Newhivemux swarm: Claude Code’s builds and tests run on your other Macs →

How to run multiple Claude Code sessions at once

Short answer

Start each Claude Code session in its own terminal, and in its own git worktree (claude -w <name>) when they share a repository, so they do not edit the same files. Run them inside tmux so they survive closing the terminal. Notifications or a sidebar such as hivemux show which session is waiting for a permission prompt. All sessions draw on the same plan usage limits.

By · · 7 min read

Claude Code works on one task per session, and a task often runs for minutes before it needs you again. Running several sessions side by side, one fixing a bug, one writing tests, one exploring another project, keeps you busy while each works. The two problems that come up are file conflicts between sessions and losing track of which one is waiting for you.

Step 1. Give each session its own working copy

Two sessions in the same folder share one working tree: both see each other’s half-finished edits and can overwrite them. For parallel tasks in one repository, give each session its own git worktree, a second checkout of the same repository on its own branch:

Terminal window
cd ~/code/api
git worktree add ../api-login-bug -b login-bug
git worktree add ../api-tests -b more-tests

Each folder has its own files and branch but shares the repository history. Remove a worktree when the task is merged:

Terminal window
git worktree remove ../api-login-bug

Claude Code can also do this itself. claude --worktree <name> (or -w) creates a worktree under .claude/worktrees/<name>/ at the repository root on a new branch named worktree-<name>, and starts the session there. Anthropic’s docs suggest adding .claude/worktrees/ to .gitignore. A .worktreeinclude file lists gitignored files, such as .env, to copy into new worktrees.

Terminal window
claude -w login-bug

Sessions in different projects do not need this; they already have separate folders.

Step 2. Start one Claude per folder

The simplest setup is one terminal tab per session:

Terminal window
cd ~/code/api-login-bug && claude -n login-bug
cd ~/code/api-tests && claude -n more-tests

-n names the session, so it is easy to recognise later in the /resume list. This works, but each tab ends when it closes, and with five tabs you have to click through them to see which one stopped to ask a question.

Step 3. Put the sessions in tmux

tmux runs your sessions inside a server that stays up when the terminal closes. One tmux session per project and one window per Claude is a layout that scales:

Terminal window
tmux new -s api -c ~/code/api-login-bug -n login-bug 'claude -n login-bug'
tmux new-window -t api -c ~/code/api-tests -n more-tests 'claude -n more-tests'
tmux attach -t api

Claude Code’s --tmux flag combines both steps: claude -w feature-auth --tmux creates the worktree and a tmux session for it (it uses iTerm2 native panes when available; --tmux=classic forces plain tmux).

Switch windows with the prefix key and a number, sessions with prefix s. Closing the terminal detaches; tmux attach brings it all back. See How to use Claude Code with tmux for the settings worth changing (the prefix key and Shift+Enter in particular).

Step 4. Know which session needs you

With sessions spread across windows, the real cost is checking them. Two generic options:

  • Hooks. Claude Code can run a command on its Notification and Stop hook events. Wire them to a desktop notification and you hear about sessions that need input or have finished. How to get notified when Claude Code needs input shows a working setup.
  • Agent view. Claude Code’s claude agents (a research preview at the time of writing) is one screen for background sessions started with claude --bg "<task>"; claude attach <id> opens one.
  • tmux activity flags. setw -g monitor-bell on marks windows that rang the bell in tmux’s window list. It tells you something happened, not what.

hivemux is a tmux sidebar that shows every Claude Code session — running, waiting for you, or done — and lets you jump to the one that needs you. It registers Claude Code hooks that write each session’s state onto its tmux pane, and a sidebar in every tmux window draws the whole board.

hivemux sidebar with Claude Code sessions grouped by project, showing running, needs input, done and idle sessions, one line each

Install and set it up:

Terminal window
curl -fsSL https://hivemux.dev/install.sh | bash

or

Terminal window
brew install hivemux/tap/hivemux
hivemux setup

Step 5. Work through the board

With hivemux, the daily loop looks like this:

  1. hm ~/code/api-login-bug opens a tmux session for that folder with a Claude window and a shell window.
  2. hm ~/code/api-tests opens the next one. The first keeps working.
  3. Prefix Shift+C adds another named Claude to the current project.
  4. Watch the sidebar. Each Claude is one line with its state, the task name and how long it has been in that state. A line that needs input turns amber.
  5. Press Option+0 to jump to the session that has waited longest; press it again to work through the queue. Option+1 … 9 jump to the first nine Claudes, in sidebar order.

The right side of the tmux status line works like a food-court pickup board: a numbered badge for every task that needs input (amber) or finished and is not seen yet (green). You also get a macOS notification for those, except for the session you are looking at.

To keep a fixed order, drag the Claudes’ lines and the project names in the sidebar; the Option numbers follow it.

Dragging a Claude’s line in the hivemux sidebar to reorder Claude Code tasks

Step 6. Keep them across reboots

tmux alone stops at a reboot. hivemux installs tmux-resurrect and tmux-continuum to save the layout every 5 minutes and, on the next start, types claude --resume <id> in each pane so every conversation comes back where it was. Sessions you ended with /exit are not resumed. Details are in How to resume Claude Code sessions after a reboot.

Common problems with multiple sessions

Two sessions edit the same files

Symptom: one session’s changes disappear or show up half-finished in another, tests fail for reasons neither session caused, or git status lists files you did not expect.

Fix: sessions started in the same folder share one working tree. Give each its own worktree (Step 1): claude -w <name> in each terminal, or git worktree add and start claude inside it. Three details from Anthropic’s worktree docs that catch people out:

  • claude -w branches from the repository’s default branch, not from the branch you are on. Set "worktree": { "baseRef": "head" } in settings to branch from your current HEAD instead.
  • A worktree is a fresh checkout, so gitignored files such as .env are missing and dependencies are not installed. List the files in .worktreeinclude and install dependencies in the new folder.
  • Do not resume the same conversation in two terminals: messages from both interleave into one transcript. Use claude --resume <id> --fork-session or /branch to get a separate copy.

A session waits on a permission prompt you never see

Symptom: you come back to a tab and find Claude has been waiting several minutes for approval to run a command or edit a file.

Fix: let Claude Code tell you. It fires a Notification hook when it needs your attention, which you can turn into a desktop notification; How to get notified when Claude Code needs input has a working setup. With hivemux, the waiting session’s line turns amber in the sidebar, a numbered badge appears in the tmux status line, and Option+0 jumps straight to it.

Usage limits run out sooner

Symptom: a “You’ve hit your session limit” or “weekly limit” message arrives earlier than you are used to.

Fix: that limit is a usage window on your plan, not a limit per Claude Code session, so every session you run draws on the same allowance. On Team and Enterprise plans, Anthropic’s docs say the per-seat allowance is also shared with Claude chat and Cowork. Run /usage to see your plan usage and what is consuming it. Each request carries the whole conversation, so long sessions cost more per message: /clear a session when it moves to an unrelated task, and stop sessions you are not using.

Too many tabs to tell apart

Symptom: five tabs all titled claude, and you click through each to find the one you want; closing the wrong window ends a session.

Fix: name every session after its task (claude -n login-bug, or /rename); the name shows in the terminal title and the /resume list. Run them in tmux, one tmux session per project, so closing a window only detaches. hivemux goes one step further: one sidebar line per Claude across all tmux sessions, in a tile for each project, with hm <folder> creating each project’s session.

Tips for running sessions in parallel

  • Name sessions after the task (claude -n login-bug) instead of leaving them to a generic title.
  • Keep tasks independent. Two sessions refactoring the same module in different worktrees will still produce merge conflicts later.
  • Leave a shell window next to each Claude for git, tests and dev servers.
  • Review as sessions finish rather than letting finished work pile up; that is what the green badges are for.

Other tools take different approaches, such as creating a worktree per task automatically. Claude Code session managers compared lists them side by side. To get started with hivemux, see /docs/install/ and /docs/quick-start/.

FAQ

Can two Claude Code sessions work in the same folder?

They can, but both edit the same working tree, so changes can collide. Use a separate git worktree (or a separate clone) per session when they touch the same repository.

Why do my parallel Claude Code sessions overwrite each other's changes?

They run in the same folder, so they edit one working tree. Give each session its own git worktree, with claude -w <name> or git worktree add, and merge the branches when the work is done.

Why do I hit my usage limit faster with several sessions?

Every session draws on the same plan usage, and each request sends that session's whole conversation, so several sessions working at once add up quickly. Run /usage to see where it goes, and /clear sessions between unrelated tasks.

How many Claude Code sessions can I run at the same time?

There is no fixed number in the CLI itself. The practical limits are your plan's usage limits, your machine, and how many sessions you can review; each session uses your account's usage.

Does hivemux create git worktrees for me?

No. hivemux opens one tmux session per folder and shows every Claude in it; you create worktrees with git worktree or Claude Code's --worktree flag and open each one with hm <folder>.

How do I know which session is waiting for approval?

Claude Code fires a Notification hook when it needs your attention, which you can wire to a desktop notification. hivemux uses those hooks to mark the session amber in its sidebar, and Option+0 jumps to the one that has waited longest.