<p>There's a question that comes up the moment you start trusting an AI agent with real work: <em>how do I run more than one at a time without them tripping over each other?</em> You've got a feature to build, a bug to chase, and a refactor you've been putting off. One agent, one working directory, one branch — they'd collide instantly.</p><p>The answer isn't a feature we invented. It's a git feature most developers have never used, and it pairs with Elyra so naturally it feels designed for this. Let's explain git worktrees, and why they're the quiet superpower for running Elyra in parallel.</p><h2>What a git worktree actually is</h2><p>Normally a git repo has one working directory — one set of files on disk, sitting on one branch. To work on something else, you <code>git stash</code> or commit, then <code>git checkout</code> another branch, and your files transform in place. One desk, one project at a time.</p><p>A <strong>worktree</strong> lets one repository have <em>multiple</em> working directories at once, each on its own branch, all sharing the same underlying history and object store:</p><pre><code class="language-bash"># From your main repo
git worktree add ../myproject-feature-auth feature-auth
git worktree add ../myproject-bugfix-checkout bugfix-checkout
</code></pre><p>Now you have three folders on disk — your original, plus two more — each checked out to a different branch, all backed by the same <code>.git</code>. Edits in one don't touch the others. No stashing, no context-switching, no "wait, which branch was I on." Three desks, three projects, one filing cabinet.</p><h2>Why this is the natural home for parallel Elyra agents</h2><p>Here's where it clicks. Run an Elyra agent in each worktree, and each one gets:</p><ul><li><p><strong>Its own files.</strong> The auth agent edits <code>../myproject-feature-auth</code>; the bugfix agent edits <code>../myproject-bugfix-checkout</code>. They physically cannot overwrite each other's work, because they're in different directories.</p></li><li><p><strong>Its own branch.</strong> Each agent's commits land on that worktree's branch. Two clean, reviewable branches at the end, not one tangled mess.</p></li><li><p><strong>Shared history.</strong> Because they share the object store, merging is normal git. No copying, no re-cloning a multi-gigabyte repo three times.</p></li></ul><pre><code class="language-bash">cd ../myproject-feature-auth &amp;&amp; elyra      # agent 1, on feature-auth
cd ../myproject-bugfix-checkout &amp;&amp; elyra   # agent 2, on bugfix-checkout
</code></pre><p>Two terminals, two agents, zero collisions. Set a <code>/goal</code> in each, walk away, and come back to two finished branches.</p><h2>What Elyra does to make this work</h2><p>This isn't an accident — Elyra is built to be worktree-aware in the places that matter.</p><p><strong>It knows which branch you're on.</strong> A worktree's <code>.git</code> isn't a directory, it's a file pointing elsewhere. Elyra's footer follows that pointer correctly (including the trickier reftable-backed worktrees), so each session shows the right branch instead of getting confused. A small thing you only notice when it's <em>wrong</em> in other tools.</p><p><strong>Sessions and memory are per-directory.</strong> Elyra keys session history and codebase memory to the working directory's path. So the auth worktree and the bugfix worktree have <em>completely separate</em> conversations, checkpoints, and accumulated project memory. The bugfix agent doesn't inherit half-finished thoughts from the auth agent. Each <code>/rewind</code> rewinds only that worktree's files. Clean separation, for free.</p><p><strong>Checkpoints stay local.</strong> <code>/rewind</code>'s file checkpoints operate on the worktree you're in — rolling back the auth agent never disturbs the bugfix agent's working tree.</p><h2>The discipline that makes it safe</h2><p>One honest caution, and it's the same one our own contributor rules hammer on: <strong>when agents share a repository, commit hygiene matters.</strong> Even across worktrees, you're committing into a shared history, so the rule is simple and strict:</p><ul><li><p>Each agent commits <strong>only the files it changed</strong> — <code>git add &lt;specific paths&gt;</code>, never <code>git add -A</code> or <code>git add .</code>, which can sweep up another agent's in-progress work.</p></li><li><p>Check <code>git status</code> before committing and confirm you're staging only your own files.</p></li></ul><p>This is literally how Elyra's own development works — multiple agents, multiple worktrees, one repo — and it's codified in our <code>AGENTS.md</code> so every agent reads it at startup. Worktrees give you physical separation of <em>files</em>; this discipline gives you clean separation of <em>commits</em>.</p><h2>Bonus: separate agent profiles per worktree</h2><p>If you want even stronger isolation, you can give each worktree its own Elyra agent home:</p><pre><code class="language-bash">ELYRA_CODING_AGENT_DIR=~/agents/auth    cd ../myproject-feature-auth &amp;&amp; elyra
ELYRA_CODING_AGENT_DIR=~/agents/bugfix  cd ../myproject-bugfix-checkout &amp;&amp; elyra
</code></pre><p>Now even settings, skills, and pinned models can differ per agent — useful when one task wants a premium model and another is fine on something cheap.</p><h2>When to reach for it (and when not to)</h2><p>Worktrees shine when you have <strong>genuinely independent</strong> tasks you want to run concurrently. They're overkill for a single focused session — one repo, one agent, done. But the moment you think "I wish I could let an agent grind on this while I work on that," worktrees are the answer, and Elyra is ready for them.</p><h2>The takeaway</h2><p>Git worktrees were built for human developers juggling branches. They turn out to be the perfect substrate for juggling <em>agents</em>: physical file isolation, per-branch commits, shared history, and an Elyra that correctly understands the branch, session, and memory of each one independently.</p><p>One repository. Many desks. As many agents as you have problems. That's not a hack — it's just git and Elyra doing what each does best.</p><p>Happy building (in parallel).</p>