What goes where
What belongs in CLAUDE.md or AGENTS.md, what belongs in the cortex, and how to tell a memory from a decision or a fact, so agents find the right thing.
On this page
Agents read two kinds of things: instructions, which tell them how to work, and knowledge, which tells them what’s true and what was decided. Keep them apart and both work better.
Instructions: CLAUDE.md, AGENTS.md, GEMINI.md, Cursor rules
Each agent has a file it loads whole into every session. Keep it for how to work in the project:
- how to build, test and run it;
- the code style and the commit format;
- rules that rarely change.
Because it’s loaded whole every time, it must stay short. It’s also yours: written by you, not by agents.
Knowledge: the cortex
Everything that grows as you work goes in the cortex, where agents search it instead of loading it all:
- what was decided, and why;
- what’s true about the code and the tools, with sources;
- what was learned, what happened, how you like things done.
Agents write most of it themselves.
Point one at the other
A line in the instructions file helps agents use the cortex well:
Search memory before answering questions about past work or decisions.
Record key decisions with record_decision, and stable facts with add_fact
(with a source: a file path, a commit or a URL). Don't record what the
code or git history already says.Memory, decision or fact?
| If it is… | Save it as | Example |
|---|---|---|
| A choice that should hold from now on, with a reason | Decision | “Store times in UTC” |
| One claim that can be checked against a source | Fact | “The health check is at /health” |
| Something learned, something that happened, a preference, a how-to | Memory | “The login bug was a time zone mix-up” |
For how Claude Code’s own memory and other memory tools fit beside the cortex, see Memorinth vs other agent memory.
What not to save
- What the code already says. Function names, file layouts, signatures: the agent can read them.
- What git already says. Who changed what, and when.
- What only mattered today. A to-do for this session, a temporary workaround.
A cortex full of noise is searched less well and trusted less. A few notes that each say something the code can’t are worth more than many that repeat it.
Updated