Claude Code has two durable context systems:
CLAUDE.md files and .claude/rules/ files for user- or project-authored instructions.The official docs describe CLAUDE.md files as persistent context and auto memory as notes Claude writes based on corrections and preferences. Auto memory is enabled by default and can be disabled via /memory, settings, or CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.
Instruction files:
/Library/Application Support/ClaudeCode/CLAUDE.md, /etc/claude-code/CLAUDE.md, or C:\Program Files\ClaudeCode\CLAUDE.md.~/.claude/CLAUDE.md.~/.claude/rules/**/*.md../CLAUDE.md or ./.claude/CLAUDE.md../.claude/rules/**/*.md../CLAUDE.local.md.Auto memory:
~/.claude/projects/<project>/memory/.MEMORY.md as an index/entrypoint and one markdown topic file per memory.MEMORY.md is not necessarily the full memory body. It is the startup-loaded index that points Claude to the more detailed topic files that hold the real memory references/content.autoMemoryDirectory can override the storage directory.CLAUDE.md and rules are markdown instruction files.CLAUDE.md can import additional files with @path syntax..claude/rules/*.md files may have YAML frontmatter, including path scoping through paths.type field such as user, feedback, project, or reference, and Claude Code can update modified timestamps.MEMORY.md are loaded at the start of a conversation; topic files are read on demand.MEMORY.md as a manifest/index first: parse its entries and follow same-directory markdown references before deciding that an entry has no detail file.Recommended import order:
CLAUDE.md / .claude/CLAUDE.md and project rules.CLAUDE.local.md only when the user explicitly opts in.MEMORY.md index, then the topic files it references.--scope=user or equivalent.Suggested mapping:
type: user -> preference unless content indicates config.type: feedback -> pattern or preference depending on wording.type: project -> decision, discovery, config, or manual after classification.type: reference -> discovery with source URL/path provenance.pattern or config; avoid importing broad policy text as factual memory without review.Important importer behavior:
source_file, heading path, frontmatter fields, and import timestamp.MEMORY.md) and the referenced topic file path so users can audit where the observation came from.@path imports only in dry-run unless explicitly allowed; imported files may point outside the project.