Skip to main content

Hook Events

Claude Code has 33 hook events. Each event fires at one point in a session. Each event gets its own input fields and accepts its own output fields. This page lists them in groups: tool, tool result, session, prompt and turn, agent and task, and other events. The fields that every event shares are on Input and Output.

Add the event key to the hooks map to enable an event. Remove it to disable the event.

Example​

A SessionStart hook that adds your open tickets as context.

.claude/settings.json
{
"hooks": {
"SessionStart": [
{
"matcher": "startup",
"hooks": [{ "type": "command", "command": ".claude/hooks/tickets.sh" }]
}
]
}
}
.claude/hooks/tickets.sh
#!/bin/bash
# Plain stdout on SessionStart becomes context for Claude.
echo "Open tickets: $(gh issue list --limit 5 --json title -q '.[].title' | paste -sd ';' -)"

All Events​

EventGroupFires whenMatcherCan block
PreToolUseToolBefore a tool runs.Tool name✅
PermissionRequestToolA permission prompt would show.Tool name❌ (use a decision)
PermissionDeniedToolAuto mode denies a call.Tool name❌
PostToolUseTool resultA tool call succeeds.Tool name❌
PostToolUseFailureTool resultA tool call fails.Tool name❌
PostToolBatchTool resultAll tool calls of a batch finish.None✅
SessionStartSessionA session starts or resumes.Start source❌
SetupSession--init-only, or --init or --maintenance with -p.CLI flag❌
SessionEndSessionA session ends.End reason❌
InstructionsLoadedSessionA CLAUDE.md or rules file loads.Load reason❌
ConfigChangeSessionA settings or skill file changes.Config source✅
CwdChangedSessionA shell command changes the directory.None❌
FileChangedSessionA watched file changes on disk.File names❌
DirectoryAddedSessionYou add a directory with /add-dir.Add source❌
UserPromptSubmitPromptYou submit a prompt.None✅
UserPromptExpansionPromptA typed command expands to a prompt.Command name✅
MessageDisplayPromptAssistant text streams to the screen.None❌
NotificationPromptClaude Code sends a notification.Notification type❌
StopPromptThe main agent finishes.None✅ (keeps working)
StopFailurePromptThe turn ends on an API error.Error type❌
SubagentStartAgentA subagent starts or resumes.Agent type❌
SubagentStopAgentA subagent finishes.Agent type✅ (keeps working)
TaskCreatedAgentTaskCreate makes a task.None✅
TaskCompletedAgentA task changes to done.None✅
TeammateIdleAgentA teammate is about to go idle.None✅ (keeps working)
PreCompactOtherBefore a compaction.Trigger✅
PostCompactOtherAfter a compaction.Trigger❌
PreModelSwitchOtherBefore a requested model switch.Target model✅
PostModelSwitchOtherAfter the model changes.Target model❌
ElicitationOtherAn MCP server asks you for input.Server name✅ (declines)
ElicitationResultOtherYou answered an MCP question.Server name✅
WorktreeCreateOtherClaude Code needs a worktree.None✅ (fails)
WorktreeRemoveOtherClaude Code removes a hook-made worktree.None✅ (fails)

Event Pages​

PageEvents
Tool Hook EventsTool events, tool result events, and the PostToolUse tool_response shapes.
Session, Prompt, and Turn Hook EventsSession events, and prompt and turn events.
Agent, Task, and Other Hook EventsAgent and task events, compaction, model switch, elicitation, and worktree events.

Source: Hooks Reference, the HookInput types in the program type file, and the hook output schema in the program. Probed in -p: a Workflow call has tool_input {script}, and its PostToolUse tool_response has status (async_launched), taskId, taskType (local_workflow), workflowName, runId, summary, and transcriptDir. A Skill call has tool_input {skill} and tool_response {success, commandName}. An MCP tool's tool_response is the list of content blocks that the server returned, for example [{"type":"text","text":"pong"}]. Built-in tool outputs differ per tool (see PostToolUse tool_response Shapes). We did not probe every built-in tool, and WebFetch, ScheduleWakeup, and NotebookEdit calls did not reach PostToolUse in our run.