Skip to main content
Glama

agent-bridge

Let Claude Code, OpenAI Codex and opencode talk to each other.

agent-bridge is a set of plugins for Claude Code, Codex and opencode, built on a shared core. Agents on the same machine can:

  • Message each other live. A Claude Code session and a Codex session send each other questions, reviews and results. Replies are threaded, and messages to an agent that is offline wait for it.

  • Delegate. ask_<agent> runs another agent headlessly for a one-off task and returns its answer; for example ask_codex and ask_opencode from Claude, or ask_claude from Codex. You can continue that session later.

  • Spawn each other as subagents. spawn_codex / spawn_claude start the other agent in the background and return immediately. The result arrives later as a message, and several subagents can run in parallel.

  • Pick any model. ask_* and spawn_* accept any model id or alias the target CLI accepts, for example gpt-6-sol, opus, or a full Claude model id. Ids are passed through verbatim, so new models work without a plugin update.

 Claude Code session                               Codex session
┌─────────────────────────┐                      ┌─────────────────────────┐
│ agent-bridge MCP server │◄──── local pipe ────►│ agent-bridge MCP server │
│ + channel push / hooks  │  \\.\pipe\… or .sock │ + hooks / codex queue   │
└─────────────────────────┘          │           └─────────────────────────┘
               the first server to start is the broker; messages persist in SQLite

There is no daemon to install. Each agent starts its own MCP server. The first one to start binds a Windows named pipe (or a Unix domain socket on macOS/Linux) and acts as the broker. If that process exits, another server takes over automatically. All messages are stored in SQLite under ~/.agent-bridge, so nothing is lost when a peer is offline or the broker changes.

Requirements

  • Node.js 22.13+ (uses the built-in node:sqlite)

  • Claude Code (with plugin support) and/or Codex CLI (with plugin support; tested with 0.156)

Related MCP server: claude-intercom-mcp

Install

Claude Code

claude plugin marketplace add rennerdo30/agent-bridge
claude plugin install agent-bridge@agent-bridge

Codex

codex plugin marketplace add rennerdo30/agent-bridge
codex plugin add agent-bridge@agent-bridge

Codex does not run plugin hooks until you trust them. Open /hooks in a Codex session once and trust the agent-bridge hooks. Without them, messages are only visible when Codex calls the inbox tool.

opencode

npx -y github:rennerdo30/agent-bridge install-opencode

This copies the plugin into opencode's global config (~/.config/opencode/plugins/, plus a skill). Restart opencode afterwards. It needs Node.js 22.13+ on PATH. Remove it with npx -y github:rennerdo30/agent-bridge uninstall-opencode.

In opencode the tools are called bridge_peers, bridge_send, bridge_ask_claude, bridge_spawn_codex, and so on. Because opencode plugins can start turns themselves, opencode receives peer messages live, even while idle, whenever its listen window or auto-wake applies.

Usage

Just ask in plain language, for example:

Ask Codex to review the diff in src/auth and wait for its answer.

Send the Codex session a summary of the API we agreed on.

Get a second opinion from Claude on this migration plan. (from Codex)

Tools (both agents)

Tool

What it does

peers

Who is online, your own name, delivery mode and auto-wake status

send

Message a peer: to = peer name, claude/codex (if exactly one is online) or *; reply_to threads answers

wait_for_message

Block until a (matching) message arrives, e.g. the answer to your question

inbox

Read unread messages

ask_claude / ask_codex / ask_opencode

Headless delegation to another agent (every agent gets the other two); waits and returns the answer and a session_id to continue

spawn_claude / spawn_codex / spawn_opencode

Same, but as a background subagent: returns a job name at once; the result arrives as a message from <agent>-job-<id>

cancel_subagent

Stop a running background subagent

auto_wake

Let incoming messages make this session keep working (see below)

ask_* and spawn_* take these optional parameters:

  • model: any id or alias the target accepts, passed through verbatim. opencode uses provider/model.

  • session_id, cwd, timeout_sec.

  • One target-specific option: sandbox for Codex, permission_mode for Claude, or auto_approve for opencode. Headless opencode rejects every permission request unless auto_approve is set.

Peer names default to <agent>-<project folder>, for example codex-myrepo. Set AGENT_BRIDGE_NAME or the name option in the config file to choose your own.

How messages reach a session

Claude Code

Codex

While the agent is working

injected after each tool call (PostToolUse hook)

same

On your next prompt

injected (UserPromptSubmit hook)

same

When the agent finishes a turn (auto-wake on)

Stop hook keeps it going

same

While the session is idle

live push via channel (see below)

auto-wake runs codex queue, which starts a turn

opencode receives messages through its plugin: after each model step while it works, and by starting a turn itself when it is idle.

Live push into Claude Code (channels)

Claude Code channels let the agent-bridge MCP server push peer messages straight into a running session, even an idle one. Channels are a research preview, and custom channels must currently be loaded with the development flag:

claude --dangerously-load-development-channels plugin:agent-bridge@agent-bridge

agent-bridge detects this flag on its parent process and switches to channel delivery automatically. You can force a mode with AGENT_BRIDGE_DELIVERY=channel|hooks.

Listen window

After a session sends a bridge message or spawns a subagent, its Stop hook keeps the turn open for up to lingerSec seconds (default 300) waiting for the reply. If a reply arrives, the agent continues with it; otherwise the turn ends normally. This keeps a back-and-forth going without you nudging either agent, and needs no auto-wake. Press Esc to stop listening early, or set lingerSec to 0 to disable it.

Auto-wake and loop protection

Auto-wake is off by default. Turn it on per session by asking the agent ("turn on agent-bridge auto-wake"), or globally with "autoWake": true in the config.

Every reply increments a conversation's hop count. Messages at or above maxHops (default 6) never wake an agent; they are still shown on the next prompt. Delegated headless sessions cannot delegate again.

Configuration

~/.agent-bridge/config.json (all keys optional; per-agent sections override the top level; env vars override both):

{
  "autoWake": false,
  "maxHops": 6,
  "lingerSec": 300,
  "codex": { "name": "codex-main", "claudeBin": "claude", "claudePermissionMode": "default", "claudeModel": "opus" },
  "claude": { "delivery": "auto", "codexBin": "codex", "codexSandbox": "read-only", "codexModel": "gpt-6-sol" },
  "opencodeModel": "anthropic/claude-sonnet-5",
  "opencodeAutoApprove": false
}

Env var

Meaning

AGENT_BRIDGE_HOME

Data directory (default ~/.agent-bridge)

AGENT_BRIDGE_NAME

Peer name

AGENT_BRIDGE_AUTO_WAKE

on / off

AGENT_BRIDGE_MAX_HOPS

Loop limit

AGENT_BRIDGE_LINGER_SEC

Listen window after sending (0 disables)

AGENT_BRIDGE_DELIVERY

Claude only: auto, channel, hooks

AGENT_BRIDGE_CLAUDE_BIN / AGENT_BRIDGE_CODEX_BIN / AGENT_BRIDGE_OPENCODE_BIN

Paths of the CLIs used for delegation

AGENT_BRIDGE_LOG_LEVEL

File log level: debug, info (default), warn, error, silent

AGENT_BRIDGE_LOG_CONSOLE

stderr log level (default warn)

AGENT_BRIDGE_PIPE

Override the pipe / socket path

Logs are written to ~/.agent-bridge/logs/agent-bridge.log.

CLI

The plugins bundle a small CLI for debugging:

node <plugin>/dist/cli.mjs status          # broker and connected peers
node <plugin>/dist/cli.mjs send codex "hi" # send as peer "cli"
node <plugin>/dist/cli.mjs tail            # print messages addressed to "cli"
node <plugin>/dist/cli.mjs paths

Troubleshooting

  • Console windows flash on Windows while Codex works. This happens when Codex runs your session inside its background app-server daemon: that process has no console, so Windows opens a new window for every git or node process it starts. Add daemon_auto_start = false under [features] in ~/.codex/config.toml, run codex app-server daemon stop, and restart Codex.

  • A peer shows up as plain codex with the plugin folder as its cwd. Codex hasn't reported the project directory yet. It does so on the first hook or tool call; make sure the hooks are trusted in /hooks.

  • Messages to an idle agent are not answered. An idle session only sees messages on its next prompt, unless it's in its listen window, auto-wake is on, or (for Claude) channels are enabled.

Security notes

  • The pipe and socket are local to your user account. On Unix the socket lives in your home directory; on Windows the named pipe name is derived from your data directory.

  • Peer messages are presented to the model as coming from another agent, not from you. The model is told not to take destructive actions only because a peer asked.

  • Delegated Codex runs are read-only by default. Delegated Claude runs use the default permission mode, which cannot approve anything in headless mode. Raise these only if you trust the task.

Development

npm install
npm run check   # typecheck + tests + build

npm run build bundles src/ into plugins/*/dist (committed, so plugins work straight from git).

License

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables discovery and instant communication between multiple local Claude Code instances running across different projects. It allows agents to list active peers, share work summaries, and send messages through a local broker daemon.
    16 npm
    2,210
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Enables local messaging between Claude Code, Codex, Pi, and other coding-agent sessions on the same machine, allowing them to discover each other, send updates, ask questions, and reply.
    8
    14 npm
    2
    AGPL 3.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables bidirectional messaging between Claude Code and Codex Desktop through a SQLite-backed bus, so messages sent from either side appear in the other's chat pane, with acknowledgement and redelivery semantics.
    23 npm
    MIT