Sponsored by Deepsite.site

Hindsight Mempalace

Created By
holetrona month ago
Self-hosted long-term memory for AI agents. An MCP server that gives agents persistent, hierarchical recall (L0–L3) over pgvector — retain preferences, decisions and observations, then recall them by topic across sessions. MIT, clone-and-run, requires Postgres + pgvector.
Overview

Hindsight MemPalace

Hierarchical memory for AI agents. Storage + taxonomy in one system.

A hybrid of two open-source projects:

ProjectWhat it doesWhat it lacks
Hindsight by vectorize-ioLong-term vector memory for AI agents. Stores, embeds, recalls.No structure — all memories in one flat pile
MemPalace by milla-jovovichHierarchical taxonomy: rooms, halls, layers — the method of loci for AINo storage engine — a spec without a database

This fork connects them. Hindsight's vector store + MemPalace's taxonomy = structured memory with semantic search.


How it works

┌──────────────────────────────────────────────────────┐
│                    MEMPALACE                          │
│                                                      │
│  ┌─── Room: auth ──┐  ┌─── Room: pipeline ──┐       │
│  │ Hall: facts      │  │ Hall: decisions     │       │
│  │ Hall: procedures │  │ Hall: events        │       │
│  │ Hall: warnings   │  │ Hall: facts         │       │
│  │                  │  │                     │       │
│  │  L0 ████ always  │  │  L0 ████ always     │       │
│  │  L1 ███░ warm    │  │  L1 ███░ warm       │       │
│  │  L2 ██░░ cold    │  │  L2 ██░░ cold       │       │
│  │  L3 █░░░ archive │  │  L3 █░░░ archive    │       │
│  └──────────────────┘  └─────────────────────┘       │
│           │                      │                   │
│           └──── Tunnel ──────────┘                   │
│                (cross-bank bridge)                   │
│                                                      │
│  Closets: compressed summaries + source pointers     │
└──────────────────────┬───────────────────────────────┘
              Hindsight vector store
              (embeddings + semantic search)

Rooms — topic isolation. Auth, pipeline, infrastructure, schema — each topic in its own room. An agent searching for auth facts won't wade through 500 deploy memories.

Halls — knowledge typing within a room. Fact, event, decision, procedure, warning. The system knows what it's looking at before reading — like Content-Type for memory.

Layers L0–L3 — four priority tiers. L0 (core) is always loaded. L3 (archive) is deep-search only. Same idea as CPU cache hierarchy: L1 is fast and small, RAM is slow but holds everything.

Closets — AI-compressed summaries with source pointers. Deduplication at the knowledge level: 10 related facts → 1 paragraph + references.

Tunnels — cross-bank bridges between agents. Agent A discovers an insight — Agent B sees it through a tunnel without data duplication.

Comparison

HindsightMemPalaceThis fork
What it isLong-term memory storeHierarchical taxonomy specStorage + taxonomy hybrid
StorageVector store + embeddingsNone (spec only)Vector store + embeddings
Memory structureFlat (all memories equal)Rooms → Halls → LayersRooms → Halls → Layers + embeddings
RetrievalSemantic searchNo retrieval engineRoom-scoped semantic search
ClassificationNoneDefined in specKeyword-based, <1ms, zero LLM cost
Priority tiersAll memories equalL0–L3 (spec)L0–L3 (implemented)
CompressionNoneClosets (spec)Closets with source pointers
Multi-agentShared bankTunnels (spec)Tunnels (cross-bank bridges)
MCP integrationAPI onlyNone5 tools via MCP protocol
SetupDockerManual configDocker (drop-in upgrade)

Quick start

git clone https://github.com/holetron/hindsight-mempalace.git
cd hindsight-mempalace
cp .env.example .env
# edit .env with your config
docker compose -f docker-compose.mempalace.yml up -d

API available at http://localhost:5100. Drop-in replacement for vanilla Hindsight — same API, same clients, new brain.

Embeddings

Ships with BAAI/bge-small-en-v1.5 (384-dim) — fast, CPU-friendly, baked into the image so first run needs no network download. It's English-optimized; recall quality on other languages degrades.

For multilingual memory (e.g. RU, multi-script), point it at a multilingual model:

HINDSIGHT_API_EMBEDDINGS_LOCAL_MODEL=BAAI/bge-m3   # 1024-dim, multilingual

Dimension is detected automatically. ⚠️ Switching models changes the vector dimension — do it on an empty memory store, or wipe + re-embed, since existing vectors can't be mixed across dimensions.

MCP Server

The mcp-server/ directory contains a standalone MCP server. Any MCP-compatible client (Claude Code, OpenClaw, Cursor, etc.) connects and gets structured long-term memory.

Tools

ToolDescription
memory_retainSave a memory with automatic room/hall classification
memory_recallScoped semantic search with room/hall/layer filters
memory_reflectDeep reasoning — synthesize facts, find patterns, answer with citations
memory_compressCreate closet summaries from accumulated facts
memory_bridgeCross-bank tunnels between related memories

Setup

cd mcp-server
npm install
HINDSIGHT_URL=http://localhost:5100 node server.js

Claude Code config

Add to ~/.claude/mcp.json:

{
  "mcpServers": {
    "mempalace": {
      "command": "node",
      "args": ["/path/to/mcp-server/server.js"],
      "env": {
        "HINDSIGHT_URL": "http://localhost:5100",
        "MEMPALACE_BANK": "my-agent-bank"
      }
    }
  }
}

See mcp-server/README.md for full docs and environment variables.

API changes from upstream

The base /retain and /recall endpoints are fully backward-compatible. New parameters are optional.

New parameters

EndpointParameterTypeDescription
/retainroomstringTopic room (auto-classified if omitted)
/retainhallstringKnowledge type (auto-classified if omitted)
/retainlayerintPriority 0-3 (default: 2)
/recallroomstringFilter recall to a specific room
/recallhallstringFilter recall to a specific hall
/recallmax_layerintMaximum layer depth to search

New endpoints

MethodEndpointDescription
POST/bridgeCreate a cross-bank memory bridge
GET/tunnelsList existing tunnels
POST/tunnelsCreate a tunnel between banks
GET/closetsList compressed memory summaries
POST/closetsCompress L3 memories into a closet

Room/Hall taxonomy

Rooms (topics)

auth · pipeline · infrastructure · deployment · schema · api · ui · tax · hr · legal · compliance · monitoring · agent · general

Halls (knowledge types)

warning · decision · procedure · event · preference · discovery · fact

Layers

LayerNameBehavior
L0CriticalAlways recalled
L1ImportantRecalled by default
L2NormalStandard (default for new memories)
L3ArchiveDeep search only, compressed into closets

Auto-classification

MemPalace includes a keyword-based classifier (room_hall_classifier.py) that assigns room and hall automatically when not provided. No LLM call — classification is instant and free.

Extensible: add keywords to ROOM_KEYWORDS / HALL_KEYWORDS dictionaries.

Examples

Store a memory

curl -X POST http://localhost:5100/retain \
  -H "Content-Type: application/json" \
  -d '{
    "bank": "project-alpha",
    "text": "Never restart PROD PM2 without confirming DEV works first.",
    "room": "deployment",
    "hall": "warning",
    "layer": 0
  }'

Scoped recall

curl -X POST http://localhost:5100/recall \
  -H "Content-Type: application/json" \
  -d '{
    "bank": "project-alpha",
    "query": "deployment safety rules",
    "room": "deployment",
    "hall": "warning",
    "max_layer": 1
  }'

Cross-bank bridge

curl -X POST http://localhost:5100/bridge \
  -H "Content-Type: application/json" \
  -d '{
    "source_bank": "project-alpha",
    "target_bank": "project-beta",
    "room": "infrastructure",
    "hall": "procedure"
  }'

What we changed

A taxonomy layer over Hindsight's vector store, plus a standalone MCP server.

Key additions:

  • room_hall_classifier.py — keyword-based taxonomy engine (new)
  • aa1_add_room_hall_to_memory_units.py — DB migration: flat → hierarchical, adds room/hall + layer column (new)
  • mcp-server/ — standalone MCP server with 5 tools (new)
  • Storage layer — room/hall/layer metadata on every write
  • Retrieval — room-scoped search with hall filtering
  • Compression — closet generation with source linking
  • Tunnels — cross-bank memory sharing protocol

Full architectural spec: MEMPALACE.md

Upstream compatibility

This fork tracks vectorize-io/hindsight as upstream. To pull updates:

git remote add upstream https://github.com/vectorize-io/hindsight.git
git fetch upstream
git merge upstream/main

All changes are additive — existing Hindsight behavior is preserved.

Credits

  • Hindsight by vectorize-io — the memory storage engine
  • MemPalace by milla-jovovich — the hierarchical taxonomy architecture
  • Holetron — fork maintainers, MCP server, integration

License

MIT — same as upstream Hindsight. See LICENSE.

Server Config

{
  "mcpServers": {
    "hindsight-mempalace": {
      "command": "npx",
      "args": [
        "-y",
        "hindsight-mempalace-mcp"
      ],
      "env": {
        "HINDSIGHT_URL": "http://127.0.0.1:5100",
        "MEMPALACE_BANK": "mempalace-main"
      }
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Playwright McpPlaywright MCP server
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
ChatWiseThe second fastest AI chatbot™
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
CursorThe AI Code Editor
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
DeepChatYour AI Partner on Desktop
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Tavily Mcp
WindsurfThe new purpose-built IDE to harness magic
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Serper MCP ServerA Serper MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
Amap Maps高德地图官方 MCP Server