Claude Code Memory Layers
Run the Claude Code Memory Layers MicroSim Fullscreen{ .md-button .md-button--primary }
About This Infographic
This interactive visualization demonstrates how Claude Code manages its memory hierarchy through five distinct layers. Each layer serves a specific purpose and has different sharing scopes.
How to Use
- Click "Play Animation" to watch how Claude Code loads rules from each layer sequentially
- Hover over any layer to see detailed information including:
- File locations for different operating systems
- Purpose and use case examples
- Who the rules are shared with
- Example rules for that layer
- Watch the override example that appears after the animation completes
The Five Memory Layers
| Priority | Layer | Location | Shared With |
|---|---|---|---|
| 1 (Highest) | Enterprise Policy | System directories | All org users |
| 2 | Project Memory | ./CLAUDE.md |
Team (via git) |
| 3 | Project Rules | ./.claude/rules/*.md |
Team (via git) |
| 4 (Lowest) | User Memory | ~/.claude/CLAUDE.md |
Just you |
| N/A | Project Local | ./CLAUDE.local.md |
Just you (gitignored) |
Key Concepts
Rule Override Behavior
Higher priority rules override lower priority rules when there's a conflict. For example:
- Your User Memory might specify:
"Use 2-space indentation" - But the Project Memory specifies:
"Use 4-space indentation" - Result: Claude uses 4-space indentation because Project Memory has higher priority
Loading Order
Claude Code reads memory files in priority order:
- Enterprise Policy loads first (if present)
- Project Memory loads next
- Project Rules are loaded
- User Memory preferences are applied
- Project Local settings are applied last
Despite loading last, lower-priority files have lower precedence - they fill in gaps but don't override higher-priority settings.
Embed This MicroSim
You can include this MicroSim on your website using the following iframe:
<iframe src="https://dmccreary.github.io/claude-skills/sims/claude-code-memory-layers/main.html"
height="602px"
width="100%"
scrolling="no"></iframe>
References
Lesson Plan
Learning Objectives
By using this MicroSim, students will be able to:
- Remember the five memory layers and their priority order
- Understand how rule override works between layers
- Apply knowledge to configure their own Claude Code environment
- Analyze which layer is appropriate for different types of rules
Discussion Questions
- Why might an organization want to use Enterprise Policy rules?
- When should you use Project Rules vs. Project Memory?
- What types of preferences belong in User Memory vs. Project Local?
- How does the gitignore behavior of
CLAUDE.local.mdaffect team collaboration?
Hands-On Activity
- Create a
~/.claude/CLAUDE.mdfile with a personal preference - Create a project
./CLAUDE.mdthat overrides that preference - Observe which rule Claude follows
Remember to create a screenshot image (claude-code-memory-layers.png) for social media previews.