Study guide
Loops that check themselves: build, verify, fix, repeat
The main points of the lesson, for review.
Key terms
- Check: something the agent can run that answers yes or no: a test, a build, a screenshot, a word count
- Review: a judgment that depends on taste, done by a fresh agent or a person
- Fresh reviewer: an agent that never saw the work being made, so its reasoning does not sway it
- Cap: a limit that ends the loop without success: a number of tries, turns or dollars
- Stop hook: a script that runs when the agent tries to finish and can refuse until a check passes
- Headless mode: running Claude Code without a chat window, with claude -p
Facts that move (checked November 24, 2026)
- "Give Claude something it can run that comes back pass or fail" (Anthropic best practices)
- After two failed corrections, /clear and write a better prompt (Anthropic best practices)
- Headless caps: --max-turns and --max-budget-usd (Anthropic)
- Claude Code ends the turn after eight Stop-hook blocks in a row (Anthropic best practices)
The loop, in order
- Say what done means, in one line
- Plan before building
- Build one small step
- Run a check that comes back pass or fail
- Feed back the exact error on a fail
- Get a fresh review
- Save the step, then start the next
- Stop after the same failure three times and ask a person