Series: Harness Engineering (2/3)

← Harness Engineering: The Model Isn't Dumb, It Just Lacks Human Guidance Harness Engineering (3): Industry Consensus, Four Pillars, and a Three-Phase Rollout →
Table of Contents

Part 1 laid out the concept of Harness Engineering: an AI Agent = language model + Harness, and when an Agent underperforms, the problem isn’t necessarily the model — it may just be a poorly designed harness.

But concepts are one thing. What does “designing the harness” actually look like? What do engineers concretely do? This post starts with a real, scaled-up experiment and examines what Harness Engineering looks like in a production environment.

An experiment designed to be extreme

In February 2026, OpenAI published a blog post titled “Harness engineering: leveraging Codex in an agent-first world.” It’s a process log of building an internal product from scratch using Codex Agent.

The rules were set to be extreme on purpose: no human is allowed to write a single line of code. Application logic, tests, CI config, API docs, internal tooling, observability stack — all produced autonomously by Codex. Engineers did exactly one thing: design the agent’s working environment.

Five months later, the numbers look roughly like this:

MetricData
Development window5 months
Starting team3 engineers
Later team7 engineers
Code volume~1M lines
Human-written code0 lines
PRs merged~1,500
PRs per person per day3.5
Efficiency vs. traditional~10x

A three-person team, each merging 3.5 PRs per day, finishing in five months what would traditionally require 20–30 engineers.

Looking at the numbers alone easily turns this into an arms race, but what really deserves attention is the counterintuitive phenomena that showed up during the process — and how OpenAI used engineering means to suppress them.

Why doesn’t adding people slow things down?

Here’s the first counterintuitive point. When the team expanded from 3 to 7, throughput didn’t drop — it kept increasing. This directly violates one of software engineering’s most famous laws — Brooks’s Law: “Adding manpower to a late software project makes it later.”

The root of Brooks’s Law is communication cost. In traditional development, every added person creates N-1 more communication channels; behind each channel is code-level coupling — “the interface I wrote and the way you call it need to align,” “I changed the schema and need to tell you.” More people, more noise.

The reason Harness Engineering can sidestep this law is that the coupling point has moved:

  • Traditional development: coupling lives between “my code” and “your code”
  • Harness development: coupling lives between “the environment constraints I designed” and “the environment constraints you designed”

Environment-constraint coupling is naturally sparser than code coupling — everyone is editing rules and docs, not the same user_service.py. The marginal cost of adding people is much lower. This also explains why OpenAI dared to expand later: an extra engineer contributes not 3.5 PRs of execution, but 3.5 PRs of environment design capacity.

Why doesn’t the Agent naturally collapse?

The second counterintuitive point is more critical. One million lines of code, all produced by a statistical model with no memory, no taste, and reading its context from scratch every time — in theory this should be a disaster: style drift, reinvented wheels, accumulating random tech debt.

Agents do have this tendency. OpenAI’s team found that left unattended, Codex might implement the same feature three different ways, log in five different formats, write tests in wildly varying styles. But rather than resorting to “fix it with human Review” — impossible at 3.5 PRs per person per day — they asked a more fundamental question:

What capabilities (tools, abstractions) are needed, and how do we make them legible to the Agent?

This question is the thinking origin of the entire Harness Engineering methodology. It pulls engineers out of the bottomless pit of “let’s try harder to coach the Agent” and replaces it with an actionable engineering question: What’s missing in your environment such that the Agent can’t converge to the right direction on its own?

Follow that question, and five engineering practices naturally emerge.


Practice 1: Make the App Legible to the Agent (Application Legibility)

The problem

An Agent can write JSX correctly, but it can’t tell whether the rendered button is misaligned, the color is wrong, or the click feels laggy. It can write API handlers, but it can’t see the latency or the occasional 500 when the handler runs.

In traditional development, this is human work — an engineer opens the browser and eyeballs it, QA clicks through manually, issues surface later. But if an Agent runs hundreds of tasks a day and a single task might span 6+ hours, “human eyeballs” can’t keep up.

More critically: if the Agent can’t see the effects of its own output, it doesn’t know it made a mistake, and has no way to self-correct. No observation, no feedback. No feedback, no convergence.

The solution

OpenAI let the Agent “grow eyes” of its own by doing three things:

Git Worktree integration. Every time Codex needs to verify a change, it can spin up a full application instance in an isolated worktree, without stepping on other in-flight PRs. This turns “run it and see” into an atomic operation — the Agent doesn’t need to compete with other tasks for the environment.

Wire up Chrome DevTools Protocol (CDP). Codex gets browser control — it can screenshot, read DOM snapshots, simulate clicks, and simulate navigation. From this moment on, the Agent isn’t just writing UI code; it can open the page to confirm rendering, reproduce user-reported bugs itself, and attach demo videos to the PR.

Local observability stack. A full logs + metrics system is deployed. The Agent can query logs with LogQL and metrics with PromQL. When something breaks, it doesn’t wait for a human to tell it — it reads the trace itself.

Stack the three capabilities together, and the Agent’s workflow shifts from “blindly write code and hand it to a human” to a complete loop:

Write code → Run it → See the result (screenshot / logs / metrics)
   → Notice something's off → Fix it → Run again

This is the prerequisite for Codex being able to work on a single task for over 6 hours continuously. It usually happens while humans sleep — engineers dispatch tasks at night, collect PRs in the morning. Without Application Legibility, this kind of asynchronous collaboration would be impossible.

The takeaway for teams that aren’t OpenAI

Most teams don’t have Codex, but the core of this practice transfers: for any task you want an Agent to complete autonomously, first ask “can the Agent see the outcome of this task?” If the answer is no, no matter how good your prompt is, the Agent will remain stuck in blind-write mode.

Wiring the Agent to a Puppeteer MCP, giving it an environment where it can curl a health-check endpoint, granting it permission to read log files — these all count as minimum viable versions of Application Legibility.


Practice 2: The Repo as Single Source of Truth (Repo as Record)

The problem

Agents have no memory. Every new session, its understanding of the project starts from zero. The naive instinct is: just write an ultra-long AGENTS.md and cram architecture, conventions, decisions, history all in there, so the Agent absorbs it at the opening of every session.

OpenAI explicitly rejected this. They tried it. It performed poorly. Three reasons:

  1. Context crowding. A multi-thousand-line instruction file consumes a huge chunk of the context window, leaving less room for “actual work.” Combined with the sweet spot mentioned in the previous post, an oversized AGENTS.md pushes the Agent straight into the Dumb Zone.
  2. Docs rot. Code changes; instruction files don’t get maintained. Three months later, what the doc says and what the repo actually looks like no longer match, and the Agent gets misled by reading it.
  3. Hard to verify compliance. How do you confirm the Agent actually followed the rules in the doc? There’s no mechanism to guarantee it.

The solution: map mode

OpenAI’s alternative treats AGENTS.md as a map, not an encyclopedia. The whole file is about 100 lines and does one thing: tells the Agent “if you want X information, look in Y directory.”

AGENTS.md (~100 lines)
├── Project overview: one sentence describing what this is
├── Architecture entry: points to docs/architecture/
├── Design docs: points to docs/design/
├── Coding conventions: points to docs/conventions/
├── Execution plans: points to docs/plans/
└── References: points to docs/reference/

Specific knowledge lives in a structured docs/ directory, with each category having a clear update cadence and stability level:

TypeContentCharacteristic
Architecture docsSystem architecture, module boundariesStable, rarely changes
Design docsDesign proposal per featureHas status (Draft / Approved / Implemented)
Execution plansCurrent sprint task listFrequently updated
Product specsFeature requirements and acceptance criteriaSynced with PM
Reference docsAPI contracts, error codes, data modelsAuto-generated

This pattern is called Progressive Disclosure: the Agent starts from a stable entry point and pulls in information on demand, rather than being drowned in a wall of instructions upfront.

A self-referential maintenance mechanism

There’s one detail worth calling out separately. OpenAI runs a doc-gardening Agent on a schedule, dedicated to scanning and cleaning up stale docs — comparing docs against actual code, finding out-of-date sections, and producing update PRs.

This is a self-referential system: using an Agent to maintain the docs that other Agents read. Its significance is putting the docs themselves into the “mechanized execution” loop, rather than relying on human diligence to update them. This is a recurring pattern in Harness Engineering: automate whatever maintenance you can, or the system will rot.


Practice 3: Replace Code Review with Architectural Constraints

The problem

One million lines of code, five months, 3.5 PRs per day. Maintaining style consistency the traditional way — Code Review — is impossible. The manpower arithmetic simply doesn’t work.

But a codebase without Review becomes a junkyard fast. So OpenAI flipped the approach: don’t rely on review, rely on constraints. Let the Agent only run inside a fixed “lane” — if it drifts, CI blocks it directly.

Means 1: Strict layered architecture

Each business domain is forced into six layers, with dependencies strictly one-way:

Types → Config → Repo → Service → Runtime → UI

Upper layers may reference lower layers; the reverse is forbidden. If the Agent writes UI code that directly calls the Repo layer, CI turns red and the PR can’t merge.

This level of strictness is hard to enforce on human teams — someone always says “let me bend it just this once, I’ll clean up later.” But the Agent doesn’t complain, doesn’t cut corners, doesn’t make verbal promises to pay down tech debt. If CI fails, it fixes; if it still fails, it fixes again. This is a unique advantage Agents have over humans: their tolerance for mechanical constraints is infinite.

Means 2: Providers pattern

Cross-cutting concerns (auth, telemetry, logging, error handling) aren’t allowed to be imported ad hoc — they can only be injected through a unified Provider interface:

// ✅ Correct
const auth = useProvider('auth');

// ❌ Wrong
import { getSession } from '../auth/session';

This ensures each cross-cutting concern has a single entry point. Without this constraint, the Agent would end up producing five different auth-handling styles across modules — because each time it starts from scratch and reinvents.

Means 3: Custom linters, where error messages are prompts

This is the single highest-leverage insight in Harness Engineering. It deserves standalone emphasis.

OpenAI had Codex generate a suite of custom linters — enforcing structured logging, naming conventions, file size limits, cross-layer dependency bans, etc. But the key point is that every linter error message directly contains the fix instruction:

ERROR: File exceeds 300 lines limit.
FIX: Split into smaller modules. Move helper functions to utils/.
     See docs/conventions/file-size.md for guidelines.

When the Agent hits this error, it doesn’t need any extra context — it knows how to fix it. Every linter rule you write is, in essence, an auto-triggered prompt.

If you internalize this observation, a lot of things change. Traditionally, linters are “tell the human what’s wrong” tools — the shorter the message the better, since humans go look things up themselves. But in an Agent-first world, linters become “teach the Agent to do the right thing” tools — the more specific and how-to-flavored the message, the lower the Agent’s fix cost.

The linter upgrades from a validation tool to a teaching tool — a shift you rarely see in traditional software engineering.


Practice 4: High Throughput Rewrites the Merge Philosophy

The problem

When Agent output speed vastly exceeds human review capacity, the traditional PR flow becomes the bottleneck. Write code → open PR → wait for Review → fix → wait again → merge; the full lifecycle can be two or three days. At 3.5 PRs per day per Agent, a 2–3 day PR cycle makes the backlog grow exponentially.

The core logic shift

OpenAI’s response is blunt: lower the merge threshold, accept a higher correction frequency.

The cost calculation behind this has changed:

In a system where Agent output vastly exceeds human attention, the cost of waiting is higher than the cost of correcting.

Concrete practices:

  • Shorten PR lifecycle: all automated tests pass + CI green = mergeable. No unnecessary human blocking gates.
  • Flaky tests don’t block: reruns solve them, don’t indefinitely block merges.
  • Fast rollback beats strict review: if something breaks, open a follow-up PR to fix, rather than trying to prevent every possible issue before merge.

This resembles Google’s Trunk-Based Development, but more extreme — because the “author” of the code is a callable-anytime Agent, the marginal cost of a fix is nearly zero. The traditional “think twice before merging” caution exists because fixing bugs consumes precious human engineering time. When that cost trends to zero, the optimum for merge policy shifts accordingly.

This isn’t “lowering quality” — it’s a different quality assurance strategy

It’s easy to misread this as “OpenAI trading quality for speed.” That’s not what’s happening. Quality assurance has been moved from human review before merge to mechanical checks before merge (CI + linters + architectural constraints) + fast rollback after merge. The former is a gate; the latter is a loop. They chose the loop because loops scale. Gates don’t.


Practice 5: Background Cleanup, Fighting Entropy

The problem

Fully autonomous Agents introduce “drift.” Over time, the codebase accumulates inconsistent styles, redundant utility functions, stale comments, duplicate implementations — this isn’t a bug, it’s entropy. Like an untended house: nothing broke, but the whole thing gets messier over time.

Agent-generated code is worse on this front than human-written code. LLMs have a tendency to reinvent the wheel every time, because they don’t proactively search “has this utility already been written?” Anthropic assigned a dedicated “dedup Agent” in their C compiler project precisely because of how often this happens.

The solution: translate subjective taste into mechanical rules + background cleanup

OpenAI works in two steps.

Step one: translate subjective code taste into mechanically executable rules:

Subjective ruleMechanized translation
”Code should be concise”Single function ≤ 30 lines
”Don’t reinvent the wheel”Prefer existing tools in shared/utils/
”Names should be meaningful”Function names start with verbs, variable names are noun phrases
”Error handling should be standardized”All errors must be reported via ErrorProvider

Subjective rules can’t be validated by CI; mechanized rules can. One of the core ongoing tasks in Harness Engineering is: continuously translating the former into the latter.

Step two: periodically run dedicated background cleanup Agents — scan for spots drifting from convention → produce refactor PRs → automatically run tests to verify refactor safety → submit for review. These Agents don’t write new features; they clean up.

OpenAI used a memorable analogy:

Tech debt is like a high-interest loan — you should make small, frequent payments rather than accumulating and paying painfully later.

The traditional team’s approach is “let it slide, we’ll do a big refactor when we have time” — and “when we have time” never comes. The Harness approach automates “paying it down” into a daily background task, so the debt never accumulates to the point where a major refactor becomes necessary.


End-to-End Autonomous Flow: Agent from Tool to Colleague

Stack the five practices together, and OpenAI implemented a complete end-to-end autonomous feature development flow:

graph TD
    A["Verify current codebase state"] --> B["Reproduce bug and record video"]
    B --> C["Implement fix"]
    C --> D["Start app, self-verify"]
    D --> E["Record demo video"]
    E --> F["Open PR, respond to review feedback"]
    F --> G["Detect and fix build failures"]
    G --> H{"Can it resolve itself?"}
    H -->|Yes| I["Merge changes"]
    H -->|No| J["Hand off to human"]
    J --> I

Note the second-to-last step: “Hand off to human only when necessary.” Humans aren’t reviewers of every PR — they’re the safety net when the Agent gets stuck.

If you covered up the “author” field, you’d have a hard time telling this flow apart from a senior engineer’s daily work.


The real shift: discipline has moved

Looking back at the five practices, you’ll notice a common thread: none of them are “make the Agent smarter” tricks. They’re “make the environment better at hosting the Agent” designs. The engineer’s center of gravity has fundamentally shifted.

OpenAI’s blog post ends with a line worth writing down:

The discipline required in software engineering is no longer expressed in the code itself, but in the supporting structures, tools, abstractions, and feedback loops.

Previously, “a disciplined engineer” meant: writes clean code, covers tests thoroughly, updates docs on time, writes clear PR descriptions. These are individual-level disciplines, transmitted and maintained through Code Review.

Now, “a disciplined engineer” means: designs tight architectural constraints, covers comprehensive linter rules, maintains fresh doc structures, closes feedback loops fast. These are system-level disciplines, realized through environment design.

Code quality has moved from “personal virtue” to “system property” — like how quality in a modern factory doesn’t depend on how skilled a specific worker is, but on how precisely the production line is designed.

What does this shift mean for engineers’ careers? Both a challenge and an opportunity. Those who truly understand “engineering” — rather than just being good at “coding” — become more valuable, not less. Because in a world where every Agent can write code, “knowing what to write” and “knowing how to make sure it’s written right” are the truly scarce skills.


The concept and OpenAI’s benchmark case are both clear now. The next question: if I’m not OpenAI and I don’t have Codex, how does this methodology land on my project? The next post shifts to an industry-wide lens: the four typical Agent failure modes, the 40% context sweet spot, the four-pillar framework that has emerged across teams, and a three-phase rollout roadmap from “start this afternoon” to “fully automated in two weeks.”

References

Ask this article

Answers come from this article only. Click any prompt below or open the chat at the bottom right.

🇺🇸 English

Part one of this series laid out the concept: an AI agent equals a language model plus a harness. When an agent underperforms, the problem often isn't the model — it's a poorly designed harness. But concepts are one thing. What does designing the harness actually look like in practice? For that, we have a real experiment at scale.

In February 2026, OpenAI published a piece called "Harness engineering: leveraging Codex in an agent-first world." The rules were extreme on purpose: not a single line of code written by a human. Application logic, tests, CI config, API docs, tooling, observability — all produced autonomously by Codex. Engineers did exactly one thing. They designed the agent's working environment.

Five months later, here's what happened. A team that started at three engineers and grew to seven. Around one million lines of code. Zero written by humans. Roughly fifteen hundred pull requests merged. Three and a half PRs per person per day. Something like ten times the efficiency of traditional development. A team of three or seven, finishing in five months what would traditionally require twenty to thirty engineers.

The numbers make it easy to frame this as an arms race, but what really deserves attention is the counterintuitive stuff that happened along the way.

Here's the first surprise. When the team grew from three to seven, throughput didn't drop. It kept climbing. That directly violates one of software engineering's most famous laws — Brooks's Law: adding manpower to a late software project makes it later. Brooks's Law is really about communication cost. Every added person creates more channels, and behind each channel is code-level coupling. My interface has to align with your call site. I changed the schema, I need to tell you. More people, more noise.

Harness engineering sidesteps that because the coupling point has moved. In traditional development, coupling lives between my code and your code. In harness development, coupling lives between the environment constraints I designed and the environment constraints you designed. Environment-constraint coupling is naturally sparser. Everyone edits rules and docs, not the same user service file. So the marginal cost of adding people is much lower. An extra engineer contributes three and a half PRs of environment design capacity, not just execution.

Second surprise, and this one's more critical. One million lines of code, all produced by a statistical model with no memory, no taste, reading its context from scratch every time. In theory, that should be a disaster — style drift, reinvented wheels, tech debt piling up randomly. And left unattended, that's exactly what Codex does. It might implement the same feature three different ways, log in five different formats, write tests in wildly varying styles.

But rather than throwing humans at review — impossible at three and a half PRs per person per day — the team asked a more fundamental question. What capabilities are needed, and how do we make them legible to the agent? That question is the thinking origin of the whole methodology. It pulls engineers out of the bottomless pit of trying to coach the agent harder, and replaces it with an engineering question you can actually act on: what's missing in your environment such that the agent can't converge on its own?

Follow that question, and five practices fall out.

Practice one — make the app legible to the agent. An agent can write JSX correctly, but it can't tell if the button is misaligned, the color is wrong, or the click feels laggy. It can write API handlers, but it can't see the latency or the occasional five hundred error. Traditionally, that's human work. But if the agent runs hundreds of tasks a day and a single task might span six hours or more, human eyeballs can't keep up. And more critically: if the agent can't see the effects of its own output, it doesn't know it made a mistake, and it can't self-correct. No observation, no feedback. No feedback, no convergence.

OpenAI let the agent grow its own eyes three ways. First, git worktree integration — every time Codex needs to verify a change, it spins up a full application instance in an isolated worktree, without stepping on other in-flight PRs. Second, they wired up the Chrome DevTools Protocol so Codex can screenshot, read DOM snapshots, simulate clicks, and navigate. The agent isn't just writing UI code anymore — it can open the page, confirm rendering, reproduce user-reported bugs itself, even attach demo videos to the PR. Third, a local observability stack. The agent can query logs with LogQL and metrics with PromQL. When something breaks, it doesn't wait for a human — it reads the trace itself.

Stack those together and the workflow becomes a loop: write code, run it, see the result — screenshots, logs, metrics — notice something's off, fix it, run again. That's the prerequisite for Codex working on a single task for over six hours continuously, usually while humans sleep. Engineers dispatch at night, collect PRs in the morning. Without this legibility, that asynchronous collaboration wouldn't exist.

For teams that aren't OpenAI, the transferable core is this. For any task you want an agent to complete autonomously, ask first — can the agent see the outcome of this task? If not, no matter how good your prompt is, the agent stays stuck in blind-write mode. Wiring an agent to a Puppeteer MCP, giving it an environment where it can curl a health check, letting it read log files — those are minimum viable versions.

Practice two — the repo as single source of truth. Agents have no memory. Every new session starts from zero. The naive instinct is to write an ultra-long AGENTS.md that crams architecture, conventions, decisions, and history all in one place. OpenAI tried it. It performed poorly. Three reasons. First, context crowding — a multi-thousand-line instructions file eats a huge chunk of the context window, leaving less room for actual work, pushing the agent past its sweet spot into the dumb zone. Second, docs rot. Code changes, docs don't get maintained, and three months later the doc and the repo don't match. Third, there's no way to verify the agent actually followed the rules.

Their alternative is what they call map mode. AGENTS.md is a map, not an encyclopedia. The whole file is about a hundred lines and does one thing — tells the agent, if you want X information, look in Y directory. The specific knowledge lives in a structured docs folder. Architecture docs, stable, rarely change. Design docs, one per feature, with status like draft, approved, implemented. Execution plans, current sprint tasks, frequently updated. Product specs synced with PM. Reference docs like API contracts and error codes, auto-generated.

This pattern is called progressive disclosure. The agent starts from a stable entry point and pulls in information on demand, rather than drowning in a wall of instructions upfront.

There's one detail worth calling out separately. OpenAI runs a doc-gardening agent on a schedule, dedicated to scanning and cleaning up stale docs — comparing them against actual code, finding out-of-date sections, and opening update PRs. That's a self-referential system: using an agent to maintain the docs that other agents read. The docs themselves become part of the mechanized loop, rather than depending on human diligence. This is a recurring pattern in harness engineering — automate whatever maintenance you can, or the system rots.

Practice three — replace code review with architectural constraints. One million lines, five months, three and a half PRs per day. Maintaining consistency the traditional way, with code review, is impossible. The manpower math doesn't work. But a codebase without review becomes a junkyard fast. So OpenAI flipped it. Don't rely on review, rely on constraints. Let the agent only run inside a fixed lane — if it drifts, CI blocks it directly.

First means: strict layered architecture. Each business domain is forced into six layers — types, config, repo, service, runtime, UI — and dependencies are strictly one-way. Upper layers can reference lower layers, never the reverse. If the agent writes UI code that directly calls the repo layer, CI turns red and the PR can't merge. That level of strictness is hard on human teams — someone always says "let me bend it just this once." But the agent doesn't complain, doesn't cut corners, doesn't make verbal promises about tech debt. CI fails, it fixes. Still fails, it fixes again. That's a unique advantage agents have over humans — infinite tolerance for mechanical constraints.

Second means: the providers pattern. Cross-cutting concerns like auth, telemetry, logging, and error handling can't be imported ad hoc. They can only be injected through a unified provider interface. So instead of importing getSession directly from an auth session file, you call useProvider auth. That guarantees each cross-cutting concern has a single entry point. Without this, the agent ends up producing five different auth-handling styles across modules, because it reinvents each time.

Third means, and this is the single highest-leverage insight in harness engineering. OpenAI had Codex generate a suite of custom linters — structured logging, naming conventions, file size limits, cross-layer dependency bans. But the key point is that every linter error message directly contains the fix instruction. So instead of just "file exceeds three hundred lines limit," the message says: split into smaller modules, move helper functions to utils, see this specific convention doc for guidelines. When the agent hits that error, it doesn't need extra context — it knows how to fix it.

Every linter rule you write is, in essence, an auto-triggered prompt. If you internalize that, a lot of things change. Traditionally, linters are "tell the human what's wrong" tools — the shorter the message the better, humans go look things up. But in an agent-first world, linters become "teach the agent to do the right thing" tools — the more specific and how-to-flavored the message, the lower the fix cost. The linter upgrades from a validation tool to a teaching tool.

Practice four — high throughput rewrites the merge philosophy. When agent output massively exceeds human review capacity, the traditional PR flow becomes the bottleneck. Write code, open PR, wait for review, fix, wait again, merge. Two or three days per cycle. At three and a half PRs per day per agent, that backlog grows exponentially.

OpenAI's response is blunt: lower the merge threshold, accept a higher correction frequency. The cost calculation has changed. In a system where agent output vastly exceeds human attention, the cost of waiting is higher than the cost of correcting. Concretely: shorten PR lifecycles — automated tests pass plus CI green equals mergeable, no unnecessary human blocking gates. Flaky tests don't block — reruns solve them. Fast rollback beats strict review — if something breaks, open a follow-up PR to fix, rather than trying to prevent every possible issue before merge.

This looks like Google's trunk-based development but more extreme, because the author of the code is a callable-anytime agent. The marginal cost of a fix approaches zero. The traditional "think twice before merging" caution exists because bugs consume precious human engineering time. When that cost trends to zero, the optimum shifts.

Don't misread this as OpenAI trading quality for speed. Quality assurance has moved from human review before merge to mechanical checks before merge — CI, linters, architectural constraints — plus fast rollback after merge. The former is a gate, the latter is a loop. They chose the loop because loops scale. Gates don't.

Practice five — background cleanup, fighting entropy. Fully autonomous agents introduce drift. Over time, the codebase accumulates inconsistent styles, redundant utilities, stale comments, duplicate implementations. Not a bug, just entropy. Like an untended house — nothing broke, but everything gets messier. Agent-generated code is worse on this front than human code, because LLMs tend to reinvent the wheel every time — they don't proactively search "has this utility already been written?" Anthropic assigned a dedicated dedup agent in their C compiler project precisely because of how often this happens.

OpenAI works in two steps. Step one: translate subjective code taste into mechanically executable rules. "Code should be concise" becomes "single function no more than thirty lines." "Don't reinvent the wheel" becomes "prefer existing tools in shared utils." "Names should be meaningful" becomes "function names start with verbs, variables are noun phrases." "Error handling should be standardized" becomes "all errors reported via the ErrorProvider." Subjective rules can't be validated by CI. Mechanized rules can. Continuously translating the former into the latter is one of the ongoing core tasks of harness engineering.

Step two: run dedicated background cleanup agents on a schedule. They scan for spots drifting from convention, produce refactor PRs, automatically run tests to verify safety, submit for review. These agents don't write features — they clean up. OpenAI used a memorable analogy: tech debt is like a high-interest loan. Make small, frequent payments rather than accumulating and paying painfully later. The traditional approach is "we'll do a big refactor when we have time," and "when we have time" never comes. Harness automates the paydown into a daily background task.

Stack the five practices together and OpenAI implemented a complete end-to-end autonomous flow. The agent verifies the current codebase, reproduces a bug and records a video, implements the fix, starts the app and self-verifies, records a demo video, opens a PR and responds to review feedback, detects and fixes build failures, and only when it truly can't resolve something itself does it hand off to a human. Then merge. Note that second-to-last step. Humans aren't reviewers of every PR — they're the safety net when the agent gets stuck. If you covered up the author field, you'd have a hard time telling this flow apart from a senior engineer's daily work.

Here's the deeper shift. Look back at those five practices, and you'll notice none of them are "make the agent smarter" tricks. They're "make the environment better at hosting the agent" designs. The engineer's center of gravity has fundamentally moved. OpenAI's post ends with a line worth writing down: the discipline required in software engineering is no longer expressed in the code itself, but in the supporting structures, tools, abstractions, and feedback loops.

Previously, a disciplined engineer meant someone who writes clean code, covers tests thoroughly, updates docs on time, writes clear PR descriptions. Individual-level disciplines, transmitted through code review. Now, a disciplined engineer means someone who designs tight architectural constraints, covers comprehensive linter rules, maintains fresh doc structures, closes feedback loops fast. System-level disciplines, realized through environment design. Code quality has moved from personal virtue to system property — like how quality in a modern factory doesn't depend on the skill of a specific worker, but on the precision of the production line.

For engineers, this is both a challenge and an opportunity. Those who truly understand engineering — rather than just being good at coding — become more valuable, not less. In a world where every agent can write code, knowing what to write and knowing how to make sure it's written right are the truly scarce skills.

So here's what to hold onto. First, the coupling point has moved — from your code and my code, to your environment constraints and my environment constraints — which is why adding people no longer slows things down. Second, every linter rule is an auto-triggered prompt, and error messages in an agent-first world should teach, not just report. Third, quality assurance has shifted from gates to loops — mechanical pre-merge checks plus fast post-merge rollback — because loops scale where gates can't. The engineer's job is no longer writing the code. It's designing the conditions under which correct code emerges.

🇹🇼 中文

上一集我們聊完 Harness Engineering 的概念——AI Agent 等於語言模型加上馬具,當 Agent 表現不好,問題可能不在模型,而在馬具沒設計好。但概念歸概念,「設計馬具」到底長什麼樣子?工程師具體要做哪些事?今天這集,我們從 OpenAI 一個非常極端的實驗切入。

2026 年 2 月,OpenAI 發了一篇博文,標題是〈Harness engineering: leveraging Codex in an agent-first world〉。內容是他們用 Codex Agent 從零打造一個內部產品的完整記錄。實驗規則設定得非常刻意——人類不能寫任何一行程式碼。應用邏輯、測試、CI 配置、API 文件、可觀測性堆疊,通通交給 Codex 自主產出。工程師只做一件事:設計 Agent 的工作環境。

五個月後的數字大概是這樣:起始三個人的團隊,後期擴到七人,累積產出約一百萬行程式碼,人工手寫的部分是零,合併了大約一千五百個 PR,人均每天處理三點五個 PR,效率大約是傳統開發的十倍。三個人的團隊做了傳統至少要二三十人做的事。

單看數字容易變成軍備競賽,但這場實驗真正該關注的,是過程中兩個反直覺現象,以及 OpenAI 怎麼用工程手段把它們壓下來。

第一個反直覺點:為什麼加人不降速?團隊從三人擴到七人,吞吐量沒下降反而繼續成長。這直接違反了軟體工程界最有名的定律——布魯克斯法則:向落後的專案加人,只會讓它更落後。布魯克斯法則的根源是溝通成本,每加一個人,就多出 N 減一條溝通管道。

Harness Engineering 之所以能繞開這個定律,關鍵在於耦合點被搬家了。傳統開發的耦合,發生在「我的程式碼」和「你的程式碼」之間;Harness 開發的耦合,發生在「我設計的環境約束」和「你設計的環境約束」之間。環境約束天然比程式碼稀疏,大家改的是規則和文件,不是同一份 user_service.py。加人的邊際成本因此低很多。

第二個反直覺點更關鍵:為什麼 Agent 不會自然崩潰?一百萬行程式碼,全部由一個沒有記憶、每次都從零讀取上下文的統計模型寫出來,理論上應該災難——風格漂移、重複造輪子、隨機技術債。Agent 確實有這個傾向,如果放任不管,同一個功能可能出現三種寫法。但 OpenAI 沒有選擇靠人工 Review 修正,因為一天三點五個 PR 的節奏,人工 Review 直接崩潰。他們換了一個更根本的提問:Agent 究竟需要什麼樣的能力和抽象層,以及如何讓這個能力對 Agent 清晰可讀?

這個提問,是整個方法論的思維原點。順著它往下推,五個工程實踐就浮現出來。

第一個實踐:讓 App 對 Agent 可見,也就是 Application Legibility。Agent 能把 JSX 寫對,但它看不到渲染出來的按鈕是不是歪了、點擊是不是卡了。傳統上這靠人類肉眼檢查,但 Agent 一天跑幾百個任務、單一任務甚至持續六小時以上,人類撐不住。更關鍵的是,Agent 如果看不到自己的輸出,就沒有回饋,沒有回饋就沒有收斂。

OpenAI 做了三件事讓 Agent 長出眼睛。第一,Git Worktree 整合,讓 Agent 可以在獨立環境拉起完整應用實例,不跟其他 PR 搶資源。第二,接入 Chrome DevTools Protocol,Agent 拿到瀏覽器控制權,能截圖、讀 DOM、模擬點擊,甚至可以自己錄 demo 影片附在 PR 裡。第三,本地可觀測性堆疊,Agent 可以用 LogQL 查日誌、用 PromQL 查指標,出問題自己看 trace。三個能力疊起來,Agent 的工作模式從盲寫程式碼變成完整閉環——寫、跑、看、改、再跑。這才是 Codex 能在單一任務上持續工作六小時以上、通常在人類睡覺時間完成整批任務的前提。

對一般團隊的啟示很直接:任何你希望 Agent 自主完成的任務,先問一句「Agent 能不能看到執行結果」。答案是不能,那 prompt 寫得再好,Agent 也只會停在盲寫階段。給它接個 Puppeteer MCP、給它 curl 健康檢查的權限、讓它讀 log 檔案,這些都算最小可用版本。

第二個實踐:程式碼倉庫即唯一事實來源。Agent 沒有記憶,每次新 session 都從零開始。直覺做法是寫一份超長的 AGENTS.md 把架構、規範、歷史全塞進去。OpenAI 明確否決了這個做法,原因有三:擠占上下文、文件會腐爛、無法驗證遵守。

他們的替代方案是把 AGENTS.md 定位成地圖,不是百科全書。整份文件大約一百行,只做一件事:告訴 Agent 你想找什麼,去哪個目錄看。具體知識分散在結構化的 docs 目錄——架構文件很少改、設計文件帶狀態、執行計畫頻繁更新、參考文件自動生成。這叫漸進式披露,Agent 從穩定入口點開始,按需獲取,不會一開始就被淹沒。

還有一個很有意思的細節:OpenAI 定期跑一個叫 doc-gardening 的 Agent,專門掃描並清理過時文件、產生更新 PR。這是一個自指系統——用 Agent 來維護給 Agent 看的文件。能自動化的維護就自動化,否則系統會腐爛,這是 Harness Engineering 反覆出現的模式。

第三個實踐:用架構約束替代 Code Review。一百萬行、五個月、每天三點五個 PR,人力算術上撐不了傳統 Review。但沒 Review 的程式碼庫又會變垃圾場。OpenAI 的思路是不靠審查靠約束——讓 Agent 只能在賽道裡跑,跑歪了 CI 直接擋。

具體有三個手段。第一,嚴格分層架構。每個業務域強制分為六層:Types、Config、Repo、Service、Runtime、UI,依賴嚴格單向。上層絕對不能引用下層以外的東西。這種嚴格程度在人類團隊很難推,總會有人說「這次繞一下沒關係」。但 Agent 不會抱怨、不會走捷徑、不會累積技術債的口頭承諾。CI 不過它就改,改完再不過再改。它對機械約束的容忍度無限高,這是 Agent 相對人類的獨特優勢。

第二,Providers 模式。認證、遙測、日誌這些橫切關注點,不允許在程式碼裡隨意 import,只能透過統一 Provider 介面注入。沒這個約束,Agent 會在不同模組裡搞出五種不同的認證處理,因為它每次都從零開始重新想。

第三個手段是整段方法論裡最有槓桿的一個 insight——自訂 Linter,錯誤訊息即 Prompt。OpenAI 讓 Codex 自己產生了一套 Linter,強制結構化日誌、命名約定、檔案大小上限、跨層依賴禁令。關鍵在於,每條 Linter 錯誤訊息裡直接寫了修復指令。比方說「檔案超過三百行上限,修復方式是拆成更小模組、把 helper 函式移到 utils 目錄、詳見某某文件」。Agent 看到這種報錯不需要任何額外 context 就知道怎麼改。

你寫的每一條 Linter 規則,本質上都是一個自動觸發的 Prompt。傳統上 Linter 是「告訴人類哪裡錯了」的工具,訊息越簡短越好,因為人類會自己查。但在 Agent-first 世界裡,Linter 變成「教 Agent 怎麼做對」的工具,訊息越具體、越含 how-to,Agent 修復成本越低。Linter 從驗證工具升級成教學工具,這是傳統軟體工程幾乎不會有的角度。

第四個實踐:高吞吐量重寫合併哲學。Agent 產出遠超人類審查能力,傳統 PR 流程就成瓶頸。OpenAI 的因應方式很直接:降低合併門檻,接受更高的糾錯頻率。背後的成本計算變了——在 Agent 產出遠超人類注意力的系統中,等待的成本高於糾錯的成本。

具體做法:CI 全綠就可以合,不設不必要的人工阻塞閘門;偶發 flaky test 重跑解決,不無限期擋合併;快速回滾優於嚴格審查,出問題再開一個 PR 修就好。這跟 Google 的 Trunk-Based Development 有相似之處,但更極端,因為程式碼的作者本身是可以隨時召回的 Agent,修復的邊際成本幾乎為零。

這裡很容易被誤讀成「為了速度犧牲品質」。實際上不是。品質保證從合併前的人工審查,被搬到了合併前的機械檢查加上合併後的快速回滾。前者是 gate,後者是 loop。他們選擇後者,因為後者可以規模化,前者不行。

第五個實踐:後台清理,對抗熵增。完全自主的 Agent 會引入漂移——不一致的風格、冗餘的工具函式、過時的註解、重複的實作。這不是 bug 是熵增,就像沒人打掃的房子,不是某個東西壞了,而是整體越來越亂。Agent 在這方面比人類寫的更嚴重,LLM 有一種傾向:每次都重新發明輪子,因為它不會主動去搜「這個 utility 是不是已經有了」。Anthropic 在 C 編譯器專案裡專門派了一個去重 Agent 處理這個問題。

OpenAI 分兩步走。第一步,把主觀品味翻譯成機械規則。「程式碼要簡潔」翻成「單函式不超過三十行」;「不要重複造輪子」翻成「偏好使用 shared/utils 中的既有工具」;「命名要有意義」翻成「函式名必須動詞開頭」。主觀規則 CI 驗證不了,機械規則可以。第二步,定期跑後台清理 Agent,掃描偏離約定的地方、產生重構 PR、自動測試驗證、提交審查。

他們用了一個很傳神的類比:技術債像高利貸款,應該小額常還,而不是累積後痛苦償還。傳統團隊常說「先欠著等有空再重構」,那個「有空」永遠不會來。Harness 的做法是把還債變成自動化的日常後台任務。

把這五個實踐拼在一起,OpenAI 實現了完整的端對端自主流程:驗證當前狀態、復現 Bug 並錄影片、實施修復、啟動應用自行驗證、錄展示影片、開 PR 回應反饋、偵測並修復建置故障。能自己解決就合併,解決不了才交人工。人類不是每個 PR 的審查者,是 Agent 搞不定時的兜底者。

回頭看這五個實踐,共通點是它們都不是「讓 Agent 更聰明」的技巧,而是「讓環境更能承接 Agent」的設計。OpenAI 在博文結尾寫了一句話很值得抄下來:軟體工程所需的紀律,不再體現在程式碼本身,而是體現在支撐結構、工具、抽象和回饋迴路。

以前,有紀律的工程師意味著程式碼寫得乾淨、測試覆蓋充分、文件及時更新——這些是個人層次的紀律。現在,有紀律的工程師意味著架構約束設計得嚴密、Linter 規則覆蓋得全面、文件結構維護得新鮮、回饋迴路閉合得快速——這些是系統層次的紀律。程式碼品質從個人修養變成系統屬性,就像現代工廠的產品品質不取決於某個工人手藝多好,而是取決於生產線設計得多精密。

在一個 Agent 都會寫程式碼的世界裡,知道該寫什麼、知道怎麼確保寫對,才是真正稀缺的能力。

好,這集想留下三個核心要點。第一,Harness Engineering 之所以能繞開布魯克斯法則,是因為耦合點從程式碼搬到了環境約束,加人的邊際成本因此變低。第二,Application Legibility 是 Agent 能自主閉環的前提——看不到執行結果,Agent 就永遠停在盲寫。第三,也是最有槓桿的一點:Linter 錯誤訊息在 Agent-first 世界裡本質上是 Prompt,訊息越具體、越含修復指引,Agent 修得越好。

概念和標竿案例都清楚了,下一集我們處理最實際的問題:如果你不是 OpenAI 也沒有 Codex,這套方法論怎麼落到你的專案上?我們會拆 Agent 的四種典型翻車姿勢、上下文的 40% 甜蜜區間、業界收斂出的四大支柱,以及從今天下午就能開始的三階段落地路線圖。下集見。

Tags

Related Articles

Harness Engineering (3): Industry Consensus, Four Pillars, and a Three-Phase Rollout

Distilling Harness Engineering from concept and benchmark case into something you can start executing today: the four fixed failure modes of Agents, the 40% context sweet spot, the four-pillar framework the industry has converged on, and a three-phase roadmap from 'this afternoon' to 'fully automated in two weeks' — closing with six industry consensus points and three still-unsolved problems.