How to switch from Claude Code to Codex mid-task
You can't move a live Claude Code chat into Codex. The two keep separate session histories,
and neither reads the other's. What carries over is what's in the folder: your files, Git, and
any notes you leave there. So before you switch, put the rules in AGENTS.md, write
the current task in a short HANDOFF.md, and make sure the work so far is in the
working tree or a commit. Then open Codex in the same folder and ask it to read both files and
the diff before it edits. On a Mac, BuildGist's Continue can hand the task to the new Codex chat
for you.
What Codex sees and what it doesn't
| Comes with you | Stays in Claude Code |
|---|---|
| Every file in the folder, including uncommitted changes | What you asked for, and what you ruled out |
| Git history and branches | What was tried and failed |
AGENTS.md (Codex reads it when it starts) | Your chat and Claude Code's auto memory |
1. Share the rules once
Codex reads AGENTS.md: your ~/.codex/AGENTS.md first, then one per
folder from the repo root down. Claude Code reads CLAUDE.md, and reads
AGENTS.md directly only when there's no CLAUDE.md. To keep one set of
rules, put them in AGENTS.md and make the first line of CLAUDE.md:
@AGENTS.md
Add this line to AGENTS.md so every new session picks up the live task:
If HANDOFF.md exists, read it first and say the task and the next step back before you edit.
2. Write the handoff note
Ask Claude Code to write it while it still has the context:
Task: Add login with Google.
Done: the sign-in button, where Google sends you back, the signed-in state in the browser. See the diff.
Tried and failed: keeping the session in localStorage (lost on refresh).
Not done: deleting a note doesn't check that it belongs to the signed-in user.
Next step: add that check. Don't redo the sign-in work.
If Claude Code wrote it, read it before you rely on it. It records what the agent thinks it did. Replace the note on every switch, and delete it when the task is done.
3. Check the work is in the folder
git status
git diff --stat
If Codex will open in the same folder on the same Mac, you don't need to commit. It reads the uncommitted files. Commit when you want a checkpoint you can go back to, or when Codex will run somewhere else:
git switch -c wip/google-login
git add -A
git commit -m "WIP: Google login, handing off to Codex"
Don't use git stash push -u for a handoff in the same folder. It takes the
changes out of the working tree, so Codex starts without them until you run
git stash pop.
4. Start Codex with a pointed first message
Open Codex in the same folder and send:
Read AGENTS.md and HANDOFF.md, then look at git diff to see the work so far.
Tell me the task, what's done and the next step before you change anything.
If its answer doesn't match the note or the diff, fix that first.
If the limit already hit
Claude Code can't write the note once you're out of usage, so write the five lines yourself
from git diff --stat and what you remember. When your limit resets, claude --continue reopens the most recent Claude Code chat in that folder,
and codex resume reopens a recent Codex chat from that repository. More in usage limit hit in the
middle of a task.
Tools that do the handoff for you
- SpecWeave has
specweave handoffandspecweave pickupcommands that write a handoff note and move uncommitted edits through Git. They don't need the agent, so they work after a limit has hit. - Reinstate has
rein handoff --last --from claude --to codex, which starts a new Codex session from a Claude Code one. Its docs say it isn't a lossless copy. - A GitHub project by amal-david
adds a
/handoffcommand in Claude Code that carries the active session into Codex.
Or choose Continue in BuildGist
BuildGist works with Claude Code, Cursor and Codex. When you start a new Codex chat in the same project, a BuildGist card at the bottom right of your screen offers the task you were doing in Claude Code. Choose Continue and the new chat starts with that task's context. Start fresh hands nothing over.
The context is your own words: what you asked for, and constraints you typed. If the last run's files are as it left them and HEAD hasn't moved, it can also say
how many files changed, whether a test failed, and up to three paths. It doesn't include the
patch, because the code is already in the folder. By default the card offers a task active in
this project in the last 12 hours. Codex takes it on a new session, not a chat you're already in.
BuildGist doesn't write HANDOFF.md or change AGENTS.md or
CLAUDE.md.
BuildGist also explains each meaningful run in plain English. Setup, including the one-time approval in Codex, is in Getting started.
Going the other way: Codex to Claude Code. Running both at once: keep context across agents.
Questions
Can Codex read my Claude Code conversation?
No. Codex doesn't open Claude Code's session history. It reads the files in the folder, so the task has to be in a file, a commit, or your first message.
Do I have to commit before switching?
No, if Codex opens in the same folder. It reads uncommitted changes. Commit on a WIP branch for a checkpoint.
Will Codex follow my CLAUDE.md?
No. Codex reads AGENTS.md. Keep shared rules there and import them into
CLAUDE.md with @AGENTS.md.
Can I switch back to Claude Code later?
Yes. Update HANDOFF.md in Codex, then open Claude Code in the same folder.
claude --continue reopens your earlier Claude Code chat, but it won't know what Codex
did unless the note or the diff tells it. See Codex
to Claude Code.
What you need
- A Mac with Apple silicon and macOS 12 or later.
- Claude Code, Cursor or Codex.
- A Git project. No commit, push, remote or GitHub repository is needed.
- A GitHub account, to sign in. BuildGist does not access your GitHub repositories.
Codex needs you to approve BuildGist once, in Codex. BuildGist shows the steps. Setup is in Getting started.
To explain a run, your computer sends BuildGist what that run needs, and BuildGist passes it to Anthropic. BuildGist does not keep this material. It does not send your whole repository, files the run did not change, or files named like secrets, such as .env files and keys. It keeps the explanation and short cited excerpts of changed code, at most 12 lines each. Secret masking is best-effort. Privacy has the full list.
Every account gets 7 days of BuildGist Pro free, with no card. The 7 days start at your first explanation or Continue handoff. Nobody is charged when the trial ends. After that, BuildGist Pro is $12 per month, plus any applicable tax shown at checkout. See pricing.
Try BuildGist Download for Mac
No Mac handy? Try it in your browser: paste a session or a git diff and see the explanation.
Apple silicon, macOS 12 or later. United States, 18 or older.
Related
- What did Claude Code change?
- Understand code an agent wrote
- Hand off Claude Code to Cursor
- Review what Codex changed
- You’ve hit your session limit in Claude Code
- You’ve hit your usage limit in Codex
- Keep context across agents
- Review AI code before merging
- BuildGist or the git diff
- Claude Code session history
- Undo Claude Code changes
- BuildGist vs CLAUDE.md, AGENTS.md and HANDOFF.md
- Keep context from Claude Code to Cursor
- Resume an agent session in another tool
- BuildGist vs Conductor
- Codex context window full
- Undo Codex changes
- Cursor usage limit reached
- Review Cursor agent changes
- Codex session history location
- Your conversation is too long in Cursor
- One default coding agent, or two?
- Tools that summarize agent sessions
- Switch from Codex to Claude Code
- Move from Cursor to Claude Code
- Switch from GitHub Copilot to Claude Code
- Move from Windsurf to Cursor
- Switch from Gemini CLI to Claude Code
- Coding agent crashed mid-task
- Claude Code lost context after compacting
- What commands did the agent run?
- Turn an agent session into a PR description
- Which coding agents read AGENTS.md?
- Switch from Cursor to Codex
- Export a Claude Code conversation
- Keep the dead ends when you switch agents
- Write a handoff note for a fresh session
- Usage limit hit in the middle of a task
- Mac apps that explain agent runs
- Explain a Claude Code session
- What did my agent change before I merge?
- BuildGist vs an AI PR reviewer
- Review what Claude Code changed
- Review what Copilot changed
- Review what Windsurf changed
- Review what Gemini CLI changed
- Review what Devin changed
- Review what Cline changed
- Review what Aider changed
Questions: kayvanandre@gmail.com.