Skip to content

Memory Overview

Claude Code’s memory architecture comprises four complementary systems: MEMORY.md entrypoints with auto-scanning, daily auto-memory logs, session memory extraction, and command history. Together they enable Claude to recall context, learn from past sessions, and handle complex projects without losing information.

  1. How memory works
  2. Storage paths
  3. Auto-memory
  4. Memory types
  5. Session memory
  6. History and pastes
  7. Discrepancies & notes

7 sections, 6 memory subsystems across local, remote, and agent scopes.

#SectionDescriptionEntries
1How memory worksArchitecture: MEMORY.md entrypoints, auto-memory daily logs, session memory extraction, and command history indexed by project.narrative
2Storage pathsFull path resolution: local ~/.claude/, remote CCR, team memory, agent memory (user/project/local), and session memory.8 paths
3Auto-memoryDaily logs, 200-file scan cap with newest-first sort, 5-result Sonnet selector, 200-line / 25KB MEMORY.md caps, staleness warnings.narrative
4Memory typesFrontmatter classification: user, feedback, project, reference with narrowing logic during recall.4 types
5Session memoryBackground subagent extraction (feature gate tengu_session_memory), token budgets, initialization thresholds.narrative
6History and pastesGlobal history.jsonl (100 items/project, indexed by name) and paste-store content-addressed cache for >1024 char pastes.narrative
7Discrepancies & notesGaps between public docs and reality: feature gates, team memory gating, local-only agent memory, extraction behavior.narrative
File/dirPathScopePurposeCap/retention
MEMORY.md<memdir>/MEMORY.mdProject-localIndex + entrypoint for memory files. Auto-scanned first.200 lines OR 25KB; excess dropped with warning
Auto-memory dir~/.claude/memory/YYYY/MM/YYYY-MM-DD.mdUser globalDaily logs. Newest 5 files selected by Sonnet after scan.One file per day; 200-file scan cap
User agent memory~/.claude/agent-memory/<agentType>/User globalPer-agent-type memories (saved manually or via /memory).No cap; scanned up to 200 files
Project agent memory.claude/agent-memory/<agentType>/Project-localProject-specific agent memories (feature-gated by local setting).No cap
Local agent memory.claude/agent-memory-local/<agentType>/Project-localNEVER synced to CCR; kept only in .claude/No cap
Team memoryCLAUDE_CODE_REMOTE_MEMORY_DIR/projects/<project>/team-memory/Team (CCR only)Shared memories for team context (feature gate isTeamMemoryEnabled()).No formal cap
Session memory~/.claude/sessionMemory.mdUser globalCurrent conversation notes. Extracted by background subagent.Thinking=1024 tokens; extraction=2048 tokens max
History index~/.claude/history.jsonlUser globalGlobal history across all projects, indexed by project-name.100 entries per project (newest first)
Paste cache~/.claude/paste-store/User globalLarge pastes (>1024 chars) stored by content hash. Referenced as [Pasted text #N +M lines].No formal cap; cleaned by retention policy