MemoryLake
Back to all articles
TutorialJuly 29, 2026·6 min read

How to Migrate From Codex to Claude Code Without Losing Context (2026)

A lot of developers spent July reconsidering Codex. The default input context for GPT-5.6 in Codex was quietly reduced — roughly 372k tokens down to 272k, about a 27% cut, noticed through a GitHub configuration change rather than an announcement — and on long agentic tasks that means compaction arrives sooner and takes your requirements with it. If you're moving to Claude Code, you'll find the migration is mostly manual, and the part you'll miss most doesn't export at all.

The short answer: there's no importer from Codex into Claude Code. Your `AGENTS.md` translates into `CLAUDE.md` by hand, but the session-level understanding — the decisions, the corrections, the architecture the agent worked out with you — has no export, so Claude Code starts by greping your repo from scratch.

This guide covers how to move a Codex setup into Claude Code, what won't survive, and how to make the switch without re-teaching your codebase to a second agent.

Why Your Codex Context Doesn't Follow You to Claude Code

What each tool stores

Codex reads AGENTS.md at startup and holds everything else — files it opened, decisions you reached, the plan in progress — in its context window, compacting as that window fills. Claude Code works the same shape: CLAUDE.md at startup, everything else in session context. The static instruction files have direct equivalents. The dynamic understanding has no home in either, which is why neither can hand it to the other.

The technical reason it doesn't transfer

AGENTS.md and CLAUDE.md are just Markdown, so that part is copy-and-adjust. But session state is ephemeral by construction: Codex compacts it away during long tasks and discards it at session end, so there's nothing to export even if Claude Code had an importer. You're not migrating an agent's memory — you're migrating a config file and then rebuilding the memory by hand.

What this costs you

You re-onboard a second agent on a codebase the first one already understood: same conventions, same architecture walkthrough, same corrections. Everything Codex learned that never got written into AGENTS.md is simply gone. And you land in the same place you left: Claude Code is also stateless between sessions, so tomorrow it starts light too — you changed tools without changing the underlying problem.

Step-by-Step: Moving From Codex to Claude Code by Hand

The native route is manual, but it gets the essentials across.

Step 1: Extract what Codex holds

  1. Copy your AGENTS.md — the conventions, commands, and constraints the agent was following.
  2. Review recent Codex sessions and write down the decisions and constraints that never made it into the file: rejected approaches, architectural choices, known traps.
  3. Note the MCP servers and tooling your Codex setup relied on.

Step 2: Set up Claude Code

  1. Create or update CLAUDE.md at the repo root with your conventions, adjusted from AGENTS.md.
  2. Add the salvaged decisions and constraints into CLAUDE.md or a docs file Claude Code will read at startup.
  3. Re-add your MCP servers to Claude Code's MCP configuration.

What you get is a translated baseline: a config file plus whatever context you remembered to salvage. There's no session-history transfer, and nothing here stays in sync if you keep Codex around for some work.

What doesn't survive the migration

Session-level project understanding that never reached a file. The reasoning behind past fixes. And the durability problem itself: both agents compact and discard, so a file you hand-maintain is the only thing either one reliably starts with — until you add a layer that outlives sessions in both.

The Better Way: One Memory Layer, Either Agent

The migration is only painful because each agent's knowledge dies inside it. Put project knowledge in a neutral layer and the switch becomes a connection. MemoryLake stores your architecture, decisions, and conventions once — searchable, versioned Git-style, end-to-end encrypted — and serves them to Claude Code and Codex alike over MCP, so neither one starts blank and switching costs nothing.

DimensionManual Codex → Claude CodeMemoryLake layer
Steps requiredTranslate config + salvage by hand3 (one-time)
Session-level understandingMostly lostRetained and searchable
Survives compactionNoYes (retrieved on demand)
Stays in sync during a gradual switchNoYes
Decision historyNoneYes (Git-style)
Switching or adding an agent laterTranslate againConnect it

Step 1: Create an API key

Sign in to MemoryLake, generate a key, and make your first request — it takes about 30 seconds.

Create a MemoryLake API key
Create a MemoryLake API key

Step 2: Upload your first memories

Drop in the project knowledge both agents need: architecture notes, decision records, conventions, and API docs — documents, images, and other files all work — instead of trapping them in one tool's config file.

Upload your first memories to MemoryLake
Upload your first memories to MemoryLake

Step 3: Connect your AI & agents

Both agents speak MCP: add MemoryLake to Claude Code's MCP configuration and to Codex's with your API key. During a gradual switch neither falls behind, and the same memory reaches OpenClaw and other MCP-capable agents — so your next tool connects instead of restarting.

Connect your AI and agents via MCP
Connect your AI and agents via MCP

What Re-Onboarding an Agent Actually Costs

The switching tax, paid twice

Moving agents means re-teaching a codebase the previous one knew — and then paying the daily version of it, because the new agent also rediscovers your repo each session. In usage-billed tools, that rediscovery is tokens spent before any work happens.

Retrieval instead of re-onboarding

With a shared layer, Claude Code pulls your conventions and decisions on demand instead of reconstructing them, so it's informed on day one and stays informed after compaction. Faster starts, fewer repeated corrections, lower spend — MemoryLake's Token Saving Calculator projects the effect from your usage.

Best Practices for a Cross-Agent Memory

Salvage before you switch

The session knowledge Codex holds is the part that vanishes at cutover. Capture it into the shared layer first, and the migration loses nothing.

Keep conventions in the repo, decisions in the layer

CLAUDE.md and AGENTS.md are good homes for stable conventions each tool reads at startup. Dated decisions, rejected approaches, and resolved issues belong in retrievable memory, where compaction can't drop them.

Scope by repository

One memory scope per repo keeps both agents' context precise and stops one project's conventions from leaking into another's.

Conclusion

Switching from Codex to Claude Code is a config translation plus a memory you rebuild by hand — and if you stop there, you've moved the problem, not solved it, because the new agent forgets between sessions exactly like the old one. Put your project's knowledge in a layer both agents read, and the switch is a connection: informed sessions on day one, decisions that survive compaction, and no re-teaching the next time you change tools. Migrate the config; keep the memory.

Frequently asked questions

Can I import my Codex setup into Claude Code?

No. AGENTS.md can be translated into CLAUDE.md by hand, but session state is ephemeral in both tools — there's nothing to export, and Claude Code has no importer for Codex context.

Is translating AGENTS.md to CLAUDE.md enough?

It moves the static conventions, which is the easy part. Decisions, rejected approaches, and the project understanding built during sessions never lived in that file, so they need salvaging or a shared memory layer.

Why did my Codex context get worse in July 2026?

Developers documented a reduction in the default configured input context for GPT-5.6 in Codex — roughly 372k to 272k tokens — surfaced via a GitHub configuration change. Less room means compaction triggers earlier in long tasks, dropping requirements and decisions sooner.

Will Claude Code remember my project after I switch?

Not by itself. It reads CLAUDE.md at startup and rebuilds the rest from your repo each session — see why Claude Code forgets project context. A persistent layer is what makes sessions start informed.

Can I run Codex and Claude Code side by side?

Yes, and it's the smoother path. With a shared memory over MCP both stay current, so you can shift work gradually instead of cutting over — and compare them on equal footing. Related: adding memory to Claude Code.