hooks
hooks — Technology. role: Commands triggered at fixed points in the Claude Code lifecycle, serving as hard gates independent of the model's decision · usage: check-file-size blocks Reads beyond 350 lines (SHUNT_MIN_LINES); check-bash-read intercepts cat, head, tail, less, more; targeted reads and piped commands exempted
Hugo Lassiège compresses the argument into one line in his 28 juillet 2026 account of his usine logicielle: an instruction is followed "la plupart du temps", while a hook or a test is followed all the time. That gap is the whole subject. These are commands Claude Code runs at fixed points of its lifecycle, on PreToolUse and PostToolUse events, independent of what the model decided.
Dimitri Mazmanov built the bottom layer of his shunt plugin out of them. Writing on Spotify's engineering blog on 3 septembre 2026, he reports that an earlier version put the routing rules in CLAUDE.md, which the model could ignore. The replacement: check-file-size blocks a Read past 350 lines (SHUNT_MIN_LINES), check-bash-read intercepts cat, head, tail, less and more, and targeted reads and piped commands are exempt.
Louis Claxton, of Anthropic's Applied AI team, splits governance into two layers in his 21 août 2026 AI-native SDLC guide: an advisory control that recommends, and the deterministic one that blocks or demands an approval. Michael Segner's guide for startups sends readers to the same mechanism for deterministic gates. Addy Osmani lists it among the seven primitives of the agent harness under a slogan: "success is silent, failures are verbose."
The gates named are concrete: a blocking lint, a test before a commit, secrets refused to a read. A curriculum on Claude Code counts more than eleven events a hook can attach to.
- Type
- Technology
- role
- Commands triggered at fixed points in the Claude Code lifecycle, serving as hard gates independent of the model's decision
- usage
- check-file-size blocks Reads beyond 350 lines (SHUNT_MIN_LINES); check-bash-read intercepts cat, head, tail, less, more; targeted reads and piped commands exempted
- relations
- 7
- Cited in
- 3 fiches
Neighborhood
→ is based on
→ is part of
→ applies to
→ improves