{"slug": "claude-code-auto-memory-stop-re-explaining-your-preferences-every-session", "title": "Claude Code Auto Memory: Stop Re-Explaining Your Preferences Every Session", "summary": "Claude Code's Auto Memory feature automatically records user corrections and preferences across sessions, eliminating the need to re-explain instructions. The system stores learned patterns in a home directory, separate from project-level CLAUDE.md files, and loads only the first 200 lines of the memory index to keep context lean.", "body_md": "If you've spent any real time with Claude Code, you know this pain: you open a fresh session and it's forgotten everything you taught it yesterday. I'd tell it over and over not to dump a pile of emojis into my writing because it looks too AI — and the next morning, fresh session, emojis everywhere again.\n\nTurns out there's a fix built for exactly this, called **Auto Memory**. I'd already written about [CLAUDE.md](https://israynotarray.com/en/ai/2026/03/10/claude-md-rules-for-ai-writing-tips/) for setting project rules by hand, but Claude Code's memory system is bigger than just CLAUDE.md. Auto Memory quietly records your corrections and preferences as you work, so next session you don't have to say them again.\n\nAuto Memory needs Claude Code v2.1.59 or newer. Check with\n\n`claude --version`\n\n.\n\nA lot of people mix these two up, so let's get it straight first.\n\n| CLAUDE.md | Auto Memory | |\n|---|---|---|\n| Who writes it | You | Claude, automatically |\n| What's in it | Instructions and rules | Learned lessons and patterns |\n| Scope | Project / user / org | Per working tree |\n| Loading | Fully loaded every session | First 200 lines / 25KB only |\n| Best for | Code conventions, workflow, architecture | Build commands, debugging notes, preferences |\n\nIn short: CLAUDE.md is the set of rules you write for Claude on purpose — \"use 2-space indentation,\" \"write commit messages in English.\" Auto Memory is what Claude picks up on its own while working with you. You don't write it; it does.\n\nAuto Memory is basically Claude taking its own notes. When you correct it, or tell it whether an approach worked, Claude decides whether that's worth remembering for later. If it is, it saves it.\n\nSo when I told it:\n\nDon't use so many emojis, it looks too AI\n\nit saved that as a memory file, and every new session loads it back. Now it remembers I don't like emoji soup.\n\nIt doesn't save everything, though — one-off discussions or things irrelevant to future work don't get written down.\n\nHere's the thing that trips everyone up. Your project has a `.claude/`\n\nfolder, but Auto Memory files are **not** in there. The project `.claude/`\n\nonly holds settings (`settings.json`\n\n, `settings.local.json`\n\n) and rules.\n\nThe actual memory lives under your home directory:\n\n```\n/Users/ray/my-project/.claude/                              <- project settings, inside your repo\n/Users/ray/.claude/projects/-Users-ray-my-project/memory/   <- Auto Memory, under your home dir\n```\n\nBoth paths contain `.claude`\n\n, but one is in your project and one is in your home directory — don't mix them up. If you peek into your project's `.claude/`\n\nand only find `settings.local.json`\n\n, that's normal. The memory was never there.\n\nThe memory path is derived from your git repo, so subdirectories and worktrees of the same repo share one memory. And it's machine-local — it does not sync to other machines or cloud environments.\n\nIf you want it somewhere else, set `autoMemoryDirectory`\n\n(Policy / Local / User level only — not project level, on purpose, so a shared repo can't redirect your memory somewhere shady):\n\n```\n{\n  \"autoMemoryDirectory\": \"~/my-custom-memory-dir\"\n}\n~/.claude/projects/<project>/memory/\n├── MEMORY.md          # index, loaded every session\n├── debugging.md       # debugging notes\n├── api-conventions.md # API design decisions\n└── ...                # other topic files Claude creates\n```\n\n`MEMORY.md`\n\nis the index — Claude uses it to track which memories exist and which file each one lives in. Only the first 200 lines / 25KB of `MEMORY.md`\n\nloads at session start, so Claude keeps it lean and pushes detail into separate topic files. Those topic files aren't loaded on startup; Claude reads them on demand. So your memory can grow without bloating context every single time.\n\n(That 200-line cap is only for `MEMORY.md`\n\n. CLAUDE.md always loads in full — though shorter still means better adherence.)\n\nWhen you see \"Writing memory\" or \"Recalled memory\" in the Claude Code UI, that's it updating or reading memory files. You don't have to do anything; it handles it.\n\n`/memory`\n\n`~/.claude/projects/`\n\n. Add, edit, or delete whatever you want.`/memory`\n\n, set `\"autoMemoryEnabled\": false`\n\n, or set `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1`\n\n.And in case you were wondering: `/compact`\n\ndoes not wipe it. The files are on disk, not in the conversation. Compacting only squeezes the chat history; `MEMORY.md`\n\nand CLAUDE.md get re-read from disk and injected back afterward.\n\nThat's the whole thing. It's a small feature, but once you stop repeating yourself every session it's hard to go back.", "url": "https://wpnews.pro/news/claude-code-auto-memory-stop-re-explaining-your-preferences-every-session", "canonical_source": "https://dev.to/isray_notarray/claude-code-auto-memory-stop-re-explaining-your-preferences-every-session-35ne", "published_at": "2026-06-17 02:50:33+00:00", "updated_at": "2026-06-17 03:21:21.709604+00:00", "lang": "en", "topics": ["large-language-models", "ai-tools", "developer-tools"], "entities": ["Claude Code", "Anthropic", "CLAUDE.md", "Auto Memory"], "alternates": {"html": "https://wpnews.pro/news/claude-code-auto-memory-stop-re-explaining-your-preferences-every-session", "markdown": "https://wpnews.pro/news/claude-code-auto-memory-stop-re-explaining-your-preferences-every-session.md", "text": "https://wpnews.pro/news/claude-code-auto-memory-stop-re-explaining-your-preferences-every-session.txt", "jsonld": "https://wpnews.pro/news/claude-code-auto-memory-stop-re-explaining-your-preferences-every-session.jsonld"}}