Parallel subagents without merge hell: one worktree per task
Two agents editing the same checkout is not parallelism, it is a race. The fix is older than AI: give every task its own checkout, and make the plan prove the paths do not overlap.
The demo is always the same. Three agents, one repository, everything green. Then you try it on real code and the second agent overwrites the first one's file, the build fails, and you spend twenty minutes reconstructing which change came from where.
Parallelism without isolation is just a faster way to lose work.
What actually collides
- The working tree. Two writers, one directory. Last write wins, silently.
- The branch. Both agents commit to the same branch, so neither diff is reviewable on its own.
- The build. One agent runs a formatter or a codegen step while the other is mid edit.
- The terminal. Two processes competing for the same port, lock file or database handle.
Isolation has to cover all four, which means a separate directory, a separate branch, and a separate shell per task.
Worktrees in one minute
A git worktree is a second checkout of the same repository, on its own branch, sharing one object database. It is cheap: no clone, no duplicate history.
git worktree add ../wt-docs -b council/docs
git worktree add ../wt-export -b council/export
git worktree list
Now agent A edits ../wt-docs and agent B edits ../wt-export. Neither can see the other's uncommitted changes, and your main checkout stays clean while you keep reading it.
When a task is done, you merge its branch, or delete the worktree and the branch together. A failed experiment costs a directory, not a rebuild.
Path ownership is a planning problem
Worktrees stop file level collisions inside a task. They do not stop two tasks from being the same task. If the plan says task one edits src/index.ts and task two also edits src/index.ts, you have built a merge conflict on purpose.
The fix belongs at plan time: every task declares the paths it owns, and the plan is rejected when two tasks claim the same file or a directory that contains another task's file. Compare normalized paths, and keep src/a.ts distinct from src/a.tsx.
If two tasks cannot be reviewed independently, they should not be two tasks. Split by file ownership, not by verb.
Review per branch, not per session
A single agent session produces one giant diff, and a giant diff gets approved by vibes. One worktree per task produces one diff per task, each small enough to read with line numbers, comment on, and revert if it is wrong.
That is also what makes a reviewer subagent useful. Give it one branch, one brief and a rubric, and it can say something specific. Give it six branches and it will summarize.
The costs nobody mentions
- Dependencies. A fresh worktree has no
node_modules. Either share a package store with hard links, or accept the install cost per task. - Disk. Each worktree is small, but a monorepo with ten of them is not. Prune aggressively.
- Stale bases. A worktree created twenty minutes ago is behind main. Rebase before review, not after merge.
- Cleanup. Worktrees are real directories. Delete them when the branch merges, and never delete one that a live thread still points at.
How Council applies this
In Tuffcode, Council is the mode where this is automated. The planner returns a task list with owned paths, overlapping plans are rejected before dispatch, each worker runs in its own worktree with its own branch, and the board shows queued, running, passed, failed, blocked or cancelled per node.
Approval comes first. The plan parks for your review, and nothing starts until you approve it. If a worker fails, the goal ends failed with the provider's error text, and the surviving worktrees stay reviewable.
Threads outside Council can use a worktree too, and worktree threads get the full path: diff, checkpoints, commit, push and draft PR. Folder threads keep diff, checkpoint and commit, without the isolation.
A recipe you can run today
- Write the goal as a list of files, not a list of steps.
- Create one worktree per file group.
- Run one agent per worktree, with the same brief and a different scope.
- Review each branch on its own, then rebase the survivors onto main.
- Delete every worktree you did not merge.
Related: how Council works and what agent-native actually means.