Agent Collaboration Across Coding Agents ​

Many developers now pay for more than one coding agent: Claude Code, Cursor, Codex, Gemini CLI. They usually sit side by side and never talk, and each subscription only pays off when you happen to open that tool.

Making them collaborate gets more out of every subscription and lets each model do the part it is best at. The examples use two roles: a supervisor that plans, answers questions and approves, and an executor that does the work.

Why several agents beat one ​

BenefitWhat it means
The right model for each rolea strong model plans, reviews and approves while a cheaper or faster one does the grind
Every subscription pulls its weightlong, token-heavy work runs on one plan and the other plan is spent on judgement
No single point of quotawhen one plan hits its limit, another keeps the work moving
Built-in reviewa different model checks the plan and the diff before anything expensive runs
Cheap supervisionthe supervisor reads only questions and alerts, not every report
A fresh context per stepeach executor run starts clean from the brief and the state, so it does not drift on a long context

The cost: the agents need a way to talk and a place to keep state. Inside one tool that comes built in. Across tools you build it, or you run a hub: a service that connects sessions from several tools. It also costs tokens: Anthropic reports that its multi-agent research system uses about 15 times the tokens of a chat, and that multi-agent setups fit poorly when every agent needs the same context or the parts depend heavily on each other (Anthropic). Split work only where the parts can run apart, and start with the simplest setup that works.

Models reason, harnesses act ​

A coding agent is two things: a model that reasons, and a harness (Claude Code, Cursor, Codex, Gemini CLI) that owns the tools, the context, the state and the permissions. The pair is what you are really running. In a 2026 preprint, keeping the model fixed under a tight 20k-token window and adding mechanical tool-output shortening plus stall detection lifted complete solutions on a 169-task SWE-bench Verified subset from 43 to 72 (wide-window arms stayed close). Across mature harnesses at normal context sizes, accuracy usually moves by only a few points, while cost, runtime and behavior under pressure vary widely (harness × model field guide). So a mixed flow has two levers, not one.

LeverHow to use it
Route models by rolethe strongest model plans and reviews while faster, cheaper models handle routine edits and tool calls. In Anthropic's parallel research system, an Opus lead with Sonnet subagents beat a single Opus agent by 90.2% on an internal research eval. On coding tasks, fixed planner-to-executor splits have tighter margins unless the price gap is large (field guide)
Match the harness to the workan open, sandboxed harness for exploring and debugging, and a constrained one with tight permissions and approval gates for bounded changes (Interloom)
Tune the harness to the modelmodels expect different prompts, tools and context handling. Per-model harness profiles fix stalled loops (LangChain), and for a pairing you run often, a small adapter can be trained for that exact harness (Hugging Face)
Put controls in the harness, not the promptbudgets, approvals and audit trails belong in the layer that runs the agent. A meta-harness such as Databricks Omnigent sits above Claude Code and Codex and can pause a run after every $100 spent

Building the communication ​

Any channel between agents has to answer five questions. Claude Code sessions answer them inside one tool. Across tools you answer them by hand or through a hub such as ORC.

QuestionSame toolDifferent tools, by handDifferent tools, through a hub
What is a message?a message to a session idan entry appended to a filea row in a shared inbox
How is it delivered?injected into the session by the toolread by the other agent on its next runmid-turn through a hook, on the next turn, or on resume
How does a reply come back?the parent is woken when the child finishesanother file, plus an ack linethe child's result is queued back to the parent
How does a question pause work?built ina pause file the loop respectsa session_send wait for another agent, or a human_request when a person must decide
How do you know the other side is alive?built inwhatever you builddead-process detection and retry

Left: a supervisor agent and an executor agent from different tools talk only through files in the repo and a driver loop. Right: Claude Code, Gemini CLI, Codex and Cursor agent CLI all connect to an ORC hub

Without a hub, the simplest channel is two files and a loop:

Animated: the driver starts the executor, the executor appends a REPORT, then a QUESTION lights the WAITING flag and the driver pauses until the supervisor answers and clears it

  • Typed messages: the executor appends REPORT, QUESTION, BLOCKED or DONE to to_supervisor.md, and the supervisor appends GUIDE or ANSWER to to_executor.md. Typed headers let the supervisor watch only the types that need it, so routine reports stay out of its context.
  • Acks: each executor entry starts with ack: <time> of the last supervisor entry it read, so you always know which instructions it acted on.
  • A pause that stops spend: a QUESTION creates a WAITING file, and the loop starts nothing until the supervisor answers and deletes it.
  • One step per run: a driver loop starts the executor once per iteration, with a timeout, and stops when the first line of the status file reads BLOCKED or DONE.

Building the state ​

Messages say what changed. State says where things are, so any agent, a new session or a human can pick up the work. Each piece needs exactly one writer.

StateHoldsWriterWhy it matters
Briefgoal, hard rules (budget, allowed models, evidence for every number), tools, ordered stepssupervisorthe executor starts every run with no memory
Statusfirst line is the state word (BLOCKED, DONE), followed by what is in flight and how to resumeexecutorthe loop and the supervisor read it without asking
Decision logevery call that is not in the plan, numberedsupervisorthe shared history both agents cite
Evidencethe command and its real output for every numberexecutorthe supervisor can rerun the command instead of trusting the report
Version controlone commit per step, only the agent's own fileseach agent, its own filesagents sharing one checkout do not overwrite each other's work

Two agents writing to one sequence (decision numbers, ids, a shared table) will collide, so the agent that does not own a piece proposes changes through a message.

Operating unattended agent runs ​

With messages and state in place, the failures that remain are in the operation around the steps, not in the steps.

Failure modeWhat happensRule that closes it
Silent deathsan executor run exits with an error while the loop logs the exit code and keeps sleepingalert after N failed runs in a row and write a heartbeat on every good one
Single-instance toolsa helper script or a manual run starts the same CLI and kills the executora lock so a second caller waits instead of killing the first
Same words, different numberstwo agents compute "cost up 20%" from two different counters, and a stop rule never firesa metric contract in the brief: exact log key, baseline and threshold
Gates on a laptopa check that must stop the job lives in a loop on one machine that can sleep or drop the looprun must-not-miss gates with the work (auto-stop in the job itself)
Leftover processesa background script from an earlier session holds a resource the loop waits onlist every background process and its owner before the first run
Invisible spendthe supervisor cannot see cost without reading every reporttokens and dollars in every report, plus a budget per run
Loops and context bloatan agent repeats a failing command or rereads files without editing, while old tool output fills the contextshorten old tool output as the window fills, detect repeated failures and stop early (preprint)

Running multi-agent sessions through a hub ​

A hub turns most of the hand-built pieces into infrastructure. ORC (an open-source hub I maintain) discovers sessions from Claude Code, Codex, Cursor and Gemini CLI and gives them shared tasks, messages and memory over MCP.

Built by handWith ORC
driver loop starts the executorsession_start starts a session in any supported tool on a chosen model, and the result is queued back to the parent
two message filessession_send, a durable inbox with delivery states and idempotent retries
status file and decision loga task board with states and comments, plus memories every agent loads
pause fileinbox waits for another agent, or human requests when a flow needs a person to answer
liveness checka dead worker is detected and retried up to twice
loop guard (rarely built)3 hops and 20 messages per pair per hour

Two other layers are growing next to hubs. Meta-harnesses such as Omnigent wrap Claude Code, Codex and custom agents behind one control layer, so switching harnesses is a configuration change. The A2A protocol (Linux Foundation, v1.0) standardizes messages between agents on different platforms: MCP connects an agent to tools, A2A connects agents to each other.

Vendor bridges ​

Vendors have started shipping bridges themselves. OpenAI's Codex plugin for Claude Code (announcement) runs on a ChatGPT subscription and answers most of the five questions for one direction, Claude to Codex:

PieceCodex plugin
Message/codex:review, /codex:adversarial-review with focus text, or /codex:rescue to hand Codex a task through a subagent
Reply/codex:result, with the Codex session id to reopen the run in Codex
Liveness/codex:status and /codex:cancel for background jobs
State--resume continues the latest Codex thread for the repo, and /codex:transfer turns the whole Claude session into a Codex thread
Gatean optional review gate, set up with /codex:setup

It is one-way and call-and-return at heart: Claude asks, Codex answers, nothing flows back on its own. For short reviews and second passes across two subscriptions, that is enough. Long unattended work still needs the state, liveness and gates above.

Which setup for which job ​

Six setups placed by how long the work runs and how fast a decision must come back: call and return, direct session messages, hub sessions, files and a loop, git as the channel, task board

SetupUse whenLimit
Call and return (codex exec, cursor-agent -p, a subagent, the Codex plugin)a bounded task under ten minutes: a review, a second opinionthe caller waits and pays for its context
Direct session messagestwo live agents of the same toolsame tool only
Hub sessionsseveral tools, models or subscriptions on one goalthe hub must be running
Files and a loophours unattended, spend gates, no hubliveness is yours to build
Git as the channelcode that must be reviewed and mergedslow round trips
Task boardseveral agents and people on one goalcoarse, so pair it with one of the above

Most setups combine two or three: call and return for reviews, hub sessions or files and a loop for long work, and a task board where people follow along. Start with the smallest setup that answers the five questions for your job, and add state and gates once the work runs unattended.

When not to split the work ​

Multi-agent setups carry real overhead, and a single agent is still the better default for most day-to-day coding:

  • Short tasks under ten minutes: handoffs, cold prompt caches and message plumbing cost more time and tokens than letting one session finish.
  • Tightly coupled edits: when every step depends on the full context of the same files, splitting work across agents creates merge conflicts and stalls instead of parallelism.
  • Flat single-plan volume: if one frontier subscription already covers your daily quota without hitting limits, adding a second harness buys a second opinion on reviews, not a faster inner loop.
  • No clear verification gate: without commands or tests the supervisor can rerun, a second agent only adds another confident summary to read.

Where collaboration pays off is long unattended runs, cross-model reviews that break single-model blind spots, and work that benefits from spreading across multiple subscriptions and harnesses. The models and harnesses are ready to work together. What makes them hold up is the plumbing between them: a channel that answers the five questions, state with one writer per piece, and operation rules that catch failures before they cost you.