Pass the baton between coding agents: convert sessions across Claude Code, OpenCode, Codex & more.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Pass the baton between coding agents.
Convert any coding-agent session to any other. One command. Keep going where you left off.
A passed transcript kept 14/17 concrete facts. A hand-written handoff summary kept 3/17. Benchmark β
It's 4 p.m. Claude Code says "usage limit reached β resets at 10 p.m." You're three hours into a session: architecture decided, edge cases mapped, half the diff written.
β Without baton β open another agent and start from zero. Re-explain the plan. Re-read the files. Re-litigate every decision you already made.
β With baton β pass the session and keep going:
Works in every direction: switch agents mid-task, try a second opinion on a hard bug, move a session from your editor agent to a terminal agent, or archive everything in one format.
You never have to hunt these down (--latest and the interactive picker find them for you), but for reference β each agent stores its transcripts on disk:
| Agent | Location |
|---|---|
| Claude Code | ~/.claude/projects/<encoded-cwd>/<session-uuid>.jsonl |
| Codex CLI | ~/.codex/sessions/<YYYY>/<MM>/<DD>/rollout-*.jsonl |
baton list prints the path of every session it can find, across all agents.
| Agent | Read | Write | Auto-import |
|---|---|---|---|
| Claude Code | β | β | β |
| OpenCode | β | β | β
opencode import |
| Codex CLI | β | β | β |
| Gemini CLI | β | β | β |
| Zed | β | β | β |
| Aider | β | β | β |
| Cursor | β ΒΉ | βΒ² | β |
| Continue | β | β | β |
| Cline / Roo | β | βΒ² | β |
ΒΉ Cursor reads from exported JSON (sqlite3 state.vscdb "SELECT value FROM ItemTable WHERE key='aiService:chats'")
Β² Not planned: Cursor and Cline keep session state inside editor databases (SQLite / VS Code globalState) with no file-level import path.
Does carrying the full transcript beat writing a handoff summary for the next agent? We measured both on a real 3.4 MB Claude Code session (same model both arms, only the context differs):
| session size | baton transcript | handoff summary |
|---|---|---|
| sm (93 KB) | 3/3 details recalled | 1/3 |
| md (198 KB) | 6/6 | 1/6 |
| lg (599 KB) | 5/8 | 1/8 |
| total | 14/17 | 3/17 |
The summary lost concrete facts (versions, line counts, MSRV) even on the smallest slice β the receiving agent had to re-read files and re-run commands to rediscover them. Mechanical fidelity: all 896 messages are written to every target; round-trip loss reflects each target format's expressiveness (claude-code 896/896, codex 736, gemini-cli 723, aider 111 β it stores chat text only).
We also measured task continuation: cut the session at three mid-task points, ask a fresh agent to state the task, state, and next steps. Result: parity (baton 10/12, handoff 10/12) β a good summary is enough for what to do next; the transcript is what answers the specific factual questions the summary's author didn't anticipate. And the summary only exists if an agent spends a full transcript read writing it β baton makes the transfer free.
Full methodology, caveats, and reproduction steps: benchmark/RESULTS.md.
baton is also an MCP server β your agent can pass the baton itself, mid-conversation:
| Tool | Description |
|---|---|
list_sessions | Scan all agents, return a unified list |
convert_session | Convert a session from one format to another |
import_to_target | Convert + run the target agent's import command |
detect_format | Sniff a file/dir and report which agent produced it |
Every agent format is read into a canonical intermediate representation, then written out in the target format. Adding a new format is O(1), not O(NΓM) per-pair converters.
Or grab a binary from GitHub Releases.
Each format lives in src/formats/<name>.rs and implements the Format trait (read + write). See src/formats/claude_code.rs for a complete reference implementation.
All nine formats have readers; Claude Code, OpenCode, Codex, Zed, Aider, and Gemini CLI also have writers. The most impactful contribution now is a writer for Continue.
The README GIF is scripted with VHS: vhs assets/demo.tape. It records against a sandboxed $HOME (/tmp/demo) populated with fabricated sessions, so no real session data ends up in the GIF.
Don't drop the baton.
Dual-licensed under MIT OR Apache-2.0.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/baton-2)<a href="https://allmcps.com/mcp/baton-2"><img src="https://allmcps.com/api/badge/baton-2?style=directory" alt="Baton on AllMCPs" /></a>