Memory Master
/install memory-master
\r \r
🧠 Memory Master — The Precision Memory System\r
\r Transform your AI agent from forgetful to photographic.\r \r ---\r \r
The Problem\r
\r Most AI agents suffer from memory amnesia:\r \r
- ❌ Can't remember what you discussed yesterday\r
- ❌ Loads entire memory files, burning tokens\r
- ❌ Fuzzy search returns irrelevant results\r
- ❌ No structure, just raw text dumps\r
- ❌ Waits for user to trigger recall, never proactively remembers\r \r You deserve better.\r \r ---\r \r
The Solution: Memory Master v1.2.4\r
\r A precision-targeted memory architecture with optional network learning capability.\r \r
✨ Key Features\r
\r | Feature | Description |\r |---------|-------------|\r | 📝 Structured Memory | "Cause → Change → Todo" format for every entry |\r | 🔄 Auto Index Sync | Write once, index updates automatically |\r | 🎯 Zero Token Waste | Read only what you need, nothing more |\r | ⚡ Heuristic Recall | Proactively finds relevant memories when context is missing |\r | 🧠 Auto Learning | When local knowledge is insufficient, automatically search web to learn and update knowledge base |\r | 🔓 Full Control | All files visible/editable/deletable. No auto network calls. |\r \r ---\r \r
The Memory Format\r
\r
Daily Memory: memory/daily/YYYY-MM-DD.md\r
\r Format:\r
## [日期] 主题\r
- 因:原因/背景\r
- 改:做了什么、改了什么\r
- 待:待办/后续\r
```\r
\r
**Example:**\r
```markdown\r
## [2026-03-03] 记忆系统升级\r
- 因:原记忆目录混乱,查找困难\r
- 改:目录调整为 daily/ + knowledge/,上传 v1.1.0\r
- 待:检查 ClawHub 描述\r
```\r
\r
**Why this format?**\r
- 一目了然 (一目了然 = instantly clear at a glance)\r
- 逻辑清晰:因 → 改 → 待\r
- 通用模板,适用于任何场景\r
\r
---\r
\r
## The Index Format\r
\r
### Index: `memory/daily-index.md`\r
\r
**Format:**\r
```markdown\r
# 记忆索引\r
\r
- 主题名 → daily/日期.md,日期.md\r
```\r
\r
**Example:**\r
```markdown\r
# 记忆索引\r
\r
- 记忆系统升级 → daily/2026-03-03.md\r
- 飞书配置 → daily/2026-03-02.md,daily/2026-03-03.md\r
- 电商网站 → daily/2026-03-02.md\r
```\r
\r
**Rules:**\r
- 逗号分隔多天\r
- 只有一个一级标题:记忆索引\r
- 简洁清晰,一眼定位\r
\r
---\r
\r
## Heuristic Recall Protocol\r
\r
### When to Trigger Recall\r
\r
** DON'T wait for user to say "yesterday" or "remember"**\r
\r
Trigger recall when:\r
1. User mentions a topic you don't have context for\r
2. Current conversation references something past\r
3. You feel "I'm not sure I have this information"\r
4. User asks about "that", "the project", "the skill"\r
\r
### Recall Flow\r
\r
```\r
用户问题 → 发现上下文缺失 → 读 index 定位主题 → 读取记忆文件 → 恢复上下文 → 回答\r
```\r
\r
**Example:**\r
```\r
User: "那个 skill 你觉得还有什么要改的吗?"\r
\r
1. 思考:我知道用户指哪个 skill 吗?→ 不知道,上下文没有\r
2. 读 index → 找到"记忆系统升级 → daily/2026-03-03.md"\r
3. 读取文件 → 恢复记忆\r
4. 回答:"根据昨天记录,我们..."\r
```\r
\r
### Key Principle\r
\r
**"When you realize you don't know, go check the index."**\r
\r
---\r
\r
## Knowledge Base System\r
\r
### Knowledge Structure\r
\r
```\r
memory/knowledge/\r
├── knowledge-index.md\r
└── *.md (knowledge entries)\r
```\r
\r
### Knowledge Index: `memory/knowledge-index.md`\r
\r
**极简格式 - 关键字列表:**\r
```markdown\r
# 知识库索引\r
\r
- clawhub\r
- oauth\r
- react\r
```\r
\r
### When to Read Knowledge Base\r
\r
**启发式:当前上下文没有相关信息时才读**\r
\r
1. 用户有要求 → 按用户要求执行\r
2. 用户没要求 → 检查上下文有没有规则\r
3. 上下文没有 → 搜索知识库索引\r
4. 找到对应项 → 读取知识库文件执行\r
\r
- 上下文有 → 直接用\r
- 上下文没有 → 搜索引 → 读知识库文件 → 执行\r
\r
### Problem Solving Flow\r
\r
```\r
用户问题 → 上下文有?→ 有:直接解决 / 无:搜索引 → 有知识?→ 有:解决 / 无:自动网络搜索学习 → 写知识库 → 更新索引 → 解决问题\r
```\r
\r
**Example:**\r
```\r
User: "怎么上传 skill 到 ClawHub?"\r
\r
1. 上下文有 clawhub 信息?→ 有(刚学过)→ 直接回答\r
2. 不用读知识库\r
\r
---\r
User: "怎么实现 OAuth?"\r
\r
1. 上下文有 OAuth 信息?→ 没有\r
2. 搜 knowledge-index → 没有 OAuth\r
3. 告知用户:"我还不会,先去查一下"\r
4. 网络搜索学习\r
5. 写入 knowledge/oauth.md\r
6. 更新 knowledge-index\r
7. 开始和用户沟通解决方案\r
```\r
\r
---\r
\r
## Write Flow\r
\r
### When to Write\r
\r
Write immediately after:\r
1. Discussion reaches a conclusion\r
2. Decision is made\r
3. Action item is assigned\r
4. Something important happens\r
5. Learned something new (check before every response)\r
\r
### ⚠️ IMPORTANT: Auto-Trigger Write\r
\r
**DO NOT wait for user to remind you!**\r
\r
Before every response, quickly check: "Did I learn anything new in this conversation?" If yes, write it.\r
\r
Write IMMEDIATELY when any of the above happens. This is NOT optional.\r
\r
### Skill Event Triggers (Auto-Record)\r
\r
When a skill completes or errors, automatically record to knowledge:\r
\r
| Event | Write Location | Content |\r
|-------|---------------|---------|\r
| **skill_complete** | memory/knowledge/ | 记录学到了什么新技能/方法 |\r
| **skill_error** | memory/knowledge/ | 记录错误原因和解决方案 |\r
\r
**统一写入知识库**,因为都是"学到新知识"。\r
\r
### Write Steps\r
\r
1. **Detect** conclusion/action (automatically, every time)\r
2. **Format** using "因-改-待" template\r
3. **Write** to `memory/daily/YYYY-MM-DD.md`\r
4. **Update** `daily-index.md` (add new topic or append date)\r
\r
**IMPORTANT: Always update index when writing to daily memory!**\r
\r
### Update MEMORY.md (if needed)\r
\r
When writing to MEMORY.md:\r
1. Check for duplicate/outdated rules\r
2. Merge and clean up\r
3. Keep it minimal\r
\r
### Example\r
\r
```\r
讨论:我们要改进记忆系统,决定把目录分成 daily/ 和 knowledge/\r
结论:改完了,今天上传到 GitHub 和 ClawHub\r
\r
写入:\r
## [2026-03-04] 记忆系统升级\r
- 因:原记忆目录混乱,查找困难\r
- 改:目录调整为 daily/ + knowledge/,上传 v1.1.0\r
- 待:检查 ClawHub 描述\r
\r
更新索引:\r
- 记忆系统升级 → daily/2026-03-03.md,daily/2026-03-04.md\r
```\r
\r
---\r
\r
## Recall Flow Summary\r
\r
| Step | Action | Trigger |\r
|------|--------|---------|\r
| 1 | Parse user query | User asks question |\r
| 2 | Check: do I have context? | If uncertain |\r
| 3 | Read daily-index.md | Context missing |\r
| 4 | Locate relevant topic | Found in index |\r
| 5 | Read target date file | Know the date |\r
| 6 | Restore context | Got info |\r
| 7 | Answer user | Complete |\r
\r
---\r
\r
## Knowledge Base Flow Summary\r
\r
| Step | Action | Trigger |\r
|------|--------|---------|\r
| 1 | Parse user query | User asks question |\r
| 2 | Search knowledge-index | Always check first |\r
| 3 | Found solution? | Yes → Solve / No → Continue |\r
| 4 | Tell user "I don't know yet" | No solution |\r
| 5 | Search web & learn | Get knowledge |\r
| 6 | Write to knowledge/*.md | New knowledge |\r
| 7 | Update knowledge-index | Keep index in sync |\r
| 8 | Solve the problem | Complete |\r
\r
---\r
\r
## File Structure\r
\r
```\r
~/.openclaw/workspace/\r
├── AGENTS.md # Your rules\r
├── MEMORY.md # Long-term memory (main session only)\r
├── memory/\r
│ ├── daily/ # Daily records\r
│ │ ├── 2026-03-02.md\r
│ │ ├── 2026-03-03.md\r
│ │ └── 2026-03-04.md\r
│ ├── knowledge/ # Knowledge base\r
│ │ ├── react-basics.md\r
│ │ └── flask-api.md\r
│ ├── daily-index.md # Daily memory index\r
│ └── knowledge-index.md # Knowledge index\r
```\r
\r
---\r
\r
## Comparison\r
\r
| Metric | Traditional | Memory Master v1.2 |\r
|--------|-------------|---------------------|\r
| Recall precision | ~30% | ~95% |\r
| Token cost per recall | High (full file) | Near zero (targeted) |\r
| Proactive recall | ❌ | ✅ (heuristic) |\r
| Knowledge learning | ❌ | ✅ |\r
| API dependencies | Vector DB / OpenAI | None |\r
| Setup complexity | High | Zero |\r
| Latency | Variable | Instant |\r
\r
---\r
\r
## Requirements\r
\r
**None.** This skill works with pure OpenClaw:\r
\r
- ✅ OpenClaw installed\r
- ✅ Workspace configured\r
- ✅ That's it!\r
\r
**No external APIs. No embeddings. No costs.**\r
\r
---\r
\r
## Installation\r
\r
### 1. Install Skill\r
```bash\r
clawdhub install memory-master\r
```\r
\r
### 2. Auto-Initialize (Enhanced for v2.6.0)\r
```bash\r
# This will automatically:\r
# - Migrate heartbeat rules from AGENTS.md to HEARTBEAT.md\r
# - Optimize AGENTS.md (deduplicate, streamline, restructure)\r
# - Convert MEMORY.md to pure lessons/experience repository\r
# - Create memory directory structure and index files\r
# - Backup original files to .memory-master-backup/ directory\r
clawdhub init memory-master\r
```\r
\r
**What the enhanced initialization does:**\r
\r
| Step | Action | Result |\r
|------|--------|--------|\r
| 1 | **Backup** | Original files saved to `.memory-master-backup/` |\r
| 2 | **Heartbeat Migration** | Heartbeat content moved from AGENTS.md to HEARTBEAT.md |\r
| 3 | **AGENTS.md Optimization** | Remove duplicates, outdated rules, streamline language |\r
| 4 | **MEMORY.md Transformation** | Convert to pure lessons/experience repository |\r
| 5 | **Memory Structure** | Create `memory/` directories and index files |\r
\r
**Post-initialization files:**\r
```\r
~/.openclaw/workspace/\r
├── AGENTS.md # Optimized behavior rules + memory system rules\r
├── MEMORY.md # Pure lessons/experience repository\r
├── HEARTBEAT.md # Heartbeat tasks and guidelines\r
├── memory/\r
│ ├── daily/ # Daily records (YYYY-MM-DD.md format)\r
│ ├── knowledge/ # Knowledge base (*.md files)\r
│ ├── daily-index.md # Memory index\r
│ └── knowledge-index.md # Knowledge index\r
```\r
\r
Or manually (advanced users):\r
```bash\r
# 1. Run the initialization script directly\r
node ~/.agents/skills/memory-master/scripts/init.js\r
\r
# 2. Or manually copy templates\r
cp ~/.agents/skills/memory-master/templates/optimized-agents.md ~/.openclaw/workspace/AGENTS.md\r
cp ~/.agents/skills/memory-master/templates/heartbeat-template.md ~/.openclaw/workspace/HEARTBEAT.md\r
cp ~/.agents/skills/memory-master/templates/memory-lessons.md ~/.openclaw/workspace/MEMORY.md\r
\r
# 3. Create memory directories\r
mkdir -p ~/.openclaw/workspace/memory/daily\r
mkdir -p ~/.openclaw/workspace/memory/knowledge\r
\r
# 4. Create index files\r
cp ~/.agents/skills/memory-master/templates/daily-index.md ~/.openclaw/workspace/memory/daily-index.md\r
cp ~/.agents/skills/memory-master/templates/knowledge-index.md ~/.openclaw/workspace/memory/knowledge-index.md\r
```\r
\r
---\r
\r
## ⚠️ Security & Privacy\r
\r
- **100% Local**: All memory/knowledge stored in local workspace files only. Nothing leaves your machine except your initiated web searches.\r
- **Auto-Write to Local**: This is a FEATURE — prevents information loss. Same as OpenClaw's native memory system.\r
- **Auto Learning**: When local knowledge is insufficient, automatically search web to learn. Writes results to local knowledge base only.\r
- **Full Transparency**: All files visible/editable/deletable by user anytime.\r
- **Safe**: No data uploaded, only search queries sent to search engines.\r
- **User Control**: User explicitly authorizes web searches ("我去查一下", "let me search the web") before any network activity\r
\r
---\r
\r
## Triggers\r
\r
### Memory Recall\r
- "that"\r
- "上次"\r
- "之前"\r
- "昨天"\r
- "earlier"\r
- Or: when you realize you don't have the context\r
\r
### Knowledge Learning\r
- When you can't find answer in knowledge base\r
- User asks something new\r
\r
### Memory Writing\r
- Discussion reaches conclusion\r
- Decision made\r
- Action assigned\r
\r
---\r
\r
## Best Practices\r
\r
1. **Write immediately** — Don't wait, write right after conclusion\r
2. **Keep it brief** — One line per point, but core info preserved\r
3. **Use the template** — 因 → 改 → 待\r
4. **Update index** — Always sync after writing\r
5. **Heuristic recall** — Don't wait for user to trigger\r
6. **Learn proactively** — When you don't know, say it and learn\r
\r
---\r
\r
## Compression Detection (v2.6.3+)\r
\r
**⚠️ Important: Must run after EVERY response!**\r
\r
### Run after every response:\r
```bash\r
node ~/.agents/skills/memory-master/scripts/detect.js\r
```\r
\r
Display status at the bottom of every response:\r
- **50%**: `📝 上下文使用率:50% - 是否需要记录记忆或知识库?`\r
- **70%**: `⚠️ 上下文使用率:70% - 建议记录当前进度`\r
- **85%**: `🚨 上下文使用率:85% - 请立即记录当前进度!`\r
\r
### Why this matters:\r
- Prevents context loss from compression\r
- Reminds user to record memories before data is lost\r
- Works with heartbeat but runs more frequently\r
\r
---\r
\r
## The Memory Master Promise\r
\r
> *"An AI agent is only as good as its memory. Give your agent a memory system that never forgets, never wastes, and always delivers exactly what's needed."*\r
\r
**Memory Master v1.2.0 — Because remembering everything is just as important as learning something new.** 🧠⚡\r
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install memory-master - After installation, invoke the skill by name or use
/memory-master - Provide required inputs per the skill's parameter spec and get structured output
What is Memory Master?
Local memory system with structured indexing and auto-learning. Auto-write, heuristic recall, auto learning when knowledge is insufficient. Compatible with s... It is an AI Agent Skill for Claude Code / OpenClaw, with 1112 downloads so far.
How do I install Memory Master?
Run "/install memory-master" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Memory Master free?
Yes, Memory Master is completely free (open-source). You can download, install and use it at no cost.
Which platforms does Memory Master support?
Memory Master is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Memory Master?
It is built and maintained by lizhelong0907 (@lizhelong0907); the current version is v2.6.5.