<?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: M T</title>
    <description>The latest articles on DEV Community by M T (@m_t_bbe0d7e2206ba4769563b).</description>
    <link>https://dev.to/m_t_bbe0d7e2206ba4769563b</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%2F4048245%2F47eef682-fd8a-4862-a6d6-ebcb7ab66ca6.png</url>
      <title>DEV Community: M T</title>
      <link>https://dev.to/m_t_bbe0d7e2206ba4769563b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/m_t_bbe0d7e2206ba4769563b"/>
    <language>en</language>
    <item>
      <title>The Delegate Pattern: Run Claude Code + Codex + Gemini in Parallel — Zero-Cost Rate Limit Bypass for Multi-Agent AI</title>
      <dc:creator>M T</dc:creator>
      <pubDate>Sun, 26 Jul 2026 17:51:19 +0000</pubDate>
      <link>https://dev.to/m_t_bbe0d7e2206ba4769563b/the-delegate-pattern-run-claude-code-codex-gemini-in-parallel-zero-cost-rate-limit-bypass-joh</link>
      <guid>https://dev.to/m_t_bbe0d7e2206ba4769563b/the-delegate-pattern-run-claude-code-codex-gemini-in-parallel-zero-cost-rate-limit-bypass-joh</guid>
      <description>&lt;h2&gt;
  
  
  Why I Built This
&lt;/h2&gt;

&lt;p&gt;The motivation was simple: &lt;strong&gt;AI stops. Frequently.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When running large tasks with Claude Code, you hit Anthropic's rate limits fast. When you add more sub-agents to run in parallel, Claude's own context gets polluted and performance degrades.&lt;/p&gt;

&lt;p&gt;I also tried a real-time message bus (agmsg). Multiple CLI windows throwing messages caused confusion. SSE connections dropped, losing notifications. Infrastructure maintenance cost was too high.&lt;/p&gt;

&lt;p&gt;Then it hit me: &lt;strong&gt;concentrating everything in one AI vendor is itself the problem.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Claude (Anthropic), Codex (OpenAI), and AGY/Gemini (Google) each have independent APIs and rate limit pools. Run them in parallel, and when one hits its limit, the others keep going. Use files as the communication channel, and there's no confusion or disconnection.&lt;/p&gt;

&lt;p&gt;This is the &lt;strong&gt;delegate pattern&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The 3 Problems It Solves
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Problem 1: Rate Limits
&lt;/h3&gt;

&lt;p&gt;Single-vendor dependency means hitting ceilings fast. The delegate pattern uses 3 independent API pools, dramatically increasing effective throughput.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem 2: Context Pollution
&lt;/h3&gt;

&lt;p&gt;Dumping all research logs and code output into the parent agent's context makes it forget earlier instructions. In the delegate pattern, child agents run in separate processes and return only their results as files.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem 3: Missed Notifications / Message Confusion
&lt;/h3&gt;

&lt;p&gt;When you call &lt;code&gt;codex exec&lt;/code&gt; / &lt;code&gt;agy --prompt&lt;/code&gt; via Bash, Claude Code recognizes them as sub-agents. Claude Code's built-in completion notification infrastructure handles everything automatically — no Monitor tool or custom polling loops needed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Architecture Overview
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Lux / Claude Code (parent · orchestrator)
  ├─ Bash → Codex CLI  → Tasks/codex_xxx.md → Reports/codex_xxx.md
  └─ Bash → Gemini CLI → Tasks/agy_xxx.md   → Reports/agy_xxx.md
                              ↓
               Completion notification → Lux reads all results and synthesizes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why Obsidian as the communication channel:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each agent gets a dedicated file path → message confusion is physically impossible&lt;/li&gt;
&lt;li&gt;Even if Claude Code's context disappears, reading Obsidian files restores full context&lt;/li&gt;
&lt;li&gt;The human (developer) can check it at any time — it serves as a permanent evidence log&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What You Need (Setup)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;th&gt;How to get&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Claude Code&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Parent · orchestrator&lt;/td&gt;
&lt;td&gt;claude.ai/code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Obsidian&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Communication channel · persistent log&lt;/td&gt;
&lt;td&gt;obsidian.md (free)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Codex CLI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Child agent A (OpenAI)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;npm install -g @openai/codex&lt;/code&gt; → &lt;code&gt;codex login&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AGY / Gemini CLI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Child agent B (Google)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;npm install -g @google/gemini-cli&lt;/code&gt; → &lt;code&gt;agy login&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Codex requires an OpenAI paid plan. AGY requires a Gemini subscription + CLI install + login (no API key needed).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Let Claude Build the Skill
&lt;/h2&gt;

&lt;p&gt;Once you're set up, just tell Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create a skill called "delegate".
Role: I (Lux) am the parent, Codex CLI and AGY CLI are the children.
Tasks are passed via Obsidian Markdown files.
Include fire command templates and save to .claude/skills/delegate.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude will interactively create the skill file for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Want to skip setup?
&lt;/h3&gt;

&lt;p&gt;Copy the skill file directly from the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/melt1007/claude-delegate-pattern.git
&lt;span class="nb"&gt;cp &lt;/span&gt;claude-delegate-pattern/skills/delegate.md ~/.claude/skills/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After copying, tell Claude Code "read the delegate skill" and it will be recognized.&lt;/p&gt;




&lt;h2&gt;
  
  
  Running It
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Create a task file in Obsidian
&lt;/h3&gt;

&lt;p&gt;Write instructions for each agent in separate files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Codex Research Task&lt;/span&gt;

&lt;span class="gu"&gt;## Objective&lt;/span&gt;
[What you want researched]

&lt;span class="gu"&gt;## Output destination&lt;/span&gt;
Obsidian/Reports/codex_result_20260726.md

&lt;span class="gu"&gt;## Constraints&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Read only: this task file and the specified folder
&lt;span class="p"&gt;-&lt;/span&gt; Output: write conclusions, reasoning, and steps separately
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Parallel fire from Claude Code
&lt;/h3&gt;

&lt;p&gt;Tell Claude Code "delegate and summon" and the skill automatically runs:&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;# Launch Codex in background&lt;/span&gt;
codex &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="s2"&gt;"Read Tasks/task_codex.md and write results back"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--dangerously-bypass-approvals-and-sandbox&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="s2"&gt;"codex_out.txt"&lt;/span&gt;

&lt;span class="c"&gt;# Launch AGY simultaneously&lt;/span&gt;
agy &lt;span class="nt"&gt;--prompt&lt;/span&gt; &lt;span class="s2"&gt;"Read Tasks/task_agy.md and do the work"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--dangerously-skip-permissions&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both start in parallel. Claude Code can respond to your next instruction while waiting for completion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Receive completion → synthesize
&lt;/h3&gt;

&lt;p&gt;When a child agent completes, Claude Code receives a notification. It reads each report file and synthesizes the results.&lt;/p&gt;




&lt;h2&gt;
  
  
  Comparison with Real-Time Bus (agmsg)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Criterion&lt;/th&gt;
&lt;th&gt;agmsg (real-time bus)&lt;/th&gt;
&lt;th&gt;delegate pattern (file-based async)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Reliability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;SSE connection errors · complex disconnect handling&lt;/td&gt;
&lt;td&gt;File I/O only · simple and robust&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Message conflicts&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Timing coordination is hard, conflicts happen&lt;/td&gt;
&lt;td&gt;Physically separated · zero conflicts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Log persistence&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Depends on memory · volatile&lt;/td&gt;
&lt;td&gt;Persisted in Obsidian · always accessible&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Implementation cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High (bus config · state management required)&lt;/td&gt;
&lt;td&gt;Low (only file ops and CLI calls)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best for&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Low-latency interactive processing&lt;/td&gt;
&lt;td&gt;"Request → deliverable" tasks: research, implementation, review&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;The delegate pattern in one sentence:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Run AIs from different companies in parallel and connect them via Obsidian."&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This alone solves all three problems simultaneously: rate limit distribution, context pollution prevention, and reliable completion notifications.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What you need:
✅ Claude Code (free tier available)
✅ Obsidian (free)
✅ Codex CLI (OpenAI paid plan)
✅ AGY / Gemini CLI (Google AI Studio)
✅ delegate.md (get from repo or have Claude create it)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple mechanism. Most reliable and scalable multi-agent approach I've found.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repository (skill file · task templates):&lt;/strong&gt;&lt;br&gt;
👉 &lt;a href="https://github.com/melt1007/claude-delegate-pattern" rel="noopener noreferrer"&gt;https://github.com/melt1007/claude-delegate-pattern&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;em&gt;This article was written using the delegate pattern itself. Claude Code (Lux) acted as orchestrator, generating 3 drafts in parallel — Codex, AGY, and Lux — then synthesizing them into this final version.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>claudecode</category>
      <category>ai</category>
      <category>obsidian</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
