Running Coding Agents in Parallel Without Them Colliding
One agent per task, one git worktree per agent, and subagents for research that would flood the main context. The setup that lets me run three tasks at once, and the tasks I never split.
Once an agent can draft a change and run the checks on its own, the bottleneck becomes me waiting for it. The obvious next step is running several at once. The first time I tried, two agents edited the same file in the same checkout and each one "fixed" the other's work.
Here's the setup that works.
Update, November 2026: T3 Code now creates the worktree per thread for me. Ports, env files, and the review limit below still apply. More here.
One worktree per agent
A git worktree is a second checkout of the same repository in another folder, on its own branch. Agents in different worktrees can't touch each other's files.
git worktree add ../app-filters -b feat/order-filters origin/dev
git worktree add ../app-export -b fix/export-timezone origin/devEach agent gets its own folder, its own branch, and its own dev server port. When the task is done, I review the branch like any pull request and remove the worktree.
Three things to set up once:
- Ports. Give each worktree's dev server its own port, or the second one fails to start.
- Dependencies. Each worktree needs its own
node_modules. pnpm's shared store makes that cheap. - Env files.
.env.localisn't tracked, so copy it into each new worktree. A setup script that does all three saves a lot of "why won't it start".
Subagents for reading, not writing
The other kind of parallelism happens inside one session. When a task needs research, like "find every place that formats currency", the main agent can hand that to a subagent. The subagent reads twenty files and returns a short list. The main conversation gets the answer without the twenty files filling its context.
My rule: subagents read, the main agent writes. A subagent that edits code produces changes the main agent didn't see and can't reason about.
Which tasks to split
Good to run in parallel:
- Independent bug fixes in different features.
- A feature in one worktree, its tests or docs in another, once the interface is agreed.
- Exploratory spikes: two approaches to the same problem, keep the better one.
Never split:
- Anything touching the same files. Merge conflicts from agents are worse than from people, because neither side remembers why.
- Database migrations. Two branches each adding a migration means two migrations with conflicting order. One agent, one migration at a time.
- Work where I haven't decided the design. Parallel agents multiply a wrong decision.
The real limit is review
Three agents can produce three branches in the time I used to finish one. I can't review three branches properly in that time. So I cap it at what I can actually read: usually two tasks in parallel, sometimes three if one is small.
Running more agents than you can review just moves the bottleneck to a place where mistakes are easier to miss.
Keep reading
All posts2026
7 min
Code Is Cheap Now. Guardrails Are the Bare Minimum
An agent writes a feature in minutes. Whether it still works next week depends on what checks it the moment it changes. What I treat as non-negotiable now, on the backend, on the web, and on mobile.
testingaiworkflow5 min
Why T3 Code Replaced the Terminal as My Daily Agent Setup
Same agents, same subscriptions, one interface. Threads with their own worktrees, review before commit, approvals from my phone, and a second model one click away. What changed in my day, and what it still doesn't solve.
aiworkflowtooling