What a worktree is
Git’s own description: “A git repository can support multiple working trees, allowing you to check out more than one branch at a time.” A worktree is a second folder, attached to the same .git, with its own branch checked out. Edits in one folder do not touch the other. Git refuses to check the same branch out in two worktrees, so every worktree is also a separate branch.
$ git worktree list
$ git worktree remove ../app-reset-flow
Using worktrees with Claude Code, Codex and Cursor
Claude Code has a flag for it: claude --worktree feature-auth starts a session in a fresh worktree on its own branch, created from an existing commit. Codex and Cursor have no flag, but you can start either one inside a folder you created with git worktree add and get the same isolation. Chain does this step for every agent it opens: chain open claude creates a worktree on a branch named {user}/{task-slug} and starts the agent there.
What worktrees fix
- Live overwrites. Two agents in one folder write to the same files on disk. Two agents in two worktrees cannot.
- Half-finished states. One agent’s in-progress edit no longer breaks the other agent’s build or tests.
- Branch hygiene. Each task ends up on its own branch with its own history, ready to review and merge.
What worktrees do not fix
- Merge conflicts. Two agents can still rewrite the same function on two branches. Git tells you at merge time, and only if the edits land on the same lines. Different lines in the same function merge cleanly and break at runtime.
- Shared services. Worktrees separate files, not processes. Two agents pointed at the same dev database or the same port still collide.
- Teammates. A worktree is a folder on your Mac. Your colleague’s agent on their Mac has no idea it exists. Nothing stops both of you from taking the same task.
- Merge order. Somebody still has to merge the branches one at a time, re-test after each landing, and decide what to do when two of them disagree.
What to add on top
The missing piece is a shared view of who is changing what. Chain gives every co-work one board of claims: before an agent edits, it claims the paths it is about to touch, and a pre-tool hook refuses writes to paths another agent holds. That turns “separate folders” into “separate work”. When an agent finishes, Chain runs the tests in its worktree, merges if green, pushes and releases the claims. The file claims guide goes into how claims and hooks work, and the parallel agents guide puts the whole sequence together.