Hooks
Deterministic actions on harness events. Reach for one to kill a specific frustration.
Hooks are configurable actions that fire under specific circumstances inside a harness - deterministic automation on the events of an agent session, where AGENTS.md and skills only ever suggest.
The event surface
Most harnesses expose a rich set of events a hook can fire on:
- Before or after a model turn
- Whenever the agent calls a tool
- Before a commit
- Before context compaction
- …and many more, depending on the harness
The hook itself is highly configurable: block the action, rewrite it, run a script, inject a reminder. Because hooks execute outside the model, they’re the right tool for anything that must happen every time - a model can forget an instruction; a hook can’t.
The same rule as everything else
As with AGENTS.md and skills: less is more. Add a hook to address a specific frustration or an observed failure mode - the agent that keeps skipping your formatter, the commit that keeps sneaking past review - not to build a speculative safety net. Every hook is machinery you now maintain, and over-hooked sessions get slower and noisier.
Hooks can be user-level or repo-level. Keep user-level hooks universal (they fire in every project), and put anything project-specific in the repo.
A useful mental model
If you find yourself writing the same corrective sentence into AGENTS.md for the third time, it probably wants to be a skill. If the skill still gets ignored at the moment it matters, it wants to be a hook.