[BUG] UserPromptSubmit hooks silently not firing in git worktree sessions

Resolved 💬 3 comments Opened Apr 17, 2026 by adelaidasofia Closed May 27, 2026

Summary

UserPromptSubmit hooks configured in .claude/settings.json or .claude/settings.local.json silently skip in git worktree sessions. No error is thrown, no log entry is written — they simply don't fire. SessionStart hooks (e.g. from claude-mem) do fire correctly in the same sessions, making this specific to UserPromptSubmit.

Steps to reproduce

  1. Configure a UserPromptSubmit hook in .claude/settings.local.json (e.g. a hook that echoes a protocol reminder or runs a context-loading script).
  2. Run Claude Code from a git worktree (via claude -w <name> or from a path under .claude/worktrees/{name}/).
  3. Submit any prompt.
  4. The hook does not fire. No error is shown. No log entry in ~/.claude/debug/latest.

Evidence

In ~/.claude/projects/<worktree-path>/<session>.jsonl:

  • Zero occurrences of "hookEventName":"UserPromptSubmit" despite the hook being present in settings.
  • SessionStart hooks (e.g. from the claude-mem plugin) do appear correctly — hook discovery is running, just not for UserPromptSubmit in this context.

Confirmed across five sessions, three worktrees, six-plus days. The parent vault's regular (non-worktree) sessions run the same hooks correctly.

Root cause hypotheses

  1. The worktree path nests its own .claude/ inside the parent vault's .claude/. Claude Code may load the worktree's settings.local.json for SessionStart but silently fail UserPromptSubmit registration in the nested structure.
  2. "once": true state may be keyed on the parent-vault project path, marking hooks as already-fired for all subsequent worktree sessions.

Impact

Any automation depending on UserPromptSubmit for context injection, session initialization, or auto-update checks is silently broken in worktree sessions. No indication that hooks aren't running — users assume their automation is working when it isn't.

Related: #47733 (user-level MCP servers also fail in worktrees — same root cause, different subsystem).

Detailed session JSONL evidence and full repro: adelaidasofia/ai-brain-starter#6

Environment

  • macOS Darwin 25.4.0, arm64
  • Claude Code: latest CLI (claude-opus-4-6, 1M context)
  • Worktrees nested under .claude/worktrees/{name}/ within the main working directory

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗