Skip to main content
paw
Anatomy

How a Hook Works

paw ๐Ÿ›ก Hooks deep dive

  A hook is a script wired to a Claude Code
  lifecycle event.

  EVENT     When it fires (PreToolUse fires
            BEFORE the agent runs a tool).
  MATCHER   Which tools trigger it (Bash,
            Write|Edit).
  PAYLOAD   The tool call arrives as JSON
            on stdin.
  VERDICT   exit 0 allows. exit 2 blocks and
            shows the agent your message.

  No AI involved. No judgment. Just code
  that runs every single time.

1 / 5

Arrow keys to move ยท s skip section ยท / search ยท Esc tracks