Claude Memory

Overview

Persistent context = markdown loaded into every new context. Two sources: you (CLAUDE.md, rules) and Claude (auto memory).

CLAUDE.md Locations

Scope Path
Managed policy macOS /Library/Application Support/ClaudeCode/CLAUDE.md; Linux/WSL /etc/claude-code/CLAUDE.md; Windows C:\Program Files\ClaudeCode\CLAUDE.md
Project (shared) ./CLAUDE.md or ./.claude/CLAUDE.md (the .claude/ one is expected)
User ~/.claude/CLAUDE.md
Local (not in git) ./CLAUDE.local.md

Writing Good Ones

Split it up

Tool Use Strength
@path/to/file.md imports Docs and context ("developer handbook") Guidance, not hard rules. Relative to the importing file, max 5 hops
.claude/rules/*.md Rules to always follow, one topic per file Same priority as .claude/CLAUDE.md; symlinks allowed
Auto memory Claude's own learned preferences Best guesses

Scoped rule:

---
paths:
  - "src/api/**/*.ts"
---
# API rules
- All endpoints validate input

Skip files in monorepos: "claudeMdExcludes": ["**/monorepo/CLAUDE.md"] in .claude/settings.local.json.

Auto Memory

Troubleshooting

Problem Fix
Not following CLAUDE.md /memory to confirm it's loaded; make rules specific; look for conflicts
Don't know what was saved /memory → open auto-memory folder
File too large Move to imports/rules
"Lost after /compact" It isn't compact: CLAUDE.md is re-read from disk, so it probably wasn't saved

Related: Claude Settings, Claude Skills, Claude Sessions and Context