Claude Code Hooks Checklist: 10 Checks When a Hook Does Not Fire or Block
A Claude Code hook fails in one of three ways: it does not run, it runs but does not block, or it runs where you did not want it. The 10 checks below each have a yes/no answer and the command or setting that gives it. Checked against the Claude Code hooks reference on 27 November 2026.
Jump to 5 sections
The short answer
Most broken hooks have one of three faults: the hook is in a settings file Claude Code does not read for this session, the matcher does not match the tool name, or the script exits with 1 when it must exit with 2.
The 10 checks below find which one. Source for every check: the Anthropic hooks reference and hooks guide, read on 27 November 2026.
The checklist
Mark each line yes or no. A “no” is your fix.
Does the hook run?
- 1. The hook is in a settings file that applies here. Hooks can live in
~/.claude/settings.json(all your projects),.claude/settings.json(one project, committed),.claude/settings.local.json(one project, not committed), managed policy settings, a plugin’shooks/hooks.json, or skill and subagent frontmatter. Check: type/hooksin Claude Code. It opens a read-only list of the hooks it loaded. - 2. Hooks are not turned off.
"disableAllHooks": truestops all hooks except managed ones. If the/hooksmenu showsOnly hooks from managed settings run here, your organization setallowManagedHooksOnly. Check:grep -rn "disableAllHooks\|allowManagedHooksOnly" ~/.claude/settings.json .claude/. - 3. You accepted the workspace trust dialog. In an interactive session, Claude Code “holds back hooks from every settings file, including your own
~/.claude/settings.json, until you accept the workspace trust dialog.” - 4. The matcher matches the real tool name. A matcher with only letters, digits,
_,-, spaces,,and|is an exact string, soEdit|Writematches those two tools. Any other character makes it an unanchored JavaScript regex:Edit.*also matchesNotebookEdit. For MCP tools,mcp__memorymatches no tool. Usemcp__memory__.*. An empty matcher or"*"matches every call. - 5. The event supports a matcher. “If you add a
matcherfield to an event without matcher support, it is silently ignored.” Check the event table in the reference before you rely on a matcher.
Does the hook block?
- 6. The script exits with code 2 to block. Exit 2 is a blocking error: “On events that can block, Claude Code stops the action.” Exit 1 is a non-blocking error, and the action goes ahead. The docs say: “If your hook is meant to enforce a policy, use
exit 2.” Write the reason to stderr; Claude receives it as feedback. Check:grep -n "exit" .claude/hooks/*.sh. - 7. A PreToolUse JSON reply uses
hookSpecificOutput. PreToolUse puts its decision inhookSpecificOutput.permissionDecision(allow,deny,askordefer). The old top-leveldecisionandreasonfields are deprecated for this event. Exit 0 with no decision does not approve the call; it “still goes through the normal permission flow.” Pick one method per hook: exit 2 with stderr, or exit 0 with JSON.
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "deny",
"permissionDecisionReason": "Destructive command blocked by hook"
}
}
- 8. The script finishes before the timeout. The default
timeoutis 600 seconds forcommandhooks, 30 forprompthooks and 60 foragenthooks. It drops to 30 seconds onUserPromptSubmit.SessionEndhooks share a 1.5-second budget unless you set a longertimeout. Check: time your script by hand withtime ./.claude/hooks/your-hook.sh < sample-input.json.
Is the hook safe?
- 9. The script uses a full path and quotes its variables. Use
${CLAUDE_PROJECT_DIR}for scripts in the project, wrapped in double quotes in shell form. The reference also says: quote shell variables, block..in file paths, and skip.env,.git/and key files. - 10. You reviewed hooks before you run
claude -pon a repo you did not write. Command hooks “execute shell commands with your full user permissions.” In-pand SDK sessions there is no trust dialog, so a repo’s committed.claude/settings.jsonhooks run. Review its.claude/files first, or turn hooks off for that run:claude -p --settings '{"disableAllHooks": true}' "your prompt".
Prove it ran
Start Claude Code with claude --debug, then read ~/.claude/debug/<session-id>.txt. The --debug flag does not print to the terminal. A run line looks like this:
Hooks: PostToolUse:Write [.claude/hooks/log-write.sh] finished with status 0 (31ms)
Set CLAUDE_CODE_DEBUG_LOG_LEVEL=verbose to also see matcher counts. Already in a session? Run /debug to turn on logging and get the log path.
You do not need to restart after an edit: “File edits are normally picked up automatically.” If a change does not show after a few seconds, restart the session.
Related checks
Not sure a hook is the right tool? Read Claude Code hooks vs skills. To use hooks to cut context use, see Claude Code hooks that cut token burn. To test hooks next to CLAUDE.md and skills, see how to test CLAUDE.md, skills and hooks.
Using Codex too? Run the Codex AGENTS.md checklist. Running an always-on agent? Use the OpenClaw security checklist. A hook is one guard; it does not replace a sandbox.
FAQ
Why does my Claude Code hook not block the tool call?
A hook blocks only when it exits with code 2 or returns "permissionDecision": "deny" in JSON. Exit code 1 is a non-blocking error, so the action goes ahead.
How do I see if a Claude Code hook ran?
Type /hooks to see the loaded hooks. Start with claude --debug and read ~/.claude/debug/<session-id>.txt for each run and its exit status.
Why does my matcher mcp__memory match nothing?
It has only exact-match characters, so Claude Code compares it as an exact string. Use mcp__memory__.* to match every tool from the memory server.