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]
- Computational controls are a deterministic program, fast and cheap enough to run on every change: tests, linters, type checkers, codemods.
- Inferential controls depend on an LLM interpreting or judging: AGENTS.md, skills, review agents, "LLM as judge." They are slower, costlier and non-deterministic, but they can judge meaning.
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:
- Prefer computational when you can. A rule in CLAUDE.md can be ignored; a failing check can't. If a mistake keeps happening despite the guide, add a sensor.
- Write sensor messages for the model. A linter error that says how to fix the violation steers the next attempt. Böckeler calls this "a positive kind of prompt injection."[1]
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 file | Failure it prevents |
|---|---|
feature_list.json: 200+ features, all marked failing; agents may only flip passes | Declaring the project "done" too early. JSON was chosen because models are less likely to overwrite it wrongly than Markdown. |
claude-progress.txt + git log | A fresh session not knowing what happened before |
init.sh: starts the app, then a basic end-to-end check | Each session wasting time working out how to run things; building on a broken state |
| Rule: one feature per session, then commit | Trying 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:
- Could I prevent it before it acts? → add a guide.
- Can I detect it after? → add a sensor, ideally with a fix-it message.
- Can a program decide it, or does it need judgment? → computational if possible, otherwise inferential.
- 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 testrun 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.jsonlisting 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