Level 1
A linked worktree
Another checkout of the same repository. Isolates files. Carries nothing else.
Parallel agents in lpm
Two agents in one folder overwrite each other. A worktree fixes that in one command — and then leaves you to rebuild the environment around it. This page covers what worktrees do for agents, what Claude Code and Codex now do natively, and the three levels of isolation you can choose between.
Level 1
Another checkout of the same repository. Isolates files. Carries nothing else.
Level 2
The same checkout, created and torn down for you, with the agent already running in it.
Level 3
The project as it exists on disk right now — local files, dependencies, uncommitted work — with its own Git repository.
The short answer
Give every agent its own directory. A Git worktree is the cheapest way to do it: a second working directory on its own branch, backed by the same repository history.
git worktree add ../app-auth -b auth
cd ../app-auth
claudeClaude Code and Codex now do this for you: claude --worktree creates, enters, and cleans up a worktree per session, and the ChatGPT desktop app gives each Codex chat one. The rest is still yours to set up: copying your .env, installing dependencies, carrying over uncommitted work, and sharing the ports and databases every agent still uses.
That gap is why a second primitive exists. lpm creates worktrees too, and lpm Duplicate can instead copy the project as it sits on your disk into a standalone project with its own Git repository — then start the agent in each one.
Creating the worktree is one command. These are the five reasons the agent inside it still cannot run your project.
What you see Every environment variable is undefined
Fix in a worktree List them in .worktreeinclude, or copy them by hand
In a copy Comes along
What you see A full install per agent before any work starts
Fix in a worktree Install per worktree, with a setup script
In a copy Comes along
What you see The agent starts from a commit you moved past
Fix in a worktree Commit or stash first
In a copy Comes along
What you see fatal: 'main' is already checked out
Fix in a worktree One branch per agent
In a copy Comes along
fatal: 'main' is already checked out at '/path/to/repo'Linked worktrees share one repository, and Git refuses to check out a branch in two of them — a commit in one would leave the other pointing at a stale state of the same branch.What you see The second dev server can't bind its port
Fix in a worktree Per-copy config, separate services or containers
In a copy Still shared
The first four go away when you copy the whole project instead of a worktree: your .env, installed dependencies, and uncommitted work come along by default, and the copy has its own repository, so it can stay on a branch that is checked out elsewhere. The fifth holds for copies too.
Before adding a tool, check what your agent ships with. For a single session on a clean branch, the built-in flag is usually enough. Checked against each CLI's documentation in September 2026.
Pass --worktree (or -w) with a name and Claude creates the worktree, starts the session inside it, and offers to remove it on exit. Worktrees land under .claude/worktrees/<name>/ on a branch named worktree-<name>. Subagents can get the same treatment with isolation: worktree in their frontmatter.
claude --worktree feature-auth
# copy gitignored files into every new worktree
cat .worktreeinclude
.env
.env.localNew worktrees branch from your default branch unless you set worktree.baseRef to head. Anthropic's own documentation is explicit that a worktree is a fresh checkout and you still have to initialize the environment inside it. Claude Code worktree documentation
Codex in the ChatGPT desktop app can give each chat its own worktree, so several run in the same project in parallel. Worktrees are created under $CODEX_HOME/worktrees/ in a detached HEAD state rather than on a branch, leaving your main checkout untouched, and older ones are cleaned up automatically.
It reads a .worktreeinclude file too, and a local environment can run a setup script in each new worktree. Uncommitted work, ports, and databases are still yours to handle. Codex worktree documentation
Worktrees are a Git feature, not an agent feature, so any terminal agent works inside one. What varies is whether the agent creates and cleans up the directory for you, or whether you script it.
git worktree add ../app-copilot -b copilot-task
cd ../app-copilot
cp ../app/.env .env
pnpm install
copilotThis is the loop that agent-specific flags remove — and the loop that stays if the agent you use does not have one.
Raw Git, the worktrees Claude Code and Codex create for you, and both lpm primitives, side by side, so you can see exactly where each boundary is drawn.
The last one is worth reading twice. Nothing above reserves a port, namespaces a database, or forks a Docker volume, including both lpm entries. Filesystem isolation is where all five stop, and shared ports and databases are where parallel agents usually collide. lpm catches the port half of it when a project starts: it tells you which process holds a declared port and can stop it or cancel the start. Giving each copy its own ports is up to your configuration.
lpm does not ask you to give up worktrees. Pick the kind from the project menu, and both share the same fan-out form for queuing the work.
lpm Worktree
Each one is a real Git worktree on a new branch from your current commit, sharing the repository. Uncommitted and ignored files stay behind, the same as raw Git. Tick Install dependencies when the worktree needs them.
lpm Duplicate
A copy of the folder with its own Git repository, carrying uncommitted work, ignored files, and installed dependencies; on APFS it is a copy-on-write clone. Regenerable build caches are left behind.
Right-click a project and choose Duplicate for standalone copies or New worktree for linked worktrees, then set how many, up to 50.
Label them, group them in the sidebar, and pick the action or command each one should run, with the prompt to send. Each copy can get its own.
Watch every copy's agent status from the sidebar, review the diffs, and delete the copies you do not keep. Deleting is permanent.
The agents can drive this themselves. lpm installs skills for Claude Code, Codex, Gemini CLI, and OpenCode, so an agent asked to try three approaches can create its own copies, run the work in them, wait for the others to settle, and clean them up when you have merged the one you want. Already typing the prompt? Choose Run in duplicates from the composer’s send menu to run it here and in fresh copies at once, or read the full guide to running Claude Code in parallel.
Work down the list and stop at the first line that describes your repository.
One agent, one clean branch, and setup is cheap
Your agent's built-in flag
claude --worktree, or a worktree chat in the ChatGPT desktop app for Codex. Nothing to install, and the agent cleans up after itself.
Several agents, and your repository needs no local setup
Git worktree, or lpm Worktree for the batch
The checkout is all the agent needs, so the lightest primitive wins. Use lpm Worktree when you want several at once with a prompt queued on each.
The agent needs your .env, your dependencies, or your uncommitted work
lpm Duplicate
A checkout cannot reproduce state that was never committed. A standalone copy of the working project can.
Several agents should attempt the same branch and you keep the best
lpm Duplicate
Linked worktrees refuse a branch that is already checked out. Independent repositories have no such restriction.
You are running agents with approvals turned off
A container or a VM
None of these models is a security boundary. A separate directory does not contain a command that decides to touch the rest of your machine.
Yes. Pass --worktree or -w with a name and Claude Code creates the worktree, starts the session in it, and offers to remove it when you exit. Worktrees are created under .claude/worktrees/<name>/ on a branch named worktree-<name>, and subagents can be pinned to their own worktree with isolation: worktree in their frontmatter.
No. git worktree add checks out tracked files from the commit you point it at. Anything ignored by Git — .env files, node_modules, virtualenvs, local certificates — is absent from a new worktree. Claude Code and Codex can copy selected ignored files into the worktrees they create if you add a .worktreeinclude file, and lpm Duplicate carries them because it copies the project folder instead of checking one out.
Only if two sessions could touch the same files. A worktree hands each session a separate checkout on its own branch, so their edits cannot collide; sessions working in unrelated parts of the repo can share one checkout. Whatever directory you pick — a worktree, a standalone copy or a container — sessions on one Claude account still share its plan limits, so the ceiling is usually how many diffs you can review.
No. Git refuses with 'fatal: <branch> is already checked out at <path>', because a commit in one worktree would leave the other pointing at a stale state of the same branch. If you want several agents to attempt the same branch and then keep the best result, each one needs an independent repository rather than a linked worktree.
Yes. Codex in the ChatGPT desktop app can run each chat in its own Git worktree, created under $CODEX_HOME/worktrees/ in a detached HEAD state, so several chats work in parallel and your main checkout stays untouched. It can copy files listed in .worktreeinclude and run a setup script in each worktree, but as with Claude Code, ports and databases are still shared.
No, and lpm does not isolate them either. Every model on this page draws its boundary at the filesystem, so two agents in two worktrees will still fight over port 3000 and still run migrations against the same database. lpm checks declared ports before a project starts and tells you which process is holding one, so the collision surfaces immediately instead of halfway through a run. Isolating runtime state needs per-copy configuration, separate services, or containers.
Yes. Worktrees are a Git feature, so any terminal agent runs inside one. What differs is whether the agent creates and cleans up the directory for you. Claude Code and Codex do; for the others you run git worktree add yourself, or use a tool that does the batch for you.
lpm installs skills for Claude Code, Codex, Gemini CLI, and OpenCode that teach the agent how to drive lpm directly. An agent can then create its own isolated worktrees or copies, run work in them, wait for the others to settle, and remove them, without you translating each step yourself.
They are separate items in a project's right-click menu. New worktree creates real linked Git worktrees, each on a new branch from your current commit, sharing your repository. Duplicate creates standalone folders with their own Git repository, starting from the project exactly as it is on disk. Both create up to 50 at a time, inherit the project's services, actions, and pinned Claude account, and can queue an action or command with a prompt on each one.
No. lpm Worktree creates a real Git worktree, so it has the same blind spot as raw Git: uncommitted and ignored files are not carried over. Tick Install dependencies to install them fresh in each worktree. If the copy needs your local files and current state, use lpm Duplicate instead.
lpm deletes the folder outright and skips the Trash, and removing a worktree also force-deletes its branch, so push or merge anything worth keeping first.
A linked worktree is very compact because the repository data is shared. On APFS, a Duplicate begins as a clone whose unchanged blocks stay shared on disk, and it only grows as each copy changes; where the disk can't clone, as on ext4 or Windows, it is a full copy. Regenerable build caches such as .next, dist, and target are skipped rather than cloned.
Fewer than you can create. Spinning up five agents takes one command; reviewing five diffs and landing five branches does not scale the same way, and every session draws on the same plan limits. The bottleneck is usually review, not isolation.
The standalone-copy side of the comparison in full: what Duplicate carries that a checkout cannot.
Run AI coding agents side by side with each project’s services, logs, and status in view.
Give agents a CLI to run services, read logs, wait for readiness, and fan out into project copies.
The whole workflow for several Claude Code sessions at once, from one prompt to the diff you keep.
Fan out on a Linux box with cores to spare instead of the laptop you are typing on.
cmux gives every agent its own terminal tab; see how that compares with giving every agent its own checkout.
Download lpm and fan one prompt out to Claude Code, Codex, or any terminal agent — in linked worktrees or standalone project copies, whichever the task needs.