[BUG] Claude Code spawns unwanted git worktrees and gets stuck in deleted worktree CWD
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code repeatedly creates git worktrees without being asked to. Once a session is spawned inside a worktree, the shell CWD is permanently set to that worktree path. Even after removing the worktrees (git worktree remove + git worktree prune), the session's CWD remains stuck at the now-deleted path, causing all Bash tool calls to fail silently (commands complete with no output because the working directory doesn't exist).
Worktrees are created automatically on session start (3 were created across recent sessions: modest-shaw, elegant-cartwright, loving-brown)
Shell CWD is permanently locked to the worktree path
Removing the worktree does not fix the CWD — session remains broken
All Bash tool calls fail silently (no output, no error)
What Should Happen?
Claude Code should NOT create git worktrees unless the user explicitly requests it
The shell CWD should remain at the project root
If a worktree is removed, the shell should fall back to the project root, not stay stuck on a nonexistent path
Error Messages/Logs
Steps to Reproduce
Open Claude Code desktop app (v2.1.79) on Windows 11
Open a project that is a git repository
Run a slash command (e.g., /startup) or start a conversation
Claude Code creates a git worktree automatically (e.g., .claude/worktrees/modest-shaw, sk-trade-bot/loving-brown, sk-trade-bot/elegant-cartwright) — without being asked
The session's shell CWD is set to the worktree path
All subsequent Bash tool calls show Shell cwd was reset to <worktree-path>
If the worktree is removed, all Bash calls return empty output because the CWD no longer exists
PowerShell tool calls work only if you explicitly cd to the correct path in each call
The session is effectively broken — user cannot do normal work
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Claude Code v2.1.79.
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
<img width="724" height="384" alt="Image" src="https://github.com/user-attachments/assets/e0255f1c-e4d2-4181-bac3-2d46b76199fc" />
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗