<?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: Justin</title>
    <description>The latest articles on DEV Community by Justin (@tide-n).</description>
    <link>https://dev.to/tide-n</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%2F4120290%2F392d1b58-2245-49ee-9ebd-ed10a5cd95d1.png</url>
      <title>DEV Community: Justin</title>
      <link>https://dev.to/tide-n</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tide-n"/>
    <language>en</language>
    <item>
      <title>How I got Codex and Claude Code to collaborate using their native wake-up mechanisms</title>
      <dc:creator>Justin</dc:creator>
      <pubDate>Fri, 11 Sep 2026 06:31:59 +0000</pubDate>
      <link>https://dev.to/tide-n/how-i-got-codex-and-claude-code-to-collaborate-using-their-native-wake-up-mechanisms-16dl</link>
      <guid>https://dev.to/tide-n/how-i-got-codex-and-claude-code-to-collaborate-using-their-native-wake-up-mechanisms-16dl</guid>
      <description>&lt;p&gt;I’ve been experimenting with getting Codex and Claude Code to actually collaborate on the same coding task.&lt;/p&gt;

&lt;p&gt;The obvious approach is something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Claude output → Codex prompt
Codex output → Claude prompt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Basically, capture one agent’s output and inject it into the other.&lt;/p&gt;

&lt;p&gt;I tried thinking about the problem this way at first, but it quickly gets messy.&lt;/p&gt;

&lt;p&gt;What if the other agent is busy?&lt;br&gt;
What if its current turn has already finished?&lt;br&gt;
How do you resume the right session?&lt;br&gt;
What happens to messages while the agent is doing something else?&lt;/p&gt;

&lt;p&gt;Eventually I ended up with a different design in CleanCode:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agent identity + mailbox + native wake-up.&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  1. CleanCode owns the agent identity
&lt;/h3&gt;

&lt;p&gt;Instead of exposing Claude sessions or Codex threads directly to the collaboration layer, CleanCode gives each agent its own identity.&lt;/p&gt;

&lt;p&gt;Each provider then maps that identity to its native runtime:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CleanCode Agent A
      ↓
Claude Provider
      ↓
Claude session


CleanCode Agent B
      ↓
Codex Provider
      ↓
Codex thread
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the collaboration layer doesn’t really care whether the target is Claude Code or Codex.&lt;/p&gt;

&lt;p&gt;Conceptually, it just needs to do things like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;send(to: agentB)
wake(agentB)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The provider handles the runtime-specific details.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Messages go into a mailbox
&lt;/h3&gt;

&lt;p&gt;This was probably the most important design decision.&lt;/p&gt;

&lt;p&gt;When Claude wants to send something to Codex, I &lt;strong&gt;don’t inject the actual message directly into Codex’s current prompt&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead, it goes into Codex’s collaboration inbox.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Claude
   │
   │ message
   ▼
Codex Inbox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That separates communication from execution.&lt;/p&gt;

&lt;p&gt;Codex can be working, idle, or between turns. The message is still sitting there waiting for it.&lt;/p&gt;

&lt;p&gt;The same thing works in the opposite direction.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Wake the agent using its native mechanism
&lt;/h3&gt;

&lt;p&gt;Now there’s another problem:&lt;/p&gt;

&lt;p&gt;How does Codex know that something arrived?&lt;/p&gt;

&lt;p&gt;I didn’t want CleanCode constantly polling the inbox or pretending to be the agent runtime.&lt;/p&gt;

&lt;p&gt;Instead, each provider uses the agent’s own native lifecycle to wake it up.&lt;/p&gt;

&lt;p&gt;For Claude Code, I use its &lt;code&gt;FileChanged&lt;/code&gt; hook and async re-wake behavior.&lt;/p&gt;

&lt;p&gt;For Codex, I use its native message/thread mechanism.&lt;/p&gt;

&lt;p&gt;So underneath, they are quite different:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 CleanCode
                     │
                wake(agent)
                     │
          ┌──────────┴──────────┐
          │                     │
   Claude Provider        Codex Provider
          │                     │
   FileChanged hook        native message
   + async re-wake         + thread
          │                     │
          ▼                     ▼
       Claude                  Codex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But to the collaboration layer, both simply implement:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Wake this agent up.”&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. The wake-up message does NOT contain the actual peer message
&lt;/h3&gt;

&lt;p&gt;This is a small detail that ended up mattering a lot.&lt;/p&gt;

&lt;p&gt;I deliberately keep the wake-up channel separate from the actual communication channel.&lt;/p&gt;

&lt;p&gt;When Claude sends something to Codex, the actual message stays in Codex’s inbox.&lt;/p&gt;

&lt;p&gt;The native wake-up mechanism only sends a fixed notification:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CleanCode: check your collaboration inbox.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Codex wakes up, checks its inbox, reads Claude’s message, does the work, and can reply through Claude’s inbox.&lt;/p&gt;

&lt;p&gt;So a full round trip looks roughly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Claude
   │
   │ 1. send message
   ▼
Codex Inbox
   │
   │ 2. native wake-up
   ▼
Codex
   │
   │ 3. read inbox
   ▼
Do the work
   │
   │ 4. reply
   ▼
Claude Inbox
   │
   │ 5. native wake-up
   ▼
Claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The mental model I ended up liking is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The inbox is the data plane.&lt;br&gt;
The native wake-up mechanism is the control plane.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One carries the actual agent-to-agent communication.&lt;/p&gt;

&lt;p&gt;The other just says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hey, there’s something waiting for you.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  What I learned
&lt;/h3&gt;

&lt;p&gt;The biggest lesson for me was that multi-agent collaboration doesn’t necessarily require building another agent runtime on top of existing agents.&lt;/p&gt;

&lt;p&gt;Claude Code already has a lifecycle.&lt;/p&gt;

&lt;p&gt;Codex already has a lifecycle.&lt;/p&gt;

&lt;p&gt;They have different ideas of sessions, threads, wake-ups, and what happens while an agent is busy.&lt;/p&gt;

&lt;p&gt;Rather than hiding all of that by piping stdout into stdin, I found it cleaner to preserve their native behavior and put a thin collaboration layer above them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Provider abstraction
        +
Persistent mailbox
        +
Native wake-up
        =
Agent-to-agent collaboration
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It also makes adding another coding agent much less invasive.&lt;/p&gt;

&lt;p&gt;A new provider mainly needs to answer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What is your session identity?
How do I find/resume that session?
How do I wake you up?
Can notifications queue while you're busy?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The mailbox and the higher-level collaboration protocol don’t need to know much about the underlying agent.&lt;/p&gt;

&lt;p&gt;I implemented this as part of &lt;strong&gt;CleanCode&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/chen-985211/cleancode?utm_source=chatgpt.com" rel="noopener noreferrer"&gt;GitHub – CleanCode&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Still experimenting with the model, but I’d be interested to hear how others are approaching agent-to-agent communication — especially whether you prefer mailboxes/events like this or direct message injection.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>ai</category>
      <category>opensource</category>
      <category>agents</category>
    </item>
  </channel>
</rss>
