Blog

Claude Code to Codex handoff: import chats or use HANDOFF.md

On this page
  1. If you've already hit your limit
  2. What carries over, and what doesn't
  3. Step 1: one instruction file both agents read
  4. Step 2: write the handoff while you still can
  5. Step 3: don't let the plan live in the session
  6. Why people want this solved
  7. What the tools add
  8. Where Factrove fits

There are two routes now. The quick one: Codex can import your recent Claude Code chats with /import. The deliberate one: keep shared instructions in AGENTS.md and write a HANDOFF.md before you switch. The import is the fastest way to pick up where you were. The handoff file is the one that works with any agent, survives a machine change, and can be reused next time. I'd use the import when it's available and still keep the handoff habit.

If you've already hit your limit

From the intended repository directory, run this in your shell:

bash
codex --no-daemon

Then enter this at the Codex prompt:

text
/import

Try /import first. Per OpenAI's import docs, you start a local Codex CLI session, type /import, and choose Claude Code or Cursor. You pick the setup, project files and recent chats to bring over, review the imported configuration, and continue. The CLI imports up to 50 chats from the last 30 days. The command isn't available during a running task, in a remote session, or while connected to a local app-server daemon. If /import remains unavailable, use the export or HANDOFF.md route below. The docs also say importing doesn't change or delete your existing agent setup.

The ChatGPT desktop app has the same import under Settings > Import, with an option to keep imported work in sync through automatic updates. Per the same page, instruction files map to AGENTS.md, Claude Code project memories become memories, and chats from the last 30 days become ChatGPT chats. The docs suggest reviewing imported setup before you rely on it. I'd also check what the imported chat actually gave Codex before letting it edit, by asking it to restate the task and the last decisions.

If import isn't an option, export the conversation. Per the Claude Code commands docs, /export [filename] exports the current conversation as plain text. With a filename it writes straight to that file; without one it opens a dialog to copy or save. So in the Claude Code session:

text
/export claude-session.txt

Then in Codex:

text
Read claude-session.txt, an exported Claude Code conversation about this task.
Compare it with the current files and `git status`. List what's done, what's
half-done and what we decided, and flag anything in the chat the code doesn't
match. Then name the single next step. Don't change any files yet.

The reconcile step matters, because the chat says what was intended and the files say what happened. Keep the export out of git. A raw conversation can contain things you don't want committed.

What carries over, and what doesn't

The repo carries over only if both agents see the same files. If Claude Code and Codex run in the same working directory on the same machine, Codex sees everything, including uncommitted edits. If Codex runs in another checkout, a worktree, a cloud environment or another machine, it doesn't. Uncommitted and untracked files don't show up in another checkout, and a local commit doesn't reach another machine until it's pushed and fetched.

So before you switch, a short checkpoint:

  1. Stop the outgoing agent, so it isn't still editing while the next one starts.
  2. Confirm the directory and branch: pwd and git branch --show-current.
  3. Run git status and look at what's uncommitted or untracked.
  4. Make sure the incoming agent can see the intended changes. In the same directory, no transfer is needed. For another checkout or machine, commit the intended task files and push the task branch. At the destination, fetch, switch to that branch and fast-forward it. Compare git rev-parse HEAD with the source checkout, then inspect git status --short. Transfer intentionally uncommitted files separately.
bash
git fetch origin
git switch sessions-pg-dual-write
git merge --ff-only origin/sessions-pg-dual-write
git rev-parse HEAD
git status --short

Substitute your remote and task branch. If the destination has no local branch yet, replace the git switch command with git switch --track origin/sessions-pg-dual-write. If switching or fast-forwarding fails, resolve the destination state before continuing.

The conversation is where most of the real context lives: the 40 minutes where you ruled out the obvious approach, agreed the migration has to be reversible, and found the flaky test. /import and /export are two ways to carry it. Writing the important parts into a file is the third, and the only one that doesn't depend on which agents are involved.

Project instructions carry over if they're in a file both agents read. More on that below.

Plans and reports carry over if the next agent can reach them. A file in the repo is the dependable case. A claude.ai artifact depends on the agent's tools: a normal URL fetch won't carry your claude.ai login, so a private or org-only page usually won't come through, while a signed-in tool might. Test it from the agent you're switching to.

If you only need to send a plan or report, use the artifact-sharing workflow. This guide covers continuing the unfinished task around it. For the reverse handoff, see Codex to Claude Code. For Cursor, use Claude Code to Cursor or Cursor to Codex.

Step 1: one instruction file both agents read

OpenAI's docs say Codex reads AGENTS.md files before doing any work. It walks from the project root down to your working directory and concatenates the instruction files it finds on the way. It takes at most one file per folder, and in each folder an AGENTS.override.md wins over AGENTS.md, so a stray override file silently replaces the shared one. It stops adding files at project_doc_max_bytes, which is 32 KiB by default. Keep it short.

Claude Code is the one with catches. Per the Claude Code memory docs, v2.1.277 and later read AGENTS.md directly, but by default only when there's no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in your working directory or above it. So adding a personal, uncommitted CLAUDE.local.md quietly stops Claude from reading your AGENTS.md.

The setup I'd use when a team has both:

markdown
<!-- CLAUDE.md -->
@AGENTS.md

<!-- Claude-only notes below this line, if any -->

The @AGENTS.md import pulls the shared file in, and the docs say keeping it never makes Claude read AGENTS.md twice. The rules everyone needs go in AGENTS.md. To confirm it worked, run /context in a new session and check that CLAUDE.md appears under Memory files. You could instead set Project instructions to claude-md-and-agents-md in /config, but that's a per-person setting. The import is committed, so the team gets it without each person changing settings. It still does not load when Project instructions is managed-only.

I compared what each agent reads, and the CLAUDE.local.md trap, in AGENTS.md vs CLAUDE.md: which file each agent reads.

Step 2: write the handoff while you still can

The handoff file is session state. Its job is to carry the conversation across in a form any agent can read. Update it at meaningful checkpoints, like a step finished or a decision made, while you still have enough allowance left to ask for it. Don't save it for the moment you're blocked.

Separate from usage limits, long sessions also fill the context window. When that happens the conversation gets compacted, and details from early on can end up summarized away. That's another reason to write decisions down early, but it's a different limit.

The template I'd use, as HANDOFF.md in the repo root:

markdown
# Handoff
Task: <one line>
Branch: <branch>
Updated: <date and time, with timezone>
Status: in progress | done

## Goal
One paragraph. What "done" looks like.

## State
What's working, what's half-done. Exact file paths. Last commit.

## Evidence
- Last test command: <exact command>
- Result: <pass/fail, counts, the failing test names>
- Known failures: <failing before this task started, or caused by it>
- Uncommitted files: <from git status>

## Decisions (and why)
- Chose X over Y because ... (the next agent will otherwise "fix" this)

## Ruled out
- Tried Z, failed because ... (saves the next agent an hour)

## Blockers
Anything waiting on a person, an access grant or another team.

## Constraints
Rules for this task that aren't in AGENTS.md.

## Next step
The single next action, specific enough to start without asking.

The sections that matter most are Decisions, Ruled out and Evidence. Without the first two, a fresh agent that's good at its job tends to undo your decisions, because without the reasons your choice looks like a mistake. Without Evidence, it has no way to tell "this test was already failing" from "I just broke it". If Decisions is empty, the session probably made choices it never wrote down. Ask: "What did we decide in this session that isn't in the code yet?" and put the answer in the file.

Here's a filled-in one for a half-finished task, the session-store migration from my HTML to Markdown example:

markdown
# Handoff
Task: Move sessions from Redis to Postgres, step 2 (dual-write)
Branch: sessions-pg-dual-write
Updated: 2026-10-20 18:40 IDT
Status: in progress

## Goal
Every new or refreshed session is written to Redis and Postgres. Reads stay
on Redis. Plan: docs/plans/sessions-to-postgres.html

## State
- Done: migration 0042_sessions.sql (table + index on expires_at), committed in a1b2c3d.
- Half-done: src/auth/session-store.ts writes to both stores on create,
  but not on refresh yet.

## Evidence
- Last test command: pnpm test src/auth
- Result: 41 passed, 1 failed (session-store.test.ts > "refresh writes both stores")
- Known failures: that one, expected until refresh is done. Nothing else.
- Uncommitted files: src/auth/session-store.ts, src/auth/session-store.test.ts

## Decisions (and why)
- Postgres write failures are logged, not thrown, during dual-write.
  Redis is still the source of truth, so a Postgres hiccup must not log people out.

## Ruled out
- Writing through a DB trigger from Redis keyspace events: needs Redis config
  we don't control on the managed instance.

## Blockers
None.

## Constraints
- Don't touch the read path. sessions_pg stays off until step 4.

## Next step
Add the Postgres write to refreshSession() in src/auth/session-store.ts,
then rerun pnpm test src/auth and expect 42 passed.

The task, branch and numbers there are illustrative. The shape is the point: someone who wasn't in the session can tell what's true right now and what to do next.

Then commit it, even on a WIP branch. A handoff file that's only in your working tree isn't available on the other machine.

Add this to AGENTS.md so the next agent doesn't need to be told:

markdown
## Handoffs
- If HANDOFF.md exists, read it fully before doing anything else.
- Check that its Task, Branch and Updated match the current work
  (your task, `git branch --show-current`). If they don't, stop and ask.
- Run the "Last test command" and compare with the recorded result.
- When you stop mid-task, rewrite HANDOFF.md (don't append) using the same headings.
- When the task is done, set Status: done, or move the file to
  docs/handoffs/<date>-<task>.md.

The check at the top is there because a stale handoff is worse than none. An agent that trusts last week's file will happily continue last week's task. "Rewrite, don't append" is for the same reason: appended handoffs turn into a diary, and the next agent reads old state as current.

In Codex, the first prompt is then just: "Read HANDOFF.md and continue." If it asks you something HANDOFF.md should have answered, add the answer to the file, not just to the chat.

Step 3: don't let the plan live in the session

A handoff file is meant to be short and to be overwritten. The implementation plan, the research the agent did on rate-limit options, last sprint's QA report: those are long-lived documents, and they don't belong in HANDOFF.md or only in a chat tab.

Put them in files with stable paths, like docs/plans/payments-refactor.html or docs/reports/qa-sprint-14.html, and have the handoff point to them: "Follow docs/plans/payments-refactor.html, section 3." Then the next agent, today's or one six weeks out, can find the plan without anyone pasting it.

Two practical notes:

  1. If the plan is HTML, tell the agent how to read it. Agent-made HTML is a better read for people and a heavier one for agents. Either convert it to Markdown first (there's a script and a worked example in HTML for humans, Markdown for agents) or keep the content in semantic tags so it reads cleanly.
  2. Keep a one-line index. A docs/plans/README.md that lists each file and what it covers is cheap memory for an agent. It needs an owner, or a rule that the agent adds a line whenever it writes a plan, or it drifts.

Why people want this solved

The complaint I see most is some version of this one:

I'm tired of switching between Codex and Claude Code whenever I hit the limits. When I switch I have to give all the context again. What's the best way to handle this?

@pcshipp on X

Native import now covers part of it. The handoff file covers the rest: other agents, other machines, and the next person on the task.

What the tools add

Start with the native one: Codex's /import, covered above. Beyond that, two tools I checked, described from their own pages. I haven't run either, so I won't rank them.

  • keepitmovin (the old CodePass repo link now redirects there). Its README says it runs your coding tools in one terminal in a fallback order you choose, and when one hits its usage limit it hands the next tool a structured record of the goal, changes, blockers and next step, kept in .keepitmovin/current/handoff.md. It also says plainly that it can't copy a tool's private chat state into another tool.
  • Reinstate. Its rein handoff command starts a new Claude Code or Codex session (and a few other agents) from a structured handoff. The docs say it is "not native resume, not a transferred session, and not a lossless copy of the source transcript."

Get the plain-file version working first either way. Then you'll know what you actually want automated.

Where Factrove fits

The workflow above works with repository files. A separately shared file or an accessible URL can also carry a plan or report. The remaining problem is keeping one current reference discoverable to the people and agents that need it.

Factrove's planned role is one artifact ID with a page for people and Markdown for agents. The conversion prototype runs locally in a private repository; Factrove is not released. A factrove.md index and its format are still planned. Today, use the file workflow above.


Factrove is early and not available yet; CLI and file formats aren't final. If your team switches agents mid-task, follow me on X for rough builds, and tell me where they fall short. Read the planned artifact workflow or join the waitlist.