Claude Code hooks: Opus audits, Sonnet builds, Haiku validates
Deterministic PreToolUse, PostToolUse and Stop hooks in .claude/settings.json block unsafe commands and enforce tests, while Jev applies the same idea one layer down by resolving no-thinker forks in code in milliseconds.
THIS IS ACTUAL F*CKING GOLD Anthropic just documented one of the most powerful features in Claude Code The idea: stop relying on advisory prompts in CLAUDE.md that the model can hallucinate or forget under heavy context pressure, and enforce hard deterministic hooks in .claude/settings.json Zero token burn on linting, instant exit-code blocking on dangerous commands, and automated test enforcement that Claude cannot bypass You configure Claude Code hooks like this: .claude/settings.json here's how it splits: → Opus 5.5 audits your security policies: reviews hook configurations and verifies boundary integrity across projects → Sonnet 5.5 runs the main session: writes code, handles refactors, and dispatches tool calls → Haiku 5.5 executes hook validation: parses stdin JSON payloads at 340 tok/s and runs micro-linters in milliseconds → you stop burning Opus context on routine formatting loops and keep your session token count razor thin Hooks trigger at three critical moments: → PreToolUse: intercepts dangerous shell commands or sensitive file writes and aborts with exit code 2 before execution → PostToolUse: triggers instant formatters and schema linters on modified files without wasting model turns → Stop: verifies test suites and git diff contracts before Claude can call a task finished Opus audits. Sonnet builds. Haiku executes JEV engineering is the same move one layer down: the forks that need no thinker (matcher regexes, file extension checks, exit code 2 aborts) resolve in code in milliseconds, and the frontier models only see the ones that split the full tree > Opus 5.5 designs and audits safety rules in .claude/settings.json > Sonnet 5.5 runs the main session and executes tool workflows > PreToolUse intercepts Bash commands and blocks unsafe execution with exit code 2 > PostToolUse triggers instant linters and formatters via Haiku 5.5 (340 tok/s) > Stop verifies the full test suite before marking a turn completed > JEV routes deterministic event matchers in under 15ms paste the tree and this prompt into Claude Code ↓ "Rebuild my Claude Code setup around this tree: 1. Move formatting, linting, and command safety guardrails out of CLAUDE.md into deterministic hooks in .claude/settings.json 2. Configure PreToolUse hooks on Bash to intercept and block destructive commands with exit code 2 3. Configure PostToolUse hooks on Edit and Write to auto-run formatters via Haiku 5.5 at 340 tok/s 4. Add a Stop hook to verify test passes and diff contracts before completing any turn 5. Use Opus 5.5 to audit hook security rules and sign off on project policies Show me every change as a diff first. No edits until I say go" ↳ http://code.claude.com/docs/en/hooks bookmark this, you'll need it on every project
This post quotes another post: x.com/mirku21/status/2098836008468992471