MemPalace: Free Local AI Memory System With 96.6% Recall

Use MemPalace to search old AI chats, project files, and agent context with local storage, MCP tools, and graph navigation.

MemPalace is a free, open-source, local-first AI memory system that stores conversation history, project files, and agent context as searchable verbatim memory. It organizes that memory into a palace structure and exposes it through a Python CLI, Python API, and MCP server.

The default setup uses ChromaDB and local embeddings on your machine. Shared HTTP serving and Milvus, Qdrant, or pgvector backends extend the same memory to teams and multi-machine agent setups. MemPalace reports 96.6% raw R@5 on LongMemEval for its local retrieval path.

For long-running coding and research work, the main value is continuity. Architecture decisions, debugging history, preferences, and project context stay available when a new session starts. The same memory can follow work across days, projects, and multiple agents.

Official Download

Install the Python package with uv:

uv tool install mempalace

How MemPalace Works

MemPalace uses a memory-palace hierarchy to keep large memory collections navigable. People and projects become wings, topics become rooms, and original content lives in drawers. Search can span the full palace or use wing and room filters to narrow retrieval to one project or topic.

Raw drawers hold the original text. Closets hold compact notes that point back to those drawers, and AAAK supplies an experimental shorthand format for token-dense memory notes. Use the verbatim drawer text for exact quotes and detailed reasoning.

Palace elementRole
WingA person, project, or other top-level memory area
HallA memory category such as facts, events, discoveries, preferences, or advice
RoomA topic inside a wing, such as authentication, database work, or planning
ClosetA compact note layer that points back to original content
DrawerThe original verbatim memory content and metadata
HallwayA connection between related rooms inside one wing
TunnelA connection between related locations across wings

Background and Inspiration

MemPalace was created by Milla Jovovich and Ben Sigman after Jovovich spent months manually organizing AI conversations and found that file organization alone did not make old reasoning easy for an LLM to retrieve.

The organizational model adapts the classical method of loci, where information is associated with locations in an imagined building. MemPalace applies that idea to AI history by mapping projects, people, topics, and original conversations to searchable palace locations.

Keeping the original conversation text preserves wording, code, trade-offs, and the reasoning behind decisions for later retrieval.

Features

  • Stores AI conversations and project files as searchable verbatim memory.
  • Organizes memory into wings, halls, rooms, closets, drawers, and tunnels.
  • Exposes 44 MCP tools for memory, graph, diary, and coordination tasks.
  • Tracks time-aware entity facts in a local SQLite knowledge graph.
  • Auto-saves Claude Code, Codex CLI, and Cursor sessions through hooks.
  • Runs a shared HTTP palace for team and multi-machine deployments.
  • Coordinates agents through logstream events, acknowledgements, patches, and exact artifacts.
  • Uses ChromaDB, SQLite Exact, Milvus, Qdrant, or pgvector storage.
  • Mines project files, conversation exports, and optional office documents.
  • Uses local embeddings or an OpenAI-compatible embedding endpoint.
  • Ships Docker support for CLI and MCP server deployments.
  • Generates compact wake-up context for identity and active project memory.

Use Cases

  • Recover the reasoning behind architecture, database, authentication, deployment, and product decisions.
  • Keep Claude Code, Codex, Cursor, Gemini, and other MCP clients on shared project memory.
  • Search several projects with wing or room filters.
  • Backfill Claude, ChatGPT, Slack, Markdown, and plain-text conversation exports.
  • Share long-term memory across a team or a fleet of coding agents.
  • Feed local models compact wake-up context or retrieved memory results.

How to Use MemPalace

1. Install MemPalace

MemPalace requires Python 3.9 or newer. Use uv or pipx for an isolated install. Use pip inside an activated virtual environment when Python code needs to import the package.

# Recommended
uv tool install mempalace
# Alternative isolated install
pipx install mempalace
# Virtual environment
python -m venv .venv
source .venv/bin/activate
pip install mempalace

2. Initialize a Project

Initialize a project directory and create its palace configuration:

mempalace init ~/projects/myapp
# Use the current directory
mempalace init .

3. Mine Project Files and Conversations

Mine code, documentation, notes, or conversation exports. --dry-run previews a mining pass before it writes memory.

# Project files
mempalace mine ~/projects/myapp
# Preview before filing memory
mempalace mine ~/projects/myapp --dry-run
# Conversation exports
mempalace mine ~/chats/ --mode convos
# Classify conversation content into memory types
mempalace mine ~/chats/ --mode convos --extract general
# Keep one project's history in a named wing
mempalace mine ~/chats/orion/ --mode convos --wing orion

Split multi-session transcript files before mining:

mempalace split ~/chats/ --dry-run
mempalace split ~/chats/
mempalace split ~/chats/ --min-sessions 3

Install the extraction extra for office documents:

pip install "mempalace[extract]"
mempalace mine ~/documents/ --mode extract

4. Search the Palace

Search the full palace or filter by wing and room:

mempalace search "why did we switch to GraphQL"
mempalace search "database decision" --wing orion
mempalace search "auth decisions" --wing orion --room auth
mempalace search "release blockers" --results 10

5. Connect an MCP Client

Run the MCP helper to print client setup syntax and resolve the active palace path:

mempalace mcp
mempalace mcp --palace ~/.custom-palace

6. Load Context for a Local Model

Load compact wake-up context or retrieve only the memory needed for the current prompt:

mempalace wake-up > context.txt
mempalace search "auth decisions" > results.txt

7. Use the Python API

The Python API supports the same wing and room filters:

from mempalace.searcher import search_memories
results = search_memories(
    query="why did we switch to GraphQL",
    wing="myapp",
    room="architecture",
    n_results=5,
)

8. Run a Shared Palace

For team or multi-machine use, run the HTTP server behind bearer-token authentication and TLS or a trusted private network:

mempalace serve --host 127.0.0.1 --port 8765

Core CLI Commands

CommandPurpose
mempalace init <dir>Scan a project and initialize palace configuration
mempalace mine <dir>File project data or conversation exports into memory
mempalace search "query"Run semantic search with optional wing and room filters
mempalace split <dir>Split transcript mega-files into individual sessions
mempalace wake-upPrint compact L0 and L1 session context
mempalace compressCreate AAAK compact memory notes
mempalace statusShow drawer, wing, and room status
mempalace repairRepair or rebuild palace indexes
mempalace mcpPrint MCP client setup syntax
mempalace hook runRun Claude Code or Codex hook logic
mempalace instructionsPrint bundled skill instructions
mempalace logstreamAppend, list, wait for, watch, acknowledge, and sync coordination events
mempalace artifactStore and retrieve exact patch, file, log, JSON, or note artifacts
mempalace serveRun an HTTP MCP server for a shared palace

Available MCP Tools

Palace Read Tools

ToolDescription
mempalace_statusShow drawer counts, wings, rooms, memory protocol, AAAK spec, and loaded library versions
mempalace_list_wingsList wings with drawer counts
mempalace_list_roomsList rooms globally or inside one wing
mempalace_get_taxonomyReturn the wing-to-room-to-drawer-count tree
mempalace_searchSearch verbatim drawers with optional wing and room filters
mempalace_check_duplicateCheck content similarity before filing a new drawer
mempalace_get_aaak_specReturn the AAAK dialect specification

Palace Filing and Management Tools

ToolDescription
mempalace_add_drawerFile verbatim content into a wing and room
mempalace_checkpointSave several session items and an optional diary entry in one call
mempalace_delete_drawerDelete one drawer by ID
mempalace_mineMine project files, conversations, or extracted documents
mempalace_delete_by_sourcePreview or delete every drawer filed from one source file
mempalace_syncFind and optionally prune drawers whose source files were removed or ignored
mempalace_get_drawerRead one drawer with its content and metadata
mempalace_list_drawersList drawers with pagination and wing or room filters
mempalace_update_drawerUpdate drawer content, wing, or room metadata

Knowledge Graph Tools

ToolDescription
mempalace_kg_queryQuery entity relationships with optional point-in-time filtering
mempalace_kg_addStore a time-aware entity relationship
mempalace_kg_invalidateMark an existing fact as ended
mempalace_kg_supersedeReplace a single-valued fact at one shared time boundary
mempalace_kg_timelineReturn a chronological fact timeline
mempalace_kg_statsShow entity, triple, fact, and relationship counts

Navigation Tools

ToolDescription
mempalace_traverseWalk connected rooms from a starting room
mempalace_find_tunnelsFind rooms that connect two wings
mempalace_graph_statsShow room, tunnel, edge, and connectivity statistics
mempalace_create_tunnelCreate an explicit connection between locations in different wings
mempalace_list_tunnelsList explicit cross-wing tunnels
mempalace_delete_tunnelDelete an explicit tunnel by ID
mempalace_list_hallwaysList within-wing entity co-occurrence connections
mempalace_delete_hallwayDelete a hallway record by ID
mempalace_follow_tunnelsFollow cross-wing tunnels and return connected room previews

Agent Diary Tools

ToolDescription
mempalace_diary_writeWrite a diary entry for one specialist agent
mempalace_diary_readRead recent diary entries for one agent

System Tools

ToolDescription
mempalace_hook_settingsRead or update auto-save hook settings
mempalace_memories_filed_awayCheck the most recent palace checkpoint status
mempalace_reconnectReconnect a long-running MCP session to palace storage

Agent Coordination Tools

ToolDescription
mempalace_event_appendAppend an immutable coordination event
mempalace_event_listList coordination events with routing and cursor filters
mempalace_event_waitWait for matching coordination events with a timeout
mempalace_event_ackAcknowledge an event with a new reply event
mempalace_artifact_putStore exact patch, file, log, JSON, or note content
mempalace_artifact_getRetrieve an exact artifact with its SHA-256 metadata
mempalace_patch_submitStore a patch artifact and emit its patch-ready event
mempalace_mesh_peersInspect peer reachability, replica state, version vectors, and node profiles

Memory Stack Layers

A typical wake-up loads L0 + L1 in roughly 600 to 900 tokens. L2 and L3 retrieve more detail when a topic or explicit query needs it.

LayerContentTypical SizeLoad Trigger
L0AI identity~50–100 tokensAlways loaded
L1Essential story and top moments~500–800 tokensAlways loaded
L2Wing- or room-scoped recall~200–500 tokens per recallTopic match
L3Full semantic searchVariableExplicit query

Configuration Files

~/.mempalace/config.json stores the palace path, collection name, entity mappings, backup retention, and backend selection.

{
  "palace_path": "/custom/path/to/palace",
  "collection_name": "mempalace_drawers",
  "people_map": {"Kai": "KAI", "Priya": "PRI"},
  "max_backups": 10
}

Project Configuration

mempalace init creates mempalace.yaml with the project wing, room names, and palace path:

wing: myproject
rooms:
  - backend
  - frontend
  - decisions
palace_path: ~/.mempalace/palace

Entity Mappings

entities.json stores detected people and their AAAK codes:

{
  "Kai": "KAI",
  "Priya": "PRI"
}

Identity File

~/.mempalace/identity.txt stores the Layer 0 identity context:

I am Atlas, a personal AI assistant for Alice.
Traits: warm, direct, remembers everything.
People: Alice (creator), Bob (Alice's partner).
Project: A journaling app that helps people process emotions.

Storage Backends and Privacy

ChromaDB and SQLite Exact keep palace data local. Milvus, Qdrant, and pgvector can point to local or network services. Their connection settings define where verbatim memory is stored.

BackendModeInstallData location
chromaLocal embedded defaultBundledLocal palace directory
sqlite_exactLocal exact-vector backendBundledLocal SQLite database
milvusMilvus Lite or servermempalace[milvus]Local Lite database or configured Milvus service
qdrantREST serverBundled client pathConfigured Qdrant service
pgvectorPostgres servermempalace[pgvector]Configured Postgres database

96.6% LongMemEval Recall Explained

MemPalace reports 96.6% raw R@5 retrieval recall on 500 LongMemEval questions. The run checks whether the labeled relevant session appears in the top five results and uses no LLM, cloud API, or reranking step.

R@5 measures retrieval recall. End-to-end question answering uses different metrics. Compare memory benchmarks only when they evaluate the same task and metric.

ModeR@5LLM requiredInterpretation
Raw semantic retrieval96.6%NoMain reproducible retrieval headline
Hybrid v4 held-out 450-question set98.4%NoHeld-out hybrid retrieval result
Hybrid v4 with LLM reranking99%+YesCandidate retrieval followed by model reranking

Auto-Save Hooks and Session Retention

MemPalace provides auto-save hooks for Claude Code, Codex CLI, and Cursor IDE. Claude Code session files expire after 30 days. Use the hooks or backfill transcripts to keep that history in MemPalace.

Claude Code and Codex hook logic can be invoked from the CLI:

mempalace hook run --hook stop --harness claude-code
mempalace hook run --hook precompact --harness claude-code
mempalace hook run --hook session-start --harness codex

Per-Message Recall With Sweep

sweep files one verbatim drawer per user or assistant message and can be rerun safely over the same transcript directory:

mempalace sweep ~/.claude/projects/

Agent Coordination and Artifact Handoffs

Teams running several coding agents can use the palace as a coordination channel alongside long-term memory. Agents can append task events to the logstream, wait for matching replies, acknowledge outcomes, exchange exact file or patch artifacts, and inspect peer state across shared deployments.

A background watcher can wait for several event types and persist its cursor across restarts. These commands target multi-agent coding and operations setups. Single-user memory setups can ignore them.

mempalace logstream watch \
  --agent mac \
  --type task.request \
  --type patch.ready \
  --state-file ~/.mempalace/watch/mac.json \
  --json

Pros

  • Free and open-source
  • Local-first memory storage
  • Verbatim conversation retention
  • 44 MCP tools
  • Team and multi-agent support
  • Reproducible retrieval benchmarks

Cons

  • Command-line setup
  • Experimental AAAK compression
  • Extra storage for large memory collections
  • Some transcript exports need preprocessing

Alternatives & Related Resources

Alternatives

  • Personal AI Memory: A Chrome extension that stores and recalls conversations from ChatGPT, Claude, Gemini, Perplexity, and Grok in browser IndexedDB.
  • OpenMemory MCP: A local-first MCP memory server for storing context with topics, emotions, timestamps, and search.
  • Memory Service MCP: A persistent MCP memory server with semantic retrieval, consolidation, and multi-client access.

Related Resources

FAQs

Q: Is MemPalace fully local?
A: The default ChromaDB and local-embedding workflow runs on your machine. Remote team servers, networked storage backends, and OpenAI-compatible embedding endpoints extend the data path to the services you configure.

Q: What does 96.6% R@5 mean?
A: The relevant LongMemEval session appeared among the top five retrieved results for 96.6% of the 500 benchmark questions in the raw retrieval run. This is a retrieval-recall metric.

Q: How do I keep Claude Code sessions in long-term memory?
A: Configure the MemPalace auto-save hooks and backfill existing Claude Code transcripts with mempalace mine ~/.claude/projects/ --mode convos. Claude Code session files expire after 30 days.

Q: Can a team share one MemPalace?
A: Yes. mempalace serve can run a central MCP server, and networked backends can hold the shared palace. Use bearer-token authentication plus TLS or a trusted private network for remote access.

Q: Where should I install MemPalace from?
A: Use the MemPalace package on PyPI or the MemPalace GitHub repository. Documentation is hosted at mempalaceofficial.com. Look-alike MemPalace domains are unaffiliated.

Changelog

August 23, 2026

  • Updated the article for MemPalace v3.8.0 and the current 44-tool MCP set.
  • Updated local-first storage, team server, configuration, memory-stack, and agent-coordination details.
  • Clarified the 96.6% LongMemEval R@5 retrieval metric.
  • Added the current installation security warning and verified distribution locations.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest & top AI tools sent directly to your email.

Subscribe now to explore the latest & top AI tools and resources, all in one convenient newsletter. No spam, we promise!