Safe parallel agents with Git worktrees
Run three or four agents against the same repo without them stomping each other's changes. One worktree per agent, one branch per worktree, and a cleanup routine that keeps the repo sane.
5 items, in reading order · 1.6k saves
Running more than one agent at once without them trampling each other: worktrees, branch strategy, and coordination patterns that survive contact with Friday afternoon.
Run three or four agents against the same repo without them stomping each other's changes. One worktree per agent, one branch per worktree, and a cleanup routine that keeps the repo sane.
The verified baseline setup.
Four parallel agents sounds like a 4x multiplier until they meet in the same file. Worktrees, task routing, merge order — what's your actual topology?
Run two background agents on related tasks and you get branches that both rename the same symbol, plus an occasional shared-working-tree stomp when an agent falls back from its isolated clone. Merging their PRs is a coin flip of conflicts.
Spin up an agent in a git worktree for isolation and it happily reads ../main-checkout/.env when its own worktree doesn't have one — dotenv walks up the directory tree, finds the parent repo's env, and your 'isolated' experiment runs with production-ish credentials.
Five days, two agents, one working Stripe billing portal: what was delegated, what broke, what it cost ($61.40 all-in), and the day everything went sideways.
Two agents, one week, one shipped portal.