Harness Engineering: Lessons from a Million-Line Codebase Written Entirely by AI Agents

    This article examines an extreme engineering experiment from an AI research team: maintaining a million-line codebase with no human-written code and no traditional code reviews. It explains the core shift from tweaking prompts to investing in infrastructure, the "ghost library" concept for structuring agent prompts, reengineering codebases and workflows around agent readability, and practical takeaways for ordinary teams adopting AI coding agents.

    1. An Extreme Experiment

    A long-form essay titled “Harness Engineering,” written by an engineer at a leading AI research organization, recently sparked wide discussion among developers. The essay describes how an internal frontier team works: they maintain a codebase of more than one million lines, and not a single line was written by a human. Before merges, there is no traditional code review by people either.

    The team’s experiment goes even further. While building and delivering an internal test product from scratch, they imposed a strict rule: human engineers are not allowed to write any code themselves — AI coding agents must do all the work, from start to finish.

    The constraint sounds almost obsessive, but it is precisely what makes the experiment valuable. Only by cutting off the human safety net does the team actually confront a crucial question: when an agent fails, what exactly is missing?

    2. The Core Shift: From Prompt-Tweaking to Infrastructure

    1. The Limits of Conventional Practice

    When most developers use coding agents and hit a failure, their typical reactions are:

    • Retrying with a different prompt.
    • Telling the agent to “be more careful” or “try harder.”
    • Stepping in and writing the difficult part themselves.

    These tactics look efficient but conceal the real problem. Iterating on prompts is essentially patching a system’s defects with a human’s tacit knowledge. Such fixes cannot be preserved, reused, or scaled.

    2. Harness Engineering’s Approach to Failure

    This team takes a different path. When an agent fails, they do not patch the prompt; instead, they trace the failure back to three structural questions:

    1. Capability gap: Which capability is the agent missing? Is it a missing tool-calling capability, or missing access to a specific runtime environment?
    2. Context gap: Which information was never provided? Project conventions, architecture decision records, or domain knowledge?
    3. Structural gap: Which layer of the codebase or workflow makes the code hard for the agent to understand or modify safely?

    Every failure is converted into a structural investment in the system: adding a context document, adding a tool the agent can call, or adjusting directory structure or validation mechanisms. Failure stops being a setback and becomes a signal for improvement.

    3. Token Consumption: A Counterintuitive View

    The author even argues that if an engineer burns fewer than a billion tokens per day, it is nearly negligent. At current market prices with cache discounts, that amounts to roughly two to three thousand dollars per day in token costs.

    The economic logic behind this view is simple: the cost of a human engineer’s time far exceeds the cost of tokens. Rather than having humans do what agents can do, people should focus on building the infrastructure that makes agents reliable. When agent parallelism is high enough and failure is cheap enough, massively parallel trial and error becomes the most effective engineering strategy.

    3. The “Ghost Library”: A World Model for Agents

    One output of the experiment is a reference implementation known as a “ghost library.” Its design philosophy is instructive.

    1. What Is a Ghost Library?

    The ghost library is not sample code for humans to read; it is a skeleton for a large orchestration system built specifically for agents. It contains a set of agent definitions that can be instantiated and composed, each fed extremely detailed prompts — detailed enough to resemble a real product requirements document (PRD) — but without directly providing the full implementation.

    This “requirements without answers” balance is critical:

    • Give too little, and agents drift from intent and produce code that cannot compose together.
    • Give too much, and agents degenerate into typists, losing the value of parallel exploration and autonomous decision-making.

    2. A Structured Agent Prompt Example

    A task description aimed at agents should roughly contain the following elements (illustrative):

    1. Task context:
    2. - The module's position and responsibility boundary within the overall system
    3. - Upstream/downstream interface contracts and data model definitions
    4. - Architectural constraints and coding standards that must be followed
    5. Acceptance criteria:
    6. - Behavior descriptions that can be verified automatically
    7. - The scope of test cases that must pass
    8. - An explicit list of "do not do" items (to prevent out-of-bounds changes)
    9. Environment information:
    10. - Available tools and commands
    11. - Index locations for relevant documents and decision records

    Note the key difference: unlike requirements documents written for humans, context for agents must be explicit, complete, and unambiguous. The tacit consensus, implicit conventions, and institutional memory that humans rely on simply do not exist for agents — everything must be externalized into structured text.

    4. Rebuilding Engineering Around Agent Readability

    This is the deepest insight of the practice: optimize the codebase, workflow, and organization around agent readability, not around human habits. What does that mean?

    1. At the Codebase Level

    • Documentation as interface: Architecture decisions, module boundaries, and domain knowledge must be stored in the repository in a form agents can consume.
    • Executable standards: Coding conventions should not just be documents; they should become lint rules, tests, and CI checks so agents can self-correct through tool feedback.
    • Atomic changes: Tasks should be split into units small enough to fit within a single agent session’s context window, avoiding implicit state that spans multiple rounds.

    2. At the Workflow Level

    • Automated verification replaces human review: Since there are no human reviews, there must be strong automated verification as a backstop — tests, static analysis, and integration checks form multiple lines of defense.
    • Observable failures: Every agent failure should be trackable and classifiable, so capability and context gaps can be continuously filled.

    3. At the Role Level

    The engineer’s role shifts from “writer of code” to:

    • Designer of the system: defining architecture, boundaries, and acceptance criteria.
    • Supplier of context: making tacit knowledge explicit and feeding it to agents.
    • Builder of infrastructure: creating the harness (the scaffolding) that lets agents work reliably.

    5. Practical Takeaways for Ordinary Teams

    Not every team needs to copy the extreme “zero human-written code” approach, but the methodology is broadly applicable:

    1. Build a failure-attribution habit: When an agent fails, ask “what capability/context/structure is missing?” rather than repeatedly tweaking prompts and hoping for luck.
    2. Invest in reusable context assets: Write project conventions, domain knowledge, and architecture decisions into agent-readable documents. These investments scale linearly with agent usage.
    3. Make verification come first: The more complete your automated tests, the more autonomy you can safely give agents. Conversely, codebases with weak verification should not be handed over to agents.
    4. Re-evaluate the cost model: When token costs are far below human time costs, “let agents run more, let humans write less” is economically sound.
    5. Start with small experiments: Try a single module where humans write only requirements and acceptance criteria while all code is produced by agents, and build intuition for the harness.

    6. Conclusion: From Copilot to Teammate

    The picture this experiment sketches is already clear: coding agents are evolving from a “copilot sitting next to you” into “teammates that can be invoked directly and entrusted with complete tasks.” As agents become teammates, the center of gravity of the engineering system tilts accordingly — who the codebase is written for, who the documentation is written for, and who the processes are designed for are all shifting toward agents.

    For developers, this is both a challenge and an opportunity. The value of writing code is declining, while the ability to define problems, construct context, and design verification systems is becoming the core competency of a new generation of engineers. Rather than worrying about whether agents will replace you, start thinking early about how to build a harness that lets agents perform at their best while keeping humans in control — that is the most important proposition this million-line experiment leaves to the industry.