daita@system:~$ cat ./harness_engineering_zero_handwritten_code.md

Harness Engineering: What OpenAI Learned Building a Product with Zero Handwritten Code

Created: 2026-04-22 | Size: 15118 bytes

TL;DR

OpenAI's engineering team built and shipped an internal product where every line of code (application logic, tests, CI, docs, and tooling) was written by Codex agents. Over five months, a team of 3-7 engineers produced ~1 million lines of code across ~1,500 merged PRs, averaging 3.5 PRs per engineer per day. The result isn't just a productivity story. It's a blueprint for how the role of software engineer is evolving: from writing code to designing environments that agents can navigate, validate, and ship in autonomously.

The term "harness engineering" was coined by Mitchell Hashimoto in early February 2026 and formalized by OpenAI's Ryan Lopopolo in the post we're unpacking here. Since then the idea has traveled fast, and the ecosystem has already moved beyond what the original post claims.

From Empty Repo to 1M Lines in 5 Months

The project started in late August 2025 with an empty git repository. Codex CLI scaffolded the first commit from templates using GPT-5. Five months later: ~1 million lines of code, ~1,500 merged PRs, and a shipped internal beta.

The team started small (3 engineers) and grew to 7. Throughput didn't just hold as the team scaled; it increased. The rule was strict: no manually-written code. Humans worked exclusively through prompts, reviews, and architectural decisions.

A note on the headline number: 1M lines of agent-generated code is not the same as 1M lines of human-written code. Agents tend toward verbosity, with more boilerplate, more explicit patterns, and less compression. The more meaningful metrics are throughput (3.5 PRs/engineer/day) and time-to-ship (~1/10th estimated hand-coding time). LOC is a vanity metric; velocity and outcomes are not.

Early progress was slow, but not because the agents couldn't write code. The environment was underspecified. Engineers hadn't yet built the scaffolding agents needed to operate effectively. Once that scaffolding existed, velocity compounded.

The Engineer's New Job: Environment Design

This is the core insight. The engineering job didn't disappear. It shifted layers. Instead of writing application code, engineers built the systems that let agents write it reliably:

  • Tooling and feedback loops: Every git worktree got its own app instance with a full local observability stack: logs via LogQL, metrics via PromQL, traces via TraceQL. Chrome DevTools Protocol was wired into the agent runtime for DOM snapshots, screenshots, and navigation. Single Codex runs regularly worked on tasks for 6+ hours, often while humans slept, turning agents into an overnight shift that produces PRs ready for morning review.
  • Structured documentation: A monolithic AGENTS.md failed immediately. It crowded out task context, made everything seem equally important, rotted instantly, and was hard to verify. The fix: a ~100-line AGENTS.md as a table of contents pointing to a structured docs/ directory with progressive disclosure.
  • Architectural invariants: Each business domain follows a strict layered model with validated dependency directions. Custom linters and structural tests enforce rules mechanically. Error messages are designed to inject remediation instructions directly into agent context.

The pattern should feel familiar if you've been following how context engineering is becoming the core competency for agent-driven development. The agent's context window is the new runtime constraint.

Agent Legibility Is the New DX

Here's the uncomfortable truth: anything not accessible in-context effectively doesn't exist for agents. Google Docs, Slack threads, tacit knowledge, tribal conventions: all invisible.

The team pushed everything into the repo: Slack decisions, architectural patterns, product principles, engineering norms. They favored "boring" technologies for composability and API stability. They sometimes reimplemented library subsets rather than depend on opaque upstream behavior the agent couldn't reason about.

This mirrors what we've seen in agent skills design: the difference between a capable agent and a useless one is almost entirely about what context it can access and how that context is structured.

Mechanical Enforcement Enables Autonomy

Constraints that feel pedantic for humans become force multipliers for agents. The team enforced architecture not through code review norms or convention, but through mechanical invariants:

  • Strict layered dependency directions per domain
  • Cross-cutting concerns enter only through explicit Provider interfaces
  • Custom linters catch violations with error messages designed as agent instructions
  • CI jobs enforce documentation freshness; a "doc-gardening" agent scans for stale content

This is the same principle behind agentic continuous delivery: give agents clear guardrails and let them move fast within them, rather than trying to micromanage each step.

The Merge Philosophy Flips

High throughput broke conventional merge practices. When you're shipping 3.5 PRs per engineer per day, blocking on test flakes or lengthy review cycles is catastrophically expensive. The team adopted a different philosophy:

  • PRs are short-lived
  • Test flakes trigger follow-up runs, not blocked merges
  • Corrections are cheap; waiting is expensive

Review itself became partially agent-driven through a "Ralph Wiggum Loop" (named for the Simpsons character's repetitive learning cadence), where agents review other agents' work. Humans intervene at the architectural and taste level, and in later conversations the team has described pushing toward essentially 0% human review on many flows.

Worth flagging the obvious caveat: recent research shows agents are systematically bad at evaluating their own output. The Ralph Wiggum Loop doesn't work because agents are good reviewers. It works because mechanical guardrails (linters, structural tests, typed invariants) catch the real failures before review ever happens. Review without those guardrails is theater.

This philosophy only works when your guardrails are strong enough to catch real problems mechanically. As we've explored in agent reliability research, agents that ace benchmarks can still fail unpredictably in production. The Harness team's answer isn't to slow down but to make the environment self-correcting so that fast iteration doesn't compound errors.

Entropy Is the Real Enemy

Full agent autonomy introduces drift. Codex replicates existing patterns, including suboptimal ones. The team initially spent 20% of the week manually cleaning "AI slop". That didn't scale.

The solution: encode "golden principles" into the repository and build recurring cleanup processes. Background Codex tasks scan for deviations, update quality grades, and open refactoring PRs. Technical debt is treated like a high-interest loan: paid down continuously, not deferred.

This is the part most teams will underestimate. Agent-generated codebases require continuous garbage collection as a first-class engineering concern, not an afterthought.

The Unsolved Half: Behavior Harness

Birgitta Böckeler (Thoughtworks, writing on Martin Fowler's site) drew the sharpest line through this work. What OpenAI demonstrated is a structural harness: constraints on how code is organized, layered, typed, and linted. What's missing is a behavior harness: a way to confidently validate that the code agents produce actually does what users need.

Böckeler also introduces a useful vocabulary: guides (feedforward controls that steer the agent before it acts, like AGENTS.md, prompts, architectural docs) and sensors (feedback controls that observe behavior after it acts, like linters, type checkers, test suites, output parsers). OpenAI's harness is strong on both for structural concerns. The gap is behavioral sensors.

Structural correctness and behavioral correctness are different problems. A codebase can pass every linter, respect every layer boundary, have perfect dependency graphs, and still solve the wrong problem. Agent-generated test suites don't close this gap, because agents that write the implementation also write the tests, and share the same blind spots.

Nobody has solved the behavior harness yet. Böckeler frames it as a collaborative industry problem: how do you evaluate harness quality end-to-end, prevent contradictory guidance signals to agents, and validate functional outcomes rather than just structural invariants? Those questions are open.

If you're adopting this playbook today, assume the structural side is mostly known and the behavioral side is still engineered by hand, via property-based tests, end-to-end user flows, canary deployments, and real production feedback. The harness won't save you there yet.

The Harness Is Also Becoming a Product

Since the original post, OpenAI shipped a follow-up: Unlocking the Codex harness. The harness isn't just an internal development approach. It's now a platform surface, the Codex App Server, a JSON-RPC-lite protocol over stdio that powers the Codex CLI, web app, macOS app, VS Code, JetBrains, and Xcode integrations from a single shared agent loop.

Three design primitives anchor the protocol: Items (typed atomic units like messages, tool calls, approvals, diffs, each with explicit lifecycle events), Turns (one unit of agent work from input to output completion), and Threads (durable containers persisting conversation history, forkable and resumable).

The interesting detail: they tried MCP first, then abandoned it for IDE integration work. MCP semantics couldn't cleanly express paused approvals, streaming workspace diffs, or richer session state. If you're building agent-integrated tooling, this is a data point worth sitting with.

The meta-lesson: once you've built a great harness, it becomes worth shipping as its own API. The harness abstraction is durable enough to outlive any single application.

What This Actually Means

OpenAI's Harness experiment isn't just a flex about productivity. It's a concrete demonstration of where software engineering is heading:

  1. Environment design > code writing: Tools, abstractions, feedback loops, and documentation are the real product.
  2. Progressive disclosure beats monolithic instructions: A short index pointing to structured docs works better than cramming everything into one file.
  3. Constraints are features: Strict invariants and mechanical enforcement are what let agents ship fast without drift.
  4. Entropy management is non-optional: Agent-generated code requires ongoing cleanup. Build it into the process from day one.

The team acknowledges open questions: long-term architectural coherence, where human judgment adds the most leverage, and how the system evolves as models improve. But the trajectory is clear. The real-world gap between benchmarks and production narrows when you invest in the environment, not just the model.

The Elephant in the Room

Let's be honest about what this is: OpenAI's own team, using their own frontier models, building an internal product with direct access to the Codex team for support. This is the best-case scenario for agent-driven development.

That said, the transferable lessons are the interesting ones. You don't need GPT-5 to benefit from structured AGENTS.md, mechanical linting with remediation-as-error-messages, per-worktree observability, or treating documentation as code. Those patterns work with Claude, with Gemini, with any capable coding agent. The model is the least durable part of this stack. The environment design is what compounds.

The structural harness is mostly figured out now: layered architectures, mechanical invariants, progressive-disclosure docs, per-worktree observability, entropy management. The hard part left is the behavior harness, proving that agent-written code actually does what users need, at scale, without relying on agents to grade their own homework. That's the next five years of engineering work. That's where the remaining job lives.


References

  1. Harness Engineering: Building a Product with 0 Lines of Manually-Written Code - Original source
  2. Unlocking the Codex harness: how we built the App Server - OpenAI follow-up on the harness-as-product
  3. Harness engineering for coding agent users - Birgitta Böckeler (Thoughtworks), on the behavior-harness gap and the guides/sensors taxonomy
  4. My AI Adoption Journey - Mitchell Hashimoto, where the term "harness engineering" was coined
  5. Extreme Harness Engineering for Token Billionaires - Latent Space interview with Ryan Lopopolo (OpenAI)
  6. Skill Issue: Harness Engineering for Coding Agents - HumanLayer on sub-agent context isolation and verification-driven dev
  7. Ralph Wiggum Loop - Agent-reviewing-agent pattern
  8. AGENTS.md - Community standard for agent documentation
  9. ARCHITECTURE.md pattern - Architecture documentation approach
  10. Codex Execution Plans Cookbook - OpenAI reference for Codex workflows
  11. Parse, Don't Validate - Type-driven design principle referenced by the team
  12. Agent Skills: The Paradigm Shift Hiding in Plain Text - Daita blog
  13. The Evolution of Continuous Delivery: Embracing Agentic Workflows - Daita blog
  14. Your LLM Scores 88% on Code Benchmarks. In Production, It Hits 30%. - Daita blog
  15. Your AI Agent Aces the Benchmark. It Still Can't Be Trusted. - Daita blog

daita@system:~$ _