Cognitive Ai Memory

io.github.sachitrafa由 GitHub 帳號 sachitrafa 發布v1.0.2更新於 Oct 28, 2026

Ebbinghaus-based persistent memory for Claude. Memories decay with time, strengthen on recall.

發布方自己的服務:Memory.fit

已驗證STDIO僅桌面資料庫知識與記憶

概覽

AI 產生的概覽

為 AI 助理設計的本地優先持久記憶伺服器:跨工作階段儲存、衰減、整併並回想事實,結合向量、BM25 與圖譜檢索。

可以做什麼
  • 依相似度與衰減強度回想記憶,並可依路徑加權
  • 儲存新記憶,帶重要性、類別與情境路徑,自動去重並產生嵌入向量
  • 更新過時記憶,重新嵌入並記錄變更
  • 將相關事實整併為摘要、衰減與清理陳舊記憶,並維護雜湊鏈稽核日誌
  • 匯出、清除或重新匯入使用者記憶,管理團隊共享記憶池
適用情境
適合希望助理跨工作階段與情境重置後仍記得使用者偏好、專案決策與歷史情境的情況,免去每次重複說明。也適合需要共享記憶池、同時保留個人私有項目的團隊。
執行需求
以本機程序(stdio)在使用者機器上執行,僅限桌面端。需要 DATABASE_URL 提供含 pgvector 的 PostgreSQL 連線字串。可選用 OLLAMA_URL 指定 Ollama 服務,並以 EXTRACT_MODEL 指定事實分類模型。README 另述可透過 Python 套件或獨立二進位檔安裝,並需以權杖註冊。
安裝前請注意
會將個人與專案情境持久保存到磁碟或所設定的資料庫,安裝前應確認寫入內容。它會寫入、更新與刪除記憶紀錄,整併時原始項目會被封存。README 提到需以電子郵件註冊取得權杖,以及可選的雲端擷取後端。同時執行 MCP 與 HTTP 服務可能造成寫入鎖衝突。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Cognitive Ai Memory,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[YourMemory]

YourMemory

Your AI has the memory of a goldfish. Not anymore.

Persistent, self-improving memory for AI agents — built on the science of how humans remember.

[PyPI] [PyPI Downloads] [Python] [License: CC BY-NC 4.0] [GitHub Stars]

[LoCoMo Recall@5] [LongMemEval Recall@5] [HotpotQA BOTH@5] [MCP Native]


▶ Try the live interactive demo · Website · Benchmarks


The problem

Every morning your AI agent treats you like a stranger. Same context re-explained. Same preferences forgotten. Every session starts from zero.

Most "memory" tools bolt a vector database onto an agent and call it done — but that's just storage. It hoards every near-duplicate until retrieval drowns in noise. A goldfish with a bigger bowl.

YourMemory is different: memory that works like a brain, not a database.

mermaid
flowchart LR    A["🧠 You tell your<br/>AI something"] --> B["Extract durable<br/>facts"]    B --> C["Dedup + embed<br/>+ graph-link"]    C --> D[("Memory<br/>store")]    D -->|"related facts pile up"| E["✨ Consolidate<br/>N → 1 summary"]    D -->|"stale + unused"| F["📉 Decay<br/>+ prune"]    D -->|"new session"| G["♻️ Recall<br/>hybrid + graph"]    E --> D    G --> H["🤖 Your agent<br/>picks up where<br/>it left off"]    style D fill:#0a2540,stroke:#19cdff,color:#fff    style E fill:#0c2b3a,stroke:#5eead4,color:#fff    style H fill:#0c2b3a,stroke:#19cdff,color:#fff

✨ What makes it different

FeatureWhat it does
🧠ConsolidationWhen enough related facts accumulate, they're compressed into one clean summary and the originals are archived. Memory gets sharper over time, not bloated.
📉Biological decayEvery memory ages on an Ebbinghaus forgetting curve. Stale, unused facts fade; important and frequently-recalled ones persist.
🔗Entity graphMemories link by shared people, places, and concepts — so recall surfaces what you forgot to ask for.
♻️Survives context resetsWhen the context window compacts, YourMemory hands the working context back — no re-reading files to figure out where you were.
🔒Tamper-evident audit trailEvery read / write / delete is logged in a hash-chained ledger. Alter one record and the chain breaks.
👥Team memory poolsRole-based shared memory, so a whole team's agents draw on the same institutional knowledge — with private memories kept private.
🛡️Data rights built inOne-command export (right to access) and right-to-forget (purge), plus SOC 2-aligned controls.
🔌MCP-native & local-firstWorks with Claude, Cursor, Cline, Windsurf, or any MCP client. Runs entirely on your machine — no API key, nothing leaves your system.

One command to install. DuckDB by default (zero setup), Postgres + pgvector for teams.


Table of Contents


🏆 Benchmarks

Three external datasets. Every number independently reproducible — benchmark code lives in the repo. Full methodology in BENCHMARKS.md.

LoCoMo-10 — multi-session conversational memory

mermaid
xychart-beta    title "Recall@5 · LoCoMo-10 (higher is better)"    x-axis ["Mem0", "Zep Cloud", "Supermemory", "YourMemory"]    y-axis "Recall@5 percent" 0 --> 70    bar [18, 28, 31, 59]

2× better recall than Zep Cloud across all 10 samples. *Supermemory and Mem0 exhausted free-tier quotas mid-benchmark; scores computed over the full 1,534 pairs.

LongMemEval-S — 500 questions, ~53 distractor sessions each

The hardest standard benchmark for long-term memory. Each question is buried in ~53 sessions.

MetricScore
Recall@5 (any gold session in top-5)89.4%
Recall-all@5 (all gold sessions in top-5)84.8%
nDCG@5 (ranking quality)87.4%

HotpotQA — 200 multi-hop questions

SystemBOTH_FOUND@5
YourMemory (vector + BM25 + entity graph)71.5%
YourMemory (no entity edges)59.5%

Entity graph edges add +12 pp — they traverse from Fact 1 to Fact 2 even when Fact 2 has low embedding similarity to the query.

Writeup: I built memory decay for AI agents using the Ebbinghaus forgetting curve


🚀 Quick Start

Python 3.11–3.14. No Docker, no database setup. All memory stored locally in ~/.yourmemory/.

bash
pip install yourmemoryyourmemory-register <your-token>yourmemory-setup

Get your token: visit yourmemoryai.xyz → enter your email → verify with a 6-digit code → copy your token.

yourmemory-setup auto-detects and wires up Claude Code, Claude Desktop, Cursor, Windsurf, and Cline, then asks which backend to use:

  • DuckDB — zero setup, single local file (default)
  • Postgres — shared / production; you provide a DATABASE_URL (needs the pgvector extension)

Optional — smarter local extraction: YourMemory works out of the box with built-in heuristics. For higher-quality, fully-local fact extraction, install Ollama and yourmemory-setup pulls the model (qwen2.5:7b, ~4.7 GB) automatically. Prefer the cloud? Set YOURMEMORY_EXTRACT_BACKEND=anthropic.

Or install from a binary — no Python required

Prefer not to touch pip? Grab the standalone binary for your platform from the latest release:

PlatformAsset
macOS (Apple Silicon)yourmemory-macos-arm64.tar.gz
macOS (Intel)yourmemory-macos-x86_64.tar.gz
Linux (x86-64)yourmemory-linux-x86_64.tar.gz
Windows (x86-64)yourmemory-windows-x86_64.exe.zip
bash
# macOS / Linux — download, extract, runtar -xzf yourmemory-macos-arm64.tar.gz./yourmemory-macos-arm64 register <your-token>./yourmemory-macos-arm64 setup./yourmemory-macos-arm64            # start the server

One executable handles every command: register, setup, ask "<question>", path, and (with no args) starts the server.

Fully self-contained & offline — the binary bundles Python, every dependency, and both ML models (the embedding model + spaCy). Nothing is downloaded on first run. The trade-off is size (~2 GB). Build your own with a single command — ./build-binary.sh — and multi-platform release binaries are produced automatically by the build workflow.


🧠 How Memory Works

YourMemory treats memory as a living system — it grows, consolidates, forgets, and connects, the way a brain does.

Consolidation — N → 1

Most memory tools just keep growing. YourMemory watches for clusters of related facts and, once enough accumulate, compresses them into a single clean summary — archiving the originals (never deleting, so nothing is lost).

mermaid
flowchart LR    subgraph before [Related facts pile up]        A1["Railway uses Nixpacks"]        A2["Railway on Pro plan"]        A3["Railway env vars hold<br/>the Postgres URL"]        A4["Deploys on Railway<br/>with Postgres"]    end    before --> C{"cluster +<br/>LLM summarize"}    C --> S["✨ Summary<br/>Deploys on Railway (Pro,<br/>Nixpacks) with Postgres<br/>via env vars"]    C -.->|"archived, recoverable"| ARC[("archive")]    style S fill:#0a2540,stroke:#5eead4,color:#fff    style C fill:#0c2b3a,stroke:#19cdff,color:#fff

Real example from one production store: 444 memories → 16 summaries — same knowledge, a fraction of the noise. Consolidation is event-driven (triggered when related memories pile up), not a blind nightly job.

Decay — the forgetting curve

Memory strength decays exponentially. Importance and recall frequency slow that decay:

effective_λ  = base_λ × (1 − importance × 0.8)strength     = clamp(importance × e^(−effective_λ × active_days) × (1 + recall_count × 0.2), 0, 1)

active_days counts only days you were active — vacations don't cause memory loss. Memories below strength 0.05 are pruned automatically. Each category ages at its own rate:

CategoryHalf-lifeBest for
strategy~38 daysPatterns that worked, architectural decisions
fact~24 daysPreferences, identity, stable knowledge
assumption~19 daysInferred context, uncertain beliefs
failure~11 daysErrors, wrong approaches, environment-specific issues

Chain-aware pruning: a decayed memory is kept alive if any graph neighbour is still strong — load-bearing context survives even when rarely queried directly.

Hybrid Retrieval — Vector + BM25 + Graph

Recall runs in two rounds so it surfaces both what you asked for and what you forgot to ask for:

mermaid
flowchart LR    Q["query"] --> R1["Vector + BM25<br/>hybrid search"]    R1 --> R2["Graph expansion<br/>(what you forgot to ask)"]    R2 --> S["rank by<br/>similarity × strength"]    S --> OUT["🎯 Ranked memories"]    style OUT fill:#0a2540,stroke:#19cdff,color:#fff

Subject-aware deduplication runs before every store — it embeds the subject of each sentence so "Sachit uses DuckDB" and "YourMemory uses DuckDB" stay separate (different entities), while "YourMemory uses DuckDB" and "YourMemory stores data in DuckDB" merge (same entity). No hardcoded word lists; generalises to any language.


🔒 Trust & Audit Trail

Enterprises won't let an opaque black box store their data. So every operation — read, write, update, delete, consolidation — is appended to a hash-chained, tamper-evident audit log.

mermaid
flowchart LR    E0["GENESIS"] --> E1    subgraph E1 [Event 1]        H1["row_hash =<br/>sha256(prev + data)"]    end    E1 --> E2    subgraph E2 [Event 2]        H2["row_hash =<br/>sha256(#1.hash + data)"]    end    E2 --> E3    subgraph E3 [Event 3]        H3["row_hash =<br/>sha256(#2.hash + data)"]    end    E3 --> V{"GET /audit/verify"}    V -->|chain intact| OK["✅ verified"]    V -->|any row altered| BAD["❌ chain breaks<br/>at that row"]    style OK fill:#0a2540,stroke:#5eead4,color:#fff    style BAD fill:#3a0c14,stroke:#fb7185,color:#fff

Each row records the timestamp, actor user + agent, action, operation, target memory, source (http vs mcp), and the previous row's hash. Change any historical record and verify_chain() pinpoints exactly where the chain broke.

bash
GET  /audit            # browse the trail (filter by user / action / operation)GET  /audit/verify     # cryptographically verify the chain is untamperedPOST /audit/prune      # retention-based cleanup (90-day minimum, never lower)

Audit logging is fail-open — it never blocks a memory operation — and read/list events from the dashboard's own render loop are excluded, so the trail stays signal, not noise.


👥 Team Memory Pools

Give a whole team's agents one shared brain — without leaking anyone's private context. Memories are either shared (visible to the pool) or private (visible only to their owner).

mermaid
flowchart TB    P(("🧠 Team Pool<br/>shared memory"))    A["Alice's agent"] <-->|shared| P    B["Bob's agent"] <-->|shared| P    C["Carol's agent"] <-->|shared| P    A -. private .-> AP["🔒 Alice-only"]    B -. private .-> BP["🔒 Bob-only"]    style P fill:#0a2540,stroke:#19cdff,color:#fff    style AP fill:#0c1424,stroke:#5a6b80,color:#8294a8    style BP fill:#0c1424,stroke:#5a6b80,color:#8294a8

Role-based access is enforced per agent — what one engineer's agent learns, the whole team benefits from instantly; sensitive context stays scoped to its owner.

bash
POST   /pools                          # create a poolPOST   /pools/{id}/members             # add a member (with role)POST   /pools/{id}/memories            # contribute a shared memoryPOST   /pools/{id}/retrieve            # recall across the pool

🛡️ Data Rights & Compliance

Because memory that stores real data needs the controls to be trusted with it:

RightEndpointWhat it does
Access (DSAR export)GET /users/{id}/exportFull export of everything stored for a user
Erasure (right to forget)DELETE /users/{id}/memoriesOne-command purge of a user's memories
PortabilityPOST /users/{id}/importRe-import a previous export
RecoverabilityGET /users/{id}/archiveRetrieve consolidated-away originals

Combined with the hash-chained audit trail and 90-day retention floor, these map directly onto the controls documented in SECURITY.md (SOC 2-aligned).


🎛️ Dashboards

Two built-in browser UIs — no extra setup, they start automatically with the server.

Memory Dashboard — http://localhost:3033/ui

A full read/write view with Memories · Audit · Pools tabs: stats bar (Strong / Fading / Near-prune), per-agent tabs, memory cards with live strength bars, category filters, the audit trail, and pool management.

Graph Visualiser — http://localhost:3033/graph

An interactive force-directed map of how memories connect — root memory as a bright node, neighbours color-coded by category, edge thickness = connection strength. Drag, zoom, and click any node for full content.

http://localhost:3033/graph?memoryId=42&userId=alex&depth=2

🔧 MCP Tools

Three tools, called by your AI automatically.

ToolWhen your AI calls itWhat it does
recall_memory(query, current_path?)Start of every taskSurfaces memories ranked by similarity × decay strength; spatial boost for path-matched memories
store_memory(content, importance, category?, context_paths?)After learning something newEmbeds, deduplicates, stores with decay; tags optional file/dir paths
update_memory(id, new_content, importance)When a stored fact is outdatedRe-embeds and replaces; logs the change to the audit trail
python
# Store with spatial contextstore_memory(    "Alex prefers tabs over spaces in Python",    importance=0.9, category="fact",    context_paths=["/projects/backend"],)
# Next session — spatial boost fires when working in that directoryrecall_memory("Python formatting", current_path="/projects/backend")# → {"content": "Alex prefers tabs over spaces in Python", "strength": 0.87}

⚡ Ask Without an LLM Call

The only memory system that can answer questions without making any LLM API call:

bash
yourmemory ask "what database does this project use"# → YourMemory uses DuckDB locally and Postgres in production.
yourmemory ask "how do I fix a kubernetes deployment"# → Not enough memory context to answer without an LLM.

When memory is strong enough it answers instantly — zero tokens, zero cloud cost, zero latency. When it isn't, it declines cleanly rather than hallucinating. Your query never leaves your machine.


🔀 API Proxy — Guaranteed Memory

MCP tools are called at the AI's discretion. The API proxy removes that uncertainty — it intercepts every LLM call, injects relevant memories automatically, and handles store_memory / update_memory with no model configuration.

Start the server (yourmemory), then point your client at localhost:3033:

python
from anthropic import Anthropic
client = Anthropic(    api_key="sk-ant-...",    base_url="http://localhost:3033/proxy/anthropic",    default_headers={"X-YourMemory-User": "alex"},  # per-user memory)
# Memory is injected automatically — no other changes neededresponse = client.messages.create(    model="claude-opus-4-8",    max_tokens=1024,    messages=[{"role": "user", "content": "What database do I use?"}],)

OpenAI works identically via base_url="http://localhost:3033/proxy/openai".


🏗️ Architecture & Stack

mermaid
flowchart LR    C["Your AI client<br/>Claude · Cursor · any MCP"] <--> Y["🧠 YourMemory"]    Y --> M[("Memory<br/>store")]    Y --> A[("Audit<br/>ledger")]    style Y fill:#0a2540,stroke:#19cdff,color:#fff    style M fill:#0c1a2c,stroke:#5eead4,color:#fff    style A fill:#0c1a2c,stroke:#5eead4,color:#fff
ComponentRole
DuckDBDefault vector store — zero setup, native cosine similarity
PostgreSQL + pgvectorOptional — for teams or large datasets
NetworkXDefault graph backend (~/.yourmemory/graph.pkl)
Neo4jOptional graph backend
sentence-transformersLocal embeddings (multi-qa-mpnet-base-dot-v1, 768 dims)
spaCyLocal NLP for deduplication and entity extraction
APSchedulerAutomatic decay + pruning

🩺 Troubleshooting

Writes hang / time out (DuckDB single-writer lock). If both the MCP server and the HTTP server run at once, they compete for the DuckDB write lock. Fix:

bash
pkill -f yourmemory 2>/dev/null || truerm -f ~/.yourmemory/memories.duckdb.wal ~/.yourmemory/memories.duckdb.lock 2>/dev/null || true# restart your client

Running Claude Desktop (MCP) and Claude Code (hooks) simultaneously? Use SQLite instead — it handles concurrent readers/writers cleanly: DATABASE_URL=sqlite:///~/.yourmemory/memories.db


🤝 Contributing

PRs welcome — see CONTRIBUTORS.md.

📚 Dataset References

📄 License

Copyright 2026 Sachit Misra — Licensed under CC-BY-NC-4.0.

Free for personal use, education, academic research, and open-source projects. Commercial use requires a separate written agreement → [email protected]


Give your AI a memory worth keeping.
pip install yourmemory

來源:README.md,提交 0bda3e0

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.2最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。

其他 Memory 整合