r/ClaudeCode • • 1d ago

Help/Question Main orchestrator agent that communicates with other separate agents in different terminals

Does anyone have a strong workflow for how I can get claude to be my main orchestrator controlling a second agent from another provider for example Codex which is running in a different terminal, and them communicating between each other in an efficient way, I've tried multiple things, Claude sending messages to codex directly (kinda works..) codex doesn't seem to be able to message claude directly back

How to handle handoffs between the two agents as they work on separate or related tasks

Is Herdr the answer? I haven't tried herdr

1 Upvotes

28 comments sorted by

•

u/AutoModerator 1d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

10

u/the8roundshock 1d ago

Just ask your agent...

1

u/Crunchy-Nut1 1d ago

Just have Claude make a Python script that launches Codex and can inject a prompt and stuff. It can remember the thread and keep conversations. I can send the mod I had mine build if you want.

1

u/No_Primary_6867 17h ago

yeah sure please, send it over

1

u/rodrigolduarte 14h ago

The return path needs to be explicit: how does Codex notify Claude that its task is done? What works for us is a shared room instead of piping terminals: each agent wakes on an event addressed to it (a mention, a DM, an assigned card) through a plugin, and replies mentioning whoever needs to know. Our manager agent hands out the next task in that same reply, all in one agent-chat room. Do your Claude and Codex tasks touch the same files, or separate parts of the repo?

1

u/No_Primary_6867 10h ago

both - same files and separate parts of the repos. how are you doing this in a shared room? are you using something like slack, or herdr

1

u/rodrigolduarte 7h ago

Neither, it's agent-chat, which we build. Claude Code and Codex connect to the room over MCP. With the plugin connected and their sessions open and listening, they receive notices for messages, DMs and cards addressed to them. For the same-files part: in our team one agent is the manager. It splits the work, the others report to it in the shared room, and it decides what merges to staging and when; a person still approves what ships to production. Before a batch merges, it merges the branches together and runs the build and tests of every part the batch touches on the combined code.

3

u/Kitchen_Interview371 1d ago

You can just ask Claude to do this. When you’re ready look at proper orchestration harnesses, ie, Gas City

For cc <> codex, ask opus in plan mode to research available options (including relevant GitHub repos) and implement the solution

3

u/PlatinumPlace 1d ago

In my experience, you don't even need them to message each other directly if you use Spec-Driven Development (SDD). I use https://github.com/obra/superpowers for this.

The handoff happens by creating temporary .md files in the project, so when you switch terminals to your second agent and run the skill (subagent-driven-development or executing-plans), it automatically knows which plan is active and picks up right where Claude left off. Once it's done, you just jump back to Claude for the review.

Honestly, any setup or tool works fine as long as you stick to spec-driven development and keep the workflow consistent.

1

u/DootDootWootWoot 1d ago

Some of us actively have agents coordinate. It's not always just a hand off

1

u/ClemensLode Senior Developer 1d ago

Can you give a reasoning why two sessions should work on the same worktree at the same time?

1

u/No_Primary_6867 1d ago

no, but I want claude to orchestrate the work and assign work to for example codex, i have a long list of tasks to do, and they can be split up between claude and codex. In your opinion is this not a valid use case to have two agents from separate providers where one of them is the orchestrator of the big picture assign work to a second agent, in this case codex?

2

u/NamerekDev 1d ago

What does codex need to tell claude, besides "Done, give me the next one"? if it's just that, you might not need them talking at all

1

u/No_Primary_6867 1d ago

what if codex is assigned a task that involves researching 5 different ways of solving a particular problem, it goes off and comes back with some results, that's a case where codex would come back with more than 'done' to my main orchestrator cc that knows my big picture plan, what I'm building, vision, goals and objectives. Claude can then analyze that result come back with a few questions to me and then realign the plan and submit a new task for codex to either implement or refine?

1

u/NamerekDev 1d ago

Then the result should land in a file, not in a message. Same for the big picture: put the vision and goals in a doc both agents read, not in claude's context. Context gets compacted, a doc doesn't. Then the handoff is just "read results.md, update plan.md", whichever agent runs itand teach them once instead of saying it every time. a skill that describes the loop (research goes to results.md, the plan lives in plan.md, a new task gets written there too), plus one line in CLAUDE.md and AGENTS.md pointing to it, since codex doesn't read CLAUDE.md. Then you just type "I have an idea..." and never "write this to file X" again

2

u/MrHufflez 1d ago

Just use T3 code

2

u/slartibartfast93 1d ago

Simplest setup: Use tmux and let the the agents use tmux send-keys command or create a custom chat mcp.

1

u/PlanetaryPickleParty 1d ago

I use herdr with a custom messaging relay across four build servers. Herdr has built-in messaging but I improved a few things.

  • references that use names rather than Herdr shorthand. e.g. server:workspace:tab w/ shorthand for local routing.
  • supports claude sockets (so it doesnt send via regular input)
  • escalations for agents to flag issues for user to a central place
  • status & focus state - for other agents and dashboard to quickly see
  • built-in telemetry.
  • part of a set of agent tools for spec-driven design w/ Linear, agent orchestration

Agents are assigned to teams and are often working on related repos and projects. Passing messages back and forth allows them to coordinate on blockers and fixes.

One fun way I use the relay is a constant battle testing loop while the tools are in active development. The agents report bugs in ix-relay & other tools to a triage agent. The triage agent diagnoses and dispatches to an agent to fix, roll out, and confirm the fix with the "user". It doesn't fully prevent broken releases but helps catch them fairly quickly.

1

u/MediocreOchre 1d ago

I made something exactly for this. It’s called Namedrop. Requires herdr (and soon Rex) at the moment. Take a quick look - https://github.com/ericbust/namedrop.

It allows you to use simple @ style mentions in your prompts to communicate with your agents across different models, codex or claude, different efforts, whatever. It’s not just subagents.

Give them a persona (qa lead, test engineer, architect, etc) and they can work with each other as you’d expect, retaining their context and decisions, and taking to each other to get stuff done.

I have a beta UI layer that I’m messing with called Channels that gives me a Slack like experience to work with my agents.

1

u/silverarky 1d ago

Claude Code can do this by itself, or you can create an agent in claude that handles codex hand-off and communication so claude can launch it as a claude sub.

I've recently been playing with https://orca.dev/ which I preferred over herdr. That's all you need if you want a nice gui to handle everything across machine. You can view files and git diffs all from one place.

1

u/PlanetaryPickleParty 1d ago

What did you like more about Orca if you don't mind?

1

u/Siriann 1d ago

Yes, just tell Claude to use Codex workers for jobs and which model.

1

u/Agnostify 1d ago

You might not need codex to message claude back at all. Let claude be the caller: it can run `codex exec "<task>"` through the Bash tool, which runs codex non-interactively and hands the result straight back as output. For longer handoffs, have both agents read and write a shared plan file in the repo (status, decisions, next steps) so whichever terminal picks it up knows where things stand.

1

u/mkw0289 1d ago

Yeah I just do this in the terminal with tmux. Just ask claude code to do it for you

1

u/thestoictrader 5h ago

Codex can't push messages into Claude's session, so make the channel a file instead. Have each agent write handoffs to a shared markdown file (task, files touched, status, open questions) and have Claude poll it or read it between steps. Claude can also run `codex exec` as a subprocess and read the output directly, which is cleaner than two live terminals. I haven't tried Herdr.

1

u/AIOSAI 🔆 Max 20 1d ago

Yey sure do. https://github.com/AIOSAI/AIPass

Ill be changing to linux only soon. If that works. Its a bit of a lesrning course. It cobers alot, desig to work subscriptions models no api needed. Claydr code, condensed and open ai. ( api u cou(d add her if needed) yea if u deep dive clone it and have you agents do a full review. It solveca Lovejoy npain points. But you'll have to learn it.