Episode 14: Memory System
Key Takeaway: Memory is "long-term memory" that persists across sessions, letting Claude remember your preferences and project state.
14.1 What is Memory
Memory is Claude Code's persistent memory system. It saves key information across sessions and auto-loads in new conversations.
14.2 Memory Storage Location
~/.claude/projects/-Users-eric-work-teachagent/memory/
βββ MEMORY.md β Index file (auto-loaded into context)
βββ user_role.md β User role/preferences
βββ feedback_testing.md β Feedback and corrections
βββ project_status.md β Project status
βββ ...
14.3 Memory Types
| Type | Purpose | Example |
|---|---|---|
| user | User role, preferences | "User is a data scientist, React beginner" |
| feedback | User corrections | "Don't summarize at the end of every reply" |
| project | Project status and decisions | "Auth middleware rewrite due to compliance" |
| reference | External system pointers | "Pipeline bugs in Linear INGEST project" |
14.4 How Memory Works
sequenceDiagram
participant H as Hooks
participant M as Memory files
participant CTX as Context
participant API as API
Note over H: SessionStart hook triggers
H->>M: Read MEMORY.md index
M->>CTX: Inject memory summary into system prompt
CTX->>API: Sent as fixed section
Note over H: During conversation
H->>H: claude-mem auto-records observations
Note over H: Session ends
H->>M: Update memory files14.5 Memory's Impact on Context
Memory files are injected into the system prompt at SessionStart, becoming part of the fixed section:
Fixed section = System Prompt (~3K) + CLAUDE.md (~4K) + Memory (~0.5K-3K) + Hooks (~1.5K)
More memory β larger fixed section. But thanks to caching, the fixed section is only charged once.
Recommendation: Keep MEMORY.md index under 200 lines; keep individual memory files concise.
Next Episode: Episode 15 covers /compact and /clear β an in-depth comparison of two context management commands.