Guides · Checked on 2026-10-04
Claude Code's memory between sessions
Every Claude Code session starts with a fresh context window. Three things carry over on their own: your
CLAUDE.md, Claude's auto memory, and a conversation you resume. Here's what each keeps, where
each stops, and what DMN adds.
1. CLAUDE.md: what you tell it
Claude Code reads your CLAUDE.md files at the start of every session. The project's
CLAUDE.md travels with the repository. ~/.claude/CLAUDE.md holds your own
instructions for every project, and CLAUDE.local.md your own for this one. /init
drafts a first one from your code.
Good for: rules and conventions: how to build and test, what not to touch, how you like changes made.
Where it stops: you write it and keep it current. It all loads into every session, so Claude Code's own docs suggest keeping each file under about 200 lines. The AGENTS.md and CLAUDE.md checker counts them for you.
2. Auto memory: what Claude notes for itself
As it works, Claude Code saves notes for itself: your role and preferences, corrections you give it, decisions
about ongoing work, and where to find things outside the project. They live in
~/.claude/projects/<project>/memory/, with a MEMORY.md index whose first 200
lines (or 25 KB) load into every session. It's on by default; /memory opens the folder and turns
it on or off.
Good for: how you like to work, without you writing it down.
Where it stops:
- By design it skips what Claude could work out from the code again, such as architecture, file paths and debugging fixes. The next session works those out again.
- It doesn't save something every session; Claude decides what's worth keeping.
- It's in your home folder on this machine, and only Claude Code reads it. Codex and Gemini CLI don't see it.
3. Resume: the conversation itself
claude --continue picks up the most recent conversation in the folder, and
claude --resume lets you choose one.
Good for: finishing a task you stopped in the middle of.
Where it stops: it brings back one whole conversation. That's heavy for remembering one fact from last week, and a fresh session in another folder, or another agent, gets none of it.
4. What DMN adds
DMN keeps what the other three don't: what agents learn about the code, readable by every agent on the project.
It doesn't replace CLAUDE.md or auto memory; its briefing arrives alongside them.
-
Notes in the project. Agents save what's worth keeping as short markdown files in the project's
.dmn/memoriesfolder: why a test is flaky, which file owns a setting, that a webhook must read the raw body. Claude Code, Codex, Gemini CLI and any agent connected to DMN read them. - A briefing at session start. Your rules first, then the newest notes. A note whose code was changed or deleted since it was written is flagged.
- Lessons from fixed errors. When sessions hit the same error and fix it the same way, DMN keeps the fix as a one-line lesson. When a command fails in Claude Code and matches a lesson, Claude Code is handed the fix straight away.
-
Past sessions you can search.
dmn memory search "<question>"finds what earlier sessions were asked, ran and concluded, from your Claude Code and Codex session logs, read on your machine. - Where you left off. With the hand-off hook, a Claude Code session's final message is saved, and the next session in the same checkout starts with it.
Agents don't always save notes unprompted, so ask at the end of a task: “save what you learned as a DMN note”. To connect Claude Code, run:
dmn skill-init --apply --agent claude dmn hook-init --apply --with-handoff
The first teaches Claude Code the dmn command line; the second adds the briefing, the lesson
hint and the hand-off. Leave out --apply to see what either would change. More on
DMN for Claude Code.
DMN for Windows is coming soon. The commands work once it's installed.
Which one to use
| CLAUDE.md | Auto memory | Resume | DMN | |
|---|---|---|---|---|
| Who writes it | You | Claude Code | Nobody: it's the conversation | Agents; lessons from fixed errors |
| What it keeps | Rules | Preferences, corrections, decisions | One conversation | Notes on the code, lessons, past sessions |
| Where it lives | The repository, or your home folder | Your home folder | Your home folder | The project's .dmn folder |
| Who reads it | Claude Code | Claude Code | Claude Code | Every agent connected to DMN |
If you use only Claude Code and mostly want it to remember how you work, CLAUDE.md and auto memory
cover it. DMN earns its place when the same facts about your code keep getting rediscovered, or when Codex or
another agent works on the same project. To share a CLAUDE.md with Codex, see
share context between Claude Code and Codex.