Repository avatar
Other Tools
v1.3.0
active

peer-bus

io.github.danieljohnmorris/peer-bus

Shared message bus and live roster for coding agents (Claude Code, Codex, Cursor, OpenCode, omp).

Documentation

peer-bus

Tests npm Release License: MIT Zero Dependencies Runtime: Node 22.13+ | Bun Protocol: MCP

peer-bus — one shared bus for all your coding agents

Stop playing copy-paste relay between your coding agents.

peer-bus is a zero-dependency MCP server and CLI that gives Claude Code, Codex, Cursor, OpenCode, Antigravity (agy), VS Code, Claude Desktop, omp, Hermes, T3 Code, and pi one shared message bus and live roster — locally or across machines.

Every session can see who else is online, what they're working on, and message or ask another agent directly over a shared SQLite, Markdown, or Postgres/Neon store.

What people use it for

  • Cross-harness second opinions: Build in Claude Code, ask Codex (or Cursor) to review the diff or verify edge cases directly — no manual copy-paste between terminals.
  • Parallel session coordination: Keep multiple agents working across backend, frontend, and tests without colliding on ports, branches, or DB migrations.
  • Laptop + remote dev server: Point every machine at a shared Postgres/Neon database so agents across hosts can talk without exposing any daemon port.
  • Inspectable agent logs: Use the Markdown backend to read or sync live agent-to-agent conversations directly in git or Obsidian.
> peer-bus roster
name              harness      host    model               state    seen  doing
api@mac#a1b2      claude-code  mac     -                   working  2s    fixing auth tests
web@mac#c3d4      codex        mac     -                   idle     5s    reviewing checkout PR
ui@mac#e5f6       cursor       mac     -                   idle     9s    updating payment form

Zero runtime npm dependencies. Works on Node 22.13+ and Bun for the CLI, MCP server, SQLite, and Markdown backends (Bun is required for the cross-machine Postgres/Neon backend and the native omp extension).

Quick start

Install & auto-configure your agents

npm install -g peer-bus   # or: bun add -g peer-bus
peer-bus setup

peer-bus setup detects which harnesses you have installed (Claude Code, Codex, Cursor, OpenCode, Antigravity (agy), VS Code, Claude Desktop, omp), writes their MCP/extension entries safely without touching other settings, and uses resolved absolute paths so GUI apps never fail on PATH.

Useful options:

  • peer-bus setup --dry-run — preview changes without editing any files
  • peer-bus setup --only claude-code,codex,cursor — configure specific harnesses
  • peer-bus setup --backend md --path ~/notes/peer-bus — wire every harness to a custom backend
  • npx peer-bus setup — configure MCP harnesses via npx -y peer-bus mcp without installing globally
  • peer-bus doctor — verify runtime, store health, and every configured harness
  • peer-bus uninstall [--purge] — cleanly remove peer-bus entries from your harness configs (--purge also deletes ~/.config/peer-bus/postgres.env)

Restart your agent sessions, then run peer-bus doctor or peer-bus roster.

Installing from source (git clone)

git clone https://github.com/danieljohnmorris/peer-bus.git
cd peer-bus
bun run build && bun link   # or run without linking: bun bin/bus.ts setup
peer-bus setup

Manual harness configuration

If you prefer to configure individual harnesses yourself (replace peer-bus with npx -y peer-bus if you didn't install globally):

Claude Code

claude mcp add --scope user peer-bus -- peer-bus mcp --agent claude-code

Codex

Add to ~/.codex/config.toml:

[mcp_servers.peer-bus]
command = "peer-bus"
args = ["mcp", "--agent", "codex"]

Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "peer-bus": {
      "command": "peer-bus",
      "args": ["mcp", "--agent", "cursor"]
    }
  }
}

OpenCode

Add to ~/.config/opencode/opencode.json (or a project opencode.json):

{
  "mcp": {
    "peer-bus": {
      "type": "local",
      "command": ["peer-bus", "mcp", "--agent", "opencode"],
      "enabled": true
    }
  }
}

Antigravity (agy — live push delivery + hooks)

peer-bus setup --only agy configures four pieces automatically:

  1. ~/.gemini/config/mcp_config.json — stdio MCP tools (--agent agy --hook-managed)
  2. ~/.gemini/config/hooks.json — SessionStart, PreInvocation, and Stop hooks that bind each conversation's real conversationId, model, working/idle state, and task label, and wake idle conversations automatically via agentapi send-message when a peer messages them
  3. ~/.gemini/config/rules/peer-bus.md — always_on rule so agy knows how to use peer-bus even with lazy-loaded MCP tools
  4. ~/.gemini/config/sidecars/peer-bus/sidecar.json — optional Antigravity App sidecar manifest

For MCP-only manual configuration, add to ~/.gemini/config/mcp_config.json:

{
  "mcpServers": {
    "peer-bus": {
      "command": "peer-bus",
      "args": ["mcp", "--agent", "agy"]
    }
  }
}

VS Code

Add to your user mcp.json (MCP: Open User Configuration in the Command Palette):

{
  "servers": {
    "peer-bus": {
      "type": "stdio",
      "command": "peer-bus",
      "args": ["mcp", "--agent", "vscode"]
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "peer-bus": {
      "command": "peer-bus",
      "args": ["mcp", "--agent", "claude-desktop"]
    }
  }
}

omp (native extension + live push delivery)

ln -s /path/to/peer-bus/src ~/.omp/agent/extensions/peer-bus

Restart omp. Each omp session connects over a local unix socket to src/daemon.ts and receives live push injections into idle turns plus /peers.

Hermes / T3 Code / pi / any MCP client

Register peer-bus mcp --agent <harness> (or peer-bus-mcp --agent <harness>) as a stdio MCP server. Pass --backend md --path ~/notes/peer-bus or --backend postgres --env-file ~/.config/peer-bus/postgres.env in args (or via env) to switch backends.

Storage backends

Every agent pointed at the same store shares the exact same roster and message log. Backend selection follows this order:

  1. PEER_BUS_BACKEND=sqlite|md|postgres (or --backend)
  2. PEER_BUS_PATH / --path (inferred from .md, .sqlite/.db, or postgres://)
  3. PEER_BUS_MD_DIR (Markdown) or PEER_BUS_SQLITE (SQLite)
  4. PEER_BUS_URL / NEON_URL, or explicit --env-file / PEER_BUS_ENV (Postgres)
  5. ~/.config/peer-bus/config.json (persisted by peer-bus setup --backend|--path)
  6. ~/.config/peer-bus/postgres.env (Postgres)
  7. Default: SQLite at ~/.peer-bus/peer-bus.sqlite (zero-config)

SQLite (default)

Uses Node's built-in node:sqlite (Node 22.13+) or Bun's bun:sqlite in WAL mode. Zero setup.

export PEER_BUS_BACKEND=sqlite
export PEER_BUS_PATH=~/.peer-bus/peer-bus.sqlite

Markdown (.md)

Human-readable, git/Obsidian/Syncthing-friendly Markdown files (messages.md, sessions.md, cursors.md, or <stem>.sessions.md / <stem>.cursors.md when pointing at a .md file), protected by a cooperative lockfile and atomic renames.

export PEER_BUS_BACKEND=md
export PEER_BUS_PATH=~/notes/peer-bus   # directory or path/to/bus.md

Postgres / Neon (cross-machine)

Uses Bun.SQL so agents across multiple machines share one bus without exposing any daemon port over the network. Neon's free tier works well here (its compute suspends when the daemon idle-exits), or point it at any Postgres URL. Put PEER_BUS_URL=postgresql://... in ~/.config/peer-bus/postgres.env (auto-detected by every harness) or export it, then apply schema.sql once:

export PEER_BUS_BACKEND=postgres
export PEER_BUS_URL=postgresql://...
bunx --bun peer-bus migrate   # or: bun bin/bus.ts migrate (from source)

Tools

ToolWhat it does
peer_sessionsList live agent sessions on the bus (with harness, host, model, state, and task label)
peer_sendSend a note, ask, reply, or steer to a session, host:<host>, last, or all
peer_askSend a question to a peer and wait for its reply
peer_receiveRead unread or recent traffic, or fetch one full message by #id
peer_labelSet what this session is currently working on
peer_watch / /peersomp-only push mute toggle & TUI roster command

CLI

peer-bus setup [--dry-run] [--only claude-code,codex,cursor]
peer-bus doctor
peer-bus uninstall [--purge]
peer-bus mcp --agent <harness>
peer-bus roster
peer-bus send all "port 3000 is free now"
peer-bus ask claude-code "did the migration pass?"
peer-bus tail
peer-bus stats --backend md --path /tmp/bus.md

Environment variables

VariableDescription
PEER_BUSSet 0/false/off to disable the omp extension
PEER_BUS_QUIETSet 1 to stay on the roster without injecting messages (omp)
PEER_BUS_BACKENDsqlite, md, or postgres
PEER_BUS_PATHPath to .sqlite file, .md file/dir, or postgres:// URL
PEER_BUS_URLPostgres connection URL (also checks ~/.config/peer-bus/postgres.env)
PEER_BUS_ENVCustom env file containing PEER_BUS_URL= / DATABASE_URL= / NEON_URL=
PEER_BUS_STATE_DIROverride ~/.peer-bus (socket, log, default SQLite DB)

Security & trust model

peer-bus is designed for personal / trusted single-user setups (one machine, or your own machines via Postgres):

  • The MCP server runs over local stdio only — no listening network port.
  • SQLite and Markdown files are stored locally with 0600 permissions (plaintext at rest).
  • There is no per-session authentication between peers, so do not share a bus with untrusted users and never send secrets or tokens over the bus.

Test & build

bun install
bun run build
bun run test          # Node
bun --bun run test    # Bun

MIT licensed.

NPM
peer-bus
Install Command
npm install peer-bus
Runtime: npx