安装脚本会下载约 1.5GB 模型,需等 3-5 分钟;装完要完全退出并重开 AI 工具才生效;Pro 档的 HyDE 检索需要自备 LLM API key;匿名遥测默认开启,需设 TRUEMEMORY_TELEMETRY=off 关闭
TrueMemory
buildingjoshbetterAGPL-3.0活跃维护给 AI 编程助手加一层本地长期记忆,自动捕获对话并自动召回,全部存在单个 SQLite 文件里,不依赖云端,兼容 Claude Code、Cursor 等 CLI 工具。
The memory your AI should have had from the start. Automatic capture, automatic recall, 100% local. One SQLite file, zero cloud. Works with Claude Code, Claude CLI, Cursor, Codex CLI, Gemini CLI.
curl -LsSf https://raw.githubusercontent.com/buildingjoshbetter/TrueMemory/main/install.sh | sh
pip install truememoryEdge 档纯 CPU 可跑,Base/Pro 需 4GB+ 内存;Pro 另需 LLM API key。安装时下载约 1.5GB 模型。README 未说明 GPU 型号要求。
给 AI 编码工具加本地长期记忆,自动捕获并召回对话,数据只存一个 SQLite 文件
给 AI 编程助手加一层本地长期记忆,自动捕获对话并自动召回,全部存在单个 SQLite 文件里,不依赖云端,兼容 Claude Code、Cursor 等 CLI 工具。
核心能力
- 用生命周期钩子自动捕获对话并注入下次会话
- 六层检索管线加 reranker,支持多轮 search_deep
- 自动解决矛盾、更新过期事实并整合记忆
- directive 标记的常驻指令每次会话自动加载
- 提供 11 个 MCP 工具与 Python Memory API
容易踩的坑
- v0.7.6.2v0.7.6.2 — BLAST OFF v3 hardening最新正式版2026-06-11 · 2026-06-11 20:33 UTC
v0.7.6.2 — BLAST OFF v3 hardening
An autonomous adversarial hardening + security + performance + reliability pass. 16 fixes (all 7 P1
- 9 P2) across PRs #698–713, including the 3 incomplete v2 fixes now fully closed (#638→#698, #649→#708, #653→#699). No API or behavior changes for normal use.
Security (P1)
- Prompt-injection / exfil hardening — recalled memory + directive text is escaped/sanitized before
injection so stored content can't forge
<truememory-*>/<system…>framing (#698); Stop/drain hooks guard the transcript path against out-of-tree reads (#699). - Least privilege — DB +
-wal/-shm+ the TrueMemory root are chmod'd 0600/0700 (#704). forget()completeness — purges all derived/aggregate tables, not just the row (#701).
Reliability (P1/P2)
- Engine auto-reconnect on a dead SQLite handle (#700).
- Crash-safe cosine migration via a commit-coupled done sentinel (#702).
- Near-duplicate dedup keeps facts differing only by a number (#703).
build_summariesnow uses the SAVEPOINT transaction wrapper — completes the #649 txn-hygiene fix that was the v2 live-lock root cause (#708).- Atomic writes everywhere: 20 adapter config sites + recall cache (fixes a fixed-tmp interleave race) + Online-Backup snapshot for pre-migration backups (#707).
- Per-session debounce on the per-exchange store (#709); extracted-marker pruning runs independent of the stale-session scan (#710, the 54K-marker unbounded-growth bug).
Performance
- Empty-consolidation recall no longer double-scans FTS — a measured ~185 ms/recall saved at 3k rows (PERF-01 #705); recall p50 168 ms → 47 ms at 1k.
- Recall/dedup-only hot paths skip the cross-encoder (#706).
Supply chain & hygiene
- Every GitHub Action SHA-pinned, incl. the OIDC publish job (#711).
hdbscandeclared as an optional extra; untrusted text control-char-stripped before logging (#712).- Docs accuracy (11 MCP tools, live
metadatafield), sdist excludestests/, test offline-env centralized in conftest (#713).
Validation
1941 tests pass; perf A/B confirms the recall improvement; real-embedding sanity OK. Ratings vs the post-v2 baseline: operational 8 → 9.0/10, security 6 → 8.5/10.
Known residual:
torchCVE-2025-3000 (core dependency, no upstream fix published; pre-existing, not introduced here). - v0.7.6.1v0.7.6.1 — BLAST OFF v2 hardening release2026-06-11 · 2026-06-11 13:33 UTC
查看更新说明
Hardening release: 25 fixes across the search pipeline, dedup/encoding gate, model server, hooks, directives, vector search, config, and platform compatibility (#630-#654).
Highlights:
- Vector tables now use cosine distance correctly (were L2); Base/Pro embeddings normalized at write time.
- Score-space contract: stop comparing relative retrieval scores to absolute cosine thresholds.
- Fixed a search crash on tied scores and dropped contradiction supplements.
- Memory Intensity per-exchange store path restored (was dead code).
- Directive injection hardening, recall-cache correctness, model-server lifecycle, DB-corruption UX, Windows compatibility, config validation, and a shared env-var parser.
- CI: the real-vector regression gate now actually runs online.
Full validation green across the CI matrix (ubuntu 3.10-3.13, macOS, Windows).
- v0.7.5.0v0.7.5.0 — Deterministic Memory Triggering2026-06-08 · 2026-06-08 11:56 UTC
查看更新说明
Deterministic Memory Triggering
TrueMemory tools are now guaranteed to be eagerly loaded in Claude Code, regardless of how many other MCP servers are installed. No more "coin flip" reliability.
What changed
alwaysLoadannotations — The 4 critical MCP tools (truememory_search,truememory_search_deep,truememory_store,truememory_stats) now carrymeta={"anthropic/alwaysLoad": True}, ensuring Claude Code loads their schemas eagerly even with 100+ tools from other servers.- Installer patches
alwaysLoad: true—truememory-ingest setupnow setsalwaysLoad: trueon the truememory MCP server entry insettings.json. - Removed ToolSearch workaround — The
CRITICAL — LOADING TRUEMEMORY TOOLSinstructions are no longer needed and have been removed.
Cross-platform CI hardening
- Fixed Windows CI: temp dir cleanup,
os.killliveness check, file permissions,USERPROFILEenv var - Fixed macOS CI: removed flaky concurrent SQLite test
- Fixed Python 3.10 CI:
tomllibskip - Fixed file handle leaks in
model_client.pyandsession_start.py - Atomic config writes in
tier_switch/manager.py - Refactored
engine.pygod class into 3 modules
Upgrade
pip install --upgrade truememory # Then re-run setup to get alwaysLoad patched in: truememory-ingest setupFull changelog: https://github.com/buildingjoshbetter/TrueMemory/blob/main/CHANGELOG.md
- v0.7.1.32026-05-23 · 2026-05-23 04:36 UTC
查看更新说明
Fix
- fix: centralize tier resolution for Base/Pro users (#383)
- Created
resolve_tier()as the canonical tier resolver (env var → config.json → "edge" fallback) - Replaced 3 instances of
os.environ.get("TRUEMEMORY_EMBED_MODEL", "edge")inengine.pythat ignored the user's configured tier - Previous fixes (v0.7.1.1, v0.7.1.2) addressed
vector_search.pyandmcp_server.pybut missedengine.py - Validated: 6 local tests pass, 5/5 APPROVE from OpenRouter multi-model review (GPT-4.1, Gemini 2.5 Pro, Claude Sonnet 4, Qwen3 235B, Llama 4 Maverick)
- Created
- fix: centralize tier resolution for Base/Pro users (#383)
- v0.7.1.22026-05-23 · 2026-05-23 03:42 UTC
查看更新说明
Fix
- fix(vector_search): read config.json as fallback when env var is unset
- v0.7.1.1's mcp_server.py import reorder was insufficient — Python runs
__init__.pybefore anymcp_server.pycode, so the env var could never be set in time. vector_search.pynow reads~/.truememory/config.jsondirectly whenTRUEMEMORY_EMBED_MODELis not in the environment, ensuring Base/Pro users get the correct embedding model regardless of import order.- Supersedes v0.7.1.1.
- v0.7.1.1's mcp_server.py import reorder was insufficient — Python runs
- fix(vector_search): read config.json as fallback when env var is unset
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Why TrueMemory
It finds signal in the noise. Your AI sees thousands of messages. TrueMemory figures out which ones actually matter and throws away the rest. No manual tagging, no prompt engineering. It just knows.
It gets sharper over time. It's not a static database. It's a living memory that grows with you. It resolves contradictions when you change your mind, updates stale facts, and consolidates what it knows. The longer you use it, the better it gets.
It works without you thinking about it. TrueMemory automatically captures memories from your conversations and automatically injects the right ones into your next session. You never have to store or search for anything manually. It just happens.
It's 100% local. One SQLite file on your machine. Your memories never leave your device. No cloud, no API keys needed. Your data is yours. (Anonymous usage telemetry is the only exception — never memory content — and one env var turns it off. Details.)
Without TrueMemory: "What framework are we using?" Asked for the 12th time this week. Your agent starts every session with amnesia. It doesn't know your name, your stack, or anything you told it yesterday.
With TrueMemory: Your agent already knows you use FastAPI, prefer Pydantic v2, and that your auth middleware lives in
src/auth/. It remembers your corrections, your preferences, and your decisions. Across every session, forever.
How TrueMemory Compares
| System | LoCoMo | LongMemEval | Local-first | Auto-capture | License |
|---|---|---|---|---|---|
| TrueMemory Pro | 93.0% | 92.0% | ✅ | ✅ | AGPL-3.0 |
| TrueMemory Base | 92.0% | 84.1% | ✅ | ✅ | AGPL-3.0 |
| Mem0 | 61.4% | — | Partial | ❌ | Apache-2.0 |
| Supermemory | 65.4% | — | ❌ | ❌ | Cloud API |
| MemOS | 75.8% | — | ✅ | ❌ | Apache-2.0 |
| ReadAgent | 79.5% | — | ❌ | ❌ | Research |
All benchmarks independently reproducible. Scripts included in
benchmarks/.
Quick Start
For Claude Code / Claude CLI / Cursor / Codex CLI / Gemini CLI
curl -LsSf https://raw.githubusercontent.com/buildingjoshbetter/TrueMemory/main/install.sh | sh
Installs everything in an isolated environment. Downloads ~1.5GB of AI models. No data leaves your machine. No sudo required.
- Open a terminal: Mac:
Cmd + Space, typeTerminal. Linux:Ctrl + Alt + T. Windows: open PowerShell. - Paste the command above and press Enter.
- Wait 3-5 minutes for models to download.
- Quit your AI tool completely and reopen it (Mac:
Cmd+Q). - Type "Set up TrueMemory" and pick a tier.
Windows (PowerShell):
irm https://raw.githubusercontent.com/buildingjoshbetter/TrueMemory/main/install.ps1 | iex
That's it. TrueMemory remembers your conversations automatically from here. Need help? Join our Discord.
If TrueMemory saves you time, a ⭐ helps other devs find it.
For developers (Python library)
pip install truememory
from truememory import Memory
m = Memory()
m.add("Prefers dark mode and TypeScript", user_id="alex")
print(m.search("preferences", user_id="alex"))
Tiers
Same architecture, three tiers. All included in a single install. Switch anytime by saying "switch to Pro" or "switch to Base."
| Edge | Base | Pro | |
|---|---|---|---|
| LoCoMo | 89.6% | 92.0% | 93.0% |
| LongMemEval | — | — | 92.0% |
| BEAM-1M | — | — | 76.6% (SOTA) |
| Embedding model | 8 MB lightweight | 600 MB high-accuracy | 600 MB high-accuracy |
| Reranker | 22M params | 149M params | 149M params |
| HyDE search | — | — | ✅ (requires LLM API key) |
| Runs on | Any machine, CPU only | 4 GB+ RAM | 4 GB+ RAM + API key |
Edge works everywhere. Base is the strongest fully-offline tier. Pro adds AI-powered query expansion for the highest scores.
Benchmarks
Tested across three major benchmarks with all systems sharing the same answer model (GPT-4.1-mini), judge (GPT-4o-mini, 3x majority vote), and scoring pipeline.
| Benchmark | What it tests | TrueMemory Pro |
|---|---|---|
| LoCoMo | 1,540 questions across 10 conversations | 93.0% |
| LongMemEval | 500 multi-session questions | 92.0% |
| BEAM-1M | 700 questions at 1M+ tokens | 76.6% (SOTA) |
| BEAM-10M | 200 questions at 10M tokens | 65.0% |
Reproduce any result yourself
Every benchmark script is self-contained and runs on Modal.
- LoCoMo Scripts — 8 systems (TrueMemory, Mem0, Zep, Engram, etc.)
- LoCoMo Results — per-category breakdowns, latency, cost
- LoCoMo Eval Config — exact models, prompts, parameters
- LongMemEval Scripts — oracle + strict variants
- LongMemEval Results — 6 TM Pro runs + 5 competitor results
- BEAM-1M Script — 35 conversations at 1M+ tokens
- BEAM-10M Script — 10 conversations at 10M tokens
- BEAM Results — 3 runs (1M) + 1 run (10M)
All benchmarks use the same eval pipeline. Nothing is hidden. Full details: LoCoMo | LongMemEval | BEAM
Works With
Lifecycle hooks capture conversations automatically. No manual work needed. Your memories stay local in a single SQLite file.
Python API
from truememory import Memory
m = Memory()
m.add("Prefers dark mode and TypeScript", user_id="alex")
m.add("Works at Anthropic as a senior engineer", user_id="alex")
m.add("Always sign commits with GPG", directive=True) # directives auto-load every session
results = m.search("What are Alex's preferences?", user_id="alex")
results = m.search_deep("career history?", user_id="alex") # multi-round, higher accuracy
| Method | Description |
|---|---|
m.add(content, user_id) | Store a memory (directive=True for standing instructions that auto-load at the start of every session) |
m.search(query, user_id) | Search (6-layer pipeline + reranker) |
m.search_deep(query, user_id) | Multi-round agentic search |
m.get(id) / m.get_all(user_id) | Retrieve memories |
m.update(id, content) / m.delete(id) | Modify or remove |
m.stats() | System statistics |
Docs
| Getting Started | Install to first memory |
| Python API Reference | Full Memory class reference |
| MCP Tool Reference | All 11 MCP tools |
| CLI Reference | truememory-mcp and truememory-ingest |
| Environment Variables | All TRUEMEMORY_* config options |
| Architecture Deep Dive | 6-layer retrieval pipeline, encoding gate |
| Tier Selection Guide | Edge vs Base vs Pro |
| Debugging | Logs, traces, common issues |
FAQ
Everything lives locally in ~/.truememory/memories.db. Edge and Base tiers make zero external calls. Pro sends only your search query text to an LLM for query expansion. Your memories are never transmitted.
No. The installer uses uv to manage a sandboxed Python 3.12. Your system Python is never touched.
Context windows are expensive, slow, and empty at the start of every session. TrueMemory gives instant recall for zero tokens of context, in under 200ms.
Anonymous usage telemetry (tool calls, session counts, platform info) is on by default. We never track memory content, queries, file paths, or API keys. Opt out: export TRUEMEMORY_TELEMETRY=off
Get Started in 60 Seconds
For Claude Code, Claude CLI, Cursor, Codex CLI, or Gemini CLI:
curl -LsSf https://raw.githubusercontent.com/buildingjoshbetter/TrueMemory/main/install.sh | sh
Using it as a Python library instead? pip install truememory
Questions? Join our Discord or open a Discussion. If TrueMemory saves you time, give us a ⭐
Thanks to Our Contributors
Research
TrueMemory is backed by a research paper (arXiv preprint) on retrieval-centered agent memory.
Storage Is Not Memory: A Retrieval-Centered Architecture for Agent Recall (arXiv 2605.04897)
@article{sauronlabs2026storage,
title = {Storage Is Not Memory: A Retrieval-Centered Architecture for Agent Recall},
author = {Sauron Labs},
journal = {arXiv preprint arXiv:2605.04897},
year = {2026},
url = {https://arxiv.org/abs/2605.04897}
}
Community
- Join our Discord for help, feedback, and updates
- Follow @Building_Josh on X for updates
- Follow @Sauron_Labs for company news
- Open a Discussion for questions or ideas
- Read the paper on arXiv
- Visit truememory.net · sauronlabs.ai
If TrueMemory saves you time, give us a ⭐
Translations
Read this in: 简体中文 · हिन्दी · Español · Français · العربية · বাংলা · Português · Русский · 日本語 · 한국어 · Deutsch · Bahasa Indonesia · Tiếng Việt · Türkçe · Italiano · ไทย · Polski · Українська · Nederlands
License
AGPL-3.0. Free for personal and research use. Commercial use requires a separate license. Contact [email protected].