How to run multiple Claude Code sessions in parallel without losing track
By Anjali Singh, maker of Doki · Published 26 November 2026
Running one Claude Code session feels like pair programming. Running three feels more like managing a small engineering team: useful, fast, and surprisingly easy to lose track of. The trick is to isolate the files, give each session a separate job, and make waiting sessions visible.
The short answer
Start each session in its own Git worktree:
claude --worktree coupon-codes
claude --worktree search-timeout
claude --worktree billing-tests
Run each command from the main checkout in a separate terminal. Claude Code creates a separate folder and branch for each session, so they cannot overwrite one another's working files. Give the sessions tasks that touch different parts of the codebase, ask each one to test and commit its work, then review and merge the branches one at a time.
Why run Claude Code in parallel?
AI coding work has pauses. A session may be reading a large codebase, running a test suite or waiting for a permission. Starting an independent task during that time can turn the waiting into useful work.
Anthropic's Claude Code power user guide suggests running three to five sessions in parallel. That does not mean every task should be split five ways. It works best when you have several pieces of work that can finish independently, such as:
- building a checkout feature while another session fixes a search bug;
- updating an API while another session writes unrelated documentation;
- asking one session to investigate a failure without letting it edit the feature another session is building.
If both tasks need to redesign the same module, keep them in one session or do them one after the other. More sessions create more output to review; they do not make tightly coupled work independent.
What a worktree does
A Git worktree is another working folder connected to the same repository. It has its own checked out branch and its own copy of the files, but it shares the repository history and remotes. Claude Code's own --worktree flag creates one under .claude/worktrees/ and starts the session inside it. The official worktree guide has the full reference.
For example, this command:
claude --worktree coupon-codes
creates a worktree at .claude/worktrees/coupon-codes/, on a branch named worktree-coupon-codes. A second command with a different name gets a different folder and branch.
This prevents two sessions from changing the same physical file at the same time. It does not prevent a merge conflict later if both branches change the same lines. Worktrees provide isolation, not coordination.
Set up three sessions
First, open the repository normally and make sure its default branch is up to date. Then add Claude Code's worktree folder to .gitignore if it is not there already:
.claude/worktrees/
Open a terminal for each independent task and run one command in each:
# Terminal 1: a product feature
claude --worktree coupon-codes
# Terminal 2: an unrelated bug
claude --worktree search-timeout
# Terminal 3: test coverage in another area
claude --worktree billing-tests
By default, new worktrees start from the repository's remote default branch, usually main. That is helpful because every session begins from the same clean baseline. If a session needs your current unpushed commits, commit them first or configure Claude Code's worktree.baseRef setting to use your current HEAD.
Give each session a job with boundaries
“Improve checkout” is a poor parallel task. It leaves too many decisions open and is likely to overlap with other work. A useful brief says what to change, where the boundary is, how to verify it, and what the session should leave behind.
A prompt can be as simple as:
Add percentage coupon support to checkout.
Scope:
- Work in src/checkout and tests/checkout only.
- Do not change the pricing API or shared money types.
- Preserve fixed-amount coupons.
Done when:
- Percentage coupons are validated and applied.
- Existing and new checkout tests pass.
- Summarize the behavior and commit the changes.
Use the same shape for every session. File boundaries are especially valuable: they make accidental overlap obvious before the work starts.
Prepare each worktree's environment
A worktree is a fresh checkout. Tracked source files are present, but ignored files and generated dependencies usually are not. The session may need to run your normal setup command, such as npm install, before it can test anything.
If every worktree needs ignored configuration files, create .worktreeinclude in the repository root. It uses .gitignore-style patterns:
.env
.env.local
Only matching files that are already ignored by Git are copied. Keep the list narrow: a worktree should receive only the local configuration it actually needs, especially when those files contain secrets.
Do not make yourself the polling loop
Parallel sessions become frustrating when you repeatedly open three terminals to ask, “Are you done yet?” A session that finished ten minutes ago is wasted capacity; one waiting for a permission can hold up the rest of your plan.
At minimum, turn on your terminal's notifications. For a more detailed setup, see the four ways to get notified when Claude Code finishes on a Mac.
Doki is the option we make. It is a desktop pet for Mac that walks over when a Claude Code session finishes or needs you. The bubble names the project, gives you a short line about what happened, and opens the right app when you click it. If several sessions report while you are busy or away, Doki puts them into one digest with waiting sessions first.
The practical goal is not more notifications. It is to notice the session that needs a decision without keeping every terminal in view.
Review and merge one branch at a time
When a session finishes, do not immediately merge all three branches. Review the smallest unit first:
- Read the session's summary and inspect its diff.
- Run the relevant tests inside that worktree.
- Make sure the session committed only its assigned work.
- Merge that branch into the default branch.
- Run the important tests again after the merge.
- Update or rebase the next branch before merging it.
From the main checkout, these commands show the commits and diff for the coupon session. Replace main if your default branch has another name:
git log --oneline main..worktree-coupon-codes
git diff main...worktree-coupon-codes
After reviewing it, merge it through your normal pull request process or locally:
git switch main
git merge --no-ff worktree-coupon-codes
npm test
Testing again matters because two branches can each pass alone and still break something when combined.
Clean up when the work is safe
When you exit an interactive worktree session, Claude Code checks whether it contains changes or new commits. It can remove a clean, unnamed worktree automatically; when work would be lost, it asks whether to keep it.
You can see every remaining worktree with:
git worktree list
If you created a worktree manually, remove it with git worktree remove <path> after its work is merged and the folder is clean. Do not simply delete the folder in Finder, because Git also keeps metadata for each linked worktree.
A practical rhythm
Start with two sessions, not ten. Give each a small, independent task and require a test result plus a commit. While they work, prepare the next tasks or review completed work. When one asks for input, answer it; when one finishes, review it before adding another session.
A sustainable loop looks like this:
- Choose two or three tasks that don’t overlap.
- Start a named worktree session for each.
- Let notifications bring blockers to you.
- Review one completed branch at a time.
- Merge, test the combined result, then clean up.
The number of sessions is not the score. The useful measure is how much correct, reviewable work reaches your default branch without creating a queue you cannot understand.
Common questions
Can several Claude Code sessions use the same repository?
Yes. Put each session in a separate worktree. They share Git history but get separate folders and branches, so their uncommitted edits do not overwrite one another.
Can the sessions edit the same files?
They can edit their separate copies, but you may get conflicts when merging. Divide work by feature, module or file ownership whenever possible.
Do I need tmux?
No. Separate Terminal or iTerm windows work. Claude Code also supports adding --tmux to its worktree command if that is already how you organize terminal sessions.
Can I do this in the Claude Desktop app?
Yes. Start a new Code session and choose the worktree option for the project. Each desktop session is independent, and the sidebar keeps them together. Doki's Claude alerts work with sessions in Terminal and editors such as VS Code and Cursor on your Mac; sessions that run in the cloud or in the Claude app's sandbox can't reach Doki yet.
How many parallel sessions should I run?
Start with two or three. Add another only when you can still give every session a distinct task and review its result promptly. Three clearly scoped sessions are more useful than ten overlapping ones.