MemPalace is an open-source, local-first AI memory system whose goal is to preserve and retrieve conversations and project data over the long term without relying on the cloud. It stores conversation history in verbatim text form and uses semantic search for retrieval, without summarizing, extracting, or rewriting the content, thereby preserving the original information as much as possible.
Purpose and positioning MemPalace is aimed at coding agents and personal assistant scenarios that need long-term memory, and is also suitable for users who need to retrieve their own historical conversations and project materials. It emphasizes "local-first": unless the user actively chooses otherwise, data does not leave the local machine.
Main capabilities
- Verbatim storage and semantic retrieval: saves the complete conversation history, and retrieval is based on semantic similarity, without summarization or rewriting.
- Hierarchical index structure: people and projects form wings, topics form rooms, and raw content is stored in drawers, allowing searches to be scoped rather than facing a flat corpus.
- Pluggable retrieval backends: ChromaDB is used by default, with the interface defined in mempalace/backends/base.py, and other backends can be substituted. It provides a native Rust engine, rust_exact, based on local SQLite, as well as an adapter that shares the same database file with sqlite_exact.
- Benchmark results: on LongMemEval retrieval recall (R@5, 500 questions), the raw score is 96.6%; this path requires no API key, no cloud service, and does not use a large language model at any step. The hybrid pipeline adds keyword boosting, temporal proximity boosting, and preference pattern extraction; on the held-out set it is 98.4%, which is regarded as a more honest generalization metric. The reranking pipeline uses an LLM reader to promote the best candidate from the top 20 retrieved sessions, and can work with a variety of models, but is not treated as the flagship "100%" result.
- 47 MCP tools: covering palace reading and writing, knowledge graph operations, cross-wing navigation, drawer management, agent diaries, and agent coordination (logstream events and artifact handoff).
- Knowledge graph: includes a temporal entity-relationship graph with valid time windows, supports add, query, invalidate, and timeline operations, and is backed by local SQLite.
- Agent-specific spaces: each expert agent gets its own wing and diary in the palace, can be discovered at runtime via mempalace_list_agents, and does not crowd out the system prompt.
- Auto-save hooks: supports Claude Code, Codex CLI, and Cursor IDE, save periodically and before context compression.
Usage Installation:
- uv is recommended: uv tool install mempalace, which installs the CLI into an isolated environment on PATH.
- pipx can also be used: pipx install mempalace.
- Use plain pip only in an already activated virtual environment, so that import mempalace can be used.
- Container images are supported for running the MCP server or CLI, multi-architecture (amd64 + arm64). All persistent data is located in /data, and a volume must be mounted. Commands that need embeddings for the first time will download models (by default minilm about 80 MB, embeddinggemma about 300 MB); the first call is slower and requires network access.
- Native installation on Android / Termux is not currently supported, because compiled dependencies such as ChromaDB and ONNX Runtime only publish Linux wheels, not Android wheels. Android ARM64 users can run regular Linux packages in an isolated Debian PRoot container.
- GPU images only support x86_64, because onnxruntime-gpu has no aarch64 Linux wheels. Configuration and selection:
- Select the backend using --backend <name>, MEMPALACE_BACKEND=<name>, or "backend": "<name>" in config.json.
- Embeddings can be computed locally, or an OpenAI-compatible endpoint can optionally be used. In ~/.mempalace/config.json, set embedding_model: "openai-compat" along with embedding_api_url, embedding_api_model, and embedding_api_key; these can be overridden via the corresponding MEMPALACE_EMBEDDING_API_* environment variables. Switching to this method requires running mempalace repair rebuild-index.
- Guided setup python -m mempalace.onboarding provides embeddinggemma-300m(multilingual, 100+ languages, recommended) or all-MiniLM-L6-v2 (English only, about 30 MB). Connection and integration:
- It can be connected to MCP clients (such as Claude Code) as a stdio server. The content you want the server to mine must be mounted; the server cannot access unmounted conversation records.
- The repository provides three skills: mempalace for guided installation and operation, mempalace-recall for searching before answering, and mempalace-task for logstream delegation. Installing the skills themselves does not install the CLI or MCP server; system changes must be completed through the setup skill guidance and the connection verified.
- During guided setup, the agent can provide a weekly stable release check. This feature is disabled by default; when enabled, it only connects to PyPI and does not automatically install updates. Setup records whether the runtime comes from uv tool, pipx, or pip, so that upgrade plans do not give incorrect installation commands.
Use cases
- Provide long-term memory for coding agents, save complete sessions, and retrieve them when needed.
- For users who need to save conversation history locally and do not want to rely on the cloud or APIs.
- For multi-agent workflows that need cross-agent coordination and shared memory spaces.
- For users who need to run retrieval benchmarks on their own data, mempalace-native bench --db <sqlite_exact.sqlite3> can be used to measure locally.
Limitations and notes
- Native Termux installation is not currently supported; a Debian PRoot container must be used.
- GPU images only support x86_64; building on ARM hosts (including Apple Silicon) will fail with a dependency resolution error.
- The running uid inside the container is 1000; on Linux, the mounted directory bound to it must be readable by that uid (0755 is fine, 0700 is not). On failure, it appears as PermissionError: [Errno 13]; do not bypass it with --user.
- rust_exact falls back to the Python backend when encountering complex filtering, requests that return embeddings, or when the native extension is not installed; the memapalace-native executable is Rust-only and has no Python fallback.
- Switching embedding endpoints requires rebuilding the index.
- Building from a clone uses the current branch (develop is the default branchbranch), and if you need to publish a version you should pull the already-published image.
- Official sources are limited to the GitHub repository, the PyPI package, and the mempalaceofficial.com documentation; other domains (including .tech, .net, or other .com variants) are impersonating sites and may distribute malware.
- The project has not published side-by-side comparison data with Mem0, Mastra, Hindsight, Supermemory, or Zep, because each project publishes different metrics on different splits, and direct comparison is considered dishonest.
- The project uses the MIT license.
Other facts
- Official website: mempalaceofficial.com.
- Documentation links include: Concepts (Palace), CLI reference, Python API, MCP tools, agents, hooks, and more.
- The project encourages PR contributions; see CONTRIBUTING.md for details.