How to hand work from Claude Code to Codex and back
To hand work from Claude Code to Codex, ask Claude to write what is done, what is left and how to check it into a file in your repo, then start Codex in the same folder and tell it to read that file. To hand it back, have Codex bring the file up to date and start Claude Code there again.
OpenAI also publishes a plugin that sends a task to Codex from inside Claude Code. Both ways are below, then a third for a second opinion, then what gets hard.
A hand-off file in the repo
This needs only git and the two tools. It works in both directions, and you can read what was said.
1. Ask the one who is stopping to write it
While Claude Code still has the work in its conversation, send it this:
Write HANDOFF.md at the top of this repo for another coding agent who has seen none of this conversation.
Use these headings: Goal, Done, Left, Check, Watch out, Next.
Name real files and real commands. Keep it to one page.Read what comes back. A good one looks like this:
# Hand-off: password reset
Goal: a person can reset a password from the sign-in page.
Done
- server/reset.ts makes the link and stores its hash.
- server/reset.test.ts passes.
Left
1. The page at app/reset/page.tsx. It does not exist yet.
2. A link to it from app/sign-in/page.tsx.
Check
- npm test
- Open /sign-in, ask for a link, set a new password, sign in.
Watch out
- A link works once. Do not remove that check.
Next: Codex takes Left 1, then hands back.The last line matters most. It says who has the next step, so that both tools, and you, can tell whose turn it is.
2. Commit, then start Codex
Commit the file along with the work, then write down the id of that commit. This line from git's own page prints it:
git rev-parse --verify HEADIn the same folder, start Codex by typing codex, and send it this:
Read HANDOFF.md. Do the Next line and nothing else. Then update HANDOFF.md.To let it run by itself and stop, use codex exec. By default it needs a git repo and only reads. This is the form its page gives for allowing edits. Put the message above in place of <task>:
codex exec --sandbox workspace-write "<task>"In that sandbox .git stays read-only, so make the commit yourself, after you have looked at the work.
3. Look, then hand it back
Two commands show you what Codex did. git status --untracked-files=all lists the files that are changed, staged or not yet tracked by git, and names each new file, even inside a new folder. git diff with a commit compares the tracked files in your folder with that commit. Put the id you wrote down in place of <commit>:
git status --untracked-files=all
git diff <commit>That diff covers staged changes and any commits made since the hand-off. It leaves out new files that git does not track yet, and a hand-off like the one above asks for a new file, so review each file that the first command lists, the new ones too. Run the Check lines. Then commit, the new files too, and write down the new commit's id for the next pass.
Start Claude Code in the same folder by typing claude, and send it this:
Read HANDOFF.md. Check the last commit against it, do the Next line, then update HANDOFF.md.The version that runs by itself and stops is claude -p. With acceptEdits it writes files without asking you. Most other commands still need your permission, so it may not be able to run your tests. This is the example on that page. Put your message in place of the words in quotes:
claude -p "Apply the lint fixes" --permission-mode acceptEditsIf you would rather go back to the conversation you left, claude --continue opens the most recent eligible conversation in that folder. That can be a background session that has finished. It skips sessions made with claude -p or the Agent SDK, and those whose first prompt was /loop. If your most recent conversation is one you moved to the background and it is still running, the command exits and prints that session's ID.
To open the exact conversation you mean, pass its session ID. This works for claude -p sessions too. claude -p with --output-format json prints it as session_id. Put it in place of <session-id>:
claude --resume <session-id>For Codex, codex resume with --last opens the newest interactive chat from the folder you are in. To count codex exec runs too, add --include-non-interactive. Whichever conversation you open, in either tool, tell it to read the file first.
4. Keep one writer at a time
In one folder, let one tool finish before the other starts. If you want both to work at once, give each its own git worktree and pass the file by committing it and merging the branch. The steps are on our page about how to use Claude Code and Codex together on one Mac.
OpenAI's Codex plugin for Claude Code
The plugin lets you send work to Codex without leaving Claude Code. Its page asks for Node.js 18.18 or later and a ChatGPT plan (the free one counts) or an OpenAI API key. What Codex does there counts towards your Codex limits. Type these in Claude Code, one at a time, as on its install steps:
/plugin marketplace add openai/codex-plugin-cc
/plugin install codex@openai-codex
/reload-plugins
/codex:setupThe last line tells you whether Codex is ready. Then hand over a task, look in on it, and read the answer. The first line is one of the plugin page's examples, so put your own task after --background:
/codex:rescue --background investigate the regression
/codex:status
/codex:resultFor a review that changes no files:
/codex:review --base mainCodex works in the same checkout as Claude Code, so the rule about one writer at a time still holds. The answer comes back to you in Claude Code, where you can ask Claude to carry on.
To move a whole conversation to Codex, type /codex:transfer. It makes a Codex thread from your Claude Code session and prints the codex resume command that opens it. Without the plugin, typing /import in Codex lets you choose recent Claude Code chats from this Mac.
A pipe, for a second opinion
When all you want is another look, pipe what a command prints into one tool, keep the answer in a file, and have the other tool read it. Both commands below are examples from the tools' own pages. Change the first part, the words in quotes and the file name to suit. To ask about changes to tracked files compared with main, the first part can be git diff main, as in Claude's build script example.
From Codex to Claude Code, with the example on Codex's page:
npm test 2>&1 \
| codex exec "summarize the failing tests and propose the smallest likely fix" \
| tee test-summary.mdRead test-summary.md. Fix what is right in it and tell me what is not.From Claude Code to Codex, with the example on Claude's page. Here build-error.txt is a file you saved from a build that failed:
cat build-error.txt | claude -p 'concisely explain the root cause of this build error' > output.txtRead output.txt. Fix what is right in it and tell me what is not.Where it gets hard
- You are the bell. With a file, nothing starts Codex when Claude Code stops. You have to notice, and type the next line.
- The file goes stale. A hand-off that nobody updated is worse than none, because the next agent believes it. Read it before each pass.
- Busy is hard to see. If both tools can write to the folder and you send a second task while the first is running, they may change the same files at once, or the message may arrive in the middle of something else.
- Loops use up your limits. The plugin has an optional review gate. It runs a Codex review when Claude is about to stop, and if that review finds issues, it blocks the stop so Claude can deal with them first. Its page warns that this can run long and drain limits quickly, so turn it on only while you watch.
- It is one task at a time. With five tasks between two tools, one file no longer tells you who has what.
The commands were checked on 23 November 2026 against the pages linked beside them. If one has changed since, trust that page.