Claude Code starts every session with a fresh context window and carries knowledge forward in two ways. CLAUDE.md files hold instructions you write. Auto memory holds notes Claude writes itself from your corrections. Both load at session start, and the docs call both context, not enforced configuration.
The two systems side by side
According to Anthropic's memory documentation, CLAUDE.md files contain instructions and rules, and their scope can be project, user or organization. Auto memory contains learnings and patterns, scoped per repository and shared across worktrees.
Both are loaded into every session. For auto memory, the documentation says the first 200 lines or 25KB are loaded, so a long memory file is cut off rather than read in full.
| CLAUDE.md | Auto memory | |
|---|---|---|
| Written by | You | Claude |
| Holds | Standards, workflows, architecture | Your preferences and corrections |
| Scope | Project, user or org | Per repository |
What goes in each
Put facts in CLAUDE.md that you would otherwise re-explain: build commands, naming conventions, project layout, and "always do X" rules. The documentation suggests adding to it when Claude makes the same mistake twice, when a code review catches something Claude should have known, or when a new teammate would need the same context.
Auto memory suits the things you would rather not type out: how you like commits worded, which test command you prefer, and project context Claude cannot derive from the code.
Neither one is a guardrail
This is the point teams most often miss. The documentation states that Claude treats both as context and not enforced configuration. If an instruction must hold no matter what the model decides, the docs point to a PreToolUse hook instead. A line in CLAUDE.md saying "never touch the migrations folder" is a request. A hook that exits with code 2 on edits to that folder is a rule.
For the same reason, treat instruction files as untrusted input when they arrive from a repository you did not write. They shape behavior, so a changed CLAUDE.md in a pull request deserves the same review as changed code.
Keeping instructions useful
The memory page gives concrete advice. Be specific enough to verify: "Use 2-space indentation" beats "Format code properly". Keep each file under about 200 lines, because longer files cost context and reduce adherence. If two instructions contradict each other, Claude may pick one arbitrarily, so prune old entries.
You can run /init to generate a starting CLAUDE.md from your codebase, and /memory to inspect what is loaded. Running /context lists the memory files in the current session, which is the quickest way to confirm a file was picked up.
How Safeguard fits
If you want the repository itself to enforce what an instruction file only requests, Safeguard policies, gates and guardrails check dependency and scan results in the pipeline. You can run a free scan at gold.safeguard.sh/scan.
Quick check
Does Claude always follow CLAUDE.md?
No. The documentation calls it context, not enforced configuration. Use a hook or a permission rule when a behavior must be guaranteed.
How much of auto memory loads each session?
Per the documentation, the first 200 lines or 25KB.
Sources
Last reviewed: 19 October 2026.