cx2cc
v0.1.0
Published
Convert Codex sessions to Claude Code session format for /resume
Maintainers
Readme
cx2cc
Convert Codex sessions into Claude Code session files so they appear in Claude Code's session history.
Why
The inverse of cc2cx. If you switch between Codex and Claude Code or want to reference a Codex session from Claude Code, this tool bridges the gap. It reads a Codex rollout JSONL, converts messages/tool calls/reasoning into Claude Code's session format, and writes the result so Claude Code discovers it.
Install
bun install -g cx2ccOr run directly without installing:
bunx cx2cc <session-id|last>npx cx2cc and npm install -g cx2cc work too.
Requires Node.js 18+ and a native compilation toolchain for better-sqlite3.
Usage
cx2cc <session-id|last|path> [options]Arguments:
session-id-- UUID (or prefix) of a Codex session (e.g.019cb95c-bd13-7301-b898-2cc6832b32a7)last-- automatically picks the most recently updated sessionpath-- direct path to a rollout JSONL file
Options:
| Flag | Description |
|------|-------------|
| --dry-run | Print converted JSONL to stdout without writing any files |
| --project PATH | Override the Claude Code project path (default: session's cwd) |
| --verbose | Print conversion stats (turns, lines, file paths) |
Examples
Convert the most recent Codex session:
cx2cc lastPreview what would be generated without writing anything:
cx2cc last --dry-runConvert a specific session with verbose output:
cx2cc 019cb95c-bd13-7301-b898-2cc6832b32a7 --verboseAfter running, the session will appear in Claude Code's session history for the corresponding project.
What it does
- Resolves the Codex rollout file via
~/.codex/state_5.sqlite(by session ID or most recent) - Parses the rollout JSONL, extracting session metadata and grouping response items into turns
- Converts each turn into Claude Code's session format:
- User messages with text content
- Assistant messages with thinking, text, and tool_use content blocks
- User continuation messages with tool_result blocks
- Linked-list structure via uuid/parentUuid chain
- Writes the session file to
~/.claude/projects/<encoded-cwd>/<session-id>.jsonl
Tool mapping
Codex tools are translated to their Claude Code equivalents:
| Codex | Claude Code |
|-------|-------------|
| exec_command | Bash (or Read/Grep/Glob if pattern-detected) |
| apply_patch (custom tool) | Edit |
| mcp__* | Passed through unchanged |
When a session was originally converted with cc2cx, the original tool names are recovered by pattern-matching the command strings (e.g. cat -n back to Read, rg back to Grep).
Limitations
- Subagent/team sessions are not converted (main session only)
- Image content blocks are dropped
- Token counts are not reconstructed
- Native Codex
apply_patchdiffs are stored as metadata on Edit blocks rather than parsed into old/new strings
License
MIT
