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

  1. Run /memory. It shows whether auto memory is on and has an option to open its folder. Everything in there is plain Markdown.
  2. Look for an override. Search for autoMemoryEnabled in ~/.claude/settings.json and the project’s .claude/settings.json, and run echo $CLAUDE_CODE_DISABLE_AUTO_MEMORY.
  3. 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 claude directly in your terminal and toggle it there.
  4. Measure the index. wc -l -c ~/.claude/projects/*/memory/MEMORY.md. Anything past 200 lines or 25 KB isn’t loaded.
  5. 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.md to 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. autoMemoryDirectory in 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.

Questions

Where does Claude Code store its memory?

In ~/.claude/projects/<project>/memory/. MEMORY.md is the index, with one topic file per memory beside it. The project path comes from the git repository, so all worktrees and subdirectories of a repo share one folder. You can move it with the autoMemoryDirectory setting.

How do I turn auto memory on or off in Claude Code?

Run /memory and use the toggle, which saves autoMemoryEnabled to ~/.claude/settings.json. Setting it to false in a project’s settings turns it off for that project, and CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 turns it off through the environment.

Why didn’t Claude Code save what I told it?

It doesn’t save something every session. It decides what would be useful later, and it skips what it can work out from the code, such as architecture, file paths and debugging fixes, along with anything your CLAUDE.md already says. To be sure, ask it directly: “remember that the API tests need a local Redis”.

How much of MEMORY.md does Claude Code load?

The first 200 lines or the first 25 KB, whichever comes first. Topic files aren’t loaded at startup: Claude reads them when it needs them.

Does Claude Code memory sync between computers?

No. Auto memory is machine-local and isn’t shared across machines or cloud environments. Put anything that must travel in a CLAUDE.md in the repository.

Do subagents get auto memory?

Not the main conversation’s. The exception is a fork, which inherits the parent conversation. A subagent can have its own separate memory through its memory field.

Stop explaining your day to ChatGPT

Install it, connect the apps you use, and get on with your work. Free for 14 days, no card.