AI
What does Claude Code do when a PreToolUse hook denies a tool call mid-task?
A captured `claude --print` session against the demo app, with a PreToolUse hook that denies any Edit or Write to `src/shared/`. The prompt forced a collision: add a `formatForCity` helper to `src/shared/time.ts` AND use it from `src/reporting/service.ts`. Claude read four files, attempted the Edit, hit the block, read the hook script itself to understand the policy, then stopped with three concrete paths forward (workaround, lift the freeze, two-PR split). The article shows what the block looks like in the events stream, what Claude considered and rejected, and why this is the right shape of agent behavior under denial-mode hooks.