@obafemi_adebayorr/subway
v1.3.9
Published
On-demand multi-window context transit and workspace guard for AI coding agents (Claude Code, OpenCode, Antigravity)
Maintainers
Readme
Subway
On-demand, token-efficient context transit system connecting independent AI coding agents across multiple windows (Antigravity, Claude Code, OpenCode terminal).
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, 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 |
| 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 |
| Kimi | ~/.kimi-code/ sign-in | Usage gauges (5-hour, weekly, monthly), experimental; no worker dispatch |
| GitHub Copilot | gh sign-in | Usage gauges (chat, completions, premium requests); no worker dispatch |
Installation & Setup
1. Clone Repository
git clone https://github.com/obafemiadebayorr/Subway.git
cd Subway2. Universal 1-Click Auto-Connect
Install from npm:
npx -y @obafemi_adebayorr/subway installOn 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 --statusSelective 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 opencodeClaude Code CLI
claude mcp add --scope user subway -- /usr/bin/python3 /path/to/Subway/server.pyAntigravity 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
@geminisimply resolved toORDER 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_notedelivers straight into an online agent's chat (mode="fast") or queues it (mode="normal").reply_notethreads answers,fastmail_statustracks each message (queued, delivered, read, replied), andask_roomasks every chat in a project at once. Waking an offline chat needs your approval in the HUD. Settings live undermail.*; 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/chatdeliver 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 passtool="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')). Omitchat_idto 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:
spin_worker(
role="Builder",
prompt="Build the feature",
then=json.dumps([{
"role": "Reviewer",
"prompt": "Review the patch.",
"when": "completed",
"verdict": True,
"other_provider": True,
"then": [{"role": "Docs", "prompt": "Update the README.", "when": "approved", "include": "both"}],
}]),
)4. Permissions & Oversight
permission_requests(worker_id): List worker permission requests waiting on user decision.answer_permission(request_id, decision): Submit user decision (allow,allow_always, ordeny). Agents must ask the user first.watch_workers(wait_seconds): Wait up towait_secondsfor a worker to finish or request a permission.
5. Quota & Limits
quota_status(source): Inspect session and weekly limits, token counts, and freshness.set_quota(category, weekly_left_pct, session_5h_left_pct): Record manual quota limits when live readings are unavailable.
6. Shared Tracks & Dashboard
join_track(track, station_id): Subscribe to a shared decision track.broadcast_track(message, track, files, decisions, station_id, session_id): Append an event or decision to the shared ledger.read_track(track, limit, since_timestamp): Read synchronized cross-agent decisions.hud_status(project): Departure-board status snapshot across lines, locks, workers, and tracks.start_hud(port): Start the Live HUD server on loopback (127.0.0.1).
Live Workspace Guard (Collision Shield)
When multiple autonomous agents (e.g. Claude Code in tab 1, OpenCode in terminal dock, and Antigravity in sidecar) run concurrently in the same repository, they risk file collision—clobbering and overwriting each other's edits.
Subway provides a central Workspace Guard (~/.subway/locks.json):
claim_file(filepath, ...): Acquires a time-limited lease (default: 300s).[COLLISION WARNING] 'src/components/Header.tsx' is already leased to claude-main for 'Layout refactor'. Lease expires in 240s. Do NOT overwrite or clobber until released or expired.- Lease Enforcement:
- File leases are advisory across agents to avoid breaking workflows.
- Exception: In Claude Code, edits are strictly enforced by the
PreToolUsehook (server.py hook-guardregistered in~/.claude/settings.json). If Claude attempts to edit a file currently leased to another agent, the hook intercepts and denies the tool call. The hook is designed to fail open if Subway is ever unreachable.
signoff_file(filepath, ...): Formally reviews completed changes and anchors them against git commits to prevent regressions. Approval must come from an agent different from the implementer.release_file(filepath): Explicitly relinquishes the file lease once modifications and git commits are done.
Live Station Board HUD (1.3.8)
Subway 1.3.8 includes a real-time, interactive Station Departure Board HUD available both in the terminal and as a web dashboard.
Architecture & Security
hud_nextDefault &/classic:hud_nextis now the default web interface served athttp://127.0.0.1:7890. The legacy cyber-transit dashboard (hud/index.html,app.js,views.js,usage.js,lib.js,styles.css) remains accessible athttp://127.0.0.1:7890/classic.- Principal small edits: Settings → Principal → "Small edits allowed" (
principal_small_edit_lines, default 0) lets the principal chat make edits of up to that many changed lines itself; 0 keeps every principal edit blocked so work goes to workers. - Multi-Provider HUD Support: Unified tracking, station browsing, and control across Claude, Pi, OpenCode, Antigravity, Copilot, Cursor, and Devin.
- Separate Chat & Mail Channels: The HUD provides both direct chat delivery (
/api/chat, with background continue for OpenCode and Claude chats) and the asynchronous Fast Mail channel (send_note/reply_note). - Loopback Only (
127.0.0.1): The HUD server binds strictly to127.0.0.1(orSUBWAY_HUD_PORT, default 7890). There is deliberately no option to bind to0.0.0.0or external network interfaces. - Per-User Authentication Token: Protected by a random HMAC token stored in
~/.subway/hud_token. The token is injected into served HTML and validated via theX-Subway-Tokenheader on all API calls. Requests missing or mismatched tokens are rejected with403 Forbidden. - Live Updates: HUD updates are pushed the moment a worker or permission changes (
GET /api/events), about 1 ms locally. Chats still depend on the model taking its turn. - HUD Features: Displays budget rows with real usage, a reset card that cycles through providers, a spend chart coloured per provider, and worker history pages with Load more.
- Low-power mode: Settings → Appearance → Display (Auto/On/Off) uses a static map and background with no idle animation; Auto enables it for low-resource machines and the map pauses when the tab is hidden or idle.
- No Automatic Launch: To conserve resources, the HUD no longer starts automatically when MCP connects. You start it whenever you want via:
- The
start_hudMCP tool - CLI:
subway hud(orpython3 server.py hud [--open] [port]) - Setting
SUBWAY_HUD_AUTOSTART=1in your environment
- The
Opening the HUD in an IDE Browser
You can open the HUD (hud_next by default, or /classic for the classic view) in your system browser or inside an IDE built-in browser panel (such as VS Code's Simple Browser or Antigravity's webview):
http://127.0.0.1:7890
http://127.0.0.1:7890/classicCustom Allowed Origins (SUBWAY_HUD_ORIGINS)
By default, the HUD server permits requests originating from http://127.0.0.1:<port> and http://localhost:<port>. If your IDE browser or webview uses a specific custom origin header, configure it by setting SUBWAY_HUD_ORIGINS:
export SUBWAY_HUD_ORIGINS="vscode-webview://*,http://127.0.0.1:3000"Terminals
Subway can capture commands from terminals you explicitly share with it, so agents and the HUD can see what failed and hand it to a worker — nothing is captured from anywhere you haven't opted in. There are two ways to opt in, and both need the 1.3.4 build of the VS Code extension (rebuild and reinstall it from the vscode folder):
- VS Code / Antigravity / Cursor / Windsurf extension: install the Subway VS Code extension, then enable the
subway.terminalSharing.enabledsetting and run Subway: Share Terminal on the terminal you want captured (no shell integration → nothing is captured, shown in the HUD as "no shell integration"). Subway: Allow Terminal Commands additionally letsrun_terminalexecute commands there. Subway: Stop Sharing Terminal opts back out. - Standalone zsh/bash shells:
subway terminal hook install [zsh|bash]adds a marked block to your.zshrc/.bashrc(backing up the original first) that reports each finished command's text, exit code and working directory in the background — never its output.subway terminal hook statusandsubway terminal hook uninstall [zsh|bash]check or cleanly remove it. - Captured commands are redacted (tokens, keys, passwords,
Authorizationheaders) before they reach the store, and are visible viaread_terminal,search_terminal, and the HUD's Terminals page, where a failed command can be handed straight to a worker. - Terminal Switches:
terminal_sharing(true/false) controls master capture state.terminal_mode(ask,auto_safe,auto_approve, defaultask) controls whether terminal commands require interactive user approval.
Quota & Rate Limit Tracking
Subway tracks live rate limits, token usage, and session windows across detected AI clients:
- Data Sources:
- Antigravity: Read live from the local Antigravity language server metrics.
- Claude Code: Read from Claude Code
/usageand token tracking. - OpenCode: Read from the local OpenCode SQLite database (
~/.local/share/opencode/opencode.db).
- Unknown & Stale Indicators: If an agent hasn't reported data or its server is temporarily unreachable, Subway retains the last-known reading and explicitly reports unknown values rather than guessing.
- OpenCode Limits: OpenCode uses a background service, so no terminal needs to stay open. It publishes no remaining free allowance, so limits show only when a limit error occurs; Subway displays its active model and token counts without synthetic limit caps.
- GitHub Copilot: Read through your
ghsign-in (gh api /copilot_internal/user). Workers run through the Copilot CLI and spend the chat allowance (one request per run, credits shown in AIC). Completions are inline editor suggestions, shown but never spent. - Kimi: Read from Kimi Code's own sign-in in
~/.kimi-code/credentials/. Experimental: the usage endpoint is undocumented and may change when Kimi updates. Accounts without a Kimi Code plan show "no plan limits". Subway never refreshes or prints the token, and doesn't dispatch workers to Kimi. - Manual Overrides (
set_quota): Users can record manual limits if an agent cannot report them automatically. Live readings always supersede manual overrides.
Budgets & Capacity
- Budgets:
subway budgetshows them;subway budget <chat|provider> <tokens>sets them; typing that command as your own chat message in Claude Code works, including 3.5M and even when blocked. The HUD sets them too. Agents can't: the guard is best effort for shell commands. - Per-chat vs universal chat budgets: typing
subway budget chat <tokens>as a message inside a chat sets that chat's own budget (andchat 0clears it) — it never touches other chats. Running the same command from a plain terminal (no chat context) sets the universal default that applies only to chats with no budget of their own; add--chat <id>to set one specific chat from the terminal. A chat is never blocked by a budget set in a different chat. - Enforcement: Warnings at 80%, block at 100%. Claude Code blocks the prompt and tools through hooks. Antigravity and OpenCode have no such hook, so there the block lands on the next Subway tool call.
- Worker Token Caps: Workers are told to wrap up at two thirds, and no call is started that would pass the cap. A call already running can still overrun. Counts thinking and Claude cache creation. Set Claude caps above about 100K: one call can cost 35K. Custom providers report no tokens, so they use max_seconds.
- Context Compaction:
subway compactionshows the mode;subway compaction <suggest|auto|never> [tokens]sets it, e.g.subway compaction auto 300k. The compaction point defaults to 300,000 tokens and accepts 100K to 1M; the HUD's "Compact at (tokens)" field sets it too. In Auto, Claude Code compacts itself near that point (Subway sets Claude Code'sautoCompactWindow, leaving a value the user set alone), OpenCode workers are compacted, and Antigravity is warned only. - Capacity: 4 running workers per chat. Per machine: 2 up to 8 GB, 6 up to 16 GB, 10 above, or set
max_workersinconfig.json. A worker over the limit stays queued. - Worker safeguards:
worker_rules: falseomits the standard rules from edit-worker prompts. Antigravity and OpenCode deny identifiable whole-file reads over 1,500 lines inside the worker folder; setlarge_file_read_linesto change the limit orlarge_file_reads: "allow"to disable the guard. - Configuration Switches (
~/.subway/config.json):worker_limits:falsedisables machine concurrency limits (workers remain queued only if system memory is critically low).local_memory_guard:false(or envSUBWAY_LOCAL_MEMORY_GUARD="0") disables local model RAM safety checks.copilot_inline_floor_pct: Optional allowance floor percentage (default0, off unless set) below which inline completions are denied.copilot_inline_monthly_cap: Monthly allowance cap for inline Copilot calls (default100).copilot_inline_per_worker_cap: Per-worker cap for inline Copilot calls (default5).reload_gate:truelocks dynamic live reload unlessforce=Trueis explicitly passed.mcp_relay:truemakes each chat's MCP process a lightweight relay to the running HUD instead of a full server (off by default). Set withsubway settings set mcp_relay true.
Autonomous Worker Swarms & Approval Workflow
Subway allows agents to queue background tasks across different engines (claude, opencode, or antigravity).
Mandatory User Approval
Workers always require user approval before any execution begins:
- When an agent calls
spin_worker(...), the worker is placed inpending_approvalstate. - The user can approve the worker in three ways:
- In the Live HUD: Clicking "Approve" (authenticated via HUD token).
- Via CLI: Running
subway approve <worker_id>in their terminal. - Via Approval Code: Giving the 6-character approval code shown in the HUD or CLI to their agent to call
approve_worker(worker_id="...", approval_code="...").
- No Agent Self-Approval: Agents cannot self-approve workers through MCP—they do not have access to the approval code unless the user explicitly pastes it. However, any process with shell access running as your user can still execute the CLI command
subway approve <id>.
Provider Dispatch & Antigravity CLI Note
- Claude Workers: Run via the
claudeCLI with--effort,--model, and custom tool permissions. - OpenCode and Local Workers: Run through ACP, so they ask permission and can be denied. auto_safe lets them read and edit inside their own folder.
- Custom Providers: Add a CLI to
providers.jsonwithid,name,bin,argsusing{prompt},model_argsusing{model}, andskills. Custom providers report no tokens, so they use max_seconds. - Antigravity Workers: Run through the
agyCLI binary (agy --print ...). Note thatagyruns detached batch CLI sessions and cannot continue an active Antigravity IDE conversation. - God Mode (
mode="god"): No worker count, only free memory limits it. auto spreads work across providers with Claude only as a last resort. It may still pick a model with no quota left. - Sign-in Failures: Models that fail sign-in are skipped for 24 hours.
Permission Modes
Workers use permission modes to govern actions:
- ask (Default): Always ask before running actions.
- auto_safe: Automatically approves safe read-only and diagnostic commands; lets OpenCode and local workers read and edit inside their own folder. Copilot workers run in Copilot's OS sandbox, may edit files only inside their folder, and may run
python3so they can run their own tests. - auto_approve: Auto-approves actions only if the user explicitly chooses it. Agents cannot enable this mode on their own.
Platform Support
- macOS and Linux are supported. Worktrees are removed after each worker.
- Windows is written but untested.
Worker Pings & Priority
- Worker Pings: Finished, failed or stopped workers report to the launching chat. Every client gets a line on its next tool result; Claude Code also gets it on your next message.
- Worker Priority: Urgent, normal, low. Waits return as soon as an urgent worker needs attention.
Permission Relay & Commands
When a worker needs permission:
- Relay Reach: Requests reach the launching chat automatically on its next Subway tool call (appended to the tool output), or through the
watch_workerstool. - Terminal Oversight Commands:
subway permissions: List all pending permission requests.subway allow <request_id>: Allow the action once.subway always <request_id>: Allow this and future identical requests.subway deny <request_id>: Deny the requested action.subway watch [seconds]: Wait and stream worker permission requests or status changes.
- Supported Engines: The permission relay currently supports Antigravity and Claude workers (not yet OpenCode).
Shared Decision Tracks
Rather than copying whole conversation histories, Subway maintains lightweight Shared Decision Tracks (~/.subway/tracks/<track>.jsonl).
join_track(track="main"): Subscribes an agent to a shared context track and fetches current state.broadcast_track(message, track="main", files=[...], decisions=[...]): Publishes milestones, architectural decisions, or touched files to all collaborating agents.read_track(track="main", limit=15): Reads high-density decisions and touched files across the entire fleet.
Subagent Tracking & Deep Inspection
When agents spin up parallel subagents (e.g. Claude Code background Agent workers, Antigravity subagents, or OpenCode child tasks):
- Automatic Hierarchy Discovery: Reading a coordinator chat with
read_chat(mode="decisions")discovers spun subagents and provides one-click transit links:### Spun Child Subagents (Worker Sessions): - `1043988d`: Agent 1 (Vision-Math-Agent) -> `read_chat(chat_id="1043988d", mode="decisions")` - `a8360f72`: Agent 2 (Relations-Containment-Agent) -> `read_chat(chat_id="a8360f72", mode="decisions")` - Direct Worker Boarding: Board any subagent directly by its ID to read task briefs, internal thought traces, and file diffs.
- Universal Cross-Subagent Search:
search_chat(quote="...")searches across both parent sessions and worker subagents simultaneously. - Listing Worker Lines: Pass
include_subagents=Truetolist_chats()to surface all active worker subagents tagged with↳ child of <parent_id>.
CLI Command Reference
The subway command (or python3 server.py) provides direct terminal access:
subway # Run as MCP server over stdio
subway hud [port] [--open] # Start Live HUD on 127.0.0.1
subway workers # List workers with approval codes
subway approve <worker_id> # Launch a pending worker
subway reject <worker_id> [reason] # Reject or stop a worker
subway stop <worker_id> # Terminate running worker process
subway permissions # List worker permission requests
subway mode [ask|auto_safe|auto_approve] # Show or set permission mode
subway allow|always|deny <request_id> # Answer worker permission request
subway watch [seconds] # Wait for requests or completions
subway tail <worker_id> # Inspect worker status and log
subway locks # View active workspace leases
subway track [name] # View shared context track
subway quota [source] # View quota and token metrics
subway terminal hook install|uninstall|status [zsh|bash] # Manage the shell capture hook
subway install | status | uninstall # Manage agent registrations
subway <tool> '<json args>' # Call any MCP tool directlyNative OpenCode @ Autocomplete Integration
In OpenCode, typing @ in the prompt searches workspace files and registered agent definitions. Subway automatically syncs all 4 alias tiers directly into OpenCode's agent registry (~/.config/opencode/agents/*.md):
- Hyphen-Prefixed Filtering: Typing
@claude-filters out repository files and displays agent transit targets (@claude-main,@claude-latest,@claude-my-project, etc.). - Antigravity Stations: Typing
@agy-displays active Antigravity stations (@agy-live,@agy-latest,@agy-my-project,@agy-subway, etc.). - Safe Dynamic Rotation: Auto-generated topic stubs carry a safety tag (
<!-- subway-auto-stub -->). Subway automatically prunes outdated topic stubs as conversations age out.
Claude Code: IDE Extension vs CLI
Subway supports both the Claude Code CLI (terminal) and the official Claude Code IDE extension (VS Code / Antigravity editor tab).
┌─────────────────────────────────┬─────────────────────────────────┐
│ [Center Tab] Claude Code IDE │ [Right Pane] Antigravity IDE │
│ "Codebase comprehensive review" │ "my-project / Access To Prev" │
│ (Opus 3.5 Extra High) │ (Gemini 2.5 Flash Medium) │
├─────────────────────────────────┴─────────────────────────────────┤
│ [Bottom Panel] OpenCode Terminal │
│ "taste-engine:breakdown" (Flint 40B Free) │
└───────────────────────────────────────────────────────────────────┘Both Claude environments share the exact same underlying architecture:
- Unified Configuration: Both read
~/.claude.json. Subway is registered undermcpServers["subway"], enabling all tools across both CLI and IDE chat tabs. - Unified Session Tracking: Active IDE editor tabs are recorded in
~/.claude/sessions/<pid>.jsonwith"entrypoint": "claude-vscode". Subway automatically detects live tab names and maps them for transit. - PreToolUse Hook Guard: Both CLI and IDE trigger the
hook-guardcommand on file edits, enforcing active leases against conflicting modifications.
Local Models
Subway detects Ollama and treats local models as a provider, with memory as the limit instead of a quota.
- Memory gate: before a local model loads, Subway compares what it needs with the memory free right now, keeping a reserve for the rest of your machine. It uses the size it measured when the model last ran, or an estimate marked as one. If the model won't fit, the worker waits up to 15 minutes, then fails with a clear reason.
- Machine profiles: limits follow your RAM. An 8 GB laptop gets a 4K context, one request at a time, and models unloaded straight after use.
- Big jobs:
spin_batchsplits files into chunks that fit, runs them one at a time, and writes each result as it finishes. Run it again with the same output file to resume. It writes JSONL, one result per chunk.spin_batch merge_promptcombines chunk results into<output>.merged.md. - Routing by task:
provider='auto'uses three signals. The task sets hard rules (private stays local, bulk work goes cheapest) and the strength needed. The role decides which skill counts (coding, reasoning, writing). Remaining allowance then chooses among good-enough models: hard work takes the strongest, everyday work the cheapest good enough. Rankings live inmodels.jsonand can be edited in the HUD. They're the owner's rankings, not published benchmark scores.private=trueforces local. The reason is shown before you approve.
Local workers run through ACP, so they ask permission and can be denied; auto_safe lets them read and edit inside their own folder. spin_batch isn't affected, since it uses no tools. Custom-trained models are only used when you name them.
Architecture & Security
- Runs Locally: Subway itself runs on your machine, over stdio and loopback (
127.0.0.1), with no Subway account or server. The agents it connects still use their own services,/usageasks Claude Code to contact Anthropic, and the HUD loads its fonts from Google Fonts. - Read-Only on Chat Stores: Never modifies conversation histories of host tools.
- Fail-Open Hook Design: Hook guard failures fail open to prevent blocking developer edits.
- Sandboxed Metadata: State, aliases, checkpoints, and mailboxes live strictly in
~/.subway/.
Recommended Companion Tools
Optional: Subway doesn't install, bundle or configure any of them. Users add them to their own MCP config if they want them.
- fetch (
mcp-server-fetch): for simple pages. - Lightpanda (
lightpanda.io): a fast open-source headless browser for JavaScript-heavy pages, with its own MCP server. Install on macOS:brew install lightpanda-io/browser/lightpanda. No native Windows build (use WSL). It can't take screenshots or render PDFs. - Apify (
@apify/actors-mcp-server): cloud scrapers called Actors, useful for sites that block simple requests and for public social media research (YouTube, Reddit, X, TikTok, Instagram, LinkedIn). Needs Node 22+ and anAPIFY_TOKEN.- Cost warning: the free plan gives $5 of usage a month and blocks use when it runs out, which is the only hard ceiling. There is no setting that caps spending; on a paid plan, cap each run with
maxTotalChargeUsdormaxItemswhen calling an Actor. Stay on the free plan unless you watch spend. - Legal note: scraping public data can still break a platform's terms, and in the EU public posts are still personal data under GDPR. Prefer aggregate, public signals (counts, trends, sentiment) and don't store who said what.
- Cost warning: the free plan gives $5 of usage a month and blocks use when it runs out, which is the only hard ceiling. There is no setting that caps spending; on a paid plan, cap each run with
- Suggested order: fetch for simple pages, Lightpanda for JavaScript-heavy pages, Apify for blocked sites and social media.
{
"mcpServers": {
"fetch": {
"command": "uvx",
"args": ["mcp-server-fetch"]
},
"lightpanda": {
"command": "lightpanda",
"args": ["mcp"]
},
"apify": {
"command": "npx",
"args": ["-y", "@apify/actors-mcp-server"],
"env": {
"APIFY_TOKEN": "<your token>"
}
}
}
}License
MIT
