Why every new chat forgets your project
Keeping context between Claude Code, Cursor and Codex, so you don't have to re-explain your project every chat, means giving all three tools one shared source of project knowledge that each of them loads when a session starts. That knowledge covers your conventions, past decisions and known issues. There are two ways to do it. You can keep one instructions file that every tool reads, which is mostly AGENTS.md now. Or you can add a memory layer that records what you decide during sessions and gives each tool a short briefing.
The problem is easy to recognize. On Monday you spend twenty minutes in Claude Code agreeing to drop Redis and use SQLite for the job queue. On Tuesday you open Cursor and it suggests a Redis client. That evening, on your other laptop, Codex asks whether you use npm or pnpm. Each tool starts from zero, and none of them knows what the others learned.
Each tool does remember some things on its own, but only inside its own walls:
Claude Code loads CLAUDE.md files at the user, project and folder level. The Anthropic Claude Code memory docs say CLAUDE.md can pull in other files with
@pathimports. They also say Claude can read a repository's AGENTS.md in place of CLAUDE.md. Claude Code also has auto memory, where Claude writes notes about your corrections. It loads the first 200 lines or 25KB of those notes per repository.Cursor reads project rules from
.cursor/rulesand also reads AGENTS.md. Cursor was one of the tools that backed the AGENTS.md format when it was published in August 2025.Codex reads AGENTS.md. According to the OpenAI Codex AGENTS.md guide, it starts at the project root, walks down to your working directory, and checks each folder for
AGENTS.override.mdfirst and thenAGENTS.md. It stops adding files once they reachproject_doc_max_bytes, which defaults to 32 KiB.
The limit is the same in all three. These files only contain what someone wrote down by hand. Nobody writes "we tried Redis, the queue deadlocked under load, we switched to SQLite" into a rules file at 6pm. That kind of decision is what you end up explaining again.
Repeating yourself costs tokens too. OpenAI's tokenizer guidance says one token is roughly three quarters of an English word. So a 3,000-word notes file pasted into a chat costs about 4,000 tokens, and you pay it again in every chat and every tool. Do that across Claude Code, Cursor and Codex in a day and you hit your plan's usage limits sooner than you need to.
How to keep context between Claude Code, Cursor and Codex: four options
1. Copy the same rules into each tool's file
Most people start here. You write CLAUDE.md, copy it into .cursor/rules, and copy it again into AGENTS.md. It works for about a week. After that, someone edits one copy and not the others, and your tools start following three slightly different sets of rules. Setup is close to zero effort. The real cost is that the copies drift apart.
2. One AGENTS.md, imported or symlinked
This fixes the drift. Keep AGENTS.md as the single file. Codex and Cursor read it directly. For Claude Code, the documented pattern is a CLAUDE.md that holds one line, @AGENTS.md, which imports the shared file into Claude's context. A symlink also works on macOS and Linux. On Windows, Anthropic's docs note that symlinks need Administrator rights or Developer Mode, so the import is the easier choice there.
This is the right answer for many teams. Its weakness is the same as option 1: it holds only what you wrote down, and nothing gets added to it unless you add it.
3. An MCP memory server
All three tools support MCP, so you can connect a memory server that exposes tools such as "remember" and "recall". Now the model can save a fact in one tool and look it up in another. The catch is that the model has to decide to call those tools. In practice it often doesn't, so memories get saved unevenly. Recall also happens only after the model thinks to ask, which is usually after it has already guessed wrong.
4. A shared memory layer that captures sessions
The fourth option combines capture with a briefing. Sessions are recorded automatically. Decisions, fixes and preferences are pulled out of them and ranked, and a short summary is loaded into each tool before you type anything. Older items stay searchable over MCP. That is the approach we took with Open Agentic Brain & Memory (OpenAB).
Setting up one memory for all three tools with OpenAB
At Open Agentic Brain & Memory (OpenAB), we built a free, open-source (Apache-2.0) memory layer that runs on your own machine. It has no account and no server of ours. One store serves Claude Code, Codex, Cursor, Antigravity and Kilo Code (beta). You can read the full overview on the OpenAB project page.
Install
OpenAB needs macOS or Linux, Node 22 or newer, git and a GitHub account. The install is one command:
curl -fsSL https://raw.githubusercontent.com/rohithhn/Open-Agentic-Brain-and-Memory/main/install.sh | bash
During install you choose whether to start from the AI work you've already done or to start fresh. If you choose past work, your old sessions become the first memories. Either way, the memories live in a local SQLite database, and you can delete any of them.
What gets written to CLAUDE.md and AGENTS.md
Claude Code gets its briefing in CLAUDE.md. Codex, both the CLI and the desktop app, gets its briefing in AGENTS.md. OpenAB writes only between its own BRAIN:START and BRAIN:END markers. Anything you wrote outside those markers is left alone. The MCP wiring works the same way: it adds its own entries and doesn't touch entries it didn't create.
The global CLAUDE.md, AGENTS.md and GEMINI.md also hold a map of up to 20 of your projects. When you open a folder, that repo's history comes first, so the tool starts with the project you're actually in. OpenAB works out which project you're in by walking up to the nearest .git.
The briefing is capped at 2,000 tokens, and the start-up hook has it ready in 84 ms (p50). We also measured how much it costs to load context from a store of 10,000 memories. It takes 1,325 tokens, compared with 1,131,367 to load the whole store. On the LoCoMo benchmark, the briefing keeps 97% of the full-conversation score while reading 18% of the tokens. These are our own measurements. You can run brain eval to score recall against your own history instead of taking our word for it.
How Cursor connects
OpenAB records Cursor sessions just as it records sessions from the other tools, and Cursor searches memory over MCP. So when you decide something in Claude Code on Monday, the decision gets saved. When Cursor needs it on Tuesday, it can find it with a memory search.
How brain_recall finds older decisions
The briefing covers recent history. For anything older, any connected tool can call brain_recall, brain_remember, brain_context or load-my-brain. Search combines keyword and meaning matching. Over 10,000 memories, recall takes 28 ms (p50). You can search one project or all of them. That helps when the pnpm decision you made in one repo should apply to the next one too.
Open the local control panel once during your first week. You can read, edit, pin or delete every memory there. Pin the three or four rules you never want a tool to forget, such as "always use pnpm".
Two machines, one briefing
Sync sends a single age-encrypted file as a Release asset to a private GitHub repo that you own. The key stays in your OS Keychain and is never sent anywhere. At start-up, OpenAB merges in what your other laptops learned, so both machines get the same briefing. If the repo or your token ever leaks, all anyone gets is an encrypted file they can't read without the key. If you lose the key, nobody can recover that memory, us included.
Which approach stops you re-explaining your project?
Copied rules filesOne AGENTS.md (imported)MCP memory serverOpenAB
Setup effortMinutesMinutesModerateOne install command
Drift riskHighLowLowLow
Captures decisions automaticallyNoNoOnly when the model chooses to saveYes, from sessions
Briefing at session startWhole fileWhole file (Codex caps it at 32 KiB)NoUp to 2,000 tokens, ranked
Retrieval of older itemsNoNoYesYes, hybrid search
Works across machinesThrough gitThrough gitDepends on the serverEncrypted sync through your private GitHub repo
Where data livesYour repoYour repoDepends on the serverLocal SQLite plus your private GitHub repo
OS supportAnyAnyVariesmacOS and Linux
CostFreeFreeVariesFree, Apache-2.0
Our recommendation
A plain AGENTS.md is enough if you work alone in a single repo, change your conventions rarely, and update the file whenever you decide something. Keep it short, import it from CLAUDE.md, and you're done.
A memory layer is worth it once you switch tools during the day, work on two machines, or keep losing the reasons behind decisions. Rules files can hold instructions. A memory layer also keeps what happened, including the fixes, the dead ends, and the reason Redis was dropped. We'd keep an AGENTS.md for the rules you've written down and let OpenAB handle everything you never got around to writing.
Install Open Agentic Brain & Memory (OpenAB)
FAQ
Can Claude Code, Cursor and Codex read the same memory file, or do they need separate ones?
They can share one. Codex and Cursor read AGENTS.md. Claude Code's memory docs say it can read AGENTS.md in place of CLAUDE.md, or you can keep a one-line CLAUDE.md that contains @AGENTS.md. Either way you maintain one file, not three.
Do I need an MCP server to share context between AI coding tools?
Not for static rules, because a shared AGENTS.md covers those. You need MCP when you want a tool to search older decisions on demand. OpenAB uses both: a file-based briefing at start-up and MCP tools such as brain_recall for anything older.
Will a shared memory tool overwrite my existing CLAUDE.md or AGENTS.md?
OpenAB doesn't. It writes only between its own BRAIN:START and BRAIN:END markers and leaves everything else in the file as it was. Its MCP setup also adds its own entries without touching ones it didn't create.
Where is my project memory stored, and is it sent to a third-party server?
It lives in a SQLite database on your machine. Sync uploads one age-encrypted file to a private GitHub repo that you own, and the key stays in your OS Keychain. There is no OpenAB account or server, so nothing goes to us.
How do I keep the same AI coding memory on two machines?
Install OpenAB on both machines and connect them to the same private GitHub repo. At start-up, each machine merges in what the other learned, so both get the same briefing. You can also run brain sync, brain restore or brain merge yourself.
What happens if I use Windows or a tool that only supports MCP search, like Claude Desktop?
Windows isn't supported yet. OpenAB currently runs on macOS and Linux. Claude Desktop and ChatGPT desktop connect over MCP only. They can search your memory, but their sessions aren't recorded and they don't get a start-up briefing file.
Top comments (0)