
Baton
tech.kasabeh由 kasabeh.tech 发布v0.3.0更新于 Oct 27, 2026
Pass the baton between coding agents: convert sessions across Claude Code, OpenCode, Codex & more.
概览
Baton 在 Claude Code、OpenCode、Codex 等编码代理之间转换会话,让助手列出、转换并导入对话记录。
- 可以做什么
- 列出所有受支持编码代理的会话及其文件路径
- 把会话从一种代理格式转换为另一种格式
- 转换并执行目标代理的导入命令
- 识别某个会话文件或目录由哪个代理生成
- 适用场景
- 适合在遇到用量上限或想中途更换代理时使用,保留完整对话记录而不必重新解释计划。也适合对疑难问题征求第二种意见,或把会话统一归档为一种格式。
- 运行要求
- 以本地 stdio 进程运行,通常通过 npx 调用 npm 包并下载预编译二进制;也可用 npm、Homebrew、Cargo 或 shell 安装脚本安装。仅限桌面环境,未声明认证、环境变量或请求头。会话文件从本地代理目录读取,例如 Claude Code 与 Codex CLI 的文件夹。
安装
在 SourceWeft 中
- 打开 控制台中的 Baton,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Pass the baton between coding agents.
Convert any coding-agent session to any other. One command. Keep going where you left off.
[crates.io] [npm] [CI] [agents] [license]
[baton converting a Claude Code session to opencode]A passed transcript kept 14/17 concrete facts. A hand-written handoff summary kept 3/17. Benchmark ↓
The 4 p.m. problem
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.
Quick start
Where do session files live?
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:
baton list prints the path of every session it can find, across all agents.
Supported formats
¹ 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.
Benchmark
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):
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.
MCP server
baton is also an MCP server — your agent can pass the baton itself, mid-conversation:
How it works
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.
Install
Or grab a binary from GitHub Releases.
Building
Contributing
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.
Regenerating the demo
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.
License
Dual-licensed under MIT OR Apache-2.0.
来源:README.md,提交 4526159
工具
0版本历史
1- v0.3.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
