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.
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.
Six rules that make coding agents reliable
- Context is a map, not an encyclopedia. Keep
AGENTS.mdorCLAUDE.mdshort and load the rest on demand. - 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.
- 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.
- Guard the boundary. "Never push to main" belongs in a hook, not in a prompt.
- 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.
- 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
- Write a short root instruction file.
- Make "done" one executable script.
- Move your top three "never" rules into hooks.
- Log every run.
Sources
- Anthropic Engineering: Effective harnesses for long-running agents, November 2025.
- OpenAI Codex team, summarized by InfoQ: OpenAI Introduces Harness Engineering, February 2026.
- Birgitta Böckeler: Harness engineering for coding agent users, martinfowler.com, April 2026.
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.