← Blog · 2026-10-20
Claude Code Auto Memory Not Working? 12 Causes and Fixes
Shortcut: anything Claude must know in every session belongs in a CLAUDE.md you write, not in auto memory. Our free CLAUDE.md generator builds one from a short form in your browser. If your CLAUDE.md itself is being ignored, see CLAUDE.md or .claude/rules not working? 12 causes and fixes.
Claude Code carries knowledge across sessions in two ways:
| CLAUDE.md files | Auto memory | |
|---|---|---|
| Who writes it | You | Claude |
| Where it lives | ./CLAUDE.md, ./.claude/CLAUDE.md, ~/.claude/CLAUDE.md and others |
~/.claude/projects/<project>/memory/ |
| What loads at session start | The whole file (files over 4 MiB are skipped) | The first 200 lines or 25KB of MEMORY.md, whichever comes first |
| Default | Loads when present | On in local sessions |
Auto memory is a folder of plain Markdown notes: a MEMORY.md index with one line per memory, plus topic files such as feedback_testing.md. Claude saves four kinds of notes: user (your role and preferences), feedback (corrections and approaches you confirmed), project (ongoing work and decisions it can't get from the code or git history) and reference (where to find things outside the project).
First: see what's there
Run /memory. It shows the auto memory toggle and has an option to open the auto memory folder, so you can read exactly what was saved. Run /context to see which CLAUDE.md and auto memory files loaded into the current session. While Claude works with memory you see messages such as "Saved 2 memories" or "Recalled 2 memories".
If the folder is empty, Claude never saved anything (checks 1-7 and 10). If it has the note but Claude doesn't act on it, see checks 8, 9, 11 and 12.
Nothing gets saved or loaded: 7 causes
- Auto memory is turned off in settings. The
/memorytoggle savesautoMemoryEnabledto your user settings at~/.claude/settings.json, and the key can also sit in a project's.claude/settings.jsonor.claude/settings.local.json. Withfalse, Claude doesn't read from or write to the memory folder. Fix: turn the toggle back on in/memory, and look for"autoMemoryEnabled": falsein each settings file. A project-levelfalseis the documented way to turn it off for one project only. - An environment variable or launch mode overrides the setting.
CLAUDE_CODE_DISABLE_AUTO_MEMORY=1turns auto memory off and takes precedence overautoMemoryEnabledfor that session.--bare(which setsCLAUDE_CODE_SIMPLE) and--safe-mode(orCLAUDE_CODE_SAFE_MODE=1) skip auto memory along with CLAUDE.md, andCLAUDE_CODE_DISABLE_CLAUDE_MDS=1stops user, project and auto memory files from loading. Fix: check your shell profile, CI config and theenvblock of your settings files.CLAUDE_CODE_DISABLE_AUTO_MEMORY=0forces auto memory on even when--bareorautoMemoryEnabled: falsewould turn it off. - The session can't turn it back on. In a background session, or a session another Claude Code session started (for example when Claude runs
claudethrough its Bash tool), the toggle can turn auto memory off but not on. It readsoff · can't be turned on here; use a session started outside Claude Code. Fix: runclaudedirectly in your terminal and use the/memorytoggle there. - It's a self-hosted environment. Auto memory is on by default in local sessions, but a session in a self-hosted environment runs with it off by default (Claude Tag sessions are the exception). Memory is also machine-local: files aren't shared across machines or cloud environments. Fix: put anything that must follow you between machines in a CLAUDE.md that's committed to the repository.
- You're in a different project folder. Each project gets its own memory folder, keyed by the git repository, so all worktrees and subfolders of one repo share it. Outside a git repo, the folder is keyed by the project root instead, so starting Claude Code from a different folder means a different, possibly empty, memory. Fix: start Claude Code inside the same repository. To share one memory across launches on purpose, set
CLAUDE_CODE_PROJECT_DIR_NAMEtogether withCLAUDE_CONFIG_DIR(v2.1.234 or later); memory then lives under that config directory'sprojects/folder. autoMemoryDirectorypoints somewhere that's ignored. You can move memory withautoMemoryDirectory, which must be an absolute path or start with~/. Set in a project's.claude/settings.jsonor.claude/settings.local.json, it's honored only under the same workspace trust rule as hooks. Whilepermissions.blockReadsOutsideWorkingDirectoriesis on, a directory chosen by a repository-supplied settings file loads no memory and gets none saved to it. Fix: setautoMemoryDirectoryin~/.claude/settings.jsoninstead, with an absolute or~/path.- The notes were deleted. Auto memory files are plain Markdown that you or Claude can edit or delete. The cleanup sweep that removes old session transcripts after
cleanupPeriodDaysskips the memory folder, but before v2.1.228 it could delete files in folders inside the memory directory. Fix: update Claude Code (claude --versionshows your version), and treat memory as notes, not a backup. Facts you can't afford to lose go in CLAUDE.md.
Saved, but Claude doesn't recall it: 5 causes
MEMORY.mdis over its read limit. Only the first 200 lines or 25KB ofMEMORY.md, whichever comes first, load at session start; anything past that is dropped every time. When a write leaves the index over a limit, Claude Code sends Claude an error such asthis write left the memory index at MEMORY.md at 214 lines, over its 200-line read limit. It goes to Claude after the write, not as a banner in your terminal, so you may only see it in the transcript. Before v2.1.210 an over-limit index was cut off silently. Fix: ask Claude to rewriteMEMORY.md: one line per entry, detail moved into topic files, stale entries merged or dropped. YAML frontmatter and block-level HTML comments don't count toward the limit (from v2.1.211).- The note is in a topic file. Topic files such as
feedback_testing.mddon't load at startup. Claude reads one on demand, with its normal file tools, when the task seems to need it. Fix: make sureMEMORY.mdhas a line pointing to the topic, or ask directly: "check your memory for how we run tests". If Claude needs it every time, move it into CLAUDE.md. - Claude decided not to save it. Claude doesn't save something every session; it keeps what it judges useful in a future conversation. It skips anything it can work out from the codebase, such as architecture, file paths or debugging fixes, and anything your CLAUDE.md files already say. Fix: say it outright: "remember that the API tests need a local Redis instance". That goes to auto memory. To put an instruction in CLAUDE.md instead, say "add this to CLAUDE.md" or edit the file yourself through
/memory. - A subagent is doing the work. Subagents don't get the main conversation's auto memory; the exception is a fork, which inherits the parent conversation. A subagent can keep its own memory with the
memoryfield in its frontmatter:user(~/.claude/agent-memory/<name>/),project(.claude/agent-memory/<name>/) orlocal(.claude/agent-memory-local/<name>/). It has no effect while auto memory is off. Fix: addmemory: projectto the subagent and tell it in its prompt to check and update its memory. Our free subagent builder writes the file. - It was only said in conversation. After
/compact, auto memory and your project-root CLAUDE.md are re-read from disk, but instructions you only typed in chat get summarized with the rest of the conversation. Fix: ask Claude to remember the instruction, or add it to CLAUDE.md, so it's on disk and survives compaction.
Memory is context, not a rule
Claude treats both CLAUDE.md and auto memory as context, not enforced configuration, and specific, concise notes are followed more consistently. If something must happen at a fixed moment, such as a check before every commit, make it a hook; hooks run as shell commands whatever Claude decides. For something that must never happen, use a permissions.deny rule (permissions builder).
Quick reference
| Symptom | Likely cause | Fix |
|---|---|---|
| Memory folder empty, toggle off | autoMemoryEnabled: false |
Toggle on in /memory; check every settings file |
| Toggle on, still nothing | CLAUDE_CODE_DISABLE_AUTO_MEMORY, --bare, safe mode |
Unset, or CLAUDE_CODE_DISABLE_AUTO_MEMORY=0 |
| "can't be turned on here" | Background session or one started by Claude | Run claude directly in a terminal |
| Memory gone in another folder or machine | Memory is per repository and machine-local | Same repo; shared facts in committed CLAUDE.md |
| Old entries ignored | MEMORY.md past 200 lines or 25KB |
One line per entry, detail in topic files |
| Detail not recalled | It's in a topic file read on demand | Ask Claude to check memory, or move it to CLAUDE.md |
| Subagent doesn't know | Subagents don't load your memory | memory: project in the subagent |
Facts on this page come from Anthropic's Claude Code docs on memory, the settings reference, environment variables, the CLI reference, error messages, subagents, the .claude directory, the context window and debugging your configuration. This guide isn't affiliated with Anthropic.