Description
When using Claude Code in the VS Code extension (tab, not terminal), worktrees created via /worktree are never cleaned up automatically. They accumulate in .claude/worktrees/ and must be manually removed with git worktree remove.
CLI behavior (works correctly)
In the CLI, exiting a session (/exit, Ctrl+D) triggers worktree cleanup:
- No changes: worktree and branch are auto-removed
- Changes exist: user is prompted to keep or remove
VS Code extension behavior (no cleanup path)
- Closing the tab does not trigger cleanup
/clear / /reset / /new does not trigger cleanup
/exit does not exist in the VS Code extension
There is no way to trigger worktree cleanup from the VS Code extension without manually running git commands.
Expected behavior
Closing the Claude Code tab or starting a new conversation (/clear) should trigger the same worktree cleanup flow as /exit does in the CLI.
Environment
- Claude Code VS Code extension
- macOS / Linux (Codespaces)
Description
When using Claude Code in the VS Code extension (tab, not terminal), worktrees created via
/worktreeare never cleaned up automatically. They accumulate in.claude/worktrees/and must be manually removed withgit worktree remove.CLI behavior (works correctly)
In the CLI, exiting a session (
/exit,Ctrl+D) triggers worktree cleanup:VS Code extension behavior (no cleanup path)
/clear//reset//newdoes not trigger cleanup/exitdoes not exist in the VS Code extensionThere is no way to trigger worktree cleanup from the VS Code extension without manually running git commands.
Expected behavior
Closing the Claude Code tab or starting a new conversation (
/clear) should trigger the same worktree cleanup flow as/exitdoes in the CLI.Environment