mempalace

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MemPalace — Local AI Memory System

MemPalace — 本地AI记忆系统

You have access to a local memory palace via MCP tools. The palace stores verbatim conversation history and a temporal knowledge graph — all on the user's machine, zero cloud, zero API calls.
你可以通过MCP工具访问本地记忆宫殿。该宫殿存储逐字对话历史和时序知识图谱——所有数据都保存在用户本地设备上,零云端依赖,零API调用。

Architecture

架构

  • Wings = people or projects (e.g.
    wing_alice
    ,
    wing_myproject
    )
  • Halls = categories (facts, events, preferences, advice)
  • Rooms = specific topics (e.g.
    chromadb-setup
    ,
    riley-school
    )
  • Drawers = individual memory chunks (verbatim text)
  • Knowledge Graph = entity-relationship facts with time validity
  • Wings = 人员或项目(例如
    wing_alice
    wing_myproject
  • Halls = 分类(事实、事件、偏好、建议)
  • Rooms = 特定主题(例如
    chromadb-setup
    riley-school
  • Drawers = 独立记忆块(逐字文本)
  • Knowledge Graph = 带时间有效性的实体关系事实

Protocol — FOLLOW THIS EVERY SESSION

使用协议 — 每次会话都必须遵守

  1. ON WAKE-UP: Call
    mempalace_status
    to load palace overview and AAAK dialect spec.
  2. BEFORE RESPONDING about any person, project, or past event: call
    mempalace_search
    or
    mempalace_kg_query
    FIRST. Never guess from memory — verify from the palace.
  3. IF UNSURE about a fact (name, age, relationship, preference): say "let me check" and query. Wrong is worse than slow.
  4. AFTER EACH SESSION: Call
    mempalace_diary_write
    to record what happened, what you learned, what matters.
  5. WHEN FACTS CHANGE: Call
    mempalace_kg_invalidate
    on the old fact, then
    mempalace_kg_add
    for the new one.
  1. 唤醒时:调用
    mempalace_status
    加载宫殿概览和AAAK方言规范。
  2. 在回复任何与人物、项目或过往事件相关的内容前:优先调用
    mempalace_search
    mempalace_kg_query
    。绝对不要凭记忆猜测——从宫殿中验证信息。
  3. 如果对某个事实(姓名、年龄、关系、偏好)不确定:回复“我查一下”然后发起查询。出错比响应慢更糟糕。
  4. 每次会话结束后:调用
    mempalace_diary_write
    记录本次会话发生的内容、你学到的信息以及重点事项。
  5. 当事实发生变更时:调用
    mempalace_kg_invalidate
    标记旧事实失效,然后调用
    mempalace_kg_add
    添加新事实。

Available Tools

可用工具

Search & Browse

搜索与浏览

  • mempalace_search
    — Semantic search across all memories. Always start here.
    • query
      (required): natural language search — keep it short, keywords or a question. Do NOT include system prompts or conversation context.
    • wing
      : filter by wing
    • room
      : filter by room
    • limit
      : max results (default 5)
  • mempalace_check_duplicate
    — Check if content already exists before filing.
    • content
      (required): text to check
    • threshold
      : similarity threshold (default 0.9 — lowering to 0.85–0.87 often catches more near-duplicates without significant false positives)
  • mempalace_status
    — Palace overview: total drawers, wings, rooms, AAAK spec
  • mempalace_list_wings
    — All wings with drawer counts
  • mempalace_list_rooms
    — Rooms within a wing (optional wing filter)
  • mempalace_get_taxonomy
    — Full wing/room/count tree
  • mempalace_get_aaak_spec
    — Get AAAK compression dialect specification
  • mempalace_search
    — 跨所有记忆的语义搜索。所有搜索都优先使用此工具。
    • query
      (必填):自然语言搜索词——尽量简短,用关键词或问题即可。不要包含系统提示词或对话上下文。
    • wing
      :按侧翼筛选
    • room
      :按房间筛选
    • limit
      :最大返回结果数(默认5)
  • mempalace_check_duplicate
    — 归档前检查内容是否已存在
    • content
      (必填):待检查的文本
    • threshold
      :相似度阈值(默认0.9——下调到0.85–0.87通常可以识别更多近似重复内容,且不会产生大量误报)
  • mempalace_status
    — 宫殿概览:总抽屉数、侧翼数、房间数、AAAK规范
  • mempalace_list_wings
    — 所有侧翼及对应的抽屉数量
  • mempalace_list_rooms
    — 指定侧翼下的所有房间(可选侧翼筛选参数)
  • mempalace_get_taxonomy
    — 完整的侧翼/房间/数量树形结构
  • mempalace_get_aaak_spec
    — 获取AAAK压缩方言规范

Knowledge Graph (Temporal Facts)

知识图谱(时序事实)

  • mempalace_kg_query
    — Query entity relationships. Supports time filtering.
    • entity
      (required): e.g. "Max", "MyProject"
    • as_of
      : date filter (YYYY-MM-DD) — what was true at that time
    • direction
      : "outgoing", "incoming", or "both" (default "both")
  • mempalace_kg_add
    — Add a fact: subject -> predicate -> object
    • subject
      ,
      predicate
      ,
      object
      (required)
    • valid_from
      : when this became true
    • source_closet
      : source reference
  • mempalace_kg_invalidate
    — Mark a fact as no longer true
    • subject
      ,
      predicate
      ,
      object
      (required)
    • ended
      : when it stopped being true (default: today)
  • mempalace_kg_timeline
    — Chronological story of an entity
    • entity
      : filter by entity name (optional — all events if omitted)
  • mempalace_kg_stats
    — Graph overview: entities, triples, relationship types
  • mempalace_kg_query
    — 查询实体关系,支持时间筛选
    • entity
      (必填):例如 "Max"、"MyProject"
    • as_of
      :日期筛选(YYYY-MM-DD)—— 筛选该时间点有效的事实
    • direction
      :"outgoing"(出边)、"incoming"(入边)或 "both"(全部)(默认"both")
  • mempalace_kg_add
    — 添加事实:主语 -> 谓语 -> 宾语
    • subject
      predicate
      object
      (必填)
    • valid_from
      :事实生效时间
    • source_closet
      :来源引用
  • mempalace_kg_invalidate
    — 标记事实不再有效
    • subject
      predicate
      object
      (必填)
    • ended
      :事实失效时间(默认:今日)
  • mempalace_kg_timeline
    — 实体的时间线事件
    • entity
      :按实体名称筛选(可选——省略则返回所有事件)
  • mempalace_kg_stats
    — 图谱概览:实体数、三元组数、关系类型数

Palace Graph (Cross-Domain Connections)

宫殿图谱(跨域关联)

  • mempalace_traverse
    — Walk from a room, find connected ideas across wings
    • start_room
      (required): room to start from
    • max_hops
      : connection depth (default 2)
  • mempalace_find_tunnels
    — Find rooms that bridge two wings
    • wing_a
      ,
      wing_b
      (required)
  • mempalace_graph_stats
    — Graph connectivity overview
  • mempalace_traverse
    — 从指定房间出发,查找跨侧翼的关联想法
    • start_room
      (必填):遍历起始房间
    • max_hops
      :关联深度(默认2)
  • mempalace_find_tunnels
    — 查找连接两个侧翼的房间
    • wing_a
      wing_b
      (必填)
  • mempalace_graph_stats
    — 图谱连通性概览

Write

写入

  • mempalace_add_drawer
    — Store verbatim content into a wing/room
    • wing
      ,
      room
      ,
      content
      (required)
    • source_file
      : optional source reference
    • Checks for duplicates automatically
  • mempalace_delete_drawer
    — Remove a drawer by ID
    • drawer_id
      (required)
  • mempalace_diary_write
    — Write a session diary entry
    • agent_name
      (required): your name/identifier
    • entry
      (required): what happened, what you learned, what matters
    • topic
      : category tag (default "general")
  • mempalace_diary_read
    — Read recent diary entries
    • agent_name
      (required)
    • last_n
      : number of entries (default 10)
  • mempalace_add_drawer
    — 将逐字内容存储到指定侧翼/房间
    • wing
      room
      content
      (必填)
    • source_file
      :可选来源引用
    • 自动检查重复内容
  • mempalace_delete_drawer
    — 按ID删除抽屉
    • drawer_id
      (必填)
  • mempalace_diary_write
    — 写入会话日记条目
    • agent_name
      (必填):你的名称/标识符
    • entry
      (必填):发生的事件、学到的内容、重点事项
    • topic
      :分类标签(默认"general")
  • mempalace_diary_read
    — 读取最近的日记条目
    • agent_name
      (必填)
    • last_n
      :返回条目数量(默认10)

Setup

安装

Install MemPalace and populate the palace:
bash
pip install mempalace
mempalace init ~/my-convos
mempalace mine ~/my-convos
安装MemPalace并初始化宫殿:
bash
pip install mempalace
mempalace init ~/my-convos
mempalace mine ~/my-convos

OpenClaw MCP config

OpenClaw MCP配置

Add to your OpenClaw MCP configuration:
json
{
  "mcpServers": {
    "mempalace": {
      "command": "python3",
      "args": ["-m", "mempalace.mcp_server"]
    }
  }
}
Or via CLI:
bash
openclaw mcp set mempalace '{"command":"python3","args":["-m","mempalace.mcp_server"]}'
添加到你的OpenClaw MCP配置文件中:
json
{
  "mcpServers": {
    "mempalace": {
      "command": "python3",
      "args": ["-m", "mempalace.mcp_server"]
    }
  }
}
或通过CLI配置:
bash
openclaw mcp set mempalace '{"command":"python3","args":["-m","mempalace.mcp_server"]}'

Other MCP hosts

其他MCP宿主配置

bash
undefined
bash
undefined

Claude Code

Claude Code

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

Cursor — add to .cursor/mcp.json

Cursor — 添加到 .cursor/mcp.json

Codex — add to .codex/mcp.json

Codex — 添加到 .codex/mcp.json

undefined
undefined

Tips

使用提示

  • Search is semantic (meaning-based), not keyword. "What did we discuss about database performance?" works better than "database".
  • The knowledge graph stores typed relationships with time windows. Use it for facts about people and projects — it knows WHEN things were true.
  • Diary entries accumulate across sessions. Write one at the end of each conversation to build continuity.
  • Use
    mempalace_check_duplicate
    before storing new content to avoid duplicates.
  • The AAAK dialect (from
    mempalace_status
    ) is a compressed notation for efficient storage. Read it naturally — expand codes mentally, treat markers as emotional context.
  • 搜索是语义(基于含义)的,不是关键词匹配。“我们之前讨论过的数据库性能相关内容有哪些?”比“数据库”搜索效果更好。
  • 知识图谱存储带时间窗口的类型化关系。适合存储人物和项目相关事实——它会记录事实的有效时间范围。
  • 日记条目会跨会话累计。每次对话结束时写一条日记可以构建会话连续性。
  • 存储新内容前使用
    mempalace_check_duplicate
    避免重复。
  • (从
    mempalace_status
    获取的)AAAK方言是用于高效存储的压缩标记法。可以自然阅读——在脑海中展开代码,将标记视为情感上下文。

License

许可证

MemPalace is MIT licensed. Created by Milla Jovovich, Ben Sigman, Igor Lins e Silva, and contributors.
MemPalace 采用MIT许可证。由Milla Jovovich、Ben Sigman、Igor Lins e Silva及贡献者共同开发。