You'll noticeTier: how much it should matter to you
2Useful: my rating, 1 to 5
1Signal: worth watching, 1 to 5
WorktreesArea: what it touches
Bug FixesKind: in v2.1.330,
Bug FixesSection of the release
What
A worktree is a separate working copy of a git repository. Before removing one, Claude Code now checks for another running Claude Code session working inside it. If it finds one, it keeps the worktree.
Cleanup: logs that the worktree was kept, and says to delete that session's pid json file if the session is not really running.
Hints: suggests claude stop <jobId> for background sessions, with notes for sessions in VS Code or Claude Desktop.
ExitWorktree with the remove action: now stops if another session is in the worktree, and checks again for work at the moment of removal.
On exit: the message says "Couldn't remove worktree. Kept at" and explains how to remove it later. The tmux session is closed only if the worktree can be removed.
This check is controlled by a server-side switch that is off unless it is switched on remotely.
Why
It stops a worktree being deleted while another session, for example one in VS Code or a background job, is still using it.