MemPalace: A Free Local AI Memory System That Is Blowing Up on GitHub

·Toolin Editorial Team

The open-source AI memory system MemPalace uses the memory palace method, scores 96.6% on LongMemEval, runs locally, supports MCP integration, and costs only 10 USD a year

MemPalace: A Free Local AI Memory System That Is Blowing Up on GitHub

MemPalace is an open-source AI memory system inspired by the ancient Greek "memory palace" technique. It lets an AI organize and retrieve memories the way a person "walks through a building, opening one door after another," instead of using the traditional vector-database approach.

The project was open-sourced the day it launched, stores all data locally, scored the highest score ever recorded—96.6%—on the LongMemEval benchmark (RAW mode), and has already passed 17k stars on GitHub.

What Problem It Solves

The core contradiction in today's AI memory solutions is: the more memory there is, the higher the cost and the less accurate the retrieval.

Traditional approaches either slice every conversation into embeddings for recall (inaccurate retrieval) or compress them into summaries (information loss). MemPalace instead turns memory into a navigable spatial structure, organizing memories by "spatial location."

The Structure of the Memory Palace

MemPalace organizes memory like a building:

  • Palace: the great room that holds all knowledge
  • Wing: represents a person or a project; each wing is its own separate space
  • Room: each room represents a specific topic (such as authentication, billing, deployment)
  • Hall: defines "which category this memory belongs to" (such as suggestions, personal preferences, decisions)
  • Drawer: holds raw records, sealed intact without a single word changed
  • Closet: holds compressed summaries, ready for the AI to read quickly
  • Tunnel: automatically links up when the same room appears in different wings, connecting same-topic information across projects

Every extra layer of structure shrinks the search space once more and tightens the semantic constraints once more. In testing, this layered structure improved retrieval efficiency by about 34% compared with searching everything globally at random.

MemPalace memory structure diagram

The Memory Stack: Load on Demand

MemPalace uses a memory stack that loads by level of importance:

LevelContentToken CostWhen Loaded
L0+L1Core contextabout 170 tokensalways loaded in every conversation
L2Room-level recallon demandlocal top-up
L3Global deep searchon demanddeep retrieval

The logic is simple: understand you first at minimum cost, top up locally if that is not enough, and only then search globally if it is still not enough.

Actual results: on 6 months of conversation data, roughly 19.5 million tokens, MemPalace normally loads only about 170 tokens, and even on-demand loading peaks at 13,500 tokens. Compared with the traditional summarize-and-compress approach (about 507 USD per year), MemPalace's annual cost is only about 10 USD.

Benchmark Results

BenchmarkScoreNotes
LongMemEval (RAW)96.6%the highest score ever publicly recorded
ConvoMem92.9%focused on short-term memory
LoCoMo100%focused on multi-month ultra-long memory

Installation and Usage

Before You Start

  • Python 3.8+
  • Local storage space (depending on how much data you have)

Step 1: Install MemPalace

pip install mempalace

Step 2: Initialize the Memory Palace

mempalace init ~/projects/myapp

This creates a home directory that will hold all memory data.

Step 3: Import Data

Depending on the data type, there are three modes:

Mine project files (for code, docs, and notes):

mempalace mine ~/projects/myapp

Mine conversation logs (for chat logs exported from Claude, ChatGPT, or Slack):

mempalace mine ~/chats/ --mode convos

General mining (automatically classifies content into decisions, milestones, issues, and more):

mempalace mine ~/chats/ --mode convos --extract general

Step 4: Connect an AI

Automatic mode (for AIs that support MCP tool calls, such as Claude):

claude mcp add mempalace -- python -m mempalace.mcp_server

Once connected, the AI will automatically call MemPalace's retrieval tools.

Manual mode (for local models):

Load base memories (170 tokens):

mempalace wake-up > context.txt

Retrieve on demand:

mempalace search "auth decisions" > results.txt

You can also call it directly through the Python API:

from mempalace.searcher import search_memories

results = search_memories("auth decisions", palace_path="~/.mempalace/palace")

MemPalace workflow diagram

Notes

  • All data is stored locally and never uploaded to the cloud, cutting the risk of privacy leaks at the source
  • RAW mode is more accurate (96.6%) than AAAK mode (84.2%); use RAW to keep precision, AAAK to save tokens
  • A fact_checker.py tool will be released later to automatically check memory consistency
  • Real-time error correction is still being integrated

Related articles

Video-to-Blog: Rebuilding Karpathy's Workflow with Agents and Multimodal Models
AI Tutorials

Video-to-Blog: Rebuilding Karpathy's Workflow with Agents and Multimodal Models

A four-step workflow that turns videos into illustrated blog posts automatically, pairing the Doubao Seed 2.0 Lite omnimodal model with an Agent — solving the visual information lost by traditional ASR+LLM pipelines.

Toolin Editorial Team
How to Choose an AI Image Model: A Style Comparison of Image-2, Doubao, and Kling
AI Products

How to Choose an AI Image Model: A Style Comparison of Image-2, Doubao, and Kling

The same prompt fed to different AI image models produces wildly different styles. This article compares the visual traits of Image-2, Nano Banana 2, Doubao/Jimeng, and Kling to help you pick the right model fast.

Toolin Editorial Team
DeepSeek-TUI: A DeepSeek Coding Agent in the Terminal
AI Products

DeepSeek-TUI: A DeepSeek Coding Agent in the Terminal

DeepSeek-TUI, with 2.3k GitHub stars, is a terminal coding tool written in Rust. Optimized for DeepSeek V4, it supports a 1M-token context, parallel sub-agents, and three operation modes.

Toolin Editorial Team
Convert GPT-image-2 Images to PSD in One Click: An Open-Source Skill Put to the Test
AI Tutorials

Convert GPT-image-2 Images to PSD in One Click: An Open-Source Skill Put to the Test

Use the open-source bggg-creator-image2psd Skill to split GPT-image-2's merged images into 12 editable PSD layers, with text and graphics layered automatically and no ghosting.

Toolin Editorial Team
Mintlify: A Documentation System Rebuilt with AI as Its God
AI Products

Mintlify: A Documentation System Rebuilt with AI as Its God

Mintlify, the AI documentation platform valued at $500 million, makes documentation serve humans and AI at once, with structured Markdown content, an llms.txt machine directory, and real-time MCP queries. Anthropic, X, and PayPal all use it.

Toolin Editorial Team