Follow Discord
Sweep 20 Nov 2026 · 19:55Z Build v2.1.330 547 read Stable v2.1.323 Latest v2.1.330 Next v2.1.330 Feeds RSS JSON llms.txt llms-full.txt Unofficial

Claude Code v2.1.326 ·

ExitWorktree refuses to remove a worktree while a task may still be running in it

ExitWorktree now refuses to remove a worktree while a background task or agent may be working there, unless discard_changes is set

Group of 2 You'll notice Improvements
JSON All of v2.1.326
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
ImprovementsKind: in v2.1.326,
ImprovementsSection of the release

What

A worktree is a separate working copy of a git repository that Claude can work in. The ExitWorktree tool leaves it, either keeping it or removing it.

  • Removing a worktree is now refused while a background task or agent may still be working there, unless discard_changes is set. The message says "Nothing was removed" and names the running task.
  • The tool's instructions now say discard_changes also removes the worktree from under any task still running, so it should be set only after you confirm.
  • The instructions now say removing also deletes the branch, unless a hook made the worktree or git refuses, in which case the branch is not deleted.
  • The result carries a sandbox note that is added to what the tool returns.

Why

This guards against a worktree being deleted while a background agent is still working in it and losing that work. Claude should now ask you before forcing the removal.

Read from
Names in the bundleExitWorktree
Since it was published

The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.

Added since A small documentation edit on Hooks reference touched a line naming ExitWorktree after this was published. For a `claude remote-control` cleanup, Claude Code runs your hook without prompting you. `ExitWorktree` refuses to remove a hook-created worktree unless the call passes [`discard_changes: true`](https://code.claude.com/docs/en/agent-sdk/ty… hooks see the edit
Confirmed since Anthropic's documentation has since written up ExitWorktree, on Claude Code changelog. * Changed `ExitWorktree` to ask before removing a worktree that may hold unsaved work; refused in don't-ask mode or with nobody to answer, unless an allow rule, auto or bypass permissions mode allows it changelog see the edit
How sure we are
Two sources agreeTwo things we can check say the same as this entry.
Anthropic's documentation agreesAnthropic's documentation has since written up ExitWorktree, on Claude Code changelog.
Anthropic's release notes agreeChanged ExitWorktree to refuse removing a worktree while a background subagent or shell command may still be running in it, unless Claude…

See this entry in the whole of v2.1.326 →

Feedback