cli-bridge
A Model Context Protocol server that lets the AI assistant you're talking to consult the other AI CLIs installed on your machine — Claude Code, Codex, Gemini, Mistral, opencode, Ollama, Apple fm, … Each lane spawns the official CLI as a subprocess: no API keys, no token extraction, read-only by default.
Dependencies: the Python stdlib and mcp (1.x or 2.x). No daemon.
What it does
ask_gemini(task="find the bug across ./src", cwd="path/to/repo") # one lane (1M-token context)
ask_apple(task="what's wrong in this UI?", images=["shot.png"]) # vision, on-device, $0
ask_all(task="…") # every free lane in parallel + disagreement score
ask_cascade(task="…") # cheapest→strongest, skips cooled-down lanes
ask_best(task="…", mode="deep") # router picks; rate_lane teaches it
ask_build(lane="opencode", task="add retry with backoff") # build in a throwaway worktree → diff
review_diff(base="origin/main", focus="security") # multi-model review, severity-ranked
debate(task="which migration strategy?", vote="borda") # N blind answers, peer-ranked
workflow(preset="converge", task="is this migration safe?") # author → blind arbiter → cross-family peers
git_text(kind="commit") # Conventional Commit from the staged diffEvery ask<lane returns a thread id; reuse it (even on another lane) for a multi-model conversation that survives /compact. conversations lists or replays threads.
Tools
15 fixed tools + one ask<lane per installed CLI:
- Consult: ask<lane, askall, askcascade, askbest, conversations, listmodels
- Build: askbuild (mode=isolated → diff, mode=direct → zone-guarded writes; with mode=direct, async=true → steerable via job)
- Review: reviewdiff (focus=code|security), debate (vote=judge|borda), workflow (presets: refineplan, mapreview, researchverify, fanoutcompare, converge, premortem, testplan, challenge), gittext (kind=commit|pr)
- Operate: job (action=status|result|cancel|list|tail|steer), ratelane, setlanecost, doctor, setup
CLIBRIDGETOOLS=all adds batchrun (journaled fan-out) and resetlanestate; CLIBRIDGETOOLS=default,batchrun extends the default; a plain comma list is exactly those. Usage and lane health are MCP resources (cli-bridge://usage-summary, cli-bridge://lane-stats). Full reference: docs/TOOLS.md.
There is also a human CLI, cli-bridge doctor|ask|ask-all|ask-best|build|review-diff|security-review|test-plan|premortem|stats|usage|jobs|set-cost (--json where it makes sense). cli-bridge build <lane "<task" prints the worktree diff; --apply lands it as unstaged changes.
Writing code safely
- isolated (default): the delegate edits a throwaway git worktree and you get a diff. Your tree is untouched.
- direct: writes real files, but only inside the zone you declare, behind a per-zone lock with a post-turn zone-violation check; undo is zone-scoped. async=true makes it steerable (job action=tail|steer) with an executable Definition-of-Done (dodcmd).
CLIBRIDGEVERIFYPLANREADONLY=1 flags (never reverts) a read-only delegate that wrote files anyway. Re-entry is depth-capped (CLIBRIDGEMAXDEPTH, default 1). Delegates run in the caller's cwd, else CLIBRIDGEDEFAULTCWD, else the host's MCP workspace root.
Install
Prerequisites: Python 3.12+, uv, and at least one AI CLI installed and logged in.
uvx --from cli-bridge-mcp cli-bridge doctor # what cli-bridge can see (--deep probes each lane)Wire it into your host: