Lesson 5 · Agent Orchestration

Harness Engineering: Guides, Sensors, State

You won't change the model. You will build what surrounds it.

Your win for this lesson

Given an agent failure, you can pick the harness fix (a guide, a sensor or a state file) and say whether it should be computational or inferential.

0. Warm-up

1. Idea one: the 2×2 of controls

You know guides (steer before the agent acts) and sensors (check after). Böckeler adds a second axis: what does the checking or steering?[1]

Guide (before)
Sensor (after)
Computational
Codemods (OpenRewrite), LSP / code intelligence, project templates
Tests, linters, type checker, ArchUnit structural tests, coverage
Inferential
CLAUDE.md / AGENTS.md, skills describing conventions
Review agents, LLM-as-judge

Examples from Böckeler's table.[1] The surprise is that CLAUDE.md is inferential: it's just text, so it only works if the model reads and follows it. A linter cannot be ignored.

You need both directions. Feedback alone gives an agent that keeps repeating the same mistakes; feedforward alone gives rules that nobody checks.[1] OpenAI's agent-written codebase used both: docs as the agents' source of truth (guides) plus structural tests that mechanically enforce which layer may depend on which (computational sensors).[2]

2. Idea two: the steering loop

The harness isn't designed once. When a failure happens again, change the harness, not just this one output.[1] Huntley describes the same habit as putting up signs on a playground: Ralph fell off the slide, so you add a sign that says "SLIDE DOWN, DON'T JUMP."[3]

Two practical rules:

3. Idea three: state files for fresh sessions

From Lesson 4: only what's on disk survives into a new session. Anthropic built a harness for multi-session coding around this.[4] An initializer agent runs once and creates the state; a coding agent runs every session after that and keeps it up to date:

State fileFailure it prevents
feature_list.json: 200+ features, all marked failing; agents may only flip passesDeclaring the project "done" too early. JSON was chosen because models are less likely to overwrite it wrongly than Markdown.
claude-progress.txt + git logA fresh session not knowing what happened before
init.sh: starts the app, then a basic end-to-end checkEach session wasting time working out how to run things; building on a broken state
Rule: one feature per session, then commitTrying to do everything at once, running out of context halfway

Notice that the "one feature per session" rule is a guide, the end-to-end check is a sensor, and the JSON file is state. A real harness mixes all three.


4. The harness checklist

When an agent fails, ask these questions in order:

  1. Could I prevent it before it acts? → add a guide.
  2. Can I detect it after? → add a sensor, ideally with a fix-it message.
  3. Can a program decide it, or does it need judgment? → computational if possible, otherwise inferential.
  4. Does a future fresh session need to know this? → put it in a state file or git.

5. Drill: place it in the 2×2

6. Drill: pick the fix

7. Apply it to your own repo

Pick a real project of yours, for example your Java Design-Patterns repo. Write one item for each: computational guide, computational sensor, inferential guide, inferential sensor, and one state file.

One possible answer for a Java/Gradle repo:

  • Computational guide: a project template or script that creates a new pattern's package, class and test skeleton.
  • Computational sensor: ./gradlew test run by a Claude Code hook after every edit; Checkstyle with clear messages.
  • Inferential guide: CLAUDE.md saying "one package per pattern; every pattern has a test showing its intent."
  • Inferential sensor: a review subagent asked "Does this code actually implement the pattern named, or just the name?"
  • State file: patterns.json listing each pattern with "done": false, which the agent may only flip after tests pass.

Primary source to read next (≈25 min)

Böckeler, "Harness Engineering for Coding Agent Users" (martinfowler.com). If you read it after Lesson 1, read it again now: the guides/sensors table and the "steering loop" section will make much more sense. For the long-running version, see Anthropic's "Effective harnesses for long-running agents."

Stuck or curious?

Ask me in the terminal. Good questions: "Is a Claude Code hook a guide or a sensor?" or "Review my answer to section 7." Paste your harness sketch and I'll critique it.

Quick reference: Harness Checklist · Five Zoom Levels

Sources

  1. Böckeler, "Harness Engineering for Coding Agent Users" (Apr 2026)
  2. InfoQ, on OpenAI's "Harness engineering" (Feb 2026)
  3. Huntley, "Ralph Wiggum as a 'software engineer'" (Jul 2025)
  4. Anthropic, "Effective harnesses for long-running agents" (Nov 2025)

Related ideas