raysonmeng/agent-bridge
A local bridge for bidirectional collaboration between Claude Code and Codex. 连接 Claude Code 与 Codex 的本地实时协作桥接工具。
AgentBridge – a local bridge that lets Claude Code and OpenAI Codex talk to each other in real time
What it is – AgentBridge is a developer‑side utility that runs a tiny daemon and a command‑line wrapper (abg / agentbridge). It connects two large‑language‑model coding assistants – Claude Code (Anthropic) and Codex (OpenAI) – so they can exchange messages, review each other’s work, and hand‑off tasks without you copying text between terminals.
Why it matters – Normally you would have to run two separate terminals, copy‑paste code, and manually switch when one agent hits its quota. AgentBridge automates the “relay”:
- each agent stays alive as a persistent peer,
- messages are pushed automatically (with a fallback queue),
- a busy‑guard prevents overlapping replies, and
- a built‑in watchdog lets a long job survive subscription‑quota limits by handing the turn to the other agent.
Core features (as described in the README)
| Feature | What you get |
|---|---|
| Bidirectional Claude ↔ Codex messaging | Claude receives Codex’s agentMessage payloads as channel notifications; Codex receives Claude’s replies via the reply tool. |
| Push delivery with fallback queue | If a push fails, the daemon stores the message in memory and retries via get_messages. |
| Turn coordination | A busy‑guard blocks replies while the opposite side is in an active turn; an inactivity watchdog forces a turn to complete after 5 min of silence. |
| Multiple pairs side‑by‑side | You can run several Claude+Codex pairs in the same repo; each pair gets its own set of ports (+10 stride from 4500). |
| Resilient lifecycle | The daemon survives Claude restarts, auto‑reconnects with back‑off, cleans up orphan processes, and offers abg doctor diagnostics. |
| Thread auto‑resume | abg codex automatically re‑opens the last Codex thread; abg resume prints or runs the needed commands for both sides. |
| Budget coordination & auto‑resume | When one agent’s subscription quota expires, the bridge pauses that side and lets the other continue, keeping long jobs alive. |
| Filtering to keep context small | Only agentMessage payloads cross; other tool‑call noise is dropped. A three‑tier marker system ([IMPORTANT], [STATUS], [FYI]) lets you control what is forwarded, buffered, or ignored. |
| Cross‑network collaboration (preview) | v3 adds a broker‑based “room” so pairs can run on different machines and still exchange messages. |
Quick‑start workflow (from the README)
- Install Bun – the runtime required for the daemon.
- Install the CLI –
npm install -g @raysonmeng/agentbridge(post‑install registers a Claude Code plugin). - Initialize the project –
abg initcreates.agentbridge/config.jsonand checks dependencies. - Start Claude –
abg claudelaunches Claude Code with the bridge channel enabled. - Start Codex – in another terminal,
abg codexlaunches the Codex TUI connected to the same bridge.
Now you can ask Claude to “propose a task split with Codex for …” and watch the two agents negotiate, implement, and review code without any manual copy‑pasting.
How it works under the hood
- bridge.ts – a short‑lived foreground client that Claude loads as a plugin. It forwards Claude’s
replycalls to the daemon and receives Codex messages to push back into Claude. - daemon.ts – a persistent background process that talks to the Codex app‑server (via WebSocket or Unix socket) and holds the authoritative state for the pair.
- Communication flow:
- Codex → daemon → bridge → Claude (channel notification)
- Claude → bridge → daemon → Codex (injected
turn/start)
- Each message carries a
sourcefield so the bridge never echoes a message back to its origin, preventing loops.
Installation & prerequisites (as listed)
| Dependency | Recommended version | Install command |
|---|---|---|
| Bun | v1.3.11+ | `curl -fsSL https://bun.sh/install |
| Claude Code | 2.1.269 | npm install -g @anthropic-ai/claude-code@2.1.269 |
| Codex CLI | 0.154.0 | npm install -g @openai/codex@0.154.0 |
Note: The CLI defaults launch Claude with
--dangerously-skip-permissionsand Codex with--yolo(i.e., they can run commands and edit files without prompting). Use--safeor setAGENTBRIDGE_SAFE=1if you need the normal permission prompts.
Typical commands
| Command | What it does |
|---|---|
abg init |
Checks deps, registers the Claude plugin, writes .agentbridge/config.json |
abg claude [args] |
Starts Claude Code with the bridge channel (injects required flags) |
abg codex [args] |
Starts Codex TUI attached to the bridge; abg codex --new creates a fresh thread |
abg resume |
Prints or executes the commands needed to re‑attach both sides to the last session |
abg pairs |
Lists, removes, or prunes multiple Claude+Codex pairs |
abg doctor |
Read‑only diagnostics (environment, daemon health, logs) |
abg budget |
Shows each agent’s subscription quota status |
abg kill |
Gracefully stops the daemon and any managed Codex TUI |
abg dev |
For developers – registers a local marketplace and forces a plugin sync |
Who might use it
- Solo developers who already have access to Claude Code and Codex and want them to collaborate automatically.
- Researchers exploring multi‑agent coding workflows, task‑splitting, or cross‑review between different LLM providers.
- Teams that run long‑running code‑generation jobs and need a way to keep work alive when one provider’s quota expires.
Limitations (explicitly called out)
- It is local‑only – not a hosted, multi‑tenant service.
- It only supports the two specific agents (Claude Code and Codex); it is not a generic orchestration framework.
- Security boundaries are minimal – the bridge assumes you trust both agents and the workspace.
Where to learn more
- Website & demo: https://raysonmeng.github.io/agent-bridge/ (animated replay of a real session)
- Documentation:
docs/folder in the repo – includes a manual, troubleshooting guide, and details on the cross‑network “room” feature. - Community discussion: LINUX DO developer forum (link in README).
TL;DR
AgentBridge is a lightweight, Bun‑based daemon plus CLI that lets Claude Code and OpenAI Codex converse, split tasks, and review each other’s output inside a single development session, handling turn coordination, quota hand‑off, and message filtering automatically. It is aimed at developers who want two LLM coding assistants to work together without manual copy‑pasting.
Related
- Project
- Project
- Project
- Project
- Project