[Bug] EnterWorktree tool ignores WorktreeCreate/WorktreeRemove hooks

Open 💬 10 comments Opened Mar 19, 2026 by plindberg

Bug Description
EnterWorktree tool does not invoke WorktreeCreate/WorktreeRemove hooks

When WorktreeCreate and WorktreeRemove hooks are configured in .claude/settings.json, the claude --worktree CLI flag correctly invokes them. However, the in-session EnterWorktree tool (used when asking Claude to switch to a worktree mid-conversation, or via Agent(isolation: "worktree")) ignores these hooks entirely and uses built-in git worktree add instead.

This means any repo that needs custom worktree setup (e.g. git-crypt key symlinking, sparse checkout, post-checkout dependency installation) works with --worktree but fails mid-session.

Repro:

  1. Configure a WorktreeCreate hook in .claude/settings.json
  2. Start Claude normally (without --worktree)
  3. Ask Claude to switch to a worktree – EnterWorktree runs built-in git worktree add, hook is never called

Expected: EnterWorktree should invoke WorktreeCreate/WorktreeRemove hooks the same way the --worktree CLI flag does.

Environment Info

  • Platform: darwin
  • Terminal: WarpTerminal
  • Version: 2.1.79
  • Feedback ID: 0f4e09a9-eb11-4fa5-bd88-7bf08c6261ea

Errors

[]

View original on GitHub ↗

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