{"version":"2.1.311","anchor":"background-agent-worktrees-are-kept-while-another-task-is-st","canonical_anchor":"background-agent-worktrees-are-kept-while-another-task-is-st","heading":"Agent worktrees are no longer removed while another task is still working in them","tier":"notice","area":"Worktrees","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.311\/e\/background-agent-worktrees-are-kept-while-another-task-is-st","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.311","markdown":"### Agent worktrees are no longer removed while another task is still working in them\n\nWhen an agent's worktree is cleaned up, Claude Code now keeps it if another running or parked task is still working inside it\n\n**What**\n\nA worktree is a separate working copy of your project that an agent can use so its changes stay apart from yours. When an agent finishes, Claude Code cleans up its worktree. Before removing it, Claude Code now checks whether another task is still working in that directory. This covers both tasks that are running and tasks that are parked.\n\n- If another task is still using it, the worktree is kept and Claude Code logs which task is using it.\n\n- The worktree stays reserved until no running task is left in it.\n\n- If the session was handed off with `\/background`, the reservation stays in place.\n\nBefore this change, a clean worktree was removed without checking whether any other task was using it.\n\n**Why**\n\nThis stops Claude Code from deleting a folder while another task is still working in it. Before, a background or parked task could find its working directory gone.\n\n- Area: Worktrees\n- Tier: You'll notice\n- Useful: 3\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: no"}