
The Memory Wars of Four AI Coding Assistants
You thought CLAUDE.md was just a config file? It decides whether your Agent recognizes you. Four tools, four completely different memory designs. Pick the wrong one, and you're starting over with an amnesiac assistant every day.
Same Format, Completely Different Under the Hood
In 2026, four major AI coding CLI tools all arrived at the same conclusion: use Markdown files as the Agent instruction system.
| Tool | Instruction File | Global Location | Project Location |
|---|---|---|---|
| Claude Code | CLAUDE.md |
~/.claude/CLAUDE.md |
Project root + .claude/rules/*.md |
| Codex CLI | AGENTS.md |
~/.codex/AGENTS.md |
Git root to CWD, layer by layer |
| Copilot CLI | Multi-format | ~/.copilot/copilot-instructions.md |
.github/copilot-instructions.md + AGENTS.md |
| Gemini CLI | GEMINI.md |
~/.gemini/GEMINI.md |
Recursive project tree scan |
Claude Code is a library with labeled floors. @import syntax pulls in external files from the main document. .claude/rules/ auto-loads rules on startup. Subdirectory CLAUDE.md files only trigger when you walk into them. Take what you need, leave the rest.
Codex CLI does the opposite. It collects every AGENTS.md from global to CWD, chains them into one long instruction string, and dumps it all in at session start. Efficient enough, but there's a hard 32 KiB cap. Overshoot it and the rest gets cut.
Copilot CLI is unusual. Since August 2025, it reads AGENTS.md, CLAUDE.md, and GEMINI.md simultaneously, no format preference. Your team has Claude users and Codex users? Share the same instruction file.
Gemini CLI is the most aggressive. It recursively scans the entire project tree at startup, inhaling every GEMINI.md it finds. Behind it sits a 1M token stomach that barely notices the bulk.
I've used all four for extended periods. The biggest day-to-day difference isn't how smart the model is. It's whether it remembers me.
Three Watersheds You Probably Haven't Thought About
@import: Modular or Monolithic
Claude Code and Gemini CLI support @import, so the main file can be broken into manageable pieces, each maintained separately. Codex CLI and Copilot CLI can't do this. You either cram everything into one file or rely on directory-based auto-concatenation.
My CLAUDE.md main file is 80 lines. The actual rules are spread across a dozen files in the rules directory, about 3,000 lines total. Three months ago I didn't think this mattered. Now I know better.
Cross-Session Memory: Who Remembers What You Said Yesterday
| Tool | Cross-Session Mechanism | Storage Location |
|---|---|---|
| Claude Code | autoMemory snapshots | Configurable local directory |
| Codex CLI | memories.jsonl + summaries | ~/.codex/memories/ |
| Copilot CLI | None | You update instruction files manually |
| Gemini CLI | save_memory tool |
Writes back to ~/.gemini/GEMINI.md |
Copilot CLI is the only tool with no cross-session memory. Every conversation is a first date. The preferences you shared, the mistakes you flagged, the rapport you built? Next session, all gone. Sounds minor, but after two weeks you start feeling like you're talking to a goldfish.
The Token Ceiling: How Long Can Your Instructions Be
Claude Code's 200K context paired with the community-recommended < 200 lines for CLAUDE.md. Precision-first: every token should earn its keep.
Gemini CLI? 1M tokens. You could theoretically shove the entire War and Peace in there without it breaking a sweat.
Codex CLI is strictest: 32 KiB hard cap. Go over, it truncates. No negotiation.
But a bigger window doesn't mean better compliance. I tested this by bloating my CLAUDE.md from 80 lines to 400. Claude started missing rules. Anthropic's own documentation acknowledges this: bloated instruction files cause models to ignore instructions. The shorter, the more obedient.
Memory Is Part of the Harness, Not a Plugin
Letta CTO Sarah Wooders said it well:
Asking to plug memory into an agent harness is like asking to plug driving into a car.
How are system prompts loaded? When does conversation history get compressed? What survives into the next session? These "invisible decisions" are all made by the harness. You think you're comparing config file formats. You're actually comparing four memory designs.
LangChain founder Harrison Chase was more direct: if you don't own your harness, you don't own your memory. Memory inside a closed platform is opaque and non-portable. You spent three months teaching your Agent your coding style and project context. Switch tools? Back to zero. Start over.
He learned this the hard way. An Email Agent he'd used for months was accidentally deleted by a colleague. The rebuilt version was terrible. Wrong tone, no preferences, recipient sorting logic had to be retaught from scratch. He said that moment was when he realized how valuable memory actually is.
I had a similar experience. Switched toolchains once, and three months of memory settings had to be rebuilt from nothing. It felt like moving to a new house where everything is still in boxes and you can't find anything.
So How Do You Actually Choose
The most important thing: make sure the memory format is something you can read and move. Claude Code's autoMemory writes to local disk. Codex CLI's memories.jsonl is plaintext JSON. Gemini CLI writes directly back to Markdown. These are files you can open and understand. If memory is locked behind an API you can't see, it's not your memory.
Another easy mistake: writing instruction files that are too long. Even with a massive context window, bloated instructions mean diluted compliance. Keep the main file under 100 lines. Split details into @import targets or rules directories.
Models can be swapped. Harnesses are painful to replace. But once the memory between you and your Agent breaks, no tool can get it back. I only really understood this after losing it once.
References
- AI Coding CLI Configuration & Memory Loading Mechanism Comparison (2026-05-10).
- Your harness, your memory — Harrison Chase (LangChain, 2026-04-04).
- Why memory isn't a plugin (it's the harness) — Sarah Wooders (Letta, 2026-03-31).
- Claude Code Settings Docs — code.claude.com/docs/en/settings.
- OpenAI Codex AGENTS.md Docs — developers.openai.com/codex/guides/agents-md.
- Gemini CLI GEMINI.md Docs — google-gemini.github.io/gemini-cli/docs/cli/gemini-md.html.
- GitHub Copilot CLI Custom Instructions — docs.github.com/en/copilot.
Frequently Asked Questions
What's the difference between CLAUDE.md and AGENTS.md?
CLAUDE.md is Anthropic's Claude Code instruction file, supporting @import modularity and .claude/rules/ directory. AGENTS.md is OpenAI's Codex CLI instruction file, concatenated from Git root to CWD with a hard 32 KiB size limit.
Why does Copilot CLI support both CLAUDE.md and AGENTS.md?
Since August 2025, GitHub Copilot CLI adopted a compatibility strategy, reading multiple formats simultaneously so mixed teams can share instruction files.
Does cross-session memory really matter?
Absolutely. An Agent without cross-session memory treats every conversation as a first meeting, unable to learn your preferences and work style.
Does Gemini CLI's 1M token context mean instruction length doesn't matter?
In theory yes, but larger context doesn't guarantee better instruction following. Concise instructions yield higher compliance. The big window advantage is loading more code and docs simultaneously.
Found this useful?
Follow for new AI × biomedical research notes:
Or buy me a coffee to keep new content coming.
☕ Buy Me a Coffee