<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Roi Dayan</title>
    <description>The latest articles on DEV Community by Roi Dayan (@roidayan).</description>
    <link>https://dev.to/roidayan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4212764%2Fd09ec175-d20f-4bae-9199-fd5bb4d29a28.jpg</url>
      <title>DEV Community: Roi Dayan</title>
      <link>https://dev.to/roidayan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/roidayan"/>
    <language>en</language>
    <item>
      <title>How to run several Claude Code sessions in parallel without them stepping on each other</title>
      <dc:creator>Roi Dayan</dc:creator>
      <pubDate>Wed, 28 Oct 2026 13:13:24 +0000</pubDate>
      <link>https://dev.to/roidayan/how-to-run-several-claude-code-sessions-in-parallel-without-them-stepping-on-each-other-46hp</link>
      <guid>https://dev.to/roidayan/how-to-run-several-claude-code-sessions-in-parallel-without-them-stepping-on-each-other-46hp</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  What goes wrong when you just open more terminals
&lt;/h2&gt;

&lt;p&gt;Three things, in this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Collisions.&lt;/strong&gt; Two sessions in the same folder edit the same files. One agent's half-finished change lands in the other's test run, and neither understands why.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lost attention.&lt;/strong&gt; A session stops to ask a question or for permission, and you don't notice for twenty minutes because it's in tab six.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lost sessions.&lt;/strong&gt; You close a terminal, or your laptop restarts, and the session in it is gone (you can resume the conversation, but the work stopped).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each has a simple fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. One task per session, one worktree per task
&lt;/h2&gt;

&lt;p&gt;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.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# from your main checkout&lt;/span&gt;
git worktree add &lt;span class="nt"&gt;-b&lt;/span&gt; fix-login ../myapp-fix-login
git worktree add &lt;span class="nt"&gt;-b&lt;/span&gt; add-export ../myapp-add-export
git worktree add &lt;span class="nt"&gt;-b&lt;/span&gt; flaky-tests ../myapp-flaky-tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then start one session in each:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ../myapp-fix-login &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three things catch people out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Untracked files aren't copied.&lt;/strong&gt; Your &lt;code&gt;.env&lt;/code&gt; stays in the main checkout. Copy it in, or keep a small script that does (&lt;code&gt;cp .env ../myapp-fix-login/&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dependencies aren't there either.&lt;/strong&gt; Each worktree needs its own &lt;code&gt;node_modules&lt;/code&gt; (or virtualenv). A package manager with a shared store, such as pnpm, makes that a few seconds instead of minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ports collide.&lt;/strong&gt; Two dev servers on port 3000 won't both start. Give each worktree its own &lt;code&gt;PORT&lt;/code&gt;, and its own &lt;code&gt;COMPOSE_PROJECT_NAME&lt;/code&gt; if you use Docker Compose.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a task is done, review its branch like a teammate's pull request, merge it, and clean up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git worktree remove ../myapp-fix-login
git branch &lt;span class="nt"&gt;-d&lt;/span&gt; fix-login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git worktree list&lt;/code&gt; shows what's still around, and &lt;code&gt;git worktree prune&lt;/code&gt; tidies up folders you deleted by hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Give each session a name and a place
&lt;/h2&gt;

&lt;p&gt;tmux turns a pile of terminals into something you can scan. One window per task, named after it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tmux new &lt;span class="nt"&gt;-s&lt;/span&gt; agents &lt;span class="nt"&gt;-n&lt;/span&gt; fix-login &lt;span class="nt"&gt;-c&lt;/span&gt; ../myapp-fix-login
&lt;span class="c"&gt;# inside tmux:&lt;/span&gt;
tmux new-window &lt;span class="nt"&gt;-n&lt;/span&gt; add-export &lt;span class="nt"&gt;-c&lt;/span&gt; ../myapp-add-export
tmux new-window &lt;span class="nt"&gt;-n&lt;/span&gt; flaky-tests &lt;span class="nt"&gt;-c&lt;/span&gt; ../myapp-flaky-tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start &lt;code&gt;claude&lt;/code&gt; in each window. The window names in the status bar are now your task list, and detaching (&lt;code&gt;Ctrl-b d&lt;/code&gt;) leaves every session running; &lt;code&gt;tmux attach -t agents&lt;/code&gt; brings them back. That also fixes problem 3: closing the terminal no longer ends anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Know which one needs you
&lt;/h2&gt;

&lt;p&gt;Claude Code waits when it needs an answer or a permission, and a waiting session does nothing. Two habits help:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Claude Code's hooks to run a command when it needs your input (the &lt;code&gt;Notification&lt;/code&gt; hook), such as a desktop notification or a sound, so a waiting session reaches you instead of the other way round.&lt;/li&gt;
&lt;li&gt;Set each session's permission mode to match its task. A well-scoped task with good tests can run with fewer questions; a session touching production config should ask about everything.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Mind the shared limits
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same setup on one board
&lt;/h2&gt;

&lt;p&gt;I build &lt;a href="https://moontors.com" rel="noopener noreferrer"&gt;Moontors&lt;/a&gt;, a free desktop app that does the above for you, so take this part with that in mind.&lt;/p&gt;

&lt;p&gt;Each session is a card on one board that streams its agent's work as it happens. Turning on &lt;strong&gt;Run in a new worktree&lt;/strong&gt; when you create a session makes the worktree, copies in the untracked files your project lists (such as &lt;code&gt;.env&lt;/code&gt;), 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.&lt;/p&gt;

&lt;p&gt;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: &lt;a href="https://moontors.com/docs/how-to/run-claude-code-sessions-in-parallel/" rel="noopener noreferrer"&gt;How to run several Claude Code sessions in parallel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;AI did the writing, I did the reading, and we both took credit.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>ai</category>
      <category>git</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
