How to Run Several Claude Code Sessions at the Same Time
To run several Claude Code sessions at once, give each session its own git worktree and its own terminal. A worktree is a separate copy of the project files on its own branch, so two sessions never edit the same file on disk. Then name each session and set up an alert, so you know which one is waiting for you.
Why run more than one session
A Claude Code session spends most of its time working without you. It reads files, runs tests and edits code while you watch. A second session lets you use that time.
See every Claude Code session on one screen, get pinged when one needs you, track what it costs, and stop a bad command before it runs.
Common setups:
- One session builds a feature while another fixes an unrelated bug.
- One session writes code while another reviews it or writes the tests.
- A long job, such as a large refactor, runs in one terminal while you do short tasks in another.
Parallel work only pays off when the tasks are independent. Two sessions changing the same function will produce a merge conflict, however you set them up.
The problem: two sessions, one folder
Start two sessions in the same project folder and they share every file. One session edits a file while the other is reading it. One runs the tests while the other has the code half changed. Both may try to commit at the same moment. The results are confusing and hard to trace.
Git worktrees fix this. Each worktree is its own folder with its own branch. All of them share one repository history, so commits made in one are visible to the others.
Start each session in its own worktree
Claude Code has a flag for this. Run it from your project folder:
claude --worktree feature-auth
Open a second terminal and run the command again with a different name:
claude --worktree fix-login-bug
The short form of the flag is -w. Here is what the command does by default:
| Item | Default |
|---|---|
| Folder | .claude/worktrees/<name>/ at the root of your repository |
| Branch | A new branch named worktree-<name> |
| Starting point | The repository's default branch |
Two things to do once per project:
- Add
.claude/worktrees/to your.gitignore. This keeps worktree files out of the untracked list in your main checkout. - Make at least one commit. Git needs a commit to create a worktree from.
Set up each worktree before real work starts
A worktree is a fresh checkout. It holds the tracked files only. Installed dependencies and ignored files such as .env are missing.
- Install dependencies in the new worktree, or ask Claude to do it as the first step.
- To copy ignored files into every new worktree, add a file named
.worktreeincludeto the project root. List the files in it, one per line, as you would in.gitignore.
When you exit a worktree session, Claude Code checks the worktree for changes and new commits. If it finds work, it asks whether to keep or remove the worktree. Removing deletes the folder and its branch, so commit and push what you want to keep first. Ignored files do not count as work. Copy out any that you need before you exit.
Or create the worktrees with git
You can also make worktrees by hand. This is useful when you want a specific existing branch, or a folder outside the repository.
git worktree add ../project-feature-a -b feature-a cd ../project-feature-a claude
Two more commands help you keep track:
| Command | What it does |
|---|---|
git worktree list | Shows every worktree and its branch |
git worktree remove ../project-feature-a | Removes a worktree when you are done with it |
One terminal per task, with a name
Three terminals that all say "claude" in the title are easy to mix up. Give each session a name that states its task.
| When | How |
|---|---|
| At startup | claude -n auth-refactor |
| During a session | /rename auth-refactor |
| To come back later | claude --resume auth-refactor |
A few habits keep the terminals straight:
- Keep one task per session. When the task is done, close the session and start a new one for the next task.
- Arrange the terminals so each has a fixed place: tabs in a set order, or panes in a grid.
- Write a first prompt that says exactly where the task ends. A session with a clear finish line asks fewer questions.
Know which session is waiting for you
The cost of parallel sessions is attention. A session stops to ask permission for a command. You are looking at another window, and it sits idle until you notice.
There are three ways to deal with this, from simple to complete.
- Check on a schedule. Tab through every terminal each few minutes. This is free and it works for two sessions. It gets tiring with more.
- Add a notification hook. Claude Code can run a command of your choice when a session needs input. Use it to raise a desktop notification. Claude Code hooks explained has a config you can copy.
- Use a dashboard. Gander is a free local dashboard fed by those same hooks. It shows a "needs you" list across all projects, and you can answer or allow a request from that list. It also warns when two sessions edit the same file at once.
How many sessions to run
Start with two. Add a third only when both of these hold:
- You have another task that is independent of the first two.
- You still read what each session produces before you merge it.
Each session also uses your plan's usage limit or your API budget. Sessions in parallel spend it faster than one session does.
The review step is the real limit. Each session creates a branch that someone has to read, test and merge. When unread branches start to pile up, drop back to fewer sessions.
See every Claude Code session on one screen, get pinged when one needs you, track what it costs, and stop a bad command before it runs.
Comments