
Mempalace
Local-first verbatim AI memory with 96.6% recall
Replaces Mem0, Zep

Who it's for
A developer running Claude Code or Cursor wires MemPalace auto-save hooks so every session is indexed before context compression. On the next session, `mempalace wake-up` loads relevant context and the agent resumes without re-explaining project decisions or architecture choices.
An agentic pipeline runs specialist agents — a researcher, a writer, a reviewer — each with its own wing and diary in a shared palace hub. Agents hand off work via logstream events and artifact handoffs through the 47 MCP tools, discoverable at runtime via `mempalace_list_agents`.
Single-agent setups with no handoff requirements
`mempalace mine ~/projects/myapp` indexes a codebase so queries like `mempalace search "why did we switch to GraphQL"` return the original discussion verbatim. Everything stays local; no code is sent to any external service.
Teams that need centralized cloud search across many users
A researcher mines documents and conversation exports into a local palace, then queries across the full corpus with scoped semantic search. The embeddinggemma model supports 100+ languages, and the optional knowledge graph tracks temporal entity relationships with validity windows.
The problem
AI coding agents and chat sessions lose context as conversations grow long or expire, forcing users to re-explain decisions, project history, and personal preferences from scratch in every new session. Existing memory layers typically summarize or paraphrase, which loses the original wording and introduces inaccuracies, while cloud-based approaches send private conversation data to third-party servers.
How it works
MemPalace saves conversation history exactly as written — no summarization, extraction, or paraphrasing. The original wording is always retrievable, which preserves precision and prevents the information loss that compressed memory layers introduce.
Memory is organized hierarchically: people and projects become wings, topics become rooms, and individual pieces of content live in drawers. Searches can be scoped to a wing or room rather than scanning an undifferentiated flat corpus.
ChromaDB is bundled and requires no configuration. Six additional backends are supported: sqlite_exact, rust_exact (native Rust engine sharing the same database file), Milvus, Qdrant, and pgvector. Switch with a flag, an environment variable, or a config key.
On the 500-question LongMemEval benchmark, pure semantic search scores 96.6% R@5 with no API key, no cloud, and no LLM at any stage. The optional hybrid pipeline (keyword and temporal boosting) reaches 98.4% on a held-out 450-question split, reproducible from the committed benchmark scripts.
MemPalace exposes 47 Model Context Protocol tools covering palace reads and writes, knowledge-graph queries, cross-wing navigation, drawer management, agent diaries, and logstream coordination. It runs as a stdio server and wires into Claude Code, Cursor, and any MCP-compatible client.
Hooks for Claude Code, Codex CLI, and Cursor IDE save transcripts periodically and before context compression. The `mempalace sweep` command indexes one verbatim drawer per user/assistant message, idempotent and resume-safe.
Features
- Verbatim storage
- Structured palace index
- Pluggable vector backends
- LongMemEval 96.6% R@5 raw
- 47-tool MCP server
- Auto-save hooks
How to install
uv tool install mempalace mempalace init ~/projects/myapp mempalace mine ~/.claude/projects/ --mode convos mempalace search "why did we switch to GraphQL"
Recommended for this setup
Strengths
- No API key required for full recall: The 96.6% R@5 retrieval path runs entirely offline — no Anthropic key, no OpenAI key, no cloud endpoint. The embedding model (~300 MB for embeddinggemma, ~80 MB for minilm) is downloaded once and cached locally.
- Reproducible benchmarks: All benchmark numbers are reproducible from the repository. Full per-question result files are committed under benchmarks/results_*, and the commands to reproduce each run are documented in benchmarks/BENCHMARKS.md. The project explicitly avoids cherry-picked side-by-side comparisons against Mem0, Mastra, or Zep on incompatible splits.
- Local-first privacy: Nothing leaves the machine unless the user explicitly opts in. The optional OpenAI-compatible embedding endpoint can point to LM Studio, llama.cpp, vLLM, or Ollama on the same LAN, keeping all content off external servers.
- Multi-arch Docker with persistent volumes: The published container image supports amd64 and arm64 natively, runs on Apple Silicon, and persists the palace, config, and embedding model under /data. The same image serves as both MCP server and CLI without a local Python toolchain.
Trade-offs
- ~300 MB one-time model download: The first command that needs embeddings downloads the model into the data directory. The default embeddinggemma model is ~300 MB; minilm is ~80 MB but English-only. First-run latency is noticeable on slow connections.
- No native Android / Termux support: ChromaDB and ONNX Runtime publish Linux wheels, not Android wheels, so native Termux installation is unsupported. Android ARM64 users must run the packages inside a Debian PRoot container.
- GPU image is x86_64-only: The CUDA GPU container image cannot be built on ARM hosts including Apple Silicon because onnxruntime-gpu publishes no aarch64 Linux wheels. The CPU image remains multi-arch.
- Switching embedding models requires full re-indexing: Changing the embedding model on an existing palace requires running `mempalace repair rebuild-index` because the new model occupies a different vector space. Changing only the compute device (CPU vs GPU) does not require re-embedding.
Tech stack
FAQ
No. The core retrieval path — including the 96.6% R@5 LongMemEval result — requires no API key, no cloud, and no LLM. The embedding model is downloaded once and cached locally. An optional OpenAI-compatible endpoint can be configured to offload embeddings to a local server such as LM Studio or Ollama.
The raw result uses pure semantic search with no heuristics and no LLM. The hybrid pipeline adds keyword boosting, temporal-proximity boosting, and preference-pattern extraction. The 98.4% figure is measured on a held-out 450-question split (tuned on 50 development questions not included in the test set) and is the number the project considers the honest generalizable figure.
ChromaDB is bundled and requires no configuration. Additional backends are sqlite_exact (exact NumPy, bundled), rust_exact (native Rust engine, separate wheel, shares the same database file as sqlite_exact), Milvus (local Lite or server, opt-in install), Qdrant (REST server, bundled), and pgvector (Postgres, opt-in install). Switch with `--backend <name>`, the `MEMPALACE_BACKEND` environment variable, or a `backend` key in config.json.
MemPalace ships auto-save hooks that fire periodically and before context compression in Claude Code. The MCP server wires in as a stdio server via the mcpServers config block. The `mempalace-recall` skill adds search-before-answer recall, and `mempalace-task` handles logstream delegation. A setup checklist at mempalaceofficial.com/guide/claude-code-retention.html covers the full wiring.
Yes. The multi-arch Docker image (amd64 + arm64) runs natively on Apple Silicon. CPU is the expected compute path for both MiniLM and EmbeddingGemma ONNX on Apple Silicon. Experimental EmbeddingGemma 2 supports PyTorch MPS with health checks and a CPU fallback.