Introduced in Claude Code v2.1.33 (February 2026), the
memory frontmatter field gives each subagent its own persistent markdown-based knowledge store. Before this, every agent invocation started from scratch.Overview
Thememory frontmatter field enables persistent knowledge for subagents:
Memory Scopes
user
Location:
~/.claude/agent-memory/<agent-name>/- Not version controlled
- Not shared between users
- Cross-project knowledge
- Recommended default
project
Location:
.claude/agent-memory/<agent-name>/- Version controlled
- Shared with team
- Project-specific knowledge
local
Location:
.claude/agent-memory-local/<agent-name>/- Git-ignored
- Not shared
- Personal project knowledge
These scopes mirror the settings hierarchy:
~/.claude/settings.json → .claude/settings.json → .claude/settings.local.jsonHow It Works
Agent Memory vs Other Memory Systems
| System | Who Writes | Who Reads | Scope |
|---|---|---|---|
| CLAUDE.md | You (manually) | Main Claude + all agents | Project |
| Auto-memory | Main Claude (auto) | Main Claude only | Per-project per-user |
/memory command | You (via editor) | Main Claude only | Per-project per-user |
| Agent memory | The agent itself | That specific agent only | Configurable (user/project/local) |
Practical Example
Best Practices
Prompt memory usage
Prompt memory usage
Include explicit instructions in your agent’s system prompt:“Before starting, review your memory. After completing, update your memory with what you learned.”
Request memory checks
Request memory checks
When invoking agents, explicitly ask them to check memory:“Review this PR, and check your memory for patterns you’ve seen before.”
Choose the right scope
Choose the right scope
userfor cross-project knowledgeprojectfor team-shared patternslocalfor personal project-specific notes
