Auto memory wrote 40 files about your project: which are worth keeping?
Published · Updated
Open ~/.claude/projects/<project>/memory/ and you will find them: a MEMORY.md index plus one markdown file per thing Claude decided to remember. Keep the ones that are true, short and not derivable from the code, edit the ones that are half right, and delete the rest. This page gives the facts you need first, then a ten-line audit.
What the docs say, and what they do not
These are the claims the blogs repeat, checked against the memory page and the settings reference as of 2026-11-10.
| Claim | Docs say |
|---|---|
| On by default | Yes, "in local sessions". A session in a self-hosted environment runs with it off by default |
| Location | ~/.claude/projects/<project>/memory/, derived from the git repository, so all worktrees of one repo share a directory |
| Index limit | "The first 200 lines of MEMORY.md, or the first 25KB, whichever comes first" load at the start of every conversation |
| 4 MiB | Applies to CLAUDE.md files, not to MEMORY.md: a CLAUDE.md over 4 MiB is skipped entirely |
| Since v2.1.59 | Not in the docs. The changelog lists "Claude automatically saves useful context to auto-memory. Manage with /memory" under 2.1.59 |
| Deleted by the 30-day sweep | No: memory files are excluded from the retention sweep and stay until you or Claude edit or delete them |
Topic files are not loaded at startup. Claude reads them on demand. Only the index is always in context, which is why the index is the thing to keep clean. The docs add that after a write that leaves MEMORY.md near a limit, Claude Code reminds Claude to shorten it, and over the limit it returns an error telling Claude to rewrite the index, because everything past the limit is dropped on the next load.
Users hit that ceiling. #79217 (open) asks for the limit to be configurable and describes a project with about 500 memory files whose index was 17KB across only 41 lines, so the byte cap bound first. That is one team's report of its own project. Across 179 indexes on one Mac the largest is 105 lines and 24,629 bytes, the same pattern: bytes run out before lines do.
Audit the directory
The audit needs no tools beyond the shell. Run it from any directory.
root=~/.claude/projects
# index size per project, biggest last
find "$root" -name MEMORY.md -path '*/memory/*' -exec wc -lc {} + | sort -n | tail -5
# topic files the index never mentions
find "$root" -path '*/memory/*.md' ! -name MEMORY.md | while read -r f; do
grep -q "$(basename "$f")" "$(dirname "$f")/MEMORY.md" 2>/dev/null || echo "$f"
done
# files untouched for 90 days
find "$root" -path '*/memory/*.md' -mtime +90
In a scratch directory in the documented layout, with one index and three topic files, the second command flagged the one file the index did not mention. On a real directory of 677 topic files it found 4 that no index listed. Those are the cheapest deletions, because Claude would not have found them either, except by listing the folder.
The docs say a memory file that begins with YAML frontmatter gets a modified timestamp when Claude writes it. None of 677 topic files on one Mac had one, so file modification time is the date you have. Do not build an audit on modified unless you see it in your own files.
Decide file by file
Read each topic file and ask four questions. Is it still true? Could Claude learn it from the repository in thirty seconds? Is it a preference of yours or a fact about the project? Would it hurt if it were wrong? A memory about a preferred test runner is cheap to keep. A line that tells Claude to distrust something is not, and a poisoned entry gets re-read every session.
Things that tend to age badly are workarounds for a bug that has since been fixed, names of branches, and anything that records a date or version. Things that last are your corrections to Claude's habits and the odd convention the codebase does not show.
If a file survives but is too long, split the facts into one line each in the file and keep the index entry to a single line. The docs ask for exactly that: one line per entry, detail in topic files.
Find where an entry came from
An entry you cannot explain is the one to check first. Claude wrote it with a Write call, so the transcript for that session has a tool_use block naming the file. This finds the session and the time.
grep -l 'memory/feedback_testing.md' ~/.claude/projects/<project>/*.jsonl
jq -r 'select(.type=="assistant") | .timestamp as $t | .sessionId as $s
| .message.content[]? | select(.type=="tool_use" and (.input.file_path? // "" | endswith("feedback_testing.md")))
| [$t,$s,.name] | @tsv' SESSION.jsonl
On the fixture it returned the Write call with the session ID and time. Then read the turns before it to see what you actually said. This has a limit: transcripts are swept after 30 days by default and memory is not, so old entries may have lost their evidence. On this Mac, 51 of 60 sampled files had a transcript naming them, and the other 9 did not. That sample counted any transcript mentioning the file name, so it overstates.
Sealkeep keeps sealed copies of sessions, and sealkeep search <query> --content can find the session from what was said, even after the original was swept. It does not review the memory files and does not tell you which are right, and it cannot restore sessions deleted before it ran.
Turning it off
You have three switches. /memory toggles it and saves autoMemoryEnabled to ~/.claude/settings.json. That same key in a project's settings turns it off for that project, and CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 turns it off by environment. In a scratch run the model followed a line in the index, and with the variable set it did not. #23544, "Need ability to disable auto-memory (MEMORY.md)", is the early request for a switch, and it is closed. If you move the directory with autoMemoryDirectory, the audit above needs the new root.
How auto memory compares with CLAUDE.md and MCP memory servers is in memory between sessions, and the others are listed at /guides/.
FAQ
Is auto memory the same as the /memory command?
They differ. /memory lists your CLAUDE.md files and opens the auto memory folder, and it holds the toggle. The memory itself is the files in the folder.
Can I commit the memory folder to git?
It is machine-local by design, and the docs say files are not shared across machines or cloud environments. Copying the folder into a repo is possible, but the docs do not describe it, and #24382 is a request about sharing it across worktrees.
Why did Claude stop saving things?
Claude does not save every session. The docs say it decides what is worth remembering. Also check that you are not in a background session or one started by another Claude session, where the toggle can be off and cannot be turned back on.
How big is too big for MEMORY.md?
The loaded part stops at 200 lines or 25KB, whichever comes first, so past that Claude does not see the rest at session start. Keep entries to one line and move detail into topic files.
Does deleting a topic file break anything?
The docs call the files plain markdown you can edit or delete at any time. Remove the matching line from MEMORY.md as well, or the index will point at a file that no longer exists.