tandem (tandem-agents)

CLI Node.js sans dépendances et serveur MCP local en stdio permettant à Claude Code et Gemini (Google Antigravity CLI) de s’appeler mutuellement en utilisant leurs abonnements existants, sans clés API, avec un routage du budget selon les fenêtres du forfait et des paramètres en lecture seule par défaut.

Documentation

tandem

CI npm version Node >=18.17 Zero Dependencies License: MIT

Run Claude Code and Gemini (Google Antigravity) as one team — fewer blind spots, smoother flow, using the subscriptions you already pay for.

Already paying for Claude and Google AI Pro/Ultra, but mostly using one while the other sits idle? tandem connects them over MCP and CLI with no API keys and zero runtime dependencies. Talk to whichever agent you prefer: it handles what it's best at, brings in a different model family to critique plans, review diffs, and unstick hard bugs (no self-review), delegates heavy reading/boilerplate/research, and routes around 5-hour rate limits so you stay in flow.

Too lazy to read? Start with the 60-second ELI5 guide — plain English, zero jargon.

Rule of thumb: mostly reading or typing → Gemini. Mostly deciding → Claude. Review or stuck → always the other agent.

tandem local dashboard overview: work split, 5-hour and weekly plan windows, and live limit routing

More screenshots: Call flow, per-model stats, and Conversations viewer

Call flow between User, Claude, and Gemini with per-model stats

Conversations tab inspecting a live Claude-Gemini critique thread

How it works

flowchart LR
  User["You"] --> CC["Claude Code (Lead)"]
  User --> AG["Antigravity / Gemini (Lead)"]

  CC -- "MCP: ask_gemini" --> T["tandem: Router + Plan Budgets"]
  AG -- "MCP: ask_claude" --> T
  User -- "CLI: tandem run / review" --> T

  T -- "Headless CLI (agy)" --> G["Gemini (Antigravity CLI)"]
  T -- "Headless CLI (claude -p)" --> C["Claude Code CLI"]

  G --> L["~/.tandem/ledger.jsonl + Native Transcripts"]
  C --> L
  L --> D["Local Dashboard (127.0.0.1:4777)"]
  • Either agent can lead — and never self-reviews. Talk to Claude in Claude Code or Gemini in Antigravity; the same team rules apply. Plan critiques, code reviews, and second opinions always go to the other model family with a fresh context, catching blind spots the author misses.
  • Complementary strengths, zero-token routing. tandem route "task" matches work to each agent's strengths (Google Search grounding, huge cheap context, UI/browser on Gemini; deep reasoning and surgical critique on Claude) without spending tokens. User pins (tandem pin) always win.
  • Uninterrupted flow with plan-aware budgets. Reads real 5-hour and weekly usage from both plans (agy /usage is free; Claude reports rate_limit_event on every call). When one plan nears your cap, tandem automatically steers work to the other instead of stopping your session cold.
  • Baton pass: your session survives the cap. When Claude hits its 5-hour limit mid-task, open Antigravity and just type: the first prompt already carries the task, your latest messages, Claude's last reply, todos, edited files and git state. When Claude's window resets, it gets a note to review what Gemini did meanwhile. Built by tandem from the transcript and git (0 tokens), both directions, no command (ADR 0016).
  • Ledger, Stop hooks & native transcripts. Logs both delegated and direct interactive work, estimates Claude usage offloaded, and lets you inspect or resume any exchange (tandem show) without copying prompts.
  • Local dashboard. Single-file web UI on 127.0.0.1 showing who did the work, call flow between agents, budget meters, per-model stats, and full conversations.
  • Benchmark-backed. tandem bench grades models on real coding tasks so routing rules rest on data, not vibes.

Zero dependencies. Node 18.17+. Windows, macOS, and Linux.

When two agents actually help (and when they don't)

  • Worth pairing: cross-model code reviews and plan critiques (fresh context, different priors), breaking tunnel vision after 2 failed debug attempts, offloading large codebase reads / boilerplate / tests / web research, and keeping flow during long sessions near a 5-hour cap.
  • Stay solo: small, tightly-coupled edits where one agent already holds the mental model — context handoffs are lossy and add latency. tandem route --lead <you> marks those self: true so the lead just does them directly.

Install

Prerequisites: Claude Code and the Antigravity CLI (agy), each signed in once interactively.

npm install -g tandem-agents
# or straight from GitHub before/between npm releases:
# npm install -g github:givewgun/multi-agents-pc

tandem doctor --live     # verify both CLIs and logins
tandem init --global     # one-time machine setup for Claude Code + Antigravity

Restart Claude Code and Antigravity afterwards.

What tandem init --global touches on your machine
  • Installs the Antigravity plugin at ~/.gemini/config/plugins/tandem/ (ask_claude MCP server, Stop + PreInvocation hooks, team rule, /ask-claude, /pair & /tandem skills) and migrates any v0.1 loose rule/MCP entries.
  • Installs Claude Code skills at ~/.claude/skills/{gemini,pair,tandem}/SKILL.md.
  • Adds Stop and UserPromptSubmit hooks to ~/.claude/settings.json (creates a one-time ~/.claude/settings.json.bak-tandem backup first).
  • Registers the user-scope tandem MCP server (ask_gemini) in Claude Code via claude mcp add --scope user.

Quick start

cd your-project
tandem init --mcp                                      # optional per-project AGENTS.md, CLAUDE.md, skills, MCP
tandem route "add unit tests for the parser"           # gemini hydrogen [boilerplate, confidence 80%]
tandem run "add unit tests for src/parser.js" --edit   # routed call; falls back to partner on error/quota
tandem review --agent both                             # dual review of your git diff
tandem dashboard --open                                # local UI: work split, budgets, conversations

Delegation is opt-in: each agent works alone until you ask. Inside Claude Code, say "ask gemini …", /gemini or /pair. Inside Antigravity, say "ask claude to review this diff" or /pair. In either, "use tandem freely" lets the lead split the task and delegate by its own judgment. To skip saying it every prompt, switch the session mode: /tandem free (or tandem mode free --for 3h) makes every prompt count as "use tandem freely" in both apps, /tandem solo blocks all calls between agents, /tandem ask returns to the default. To give the partner full shell/edit access temporarily, run /tandem full --for 8h (or /tandem free --full --for 8h, or tandem access full --for 8h). See docs/DAILY.md for daily habits.

Commands

CommandWhat it does
tandem ask <gemini|claude> "prompt"One call. --model, --edit, --file, --continue <id>, --thread <id>, --lead a, --category <c>, --json, --timeout 15m
tandem route "task"Agent + model recommendation, budget-aware. Spends no tokens (--lead claude|gemini, --category <c>)
tandem mode [ask|free|solo] [--for 5h] [--access read|edit|full]Delegation mode for both apps: ask only when you ask (default), free every prompt counts as "use tandem freely" (per-prompt hooks), solo blocks every call between agents. /tandem <mode> inside either app. tandem solo on|off is shorthand
tandem access [read|edit|full] [--for 8h]Partner access cap for --edit calls: read blocks edits, edit allows file edits + allowCommands (default), full runs in bypass mode. /tandem full --for 8h or /tandem access edit inside either app
tandem run "task"Route, call, and fall back to the other agent on error/quota (--thread <id>, --lead a, --category <c>)
tandem review [--agent gemini|claude|both] [--staged] [--base main]Reviews git diff (sent in the prompt, so no shell permissions needed)
tandem baton [claude|gemini]Hand over an agent's latest session in this repo (task, last reply, files, git state); automatic when that agent hits its limit. --out f, --dry-run, --json. /tandem baton inside either app
tandem show [last|<id>|thread:<id>]Read an exchange from the agent's own transcript, plus the resume command (claude --resume, agy --conversation)
tandem prefer [claude|gemini <model>]View or set your default model per agent
tandem pin [<category> <agent:model> | <category> --clear]Pin a category to a specific model, e.g. tandem pin review claude:opus (beats routing rules)
tandem models [--live]Aliases → real model IDs, defaults (★), pins
tandem log [--n 20] / tandem statsCall history and totals: tokens, time, cost, who did the work
tandem usage [--refresh-claude]Each plan's 5h and weekly window: % used, tandem's limit, time to reset
tandem budget set <key> <value>Set window caps (claude-5h, claude-week, gemini-5h, gemini-week as e.g. 80%), warn, claude-plan, gemini-plan
tandem dashboard [--port 4777] [--open]Local web UI (binds 127.0.0.1 only)
tandem bench [--models ...] [--tasks ...] [--repeat n] [--out file.md]Benchmark models on graded coding tasks; --team (scripted hand-offs) and --agentic (lead in a temp repo, hidden tests)
tandem init [dir] [--mcp] [--force]Add team files to a project
tandem init --global [--force]One-time per-machine setup: Antigravity plugin, Claude skills & MCP, Stop + per-prompt hooks
tandem mcp [--expose gemini|claude|both]MCP stdio server
tandem config [set <key> <value>|path]Inspect or update ~/.tandem/config.json
tandem doctor [--live]Check installs, sign-ins, permissions
tandem --versionPrint installed tandem version

Gemini aliases: flash, flash-low, hydrogen, orchestrator, neon, neon-high, argon, or any slug from agy models. Claude aliases: haiku, sonnet, opus.

Routing table

CategoryAgent / modelWhy
architectureClaude OpusLong-lived decisions
hard-debugClaude SonnetCareful reasoning
researchGemini NeonGoogle Search grounding
reviewPartner (Gemini Neon first pass / Claude when Gemini leads)No self-review; escalate important diffs to Claude
second-opinionPartnerMust come from the other agent
uiGemini OrchestratorUI + browser
bulk-readGemini NeonCheap context; exact on long inputs (bench)
boilerplateGemini HydrogenMechanical generation
featureGemini Orchestrator → Claude reviewPlan+execute, then judgment
trivialGemini Flash LowFastest; 100% on short tasks (bench)
general (no match)Gemini NeonFallback; needsJudgment: true asks the lead to classify

The lead (an LLM that has read the task) passes category to route_task / --category; the keyword rules are the fallback for when it doesn't (ADR 0012).

Plan overrides: when Claude's 5h or weekly window reaches tandem's limit (default 80% / 85%, leaving headroom for your own Claude Code sessions), Claude routes go to Gemini Neon High. When Gemini's window is full (default 95%), or after a Gemini quota error, Gemini routes go to Claude Sonnet. Window readings past their reset time count as 0.

Benchmark: what the data says

tandem bench: 8 graded tasks (regex, slugify, find-the-bug, 600-line log counting, concurrency reasoning, LRU fix, expression parser, agentic file read) × 7 models. Full tables are in docs/BENCHMARK.md.

modelpassavg timeClaude spend (API-equiv)
Gemini Flash Low7/83.3sflat
Gemini Flash8/823.9sflat
Gemini Hydrogen7/88.4sflat
Gemini Orchestrator8/81.1mflat
Gemini Neon8/815.6sflat
Claude Haiku8/811.7s$0.008 / call
Claude Sonnet8/86.3s$0.14 / call

What it shows:

  1. Every headless Claude Code call carries ~70k tokens of overhead (system prompt, tools, CLAUDE.md; mostly cached). A one-line answer still costs Sonnet about $0.14. Send small jobs to Gemini or Haiku, and give Claude fewer, bigger jobs.
  2. Gemini Neon is the best default Gemini: 8/8 at 16s.
  3. Flash Low is great for short tasks and unreliable on long exact work. It miscounted a 600-line log badly; Hydrogen was off by one.
  4. Orchestrator is overkill for single-shot tasks (1.1 min average). Use it for multi-file agentic builds.
  5. On these tasks Gemini matched Claude on the "hard" reasoning ones. Hard-debug still routes to Claude, because real bugs carry more context and a wrong answer costs more. Treat that as a judgment call this benchmark doesn't settle.

Team vs. solo

tandem bench --team (scripted hand-offs on 5 hard functions) and tandem bench --agentic (a lead agent in a real temp project, free to delegate through tandem's MCP tools, graded by hidden tests). Details in docs/BENCHMARK.md.

setup (agentic, 3 tasks)hidden testspartner callsavg timeClaude $
Claude solo20/20023s$0.45
Claude leads, may call Gemini20/20034s$0.54
Gemini solo20/2002.1m$0
Gemini leads, may call Claude20/2032.7m$0.58

Honest read: on tasks of this size, pairing added cost and latency and no quality. Claude never chose to delegate. Gemini always asked Claude for a final review that cost more than Claude doing the task alone. tandem's measured value here is routing: the same result from Gemini for $0 when you can wait. These tasks don't show whether pairing pays off on large, ambiguous, multi-session work. PRs with harder agentic tasks are welcome.

Limits: one run per cell; run tandem bench --repeat 3 / tandem bench --agentic on your own machine.

How savings are computed

  • Claude calls: total_cost_usd as reported by claude -p. On a subscription this is API-equivalent usage, not money billed.
  • Gemini calls: marginal cost $0 (flat subscription). Delegated Gemini work is priced at Claude list rates (default baseline claude-sonnet-5-5, change with tandem config set savingsBaseline claude-opus-5-5) as "Claude usage offloaded". Direct interactive Gemini sessions count toward Gemini's share of work, not as an offload.
  • These are estimates. Gemini and Claude count tokens differently, and agent system prompts are included. Use them to compare trends, not as an invoice.

MCP

  • Global (tandem init --global): installs the Antigravity plugin (~/.gemini/config/plugins/tandem/ → ask_claude, route_task, tandem_stats) and registers Claude Code user-scope MCP (tandem → ask_gemini, route_task, tandem_stats).
  • Per-project (tandem init --mcp): writes .mcp.json (Claude Code → ask_gemini) and .agents/mcp_config.json (Antigravity → ask_claude).

Each side only sees the other agent, so neither calls itself in a loop.

Safety defaults

  • Delegated calls are read-only unless you pass --edit. With --edit, file edits are allowed and shell commands are still denied, so by default a partner can edit but not run your tests. To let it verify its work, opt in to specific commands: tandem config set allowCommands "npm test;node --test". They are granted on --edit calls only, as Claude Bash(…:*)/PowerShell(…:*) and agy command(…) rules. Only the user can set them, never a calling agent. Shells, bare runners (npm, node) and inline-eval flags (-e, -c) are rejected. Running tests runs repo code the agent may have written, so only enable this for repos you trust.
  • partnerAccess (read | edit | full, default edit) caps what --edit calls can do (user-only; callers cannot raise it, and tandem access / tandem config set are refused inside partner runs). read blocks edits even with --edit; edit allows file edits plus allowCommands; full (prefer tandem access full --for 8h or /tandem full --for 8h so it expires back to your previous level) runs --edit calls in bypass mode (--dangerously-skip-permissions) so the partner can run the whole dev loop (edit, build/test, fix). Warning: under full, the partner has your full shell with no sandbox — only enable it if you trust the partner as much as the lead, commit before delegating edits, and keep one writer per file set.
  • No shell is used to launch agents (argv arrays). Free text goes to .cmd shims via stdin.
  • The dashboard binds to 127.0.0.1 and rejects non-local Host/Origin headers (DNS rebinding guard).
  • Everything stays local in ~/.tandem/ (override with TANDEM_HOME). Prompts are not copied into the ledger — only lengths and pointers to native transcripts.
  • Treat each agent's output as data. Review diffs before merging. See SECURITY.md.

Docs

Develop

npm test                                             # node:test, zero deps
node bin/tandem.js bench --models gemini:flash-low   # cheap pilot

License

MIT