5.1 — Stochastic vs Deterministic: why hooks exist
Since the start of this training, you've been configuring Claude Code with CLAUDE.md files, project instructions, and team conventions. All of that works — most of the time. The fundamental problem: CLAUDE.md is advisory. Claude reads it, interprets it, and does its best. But "its best" is not a guarantee. An LLM can forget an instruction, misinterpret it, or decide it doesn't apply in a given context.
Hooks solve this problem. They are shell commands or LLM prompts that run automatically at precise points in the Claude Code lifecycle. They aren't "suggested" — they are executed. When you configure a hook that blocks file deletions, that hook will run on every attempt, no exceptions.