Hook System

Hooks let you customize the behavior at key lifecycle points. Each hook can run default actions or your own custom scripts.

Lifecycle Hooks

Hook When Default Actions
pre-session Session start verify-clean
pre-task Task start check-blockers
post-task Task complete sync, commit
post-story Story complete test, audit
post-command After audit commands verify-tasks
post-session Session end final sync

Mode-Specific Behavior

Hooks respect the current work mode. In supervised mode, post-task triggers a pause for review. In auto mode, the same hook only logs the result and continues. The unattended mode skips all pause points entirely.

Custom Hooks

You can add custom hooks by editing your project configuration:

.claude/settings.json
{
  "hooks": {
    "post-task": [
      "sync",
      "commit",
      "npm run lint"       // custom action
    ],
    "post-story": [
      "test",
      "audit",
      "./scripts/notify.sh" // custom script
    ]
  }
}