What
A worktree is a separate working copy of a project. Claude Code can give one to a helper agent so that agent's edits stay apart from yours. Before this release, worktree mode needed a git repository or a WorktreeCreate hook, which is your own script that makes the copy. A mod, meaning a user-written add-on, can now supply worktrees too. Prompts, error messages and cleanup were reworked around this.
- The worktree mode check now waits for the mod loader. If the installed mod is not loaded, it fails with a new message saying worktree mode needs a git repository,
WorktreeCreatehooks or a mod. - A new section of the worker prompt says a folder that is not a git repository still supports
isolation: "worktree"when a mod or hook makes the worktrees. In that case git and gh do not work, so workers commit and publish with the project's own version control and finish withPR: none. Phase 3 counts such a worker as done. - The Agent tool's
isolationsetting is now one shared definition with a new description covering "worktree" and "remote". "remote" runs the agent in a cloud environment, always in the background, and is only offered to some users. The "worktree" description says a project without version control that can make worktrees gets its own label in the folder. - Workflow web-fetch agents with
isolation: 'worktree'now get their copy through the hook-based creator, which may hand back a copy made in place. Their prompt then says "worktree" or "project" instead of "git worktree" or "repo", and each agent gets an agent ID assigned in advance. - The error for a returned path that is not a folder now names
WorktreeCreatefor the ordinary hook, or the other provider by name, and ends with "answering" instead of "echoing". - The symlink error now names the
vcs.isolatehook when a mod made the copy. That part is left out when you entered a worktree that already existed. - The error "Cannot create agent worktree: not in a git repository and no WorktreeCreate hooks are configured." can now use a default hint when an optional flag is set and no hook hint exists. When there is no hint, the text is the same as before.
- The safety checks for hook-made worktrees moved into one shared function.
- The
git branch -Dcall that deletes a branch was replaced by a helper. - Worktree creation accepts new
newInandskipsSetupoptions. - Cleanup of stale worktrees now skips a worktree whose recorded path still exists.
Why
A project that does not use git can now give helper agents their own working copies, as long as a mod or a hook makes those copies. The messages now say which kind of provider made the copy, which helps when something goes wrong. The cleanup change means a stale worktree is left in place if its folder is still there.
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.
When 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]…worktrees see the edit
| `WorktreeCreate` | No | Yes | Claude Code needs a worktree, and the hook creates it instead of git | Create the worktree and return its path in [`hookSpecificOutput.worktreePath`](https://code.claude.com/docs/en/hooks#worktreecreate-outp…agent-sdk/hooks see the edit
Anthropic's documentation has since written up WorktreeCreate, on Intercept and control agent behavior with hooks.