Follow Discord
Sweep 24 Nov 2026 · 22:58Z Build v2.1.332 549 read Stable v2.1.325 Latest v2.1.331 Next v2.1.332 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Run parallel sessions with worktrees changedworktrees

Nearest release: v2.1.332, published 2 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 25 Nov 2026 00:35 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 25 Nov 2026 00:37 UTC.

Upstream edited
Recorded here
Lines+2added
Lines−2removed
From line 137 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits49to this page, all time

The whole hunk

from line 137, old and new numbered
/
lines
from line 137
137137and report the results.
138138```
139139 
140Each subagent gets a temporary worktree that Claude Code removes automatically when the subagent finishes without changes; a worktree with changes stays on disk until the [periodic sweep below](#clean-up-subagent-and-background-session-worktrees) can remove it without losing work. For a worktree your [WorktreeCreate hook](https://code.claude.com/docs/en/hooks.md#worktreecreate) created, see [WorktreeRemove](https://code.claude.com/docs/en/hooks.md#worktreeremove) instead.
140When a subagent finishes, Claude Code keeps the worktree if git shows changed files, untracked files, or new commits there. Otherwise, Claude Code can remove the worktree right away. A kept worktree stays on disk until the [periodic sweep](#clean-up-subagent-and-background-session-worktrees) can remove it without losing work. For a worktree your [WorktreeCreate hook](https://code.claude.com/docs/en/hooks.md#worktreecreate) created, see [WorktreeRemove](https://code.claude.com/docs/en/hooks.md#worktreeremove) instead.
141141 
142142Subagent worktrees use the same [base branch](#choose-the-base-branch) as `--worktree`, so they branch from your repository's default branch unless `worktree.baseRef` is set to `"head"`.
143143 
from line 157
157157 
158158#### Worktree locks and manual removal
159159 
160While an agent is running, Claude Code holds a `git worktree lock` on its worktree so that concurrent cleanup can't remove it, and releases the lock when the agent finishes. Claude Code holds the same lock on the worktree it created for a backgrounded session while the session runs, so the sweep leaves the worktree in place and `git worktree remove` refuses to remove it.
160Claude Code takes a `git worktree lock` on the worktree it creates for an agent, so that concurrent cleanup can't remove it during the agent's first run, before any [resume](https://code.claude.com/docs/en/sub-agents.md#resume-subagents). The worktree Claude Code created for a backgrounded session has the same lock while the session runs, so the sweep keeps the worktree and `git worktree remove` refuses it.
161161 
162162The sweep also releases a lock Claude Code set for a session whose process has exited, so a killed background session doesn't leave its worktree permanently locked. The sweep never releases a lock you set yourself with `git worktree lock`.
163163 
Feedback