Skip to content

Hooks

Hooks are accelerators and guards — they do not replace plans, contracts, reviews, or checks. Every route is addressed by event + routeId + matcher, and the guard routes fail closed.

EventRouteMatcherDoes
SessionStart.defaultall sessionsinject the prior session’s resume packet
PreToolUse.edit 🛡Edit / Writehold edits until a plan is approved
PreToolUse.subagent 🛡Task / Agentscope delegated work
PostToolUse.editEdit / Writearchitecture-drift + contract checks
PostToolUse.bashBashtrace shell commands
PostToolUse.alwaysall toolsappend to the event trace
UserPromptSubmit.defaultall promptsroute intent, surface plan status
Stop.default 🛡session stopwrite the next handoff packet

🛡 = fails closed.

The installable source is assets/hooks/; the active runtime resolves central-first. User-level ~/.claude/settings.json and ~/.codex/hooks.json are the host adapters that dispatch each event into the harness. Repo-local .claude/hooks/ and .codex/hooks.json are legacy cleanup targets — only your own custom-*.sh hooks are preserved.