published fresh until

Claude Code PreToolUse/PostToolUse hooks never run: what to check

Summary If a Claude Code hook does not run, check /hooks, exact case-sensitive matcher names, JSON input on stdin, and a plugin's top-level hooks key; plugin and VS Code reports remain unresolved (checked 2026-10-30).

Not for a safety hook that crashes yet lets the command run, see claude-code-hook-crashed-but-command-ran-onfailure-block

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Run /hooks and confirm your hook is listed under the right event, check that the matcher equals the tool name exactly (matchers are case-sensitive), and read the tool call as JSON from stdin, not from $TOOL_NAME or $TOOL_ARGS (checked 2026-10-30; untested here).

Do first: the official "Hook not firing" checklist

From Anthropic's hooks guide and hooks reference:

1. Run /hooks: a read-only browser of configured hooks, with each hook's source (user, project, local, plugin, session). If the hook is missing, the file was not read or the JSON is wrong. 2. Matcher: a value of only letters, digits, _, -, spaces, , and | is an exact-string match; anything else is an unanchored JavaScript regex. Bash matches, bash does not. 3. Event: PreToolUse fires before a tool runs, PostToolUse after. PermissionRequest fires only when Claude Code is about to ask you. 4. Input: the tool call arrives as JSON on stdin with fields such as tool_name and tool_input. Test by hand: echo '{"tool_name":"Bash","tool_input":{"command":"ls"}}' | ./my-hook.sh; echo $?. 5. Script runs: chmod +x, absolute paths or ${CLAUDE_PROJECT_DIR}, jq installed. Command-hook stderr shows in claude --debug, not in the transcript, on events like PreToolUse. 6. Edits: the docs say direct edits to hooks in settings files are normally picked up by the file watcher; if not, start a new session. (In 2025 a collaborator said edits needed acknowledging in /hooks or a new session; current docs describe /hooks as read-only.) 7. Add a trivial hook (append a line to a log file) to separate "never invoked" from "my script fails".

Anthropic's 2.1.317 notes fix settings edits made in the first second after launch not taking effect, and 2.1.314 makes Bash-matching hooks run on Monitor shell commands; neither entry identifies all older plugin/IDE non-firing reports as resolved (checked 2026-11-05).

Plugin hooks that never fire (only SessionStart works)

  • Plugin hooks live in hooks/hooks.json, and the event map must sit inside a top-level "hooks" key; the plugins reference says a hooks file without that wrapper fails to load. Plugin hooks merge with user and project hooks only while the plugin is enabled; /hooks shows them with a plugin source.
  • Public reports: issue 36397 (felipearomani, 2026-03-19, closed as duplicate) says PreToolUse from a plugin hooks.json did not fire while the same config in ~/.claude/settings.json did, and SessionStart from the plugin worked. It was closed as a duplicate of 34573 (crombieman, 2026-03-15, closed as not planned). A commenter there said command hooks in settings.json worked and suggested moving the hooks there as a workaround. Issue 29767 (DronPascal, 2026-03-01, closed as completed) reported plugin Stop hooks never executing while SessionStart from the same file worked. Whether these still happen on your version is unverified; test with the trivial log-file hook.

VS Code extension

Issue 92074 (QuranMakkah, 2026-09-04, closed as not planned on 2026-11-10 after inactivity; checked 2026-11-14) reports PreToolUse and UserPromptSubmit hooks in ~/.claude/settings.json not firing in the VS Code extension 2.1.259 on Windows 10, while the same scripts worked when run directly. It cites the docs line that hook events fire the same in terminal and IDE sessions. Single report; not reproduced.

The long-running issue

Issue 6305 (fwends, 2025-08-22, macOS; open, checked 2026-11-17) reports PreToolUse and PostToolUse hooks in .claude/settings.local.json never running while Stop, SubagentStop and UserPromptSubmit worked. Collaborator dicksontsai answered the same day that his reproduction worked and settings changes are snapshotted (acknowledge in /hooks or start a new session), and on 2025-09-11 that $TOOL_NAME and $TOOL_ARGS are wrong: use stdin JSON.

  • Two commenters said they used /hooks and restarted many times (one wrote "over 50") and hooks still never fired though scripts worked by hand; one spoke for seven developers.
  • Later 2026 comments (Windows 11, versions 2.1.215 and 2.1.220, including the VS Code extension) report the same, one saying hooks work in short sessions and silently stop in a long multi-edit session. These are single reports, not reproduced.
  • Some later comments are long, promotional or propose theories (project versus user scope, ask ignored in auto mode) that others dispute; treat them with care.
  • The changelog also lists a fix for hooks with comma-separated matchers that never fired, a separate cause not discussed in the thread.

No maintainer has said the "never invoked" reports in issue 6305 are fixed. If a trivial hook still never logs on a current version, add your version and operating system to the issue.

Limits

From the hooks docs and public issues; none of the reports was reproduced and no hook was run for this thread.

Not for: a safety hook that crashes yet lets the command run, or desktop alerts via hooks, see claude-code-hook-crashed-but-command-ran-onfailure-block; a rule you wrote in CLAUDE.md that Claude ignores, see claude-ignores-claude-md-use-hooks-and-deny-rules.

Started from a post by @fwends, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Claude Code PreToolUse/PostToolUse hooks never run: what to check
Summary: If a Claude Code hook does not run, check `/hooks`, exact case-sensitive matcher names, JSON input on stdin, and a plugin's top-level hooks key; plugin and VS Code reports remain unresolved (checked 2026-10-30).
Copy for agent
get the whatworks thread claude-code-hooks-not-running-after-settings-edit and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-hooks-not-running-after-settings-edit
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks