Run many Claude Code sessions at once and know which needs you
On this page
Two separate problemsIsolate the work with worktreesOption A: Claude Code's agent viewOption B: tmux windows and the terminal bellOption C: a hook that reaches you anywhereHow Codeman handles itGive each Claude Code session its own git worktree so their edits cannot collide, run each one in its own tmux window (or in Claude Code's agent view), and turn Claude Code's "needs you" signal into something visible from wherever you are: a tmux bell flag, a notification hook, or a dashboard that colours the session.
Two separate problems
Running five sessions at once goes wrong in two ways:
- Collisions. Several agents in one checkout overwrite each other's files, and one agent switching branches changes the tree under all the others.
- Attention. A session that stopped to ask a question looks exactly like one that is still working until you open it. With five of them you end up cycling through terminals, and a blocked session can sit for an hour.
Worktrees fix the first. The rest of this page is about the second.
Isolate the work with worktrees
A git worktree is a second checkout of the same repository on its own branch. Claude Code can create one for you:
claude --worktree feature-auth
Run the same command with a different name in another terminal for a second isolated session. Anthropic's docs note that the repository needs at least one commit first. With plain git:
git worktree add ../myapp-auth -b auth
cd ../myapp-auth && claude
# later
git worktree remove ../myapp-auth
Option A: Claude Code's agent view
claude agents opens agent view, one screen for Claude Code's background sessions: what is running, what needs your input, and what is done. Sessions waiting on you are grouped at the top with a yellow icon. A separate supervisor process runs the sessions, so they keep going after you close the view, and they are preserved while the machine sleeps (a shutdown still stops them). It is a research preview, and it covers Claude Code only. See agent view.
Option B: tmux windows and the terminal bell
If you want plain terminals, or you mix Claude Code with other CLIs, tmux can flag the window that needs you with no scripting.
Start one window per worktree:
tmux new-session -d -s agents -n auth -c ~/src/myapp-auth claude
tmux new-window -t agents -n billing -c ~/src/myapp-billing claude
tmux attach -t agents
Then tell Claude Code to ring the terminal bell instead of sending a desktop notification. In ~/.claude/settings.json:
{
"preferredNotifChannel": "terminal_bell"
}
Claude Code fires its notification when it finishes a task or pauses for a permission prompt and you appear to be away from the terminal. tmux monitors bells by default: a window that rings gets a ! flag in the status line and its name is drawn in inverted colours, so 1:billing! means that session wants you.
To check from a script or a status bar:
tmux list-windows -a -F '#{session_name}:#{window_name} #{?window_bell_flag,NEEDS YOU,}'
Two timing details from Anthropic's hooks reference: the permission notification fires once you have not typed for about six seconds, and the idle notification fires about 60 seconds after Claude finishes responding. A session can be done for a minute before it rings.
Option C: a hook that reaches you anywhere
The bell only helps while you are looking at tmux. A Notification hook in Claude Code's settings can run any command, such as a desktop notification or a push to your phone, and the hook input says which session and which kind of prompt it was. Get notified when Claude Code finishes or needs input has working examples.
How Codeman handles it
Codeman runs every session as one CLI in its own tmux session and shows each as a tab in a browser dashboard, on a desktop or a phone. The attention problem is what most of its interface is about:
- Tab states. A yellow blinking tab is waiting for input; a red blinking tab is blocked on a question or permission prompt; a pulsing green dot is working. For Claude sessions these come from Claude Code hooks that Codeman writes into the project's
.claude/settings.local.json, so they say why a session stopped, and they survive a page reload. - Approvals Inbox (opt-in). One list of every prompt currently waiting on a human, across all sessions, answerable in place. Codeman re-reads the screen before sending a menu answer and refuses if the dialog is gone, so a stale answer never lands in the input box.
- No false alarms for background work. A session that ended its turn to wait on a monitor or a background shell gets a blue "watching" badge instead of an alert.
- Ordering. The optional vertical tab rail sorts sessions by activity by default: blocked on you first, then longest running, then most recently quiet. The phone home screen puts a NEEDS YOU section first.
- Navigation.
Alt+1toAlt+9jump to a tab,Ctrl+Kfinds any session, live or past, and the optional Split view shows a second session beside the active one on desktop.
Several sessions can share one case (Codeman's name for a project directory), and the counter next to the Run button starts more than one at a time. Codeman does not create worktrees itself: create one with git and register it with Add Case → Link Existing, which leaves the folder where it is.
A Claude session can also start and supervise other sessions through Codeman's API, with lineage lines showing which session spawned which. See The Dashboard, Notifications And Approvals and Driving Codeman From An Agent.