建议用 uv tool 或 pipx 隔离安装,否则在 Debian/Ubuntu/Homebrew 的 Python 上易触发 PEP 668 错误并与全局依赖冲突;首次调用嵌入会下载模型(约 80~300 MB),需联网且较慢,容易误以为容器卡死;Docker 镜像以 uid 1000 运行,Linux 下挂载目录需对该 uid 可读,否则报 PermissionError;Claude Code 会话若无自动保存钩子会在 30 天后过期。

uv tool install mempalace
mempalace init ~/projects/myappREADME 未说明显存或 GPU 型号要求;默认嵌入模型 minilm 约 80 MB、embeddinggemma 约 300 MB,首次使用需联网下载。Docker 镜像为 amd64 + arm64 多架构,GPU 变体需自行构建且未发布。
本地优先的 AI 记忆系统,逐字存储对话历史并用语义检索,全程零 API 调用
开源 AI 记忆系统,基于 ChromaDB 为 LLM 提供持久化记忆存储与检索,在基准测试中表现领先,可免费自托管。
核心能力
- 按 wing/room/drawer 分层组织索引,检索可限定范围
- 逐字保存原文,不做摘要或改写
- 检索后端可插拔,默认 ChromaDB
- 内置带有效时间窗的实体关系知识图谱,基于本地 SQLite
- 提供 47 个 MCP 工具,覆盖读写、知识图谱与代理协作
容易踩的坑
- v3.11.0v3.11.0 — audit, repair and opt-in EmbeddingGemma 2最新正式版2026-10-14 · 2026-10-14 05:25 UTC
A palace can now be audited and repaired in guided steps, and EmbeddingGemma 2 arrives as an opt-in embedder with native image, audio and video search. Every palace records the embedding model that built it and refuses to open with a different one. Conversation mining stops discarding text, status, search, wake-up and hub mines stay responsive on large palaces, and a round of correctness fixes from the 3.11 review hardens metadata updates, recovery and HTTP validation.
Upgrade notes
- The first conversation mine after upgrading re-mines each conversation file it covers, once. The exchange chunker no longer discards text (#2591), so conversation drawers filed before 3.11 count as stale and are re-chunked and re-embedded from transcripts still on disk; transcripts no longer on disk keep their drawers. Project files are not re-mined. Expect roughly 40 minutes to 3 hours per million drawers, depending on hardware. On a large palace, back up first and run it in batches at a quiet time, for example
mempalace mine <dir> --mode convos --limit 200; an interrupted run resumes where it stopped. - A palace refuses to open with a different embedding model than the one that built it. Search, mining and MCP writes stop with a message that names the fix: set
embedding_model(config.jsonorMEMPALACE_EMBEDDING_MODEL) back to the model the palace was built with, or re-embed withmempalace repair rebuild-index. A palace with no recorded model opens with the configured one and a warning that namesmempalace palace set-embedder. (#2694, #2717) EntityRegistry.research()andconfirm_research()are removed. They were an opt-in, off-by-default Wikipedia lookup that nothing in the CLI, MCP server, miners or hooks called. Existingwiki_cacheentries inentities.jsonare still read bylookup(). (GHSA-mrj5)
EmbeddingGemma 2 and embedder identity
- EmbeddingGemma 2 is available as an opt-in embedder. Set
embedding_model: embeddinggemma2and installmempalace[embeddinggemma2], ormempalace[multimodal]for media (Python 3.10+, PyTorch). It runs on CUDA when present, on Apple MPS, or on CPU, and supports 768/512/256/128 dimensions. A CUDA out-of-memory error halves the batch and retries. (#2694, #2717) - Native image, audio and video retrieval. A built-in
mediasource adapter embeds original files into a separatemempalace_assetscollection, and opt-in CLI/MCP media search returns typed local asset references alongside matching drawers. File-level retrieval is experimental. (#2694) - Existing palaces are untouched unless you opt in. The default MiniLM path is unchanged and nothing is re-embedded. An unknown
embedding_modelkeeps the MiniLM fallback, while near misses of a known name are refused instead of silently falling back. (#2717) - Every palace records which embedder built it, and every write path fails closed on a mismatch. CLI, MCP, mine and
repaircheck the recorded identity;repair rebuild-indexand--mode from-sqliterecord it again after a verified rebuild; new Qdrant and pgvector palaces record it; and MCP refuses rather than falling back to Chroma's default embedder. (#2717; fixes #2709)
Palace audit and guided repair
mempalace auditscores how well a palace is organized, across five layers (rooms, wings, tunnels, hallways and knowledge graph), with concrete findings,--jsonoutput and--fail-underfor cron or CI. It is read-only and runs against a palace an MCP server is serving. (#2576)- Guided repair tooling:
mempalace instructions auditwalks an agent and user through the findings;rooms propose/applygive a wing a closed room set;wings splitturns a machine-level transcript wing into one wing per project;tunnels propose/pruneandhallways --rebuild/--prune-spellingsclean up noisy links; andkg normalizemaps one-off predicates onto a closed vocabulary. Everything is a dry run until--yes, and interrupted runs
- The first conversation mine after upgrading re-mines each conversation file it covers, once. The exchange chunker no longer discards text (#2591), so conversation drawers filed before 3.11 count as stale and are re-chunked and re-embedded from transcripts still on disk; transcripts no longer on disk keep their drawers. Project files are not re-mined. Expect roughly 40 minutes to 3 hours per million drawers, depending on hardware. On a large palace, back up first and run it in batches at a quiet time, for example
- v3.10.0v3.10.0 — lighter ways in for agents2026-09-16 · 2026-09-16 00:24 UTC
查看更新说明
Agents get lighter ways in: a 3-tool MCP server with Palace Query Language, shared-brain rules for
host:harness:projectidentities, and optional native exact-vector search. New installs follow XDG, and storage fixes close a silent write-loss path, a macOS integrity refusal and several hangs.Upgrade notes
mempalace rulesno longer accepts--agent. Pass--host,--harnessand--project, then re-render any installed shared-brain block. (#2508)get_collection()refuses names MemPalace never reads. Any name other than the configured drawers collection ormempalace_closetsraisesCollectionNameMismatchError; maintenance scripts can pass_skip_name_check=True. (#2446)- The MCP event listing returns the newest events first when no cursor is given.
mempalace_event_listandpalace_coordinatenow default to newest-first unlesssince_event_idororderis passed;mempalace logstream listandLogstream.list_events()still default to oldest-first. (#2497) - New installs keep config and palace under
~/.config/mempalace(or$XDG_CONFIG_HOME/mempalace). Existing~/.mempalaceinstalls are unchanged. (#148)
Performance & Architecture (Dual-Track Rust Engine)
-
Optional native Rust exact-vector acceleration (
rust_exact). Reads the existing SQLite format into a contiguous float buffer, uses Rayon for large scans, and releases the Python GIL. Local and external writes invalidate the native cache. Loading is collection-scoped and decodes blobs safely; serial and parallel scans preserve deterministic tie ordering. Complex filters and absent native extensions fall back to Python. -
Standalone native vector CLI and optional wheels. GitHub releases include native wheels and platform executables. The CLI accepts JSON embedding vectors via
--vectoror stdin; it does not embed text or require Python. Platform runtime libraries may still be required. -
NumPy top-k optimization. Cache vector norms and partition distances before sorting the selected results, preserving row-order ties at the cutoff.
-
Read-only search operations stop contending with palace writer leases.
searcher.pyand_open_search_collectionnow explicitly open collections withread_only=True. Read-only queries connect in SQLite WAL reader mode without attempting schema initialization or writer lease locks, allowing CLI and agent searches to run concurrently with an active background MCP server or writer process without raisingMineAlreadyRunning.
Refactors
- MCP server is a package, not an 8 000-line module.
mempalace.mcp_serverstays the public import path (TOOLS,handle_request,main, everytool_*handler, and the process-global names tests monkeypatch). Implementation lives in domain files undermempalace/mcp_server/so PRs can target drawers, KG, coordination, protocol, or HTTP without colliding on one god-file. Fragments exec into the package namespace — a physical split, not a behaviour change. - CLI is a package, not a 4 000-line module.
mempalace.clistays the public import path (main, everycmd_*handler, and the names tests monkeypatch). Implementation lives in domain files undermempalace/cli/so PRs can target init, mine, search, repair, logstream, or argparse without colliding on one god-file. Fragments exec into the package namespace — a physical split, not a behaviour change. - MCP server tests are split by domain.
tests/test_mcp_server.pyis nowtests/mcp/(protocol, read, search, write, diary, KG, guards, stale-library) so community MCP PRs do not collide on one 8 600-line test file. Shared helpers live intests/_mcp_server_helpers.py. - Searcher is a package, not a 2 200-line module.
mempalace.searcherstays the public import path (search,search_memories,SearchError, and the helpers tests monkeypatch). Implementation lives undermempalace/searcher/(ranking, filters, sqlite BM25, candidates, q
- v3.9.0v3.9.0 — one hub for every agent2026-08-31 · 2026-08-31 10:25 UTC
查看更新说明
v3.9.0 — one hub for every agent
One hub now serves every agent. CLI search reuses the live palace index instead of loading another multi-gigabyte HNSW copy, concurrent searches stop blocking each other, and skill-first coordination plus opt-in release awareness make shared-brain fleets easier to operate safely.
Shared hub and search
mempalace searchreuses a healthy live Hub. On the reported 4.99-million-vector palace, two direct CLI searches held about 18.6 GB of private RSS. Forwardable searches now reuse the Hub collection while preserving filters, ranking, output, authentication, configuration negotiation, and safe fallback behavior. (#2379)- Hub reads run concurrently. Searches no longer serialize behind one exclusive HTTP dispatch lock; reads share a writer-preferring lock while mutations remain exclusive. (#2398)
- Search results are clearer and faster to enrich. Public similarity is the raw vector score, closet boost remains in effective ranking, source lookups are indexed, and duplicate enriched passages are removed. (#2399, #2143)
- A private-palace benchmark is included for product search evaluation without exposing private queries or corpus text. (#2400)
Agent coordination and operations
- Skill-first setup and task handoff. The guided setup skill can bootstrap private or shared-brain installations, render canonical rules, assign stable fleet identities, and validate logstream readiness. Task creation now records an immutable base commit and complete definition of done before controlled launch. (#2374, #2361)
- Release awareness is explicit and opt-in. Agents can surface cached update state and prepare an exact upgrade plan without blocking, auto-installing, or silently enabling network checks. (#2376)
- Logstream gains topic routing and reverse pagination, making focused coordination and newest-first inspection practical without weakening append-only cursor guarantees. (#2397)
Correctness and resource safety
- Unreadable configuration is never overwritten. Invalid files are preserved, writes are atomic where possible, symlinks remain intact, and UTF-8 project configuration is handled consistently. (#2357, #2353, #2369)
- Drawer mutations purge stale closet entries, single conversation files mine correctly through a running Hub, and absent SQLite databases no longer report a false clean integrity verdict. (#2355, #2282, #2291)
- Qdrant bounded reads stop scanning whole collections, and EmbeddingGemma internal batches can be reduced for long drawers on memory-constrained hardware. (#2384, #2383)
A big thank-you to everyone who contributed. This release includes 29 merged PRs and seven first-time contributors.
Install:
pip install -U mempalace==3.9.0What's Changed
- docs: refresh the release entry-point check and plugin tool counts by @igorls in https://github.com/MemPalace/mempalace/pull/2348
- docs(shared-brain): teach the from-zero guide about logstream watch by @igorls in https://github.com/MemPalace/mempalace/pull/2349
- docs(coordination): wake for replies, and keep announcements silent by @igorls in https://github.com/MemPalace/mempalace/pull/2352
- fix(mcp): report an absent integrity verdict instead of a clean one (#2290) by @mvalentsev in https://github.com/MemPalace/mempalace/pull/2291
- docs: add branching model to CONTRIBUTING.md by @jjcav84 in https://github.com/MemPalace/mempalace/pull/2246
- fix(sqlite_exact): cross-handle cache invalidation and filtered id lookups by @igorls in https://github.com/MemPalace/mempalace/pull/2362
- fix(search): return distinct passages after closet enrichment by @fatkobra in https://github.com/MemPalace/mempalace/pull/2143
- fix(graph): report complete palace graph stats by @MichaelWave369 in https://github.com/MemPalace/mempalace/pull/2288
- feat(cli):
mempalace rules— render the canonical shared-brain rules block by @igorls in https://github.com/MemPalace/mempalace/pull/2361 - fix(mcp):
- v3.8.0v3.8.0 — fast large palaces, lean MCP proxies, wakeable agents2026-08-23 · 2026-08-23 21:11 UTC
查看更新说明
v3.8.0 — fast large palaces, lean MCP proxies, wakeable agents
Large palaces get fast and stay small in 3.8.0. Chroma metadata tools no longer cold-load HNSW,
sqlite_exactstops scanning and hydrating the whole palace for common reads, long-running Chroma servers stop rebuilding their client on their own writes, and proxied MCP sessions no longer import a storage stack they never use. Agents also gain a persistentlogstream watchprimitive so coordination can wake a harness instead of relying on repeated five-minute waits.Performance
- Chroma metadata reads skip the vector index. On a 1.7 GB / 165k-drawer palace, wing-scoped
list_drawers(limit=20)fell from 2.31 s and 1148 MB peak RSS to 0.01 s and 86 MB.list_drawersand tunnel reads now query Chroma's SQLite metadata directly, push filters into SQL, and hydrate only the requested previews. (#2314) sqlite_exactcommon reads no longer walk the whole palace. On a live 167k-drawer / 166k-closet palace,mempalace_statusfell from 6997 ms to 1045 ms and warmmempalace_searchfrom 6364 ms to 210–1600 ms. Vector ranking is batched and cached, top-k documents are hydrated afterward, equality filters paginate in SQL, taxonomy results are cached, andwing/room/hallgain indexed generated columns without rewriting the 1.6 GB embedding table. (#2308, #2311, #2313)- Long-running Chroma servers stay flat instead of reloading HNSW on their own writes. Across eight searches, measured RSS changed from 951 MB → 3522 MB before to 940 MB → 965 MB after. Replaced clients are closed, while genuine external database changes still trigger a rebuild. (#2307)
- Hub-proxied MCP sessions are thin. A plain stdio proxy now imports only the forwarding path and lazily loads the full server only if local fallback is needed. A proxied session runs at roughly 17 MB, with import weight falling from about 80 MB to 24 MB—avoiding roughly 3.9 GB across a 50-agent fleet. (#2312)
Agent coordination
mempalace logstream watchprovides a durable wake-up loop. It owns cursor advancement, supports repeated type filters, agent self-exclusion, persistent state files, idle exit, and NDJSON follow mode. Cursorless first runs start at the live tip; restarts may replay an event but do not silently miss one. (#2315)- The monitoring protocol now documents the safe resume cursor. Cross-replica events are appended in arrival order, so
since_event_id—not a wall-clock timestamp—is the resumable high-water mark. Tool descriptions and the shared coordination protocol now put that rule where agents use it. (#2315)
Integrity and operations
sync --applyno longer deletes drawers whose source file it could not reach. OnePath.exists()separated keep from remove, so an unreadable directory, a path component that is a regular file, and a volume that is not mounted all answered the same as a deletion — a project mined from a mounted volume could lose every drawer to onesync --applywhile the volume was away, and come back empty. Removal now asks for corroboration rather than a probe: a file that is not at its path is removable only while the palace can still see a source of its own, a regular file, in that same directory. Everything uncorroborated lands in a newunresolvedbucket, never pruned and reported the way removals are. (#2320)- EmbeddingGemma cannot silently store NaN or zero vectors through CoreML auto-selection on Apple Silicon. Auto mode avoids the affected provider/model pair, and every vector is checked for a finite, non-zero norm before use. CUDA, DirectML, and other models are unchanged. (#2283)
- FTS5 auto-heal verifies and repairs the content table before rebuilding the index. It uses Chroma's metadata copy as authority where possible and declines to guess when integrity cannot be established. (#2279)
- Mesh status is consistent across transports. The hub publishes a token-free, last-k
- Chroma metadata reads skip the vector index. On a 1.7 GB / 165k-drawer palace, wing-scoped
- v3.7.1v3.7.1 — mine completeness, reconnect integrity, clean shutdown2026-08-14 · 2026-08-14 17:51 UTC
查看更新说明
v3.7.1 — mine completeness, reconnect integrity, clean shutdown
Post-3.7.0 integrity patch: ingest no longer hangs on non-regular files, incomplete mines can be retried instead of permanently skipped, chromadb reconnect no longer rewinds the HNSW index, and MCP releases the writer lease on SIGTERM/SIGHUP.
Bug Fixes
- Ingest commands no longer hang on a named pipe.
os.walkandgloblist a FIFO as an ordinary filename and MemPalace decides what to read from the suffix, so a pipe callednotes.mdin a mined directory wedgedminein the kernel forever: opening a FIFO for reading waits for a writer that never arrives, and theS_ISREGrefusal written on the next line could never run.mine --mode convos,sweep,init,compressandsplitblocked the same way through their own readers. The four affected opens now passO_NONBLOCK, which makes the existing type check reachable — a pipe is refused on its mode, with or without a live writer — and the discovery walks drop non-regular entries with aSKIP: <name> (not a regular file)line, so the readers that use a plainopen()never see one. Regular files read back byte-identical; the one case where the flag is not inert, a reader breaking a write lease, re-checks the file type and retries without it rather than dropping the file.mine --mode extractwas already immune through its zero-size gate. (#2221) - Project re-mine no longer silently skips a partial or interrupted file. Four related gaps in
process_file: (1) multi-batch upserts now stamp every drawer withchunk_totalsofile_already_minedcan tell "N of N committed" from "crashed after batch 1"; (2)source_mtimecomes from the samefstatas the content read, so an append between read and a later re-stat cannot permanently hide the new tail; (3) a failed stale-drawer purge aborts the file instead of half-overwriting; (4) closets are purged even when the re-mine ends with zero drawers. A mid-file upsert failure also deletes the partial drawers and closets for that source before re-raising, so the next mine retries instead of treating the incomplete set as complete. (#2088, #2122, #2151) - Conversation mine completeness matches the project path. Convo drawers now stamp
chunk_total; a mid-batch upsert failure deletes that source's partial drawers before re-raising;prefetch_mined_setomits incomplete groups so the bulk "already filed" skip cannot permanently strand missing exchanges from an interrupted transcript mine. (#2183) - Stale chromadb System cache is cleared on palace reconnect. After a peer or rebuild changes
chroma.sqlite3on disk, bothmcp_server._get_clientandChromaBackend._clientdrop chromadb's path-keyedSharedSystemClientcache before reopening — otherwise the stale in-memory HNSW segment is reused and can persist an outdated index over the peer's writes (index count going backwards). (#2002, #2028, #2026, #2032) - MCP releases the palace writer lease on SIGTERM/SIGHUP. The lease was only released via
atexit, which CPython skips on those signals' default disposition. SSH disconnect (SIGHUP) and container/systemd stop (SIGTERM) therefore leftmine_palace_*.locknaming a dead PID until a contender's liveness check reclaimed it.main()now installs handlers that exit throughsys.exit, so the existingatexitrelease path runs. (#2205)
A big thank-you to everyone who contributed to this release. Contributors and first-time contributors are credited below.
What's Changed
- fix(tests): harden hybrid search against empty Windows Chroma reads by @igorls in https://github.com/MemPalace/mempalace/pull/2220
- docs(changelog): lead 3.7.0 with agent logstream + tighten notes by @igorls in https://github.com/MemPalace/mempalace/pull/2219
- fix: 3.7.1 critical patch — hang, re-mine honesty, stale Chroma cache by @igorls in https://github.com/MemPalace/mempalace/pull/2228
- fix(mcp_server): reset chromadb System cache on staleness reconnect (#20
- Ingest commands no longer hang on a named pipe.
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
MemPalace
Local-first AI memory. Verbatim storage, pluggable backend, 96.6% R@5 raw on LongMemEval — zero API calls.
[!CAUTION] Beware of impostor sites. MemPalace has no other official websites. The only official sources are this GitHub repository, the PyPI package, and the docs at mempalaceofficial.com. Any other domain (including
.tech,.net, or other.comvariants) is an impostor and may distribute malware. Details and timeline: docs/HISTORY.md.
[!IMPORTANT] Claude Code sessions expire in 30 days without auto-save hooks wired. Read this →
Need the shortest recovery/setup path? Use the Claude Code retention setup checklist.
What it is
MemPalace stores your conversation history as verbatim text and retrieves it with semantic search. It does not summarize, extract, or paraphrase. The index is structured — people and projects become wings, topics become rooms, and original content lives in drawers — so searches can be scoped rather than run against a flat corpus.
The retrieval layer is pluggable. The current default is ChromaDB; the
interface is defined in mempalace/backends/base.py
and alternative backends can be dropped in without touching the rest of
the system.
Nothing leaves your machine unless you opt in.
Architecture, concepts, and mining flows: mempalaceofficial.com/concepts/the-palace.
Install
Agent-guided setup
Install the MemPalace skills first, then ask your coding agent to set up MemPalace. The setup skill detects your system, installs the Python package, configures MCP, and asks whether you want a private local palace, a shared-brain hub, or a client connected to an existing hub:
npx skills add MemPalace/mempalace
The repository exposes three skills: mempalace for guided installation and
operations, mempalace-recall for search-before-answer recall, and
mempalace-task for logstream delegation. Installing a skill does not by
itself install the MemPalace CLI or MCP server; the setup skill guides the
agent through those system changes and verifies the live connection.
During guided setup the agent can offer weekly stable-release checks. They are
disabled by default, contact only PyPI when enabled, and never install updates
automatically. Cached availability appears in scoped mempalace_status fields
for the serving runtime and, when a local proxy is present, its client runtime,
allowing the agent to explain the release and request authorization before showing an exact
upgrade plan. Setup records whether the runtime came from uv tool, pipx, or
pip so the plan never proposes an upgrade command for the wrong installation.
Direct CLI setup
MemPalace ships a CLI, so install it in an isolated environment to avoid
PEP 668 errors on Debian/Ubuntu/Homebrew Pythons and to keep mempalace's
deps (chromadb, numpy, grpcio, …) from conflicting with anything
else in your global site-packages.
We recommend uv — uv tool install puts
the mempalace CLI in an isolated environment on your PATH:
uv tool install mempalace
mempalace init ~/projects/myapp
pipx works the same way if you prefer it:
pipx install mempalace.
Prefer plain pip only inside an activated virtualenv where you
explicitly want import mempalace available:
python -m venv .venv && source .venv/bin/activate
pip install mempalace
Android / Termux
Native Termux installation is not currently supported because compiled dependencies such as ChromaDB and ONNX Runtime publish Linux wheels, not Android wheels. Android ARM64 users can run the regular Linux packages in an isolated Debian PRoot container instead. See the Termux installation guide for the tested setup and an argv-preserving launcher.
Docker
A container image is also available for running the MCP server or the CLI without a local Python toolchain. Multi-arch (amd64 + arm64), so it runs natively on Apple Silicon:
docker pull ghcr.io/mempalace/mempalace:latest
Everything persists under /data — palace, config, and the cached embedding
model — so mount a volume there and reuse it across runs:
# MCP server over stdio — note the `-i` flag (JSON-RPC needs stdin)
docker run -i --rm -v mempalace-data:/data ghcr.io/mempalace/mempalace
# Run any CLI command instead. The container only sees what you mount, so
# mount the directory you want to mine — read-only is enough, mining never
# writes to the source.
docker run --rm -v mempalace-data:/data -v /path/to/project:/work:ro \
ghcr.io/mempalace/mempalace mine /work
docker run --rm -v mempalace-data:/data ghcr.io/mempalace/mempalace search "why GraphQL"
The first command that needs embeddings downloads the model into /data
(~80 MB for the default minilm, ~300 MB for embeddinggemma). It is a
one-off as long as the volume persists, but it does mean the first call is
slow and needs network — worth knowing before assuming a hung container.
Wire it into an MCP client (e.g. Claude Code) as a stdio server. Mount anything you want the server to be able to mine — it cannot reach your transcripts otherwise:
{
"mcpServers": {
"mempalace": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "mempalace-data:/data",
"-v", "/absolute/path/to/.claude/projects:/transcripts:ro",
"ghcr.io/mempalace/mempalace"
]
}
}
}
Use a real absolute path there — ~ and $HOME are not expanded by every
MCP client. Paths are container paths from then on: mine /transcripts, not
~/.claude/projects.
Mount permissions on Linux. The image runs as uid 1000 and bind mounts
keep their host ownership, so a mounted directory has to be readable by that
uid — an ordinary 0755 checkout is fine, a 0700 directory is not, and the
failure surfaces as PermissionError: [Errno 13] rather than anything about
Docker. Docker Desktop maps uids on macOS and Windows, so this only bites on
Linux. Do not work around it with --user: /data is owned by uid 1000
inside the image, so another uid cannot write the palace at all.
docker compose run --rm mcp works too (see docker-compose.yml), and
deploy/docker-compose.server.yml stands up the team server. To build the
image yourself instead of pulling — required for the GPU variant, which is not
published:
docker build -t mempalace . # CPU
docker build --build-arg EXTRAS="extract,spellcheck" -t mempalace .
docker build -f Dockerfile.gpu -t mempalace:gpu . # CUDA; run with --gpus all
The GPU image is x86_64-only: onnxruntime-gpu publishes no aarch64 Linux
wheels, so that last build fails on an ARM host (including Apple Silicon) with
a dependency-resolution error rather than an obvious one.
Note that a build from a clone uses whatever branch you checked out; develop
is the default branch, so pull the published image if you want the released
version.
Storage backends
ChromaDB is the default and needs no configuration. MemPalace also ships a pluggable backend contract, exercised across deliberately different substrates so the contract is never accidentally shaped around one vendor. Every non-default backend is opt-in.
| Backend | Mode | Install | Namespaces | Lexical | Configure with |
|---|---|---|---|---|---|
chroma (default) | Local (embedded) | bundled | – | ✓ | – |
sqlite_exact | Local (exact NumPy) | bundled | – | ✓ | – |
rust_exact | Local (native vectors) | wheel / compiled | – | ✓ | – |
milvus | Local (Lite) · Server opt-in | mempalace[milvus] | ✓ | ✓ | MEMPALACE_MILVUS_URI |
qdrant | Server (REST) | bundled | ✓ | ✓ | MEMPALACE_QDRANT_URL |
pgvector | Server (Postgres) | mempalace[pgvector] | ✓ | ✓ | MEMPALACE_PGVECTOR_DSN |
Select with --backend <name>, MEMPALACE_BACKEND=<name>, or
"backend": "<name>" in config.json. rust_exact uses the exact same sqlite_exact.sqlite3 file on disk as sqlite_exact with zero data migration. See native installation and vector CLI usage for the separately distributed wheel and executables.
Native vector search
rust_exact and the standalone mempalace-native CLI scan the same sqlite_exact database with a native Rust engine. The rust_exact adapter falls back to the Python backend for complex filters, requests for returned embeddings, and installs without the native extension; the mempalace-native executable is Rust-only and has no Python fallback. No benchmark figures are published for this release; mempalace-native bench --db <sqlite_exact.sqlite3> measures it on your own data. See crates/ for the core workspace, PyO3 bindings, and native CLI.
Quickstart
# Mine content into the palace
mempalace mine ~/projects/myapp # project files
mempalace mine ~/.claude/projects/ --mode convos # Claude Code sessions (scope with --wing per project)
# Search
mempalace search "why did we switch to GraphQL"
# Load context for a new session
mempalace wake-up
# Score how well organized the palace is (read-only, safe while the MCP server runs)
mempalace audit
For Claude Code, Gemini CLI, Antigravity, MCP-compatible tools, and local models, see mempalaceofficial.com/guide/getting-started.
Benchmarks
All numbers below are reproducible from this repository with the commands
in benchmarks/BENCHMARKS.md. Full
per-question result files are committed under benchmarks/results_*.
LongMemEval — retrieval recall (R@5, 500 questions):
| Mode | R@5 | LLM required |
|---|---|---|
| Raw (semantic search, no heuristics, no LLM) | 96.6% | None |
| Hybrid v4, held-out 450q (tuned on 50 dev, not seen during training) | 98.4% | None |
| Hybrid v4 + LLM rerank (full 500) | ≥99% | Any capable model |
The raw 96.6% requires no API key, no cloud, and no LLM at any stage. The hybrid pipeline adds keyword boosting, temporal-proximity boosting, and preference-pattern extraction; the held-out 98.4% is the honest generalisable figure.
The rerank pipeline promotes the best candidate out of the top-20
retrieved sessions using an LLM reader. It works with any reasonably
capable model — we have reproduced it with Claude Haiku, Claude Sonnet,
and minimax-m2.7 via Ollama Cloud (no Anthropic dependency). The gap
between raw and reranked is model-agnostic; we do not headline a "100%"
number because the last 0.6% was reached by inspecting specific wrong
answers, which benchmarks/BENCHMARKS.md flags as teaching to the test.
Other benchmarks (full results in benchmarks/BENCHMARKS.md):
| Benchmark | Metric | Score | Notes |
|---|---|---|---|
| LoCoMo (session, top-10, no rerank) | R@10 | 60.3% | 1,986 questions |
| LoCoMo (hybrid v5, top-10, no rerank) | R@10 | 88.9% | Same set |
| ConvoMem (all categories, 250 items) | Avg recall | 92.9% | 50 per category |
| MemBench (ACL 2025, 8,500 items) | R@5 | 80.3% | All categories |
We deliberately do not include a side-by-side comparison against Mem0, Mastra, Hindsight, Supermemory, or Zep. Those projects publish different metrics on different splits, and placing retrieval recall next to end-to-end QA accuracy is not an honest comparison. See each project's own research page for their published numbers.
Reproducing every result:
git clone https://github.com/MemPalace/mempalace.git
cd mempalace
uv sync --extra dev # or: pip install -e ".[dev]"
# see benchmarks/README.md for dataset download commands
uv run python benchmarks/longmemeval_bench.py /path/to/longmemeval_s_cleaned.json
Knowledge graph
MemPalace includes a temporal entity-relationship graph with validity windows — add, query, invalidate, timeline — backed by local SQLite. Usage and tool reference: mempalaceofficial.com/concepts/knowledge-graph.
MCP server
47 MCP tools cover palace reads/writes, knowledge-graph operations, cross-wing navigation, drawer management, agent diaries, and agent coordination (logstream events + artifact handoffs). Installation and the full tool list: mempalaceofficial.com/reference/mcp-tools.
Agents
Each specialist agent gets its own wing and diary in the palace.
Discoverable at runtime via mempalace_list_agents — no bloat in your
system prompt:
mempalaceofficial.com/concepts/agents.
Auto-save hooks
Auto-save hooks for Claude Code, Codex CLI, and Cursor IDE save periodically and before context compression:
- Claude Code + Codex → mempalaceofficial.com/guide/hooks
- Cursor IDE (adds session-start recall and a transcript snapshot before compaction) → mempalaceofficial.com/guide/cursor-hooks
If you are installing under time pressure, start with the
Claude Code retention setup checklist:
wire the hooks, back up existing JSONL transcripts, and backfill them with
mempalace mine ~/.claude/projects/ --mode convos.
For per-message recall on top of the file-level chunks the hooks produce,
run mempalace sweep <transcript-dir> periodically — it stores one
verbatim drawer per user/assistant message, idempotent and resume-safe.
Requirements
- Python 3.10+
- A vector-store backend (ChromaDB by default)
- ~300 MB disk for the embedding model. Pick it with
mempalace init --embedding-model:embeddinggemma(embeddinggemma-300m, multilingual, 100+ languages, recommended) orminilm(all-MiniLM-L6-v2, English-only, ~30 MB). See the docstring atmempalace/embedding.pyfor details and migration notes. - Optional — compute embeddings on a server instead of locally. Set
embedding_model: "openai-compat"in~/.mempalace/config.jsontogether withembedding_api_url/embedding_api_model(andembedding_api_keyif the server needs auth) to use any OpenAI-compatible/v1/embeddingsendpoint — LM Studio, llama.cpp, vLLM, Ollama's OpenAI shim, or a self-hosted server (e.g. a larger multilingual or GPU-served embedder). Each key is overridable via the matchingMEMPALACE_EMBEDDING_API_*env var. When the endpoint is on your machine or LAN, no content leaves your network. Switching to it requiresmempalace repair rebuild-index(different vector space).
For GPU setup, see the model/device support table. On Apple Silicon, CPU is expected for MiniLM and EmbeddingGemma ONNX: MiniLM disables CoreML, while EmbeddingGemma excludes it from automatic selection to avoid invalid vectors. Experimental EmbeddingGemma 2 supports PyTorch MPS with health checks and CPU fallback. Changing models on an existing palace requires re-embedding; changing only the device does not.
No API key is required for the core benchmark path.
Docs
- Getting started → mempalaceofficial.com/guide/getting-started
- CLI reference → mempalaceofficial.com/reference/cli
- Python API → mempalaceofficial.com/reference/python-api
- Full benchmark methodology → benchmarks/BENCHMARKS.md
- Release notes → CHANGELOG.md
- Corrections and public notices → docs/HISTORY.md
Contributing
PRs welcome. See CONTRIBUTING.md.
License
MIT — see LICENSE.