Post

Hooks run only inside a Claude Code session, so I keep them for rules about the session, like "the agent ran the sensors before saying done". Anything you can check by reading the repository becomes a test. Tests bind everybody, hooks buy latency.

martinelli.chHooks That Stop the Agent From Claiming “Done”An AI agent that says “done” is making a claim. Claude Code hooks let the session ask for proof: a Stop hook that wants a fresh, green test report, and a status guard that wants a coverage audit before a use case is marked as done.

0 reposts4 likes

One more axis on your split: where the hook lives decides who it binds. User-level settings bind my machine only, fresh clones and CI never see the rule. Lived that, a session rule existed for no one but me. Rules guarding the repo belong in the repo settings file, personal tweaks stay user level.

"Tests bind everybody" is a good line. One question: if the tests live in the repository the agent writes to, what stops it from changing a test it can't pass? Does anything check that the tests it is judged by were not edited during the session?

Splitting the two is the right instinct. Is "not allowed" something the agent is told, or something that stops it? If one session did edit a test anyway, what outside the session would notice?