Memory
Persistent information storage across sessions
Prerequisites
- Basic Claude Code usage
What You'll Learn
- Understand how CLAUDE.md files work
- Know where to place memory files
- Learn what to store in memory
- Use the memory hierarchy effectively
01/05
0:00 / 0:22
Where Memory Lives
📄
~/.claude/CLAUDE.mdUser-level
Personal defaults across all projects. Good for global preferences.
📄
~/project/CLAUDE.mdProject-level
Project-wide conventions. Best for team standards.
📄
~/project/src/CLAUDE.mdDirectory-level
Subdirectory-specific rules. Use for folder-specific context.
What to Store in Memory
✓ Good for Memory
- •Coding style preferences (TypeScript, formatting)
- •Project architecture decisions
- •Common patterns and conventions
- •Testing approach and tools
- •Deployment and build instructions
✗ Avoid in Memory
- •Secrets, API keys, passwords
- •Large code snippets (use file references)
- •Rapidly changing information
- •Information already in code comments
Example CLAUDE.md
# Project Context
## Tech Stack
- Framework: Next.js 14 with App Router
- Language: TypeScript (strict mode)
- Styling: Tailwind CSS + shadcn/ui
- Database: PostgreSQL with Drizzle ORM
## Conventions
- Use `pnpm` for package management
- Components in `src/components/`
- Server actions in `src/actions/`
- Always use React Server Components
when possible
## Testing
- Use Vitest for unit tests
- Use Playwright for E2E
- Run `pnpm test` before committingHow Memory Merges
When Claude reads your project, it combines all CLAUDE.md files in the hierarchy:
~/.claude/Personal defaults
project/CLAUDE.mdProject specifics
src/CLAUDE.mdDirectory context
Full Context
Merged automatically
More specific (deeper) files can override or extend settings from parent files.
💡 Pro Tips
- 1.Use
/memorycommand to quickly add to your CLAUDE.md without leaving the conversation. - 2.Keep memory files focused and scannable—Claude reads them every session, so brevity helps.
- 3.Use directory-level memory for folder-specific patterns (e.g., API conventions in
src/api/CLAUDE.md). - 4.Commit your CLAUDE.md files to git—share project context with your team!
Master Claude Code faster
Get notified when new animated guides are released.
Subscribe to the newsletter