# Repository Briefing: MemPalace/mempalace
> Source: https://repoforai.com/repo/MemPalace/mempalace (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/MemPalace/mempalace
- **Official Docs / Website**: http://mempalaceofficial.com/
- **Category**: RAG, Data & Memory (知识库 / 爬虫 / 记忆层)
- **Primary Language**: Python
- **License**: MIT
- **Engineering Health**: A+ (98/100 · Maintenance 35/35 · Adoption 23/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v3.12.0 (2026-11-12) — https://github.com/MemPalace/mempalace/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: Docker, Self-Hosted, MCP, Local AI, CLI
- **Momentum**: 60,810 ★ total (+14 24h / +120 7d) · 7,686 forks
- **Topics**: `ai`, `chromadb`, `llm`, `mcp`, `memory`, `python`
- **When to Use**: Best for: Developers and teams that want coding agents to recall prior decisions and conversations from verbatim sources through MCP, with local embeddings and a choice of storage backends. Skip if: You need a managed memory service, cannot retain raw transcripts, or primarily want generated summaries rather than retrievable source passages.

## Overview
```text
### Architecture & Core Mechanics
MemPalace is a Python 3.10+ memory and retrieval layer for project files and conversation transcripts. Its mining pipeline indexes verbatim content rather than replacing it with generated summaries. Wings group projects or people, rooms organize topics, and drawers hold source content. The hierarchy lets agents narrow a query to relevant material instead of searching an undifferentiated corpus.

The storage contract in `mempalace/backends/base.py` separates mining and retrieval from the vector store. ChromaDB is the embedded default. `sqlite_exact` performs exact vector search with NumPy; `rust_exact` opens the same SQLite file and falls back to Python for cases such as complex filters. The Rust workspace contains a core crate, PyO3 bindings, and a native CLI. A separate SQLite graph stores temporal entity relationships, while agents access palace operations through the CLI or MCP over stdio.

### Key Capabilities & Differentiators
Use `mempalace mine` to index project files or `--mode convos` to ingest conversation history, then use `search` for targeted retrieval or `wake-up` to load context into a new session. Auto-save hooks cover Claude Code, Codex CLI, and Cursor; `sweep` provides resumable, idempotent per-message indexing. The broader MCP surface covers reads and writes, graph operations, agent diaries, logstream events, and artifact handoffs. Embedding options include multilingual EmbeddingGemma, English MiniLM, opt-in EmbeddingGemma 2 with image, audio, and video search, and OpenAI-compatible embedding endpoints.

On LongMemEval, raw semantic retrieval reaches 96.6% R@5 across 500 questions without an LLM. Hybrid v4 adds keyword and temporal boosts plus preference-pattern extraction, reaching 98.4% R@5 on 450 held-out questions after tuning on 50 development questions. The ≥99% result uses LLM reranking on the full 500. That result has a different evaluation split and runtime requirement; none of these retrieval scores measures generated-answer accuracy.

### Trade-offs & Limitations
Compared with building directly on a vector database, MemPalace supplies conversation ingestion, project scoping, and agent-facing interfaces out of the box, but also brings its own hierarchy and ingestion lifecycle. Against Mem0, Hindsight, or Zep, the useful comparison is whether agents recover the original passages they need, how well results are scoped, and what it takes to operate the integrations. The published benchmark figures do not establish a head-to-head ranking.

Embedded ChromaDB avoids a separate database service; opting into Milvus, Qdrant, or pgvector brings namespace support and more infrastructure to operate. Benchmark an exact-search backend at your expected corpus size rather than assuming native code guarantees lower latency. Local embeddings keep the core path independent of an API, but retaining verbatim data makes the palace and its backups sensitive. Model changes require re-embedding, and session retention still depends on configuring hooks or ingesting transcripts before they expire.

### Hardware & Deployment Guide
For a workstation, install the Python CLI in an isolated environment with `uv tool install mempalace` or `pipx install mempalace`, then initialize and mine the source paths. The amd64 and arm64 Docker image persists the palace, configuration, and model cache under `/data`. Run the Compose MCP service interactively with `docker compose run --rm mcp`, not as a detached HTTP service: JSON-RPC travels over stdin and stdout without a TTY. The first embedding operation needs network access to fetch weights if they are not cached; subsequent local embedding does not require an API key.

For shared use, `deploy/docker-compose.server.yml` provides a team-server deployment; an OpenAI-compatible embedder can also run on the host or LAN. The GPU image must be built locally. Version 3.10 introduced a three-tool MCP option and optional native exact search; 3.11 added guided audit and repair and records which embedding model built each palace. Version 3.12 improves source text and byte preservation and recovery from interrupted re-mining. Check the existing palace's model and plan any necessary index rebuild before switching.
```

## Key Capabilities
```text
- Storage: Wings and rooms scope retrieval; drawers hold verbatim content rather than generated summaries.
- Backend portability: Embedded ChromaDB by default, exact search through NumPy or Rust, and opt-in Milvus, Qdrant, or pgvector.
- Retrieval evaluation: LongMemEval reaches 96.6% raw R@5 across 500 questions and 98.4% hybrid R@5 on 450 held-out questions without an LLM.
- Embedding lifecycle: Each palace records its embedding model; switching models requires re-embedding, but changing devices alone does not.
- Session retention: Hooks support Claude Code, Codex CLI, and Cursor; an idempotent sweep can index one drawer per message.
- Agent integration: JSON-RPC over stdio exposes memory and coordination tools; a separate SQLite graph tracks relationship validity windows.
```

## Quick Start / Clone
```bash
npx skills add MemPalace/mempalace
```
