MemPalace: Your AI Conversations Never Forget, A Locally-Running Memory Palace
Open-source AI memory system with a 96.6% recall rate on the LongMemEval benchmark. No cloud API dependency, fully local operation, solving session memory loss through structured storage.

Every conversation with AI—architecture discussions, debugging processes, technical decisions—disappears after the session ends. Six months of accumulation, gone. You start over every time.
Existing memory systems try to let AI decide what’s worth remembering. They extract conclusions like “user prefers Postgres” but discard the full conversation where you explained why. MemPalace takes another path: **store everything, then make it retrievable**.
## How the Memory Palace Works
Ancient Greek orators memorized entire speeches by placing ideas in imaginary buildings. Walking through the building finds the ideas. MemPalace applies this principle to AI memory: your conversations are organized into wings (people and projects), halls (memory types), and rooms (specific ideas).
- **Palace Structure**: Wings correspond to people or projects, rooms correspond to specific topics, halls connect related rooms, and tunnels cross wings to link the same topic
- **AAAK Compression**: A 30x lossless compression dialect understandable by any text-reading model
- **Fully Local**: No cloud API dependency; data stays on your machine
## Practical Results
Test results on 22,000+ real conversation memories:
- Unstructured search: 60.9% recall rate
- Add wing structure: 73.1% (12% improvement)
- Add wing + hall structure: 84.8% (24% improvement)
- Add wing + room structure: 94.8% (34% improvement)
The structure itself brings a 34% retrieval improvement. It’s not decoration—it’s the core of the product.
## Four-Layer Memory Stack
```
L0 | Identity Layer: Who is the AI? | ~50 tokens | Always loaded
L1 | Key Facts: Teams, projects, preferences | ~120 tokens | Always loaded
L2 | Room Recall: Recent conversations, current projects | On demand | When the topic arises
L3 | Deep Search: Semantic queries across all storage | On demand | When explicitly asked
```
Your AI loads L0 + L1 (~170 tokens) on startup to understand your work environment. Search only triggers when needed.
## Technical Features
**AAAK Compression Example**
- English: "Priya manages the Driftwood team: Kai (backend, 3 years), Soren (frontend)..." (≈1000 tokens)
- AAAK: "TEAM:PRI(lead)|KAI(backend,3yr)..." (≈120 tokens)
Same information, 8x compression, understandable by any LLM.
**Contradiction Detection**
The system automatically detects inconsistencies:
- "Soren completed the certification migration" → Detects it was actually assigned to Maya
- "Kai has 2 years of experience" → Records show 3 years
- "Sprints end on Friday" → Current sprint ends on Thursday
## Usage
**Work with Claude, ChatGPT, Cursor**
```bash
claude mcp add mempalace -- python -m mempalace.mcp_server
```
After configuration, the AI automatically uses 19 memory tools—no manual search needed.
**Use with Local Models**
```bash
mempalace wake-up > context.txt
# Paste context.txt into the system prompt of your local model
```
Or integrate via Python API.
## Cost Comparison
Six months of daily AI use generates 19.5 million tokens:
- Full loading: Cannot fit into any context window
- LLM summarization: ≈650,000 tokens, annual cost ≈$507
- MemPalace wake-up: ≈170 tokens, annual cost ≈$0.7
- MemPalace + 5 searches: ≈13,500 tokens, annual cost ≈$10
## Benchmark Performance
On standard academic benchmarks:
- **LongMemEval R@5**: 96.6% (no API calls)
- **LongMemEval R@5** (with Haiku reranking): 100%
- **LoCoMo R@10**: 60.3%
The 96.6% raw score is the highest among published systems, with no API keys or cloud services required.
## Get Started
```bash
pip install mempalace
mempalace init ~/projects/myapp
mempalace mine ~/projects/myapp
mempalace mine ~/chats/ --mode convos
```
Three mining modes are supported: projects (code and docs), conversations (exported records), and general (auto-classified).
MemPalace is open-source on GitHub under the MIT license. It requires Python 3.9+, and runs without an internet connection after installation.
发布时间: 2026-04-07 17:46