Module 8 of 10
The Memory System
set up persistent memory that survives across sessions. After this module, Claude won't just know your preferences — it'll know your context, your projects, your decisions, and the things you've explicitly asked it to remember.
The Problem Memory Solves
Right now, your Claude Code setup has two kinds of knowledge:
- CLAUDE.md — your preferences, behaviour rules, work domain. Loaded every session.
- Skills — structured instructions for specific tasks. Loaded when invoked.
Both are things you wrote in advance. They're static. Claude reads them but doesn't add to them.
Here's what's missing: the things that emerge during work. A decision you made last Tuesday about how to structure a project. Feedback you gave Claude about how you prefer error messages formatted. A reference URL you'll need again in three weeks. The name of a colleague Claude should know about.
Without memory, this knowledge evaporates when the session ends. Next session, you explain it again. And again.
Memory changes this. It gives Claude a place to store and retrieve information across sessions — things you tell it to remember, patterns it notices about your work, project context that accumulates over time.
Memory is for the things that aren't written down anywhere else — the decisions, preferences, and context that would otherwise exist only in your head.
Here's how the whole system flows:
How It Works (Simple Version)
Claude Code has a built-in memory system using simple files stored alongside each project. It's on by default — Claude automatically saves useful notes for itself (build commands, debugging insights, your preferences) as you work. You can also tell it to remember specific things.
Memory is a folder of plain text files, each containing one piece of information. Claude reads a table of contents of these files at the start of every session (lightweight — just the list, not every file's content). When it needs specific information, it reads the relevant file.
When you tell Claude to remember something, it creates a new memory file and adds it to the index. When you tell it to forget something, it removes it.
That's the core mechanism. The setup prompt configures all of this for you. Here's what it creates and how it works.
How Memory Is Structured
The folder structure
Claude Code's auto-memory uses a project-scoped memory directory. It stores memories in:
The main file is MEMORY.md — an index that lists all your memories with short descriptions. Claude reads this file at session start. Individual memories are stored as separate files in the same directory.
Memory types
Claude's auto-memory is free-form — Claude decides what to save and how to organise it. But we recommend sorting memories into four types, which helps keep things findable as your memory grows:
| Type | What it stores | Example |
|---|---|---|
| User | Facts about you | "Priya is a freelance writer. Prefers concise suggestions." |
| Feedback | Corrections that should persist | "Don't rewrite my paragraph — just fix the specific thing." |
| Project | Ongoing work context | "GreenLeaf proposal due March 20. Casual tone." |
| Reference | Pointers to external resources | "Brand guidelines in the shared Google Drive folder." |
Creating memories
In any Claude Code session, you can say:
Claude creates a memory file with this information, categorises it (this would be a "feedback" type), and adds it to the MEMORY.md index. Next session, Claude knows this.
You can also be more explicit:
Claude stores this as a project memory with the context about why.
Retrieving memories
Claude automatically checks relevant memories when they might be useful. But you can also ask directly:
Claude searches its memory and returns what it finds.
Forgetting
Claude finds the relevant memory and removes it.
The Memory Index (MEMORY.md)
The MEMORY.md file is the table of contents for Claude's memory. It's loaded into every conversation, so it needs to stay concise. Here's what a healthy MEMORY.md looks like:
Each line is a pointer to a detailed memory file. Claude reads the index to know what memories exist, then reads specific files when they're relevant to the current task. This keeps token cost low — the index is typically 200-400 tokens, and individual memories are only loaded when needed.
Memory Hygiene
Memory grows over time. Without maintenance, it becomes cluttered with outdated information — old project decisions, completed tasks, feedback that's already been incorporated into your CLAUDE.md.
A few habits to keep it useful:
Review quarterly. Skim through your MEMORY.md and ask: is this still true? Is this still relevant? Remove anything that's outdated.
Move stable patterns to CLAUDE.md. If a feedback memory has been useful for months ("always use British English"), it belongs in your CLAUDE.md where it's loaded directly, not in memory where it has to be searched.
Keep the index under 200 lines. After 200 lines, the token cost of loading the index starts to add up. If you're approaching that, it's time to clean up.
Date your project memories. Projects change. Date them so you know when to clean them out.
What Memory Is NOT
Let's be clear about the boundaries:
| Memory is NOT... | Use this instead |
|---|---|
| A database | Files and folders for structured data |
| Version control | Git for tracking code changes |
| A task list | Claude Code's built-in task tracking |
| Documentation | The codebase itself — Claude can read it directly |
Memory is for the things that aren't written down anywhere else. The decisions, preferences, context, and corrections that would otherwise exist only in your head — and that Claude needs to know to work well with you.
Token Cost of Memory
Let's quantify it:
- MEMORY.md index (loaded every session): ~200-400 tokens depending on how many memories you have
- Individual memory files (loaded on demand): ~50-150 tokens each, only when relevant
- Typical session: index + 1-2 relevant memories = ~400-700 tokens
Compare this to the alternative: manually re-explaining context every session, which easily costs 500-1,000 tokens and often requires multiple rounds of clarification.
Memory pays for itself from the first session where Claude remembers something you would have had to re-explain.
Claude now has a memory that persists. Your preferences, your project context, your feedback — it all carries forward. Combined with the CLAUDE.md (how to behave), skills (how to perform tasks), and hooks (what to automate), your Claude Code setup is starting to feel less like a tool and more like a colleague who's been with you for a while.
One major piece left: agents. Module 9 gives Claude a team.