jared hebb ~ %

Guides

Claude Code hooks

Claude Code fires an event at about thirty points in a session, and a hook is a script you attach to one of them. Some hooks only watch. Some can stop Claude mid-action. This is one page per event: what fires it, what it receives, what it can do about it, and a working example.

Every event, one page each

  • PreToolUse Before a tool call runs, while it can still be stopped. can block
  • PostToolUse After a tool call has already succeeded. can block
  • UserPromptSubmit When you submit a prompt, before Claude processes it. can block
  • Stop When Claude has finished responding and is about to hand the turn back to you. can block
  • SessionStart When a session begins or resumes. cannot block
  • SessionEnd When a session terminates, for any reason. cannot block
  • SubagentStart When a subagent is spawned. cannot block
  • SubagentStop When a subagent finishes. can block
  • PostToolUseFailure After a tool call fails. can block
  • PermissionRequest When a permission dialog is about to appear. can block
  • PreCompact Before the context window is compacted. can block
  • Notification When Claude Code sends a notification. cannot block
  • ConfigChange When a configuration file changes during a session. can block
  • FileChanged When a file on the watch list changes on disk, whoever changed it. cannot block
  • UserPromptExpansion When a command you typed expands into a prompt, before that prompt reaches Claude. can block
  • PermissionDenied When a tool call is denied by the auto mode classifier. cannot block
  • MessageDisplay While assistant message text is being displayed. cannot block