[Bug] EnterWorktree tool ignores WorktreeCreate/WorktreeRemove hooks
Bug DescriptionEnterWorktree 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:
- Configure a
WorktreeCreatehook in.claude/settings.json - Start Claude normally (without
--worktree) - Ask Claude to switch to a worktree –
EnterWorktreeruns built-ingit 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
[]This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗