7.1 Memory & CLAUDE.md
Course: Claude Code - Power User Section: Session Management Video Length: 2-5 minutes Presenter: Daniel Treasure
Opening Hook
Claude Code remembers your project's context across sessions. We'll show you how to set up project memory and use CLAUDE.md to maintain consistency throughout your workflow.
Key Talking Points
1. What is Project Memory?
- Memory persists project-specific context across multiple Claude Code sessions
- CLAUDE.md is the project-level instruction file that Claude reads automatically when opening a project
- Unlike user memory (global), project memory applies only to this repository
- Applies to all team members working in the same project
What to say: "Project memory is like giving Claude Code a standing instruction set for this specific project. Every time you open the project, Claude remembers the rules, standards, and context you've set up."
What to show on screen: Open a project folder in Claude Code and show the CLAUDE.md file in the root directory. Show it being auto-loaded when opening the project.
2. What Goes in CLAUDE.md
- Coding standards and style guides for the project
- Architecture decisions and design patterns used
- Naming conventions (variables, functions, classes)
- Testing requirements and expectations
- Library choices and API design patterns
- Key project assumptions and constraints
What to say: "Think of CLAUDE.md as your project's instruction manual for Claude. You're essentially documenting the decisions you want Claude to respect every single time it works on this codebase."
What to show on screen: Display an example CLAUDE.md file with several sections (coding standards, architecture, naming conventions). Point to each section and explain what it accomplishes.
3. Memory Hierarchy and Priority
- Managed policy (highest priority)
- Project memory (./CLAUDE.md)
- Project rules (.claude/rules/*.md)
- User memory (~/.claude/CLAUDE.md)
- Project local (CLAUDE.local.md)
- Auto memory (~/.claude/projects/
/memory/MEMORY.md — first 200 lines loaded)
What to say: "Claude applies these contexts in order. Project memory wins over user memory, so your project-specific instructions take precedence. This keeps teams aligned."
What to show on screen: Create a visual diagram or list showing the hierarchy. Show where each file lives in the filesystem.
4. Using @imports in CLAUDE.md
- CLAUDE.md supports @imports to reference other files
- Syntax:
@README,@docs/api-design.md - Maximum import depth: 5 hops to prevent circular references
- Keeps CLAUDE.md focused while pulling in detailed documentation
What to say: "Instead of cramming everything into one file, you can import existing documentation. This way your README and API docs stay the source of truth."
What to show on screen: Show CLAUDE.md with @import statements. Create a README.md, then add @README to CLAUDE.md. Open the file to show how imports are parsed and applied.
5. Accessing Memory in the Editor
/memorycommand opens the memory editor- Opens User memory (~/.claude/CLAUDE.md) by default
- Add
--projectflag to edit Project memory instead - Supports inline editing with markdown
What to say: "You don't have to dive into the filesystem. The /memory command brings memory right into the editor where you can update it instantly."
What to show on screen: Type /memory in Claude Code. Show the editor opening with the user memory file. Then show /memory --project opening the project memory file for a specific project.
Demo Plan
-
Open a project (30 seconds) — Navigate to a project folder and show Claude Code loading. Point out the CLAUDE.md file in the root.
-
Show CLAUDE.md structure (45 seconds) — Display a well-formatted example with sections: Coding Standards, Architecture, Naming Conventions, Testing, Libraries. Explain each section briefly.
-
Show @import in action (1 minute) — Edit CLAUDE.md to add
@docs/api-design.md. Show Claude Code loading and applying that imported documentation. -
Demonstrate /memory command (45 seconds) — Type
/memoryand show the user memory editor. Type/memory --projectto switch to project memory. Make a small edit and save. -
Show memory hierarchy diagram (30 seconds) — Display a visual representation of the priority order. Explain why project memory beats user memory.
Code Examples & Commands
CLAUDE.md Example Structure
# Project Memory: MyApp
## Coding Standards
- Use TypeScript with strict mode enabled
- Follow Prettier formatting (80-char line width)
- Prefer const over let, avoid var
- Use descriptive variable names (no single-letter vars except loop counters)
## Architecture
- MVC pattern with controllers handling routes
- Services layer for business logic
- Models use TypeORM entities
- All API endpoints must return JSON with { status, data, error } shape
## Naming Conventions
- Files: lowercase with hyphens (my-component.ts)
- Classes: PascalCase
- Functions: camelCase
- Constants: UPPER_SNAKE_CASE
- Database columns: snake_case
## Testing Requirements
- All new functions require unit tests with Jest
- Target minimum 80% code coverage
- Integration tests for API endpoints
- E2E tests for critical user flows
## Libraries
- Backend: Express.js 4.x, TypeORM, PostgreSQL
- Frontend: React 18, TailwindCSS, React Query
- Testing: Jest, Supertest, Playwright
Using @imports
# Project Memory: MyApp
@README
@docs/api-design.md
@docs/database-schema.md
## Additional Standards
- Code reviews required before merge
- Security: Use helmet.js middleware
/memory Command
/memory # Opens user memory editor
/memory --project # Opens project memory editor
Gotchas & Tips
-
CLAUDE.md must be in the repo root — Claude Code looks for it at the project root, not in subdirectories. Misplaced files won't be loaded automatically.
-
@imports are relative to repo root — When writing
@docs/api-design.md, the path is relative to the root, not the current directory. -
Auto memory has a 200-line limit — The auto-loaded memory file (~/.claude/projects/
/memory/MEMORY.md) only loads the first 200 lines. Keep critical info at the top or use explicit /memory command. -
Disable auto memory if it conflicts — Set
CLAUDE_CODE_DISABLE_AUTO_MEMORY=1if auto memory is causing issues with older projects. -
Team alignment requires commitment — CLAUDE.md is only useful if the team maintains it. Schedule reviews to keep it current as the project evolves.
-
Import depth limits prevent infinite loops — Circular imports (A imports B, B imports A) are blocked. Maximum depth is 5 hops, which is plenty for most projects.
Lead-out
Now that you know how to set up project memory, the next video shows you how to continue and resume sessions—keeping your work context across multiple conversations without losing progress.
Reference URLs
- Claude Code documentation on memory and context: https://claude.ai/docs
- Git practices for project documentation: https://git-scm.com/book/en/v2/Git-Tools-Git-Tips
Prep Reading
- Review your project's current documentation (README, architecture docs)
- Think about the key standards and conventions your team follows
- Identify which docs should be imported into CLAUDE.md vs. kept separate
Notes for Daniel: This video is dense with configuration details. Keep the demo simple—show a working CLAUDE.md in a real project, not a theoretical example. Use a project from the Stormwind examples if available. Emphasize that this isn't busywork; it directly improves Claude's code quality for the project. Speak casually about "documenting decisions for Claude" rather than "configuring the system."