Guide
Claude Code auto memory not working? Causes and fixes
Claude Code didn’t save what you said, or a new session acts like it never happened. Here is where the memory files live, what loads when, and how to fix each reason it fails.
Checked against Anthropic’s How Claude remembers your project on November 3, 2026. Claude Code changes often, so run claude update if yours behaves differently.
How it works
Claude Code has two kinds of memory, and each starts every session a different way:
- CLAUDE.md is what you write: instructions and rules. It’s loaded in full, up to 4 MiB a file.
- Auto memory is what Claude writes: your role and preferences, corrections you gave, decisions the code doesn’t show, and where to find things. The first 200 lines or 25 KB of its index,
MEMORY.md, are loaded.
When it’s working, you’ll see “Saved 2 memories” or “Recalled 2 memories” in the session.
The two-minute check
- Run
/memory. It shows whether auto memory is on and has an option to open its folder. Everything in there is plain Markdown. - Look for an override. Search for
autoMemoryEnabledin~/.claude/settings.jsonand the project’s.claude/settings.json, and runecho $CLAUDE_CODE_DISABLE_AUTO_MEMORY. - Is this a normal session? Self-hosted environments run with auto memory off by default. In a background session, or one started by another Claude Code session, the toggle can turn it off but not back on. Run
claudedirectly in your terminal and toggle it there. - Measure the index.
wc -l -c ~/.claude/projects/*/memory/MEMORY.md. Anything past 200 lines or 25 KB isn’t loaded. - Ask it. In a new session: “What do you remember about this project, and which file did it come from?”
It isn’t saving
- It decided not to. The docs are clear that Claude doesn’t save something every session. It keeps what would be useful in a future conversation.
- The code already says it. It skips what it can derive from the codebase, including architecture, file paths and debugging fixes. It also skips what your CLAUDE.md files already say. If a fix has to be remembered, say why it isn’t obvious.
- You didn’t ask. “Always use pnpm, not npm” or “remember that the API tests need a local Redis” saves to auto memory directly. If you want it in CLAUDE.md, say “add this to CLAUDE.md”.
- Auto memory is off for one of the reasons in the check above.
It saved but doesn’t use it
- The index is too long. Past 200 lines or 25 KB, nothing further loads at session start. Ask Claude to shorten
MEMORY.mdto one line per entry and move detail into topic files. - It’s in a topic file. These load on demand, not at startup. Claude has to judge from the index that one is relevant, so a vague index line means a missed file. Rewrite the line to say when it applies.
- You’re in a subagent. The main conversation’s auto memory isn’t loaded into subagents, except forks.
- It’s context, not configuration. Memory is something Claude reads and weighs, not a rule it’s forced to follow. See below.
The files seem to be missing
- A different project folder. The path comes from the git repository, and outside git from the project root. All worktrees of a repo share a folder, but a fresh clone at another path, or a folder that isn’t in git, can get a different one. Look under
~/.claude/projects/. - Another machine. Auto memory is machine-local. It doesn’t follow you to a laptop or a cloud session.
- A moved directory.
autoMemoryDirectoryin any settings file changes the location. The value must be an absolute path or start with~/.
Memory files aren’t removed by the session transcript cleanup (cleanupPeriodDays). They stay until you or Claude edits or deletes them.
It ignores a rule
If Claude Code knows the rule and breaks it anyway, the problem isn’t memory. Make the instruction specific and short, and run /context to confirm your CLAUDE.md actually loaded. If an action must never happen, use a PreToolUse hook, because hooks are enforced and memory isn’t.
An instruction that vanished after /compact was probably only in the conversation. The project-root CLAUDE.md is re-read after compaction, but what you only said in chat isn’t. /compact vs /clear has more.
What it can’t remember
Even working perfectly, auto memory only knows what happened in Claude Code on this machine. The decision from a call, the bug report in your email and what you worked out with Codex yesterday were never in front of it, so you end up explaining them again.
Cachejay keeps those as you work on your Mac and lets Claude Code search them over MCP. It also keeps your Claude Code and Codex sessions, so one agent can find what another was told, and they aren’t tied to one machine. See how to make Claude Code remember between sessions and the best memory MCP servers for Claude Code, which compares it with the alternatives.