agentleFS
CLRT19CLRT19/skills/claude-to-codex-history/SKILL.md

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.

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
  1. Very specific:

    If the user wants codex resume, use Same-Directory Resume Workflow.

    line 12
  2. Very specific:

    If the user only wants a portable artifact, export Markdown with --include-predecessors -o <handoff.md>.

    line 13
  3. Very specific:

    If the user asks for raw machine-readable data, export messages-jsonl.

    line 14
  4. Very specific:

    Only export standalone codex-jsonl when explicitly requested.

    line 15
  5. Very specific:

    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 …

    line 32
  6. Distinctive:

    Always run from the project directory.

    line 34
  7. Distinctive:

    If the match is clear, dry-run the install:

    line 41
  8. Very specific:

    After this, the user can exit the current Codex chat, run codex resume, find the imported thread, or run the exact codex resume <id> …

    line 76
  9. Distinctive:

    Create a full handoff from a renamed session, following compact-summary transcript references:

    line 92
  10. Distinctive:

    Create normalized machine-readable messages:

    line 98
  11. Distinctive:

    Create a best-effort Codex rollout JSONL:

    line 104
  12. Very specific:

    Use markdown by default. It is stable, readable, and works as a Codex prompt or memory.

    line 131
  13. Very specific:

    Use messages-jsonl for downstream scripts or audits.

    line 132
  14. Very specific:

    Use codex-jsonl only for best-effort archival.

    line 133
  15. Very specific:

    Use --install-codex-session only when the user explicitly wants codex resume integration.

    line 134
  16. Very specific:

    Use --install-full-context only for small sessions or explicit debugging.

    line 135
  17. Very specific:

    Do not write into ~/.codex/sessions, ~/.codex/session_index.jsonl, or Codex SQLite state unless the user explicitly asks for native session …

    line 139
  18. Very specific:

    When using --install-codex-session, prefer --dry-run first and verify the planned paths.

    line 140
  19. Very specific:

    If testing a resume import, use codex exec resume <session-id> "<small verification prompt>" and check whether it can answer from the …

    line 141
  20. Very specific:

    Use --redact-secrets before sharing handoffs outside the user's machine.

    line 143
  21. Very specific:

    Use --full-tools or --entire only when the user truly wants full tool output.

    line 144

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Claude To Codex History

Convert Claude Code JSONL sessions into artifacts Codex can use, including an optional installed Codex resume entry.

Default Workflow

  1. If the user wants codex resume, use Same-Directory Resume Workflow.
  2. If the user only wants a portable artifact, export Markdown with --include-predecessors -o <handoff.md>.
  3. If the user asks for raw machine-readable data, export messages-jsonl.
  4. Only export standalone codex-jsonl when explicitly requested; it is archival unless installed into Codex.

Target Human Workflow

Support this end-to-end flow:

  1. User works in Claude Code inside a project directory.
  2. User exits Claude Code and keeps either the Claude session ID or renamed session title.
  3. User starts Codex from that same project directory.
  4. User asks Codex to use this skill on the Claude session name or ID.
  5. Codex converts the Claude session and installs a synthetic Codex resume session.
  6. Codex reports the exact codex resume <session-id> command, thread name, and full handoff path.
  7. User exits the current Codex chat.
  8. 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 --list

If 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-run

Then 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" --list

Create 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.md

Create normalized machine-readable messages:

python3 scripts/claude_to_codex_history.py "$SESSION_NAME_OR_ID" --include-predecessors --format messages-jsonl -o /tmp/claude.messages.jsonl

Create 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.jsonl

Install 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-run

Continue in Codex using the stable handoff:

codex -C /path/to/workspace "$(cat /tmp/claude-handoff.md)"

Format Choice

  • Use markdown by default. It is stable, readable, and works as a Codex prompt or memory.
  • Use messages-jsonl for downstream scripts or audits.
  • Use codex-jsonl only for best-effort archival. Codex's internal rollout schema can change, so do not promise codex resume compatibility from this file alone.
  • Use --install-codex-session only when the user explicitly wants codex resume integration. 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-context only 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-run first 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-secrets before sharing handoffs outside the user's machine.
  • Use --full-tools or --entire only 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.