Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Explainer

Harness engineering: why the setup around a coding agent matters as much as the model

Harness engineering is designing the instructions, tests, limits and feedback loops a coding agent works in: what OpenAI reported, the critique, where to start.

By 6 min read
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
Quiz at the end
On this page

Harness engineering is the work of designing the environment a coding agent operates in, so that it can do reliable work for long stretches without a person correcting every step. The model writes the code. The harness is everything around it: the instruction files it reads, the tests and linters that tell it when it is wrong, the rules about what it may touch, the sandbox it runs in and the logs it can query. When an agent keeps making the same mistake, harness engineering treats that as a missing piece of the environment rather than a reason to write a longer prompt.

The term took off after an OpenAI post on 11 February 2026. The glossary entry agent harness defines the thing itself; this page is about the discipline, what the evidence for it is, and how to apply it to a repository you already have. Sources were checked on 25 November 2026.

What OpenAI reported

In “Harness engineering: leveraging Codex in an agent-first world”, Ryan Lopopolo describes an internal product that a small team built with “no manually-written code”. Engineers steered and Codex wrote everything. The post reports:

  • about one million lines of code and about 1,500 merged pull requests over five months, starting in late August 2025;
  • three engineers at first, growing to seven, at about 3.5 pull requests per engineer per day;
  • single Codex runs sometimes working on one task for more than six hours;
  • an estimate that the work took about a tenth of the time hand-writing it would have.

The summary line is “Humans steer. Agents execute.” The interesting part is what the team had to build to make that true.

The parts of a harness

The post’s practices fall into five parts. Each maps to something you can set up on your own repository, and most have a page on this site.

Part What OpenAI did What it looks like for you
Instructions A short AGENTS.md, about 100 lines, that acts as “a map, not a 1,000-page instruction manual”, pointing to a structured docs/ folder A useful AGENTS.md, plus Agent Skills for procedures that load only when needed
Feedback Tests, custom linters and structural tests whose error messages tell the agent how to fix the problem Fast test and lint commands the agent can run, with failures that say what to change
Constraints Fixed architectural layers with enforced dependency directions Lint rules and type checks in CI, plus permission rules and sandboxes for what the agent may run
Observability An isolated app instance per worktree, with logs, metrics and traces the agent queries Local logs and a way to run the app, so the agent can check behaviour and not only compile
Clean-up Background agents that scan for drift from “golden principles” and open small refactoring pull requests A scheduled agent task, reviewed like any other change

Two lines from the post explain why the parts matter. On knowledge: anything the agent “can’t access in-context while running effectively doesn’t exist.” A decision made in a chat thread is invisible to it, so the team moved that knowledge into versioned files in the repository. On control: “By enforcing invariants, not micromanaging implementations, we let agents ship fast without undermining the foundation.”

The clean-up part is the one most teams skip. Agents copy existing patterns, including bad ones, and drift builds up. Before the team automated clean-up, the post says, engineers spent every Friday, about a fifth of the week, removing what they called “AI slop”.

The critique

Birgitta Böckeler’s response on martinfowler.com, “Harness engineering: first thoughts” (17 February 2026), is the useful counterweight. She likes the word, “the tooling and practices we can use to keep AI agents in check”, and agrees that treating each agent failure as a signal to improve the harness is practical. Her reservations:

  • Behaviour is not checked. “What I am missing in the write-up is verification of functionality and behaviour.” Most of the measures protect internal quality, not whether the product does the right thing.
  • Old codebases are harder. Retrofitting a harness onto a non-standardised, high-entropy codebase may not be worth the effort.
  • The source has an interest. OpenAI has “a vested interest in us believing in AI-maintainable code.”
  • It is real work. What OpenAI describes is “much more work than just generating and maintaining a bunch of Markdown rules files.”

She groups the parts into three: context engineering, architectural constraints and “garbage collection”. That grouping is a good way to audit your own setup.

Our position

The core idea holds up and is useful well below OpenAI’s scale: when an agent fails, fix the environment so the same failure cannot recur, and prefer checks the agent can run over instructions it has to remember. That is the same lesson as context engineering, extended from what the model sees to what it can verify.

The headline numbers are a vendor’s report about its own product, built greenfield by a team that controlled every convention. Do not plan your team’s capacity on them. And Böckeler’s first point is the one to act on: a harness made only of linters and structural tests keeps the code tidy while the feature is wrong. Behavioural tests, and evaluating agents on your own repository, have to be part of it.

This applies most to teams that hand coding agents multi-hour or unattended work. If you use an agent for short, supervised edits, a decent AGENTS.md and a fast test command get you most of the benefit.

Where to start on an existing repository

  1. Write the map. A short AGENTS.md, the open format now stewarded by the Agentic AI Foundation, with the commands to build, test and lint, the layout, and links to deeper docs. Delete anything the agent can find by reading the code.
  2. Make failure loud and specific. Check that one command runs the tests the agent needs, finishes in minutes, and prints errors a newcomer could act on.
  3. Turn repeated review comments into checks. If you have written the same review comment three times, it belongs in a lint rule, a test or a skill, not in your head.
  4. Bound what the agent can do. Permission rules, an OS sandbox or a container, and a human checkpoint before anything leaves the repository. Claude Code auto mode shows how one product draws that line.
  5. Give it eyes. A way to run the app locally and read its logs, so the agent can check behaviour rather than guess.
  6. Schedule the clean-up. A recurring agent task that looks for drift and opens small pull requests, reviewed like any other change.
  7. Measure. Run a fixed set of real tasks before and after each harness change, and keep the change only if results improve.

Next steps

Covers

Check your understanding

Harness engineering quiz

What a harness is, OpenAI's report and its five parts, the martinfowler.com critique, how much weight the numbers deserve and where to start on an existing repository.

8 questions · pass mark 70%

Question 1 of 80 answered
  1. An agent keeps making the same mistake in your repository. What does harness engineering tell you to do?
Back to top