Terminal memory
Claude Code Memory: The Working Map
Claude Code memory is a startup-context system plus a local Markdown memory directory. The core split is human-written instructions versus Claude-written auto memory.
Every Claude Code session starts with a fresh context window.
Human-written instructions live in CLAUDE.md, CLAUDE.local.md, and .claude/rules.
Claude-written notes live in auto memory under the user home directory.
/memory is the first diagnostic command for loaded files and auto memory.
"Each Claude Code session begins with a fresh context window." Anthropic Claude Code Docs
The startup model
Claude Code does not simply continue with the same hidden state forever. The docs say each session begins with a fresh context window. Persistent knowledge is then loaded into that new session from memory sources.
That means memory quality affects session quality. A precise CLAUDE.md gives Claude a good launch. A bloated, contradictory file gives Claude noisy context. A stale auto memory can keep reintroducing a fixed bug or outdated command.
Human-written memory
The human-written side includes CLAUDE.md, CLAUDE.local.md, and rule files under .claude/rules/. Use this layer for instructions you intentionally want Claude to see: commands, architecture notes, code style, testing expectations, and repo-specific caveats.
Claude Code reads CLAUDE.md files from multiple scopes, including managed, user, project, and local locations. Project files are shareable through version control; local files are for personal preferences and should stay gitignored.
Claude-written memory
Auto memory lets Claude Code write notes for itself. The docs describe notes such as build commands, debugging insights, architecture notes, code style preferences, and workflow habits. This is useful because not every durable learning is obvious before a session starts.
Because auto memory is Claude-written, audit it. Ask what it saved, run /memory, and open the folder when behavior starts feeling haunted by old assumptions.
Use /memory first
The /memory command lists loaded CLAUDE.md, CLAUDE.local.md, and rules files. It also lets you toggle auto memory and open the auto memory folder. If Claude is missing a rule, start by proving the file is actually loaded.
When a rule is loaded but ignored, rewrite it more concretely, remove conflicts, or move hard requirements into hooks or settings.
FAQ
What is the difference between CLAUDE.md and auto memory?
CLAUDE.md is written by you for persistent instructions. Auto memory is written by Claude based on corrections, preferences, and useful project learnings.
Can memory enforce behavior?
No. Claude Code docs describe memory as context. Use hooks or settings for enforcement.