Keep the conversations of your coding agents in one append-only history, back it up or sync it anywhere, and continue any of them in another agent. Runs on Linux, macOS, and Windows.
| Agent | --agent / --to / --in |
Read / Write |
|---|---|---|
| pi | pi |
Read / Write |
| Oh My Pi | omp |
Read / Write |
| Claude Code | claude |
Read / Write |
| Codex | codex |
Read / Write |
| OpenCode | opencode |
Read / Write |
| Kilo Code | kilo |
Read / Write |
| Hermes Agent | hermes |
Read / Write |
| MastraCode | mastracode |
Read / Write |
| Devin CLI | devin |
Read / Write |
| GitHub Copilot CLI | copilot |
Read / Write |
| Grok Build | grok |
Read / Write |
| OpenHands CLI | openhands |
Read / Write |
| Mistral Vibe | vibe |
Read / Write |
| Qwen Code | qwen |
Read / Write |
| Kimi Code | kimi |
Read / Write |
| Muse Code | muse |
Read / Write |
| Antigravity CLI | antigravity |
Read / Write |
| Cursor Agent | cursor |
Read / Write |
| DeepSeek Harness | dsh |
Read / Write |
| Antigravity desktop app | antigravity-desktop |
Read only |
| Antigravity IDE | antigravity-ide |
Read only |
| Cursor editor | cursor-ide |
Read only |
| Paseo | paseo |
Read / Write |
| RikkaHub | rikkahub |
Read / Write |
| ZCode | zcode |
Read / Write |
- Tagged versions are on Releases.
- Preview builds are in the artifacts of the newest Build workflow run.
- Nix:
nix profile add github:MZWNET/baton, or use the flake'soverlays.default(pkgs.baton). - From source:
cargo install --path crates/baton-cli.
baton import [--agent omp] [--path <path>] # read new and changed sessions
baton import --agent rikkahub --path <file> # read the conversations of a RikkaHub backup
baton list [--cwd [<dir>]] [--agent omp]
baton show <id>
baton export <id> --to claude [--cwd <dir>] # write a new Claude Code session and print its id
baton export <id> --to paseo --provider claude # write it for Claude Code, then register it in Paseo
baton export <id> --to rikkahub --backup <file> # add the session to a RikkaHub backup
baton resume <id> --in codex [--cwd <dir>] # export, then open it in Codex
baton materialize --in omp --in claude # write every session into each agent, in the matching local project
baton migrate # upgrade a data directory written by an older baton to the current format<id> is a baton session id, a unique prefix of it, or agent:native_id such as omp:01a1a978. For rikkahub:<id>, import the backup first.
- Imports are incremental and idempotent. When
--pathbelongs to one agent, pass--agentso only that agent reads it. - A session exported to another agent and continued there flows back into the same baton session on the next import, as a fork if the baton session moved on meanwhile.
baton materialize --in <agent>(repeatable) imports that agent, then writes every session it lacks on this machine so its resume list shows them; rerunning writes nothing new, except that if a newer baton writes that agent's sessions differently, it replaces any copy an older baton wrote there that was not continued in the agent.- The data directory only ever gains files and session ids derive from the native session, so machines sync by copying files between data directories (for example through a git repository); a session continued on two machines keeps both branches, the newest is active and
baton showlists the others. export,resume, andmaterializeplace a session in the checkout underBATON_PROJECTSwith the same git identity (the git remote,originpreferred, or the root commit when either side has no remote, where the directory inside the repository already exists), falling back toBATON_PATH_MAPand then the recorded directory;list --cwdalso matches sessions recorded under another machine's path of the same repository.
| Variable | Purpose |
|---|---|
BATON_HOME |
Data directory; defaults to ~/.local/share/baton (Linux), ~/Library/Application Support/baton (macOS), %APPDATA%\baton\data (Windows) |
BATON_HOST |
Identifies this machine in the synced data; defaults to the host name |
BATON_CACHE_DIR |
Import cursors and the session index (rebuilt when missing); defaults to the platform cache directory |
BATON_PROJECTS |
PATH-separated directories searched up to three levels deep for matching git checkouts |
BATON_PATH_MAP |
PATH-separated from=to path prefix pairs used when no checkout matches (for example /root/repos=/Users/me/repos) |
RAYON_NUM_THREADS |
Limits the threads used by imports, materialize, and session index rebuilds, which use all CPU cores by default |
TZ |
Time zone for RikkaHub and OpenHands timestamps that lack a UTC offset; defaults to the system zone |
Each agent's own location variables are honored, such as CLAUDE_CONFIG_DIR, CODEX_HOME, PASEO_HOME, XDG_DATA_HOME, and XDG_CONFIG_HOME.
- Agent sessions are only read during import; exports create new sessions and never overwrite existing ones.
- Before running
baton materialize --in codex, close older Codex versions that do not use the sharedsession_index.jsonl.lockfor title updates. - Thinking is stored but never written back, tool calls are written as history and never run again, and auth, hooks, and MCP settings are untouched.
- Sessions exported to Claude Code, OpenCode, Kilo Code, DeepSeek Harness, pi, Oh My Pi, Grok Build, Devin, and ZCode keep the model each message was written with, as far as the source agent recorded it; Hermes and Muse Code get the session's last model, and Codex sessions carry no model and resume on Codex's own configured model. A provider or model the source agent did not record is left out or written as
<synthetic>. Agents that resume on a session's model resume on its last one, and when the local install lacks that model the agent handles it as it handles a model it no longer offers: interactive Oh My Pi falls back to its default model, and it refuses to open the session with-por in RPC or ACP mode. - OpenCode and Kilo Code sessions go through the
opencodeandkilocommands onPATH, and the project directory must exist to receive a session. - Paseo keeps no conversations of its own: baton imports a Paseo agent through its provider's session (Claude Code, Codex, OpenCode, Pi, Oh My Pi), so the chat stays one baton session.
export --to paseoandresume --in paseotake--provider, whilematerialize --in paseorestores every session that was a Paseo agent somewhere under each provider it was registered with; registering goes throughpaseoand a running Paseo daemon, and when the daemon is not runningmaterialize --in paseowrites only the provider sessions and warns that registration and deletion are skipped.- DeepSeek Harness cannot open a session by id, so
baton resume --in dshstartsdsh web, where the session is listed under its workspace or Ungrouped. - RikkaHub runs on Android, so baton reads backups exported from the app;
--backup <file>withexportormaterializeadds sessions to that backup and creates it when missing, andresumecannot open RikkaHub. Restoring a backup in the app replaces all of its conversations, so add sessions to a backup made right before restoring. - ZCode sessions are read from and written to its CLI database
~/.zcode/cli/db/db.sqlite(orZCODE_SESSION_DB_PATH), so runzcodeonce before writing a session there. ZCode resumes on the session's last model only when the source agent recorded its provider, and otherwise asks for a model.
The session format research builds on session-migrate and omnisession.