MemPalace: Local, Verbatim, Long-Term Memory for AI Coding Assistants
MemPalace is an open-source local memory system for AI tools. It stores project context verbatim, runs entirely on your machine without external API calls, and provides a searchable index of past conversations, source files, and documentation. It integrates with Claude Code through background hooks that silently file memories as you work.
The problem it addresses
LLM context windows are limited. Once context scrolls out, the AI loses it. This produces familiar frustrations: re-explaining the same project conventions in every session, receiving suggestions that contradict previously established patterns, and losing the reasoning behind past decisions.
Some tools manage context within a single long session, but do not persist memory across sessions, days, or weeks. MemPalace stores memory permanently in a local database that any session can query.
Core architecture
Local-first. All data (memory index, source files, embeddings) is stored in ~/.mempalace. Nothing is uploaded to a cloud service.
Zero API. Extraction, chunking, and embedding run locally. No OpenAI or Anthropic API key is required for the core memory functions.
Background hooks. Integrates with Claude Code to index memories silently as you work, without manual save commands.
Temporal graph. Tracks relationships across entities with valid-from and valid-to dates, allowing the system to understand how decisions and facts evolve over time.
Installation
MemPalace is a Python application. Installing in an isolated environment avoids dependency conflicts:
Standard pip also works, but uv is the recommended path.
Setting up a palace
A palace is a dedicated memory database for a specific project.
On initialization, MemPalace scans the directory and proposes rooms based on detected patterns (for example, a documentation room for Markdown files). Accept the proposals, edit them, or add rooms manually. The command creates a mempalace.yaml configuration file in the project directory.
Mining data
Populate the palace with project files and past conversation logs.
Mine source code and documentation:
Mine past Claude Code conversations:
The mine command reads the content, chunks it, and stores the verbatim text in the palace database while building a searchable index.
Searching
Query the palace in natural language:
Results include the source file, a relevance score, and the exact original text. Other example queries:
Verbatim storage vs. lossy summarization
Most AI memory systems pass ingested content through an LLM to extract summarized facts before storing them.
Summarization discards nuance: edge cases, specific constraints, the reasoning behind a decision. Once gone, it cannot be recovered. MemPalace stores everything verbatim and builds a compact index on top of the original text. When a search runs, it retrieves the original, unsummarized source. The AI sees the conversation in its messy, complete form rather than a cleaned-up interpretation.
Memory structure
MemPalace organizes data hierarchically.
Wings. Broad categories keyed to real-world entities: people, projects, topics.
Rooms. Discrete units of time within a wing: days, sessions, chat threads. This is the source of temporal awareness.
Closets. Groupings of related information within a room by more granular topic.
Drawers. Individual verbatim chunks: the exact, untouched text from the source document. This is where the lossless promise is kept.
Practical effects
Exact recall. A specific command with an unusual flag documented three months ago is retrievable as originally written, not as an LLM's interpretation.
Privacy. Proprietary code and project discussions never leave the machine.
Lower token costs. Memory retrieval does not require stuffing thousands of tokens of history into every prompt. The Claude Code plugin searches the palace before answering, so context is retrieved automatically.
Final thoughts
MemPalace is most useful for developers who work on long-running projects with established conventions and architectural decisions that need to persist across sessions. The setup cost (initializing a palace, mining existing conversations and files) is real but front-loaded; subsequent sessions benefit from the accumulated context without manual re-introduction.
The verbatim storage approach is the architectural bet worth paying attention to. Summarization-based systems are simpler to build but permanently discard information at ingest time. Whether that matters depends on how often you need to retrieve specific technical details rather than general summaries.
Source code and documentation are at github.com/mem-palace/mempalace.