cc2cx
v0.1.0
Published
Convert Claude Code sessions to Codex-compatible rollout format for /resume
Maintainers
Readme
cc2cx
Convert Claude Code sessions into Codex rollout files so they appear in codex resume.
Why
We all know that Claude is better at some things and Codex is better at others. If you switch between them or want to reference a Claude Code session from Codex's /resume picker, this tool bridges the gap. It reads a Claude Code session JSONL, converts messages/tool calls/reasoning into Codex's rollout format, and registers the result so Codex discovers it.
Install
bun install -g cc2cxOr run directly without installing:
bunx cc2cx <session-id|last>npx cc2cx and npm install -g cc2cx work too.
Requires Node.js 18+ and a native compilation toolchain for better-sqlite3.
Usage
cc2cx <session-id|last> [options]Arguments:
session-id-- UUID of a Claude Code session (e.g.862e1482-b9cb-49ad-8631-e297a82463e0)last-- automatically picks the most recently modified session across all projects
Options:
| Flag | Description |
|------|-------------|
| --dry-run | Print converted JSONL to stdout without writing any files |
| --no-register | Write the rollout file but skip history.jsonl and SQLite registration |
| --project PATH | Limit session search to a specific Claude Code project path |
| --verbose | Print conversion stats (turns, lines, file paths) |
Examples
Convert the most recent Claude Code session:
cc2cx lastPreview what would be generated without writing anything:
cc2cx last --dry-runConvert a specific session with verbose output:
cc2cx 862e1482-b9cb-49ad-8631-e297a82463e0 --verboseAfter running, open Codex and the session will appear in the /resume list.
What it does
- Resolves the Claude Code session file from
~/.claude/projects/ - Parses the JSONL, deduplicating streamed assistant messages and walking the linked-list message chain
- Segments messages into turns (each user message starts a new turn)
- Converts each turn into Codex's rollout format:
session_metaheaderresponse_itementries for user/assistant messages, reasoning, and tool callsevent_msgentries for turn lifecycle (task_started,task_complete, etc.)turn_contextmetadata
- Writes the rollout file to
~/.codex/sessions/YYYY/MM/DD/ - Registers the session in
~/.codex/history.jsonland~/.codex/state_5.sqliteso it appears in/resume
Tool mapping
Claude Code tools are translated to their Codex equivalents:
| Claude Code | Codex |
|-------------|-------|
| Bash | exec_command |
| Read | exec_command (as cat -n) |
| Edit | exec_command (as apply_patch) |
| Write | exec_command (as cat >) |
| Grep | exec_command (as rg) |
| Glob | exec_command (as rg --files) |
| WebSearch, WebFetch | exec_command (as comment) |
| mcp__* | Passed through unchanged |
| ToolSearch | Skipped |
Limitations
- Subagent/team sessions are not converted (main session only)
- Image content blocks are dropped
- Token counts are not reconstructed
- Thinking blocks are emitted as plaintext reasoning summaries
License
MIT
