Harness Engineering in Under 3 Mins: How to Make AI Coding Agents Reliable

October 2026 · Under 3 Mins · AI agents · Full version: Deep Dive on Medium

Two teams use the same model. One team gets an agent that ships working pull requests. The other gets an agent that deletes tests and stops halfway with "Done!". The model is identical. The difference is the harness.

What is harness engineering?

Harness engineering is the practice of designing everything around an AI model that makes an agent reliable: the agent loop, the context, the tools, the guardrails, the verification checks and the state between sessions. The model proposes actions. The harness decides what runs, what the model sees and when the work is done.

Harness engineering diagram: the AI model at the center, surrounded by the agent harness layers of context, tools, guardrails, verification, and state and observability
The model is one layer. The agent harness is everything else.

The term became common in early 2026, after OpenAI's Codex team, Anthropic and Birgitta Böckeler on martinfowler.com described how they make coding agents reliable.

The agent loop

Every agent is a small loop. The model returns text or a tool call, and the harness decides what happens next: what the model sees, which calls are allowed, where they run, how the output is trimmed and when the work is done.

Agent loop diagram: context, model, policy check, sandbox and output compression, with a verification step before the agent is done
The agent loop: one model call, five harness decisions.

Six rules that make coding agents reliable

  1. Context is a map, not an encyclopedia. Keep AGENTS.md or CLAUDE.md short and load the rest on demand.
  2. Tools are an API for a reader who cannot ask questions. Use few, sharp tools with small output and errors that say what to try next.
  3. Push rules into code. Guides steer the agent before it acts. Sensors check the result after. A rule in prose is a suggestion. The same rule as a linter is a law.
  4. Guard the boundary. "Never push to main" belongs in a hook, not in a prompt.
  5. The agent never decides that it is done. One script runs the typecheck, the tests and the user-flow tests, and it gates every final answer.
  6. State lives in files. For long tasks, keep a feature list, a progress log and git commits, so a fresh session can resume.

The steering loop

When a failure repeats, add a control: observe it, classify it, choose the layer, add the control and measure. Delete controls that newer models no longer need.

Start on Monday

Sources

This is the Under 3 Mins version. The Deep Dive on Medium has the code, five diagrams and a FAQ. Both are part of the Deep Dive and Under 3 Mins series.