Giới thiệu
YourMemory là MCP memory server cho AI agent có gắn một mô hình quên kiểu sinh học. Mỗi memory được lưu kèm importance score (0.2 — 1.0); strength giảm theo công thức Ebbinghaus:
strength = importance × e^(-λ × days) × (1 + recall_count × 0.2)
Memory quan trọng decay chậm hơn (effective λ = 0.16 × (1 - importance × 0.8)); memory được recall thường xuyên duy trì lâu hơn. Một background job prune memory rớt xuống dưới strength threshold — agent không phải tự nhớ rằng mình cần quên.
License CC BY-NC 4.0 (free cho personal/research, commercial cần liên hệ).
Tính năng chính
- 3 MCP tool:
recall_memory(query)ở đầu mỗi task,store_memory(content, importance)sau khi học được điều mới,update_memory(id, new_content)khi memory cũ. - Hybrid retrieval: BM25 + vector (sentence-transformers) + graph + decay scoring.
- Auto-detect client: Claude Code, Claude Desktop, Cursor, Windsurf, Cline/VS Code —
yourmemory-setupghi MCP config tự động. - Dual backend: Postgres (production) hoặc SQLite (zero-setup, embedding lưu dưới dạng JSON).
- Embedding in-process: dùng sentence-transformers, không cần Ollama.
- Agent registry: file
.mdtrongagents/declare identity và access control (can_read,can_write); store/recall validateagent_idtrước khi chạy. - FTS + dedup: full-text search và near-duplicate detection trên
update_memory.
Số benchmark
Tested trên LoCoMo-10 (snap-research/locomo) — 1,534 QA pairs trên 10 multi-session conversation:
| System | Recall@5 | 95% CI |
|---|---|---|
| YourMemory (BM25 + vector + graph + decay) | 59% | 56–61% |
| Zep Cloud | 28% | 26–30% |
Claim: gấp đôi Zep Cloud cùng benchmark, +16pp vs Mem0. Methodology + per-sample breakdown trong BENCHMARKS.md của repo.
Cách sử dụng
Setup hai lệnh:
pip install yourmemory
yourmemory-setup
Lệnh yourmemory-setup tự download spaCy model (en_core_web_sm), khởi tạo database, detect client AI đã cài, và inject MCP config entry. Với client không detect được, in ra snippet copy-paste.
Dùng MCP tool trong session:
store_memory(
"User prefers tabs over spaces in Python",
importance=0.9,
category="fact"
)
recall_memory("Python formatting")
File MEMORY_RULES.md đi kèm là agent instruction concise drop được vào CLAUDE.md hoặc system prompt: cover policy recall/store/update/ignore, importance scale, category table với decay rate, content writing convention.
Ý nghĩa với Dev
Nếu bạn đang build agent dài-hạn (Claude Code, Cursor, agent loop tự chạy), memory layer là single point of failure cho continuity giữa session. Stash, Mem0, Zep, Letta đều giải bài toán này khác nhau — YourMemory chọn approach decay sinh học và publish benchmark verified 4-way để so sánh trực tiếp. Setup nhanh (pip + 2 lệnh), backend lựa chọn được (SQLite cho dev, Postgres cho prod), MCP-native nên không phải build adapter riêng cho mỗi client.
Trade-off cần biết: license CC BY-NC chặn use commercial trực tiếp; embedding model bake trong process — RAM footprint cao hơn approach gọi Ollama remote; benchmark report là Recall@5 (top-5 retrieval), không phải end-to-end task accuracy — số 59% không trực tiếp dịch thành “agent của bạn nhớ tốt hơn 2x” trong workload thật.