Engineering Heresy

Engineering Heresy

Build Your AgenticOS: Worktrees for Parallel Agents

Parallel agents stomping files is an isolation problem, not a parallelism problem. Here's the worktree pattern that fixes it.

Glenn Eggleton's avatar
Glenn Eggleton
Jun 01, 2026
∙ Paid

Git worktrees are how you get the wall-clock benefits of parallelism without the merge conflicts. Use them whenever two agents may touch the same files.


You run four agents in parallel. All four try to edit the same source file. The last one to write wins. The other three changes are gone. You don't get an error. You don't get a merge conflict. You get silent data loss dressed up as a successful run.

That is not a parallelism problem. It is an isolation problem. Parallelism is the right call; sequential dispatch of independent work is a bug. The mistake is dispatching parallel agents into a shared working tree and expecting them not to stomp on each other.

Git worktrees fix this. Each agent gets its own branch, its own working directory, zero shared file state. When the agents are done, you read the diffs and merge. The wall-clock cost of parallelism, without the silent data loss.

Here is what worktrees are, the exact rule for when to use them, the cost you're accepting, the wave pattern that keeps dispatch manageable, the verification discipline that catches agent failures, and the anti-pattern that makes the whole thing pointless.

Keep reading with a 7-day free trial

Subscribe to Engineering Heresy to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2026 Glenn Eggleton · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture