claude-to-codex-history
Skill2 starsChanged 8 months agoMITView on GitHub
Convert Claude Code session history into Codex-ready continuation artifacts. Use when a user asks to migrate, transfer, resume, import, archive, inspect, or continue Claude Code conversations/history in Codex, including by Claude session id, renamed session title, ~/.claude JSONL file, project directory, or search query.
In this repository2 other files it gives its agents.
- bilibili-watcherSkill
- youtube-watcherSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 5 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
If the user wants codex resume, use Same-Directory Resume Workflow.
- Very specific: line 13
If the user only wants a portable artifact, export Markdown with --include-predecessors -o <handoff.md>.
- Very specific: line 14
If the user asks for raw machine-readable data, export messages-jsonl.
- Very specific: line 15
Only export standalone codex-jsonl when explicitly requested.
- Very specific: line 32
Use this when the user says they exited Claude Code in a directory, started Codex in that same directory, and wants to convert a Claude …
- Distinctive: line 34
Always run from the project directory.
- Distinctive: line 41
If the match is clear, dry-run the install:
- Very specific: line 76
After this, the user can exit the current Codex chat, run codex resume, find the imported thread, or run the exact codex resume <id> …
- Distinctive: line 92
Create a full handoff from a renamed session, following compact-summary transcript references:
- Distinctive: line 98
Create normalized machine-readable messages:
- Distinctive: line 104
Create a best-effort Codex rollout JSONL:
- Very specific: line 131
Use markdown by default. It is stable, readable, and works as a Codex prompt or memory.
- Very specific: line 132
Use messages-jsonl for downstream scripts or audits.
- Very specific: line 133
Use codex-jsonl only for best-effort archival.
- Very specific: line 134
Use --install-codex-session only when the user explicitly wants codex resume integration.
- Very specific: line 135
Use --install-full-context only for small sessions or explicit debugging.
- Very specific: line 139
Do not write into ~/.codex/sessions, ~/.codex/session_index.jsonl, or Codex SQLite state unless the user explicitly asks for native session …
- Very specific: line 140
When using --install-codex-session, prefer --dry-run first and verify the planned paths.
- Very specific: line 141
If testing a resume import, use codex exec resume <session-id> "<small verification prompt>" and check whether it can answer from the …
- Very specific: line 143
Use --redact-secrets before sharing handoffs outside the user's machine.
- Very specific: line 144
Use --full-tools or --entire only when the user truly wants full tool output.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Claude To Codex History
Convert Claude Code JSONL sessions into artifacts Codex can use, including an optional installed Codex resume entry.
Default Workflow
- If the user wants
codex resume, use Same-Directory Resume Workflow. - If the user only wants a portable artifact, export Markdown with
--include-predecessors -o <handoff.md>. - If the user asks for raw machine-readable data, export
messages-jsonl. - Only export standalone
codex-jsonlwhen explicitly requested; it is archival unless installed into Codex.
Target Human Workflow
Support this end-to-end flow:
- User works in Claude Code inside a project directory.
- User exits Claude Code and keeps either the Claude session ID or renamed session title.
- User starts Codex from that same project directory.
- User asks Codex to use this skill on the Claude session name or ID.
- Codex converts the Claude session and installs a synthetic Codex resume session.
- Codex reports the exact
codex resume <session-id>command, thread name, and full handoff path. - User exits the current Codex chat.
- User runs
codex resume, selects the imported thread, or runs the exact command.
Same-Directory Resume Workflow
Use this when the user says they exited Claude Code in a directory, started Codex in that same directory, and wants to convert a Claude session name or ID so they can later use codex resume.
Always run from the project directory. Preview candidates first:
SESSION_NAME_OR_ID="put-session-name-or-id-here"
python3 scripts/claude_to_codex_history.py "$SESSION_NAME_OR_ID" --same-directory --listIf the match is clear, dry-run the install:
SESSION_NAME_OR_ID="put-session-name-or-id-here"
SHORT_NAME="put-short-readable-name-here"
python3 scripts/claude_to_codex_history.py "$SESSION_NAME_OR_ID" \
--same-directory \
--include-predecessors \
--tool-output-chars 4000 \
--install-codex-session \
--thread-name "Imported Claude: $SHORT_NAME" \
--dry-runThen install the resumable Codex session:
SESSION_NAME_OR_ID="put-session-name-or-id-here"
SHORT_NAME="put-short-readable-name-here"
python3 scripts/claude_to_codex_history.py "$SESSION_NAME_OR_ID" \
--same-directory \
--include-predecessors \
--tool-output-chars 4000 \
--install-codex-session \
--thread-name "Imported Claude: $SHORT_NAME"Report the printed command to the user:
codex resume <printed-session-id>Also report the thread name and full_handoff_path so the user can find the imported session in the resume picker and inspect older Claude history when needed.
After this, the user can exit the current Codex chat, run codex resume, find the imported thread, or run the exact codex resume <id> command.
What Installation Does
--install-codex-session writes a synthetic Codex session containing a bounded continuation context as the first user message. It also writes the full Markdown handoff to ~/.codex/claude_imports/, appends a row to ~/.codex/session_index.jsonl, and creates a timestamped backup of that index first. It does not modify Codex SQLite state.
This is intentionally a high-compatibility mimic: Codex sees a normal interactive-style session with compact imported context, rather than thousands of fake tool events. The bounded context matters because a multi-day Claude transcript can exceed Codex's model context window and fail on resume.
Other Commands
List matching Claude sessions:
python3 scripts/claude_to_codex_history.py "$SESSION_NAME_OR_ID" --listCreate a full handoff from a renamed session, following compact-summary transcript references:
python3 scripts/claude_to_codex_history.py "$SESSION_NAME_OR_ID" --include-predecessors -o /tmp/claude-handoff.mdCreate normalized machine-readable messages:
python3 scripts/claude_to_codex_history.py "$SESSION_NAME_OR_ID" --include-predecessors --format messages-jsonl -o /tmp/claude.messages.jsonlCreate a best-effort Codex rollout JSONL:
python3 scripts/claude_to_codex_history.py "$SESSION_NAME_OR_ID" --include-predecessors --format codex-jsonl -o /tmp/claude.codex.jsonlInstall a best-effort native Codex resume entry:
python3 scripts/claude_to_codex_history.py "$SESSION_NAME_OR_ID" --same-directory --include-predecessors --install-codex-session --thread-name "Imported Claude: $SHORT_NAME"
codex resume <printed-session-id>Preview the native install without writing:
python3 scripts/claude_to_codex_history.py "$SESSION_NAME_OR_ID" --same-directory --include-predecessors --install-codex-session --dry-runContinue in Codex using the stable handoff:
codex -C /path/to/workspace "$(cat /tmp/claude-handoff.md)"Format Choice
- Use
markdownby default. It is stable, readable, and works as a Codex prompt or memory. - Use
messages-jsonlfor downstream scripts or audits. - Use
codex-jsonlonly for best-effort archival. Codex's internal rollout schema can change, so do not promisecodex resumecompatibility from this file alone. - Use
--install-codex-sessiononly when the user explicitly wantscodex resumeintegration. It writes a synthetic Codex-shaped session containing compact continuation context, writes the full handoff as a sidecar Markdown file, appends~/.codex/session_index.jsonl, and backs up the index first. - Use
--install-full-contextonly for small sessions or explicit debugging. Large full-history installs can fail with a Codex context-window error on resume.
Safety Rules
- Do not write into
~/.codex/sessions,~/.codex/session_index.jsonl, or Codex SQLite state unless the user explicitly asks for native session installation. - When using
--install-codex-session, prefer--dry-runfirst and verify the planned paths. Never modify Codex SQLite state. - If testing a resume import, use
codex exec resume <session-id> "<small verification prompt>"and check whether it can answer from the installed compact context. - Preserve raw Claude source paths in the generated handoff so another agent can re-open the original transcript if needed.
- Use
--redact-secretsbefore sharing handoffs outside the user's machine. - Use
--full-toolsor--entireonly when the user truly wants full tool output; otherwise large logs are truncated for readability.
Script Notes
The converter accepts a Claude JSONL path, a project directory, a session UUID, or a search string. Search strings are matched against ~/.claude/history.jsonl first, then against project JSONL contents.
--entire is shorthand for --include-predecessors --full-tools; it recursively follows transcript paths embedded in Claude compact summaries.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

