Exporting a Claude Code session to Codex
I found a simple way to move a Claude Code session over to Codex CLI.
In Claude Code, I ask it to export the full session context to a dated markdown file:
Export the entire context of our current session to a markdown file named claude-context-YYYY-MM-DD.md (substitute today's actual date — run `date +%Y-%m-%d` to get it) in the current directory. Include everything needed for another AI assistant (specifically Codex CLI) to pick up exactly where we left off:
1. **Session overview**: A brief summary of what we've been working on, the goal, and current status.
2. **Project context**:
- Working directory and relevant repo/branch info (run `pwd`, `git branch --show-current`, `git status --short`, `git log --oneline -5`)
- Tech stack, frameworks, and key dependencies in play
- Any environment variables, config files, or setup steps that matter
3. **Conversation history**: A chronological digest of our exchange — my requests, your responses, decisions made, approaches tried, and approaches rejected (and why). Don't paraphrase away important detail; preserve specifics.
4. **Files touched**: List every file you've read, created, or modified this session, with a one-line note on what changed or why it was relevant. For files you created or substantially edited, include the current state or a diff summary.
5. **Commands run**: Every shell command executed, with its purpose and outcome (success/failure, key output).
6. **Open threads**:
- What's done
- What's in progress (with exact next step)
- What's blocked and on what
- Any TODOs, FIXMEs, or questions I left unanswered
7. **Gotchas and context the next assistant needs**: Quirks of the codebase, conventions I follow, things that tripped us up, anything implicit between us that wouldn't be obvious from the code alone.
8. **Suggested next action**: The single most useful thing the next assistant should do when I resume.
Format as clean markdown with clear headings. Use code blocks for commands, file paths, and code snippets. Be thorough — token count is not a concern here; continuity is. When done, print the file path and a short confirmation.
Then in Codex CLI, I start with the handoff file:
Read claude-context-YYYY-MM-DD.md in full before doing anything else. That's the handoff from my previous session — treat it as the ground truth for where we are and what to do next.
It works well because the handoff file is explicit about both code state and conversation state. The next assistant does not have to infer what happened from git diffs alone.
This is becoming one of my standard patterns for moving work between AI coding tools.




0 Comments:
Post a Comment
<< Home