Skip to main content
Back to Blog
Harness EngineeringOpenAI CodexAI Coding AgentsAgent-First DevelopmentAI Agent OrchestrationDeveloper ToolsSaaS2026

Harness Engineering: How OpenAI Used Codex to Ship 1 Million Lines Without Writing a Single One

ghosty
Founder, SaaSCity
Harness Engineering: How OpenAI Used Codex to Ship 1 Million Lines Without Writing a Single One

One million lines of production code. 1,500 merged pull requests. Three engineers. Five months. Zero lines of human-written code.

That's not a thought experiment. That's what OpenAI's harness engineering team shipped using Codex between August 2025 and January 2026. And the number that actually matters isn't the million lines — it's the discipline they had to invent to make it work.

Harness engineering is that discipline. The craft of building the environment around your AI coding agent — the scaffolding, constraints, and feedback loops that turn an LLM into something that reliably ships production code rather than something that confidently breaks it.

If you're building with AI coding agents right now, you're already doing harness engineering. The only question is whether you're doing it deliberately or by accident.


What Harness Engineering Actually Is

Most AI coding discussions collapse into debates about which model is smarter. Harness engineering starts from a different premise: the model is probably fine. The environment is broken.

A harness, in OpenAI's framing, is everything that wraps the agent — tools it can call, information it can see, constraints that keep it on track, and feedback loops that tell it when it's wrong. It's distinct from two disciplines it's often confused with:

DisciplineScopeDuration
Prompt engineeringMessage qualitySingle turn
Context engineeringInformation visibilityContext window
Harness engineeringOperational worldMulti-hour autonomous execution

Martin Fowler framed it well: "Harness Engineering is a valuable framing of a key part of AI-enabled software development. Harness includes context engineering, architectural constraints, and garbage collection."

That last phrase — garbage collection — is doing more work than it looks like. Harness engineering isn't just about giving agents what they need. It's about designing systems that actively clean up what they produce over time.


The Experiment Behind the Numbers

The OpenAI team started with an empty repository and one rule: nobody writes code. Every line comes from Codex. Humans interact with the system almost entirely through prompts — describe a task, run the agent, let it open a pull request.

By the time the project reached seven engineers, throughput had settled at 3.5 PRs per engineer per day. 1,500 merged PRs total. The agent-first development experiment ran five months without a single manually-written line of source code reaching production.

The million lines of code got all the headlines. The engineers who shipped it were focused on something else entirely: four problems that emerged the moment you remove humans from the code-writing loop, and the harness patterns they built to solve each one.


The Four Problems (and Their Solutions)

Problem 1: Agents Don't Share Your Mental Model

You understand the codebase. The agent starts from scratch every time, with only what fits in its context window.

The intuitive fix — write a massive AGENTS.md with every constraint, pattern, and architectural decision — made things worse. Context is a scarce resource. A giant instruction file crowds out the task description, the relevant code, and the documentation the agent actually needs to do the work.

OpenAI's fix: shrink the map, not the territory. A 100-line document pointing to structured docs/ directories containing design decisions, specs, and reference materials. Linters verify cross-link integrity mechanically so the map doesn't rot.

The rule that emerged: "If something isn't in context at runtime, it doesn't exist for the agent." Not a guideline. An architectural constraint.

Problem 2: QA Doesn't Scale When Nobody's Watching

When engineers review every change, quality problems get caught fast. When agents generate 3.5 PRs per engineer per day, manual review becomes the bottleneck you were trying to eliminate.

The solution was building QA into the harness itself. The OpenAI team integrated Chrome DevTools Protocol so agents can take screenshots, read logs via LogQL, and query metrics via PromQL without human involvement. Concrete performance thresholds replaced subjective review — service startup must complete in under 800ms, or the automated check fails.

Human review became optional. Most review effort shifted to being handled agent-to-agent: Codex reviews its own changes locally, requests specialized agent reviews, responds to feedback from humans and other agents, and continues iterating until all reviewers approve. The team called this the "Ralph Wiggum Loop."

Problem 3: Architecture Drifts When Nobody's Enforcing It

Without human architects reviewing every PR, the dependency graph quietly deteriorates. An agent solving problem A doesn't know it's violating a pattern that matters for problem B — because that constraint isn't in its context.

The solution is mechanically enforced architecture. The OpenAI codebase uses a strict layered dependency flow — Types → Config → Repo → Service → Runtime → UI — validated by custom linters with inline fix instructions. When a violation occurs, the linter doesn't just flag it. It tells the agent exactly what to change.

Golden principles are the key abstraction: opinionated, mechanical rules encoded directly into the repository. Prefer shared utility packages over hand-rolled helpers. Validate data at system boundaries rather than probing data without checks. These aren't guidelines for humans to interpret — they're constraints the toolchain enforces automatically, every run.

Problem 4: Technical Debt Accumulates Invisibly

Human engineers notice code smells while reading code. Agents that never read beyond their current task notice nothing.

The fix: scheduled background agents that continuously scan for principle deviations and submit refactoring PRs automatically. These PRs merge without human approval. The codebase stays consistent not because someone polices it, but because the harness does.


The Self-Evaluation Problem Nobody Talks About

Two agent failure modes don't get enough attention in agent-first development conversations.

Context anxiety: as context windows fill, agents start wrapping up tasks prematurely. They haven't finished — they're running out of room and optimizing for that. The mitigation is architectural: enable large-context betas but cap actual usage significantly below the limit. This eliminates the anxiety behavior without any model change.

Self-evaluation bias: agents score their own output generously. Ask an agent to review its own PR and it will find it acceptable far more often than it deserves. The fix is separating generator from evaluator architecturally — a Planner, Generator, and Evaluator running as distinct agents, each with independent context and no shared stake in the output's quality. Anthropic's three-agent harness architecture follows the same principle for the same reason.

Both failures share a root cause: the agent is in the loop evaluating its own work. Harness engineering is, in part, the discipline of removing the agent from loops it cannot run objectively.


Build to Delete

Ryan Lopopolo of OpenAI put the core philosophy plainly: "We built Harness to provide a consistent and reliable way to run large-scale AI workloads, so teams can focus on research and product development rather than infrastructure orchestration."

But the deeper principle from the experiment is this: "The best harness components are designed to be deleted."

Every component encodes an assumption about current model limitations. The linter that enforces an architectural pattern exists because today's model can't be trusted to follow it without enforcement. The structured doc format exists because the model can't navigate free-form documentation reliably. The mandatory QA thresholds exist because the model's self-review isn't sufficient.

When models improve — and they do — those components become dead weight. The right question after every major model upgrade isn't "what can I add?" It's "what can I remove?"

That framing changes how you build. You're not building permanent infrastructure. You're building temporary scaffolding for a moving target.


What the Hacker News Thread Actually Said

When the OpenAI post hit Hacker News, the thread split predictably.

Critics went after the million-LOC metric — fair. "We've known for decades that LOC/day is a bad measure of real productivity" is a correct observation. Multiple commenters compared celebrating 1M lines to "measuring aerospace engineer productivity by mass added." One engineer from a major tech company shared that their team attempted similar approaches and found the code "an absolute mess because of vibing."

But zbrock, one of the three original engineers, was in the thread — and nobody landed a concrete accusation that the system was broken, only a suspicion that it might be.

What cut through the noise: a comment from stult that "keeping file sizes small has been important for agentic coding...to limit the amount of incidental context they load." That's the shared understanding problem from a different angle, and it's the kind of hard-won practical insight that only surfaces when someone has actually shipped something.

The community verdict: structured harness design works, LOC is the wrong metric, and the interesting question is whether agent throughput translates to business value. Nobody in the serious part of the thread argued that building the environment around the agent is the wrong move.


List Your AI Dev Tool on SaaSCity

Building a harness framework? Shipping a Codex-compatible scaffold? Running a tool that helps teams move to agent-first workflows?

SaaSCity.io is a directory for SaaS and AI tools — your listing isn't a flat static page. It's a building in an interactive 3D digital city, visible to developers, founders, and engineers actively looking for what you've built.

  • Free to list: Submit in under 2 minutes — no credit card, no catch.
  • Earn dofollow backlinks: Every listing earns high-quality backlinks that compound your domain rating over time.
  • 3D city map visibility: Your product appears in the SaaSCity engine — the most distinctive product directory in the space.
  • Reach practitioners, not window shoppers: Our audience is builders actively evaluating tools.

Submit your product →


What SaaS Builders Should Do With This

Three things worth taking seriously from the OpenAI experiment.

Your AGENTS.md is probably already too long

The first instinct when something breaks is to add more instructions. More caveats, more edge cases, more rules. The OpenAI team found this compounds rather than fixes the problem — every line you add competes with the actual context the agent needs to do the work.

The discipline is compression. Not "what should I tell the agent?" but "what's the minimum the agent needs to navigate to the right information?" A map, not a manual. The same principle applies to MCP server tool definitions for Claude Code — precise descriptions outperform verbose ones, consistently.

Mechanical enforcement beats verbal reminders

Telling an agent to follow a pattern works for one task. A linter that rejects violations works for every task, regardless of what's in context. The investment in mechanical enforcement pays recurring dividends; the investment in prompt reminders resets to zero every session.

If you're currently handling an architectural constraint with a prompt, ask whether you can handle it with a check. If you're handling it with a check, ask whether you can handle it with a linter. Keep moving down that chain.

Build for deletion, not permanence

The temptation with agent infrastructure is to make it permanent. The harness engineering mindset inverts this — build every component knowing you'll delete it when the model no longer needs the compensation it provides.

Anthropic's launch-your-agent deployment framework follows the same principle: the infrastructure handles temporary scaffolding, the agent logic handles permanent differentiation. The scaffolding is expected to shrink; the differentiation is expected to compound.


The Shift That's Already Happening

The term "harness engineering" is gaining traction because it names something that was already true but didn't have a name. The most valuable AI coding work in 2026 isn't better prompts. It's better environments.

The ratio of prompting to harness work in productive agent-first teams is shifting toward harness. The engineers getting the most out of OpenAI Codex CLI — and Claude Code, and every other AI coding agent — aren't spending their time on clever prompts. They're spending it on better maps, better linters, better evaluators, and better garbage collection.

One million lines from three engineers over five months isn't a story about how good the model got. It's a story about how good the environment they built for it was.

Build the environment.


SaaSCity.io covers AI development tools and agent-first workflows. Explore the SaaSCity directory to discover what's shipping right now — or list your own product.

Get your SaaS in front of founders

List your product on the SaaSCity live city map — a permanent listing, real discovery, and a backlink from a high-DR directory. Free to start; upgrade for a dofollow link and a building on the map.