session-sync
v0.1.0
Published
Continuous cross-agent session sync for Claude Code and Codex
Readme
session-sync
Switch from Claude Code to Codex or any AI coding agent without losing your session.
The problem
You're mid-task in Claude Code and want to continue in Codex or another agent. Your tool calls, conversation, and working context are trapped in Claude Code's format — the other agent has no idea what you've been doing. You start over, re-explain the codebase, and rediscover what was already tried.
Quick start
npm install -g session-sync
cd your-project
session-sync initThat's it. From now on, every Claude Code tool call is automatically translated and written into each detected agent's native sessions directory. When you want to switch:
session-sync status
# → codex --continue abc123def456Install
npm install -g session-syncRequires Node.js 22+.
Usage
Initialize in a project
cd your-project
session-sync initDetects installed agents (Codex, Amp, Gemini CLI), registers the PostToolUse and Stop hooks in .claude/settings.json, and writes .session-sync/config.json.
Check active sessions
session-sync statusSession abc12345 (main @ a1b2c3d)
codex → codex --continue rollout-deadbeef (47 records)
amp → amp --session amp-session-cafebabe (47 records)List all synced sessions
session-sync list
session-sync list --jsonPause and resume
session-sync pause # hooks stay registered but do nothing
session-sync resume # re-enable syncClean up old sessions
session-sync clean --older-than 30
session-sync clean --older-than 7 --dry-runHow it works
session-sync installs two Claude Code hooks:
- PostToolUse — fires after every tool call (Bash, Read, Edit, etc.), translates the tool exchange to each target agent's format, and appends it to that agent's session file in real time
- Stop — sweeps the transcript for text-only turns (assistant reasoning, user messages) that PostToolUse doesn't see, and appends them before the session ends
Translation uses @npow/interchange-core to convert between Claude Code's format and the Codex rollout JSONL / OpenAI chat JSONL formats used by Codex, Amp, and Gemini CLI.
The hook exits 0 in all cases and never writes to stdout/stderr — it never blocks Claude Code.
Development
git clone https://github.com/npow/session-sync.git
cd session-sync
npm install
npm test
npm run build