╔══●══●══●══════════════════════════════════════════════╗
║ ║
║ > tree ~/.claude/memory ║
║ ║
║ ├── core.md claude-memory-skill ║
║ ├── topics/ ─────────────────── ║
║ │ └── *.md a skill is all you need ║
║ └── me.md ║
║ ║
╚═══════════════════════════════════════════════════════╝
An embarrassingly simple and minimal implementation for agentic memory.
No databases. No embeddings. No semantic search. Just markdown files and a skill that teaches Claude when to read and write.
Claude Code forgets everything between sessions. Built-in auto-memory exists but:
- It's opaque (Claude decides what's "meaningful")
- Limited to 200 lines loaded at startup
- Not tightly integrated into the agentic loop
- No hierarchical organization (scales poorly)
A skill-based memory protocol with:
- Hierarchical storage:
core.mdsummaries →topics/<topic>.mddetails - Background agents: Memory ops don't block the main agent
- Categorized entries: No dumping ground, everything has a topic
- Filesystem-based: Robust, inspectable, git-trackable
curl -fsSL https://raw.githubusercontent.com/hanfang/claude-memory-skill/main/install.sh | bashOr clone and run locally:
git clone https://github.com/hanfang/claude-memory-skill.git
cd claude-memory-skill
./install.sh~/.claude/
├── CLAUDE.md # Hook added (or created)
├── commands/
│ └── mem.md # The memory skill
└── memory/
├── core.md # Summaries + pointers (always loaded)
├── me.md # About you (always loaded)
├── topics/ # Detailed entries by topic
│ └── <topic>.md
└── projects/ # Project-specific memories
└── <project>.md
┌─────────────────────────────────────────────────────┐
│ Main Agent │
│ - Focuses on user's task │
│ - Spawns memory agent when needed │
│ - Doesn't wait (background) │
└─────────────────────┬───────────────────────────────┘
│ spawn (background)
▼
┌─────────────────────────────────────────────────────┐
│ Memory Agent │
│ - Reads core.md + relevant topics │
│ - Writes to topic files │
│ - Updates core.md summaries │
└─────────────────────────────────────────────────────┘
These run automatically — you don't invoke them:
| Action | When | Blocking |
|---|---|---|
load |
Session start | No |
save |
Claude learns something useful | No |
recall |
Claude needs context | No |
These are for you to inspect and manage memory:
| Command | Description |
|---|---|
/mem show |
Display memory structure and contents |
/mem forget <topic> |
Remove a topic or specific entries |
Just say it naturally:
- "Remember that we use pnpm, not npm"
- "Save that the API requires auth headers"
- "Note that tests need Redis running"
Edit ~/.claude/memory/me.md with facts about yourself:
# About the User
- AI researcher, focus on agents and RL
- Prefer explicit code over clever abstractions
- Python, PyTorch, JAXcore.md (always loaded):
# Core Memory
## Debugging
Mostly async/timing issues. Prefer explicit logging.
→ topics/debugging.md
## RL Research
PPO tuning, reward shaping experiments.
→ topics/rl.mdtopics/debugging.md (loaded on demand):
## Async race condition fix [2024-01-15]
Added explicit locks around shared state access.
## Redis timeout debugging [2024-01-10]
Default timeout was too short for large payloads.- Learn something → spawn background memory agent
- Agent categorizes → finds or creates topic file
- Agent appends entry with timestamp
- If significant, agent updates core.md summary
- Session start → agent reads core.md + me.md in background
- When stuck → agent follows pointers to relevant topics
- Returns context to main agent
- Background ops: Memory doesn't block the main agent
- Hierarchical: Summaries in core.md, details in topics
- Categorized: Every entry belongs to a topic
- Atomic entries: One
##block = one memory - No semantic search: Deterministic, grep-based retrieval
- User editable: Plain markdown, edit anytime
rm -rf ~/.claude/memory
rm ~/.claude/commands/mem.md
# Manually remove the memory hook from ~/.claude/CLAUDE.mdMIT