Black Friday week: local AI hardware on sale. See the list.
← All guides

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
  1. The short answer
  2. The checklist
  3. Prove it ran
  4. Related checks
  5. FAQ

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’s hooks/hooks.json, or skill and subagent frontmatter. Check: type /hooks in Claude Code. It opens a read-only list of the hooks it loaded.
  • 2. Hooks are not turned off. "disableAllHooks": true stops all hooks except managed ones. If the /hooks menu shows Only hooks from managed settings run here, your organization set allowManagedHooksOnly. 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, so Edit|Write matches those two tools. Any other character makes it an unanchored JavaScript regex: Edit.* also matches NotebookEdit. For MCP tools, mcp__memory matches no tool. Use mcp__memory__.*. An empty matcher or "*" matches every call.
  • 5. The event supports a matcher. “If you add a matcher field 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 in hookSpecificOutput.permissionDecision (allow, deny, ask or defer). The old top-level decision and reason fields 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 timeout is 600 seconds for command hooks, 30 for prompt hooks and 60 for agent hooks. It drops to 30 seconds on UserPromptSubmit. SessionEnd hooks share a 1.5-second budget unless you set a longer timeout. Check: time your script by hand with time ./.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 -p on a repo you did not write. Command hooks “execute shell commands with your full user permissions.” In -p and SDK sessions there is no trust dialog, so a repo’s committed .claude/settings.json hooks 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.

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.

Was this guide useful?

Read next

Codex AGENTS.md Checklist: 9 Checks When Codex Ignores Your Instructions
Codex not following AGENTS.md? Run 9 yes/no checks: file location, override files, empty files, the 32 KiB limit, fallback names, CODEX_HOME and a test prompt.
Claude Code Hooks vs Skills: When to Use Each
Claude hooks vs skills: a hook runs automatically on an event and enforces a rule. A skill is a reusable workflow the agent chooses to run. How to pick.
Claude Code Hooks That Cut Token Burn: 5 Real Configs (2026)
Most people use Claude Code hooks for desktop notifications. Here are five verified hook configs that block expensive tool calls before they run and pay for themselves.
When Should You Use a Subagent? Check Isolation First
Use a subagent for independent read-heavy work. Keep one agent for coupled edits, and isolate parallel writers by file or worktree.