Skip to content
tinAI
Go back

YourMemory: Memory layer cho AI agent áp dụng đường cong quên Ebbinghaus, Recall@5 gấp đôi Zep Cloud

Bài gốc: YourMemory — Agentic AI memory with Ebbinghaus forgetting curve decay

Tác giả: Sachit Rafa

Ngày đăng: Dịch ngày:

TL;DR

MCP memory server cho AI agent áp dụng decay sinh học (`strength = importance × e^(-λ × days)`) — memory quan trọng decay chậm hơn, memory không được recall đúng ngưỡng sẽ tự prune. Trên benchmark LoCoMo-10 (1,534 QA pairs), Recall@5 đạt 59% — gấp đôi Zep Cloud (28%) và +16pp so với Mem0. Cài bằng `pip install yourmemory`, ship MCP cho Claude Code/Cursor/Windsurf, backend Postgres hoặc SQLite.

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

Số benchmark

Tested trên LoCoMo-10 (snap-research/locomo) — 1,534 QA pairs trên 10 multi-session conversation:

SystemRecall@595% CI
YourMemory (BM25 + vector + graph + decay)59%56–61%
Zep Cloud28%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.


Read Original (EN) Quay lại Newsletter