{"version":"2.1.334","anchor":"agent-worktrees-can-be-handled-by-the-host-session","canonical_anchor":"agent-worktrees-can-be-handled-by-the-host-session","heading":"Apps running Claude Code can clean up subagent worktrees themselves","tier":"internal","area":"Subagents","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.334\/e\/agent-worktrees-can-be-handled-by-the-host-session","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.334","markdown":"### Apps running Claude Code can clean up subagent worktrees themselves\n\nWhen the app running Claude Code has its own worktree manager, subagent worktrees are removed through it and not kept for uncommitted changes\n\n**Unclear.** It is not clear which apps that run Claude Code supply their own worktree manager.\n\n**What**\n\nA worktree is a separate working copy of a git repository. Subagents (helpers Claude starts for part of a task) can work in their own worktree.\n\nWhen the program hosting the session provides its own worktree manager, Claude Code now removes subagent worktrees through that manager instead of through git. In that case it also no longer keeps a worktree because it has uncommitted changes. Before, cleanup always went through git.\n\n**Why**\n\nThis changes how worktrees are cleaned up in apps that host Claude Code, such as desktop or SDK apps. In those apps, a subagent's worktree with uncommitted changes may be removed instead of kept.\n\n- Area: Subagents\n- Tier: Under the hood\n- Useful: 2\/5\n- Signal: 3\/5\n- Scope: individual\n- Heads-up: no"}