Claude Code hooks layered by role: Haiku judges, Opus guards, Jev routes micro-forks
Command hooks block rm -rf and .env reads, Haiku prompt hooks judge whether a Stop is really done, and an Opus agent hook reviews diffs before push or publish; the post says Jev resolves micro-forks in code in 15ms.
THIS IS PURE F*CKING GOLD Anthropic just documented the most slept-on layer of Claude Code: hooks The idea: stop begging the model to follow rules in CLAUDE.md, and let the new Haiku 5.5 enforce them on every single tool call Hard guardrails that fire 100% of the time, with Haiku judging only the calls that actually need judgment and Opus guarding the ones that can't be undone You just wire it once and inspect it in Claude Code like this: /hooks here's the split: → command hooks run in pure code: block rm -rf, deny .env reads, auto-format on every Edit|Write → Haiku 5.5 runs prompt hooks: one-turn verdict on every Stop and SubagentStop, ok or "not done, here's why" → Sonnet 5.5 builds in the main session and only ever sees the verdicts, never the noise → Opus 5.5 runs as an agent hook: reads the staged diff with Read/Grep before anything leaves your machine Opus only steps in at three moments: → before git push → before npm publish → before any migration touches the db Sonnet builds · Haiku judges · Opus guards JEV engineering is the same move one layer down: the forks that need no thinker (which file, which tool, retry or stop) resolve in code in 15ms, and the frontier models only see the ones that split the full tree > Sonnet 5.5 runs the main session and writes the code > PreToolUse command hook blocks rm -rf and .env reads (matcher + if) > PostToolUse runs formatter + linter on every Edit|Write (async) > Haiku 5.5 prompt hook judges every Stop: done or keep going > Haiku 5.5 prompt hook audits SubagentStop before results return > Opus 5.5 agent hook reviews the diff on if: "Bash(git push *)" > JEV routes micro-forks in milliseconds paste the tree and this prompt into Claude Code ↓ "Rebuild my Claude Code setup around this tree: 1. Keep the main session on Sonnet 5.5 and move every rule that must never break out of CLAUDE.md into hooks in .claude/settings.json 2. Add PreToolUse command hooks that block destructive Bash (rm -rf, force push) and reads of .env, using matcher + if conditions 3. Add an async PostToolUse hook on Edit|Write that runs my formatter and linter 4. Add prompt hooks on Stop and SubagentStop with model haiku: return ok: false with a reason if tests weren't run or the task isn't actually finished 5. Add an agent hook on PreToolUse with if: "Bash(git push *)" and model opus that reviews the staged diff before it ships 6. Route fast deterministic forks (tool choice, path selection, retries) through JEV Show me every change as a diff first. No edits until I say go" ↳ http://code.claude.com/docs/en/hooks save it, it'll come in handy
This post quotes another post: x.com/lunarresearcher/status/2096570562625655088