A large part of how my team ships quickly is running parallel agent sessions. A ticket is split into independent pieces, and each piece gets its own session in its own branch. Side by side, they finish in a fraction of the time one after another would take.

That only works if the sessions do not step on each other. Left alone, they will: two agents editing the same file, one session switching a branch under another, a stash that quietly swallows someone's work. Most of the chaos is avoidable with a few mechanical habits.

One worktree per session

A git worktree is a second working directory attached to the same repository. Each session gets its own directory and its own branch. They share history and objects, but not files on disk.

git fetch
git worktree add ../repo-feature-x -b feat/feature-x origin/main
cd ../repo-feature-x
A new session starts here, never in the main checkout.

This solves the most common collision. If two sessions work in one checkout, switching branches in one changes the files under the other. With worktrees, nothing is shared. It also protects the main checkout, which often has a developer's own work or a dev server running in it. An agent should never touch that.

When the work is done and merged, remove the worktree. They accumulate and take disk space.

Never a shared stash

The git stash is shared across all worktrees of a repository. A bare stash in one session puts changes where another session can pop them, or where nobody remembers them.

The rule is to avoid bare stash entirely. If you need to switch context, commit work in progress on your own branch. Commits are named, attached to a branch and visible. Stashes are anonymous and global.

Feature branches only

  • Sessions never push to main. Every change goes through a pull request.
  • Sessions never force-push. If a branch needs a rewrite, push a new branch with a version suffix and open a new pull request.
  • Branches are named for what they do, so a human scanning the list knows what is in flight.

These are the rules most worth writing into the repository's agent rules file, because a single violation is expensive and an agent will not infer them. Written down, every session reads the same limits.

Clear ownership of files

Worktrees prevent collisions on disk. They do not prevent conflicts at merge time. If two sessions both edit the same file, someone will resolve a conflict, and the result is often wrong.

So the split of work should follow file boundaries. When I divide a ticket, I give each session a short list of what it owns, and a list of what it must not touch. A useful brief contains:

  • The goal, and what done looks like.
  • The files or directories the session owns.
  • The files it must not change, and who owns them.
  • The checks to run before opening a pull request.
  • What to do when it needs something outside its scope.

If a ticket cannot be split without overlap, that is information. Either do it in sequence, or make the shared piece its own first change that the others build on.

Small pull requests, merged often

Parallel sessions produce several focused pull requests instead of one sprawling one. Keep them that way. A small pull request is easier for a reviewer, human or AI, to check against proof. It conflicts less. It is easier to revert.

Merge often. A branch that stays open for days drifts from main, and the longer it drifts, the more the other sessions' work conflicts with it. The review gates exist to make frequent merging safe: tests, an AI reviewer, recorded verification and a human decision.

Let agents ask an orchestrator, not the human

Several agents asking one person for answers produce a queue of interruptions. Most questions an agent asks do not need a person. They need a coordinator that knows the plan.

In practice, one session acts as the orchestrator. It holds the overall plan and the file ownership. Worker sessions send their questions and blockers to it: which of two approaches fits the plan, whether a file is free to change, what another session already decided. The orchestrator answers what it can from the plan and escalates to the human only what needs a person.

What always goes to a person: product decisions, scope changes, production access and anything hard to reverse. Agents propose; people decide. The orchestrator gathers those decisions and puts them in front of the human together, instead of one interruption per session.

When it still goes wrong

Collisions will happen anyway. When they do, treat each one as a missing rule. If two sessions edited the same file, the brief was unclear about ownership. If a session pushed to the wrong branch, the rules file did not say so plainly enough. Fix the instruction, not only the incident, and the same mistake stops recurring across every future session.

Machine etiquette

  • Run targeted checks locally (lint, type check, one spec). Leave full builds and full suites to CI, so a handful of sessions do not saturate the machine.
  • Do not start, restart or kill a developer's dev server. Ask them to.
  • If you must stop a process, kill it by its PID, never by a name pattern that could match someone else's.

Put it in writing

None of these habits are clever. Their value is that they are consistent, and consistency across agents comes from the rules file in the repository. I write the worktree command, the branch rules, the stash rule and the escalation rule there once, and every session starts under the same constraints.

The result is more changes in flight without more collisions. The speed comes from the system, not from heroics.