Xpersona
M

MemPalace Memory System for OpenClaw

CLAWHUB · Unverified

MemPalace memory system for OpenClaw/XClaw/WorkBuddy. Archive AI conversations to local long-term storage with semantic search. Commands: /mem-arc (archive),...

62
Rank
84
Safety
1.4k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.4K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s172bpj8fhw2zxbnb5psa48aq983v9xd:mempalace-openclaw
  1. Install using `clawhub skill install s172bpj8fhw2zxbnb5psa48aq983v9xd:mempalace-openclaw` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/deveuper/mempalace-openclaw before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-deveuper-mempalace-openclaw/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

131,643 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: mempalace-openclaw
description: "MemPalace memory system for OpenClaw/XClaw/WorkBuddy. Archive AI conversations to local long-term storage with semantic search. Commands: /mem-arc (archive), /mem-sea (search), /mem-asave (auto-save daily). Based on https://github.com/milla-jovovich/mempalace. Triggers: user wants to save, search or back up AI conversation memories."
---

# MemPalace — AI Long-Term Memory Archive

> **Based on / 基于:** [milla-jovovich/mempalace](https://github.com/milla-jovovich/mempalace)

---

## 总览 / Overview

MemPalace 是一个**本地长期记忆系统**,为 AI 设计。对话永久存档,支持语义搜索。

MemPalace is a **local long-term memory system** for AI agents. Conversations are permanently archived and searchable by meaning (semantic search), not just keywords.

---

## 核心优势 / Key Advantages

| 优势 / Advantage | 说明 / Description |
|-----------------|-------------------|
| 本地存储 / Local Only | 所有数据存在你自己电脑,不上传任何服务器 / All data stays on your machine, nothing uploaded |
| 语义搜索 / Semantic Search | 按意思搜索,不只是关键词匹配 / Searches by meaning, not just keyword match |
| 零费用 / 100% Free | 无需 API Key,无需付费 / No API key, no subscription |
| 跨项目 / Cross-Project | 对话存档跨项目共享,不是单一 workspace / Archives shared across projects, not tied to one workspace |
| 自动归档 / Auto-Archive | 每天 23:00 自动保存,无需手动 / Daily auto-save at 23:00, no manual work |
| 源码内置 / Bundled Source | MemPalace 完整源码打包在 skill 内,首次运行自动安装 / Full MemPalace source bundled, auto-installed on first run |

---

## 费用对比 / Cost Comparison

| 方案 / Solution | 费用 / Cost | 数据位置 / Data Location |
|----------------|------------|------------------------|
| MemPalace | 免费 / Free | 本地 / Local |
| 普通 memory/ | 免费 / Free | workspace 内 / In workspace |
| 第三方云记忆服务 / Cloud memory services | 付费订阅 / Paid | 云端 / Cloud |

---

## 三个命令 / Three Commands

| 命令 / Command | 中文作用 | English Action |
|---------------|---------|--------------|
| `/mem-arc` | 手动归档当前对话到 MemPalace | Archive current session to MemPalace |
| `/mem-sea` | 语义搜索历史记忆 | Semantic search past memories |
| `/mem-asave` | 立即执行今日自动保存 | Auto-save today's memories now |

---

## 工作原理 / How It Works

MemPalace 将对话存储在分级结构中(Wing 主题 > Room 房间 > Drawer 抽屉),通过 ChromaDB 向量数据库实现语义搜索。

MemPalace stores conversations in a hierarchical structure (Wing topic > Room > Drawer) with a ChromaDB vector database for semantic search.

1. Skill 安装后,第一次运行 `/mem-arc` 时自动触发初始化
2. 自动安装 MemPalace 源码 + chromadb/pyyaml 依赖
3. 自动创建 `palace_data/` 目录和 `mempalace.yaml` 配置文件
4. 对话归档时:压缩内容 -> 写入 convos 文件夹 -> 索引到 ChromaDB
5. 搜索时:通过向量匹配找到最相关的记忆片段

---

## 自动配置 / Auto-Setup

第一次运行时自动执行以下步骤,无需手动操作:

1. `pip install -e ./mempalace --no-deps` — 从内置源码安装 mempalace
2. `pip install chromadb pyyaml` — 安装运行时依赖(chromadb 从 PyPI 下载)
3. 创建 `palace_data/` 目录 — 存放对话归档和向量索引
4. 创建 `mempalace.yaml` — Wing 和 Room 配置文件
5. 运行初次索引 — `mempalace mine ./palace_data --wing openclaw`

安装后只需要用命令,无需任何手动配置。

---

## 数据存储位置 / Storage Locations

所有路径相对于 skill 目录,不暴露用户路径。

All paths are relative to the skill directory — no user paths exposed.

mempalace/ 

mempalace/hooks/README.md

# MemPalace Hooks — Auto-Save for Terminal AI Tools

These hook scripts make MemPalace save automatically. No manual "save" commands needed.

## What They Do

| Hook | When It Fires | What Happens |
|------|--------------|-------------|
| **Save Hook** | Every 15 human messages | Blocks the AI, tells it to save key topics/decisions/quotes to the palace |
| **PreCompact Hook** | Right before context compaction | Emergency save — forces the AI to save EVERYTHING before losing context |

The AI does the actual filing — it knows the conversation context, so it classifies memories into the right wings/halls/closets. The hooks just tell it WHEN to save.

## Install — Claude Code

Add to `.claude/settings.local.json`:

```json
{
  "hooks": {
    "Stop": [{
      "matcher": "*",
      "hooks": [{
        "type": "command",
        "command": "/absolute/path/to/hooks/mempal_save_hook.sh",
        "timeout": 30
      }]
    }],
    "PreCompact": [{
      "hooks": [{
        "type": "command",
        "command": "/absolute/path/to/hooks/mempal_precompact_hook.sh",
        "timeout": 30
      }]
    }]
  }
}
```

Make them executable:
```bash
chmod +x hooks/mempal_save_hook.sh hooks/mempal_precompact_hook.sh
```

## Install — Codex CLI (OpenAI)

Add to `.codex/hooks.json`:

```json
{
  "Stop": [{
    "type": "command",
    "command": "/absolute/path/to/hooks/mempal_save_hook.sh",
    "timeout": 30
  }],
  "PreCompact": [{
    "type": "command",
    "command": "/absolute/path/to/hooks/mempal_precompact_hook.sh",
    "timeout": 30
  }]
}
```

## Configuration

Edit `mempal_save_hook.sh` to change:

- **`SAVE_INTERVAL=15`** — How many human messages between saves. Lower = more frequent saves, higher = less interruption.
- **`STATE_DIR`** — Where hook state is stored (defaults to `~/.mempalace/hook_state/`)
- **`MEMPAL_DIR`** — Optional. Set to a conversations directory to auto-run `mempalace mine <dir>` on each save trigger. Leave blank (default) to let the AI handle saving via the block reason message.

### mempalace CLI

The relevant commands are:

```bash
mempalace mine <dir>               # Mine all files in a directory
mempalace mine <dir> --mode convos # Mine conversation transcripts only
```

The hooks resolve the repo root automatically from their own path, so they work regardless of where you install the repo.

## How It Works (Technical)

### Save Hook (Stop event)

```
User sends message → AI responds → Claude Code fires Stop hook
                                            ↓
                                    Hook counts human messages in JSONL transcript
                                            ↓
                              ┌─── < 15 since last save ──→ echo "{}" (let AI stop)
                              │
                              └─── ≥ 15 since last save ──→ {"decision": "block", "reason": "save..."}
                                         

mempalace/README.md

# mempalace/ — Core Package

The Python package that powers MemPalace. All modules, all logic.

## Modules

| Module | What it does |
|--------|-------------|
| `cli.py` | CLI entry point — routes to mine, search, init, compress, wake-up |
| `config.py` | Configuration loading — `~/.mempalace/config.json`, env vars, defaults |
| `normalize.py` | Converts 5 chat formats (Claude Code JSONL, Claude.ai JSON, ChatGPT JSON, Slack JSON, plain text) to standard transcript format |
| `miner.py` | Project file ingest — scans directories, chunks by paragraph, stores to ChromaDB |
| `convo_miner.py` | Conversation ingest — chunks by exchange pair (Q+A), detects rooms from content |
| `searcher.py` | Semantic search via ChromaDB vectors — filters by wing/room, returns verbatim + scores |
| `layers.py` | 4-layer memory stack: L0 (identity), L1 (critical facts), L2 (room recall), L3 (deep search) |
| `dialect.py` | AAAK compression — entity codes, emotion markers, 30x lossless ratio |
| `knowledge_graph.py` | Temporal entity-relationship graph — SQLite, time-filtered queries, fact invalidation |
| `palace_graph.py` | Room-based navigation graph — BFS traversal, tunnel detection across wings |
| `mcp_server.py` | MCP server — 19 tools, AAAK auto-teach, Palace Protocol, agent diary |
| `onboarding.py` | Guided first-run setup — asks about people/projects, generates AAAK bootstrap + wing config |
| `entity_registry.py` | Entity code registry — maps names to AAAK codes, handles ambiguous names |
| `entity_detector.py` | Auto-detect people and projects from file content |
| `general_extractor.py` | Classifies text into 5 memory types (decision, preference, milestone, problem, emotional) |
| `room_detector_local.py` | Maps folders to room names using 70+ patterns — no API |
| `spellcheck.py` | Name-aware spellcheck — won't "correct" proper nouns in your entity registry |
| `split_mega_files.py` | Splits concatenated transcript files into per-session files |

## Architecture

```
User → CLI → miner/convo_miner → ChromaDB (palace)
                                     ↕
                              knowledge_graph (SQLite)
                                     ↕
User → MCP Server → searcher → results
                  → kg_query → entity facts
                  → diary    → agent journal
```

The palace (ChromaDB) stores verbatim content. The knowledge graph (SQLite) stores structured relationships. The MCP server exposes both to any AI tool.

README.md

# MemPalace Skill

> 让 AI 记住所有对话,随时搜索,像人一样积累经验。

---

## 一、这是什么?

MemPalace 是给 AI 用的长期记忆系统。

普通 AI 的记忆只在"当前对话"里,关掉就没了。MemPalace 把对话永久存档,还能语义搜索。

---

## 二、优势对比

| | 普通 memory/ | MemPalace |
|---|---|---|
| 存储位置 | workspace 内,仅当前项目 | 本地,跨项目 |
| 搜索方式 | 关键词匹配 | 语义向量搜索(懂意思)|
| 数据结构 | 扁平文件 | Wing > Room > Drawer 层级 |
| 长期积累 | 越积越多 AI 越慢 | 定时压缩,按需查询 |
| 本地存储 | ✅ | ✅ 全部在你电脑 |
| 自动归档 | ❌ | ✅ 每天自动 |

---

## 三、是否本地存储?

全部本地,没有任何数据上云。

所有文件存在 skill 同目录下的 palace_data/ 文件夹里:
- 对话归档:palace_data/convos/
- 向量索引:palace_data/.mempalace/
- 配置文件:palace_data/mempalace.yaml

---

## 四、目录结构

mempalace/                    Skill 根目录
├── mempalace/                内置 MemPalace 源码
│   ├── cli.py, miner.py     等所有源码文件
│   └── pyproject.toml       pip install -e 所需
├── scripts/
│   └── archive.ps1          归档和搜索脚本
├── palace_data/              首次运行后自动创建
│   ├── convos/              归档的对话文件
│   └── .mempalace/          ChromaDB 向量索引
├── mempalace.yaml            Wing/Room 配置
└── SKILL.md

---

## 五、如何安装

第一步:安装 skill
通过 ClawHub 安装:
clawhub install mempalace-openclaw

或手动:把 mempalace 文件夹放到你的 OpenClaw skills 目录

第二步:安装依赖(自动)
第一次运行 /mem-arc 时会自动:
1. 从 skill 源码目录安装 mempalace Python 包
2. 安装 chromadb 和 pyyaml 依赖
3. 创建 palace_data/ 目录
4. 完成初始化

无需手动敲命令,AI 会自动处理。

---

## 六、三个命令

| 命令 | 效果 |
|------|------|
| /mem-arc | 手动归档当前对话 |
| /mem-sea <关键词> | 搜索历史记忆 |
| /mem-asave | 立即保存今天记忆 |

---

## 七、自动归档

设置好后,每天 23:00 AI 会自动把当天对话归档,不需要手动操作。

---

## 八、兼容哪些 AI?

✅ OpenClaw  ✅ XClaw  ✅ WorkBuddy  ✅ Claude Code  ✅ 所有支持 Python + Skill 的 AI

---

## 九、常见问题

Q: 会泄露隐私吗?
A: 不会。所有数据存在你本地,不上传任何服务器。

Q: 存档的内容是什么?
A: AI 自动压缩,只保留精华(决策、配置、待办),删除废话。

Q: 记忆太多会变慢吗?
A: 不会。搜索是向量匹配,只返回最相关的几条。

---

*Skill: mempalace-openclaw | Version 1.4.0 | ClawHub: mempalace-openclaw | 基于 milla-jovovich/mempalace*

_meta.json

{
  "ownerId": "kn7a44nd3cqssbhfz0vbfrscrn82pgtk",
  "slug": "mempalace-openclaw",
  "version": "1.6.0",
  "publishedAt": 1775661675991
}

Sponsored

Ads related to MemPalace Memory System for OpenClaw and adjacent AI workflows.