Stop Hook Question Explained
This worked Harness Engineering practice question tests Feedback and Hooks. Try the answer first, then review why D is the best choice.
Short answer
The correct answer is D. A Stop hook that runs the check when the agent tries to finish.
A hook is a command that your tool runs on a named event, without being asked. In Claude Code, a Stop hook runs when Claude finishes responding. If the hook exits with code 2, Claude Code prevents the stop and sends the hook's stderr text back to the agent, so it keeps working on the fix. The tool holds the rule, and no one has to remember it. Codex has Stop hooks too, and exit code 2 with a reason on stderr also makes Codex continue. The correct answer is D. A Stop hook that runs the check when the agent tries to finish
The Question
You have a working link checker. The agent runs it when you ask, but in a long session it often says "done" without running it. You want the check to run every time, with nobody remembering. What should you add?
Why D is correct
A hook is a command that your tool runs on a named event, without being asked. In Claude Code, a Stop hook runs when Claude finishes responding. If the hook exits with code 2, Claude Code prevents the stop and sends the hook's stderr text back to the agent, so it keeps working on the fix. The tool holds the rule, and no one has to remember it. Codex has Stop hooks too, and exit code 2 with a reason on stderr also makes Codex continue. The correct answer is D. A Stop hook that runs the check when the agent tries to finish
Why the other options are wrong
Claude Code's docs say instruction files are context, not enforced configuration. A rule can be forgotten late in a long session, but the hook runs each time Claude finishes responding.
A reminder in each prompt depends on you typing it every time. The scenario asks for a check that runs with nobody remembering.
handoff.md is read at the start of the next session. It does not run anything, and it does nothing in the current session.
Key idea: Feedback and Hooks
Every question here is a situation you meet with Claude Code or Codex: the agent gets something wrong, and you choose what to change. The best answer is usually a file, a check, or a hook that stops the mistake from repeating, not a louder prompt. If you miss a question, read the explanation and note which part of the harness it uses: the AGENTS.md map, a skill, a check, a visitor check, a hook, or a handoff note.
Ready to test the full skill?
Take the free Harness Engineering quiz and find the exact basics to review next. No signup required.
Practice related questions
Same skill area or adjacent concept. Use these after reviewing the explanation.