Agent Harness · Reference sheet

Which mechanism?

You want something to happen every time. Should it be a line in a rules file, a skill, a reviewer, a hook, a test or an MCP server? And does it need a model at all? One question decides most cases: does this step have one right answer?

The rule of thumb

One right answer (format, build, a file pattern, a commit message shape): a script, a hook or a test does it, the same way every run. Needs judgement (write the code, is this change safe?): the model does it, and a second model with a fresh context checks it. Has consequences (approve the plan, accept a BLOCK, commit, push): you decide. A model is the most flexible part of the harness and the least reliable, so give it only the steps that need it.

Need → mechanism

You need…BuildWhy this and not a rules lineLesson
A fact every session should know (build command, the invariant)A line in AGENTS.mdIt is a rules line: short, loaded every session, re-read after compaction2
A fact that only matters in one folder or file typeNested AGENTS.md or .claude/rules/ with paths:Loads only when needed, so other tasks don't pay for it2
The agent to stop and ask at a real decisionThe 1-3-1 rule in AGENTS.md, plus an ask rule for risky commandsThe rule shapes the hand-over; the ask rule makes the stop happen even in auto mode3, 7
Answers in a shape you like (explain as it goes, or keep it short)An output style: Explanatory, Learning, Concise, or your ownIt shapes every reply in the session; a rules line about tone is applied unevenly2
A procedure you repeat (commit, release, new endpoint)A skillLoads only when used; steps run in order; a script inside gives the same result every run5
A whole loop as one commandA workflow skill (ship-slice) that calls the othersOne command, with the human stops written in9
A second opinion on every diffA reviewer subagent, read-onlyFresh context: it never saw the author's reasoning6
Something the agent must never runA deny rule, plus a PreToolUse hook for patternsBlocks the call before it runs, whatever the model decides7
Something no commit may contain, whoever wrote itA git hook (pre-commit, commit-msg)Runs on every commit, by a human or an agent, with any tool7
Proof that an invariant holdsA guard test (12 orders for 3 units)Fails the build when the code breaks it; a reviewer can be wrong7
Live docs or data the model would otherwise guessAn MCP server (pinned, vetted) or one read-only commandReading the source beats remembering it8
The reason odd-looking code is that wayAn ADR, plus a one-line comment pointing at itThe why lives in one file the agent reads before it edits9
Docs that stay trueA checking skill (/update-docs) in the definition of doneClaims get checked against the code, not trusted9
Work to continue somewhere elseA handoff file, or /forkA new chat, tool or colleague can't see this one5

Claude hooks or git hooks?

Both run a script, and they fire at different moments. Most teams want both for the things that matter.

Claude Code hook (PreToolUse, PostToolUse…)Git hook (pre-commit, commit-msg)
Fires whenThe agent is about to call a tool, or just didAnyone runs git commit
SeesThe tool call: the command, the file, the editThe staged diff and the message
BindsThis agent, in Claude Code onlyEvery human and every agent, in every tool
Good forStopping a command before it runs (force-push, rm -rf); formatting after an editSecrets, build output, identity, message format
MissesAnything you type yourself; an Edit-tool write when the hook only watches BashAnything that never reaches a commit

Does it need a model at all?

Before you write a skill, ask whether a plain command would do. Formatting is dotnet format, not a request to "format nicely". A version check is dotnet --version, not a question. If the step can be a script, make it one, and let the skill call it: quality-gate runs gate.sh, and the model's job is only to read the output and fix the cause.

This is one way to split the work, built from the course's reference solution. Your team may draw some lines differently; keep the principle.