There's a category error hiding in most agent configs: treating a rules file as an enforcement mechanism. It isn't one. CLAUDE.md, AGENTS.md, .cursor/rules — these are advisory context. The model reads them, weighs them against everything else in its window, and usually complies. Usually.
The failure mode isn't dramatic. It's a 40-turn session where the instruction "never commit directly to main" is now 30,000 tokens behind the current task, and the model — trying to be helpful — commits directly to main. Nobody disobeyed you. Your reminder just lost an attention contest.
Claude Code has a mechanism for the rules that must not lose that contest: hooks. A hook is a shell command that runs at a fixed point in the agent's lifecycle. It doesn't ask the model to remember anything, because it doesn't run inside the model at all.
This post covers the mechanics that matter, five hooks that earn their keep, and the pitfalls I hit shipping a set of them.
The mental model: reminders vs. gates






