[Bug] Settings discovery doesn't walk to git root, causing WorktreeCreate hooks to be silently skipped from subdirectories

Resolved 💬 2 comments Opened May 4, 2026 by msigwart Closed May 4, 2026

Bug Description
Bug: claude --worktree silently skips project-level WorktreeCreate hook when launched from a subdirectory Claude Code's .claude/settings.json discovery is CWD-only — it does not walk up to the git root. This produces an inconsistency with worktree creation, which does resolve the git root for the default worktree path. Repro: 1. Project at ~/repo with ~/repo/.claude/settings.json defining a WorktreeCreate hook. 2. A subdirectory ~/repo/sub/.claude/settings.local.json exists (no hooks — e.g., just MCP enables). 3. cd ~/repo/sub && claude --worktree Expected: WorktreeCreate hook from ~/repo/.claude/settings.json fires. Actual: Hook is silently skipped. Claude falls back to creating a worktree at ~/repo/.claude/worktrees/<random-name> (uses git root for path, but never loaded git-root settings). Evidence (from --debug-file): - Launched from ~/repo: Watching for changes in setting files …, ~/repo/.claude/settings.json, ~/repo/.claude/settings.local.json - Launched from ~/repo/sub: Watching for changes in setting files …, ~/repo/sub/.claude/settings.json, ~/repo/sub/.claude/settings.local.json (project-root settings never loaded → Hooks: Found 0 total hooks in registry) Impact: Custom worktree setups (DB, infra, etc.) get silently bypassed. No warning, no error — the user just discovers later that their environment isn't provisioned. Suggested fix: Settings discovery should walk up to the git root (or $CLAUDE_PROJECT_DIR), matching the resolution Claude already performs for the default worktree path. At minimum, log a warning when launching --worktree and a project-root .claude/settings.json exists above CWD but isn't loaded. Version: 2.1.126 (native).

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.1.126
  • Feedback ID: 3ac85329-637e-4e3e-ab2a-9396887b85b6

Errors

[]

View original on GitHub ↗

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