# Best ways to run parallel coding agents on one repo (2026): worktrees, clones, sandboxes and branchable disks

Source: https://archil.com/compare/best-ways-to-run-parallel-coding-agents-on-one-repo

How to run many coding agents (Claude Code, Codex, Cursor or your own) against the same repo and dataset without them stepping on each other: git worktrees, full clones, a sandbox per agent, Codex cloud and Claude Code on the web, sandbox snapshots and forks, Archil disk branches and Amazon EFS, compared on setup time per agent, disk use, isolation, sharing the dataset, merging results and working across machines.

[All comparisons](https://archil.com/compare)

# Best ways to run parallel coding agents on one repo (2026)

On one machine, use git worktrees: each agent gets its own checkout and branch, all of them share one `.git` object store, and Claude Code (`claude --worktree`), the Codex app and Cursor create and clean them up for you. When the agents run on many machines and share a large dataset, prepare one workspace (repo, installed dependencies, data) and fork it per agent instead of rebuilding it: an Archil disk branches in about 33 ms at p50 whatever its size, every branch mounts on any machine or sandbox, and the dataset can sit on its own disk that every agent mounts read-only. Either way, merge the agents' work with git. If the repo is on GitHub and the data is small, a cloud agent product such as Codex cloud or Claude Code on the web is the simplest way to run tasks in parallel.

Updated November 2026. Competitor facts are from each vendor's own docs and pricing pages.

## The short list

1.  [git worktrees](#git-worktrees): Best for a handful of agents on one laptop or dev box, which is how most people run Claude Code, Codex or Cursor in parallel
2.  [Archil disk branches and sandbox forks](#archil-disk-branches-and-sandbox-forks): Best for many agents across machines or sandboxes, starting from one prepared workspace and sharing a large dataset
3.  [Cloud coding-agent products](#cloud-coding-agent-products): Best for teams that want parallel tasks with no infrastructure, on a repo hosted on GitHub, with little data beyond the code
4.  [Sandbox snapshots and forks](#sandbox-snapshots-and-forks): Best for teams already running agents on E2B, Modal or Daytona who want to skip setup for each agent
5.  [A sandbox per agent with a fresh clone](#a-sandbox-per-agent-with-a-fresh-clone): Best for small repos with fast installs, where simplicity beats start-up time
6.  [Amazon EFS for the dataset](#amazon-efs-for-the-dataset): Best for agents on EC2, ECS or EKS in one AWS Region that need the same dataset, with code checked out locally
7.  [A full clone per agent](#a-full-clone-per-agent): Best for agents or tools that need a fully separate repository, such as their own hooks, config or the same branch checked out twice

## Side by side

| Option | Setup per agent | Disk use | Isolation | Shared dataset | Merging results | Across machines |
| --- | --- | --- | --- | --- | --- | --- |
| git worktrees | A checkout, plus dependency install in each worktree | One shared `.git`; each worktree has its own files and dependencies | Separate files and branch; same machine, ports and user | Any local path, outside the worktrees | git merge or a pull request per branch | No |
| Archil disk branches and sandbox forks | Branch about 33 ms and mount about 50 ms (p50) at any size; a sandbox fork uses the same operations, plus boot | Copy-on-write: the base once, plus what each branch changes | A branch or a Firecracker microVM per agent; branches share the disk's credentials | One disk mounted read-only on many clients, up to 5,000 per disk | git push from each branch; disk branches don't merge back | Yes: any machine or sandbox that runs the Archil client |
| Cloud coding-agent products (Codex cloud, Claude Code on the web, Cursor cloud agents) | A fresh VM per task, started from a cached environment | Per-task VM disk: 30 GB on Claude Code; 8 or 32 GiB by default on Codex | A VM per task | Fetched by the setup script; no shared mount | A branch and pull request per task | Yes, on the vendor's cloud |
| Sandbox snapshots and forks (E2B, Modal, Daytona) | A new sandbox from a snapshot of a prepared one | A disk per sandbox, sized by the provider | A sandbox per agent | Provider volumes: Modal mounts read-only; Daytona shares FUSE volumes | git push from each sandbox | Yes, within one provider |
| A sandbox per agent with a fresh clone | Clone, install and fetch data every time | A full copy per sandbox | A sandbox per agent | Downloaded per sandbox, or a provider volume | git push from each sandbox | Yes |
| Amazon EFS for the dataset | Mount it; agents still need their own checkouts | One copy of the data | None on the share itself | NFS, mounted by many instances in one VPC | git, for the code | Yes, within one AWS Region and VPC |
| A full clone per agent | A clone, plus dependency install | Objects hardlinked with `git clone --local`; full copies otherwise | Fully separate repositories on one machine | Any local path | Push and fetch between clones, or through the remote | Only by cloning on every machine |

## What to look for

-   ### Setup time per agent
    
    Most of an agent's start-up is not the checkout but the environment: installing dependencies, building, downloading data. Claude Code's and Cursor's docs both say a new worktree needs its own setup. Options that fork a prepared workspace skip that step; options that start from a fresh clone repeat it for every agent.
    
-   ### Disk use for big repos and datasets
    
    Worktrees share git history but not working files or `node_modules`. Full clones copy history too, unless you clone with `--local`. Copy-on-write forks store the base once and only what each agent changes. A dataset should exist once, not once per agent.
    
-   ### Isolation between agents
    
    Separate working directories stop agents from overwriting each other's files, but agents on one machine still share its CPU, ports, caches, running services and user account. A sandbox or VM per agent separates all of that. Decide whether you're isolating edits or isolating machines.
    
-   ### Sharing the dataset read-only
    
    Agents usually read the same fixtures, test data or corpus and should not change it. Look for one copy that every agent mounts read-only, rather than a download per agent. On one machine that's any local path; across machines it needs a shared file system or volume.
    
-   ### Merging results
    
    For code, git is the merge path in every option here: each agent works on a branch, and you merge it or open a pull request. Workspace forks (sandbox forks, disk branches) don't merge back on their own; push the branch from inside them.
    
-   ### Works across machines
    
    A laptop or one large box runs a handful of agents. Dozens need several machines or sandboxes, and then worktrees and local paths stop working: each machine needs the repo, the environment and the data.
    

## Each option in detail

### 1. git worktrees

[git-scm.com](https://git-scm.com/docs/git-worktree)

**Best for:** a handful of agents on one laptop or dev box, which is how most people run Claude Code, Codex or Cursor in parallel

A worktree is another working directory attached to the same repository, on its own branch. Git shares everything except per-worktree files such as `HEAD` and the index, and won't check one branch out in two worktrees. The three main coding agents build on it. [Claude Code](https://code.claude.com/docs/en/worktrees) starts a session in a new worktree with `claude --worktree <name>`, under `.claude/worktrees/`, and subagents with `isolation: worktree` get one each. The [Codex app](https://learn.chatgpt.com/docs/environments/git-worktrees) creates a worktree per thread in `$CODEX_HOME/worktrees`. [Cursor](https://cursor.com/docs/configuration/worktrees) runs agents in worktrees with setup commands from `.cursor/worktrees.json`. Each agent's work ends up on a branch you merge or open a pull request from.

#### Strengths

-   Built into git and into Claude Code, Codex and Cursor, which handle creation and cleanup
-   History is stored once; a new worktree is only a checkout
-   Every agent's work is a branch, so merging is ordinary git
-   Gitignored files such as `.env` can be copied in automatically with `.worktreeinclude` (Claude Code and Codex)

#### Tradeoffs

-   Each worktree is a fresh checkout: Claude Code's docs say to install dependencies in it, and Cursor recommends against symlinking dependencies, so `node_modules` and build output exist once per agent
-   Agents share one machine's CPU, memory, ports, databases and dev servers, so two test suites or dev servers can still collide
-   Limited to one machine; Cursor caps worktrees at 25 per machine by default, and Codex keeps its 15 most recent managed worktrees
-   Large datasets don't belong in git: GitHub blocks files over 100 MiB

### 2. Archil disk branches and sandbox forks

[docs.archil.com](https://docs.archil.com/concepts/branches-and-checkpoints)

**Best for:** many agents across machines or sandboxes, starting from one prepared workspace and sharing a large dataset

Prepare the workspace once on an Archil disk: the repo checked out, dependencies installed, the build warm. Checkpoint it (13 ms at p50) and create a branch per agent (33 ms at p50), whatever the disk's size; each branch is an independent POSIX file system that mounts on any machine or sandbox in about 50 ms. Put the dataset on a second disk, mounted read-only by every agent. Each agent commits to its own git branch inside its disk branch and pushes it, so results merge through git as usual; git, including worktrees, runs on a mounted disk. If the agents run in [Archil sandboxes](https://docs.archil.com/compute/sandboxes/introduction), [fork the sandbox](https://docs.archil.com/guides/agents/parallel-agents) instead: the fork branches its root disk, so installed tools come along too.

#### Strengths

-   Fork time doesn't grow with the repo, the dependencies or the data
-   Copy-on-write: you're billed once for the shared base plus what each branch adds
-   Each branch mounts anywhere the Archil client runs: Linux machines, containers, Archil sandboxes, and E2B, Daytona or Modal VM sandboxes
-   A read-only dataset disk mounts on up to 5,000 clients, with reads up to 8 GiB/s per client
-   Sandbox forks give each agent its own Firecracker microVM, with 1 to 32 vCPU and up to 64 GiB of memory

#### Tradeoffs

-   Disk branches don't merge back into their parent; for code that's fine because git does the merging, but changes to the dataset or environment have to be copied by hand
-   Branches and checkpoints can't be deleted yet, so a branch per agent run accumulates
-   A branch isn't a security boundary: credentials cover the whole disk and all its branches, so give untrusted agents separate disks
-   Branching works on Archil-managed disks in AWS regions; a disk that keeps files as ordinary objects in your own bucket (native format) can't branch
-   A sandbox with mounted disks must be stopped before it's forked, and Archil publishes no boot time for sandboxes
-   Agents running outside Archil pay $0.07 per GB for data transfer on Developer and Team; Enterprise avoids it with PrivateLink or VPC peering

### 3. Cloud coding-agent products

[code.claude.com](https://code.claude.com/docs/en/claude-code-on-the-web)

**Best for:** teams that want parallel tasks with no infrastructure, on a repo hosted on GitHub, with little data beyond the code

Codex cloud, Claude Code on the web and Cursor cloud agents run each task in its own VM with the repo cloned, and hand back a branch or pull request. [Claude Code](https://code.claude.com/docs/en/cloud-environments) gives each session a fresh Ubuntu VM with 4 vCPUs, 16 GB of RAM and 30 GB of disk, snapshots the environment after a setup script that finishes in about five minutes, and runs one session per `claude --cloud` command. [Codex](https://learn.chatgpt.com/docs/environments/cloud-environments.md) runs each cloud task in a VM with 2 vCPUs, 8 GiB of RAM and 8 GiB of disk on Plus, or 4 vCPUs, 16 GiB and 32 GiB on Pro, Business and Enterprise. [Cursor cloud agents](https://cursor.com/docs/cloud-agent) run in isolated VMs, configured by snapshot or Dockerfile.

#### Strengths

-   Nothing to run: VMs, cloning, setup caching and pull requests are handled for you
-   A VM per task isolates processes and ports, not only files
-   Tasks keep running when your laptop is closed

#### Tradeoffs

-   No shared dataset: data comes in through the setup script, and Claude Code caches the environment only when setup finishes in about five minutes
-   Fixed VM sizes, at most 30 to 32 GiB of disk by default
-   Repo hosts are limited: Claude Code clones from GitHub, Codex from GitHub.com and GitLab.com, and Cursor adds Bitbucket Cloud and Azure DevOps
-   Each product runs its own agent; parallel Claude Code sessions share your plan's rate limits

### 4. Sandbox snapshots and forks

[docs.e2b.dev](https://docs.e2b.dev/sandbox/snapshots) · [Archil vs E2B](https://archil.com/compare/e2b)

**Best for:** teams already running agents on E2B, Modal or Daytona who want to skip setup for each agent

Prepare one sandbox, snapshot it, and start one sandbox per agent from the snapshot. An [E2B snapshot](https://docs.e2b.dev/sandbox/snapshots) captures the filesystem and memory of a running sandbox, the original keeps running, and one snapshot can start many sandboxes. Modal's `snapshot_filesystem()` [returns an image](https://modal.com/docs/guide/sandbox-snapshots) that starts sandboxes with identical copies of the filesystem. [Daytona](https://www.daytona.io/docs/en/sandboxes) VM sandboxes fork and snapshot; its container sandboxes start in under 90 ms by its own figure. For the dataset, [Modal Volumes](https://modal.com/docs/guide/volumes) can be mounted read-only, and [Daytona Volumes](https://www.daytona.io/docs/en/volumes/) are S3-backed FUSE mounts that many sandboxes share.

#### Strengths

-   Setup runs once, not once per agent
-   A sandbox per agent isolates processes, ports and packages
-   Works with any agent you install in the image

#### Tradeoffs

-   Snapshots and volumes stay inside one provider, and volumes mount only in that provider's sandboxes
-   Per-sandbox disks are small by default: Daytona gives 3 GiB, up to 10 GB
-   Modal filesystem snapshots expire after 30 days by default; Daytona container sandboxes can't fork
-   Shared volumes are last-write-wins, and Modal readers must reload to see new data; Daytona Volumes are slower than the sandbox's local disk

### 5. A sandbox per agent with a fresh clone

[modal.com](https://modal.com/docs/guide/sandboxes)

**Best for:** small repos with fast installs, where simplicity beats start-up time

Start a clean sandbox per agent on E2B, Daytona, Modal or similar, clone the repo, install dependencies, fetch the data, run the agent, and push its branch. Nothing is shared, so nothing can leak between agents or go stale.

#### Strengths

-   The simplest model: every agent starts from a known state
-   Full isolation per agent
-   Works on any provider and with any agent

#### Tradeoffs

-   Clone, install and data download repeat for every agent, so start-up time and egress grow with the repo and the dataset
-   Every sandbox stores a full copy
-   `git clone --filter=blob:none` and `--depth` cut the clone, but not the install or the data

### 6. Amazon EFS for the dataset

[docs.aws.amazon.com](https://docs.aws.amazon.com/efs/latest/ug/how-it-works.html)

**Best for:** agents on EC2, ECS or EKS in one AWS Region that need the same dataset, with code checked out locally

EFS is managed NFS: instances in every Availability Zone of a Region, in one VPC, can mount the same file system at once. Put the dataset there and give each agent a local worktree or clone for the code. EFS doesn't fork, so it shares data but doesn't isolate agents from each other.

#### Strengths

-   Fully managed and elastic, with no capacity to provision
-   Many instances mount it at once
-   Native to AWS

#### Tradeoffs

-   No snapshots-as-forks or clones, so every agent sees and can change the same files
-   Slow for working trees: in Archil's published benchmark, a react `git clone` took 81.5 s on EFS and 9.8 s on Archil
-   Mounts only from inside one VPC, so sandboxes on other providers can't use it
-   EFS Standard costs $0.30 per GB-month in us-east-1, plus per-GB read and write charges with Elastic throughput

### 7. A full clone per agent

[git-scm.com](https://git-scm.com/docs/git-clone)

**Best for:** agents or tools that need a fully separate repository, such as their own hooks, config or the same branch checked out twice

Clone the repository once per agent. On one machine, `git clone --local` hardlinks the files under `.git/objects` to save space, and `--shared` or `--reference` borrow objects from another repository instead. Each clone is a complete repository, so agents can't affect each other's refs or config.

#### Strengths

-   Complete separation of refs, hooks and config
-   Any agent or tool works unchanged

#### Tradeoffs

-   More setup than a worktree, with the same per-agent dependency install
-   Without `--local`, `--shared` or `--reference`, history is copied once per agent
-   Results move between clones by push and fetch, or through the remote

## The repo and the dataset are different problems

Code wants branches and merges, and git already does that well, whether the agents work in worktrees, clones, sandboxes or disk branches. Every option here ends with a git branch per agent.

The dataset wants the opposite: one copy that every agent reads and none of them changes, or, when agents do change it, a cheap fork per agent that you keep or throw away. For that, see [Best ways to fork a large dataset for parallel agents](https://archil.com/compare/best-ways-to-fork-a-large-dataset-for-parallel-agents).

The cost people miss is the environment between the two: dependencies, build caches and local services. Worktrees and fresh clones rebuild it per agent; snapshots, sandbox forks and disk branches copy it.

## Which one should you use?

| If you need | Pick |
| --- | --- |
| A few agents on your own laptop or dev box | git worktrees, through `claude --worktree`, the Codex app or Cursor |
| Dozens of agents on many machines, one prepared workspace and a large shared dataset | Archil disk branches or sandbox forks, with the dataset on a read-only disk |
| Parallel tasks with no infrastructure, repo on GitHub, little data | Codex cloud, Claude Code on the web or Cursor cloud agents |
| Already on E2B, Modal or Daytona | That provider's snapshots, or mount an Archil disk inside it for the shared data |
| Small repo, fast install, maximum simplicity | A fresh sandbox and clone per agent |
| Agents on AWS that only need to share data | Amazon EFS for the data, local worktrees for the code |
| Separate hooks, config or the same branch checked out twice | A full clone per agent, with `git clone --local` |

## Questions people ask

### What's the best way to run several Claude Code agents on the same repo?

Run each one in its own git worktree: `claude --worktree <name>` in each terminal creates a worktree under `.claude/worktrees/` on its own branch. Subagents with `isolation: worktree` get their own too. Install dependencies in each worktree, and add a `.worktreeinclude` file to copy `.env` and similar files. To run sessions on Anthropic's cloud instead, start each with `claude --cloud`. See [Claude Code's worktree docs](https://code.claude.com/docs/en/worktrees).

### How do I run multiple Codex agents in parallel without them conflicting?

In the Codex app, start each thread in a worktree; Codex creates them in `$CODEX_HOME/worktrees` and keeps the 15 most recent by default. Codex cloud runs each task in its own VM and hands back a diff you can open as a pull request.

### How do parallel agents share a large dataset without copying it to each one?

On one machine, keep the data outside the worktrees and point every agent at the same path. Across machines, use a shared file system: an Archil disk that every agent mounts read-only (up to 5,000 clients per disk), a Modal Volume mounted read-only, or Amazon EFS inside one AWS VPC. If agents need to change the data, fork it per agent instead.

### Do git worktrees save disk space for a big repo?

They save the history, which every worktree shares, but not the working files or dependencies: each worktree has its own checkout and its own `node_modules` or virtualenv. For a large monorepo or a big dependency tree, that's the dominant cost; copy-on-write forks of a prepared workspace avoid it.

### How do I merge the results from parallel coding agents?

Give each agent its own git branch and merge the winners, or open a pull request per agent. That works the same in worktrees, clones, sandboxes and disk branches. Archil disk branches and sandbox forks don't merge back on their own, so push the git branch from inside them. Cursor's `/best-of-n` also leaves applying the winning result to you.

### Can I use git worktrees on an Archil disk?

Yes. Git runs on a mounted Archil disk, including worktrees, so you can keep using worktrees on one machine and put the repo on a disk that outlives it. To spread agents across machines, branch the disk per agent instead; each branch is a full copy of the workspace, dependencies included.

### How many coding agents can I run in parallel on one repo?

On one machine, the limit is CPU, memory and ports, and Cursor caps worktrees at 25 per machine by default. Cloud products scale out, but parallel Claude Code sessions share your plan's rate limits. Across your own machines or sandboxes, an Archil disk mounts on up to 5,000 clients, and each agent can have its own branch.

## How we chose

We compared the ways teams give many coding agents the same repository and data: setup time per agent, disk use for large repos and datasets, isolation between agents, sharing the dataset read-only, merging results, and working across machines. Facts come from each project's own docs as of the date above: git, Claude Code, the Codex app and Codex cloud, Cursor, E2B, Modal, Daytona and Amazon EFS. Archil makes Archil. It ranks second because git worktrees are the better answer on one machine, which is where most people run coding agents; Archil is the better pick when agents run on many machines and share a prepared workspace and a large dataset.

## Related

-   [Running parallel agent attempts from one starting state: Copy-on-write branches for a code workspace, step by step.](https://archil.com/article/running-parallel-agent-attempts-from-one-starting-state-with-copy-on-write-branches)
-   [Best ways to fork a large dataset for parallel agents: lakeFS, Archil, ZFS clones, reflinks and more, for the data side.](https://archil.com/compare/best-ways-to-fork-a-large-dataset-for-parallel-agents)
-   [Modal vs E2B vs Daytona: Sandboxes for agent code, including snapshots and forks.](https://archil.com/compare/modal-vs-e2b-vs-daytona)
-   [Best ways to persist agent files across sandbox restarts: Keeping an agent's workspace when its sandbox stops.](https://archil.com/compare/best-ways-to-persist-agent-files-across-sandbox-restarts)

Or see [every comparison](https://archil.com/compare).
