Chapter 9: Backpressure

Stop hook

A script the harness runs when the agent tries to end its turn. If the script says no, the agent is told why and has to keep working.

An agent can finish without committing, so git's hooks may never fire. This one fires when it decides it is done, and turns "please run the tests before you finish" from a request into a step the harness takes whether the agent remembers or not. The agent can't end its turn while tests are failing until the hook lets it, or the harness's own limit is reached.

Say it to your agent

“Add a Stop hook that runs bun test and bun run typecheck, and blocks with the last 20 lines of output if either fails. Don't exit early on stop_hook_active, because that gives you one retry. If the harness ends your turn with the tests still failing, tell me so plainly.”

The workshop

Name a word, or describe what you mean in everyday language.