minimal-memory

TotalClaw 作者 totalclaw

通过好/坏/中性分类和语义搜索来维护干净、高效的内存文件。在管理代理内存、决定存储什么、搜索过去的记忆或组织知识时使用。触发条件:内存清理请求、“记住这一点”、“搜索内存”、内存组织讨论或 MEMORY.md 变得太大时。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~zencrust-ai-minimal-memory
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~zencrust-ai-minimal-memory/file -o zencrust-ai-minimal-memory.md
# Minimal Memory Management

Keep agent memory lean, searchable, and actionable through structured categorization and two-tier storage.

## Core Principle

**MEMORY.md = Long-term essentials (GOOD/BAD learnings only)**
**memory/YYYY-MM-DD.md = Daily operations (GOOD/BAD/NEUTRAL tagged)**

## Information Categorization

Tag every memory entry with its value:

| Tag | Meaning | Keep in MEMORY.md? | Example |
|-----|---------|-------------------|---------|
| `[GOOD]` | Worked well, repeat | ✅ Yes | `[GOOD] CSV batch format prevents duplicates` |
| `[BAD]` | Failed, avoid | ✅ Yes | `[BAD] Bird CLI blocked by X anti-automation` |
| `[NEUTRAL]` | Facts, context, state | ❌ No | `[NEUTRAL] Day 5 of 30-day media plan` |

### Writing Rules
1. **Always tag** new entries in daily files
2. **Be specific**: What worked/failed and why
3. **One tag per entry** - pick the strongest category
4. **NEUTRAL expires**: Archive after 30 days unless promoted to GOOD/BAD

## What Goes Where

### MEMORY.md (Categorized Learnings)
Keep under 150 lines. Only GOOD and BAD entries:

```markdown
## GOOD - What Works
- `[GOOD]` Cron jobs with CSV batching = zero duplicates
- `[GOOD]` Browser tool > CLI for X.com automation
- `[GOOD]` Moltbook "crypto" submolt for token posts

## BAD - What to Avoid  
- `[BAD]` Never use bird CLI for X (anti-bot blocks it)
- `[BAD]` Don't post identical content across platforms
```

### memory/YYYY-MM-DD.md (Daily Log)
All three categories with full context:

```markdown
# 2026-02-15

## [GOOD]
- Fixed duplicate posting with 4-batch CSV structure
- Created 10 cron jobs for complete automation

## [BAD]  
- Old CSV format caused content duplication (now deprecated)

## [NEUTRAL]
- Day 5 of 30-day media plan
- Posted $ZEN token shill at 07:00 batch
```

## Quick Commands

### Search Memory
```bash
# Search all memory files
~/.openclaw/skills/minimal-memory/scripts/search.sh "duplicate posting"

# Search only GOOD learnings
~/.openclaw/skills/minimal-memory/scripts/search.sh --good "CSV"

# Search only BAD learnings  
~/.openclaw/skills/minimal-memory/scripts/search.sh --bad "CLI"

# Recent entries only (last 7 days)
~/.openclaw/skills/minimal-memory/scripts/search.sh --recent "cron job"
```

### Daily Memory
```bash
# Create today's memory file with template
~/.openclaw/skills/minimal-memory/scripts/daily.sh

# Add entry with auto-tagging
~/.openclaw/skills/minimal-memory/scripts/add.sh GOOD "Browser tool works better than CLI"
```

### Cleanup
```bash
# Review and migrate GOOD/BAD to MEMORY.md
~/.openclaw/skills/minimal-memory/scripts/cleanup.sh

# Archive old NEUTRAL entries (>30 days)
~/.openclaw/skills/minimal-memory/scripts/archive.sh
```

## Workflow

### When Writing a Memory
1. **Tag it**: Is this GOOD, BAD, or NEUTRAL?
2. **Write to daily file** with tag prefix
3. **Weekly review**: Promote GOOD/BAD to MEMORY.md
4. **Archive NEUTRAL** after 30 days

### When Searching
1. **Use search script** for fast grep across all files
2. **Check MEMORY.md first** for established patterns
3. **Fall back to daily files** for specific context
4. **Prefer recent entries** unless looking for historical

### Weekly Cleanup
1. Read last 7 days of daily files
2. Extract `[GOOD]` and `[BAD]` entries
3. Add to MEMORY.md "GOOD" and "BAD" sections
4. Remove duplicates, condense similar items
5. Ensure MEMORY.md < 150 lines

## Anti-Patterns

❌ **Don't** skip tagging - every entry needs a category
❌ **Don't** put NEUTRAL in MEMORY.md
❌ **Don't** let MEMORY.md grow past 200 lines
❌ **Don't** keep NEUTRAL entries forever (30 day max)
❌ **Don't** create topical files - use daily + search

✅ **Do** search before asking user "did we try this?"
✅ **Do** migrate GOOD/BAD weekly
✅ **Do** be specific in failure/success descriptions
✅ **Do** trust the search script to find context

## Migration from Old System

If MEMORY.md has untagged content:

1. Read entire MEMORY.md
2. Categorize each entry: GOOD/BAD/NEUTRAL
3. Move NEUTRAL to appropriate daily file
4. Keep GOOD/BAD in MEMORY.md with tags
5. Future entries: always tag in daily files first

---

## 中文说明

# 极简内存管理

通过结构化分类和两级存储,让代理内存保持精简、可搜索、可执行。

## 核心原则

**MEMORY.md = 长期必要内容(仅 GOOD/BAD 经验)**
**memory/YYYY-MM-DD.md = 日常操作(带 GOOD/BAD/NEUTRAL 标签)**

## 信息分类

为每条内存条目标注其价值:

| 标签 | 含义 | 是否保留在 MEMORY.md? | 示例 |
|-----|---------|-------------------|---------|
| `[GOOD]` | 效果好,应重复 | ✅ 是 | `[GOOD] CSV batch format prevents duplicates` |
| `[BAD]` | 失败,应避免 | ✅ 是 | `[BAD] Bird CLI blocked by X anti-automation` |
| `[NEUTRAL]` | 事实、上下文、状态 | ❌ 否 | `[NEUTRAL] Day 5 of 30-day media plan` |

### 写入规则
1. **始终为**日志文件中的新条目**打标签**
2. **要具体**:什么有效/失败以及原因
3. **每条一个标签** —— 选择最强的类别
4. **NEUTRAL 会过期**:除非提升为 GOOD/BAD,否则 30 天后归档

## 什么内容放在哪里

### MEMORY.md(分类经验)
保持在 150 行以内。仅 GOOD 和 BAD 条目:

```markdown
## GOOD - What Works
- `[GOOD]` Cron jobs with CSV batching = zero duplicates
- `[GOOD]` Browser tool > CLI for X.com automation
- `[GOOD]` Moltbook "crypto" submolt for token posts

## BAD - What to Avoid  
- `[BAD]` Never use bird CLI for X (anti-bot blocks it)
- `[BAD]` Don't post identical content across platforms
```

### memory/YYYY-MM-DD.md(每日日志)
包含全部三个类别及完整上下文:

```markdown
# 2026-02-15

## [GOOD]
- Fixed duplicate posting with 4-batch CSV structure
- Created 10 cron jobs for complete automation

## [BAD]  
- Old CSV format caused content duplication (now deprecated)

## [NEUTRAL]
- Day 5 of 30-day media plan
- Posted $ZEN token shill at 07:00 batch
```

## 快速命令

### 搜索内存
```bash
# Search all memory files
~/.openclaw/skills/minimal-memory/scripts/search.sh "duplicate posting"

# Search only GOOD learnings
~/.openclaw/skills/minimal-memory/scripts/search.sh --good "CSV"

# Search only BAD learnings  
~/.openclaw/skills/minimal-memory/scripts/search.sh --bad "CLI"

# Recent entries only (last 7 days)
~/.openclaw/skills/minimal-memory/scripts/search.sh --recent "cron job"
```

### 每日内存
```bash
# Create today's memory file with template
~/.openclaw/skills/minimal-memory/scripts/daily.sh

# Add entry with auto-tagging
~/.openclaw/skills/minimal-memory/scripts/add.sh GOOD "Browser tool works better than CLI"
```

### 清理
```bash
# Review and migrate GOOD/BAD to MEMORY.md
~/.openclaw/skills/minimal-memory/scripts/cleanup.sh

# Archive old NEUTRAL entries (>30 days)
~/.openclaw/skills/minimal-memory/scripts/archive.sh
```

## 工作流程

### 写入内存时
1. **打标签**:这是 GOOD、BAD 还是 NEUTRAL?
2. **写入每日文件**,带标签前缀
3. **每周回顾**:将 GOOD/BAD 提升到 MEMORY.md
4. 30 天后**归档 NEUTRAL**

### 搜索时
1. **使用搜索脚本**对所有文件快速 grep
2. **先查 MEMORY.md** 中已确立的模式
3. **回退到每日文件**查找具体上下文
4. **优先查看近期条目**,除非要查历史

### 每周清理
1. 阅读最近 7 天的每日文件
2. 提取 `[GOOD]` 和 `[BAD]` 条目
3. 添加到 MEMORY.md 的 "GOOD" 和 "BAD" 部分
4. 删除重复项,合并相似项
5. 确保 MEMORY.md < 150 行

## 反模式

❌ **不要**跳过打标签 —— 每条条目都需要一个类别
❌ **不要**把 NEUTRAL 放进 MEMORY.md
❌ **不要**让 MEMORY.md 超过 200 行
❌ **不要**永久保留 NEUTRAL 条目(最多 30 天)
❌ **不要**创建主题文件 —— 使用每日文件 + 搜索

✅ **要**在询问用户"我们试过这个吗?"之前先搜索
✅ **要**每周迁移 GOOD/BAD
✅ **要**在失败/成功描述中保持具体
✅ **要**信任搜索脚本来找到上下文

## 从旧系统迁移

如果 MEMORY.md 中有未打标签的内容:

1. 阅读整个 MEMORY.md
2. 对每条条目分类:GOOD/BAD/NEUTRAL
3. 将 NEUTRAL 移到相应的每日文件
4. 在 MEMORY.md 中保留带标签的 GOOD/BAD
5. 未来的条目:始终先在每日文件中打标签