MemPalace: a local-first memory system for AI agents
If you use an agentic coding tool day to day, you’ve hit the same wall repeatedly: every new session starts from zero. MemPalace is a local-first memory system built to fix exactly that — it stores your agent’s conversation history verbatim and makes it searchable, without shipping anything to a third-party API.
The core idea: verbatim, not summarized
Most memory layers for LLM agents work by summarizing or paraphrasing past conversations before storing them, which is lossy by construction. MemPalace’s pitch is the opposite: keep the original content intact and lean on retrieval instead of compression. The project reports 96.6% Recall@5 on the LongMemEval benchmark using raw semantic search alone — no heuristics, no LLM in the loop — and 98.4% with a hybrid pipeline that adds keyword boosting and temporal-proximity weighting.
The palace metaphor
MemPalace organizes memory hierarchically instead of as one flat corpus:
- Wings — people and projects
- Rooms — topics within a wing
- Drawers — the original content itself
This lets you scope a search to a specific project or person rather than searching everything you’ve ever told the agent.
On top of that, MemPalace maintains a temporal knowledge graph — entity relationships with validity windows, so facts can be added, queried, and invalidated over time (SQLite-backed) as your project or your understanding of it changes.
Pluggable storage backends
Storage is abstracted behind an interface in mempalace/backends/base.py, so you’re not locked into one vector store:
| Backend | Mode |
|---|---|
| ChromaDB | Local, embedded (default) |
| SQLite | Exact matching |
| Milvus | Local (Lite) or server |
| Qdrant | REST server |
| PostgreSQL | via pgvector |
Backends support namespacing and lexical search, and are configured through environment variables — so a solo setup can run entirely embedded, while a team setup can point at a shared Qdrant or Postgres instance.
Quick start
The recommended install path uses uv:
uv tool install mempalace
mempalace init ~/projects/myapp
pipx or a plain pip install inside a virtualenv both work too. A Docker image is also published for amd64 and arm64 at ghcr.io/mempalace/mempalace:latest, with persistence under /data.
Basic workflow once it’s initialized:
# Index your project files
mempalace mine ~/projects/myapp
# Index past Claude Code sessions
mempalace mine ~/.claude/projects/ --mode convos
# Search what's stored
mempalace search "why did we switch to OIDC for CI/CD"
# Load relevant context at the start of a new session
mempalace wake-up
Requirements are modest: Python 3.9+, and roughly 300 MB of disk for the bundled embedding model. Two embedding options ship out of the box — all-MiniLM-L6-v2 (30 MB, English-only) and embeddinggemma-300m (multilingual, the recommended default) — and you can swap in a remote OpenAI-compatible /v1/embeddings endpoint instead of running embeddings locally.
Agent integrations
This is where MemPalace becomes more than a search index: it ships 44 MCP tools covering palace operations, knowledge-graph management, cross-wing navigation, and agent-coordination events over a log stream. Combined with auto-save hooks for Claude Code, Codex CLI, and Cursor, it can persist context periodically and take a backup pass right before a session gets compacted — which is normally where long-running context quietly disappears.
Configuration
Settings live in ~/.mempalace/config.json (backend choice, embedding model, etc.), and every key can be overridden with a MEMPALACE_-prefixed environment variable — handy for CI or containerized setups where you don’t want to bake config into the image.
Why it’s worth a look
For anyone running long agentic coding sessions, the combination of verbatim storage (nothing gets silently rewritten), local-first defaults (no mandatory API calls), and MCP-native integration makes MemPalace a reasonable default to reach for before building a bespoke memory layer. The palace metaphor is more than cosmetic too — scoping retrieval to a wing/room keeps searches precise as the amount of stored history grows.
MemPalace is MIT-licensed. Source and docs: GitHub · PyPI.
⚠️ The project’s README explicitly warns about impostor sites distributing lookalike domains — stick to the GitHub repo and PyPI package linked above.