How OpenAI’s Harness Engineering Template Enables Self‑Improving AI Code Generation
OpenAI’s internal team built a million‑line codebase in five months without a single human‑written line by using Codex agents, structuring the repository as a rule‑enforced environment, and iteratively automating testing, review, and maintenance to let AI drive the entire software development lifecycle.
Project initialization
The team started from an empty Git repository. The first commit was produced entirely by the Codex CLI using GPT‑5; even the AGENTS.md file that describes the agents was generated by the model.
Scale and throughput
After five months the repository contained roughly one million lines of code covering application logic, tests, CI configuration, documentation, and internal tools.
Approximately 1,500 pull requests were processed.
Initially three engineers handled an average of 3.5 PRs per engineer per day; the team later grew to seven engineers while throughput continued to increase.
Human role
Human effort was limited to designing the environment, specifying intent, and constructing feedback loops. All code generation, testing, fixing, and most review steps were performed by AI agents.
Early bottlenecks and environment redesign
Early progress was slow because the environment lacked tooling and abstractions. The team replaced a monolithic AGENTS.md with a concise map that points to a structured docs/ directory, allowing agents to discover information incrementally.
Automated testing infrastructure
When code generation outpaced manual QA, the bottleneck shifted to testing. The repository was integrated with git worktree so that each change could launch an isolated instance. Chrome DevTools Protocol was added to give agents the ability to capture DOM snapshots, screenshots, and navigation events. Logs and metrics were exposed via LogQL and PromQL, enabling agents to query logs ( LogQL) and metrics ( PromQL) directly. Agents routinely ran for six + hours on a single task, effectively working overnight.
Architectural invariants via linters
To keep the codebase coherent, the team encoded architectural invariants as custom linters and structural tests rather than relying on documentation alone. Enforced rules included fixed dependency directions, strict layer boundaries, naming conventions, file‑size limits, and structured‑log naming. Violations triggered automated fix pull requests that agents could apply without human intervention.
Pull‑request lifecycle acceleration
AI agents generated PRs, performed self‑review, invoked other agents for additional review, responded to feedback, and iterated until all reviewers were satisfied. Most review steps became agent‑to‑agent; human review was required only for critical judgments. This dramatically shortened PR lifecycles and turned failures into learning signals that were recorded, analyzed, and turned into new rules.
Managing technical debt and entropy
Full autonomy introduced drift as agents replicated undesirable patterns. The team encoded “golden principles” in the repository and scheduled periodic cleaning tasks. A background agent scans for drift, updates quality grades, and opens targeted refactoring PRs that are reviewed and merged within minutes, acting like a garbage‑collection process for technical debt.
Environment versus model fine‑tuning
All rules live in the repository, so switching from GPT‑4 to GPT‑5 retains constraints and historical lessons without retraining. Expensive models are used to establish rules; cheaper models execute them, reducing ongoing compute costs.
Repository contents
The public implementation is available at https://github.com/lopopolo/harness-engineering. Key components include: AGENTS.md – a ~100‑line map that routes tasks to deeper resources. docs/ – a structured knowledge base that provides incremental disclosure of specifications. evals/ – scripts that implement the custom linters and structural tests. playbooks/ – concrete task execution guides used by agents.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
