Subway
On-demand, token-efficient context transit system connecting independent AI coding agents across multiple windows (Antigravity, Claude Code, OpenCode, Cursor, Devin, Codex, Pi, and more).
Live multi-window workspace: Claude Code IDE tab (center), OpenCode terminal (bottom dock), and Antigravity Gemini (right pane) connected concurrently via Subway.
Stop copy-pasting 50,000-line markdown summaries between AI tools or blowing through your context window. Subway acts as an on-demand transit system between your coding agents: board any chat, search by quote, sync only the delta turns since your last visit, and extract high-density decision logs.
Why Subway?
When you work across multiple windows (e.g. Antigravity IDE on screen 1, Claude Code in tab 2, OpenCode terminal running in background):
- Context Amnesia: Each window is completely blind to what the other agent discovered, decided, or changed.
- Serial Number Hell: Nobody remembers 36-character UUIDs (
78879399-3626-4504...).
- Token Bankruptcy: Copying full conversation dumps eats up 20,000–50,000 tokens before you even type your prompt.
Subway solves this:
- Zero Dependencies: Uses standard Python (
/usr/bin/python3), runs on your own machine.
- Search by Quote: Search any phrase you or the agent said; jump directly to that turn.
- Delta Sync (
since="last"): Only transfers the new exchanges since the last time you bridged.
- Decision Log (
mode="decisions"): Cuts 85-90% of token noise by extracting only instructions, rationale, architecture decisions, and files touched.
- Universal Multi-Window: Works seamlessly across Claude Code (CLI & IDE extension), Antigravity IDE, and OpenCode (terminal).
- Workspace Guard & HUD: Coordinates file leases, multi-agent worker swarms, permission approval relays, and quota monitoring.
Work Comfortably From Your Favourite IDE
Stay in your groove without context switching. Whether you code inside Antigravity, Claude Code, OpenCode, Pi, GitHub Copilot, Cursor, Devin, Codex, or your favorite terminal dock, Subway keeps your agents unified in the background:
- Stay in Your Environment: Dispatch autonomous workers, coordinate multi-agent threads, and review diffs directly from your preferred editor or terminal without jumping across disconnected apps.
- Unified Live HUD: Monitor real-time fleet health, active worker swarms, approval queues, quotas, and transit lines in an interactive heads-up display while remaining focused in your IDE.
- Cross-Agent Decision Sync: Architectural decisions, file claims, and rationale sync bi-directionally between windows in real time—eliminating context amnesia across tools.
Subway Live HUD: Unified fleet overview displaying connected agent lines, worker swarms, and system health.
Autonomous worker dispatch: Launching and delegating scoped subagent tasks directly from your active editor session.
Shared decision tracks: Synchronizing architectural choices, rationale, and file touch manifests across agents without token waste.
Multi-window coordination: Managing threads, reviewing approvals, and monitoring active file locks across concurrent IDE windows.
Supported Transit Lines
Universal on-demand multi-agent transit connecting Claude Code, Antigravity, and OpenCode via local stdio MCP.
| Line |
Storage Format |
Supported Capabilities |
| Claude Code |
~/.claude/projects/*/*.jsonl |
Full transcript, thoughts, active tab detection, PreToolUse collision hook, permission relay, background continue |
| Antigravity |
~/.gemini/antigravity/brain/ & summaries DB |
Full transcript, planner thoughts, historical FTS, worker dispatch via agy CLI |
| OpenCode |
~/.local/share/opencode/opencode.db |
Full transcript, reasoning blocks, costs & models, subagent stubs, background continue |
| Cursor |
Cursor session stores |
Transcript reading, live steps in HUD, worker dispatch, forks and session handoff |
| Devin |
Devin session stores |
Transcript reading, live steps in HUD, worker dispatch, forks and session handoff |
| Codex |
Codex session stores |
Transcript reading, live steps in HUD, forks and session handoff |
| Pi |
Pi session stores |
Transcript reading, session handoff, and HUD chat support |
| GitHub Copilot |
gh sign-in and Copilot session stores |
Usage gauges (chat, completions, premium requests), transcript reading, and Copilot inline tools |
| Kimi |
~/.kimi-code/ sign-in |
Usage gauges (5-hour, weekly, monthly), experimental; no worker dispatch |
Installation & Setup
1. Clone Repository
git clone https://github.com/obafemiadebayorr/Subway.git
cd Subway
2. Universal 1-Click Auto-Connect
Install from npm:
npx -y @obafemi_adebayorr/subway install
On macOS the installer also offers terminal-notifier through Homebrew, so clicking a Subway alert opens the HUD. It tells you what it's doing, asks first when it can, and only suggests the command when it can't ask.
Or run the universal installer script locally:
python3 install.py
(Or simply tell Gemini / Claude: "Connect Subway to my coding agents")
Output:
Subway Universal Connector
Server binary: /path/to/Subway/server.py
Python runner: /usr/bin/python3
[+] Claude Code : Connected in ~/.claude.json
[+] Antigravity (Gemini) : Connected in ~/.gemini/config/mcp_config.json
[+] OpenCode (Terminal) : Connected in ~/.config/opencode/opencode.json & stubs synced
[OK] Completed. 3 of 3 agent lines connected.
Check connection status at any time:
python3 install.py --status
Selective Installation (e.g. only 2 of 3)
If you only use certain agents (or want to skip one), you can choose interactively or pass flags:
# Connect only Claude Code and Antigravity
python3 install.py --targets claude,gemini
# Connect everything except OpenCode
python3 install.py --skip opencode
# Disconnect Subway from just one tool (leaving the others intact)
python3 install.py --remove opencode
Claude Code CLI
claude mcp add --scope user subway -- /usr/bin/python3 /path/to/Subway/server.py
Antigravity IDE
Add to ~/.gemini/config/mcp_config.json:
{
"mcpServers": {
"subway": {
"command": "python3",
"args": ["/path/to/Subway/server.py"]
}
}
}
OpenCode CLI / Terminal
Add to ~/.config/opencode/opencode.json:
{
"mcp": {
"servers": {
"subway": {
"type": "local",
"command": ["python3", "/path/to/Subway/server.py"]
}
}
}
}
4-Tier Station Aliasing System
Subway routes station requests through a 4-tier hierarchy: Explicit Pins -> Floating Heads -> Workspace Terminals -> Topic Slugs.
The Multi-Chat Challenge
Terminal tools like Claude Code CLI and OpenCode run on a process lifecycle (a PID or active terminal socket). When you close the terminal or switch tasks, the process ends.
Antigravity (Gemini) operates on an enduring document library lifecycle:
- An IDE workspace can have multiple concurrent conversation threads open in parallel across different projects.
- Switching tabs does not terminate chats; they pause at their last transcript turn in SQLite.
- If an alias like
@gemini simply resolved to ORDER BY last_modified_time DESC, clicking over to check another file for 30 seconds would accidentally hijack another agent's context query!
The 4-Tier Solution
Subway eliminates raw UUIDs and context jacking with a layered 4-tier naming hierarchy:
| Tier |
Format |
Examples |
Behavior |
| 1. Explicit Pins |
@<alias> |
@claude-main, @agy-live, @opencode-terminal |
Immutable & sticky via tag_chat. Never drifts when switching tabs or opening side tasks. |
| 2. Floating Latest |
@<agent>-latest, @latest |
@agy-latest, @claude-latest, @latest |
Dynamically resolves to the most recently touched session globally or per-platform. |
| 3. Workspace Heads |
@<agent>-<project> |
@agy-my-project, @claude-portfolio, @copilot-subway |
Dynamically resolves to the latest active chat in that workspace folder. |
| 4. Topic Slugs |
@<agent>-<topic> |
@agy-subway, @agy-gitignore, @copilot-parser |
Automatically extracted from conversation titles. Reference chats by topic rather than ID. |
Fast Mail vs Direct Chat
Subway separates agent-to-agent mail from direct user-to-agent chat:
- Fast Mail (
send_note / reply_note): Asynchronous agent-to-agent mailbox channel. send_note delivers straight into an online agent's chat (mode="fast") or queues it (mode="normal"). reply_note threads answers, fastmail_status tracks each message (queued, delivered, read, replied), and ask_room asks every chat in a project at once. Waking an offline chat needs your approval in the HUD. Settings live under mail.*; mute noisy stations from the HUD's Fast mail panel.
- Direct Chat (
/api/chat): Synchronous user-to-agent chat channel in the HUD. Messages sent via /api/chat deliver directly to the target agent session without passing through the Fast Mail queue, and support background continue for OpenCode and Claude chats so you can resume or steer sessions directly from the browser.
- Provider swap & live streaming: You can swap a conversation's provider while keeping it in one HUD tab, and chat replies stream token by token into the HUD panel. The new-chat (+) button opens a fresh chat for the selected provider.
Core Tool Reference
Subway exposes MCP tools divided across functional roles:
1. Navigation & Transit
subway(tool, args): Stable dispatcher to call any Subway tool by name (including newly reloaded tools), or pass tool="list" to inspect registered tools.
list_chats(source, project, query, limit, include_subagents): List active stations across Antigravity, Claude Code, OpenCode, and GitHub Copilot (CLI and VS Code), highlighting open tabs, worker sessions, token usage, and sticky @aliases.
search_chat(quote, query, source, project, limit, include_subagents): Search all transcripts for an exact phrase or snippet; returns station ID and stop index.
tag_chat(alias, chat_id): Assign a sticky station alias (tag_chat(alias='claude-main')). Omit chat_id to tag current chat.
read_chat(chat_id, mode, turns, start, since, anchor_text, max_chars, include_tools, include_thoughts, source, project): Board and read another agent's transcript.
since="last": Reads only new turns since previous transit.
mode="decisions": Cuts 85-90% token noise by extracting user intent, thought rationale, decisions, and files touched.
anchor_text="phrase": Boards at the exact quote.
segment="latest" or a segment number: Read history split at provider-reported compaction boundaries. Copilot transcripts without such a marker stay in one segment.
send_note(to, text, from_chat, share_chat): Send transit dispatch to another agent window's inbox.
check_notes(my_chat_id, keep): Read and clear incoming dispatches for this window.
whoami(): Reports current station ID, provider, and active tab identity.
2. Live Workspace Guard
claim_file(filepath, holder, duration_seconds, purpose, baseline_commit, role, project_dir): Acquire a temporary lease on a file.
signoff_file(filepath, verdict, notes, reviewer, project_dir): Formally review and sign off on completed edits to prevent regression. The agent that modified the file cannot sign off on its own work.
release_file(filepath, holder, project_dir, force): Relinquish a file lease.
list_locks(): Surface active file leases, expiry countdowns, and sign-offs across all agents.
3. Worker Delegation & Supervision
spin_worker(role, prompt, provider, model, track, project_dir, timeout_seconds, effort, mode, permission_mode, capabilities, budget_session_pct, budget_weekly_pct, max_budget_usd, thread, then, review): Queue an autonomous background worker. Workers always require user approval before starting.
approve_worker(worker_id, approval_code): Launch a pending worker using the user-provided approval code.
reject_worker(worker_id, reason): Reject a pending worker or cancel a running worker.
stop_worker(worker_id, reason): Terminate a running worker's process.
worker_status(worker_id, track): Inspect status, exit code, and log tail of workers.
collect_reports(track, wait): Collect completion summaries and log tails from workers on a track.
estimate_complexity(prompt, role): Advisory evaluation recommending model tier, effort, and provider.
escalate_worker(worker_id, new_effort, new_mode, reason, successor_provider): Replace a struggling worker with a higher-tier successor (queued for user approval). Automatic reroutes never move a stalled worker to a provider that costs more than the one it started on; if nothing the same price or cheaper is available, it stops and says why.
instruct_worker(worker_id, text, now): Steer a running worker. Recall immediately (now=True) or stack guidance into its backlog (now=False).
on_worker_done(worker_id, then): Attach follow-up steps to a worker that is running or queued, or fire them now if it has finished.
Worker triggers
A worker can start the next one when it finishes. The steps live in the worker's own record, so a chain keeps going even when no orchestrator is watching. then is a JSON list of steps: role, prompt, provider, model, when (completed, failed, always, approved, rejected), include (patch, report, both, none), other_provider, max_tokens, verdict, capabilities, effort, and then for the next link.
Ask a different provider to review the patch automatically:
spin_worker(role="Builder", prompt="Fix the parser", review="auto")
Chain build -> review -> docs, where docs runs only if the review approves: