{"version":"2.1.331","anchor":"worktree-tools-guard-against-folder-moves-and-served-launch","canonical_anchor":"worktree-tools-guard-against-folder-moves-and-served-launch","heading":"Worktree moves are refused outside the starting folder, and exits explain kept worktrees","tier":"notice","area":"Worktrees","scope":"individual","heads_up":true,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.331\/e\/worktree-tools-guard-against-folder-moves-and-served-launch","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.331","markdown":"### Worktree moves are refused outside the starting folder, and exits explain kept worktrees\n\nClaude Code refuses to move a session into a worktree outside its starting folder, and says why a worktree was kept when the return folder changed\n\n**What**\n\nA worktree is a separate working copy of a git repository. Claude Code now refuses to move a session into a worktree that sits outside the folder the server was started in.\n\n`ExitWorktree` now notices when the folder it would return to leads somewhere different from when its permission check ran. In that case it keeps the worktree and says it \"did not remove it, since the directory to go back to has changed\". The old message only said it had exited the worktree but could not remove it.\n\n**Why**\n\nEntering and leaving worktrees is stricter in sessions run by a server. A worktree is not deleted when the folder you would return to has quietly changed.\n\n- Area: Worktrees\n- Tier: You'll notice\n- Useful: 3\/5\n- Signal: 2\/5\n- Scope: individual\n- Heads-up: yes"}