ai newsMi., 28. Okt.
EilmeldungGoogle DeepMind’s Genie 4 builds AI worlds that talk and change on command

Mehrere Claude Code Sessions parallel betreiben ohne Konflikte

Eine Claude Code Session ist ein Pair Programmer, vier sind ein kleines Team, das Struktur braucht. Ein Setup aus klassischem git und tmux verhindert, dass mehrere Agents dieselben Dateien doppelt bearbeiten.

dev.toMittwoch 14:13 · 28.10.DE3 Min. Lesezeit
Bild: dev.to

One Claude Code session is a pair programmer. Four of them is a small team, and a team needs a little structure, or you spend the afternoon untangling two agents that edited the same file.

This is the setup that works: plain git and tmux first, then the same thing with a desktop app if you'd rather not manage it by hand.

A git worktree is a second working folder for the same repository, on its own branch. Give every session its own, and collisions disappear: each agent edits its own copy of every file.

# from your main checkout git worktree add -b fix-login../myapp-fix-login git worktree add -b add-export../myapp-add-export git worktree add -b flaky-tests../myapp-flaky-tests Enter fullscreen mode Exit fullscreen mode Then start one session in each:

cd../myapp-fix-login && claude Enter fullscreen mode Exit fullscreen mode Three things catch people out:

When a task is done, review its branch like a teammate's pull request, merge it, and clean up:

git worktree remove../myapp-fix-login git branch -d fix-login Enter fullscreen mode Exit fullscreen mode git worktree list shows what's still around, and git worktree prune tidies up folders you deleted by hand.

tmux turns a pile of terminals into something you can scan. One window per task, named after it:

tmux new -s agents -n fix-login -c../myapp-fix-login # inside tmux: tmux new-window -n add-export -c../myapp-add-export tmux new-window -n flaky-tests -c../myapp-flaky-tests Enter fullscreen mode Exit fullscreen mode Start claude in each window. The window names in the status bar are now your task list, and detaching ( Ctrl-b d ) leaves every session running; tmux attach -t agents brings them back. That also fixes problem 3: closing the terminal no longer ends anything.

Claude Code waits when it needs an answer or a permission, and a waiting session does nothing. Two habits help:

Every session runs on the same Claude plan, so parallel sessions share its usage limits. Five sessions burn through them five times as fast. Start with two or three, and add more once you know how your plan holds up.

I build Moontors, a free desktop app that does the above for you, so take this part with that in mind.

Each session is a card on one board that streams its agent's work as it happens. Turning on Run in a new worktree when you create a session makes the worktree, copies in the untracked files your project lists (such as.env ), and asks before removing anything when you archive it. The header counts the sessions waiting for you, and a click takes you to the next one; Allow and Deny are right in the transcript. The sessions run in a background service, so closing the window doesn't stop them, and the Android and iPhone apps can answer them away from your desk.

It runs Codex and Gemini CLI too, beside Claude Code, on macOS, Windows and Linux, and needs no account of its own. The step-by-step version of this article is in its docs: How to run several Claude Code sessions in parallel.

Either way, the rules are the same: one task per session, a worktree per task, a name for each, and a way to hear when one needs you.

AI did the writing, I did the reading, and we both took credit.

Originaltitel: How to run several Claude Code sessions in parallel without them stepping on each otherQuelle: dev.to (dev.to). Original öffnen