<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>In Rust We Trust 🦀 - workflow</title>
      <link>https://nikolaishelekhov.com</link>
      <description>Nikolai is a Rust software engineer building high-performance systems, backend and blockchain infrastructure.</description>
      <generator>Zola</generator>
      <language>en</language>
      <atom:link href="https://nikolaishelekhov.com/tags/workflow/rss.xml" rel="self" type="application/rss+xml"/>
      <lastBuildDate>Fri, 12 Dec 2025 00:00:00 +0000</lastBuildDate>
      <item>
          <title>Running Multiple Claude Instances in Parallel</title>
          <pubDate>Fri, 12 Dec 2025 00:00:00 +0000</pubDate>
          <author>Nikolai Shelekhov</author>
          <link>https://nikolaishelekhov.com/blog/parallel-claude-instances/</link>
          <guid>https://nikolaishelekhov.com/blog/parallel-claude-instances/</guid>
          <description xml:base="https://nikolaishelekhov.com/blog/parallel-claude-instances/">&lt;p&gt;The first time I waited twenty minutes for Claude to finish implementing a feature — only to realize it went in the wrong direction — I thought:&lt;&#x2F;p&gt;
&lt;p&gt;There has to be a better way.&lt;&#x2F;p&gt;
&lt;p&gt;There is.&lt;&#x2F;p&gt;
&lt;p&gt;Instead of running one AI assistant sequentially, I run multiple Claude Code instances in parallel. Each works on the same problem in isolated git worktrees. When they finish, I compare results and keep the best parts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-core-insight&quot;&gt;The Core Insight&lt;&#x2F;h2&gt;
&lt;p&gt;AI assistants are not deterministic.&lt;&#x2F;p&gt;
&lt;p&gt;Same prompt.&lt;br &#x2F;&gt;
Same model.&lt;br &#x2F;&gt;
Different results.&lt;&#x2F;p&gt;
&lt;p&gt;Sometimes the first attempt is excellent.&lt;br &#x2F;&gt;
Sometimes it drifts.&lt;br &#x2F;&gt;
Sometimes it confidently builds the wrong abstraction.&lt;&#x2F;p&gt;
&lt;p&gt;If you work sequentially, each attempt is a gamble.&lt;br &#x2F;&gt;
You wait, evaluate, retry.&lt;&#x2F;p&gt;
&lt;p&gt;Parallelizing removes the waiting loop.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;why-git-worktrees&quot;&gt;Why Git Worktrees&lt;&#x2F;h2&gt;
&lt;p&gt;Branches alone aren’t enough. They are just pointers.&lt;&#x2F;p&gt;
&lt;p&gt;Git worktrees create:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Separate working directories&lt;&#x2F;li&gt;
&lt;li&gt;Each with its own checked-out branch&lt;&#x2F;li&gt;
&lt;li&gt;Sharing the same repository history&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;That means you can have multiple implementations evolving simultaneously without stashing or context switching.&lt;&#x2F;p&gt;
&lt;p&gt;Same repo.&lt;br &#x2F;&gt;
Same base commit.&lt;br &#x2F;&gt;
Multiple active solutions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;my-workflow&quot;&gt;My Workflow&lt;&#x2F;h2&gt;
&lt;p&gt;I use a small helper command:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git parallel &amp;quot;add-auth&amp;quot; --agents 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Creates three worktrees:
&lt;ul&gt;
&lt;li&gt;add-auth-1&lt;&#x2F;li&gt;
&lt;li&gt;add-auth-2&lt;&#x2F;li&gt;
&lt;li&gt;add-auth-3&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Launches Zellij&lt;&#x2F;li&gt;
&lt;li&gt;Starts Claude Code in each pane&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Then I:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Give each instance the same prompt&lt;&#x2F;li&gt;
&lt;li&gt;Let them run in parallel&lt;&#x2F;li&gt;
&lt;li&gt;Come back later to compare outputs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;what-happens-in-practice&quot;&gt;What Happens in Practice&lt;&#x2F;h2&gt;
&lt;p&gt;Typically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;One implementation is overengineered&lt;&#x2F;li&gt;
&lt;li&gt;One misses edge cases&lt;&#x2F;li&gt;
&lt;li&gt;One is clean and well-structured&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Sometimes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Each has a strong idea worth keeping&lt;&#x2F;li&gt;
&lt;li&gt;The final solution becomes a synthesis&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Instead of restarting the same assistant three times, I evaluate three candidates.&lt;&#x2F;p&gt;
&lt;p&gt;Total elapsed time is roughly the same as one attempt.&lt;&#x2F;p&gt;
&lt;p&gt;The quality of outcome is consistently better.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;where-this-works-best&quot;&gt;Where This Works Best&lt;&#x2F;h2&gt;
&lt;p&gt;This approach shines when:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Designing new features&lt;&#x2F;li&gt;
&lt;li&gt;Refactoring complex modules&lt;&#x2F;li&gt;
&lt;li&gt;Exploring architectural directions&lt;&#x2F;li&gt;
&lt;li&gt;Working in ambiguous problem spaces&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It is unnecessary for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Small bug fixes&lt;&#x2F;li&gt;
&lt;li&gt;Mechanical changes&lt;&#x2F;li&gt;
&lt;li&gt;Deterministic tasks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Parallelization only makes sense when multiple valid solutions exist.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-mindset-shift&quot;&gt;The Mindset Shift&lt;&#x2F;h2&gt;
&lt;p&gt;The mistake is treating AI as an oracle.&lt;&#x2F;p&gt;
&lt;p&gt;It isn’t.&lt;&#x2F;p&gt;
&lt;p&gt;It is a probabilistic generator.&lt;&#x2F;p&gt;
&lt;p&gt;The better framing:&lt;&#x2F;p&gt;
&lt;p&gt;You are running experiments.&lt;&#x2F;p&gt;
&lt;p&gt;Each agent instance is a sample from a distribution of possible implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Your job is evaluation and selection.&lt;&#x2F;p&gt;
&lt;p&gt;This turns AI assistance from a linear conversation into a parallel search process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;tradeoffs&quot;&gt;Tradeoffs&lt;&#x2F;h2&gt;
&lt;p&gt;Is it more resource-intensive?&lt;&#x2F;p&gt;
&lt;p&gt;Yes.&lt;&#x2F;p&gt;
&lt;p&gt;Does it consume more tokens?&lt;&#x2F;p&gt;
&lt;p&gt;Yes.&lt;&#x2F;p&gt;
&lt;p&gt;But developer time is expensive.
Waiting is frustrating.
Context switching is costly.&lt;&#x2F;p&gt;
&lt;p&gt;I would rather review three implementations once than restart one implementation three times.&lt;&#x2F;p&gt;
&lt;p&gt;Parallel AI feels closer to how we approach distributed systems:&lt;&#x2F;p&gt;
&lt;p&gt;Spawn workers.&lt;br &#x2F;&gt;
Collect results.&lt;br &#x2F;&gt;
Select the best outcome.&lt;&#x2F;p&gt;
&lt;p&gt;It turns uncertainty into leverage.&lt;&#x2F;p&gt;
</description>
      </item>
    </channel>
</rss>
