Harness Engineering for Coding Agent Users

2026-05-14 · source · source ↗ · raw capture

Author: Birgitta Böckeler Published: 02 April 2026 Source: martinfowler.com

Overview

This article explores how to build confidence in AI-generated code through a systematic approach called harness engineering. Böckeler defines the harness as "everything in an AI agent except the model itself" and structures it around two complementary strategies: feedforward controls (guides) and feedback controls (sensors).

Key Formula

Agent = Model + Harness

Key Concepts

Feedforward and Feedback Controls

"Separately, you get either an agent that keeps repeating the same mistakes (feedback-only) or an agent that encodes rules but never finds out whether they worked (feed-forward-only)."

"A well-built outer harness serves two goals: it increases the probability that the agent gets it right in the first place, and it provides a feedback loop that self-corrects."

Computational vs. Inferential

Harnessability

"Not every codebase is equally amenable to harnessing." Determined by language features, architectural clarity, framework abstractions. Strongly typed languages, clear module boundaries, and structured frameworks inherently afford better agent governance.

Ambient Affordances

"Structural properties of the environment itself that make it legible, navigable, and tractable to agents operating within it" (coined by Ned Letcher).

Section Structure

  1. Feedforward and Feedback
  2. Computational vs Inferential
  3. The steering loop
  4. Timing: Keep quality left
  5. Regulation categories - Maintainability harness - Architecture fitness harness - Behaviour harness
  6. Harnessability
  7. Harness templates
  8. The role of the human
  9. A starting point — and open questions

Sidebars: Metaphors only go so far; How does harness engineering relate to context engineering?; Ambient affordances; Ashby's Law

Harness Categories Table

Direction Computational/Inferential Example
Coding conventions feedforward/Inferential AGENTS.md, Skills
Bootstrap instructions feedforward/Both Skill + script
Code mods feedforward/Computational OpenRewrite recipes
Structural tests feedback/Computational ArchUnit hooks

Three Regulation Categories

  1. Maintainability Harness: Regulates internal code quality through existing tooling — the most mature category. Tests, linters, type checkers, structural analysis.

  2. Architecture Fitness Harness: Enforces architectural characteristics and performance requirements via fitness functions. Commits to a topology to narrow the space.

  3. Behaviour Harness: Addresses functional correctness — currently the most challenging dimension. AI-generated test suites aren't trustworthy enough as the sole feedback mechanism.

Change Lifecycle Stages

The Steering Loop

Humans iteratively improve the harness by addressing recurring issues, potentially using AI itself to generate custom controls, structural tests, and documentation.

The Human Role

"A coding agent has none of this: no social accountability, no aesthetic disgust at a 300-line function."

"A good harness should not necessarily aim to fully eliminate human input, but to direct it to where our input is most important."

Developers bring implicit experience — organizational awareness, technical judgment, and accountability — that harnesses attempt to externalize.

Named Examples

Open Questions

Actionable Recommendations

Key Concept: Ashby's Law

Referenced in sidebar — the law of requisite variety: a controller must have at least as much variety as the system it regulates.