Hooks Hooks are Claude Code's automation surface — deterministic bash (or any shell) scripts that fire on lifecycle events. Each hook receives JSON on stdin and returns JSON on stdout: . Events (matcher + input + output) | Event | Fires | Input | Output shape | |---|---|---|---| | | Before any tool | | — block prevents the tool call | | | After tool succeeds | | | | | After tool fails | | — almost always approve | | | Claude needs input | | | | | Agent finishes turn | | | | | Prompt submitted | | + optional modified prompt | | | New session | | — usually for context injection | Installing a h…