Skip to main content
Glama

session-bridge

A zero-dependency Python (3.9+ stdlib) MCP server, SQLite WAL task ledger, cross-agent mailbox, and read-only session inspector connecting Claude Code, Antigravity, Codex CLI, and Gemini CLI.

Why session-bridge?

Switching between coding agents shouldn't mean copy-pasting transcripts or guessing which worktree is active:

  • Read-only cross-CLI session adapters: list, read (handoff, recent, full, files/artifacts), and search sessions across Claude Code (~/.claude), Antigravity (~/.gemini/antigravity*), Codex CLI (~/.codex), and Gemini CLI (~/.gemini/tmp).

  • Shared SQLite WAL task ledger (~/.local/share/session-bridge/bridge.db + auto-rendered LEDGER.md): track task status, ball_with, git worktree, branch, commit_sha, pr_url, and warn on active worktree collisions.

  • Cross-agent mailbox with honest wakeup UX: bridge_send_message tracks active wait-inbox watcher PIDs and reports either delivery: "live_wakeup" (a watcher is running and will return within ~1 s) or delivery: "queued_for_next_turn" (stored in bridge.db until the recipient's next turn).

  • Sub-5 ms prompt-turn hooks: surfaces unacknowledged message previews once per message via SessionStart / UserPromptSubmit / PreInvocation / BeforeAgent hooks without blocking turns.

  • Strict security defaults: 0700 data directory, 0600 on bridge.db + -wal/-shm + LEDGER.md, and canonical root confinement rejecting symlink escapes and .. traversal.

Related MCP server: hardline-mcp

Supported CLIs

Client

Read/List/Search Adapter

MCP Auto-Config

Prompt Hooks

Packaged Skill

Claude Code

Yes

~/.claude.json

SessionStart, UserPromptSubmit

~/.claude/skills/session-handoff/SKILL.md

Antigravity

Yes

~/.gemini/config/mcp_config.json

SessionStart, PreInvocation

~/.gemini/config/skills/session-handoff/SKILL.md

Codex CLI

Yes

~/.codex/config.toml

n/a

~/.codex/skills/session-handoff/SKILL.md

Gemini CLI

Yes

~/.gemini/settings.json

SessionStart, BeforeAgent

~/.gemini/skills/session-handoff/SKILL.md

Installation

Install persistently with uv or pipx (recommended so hooks invoke a local binary without cache cold-starts):

uv tool install session-bridge
# or
pipx install session-bridge

Or try directly from a local checkout:

pip install -e .

Then register the MCP server, hooks, and skills for whichever coding CLIs exist on your machine:

session-bridge install
session-bridge doctor

Useful flags:

session-bridge install --dry-run
session-bridge install --clients claude codex
session-bridge uninstall          # preserves ~/.local/share/session-bridge/bridge.db
session-bridge uninstall --purge-data

Honest Delivery Model (live_wakeup vs queued_for_next_turn)

Sending a message never wakes an idle peer by itself. bridge_send_message (and session-bridge send) inspects active wait-inbox watcher PIDs and returns:

  • "live_wakeup": at least one matching session-bridge wait-inbox process is alive right now (watcher_pids populated) and will receive the message within ~1 s.

  • "queued_for_next_turn": no watcher is active; the message is queued in bridge.db and surfaced on the recipient's next turn by its hook (or when the user asks it to check inbox).

To wait for a reply in the background from any agent or terminal:

session-bridge wait-inbox --target claude --session <session-id> --timeout 1800

MCP Tools (17 total)

Category

Tools

Claude Code

list_claude_sessions, read_claude_session, search_claude_sessions

Antigravity

list_antigravity_sessions, read_antigravity_session, search_antigravity_sessions

Codex CLI

list_codex_sessions, read_codex_session, search_codex_sessions

Gemini CLI

list_gemini_sessions, read_gemini_session, search_gemini_sessions

Task Ledger

ledger_upsert_task, ledger_list_tasks

Mailbox

bridge_send_message, bridge_check_inbox, bridge_ack_messages

CLI Quick Reference

# Inspect peer sessions
session-bridge list-claude --all
session-bridge read-claude <id-or-name> --mode handoff
session-bridge list-agy
session-bridge list-codex
session-bridge list-gemini

# Shared ledger & mailbox
session-bridge ledger-upsert my-task --title "Refactor auth" --status needs_review --ball-with claude
session-bridge ledger-list
session-bridge send --to claude --from antigravity:abc12345 --kind review_request --task my-task --subject "Ready for review" --body "See branch feat/auth"
session-bridge inbox --target claude
session-bridge watchers

Security & Privacy

  • Zero runtime dependencies: pure Python 3.9+ standard library (sqlite3, json, pathlib, argparse, os, signal).

  • Path confinement: every transcript, artifact, side-note, and project-root read resolves symlinks and rejects any path outside canonical CLI directories.

  • Strict file permissions: ~/.local/share/session-bridge is enforced as 0700; bridge.db, bridge.db-wal, bridge.db-shm, and LEDGER.md are enforced as 0600.

  • Opt-out env var: set SESSION_BRIDGE_DISABLE_HOOK=1 in automated/headless runs to keep hooks completely silent.

  • Custom data directory: set SESSION_BRIDGE_DIR=/path/to/dir to isolate state per environment.

Development

pip install -e ".[dev]"
pytest -v
python scripts/privacy_scan.py --git-history

License

MIT — see LICENSE.

Available Tools

17 tools
bridge_ack_messagesA

Explicitly acknowledge message IDs when bridge_check_inbox was called with ack=false.

Inputs: ids (required), acked_by.

bridge_check_inboxA

Check the shared mailbox for messages addressed to an agent role ('claude', 'antigravity', 'codex', 'gemini') or a specific session ID. Acknowledges read messages by default (ack=true).

Inputs: target (required), ack, limit, task_slug, +2 more.

bridge_send_messageA

Send a structured message (handoff, review_request, review_verdict, question, note) between coding agents via the shared mailbox. Can atomically flip a linked ledger task's status and ball_with in the same call. Sending does NOT wake the recipient: the result's delivery field is 'live_wakeup' only when an active wait-inbox watcher for that recipient is running right now; otherwise it is 'queued_for_next_turn'. Report that honestly to the user.

Inputs: body (required), sender (required), subject (required), recipient (required), +4 more.

ledger_list_tasksA

List tasks on the shared cross-agent ledger, optionally filtered by status or ball_with.

Inputs: slug, status, ball_with, include_done.

ledger_upsert_taskC

Create or update a task on the shared cross-agent ledger (~/.local/share/session-bridge/bridge.db & LEDGER.md). Tracks status, who has the ball ('claude', 'antigravity', 'codex', 'gemini', 'user', 'none'), worktree ownership, branch, commit SHA, and next step.

Inputs: slug (required), title, branch, pr_url, +8 more.

list_antigravity_sessionsB

List Antigravity (CLI, App, IDE) conversations with conversation_id, title, workspaces, status, updated timestamp, and artifact paths.

Inputs: limit, query, workspace_filter, include_subagents.

list_claude_sessionsA

List Claude Code sessions on this machine with live PID status, name, working directory (including git worktrees), status, session_id, and transcript size.

Inputs: limit, query, cwd_filter, active_only.

list_codex_sessionsA

List OpenAI Codex CLI sessions from ~/.codex/sessions with session_id, title, working directory, model, git branch, and updated timestamp.

Inputs: limit, query, cwd_filter.

list_gemini_sessionsA

List Gemini CLI sessions from ~/.gemini/tmp/*/chats with session_id, title, resolved project working directory, model, and updated timestamp.

Inputs: limit, query, cwd_filter.

read_antigravity_sessionB

Read an Antigravity conversation transcript and its artifacts cleanly. Supports lookup by conversation_id (or prefix) or title substring.

Inputs: session (required), mode, max_chars, last_n_turns, +1 more.

read_claude_sessionA

Read a Claude Code session transcript cleanly (stripping API request blobs and system-reminder noise). Supports lookup by session_id, PID, or title substring.

Inputs: session (required), mode, max_chars, last_n_turns, +1 more.

read_codex_sessionA

Read a Codex CLI session transcript cleanly (stripping environment_context and encrypted reasoning payloads). Supports lookup by session_id (or prefix) or title/cwd substring.

Inputs: session (required), mode, max_chars, last_n_turns, +1 more.

read_gemini_sessionB

Read a Gemini CLI session transcript cleanly (supporting both .json and .jsonl formats). Supports lookup by session_id (or prefix) or title/cwd substring.

Inputs: session (required), mode, max_chars, last_n_turns, +1 more.

search_antigravity_sessionsC

Search across Antigravity conversation titles and transcripts.

Inputs: query (required), limit.

search_claude_sessionsB

Search across Claude Code active transcripts, prompt history (~/.claude/history.jsonl), or recent closed transcripts.

Inputs: query (required), limit, scope.

search_codex_sessionsB

Search across Codex CLI session transcripts or prompt history (~/.codex/history.jsonl).

Inputs: query (required), limit, scope.

search_gemini_sessionsC

Search across Gemini CLI session titles and transcripts.

Inputs: query (required), limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 17 tools

    Disambiguation5/5

    Each tool targets a distinct resource+action: the four provider families are cleanly separated (list/read/search per Gemini, Antigravity, Codex, Claude), and the ledger and mailbox tools occupy clearly different domains. The only near-overlap is bridge_check_inbox (ack=true by default) versus bridge_ack_messages, and the descriptions explicitly explain the ack=false workflow that separates them.

    Naming Consistency4/5

    Twelve tools follow a strict verb_provider_noun pattern (list_gemini_sessions, read_codex_session, search_claude_sessions), and the collaboration tools follow a namespace_verb_noun pattern (ledger_upsert_task, bridge_send_message). Two coexisting conventions is a minor deviation, but each family is internally consistent and readable.

    Tool Count4/5

    17 tools is slightly above the comfortable range, but the count is fully accounted for by a systematic 4 providers × 3 operations matrix plus 5 collaboration tools. Nothing appears redundant, though the per-provider symmetry means any new provider adds three more tools.

    Completeness4/5

    Session lifecycle (list, read, search) is covered for all four agent CLIs, and the ledger/mailbox surface supports create, update, list, send, receive, and acknowledge. Gaps are minor: no task delete/archive or single-task get on the ledger, no message history/thread view beyond the inbox, and no unified cross-provider search despite the 'bridge' framing.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      A
      maintenance
      A coordination layer for coding agents that provides memorable identities, inbox/outbox messaging, searchable message history, and file lease management to prevent conflicts. Uses Git for human-auditable artifacts and SQLite for fast queries, enabling multiple agents to collaborate across projects without stepping on each other.
      41
      2,243
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Lets separate coding-agent sessions coordinate through a shared, role-addressed mailbox instead of a human relaying every message, over a single local SQLite file or a hosted server with many isolated channels. Messages can be sent as tracked obligations that stay open until one side resolves and the other confirms, alongside threads, full-text search, work statuses, and an append-only versioned pin system where protected changes require recorded agreement from every declared role.
      41
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to keep persistent project memory—rules, decisions, known failures and fixes—and to exchange durable agent-to-agent messages over a channel, including tasks, results, and acknowledgements.
      Apache 2.0