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 |
|---|
| INLINECODE0 | Worked well, repeat | ✅ Yes | INLINECODE1 |
| INLINECODE2 |
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
- Be specific: What worked/failed and why
- One tag per entry - pick the strongest category
- 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:
CODEBLOCK0
memory/YYYY-MM-DD.md (Daily Log)
All three categories with full context:
CODEBLOCK1
Quick Commands
Search Memory
CODEBLOCK2
Daily Memory
CODEBLOCK3
Cleanup
CODEBLOCK4
Workflow
When Writing a Memory
- 1. Tag it: Is this GOOD, BAD, or NEUTRAL?
- Write to daily file with tag prefix
- Weekly review: Promote GOOD/BAD to MEMORY.md
- Archive NEUTRAL after 30 days
When Searching
- 1. Use search script for fast grep across all files
- Check MEMORY.md first for established patterns
- Fall back to daily files for specific context
- Prefer recent entries unless looking for historical
Weekly Cleanup
- 1. Read last 7 days of daily files
- Extract
[GOOD] and [BAD] entries - Add to MEMORY.md "GOOD" and "BAD" sections
- Remove duplicates, condense similar items
- 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
- Categorize each entry: GOOD/BAD/NEUTRAL
- Move NEUTRAL to appropriate daily file
- Keep GOOD/BAD in MEMORY.md with tags
- 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 批量格式可防止重复 |
| [BAD] |
失败,需避免 | ✅ 是 | [BAD] Bird CLI 被 X 反自动化机制屏蔽 |
| [NEUTRAL] | 事实、背景、状态 | ❌ 否 | [NEUTRAL] 30天媒体计划第5天 |
编写规则
- 1. 始终标记 每日文件中的新条目
- 具体明确:说明什么有效/失败及其原因
- 每条一个标签 - 选择最强的类别
- NEUTRAL 过期:30天后归档,除非升级为 GOOD/BAD
内容存放位置
MEMORY.md(分类经验教训)
保持在150行以内。仅包含 GOOD 和 BAD 条目:
markdown
GOOD - 有效做法
- - [GOOD] 带 CSV 批处理的 Cron 任务 = 零重复
- [GOOD] 浏览器工具优于 CLI 用于 X.com 自动化
- [GOOD] Moltbook crypto 子话题用于代币帖子
BAD - 需避免的做法
- - [BAD] 切勿使用 bird CLI 操作 X(反机器人机制会屏蔽)
- [BAD] 不要在多个平台发布相同内容
memory/YYYY-MM-DD.md(日常日志)
包含全部三个类别及完整上下文:
markdown
2026-02-15
[GOOD]
- - 使用4批CSV结构修复了重复发布问题
- 创建了10个cron任务实现完全自动化
[BAD]
[NEUTRAL]
- - 30天媒体计划第5天
- 在07:00批次发布了$ZEN代币推广帖
快速命令
搜索记忆
bash
搜索所有记忆文件
~/.openclaw/skills/minimal-memory/scripts/search.sh 重复发布
仅搜索 GOOD 经验
~/.openclaw/skills/minimal-memory/scripts/search.sh --good CSV
仅搜索 BAD 经验
~/.openclaw/skills/minimal-memory/scripts/search.sh --bad CLI
仅最近条目(最近7天)
~/.openclaw/skills/minimal-memory/scripts/search.sh --recent cron 任务
日常记忆
bash
使用模板创建今日记忆文件
~/.openclaw/skills/minimal-memory/scripts/daily.sh
添加条目并自动标记
~/.openclaw/skills/minimal-memory/scripts/add.sh GOOD 浏览器工具比CLI效果更好
清理
bash
审查并将 GOOD/BAD 迁移到 MEMORY.md
~/.openclaw/skills/minimal-memory/scripts/cleanup.sh
归档旧的 NEUTRAL 条目(超过30天)
~/.openclaw/skills/minimal-memory/scripts/archive.sh
工作流程
写入记忆时
- 1. 标记它:这是 GOOD、BAD 还是 NEUTRAL?
- 写入每日文件,带标签前缀
- 每周审查:将 GOOD/BAD 提升到 MEMORY.md
- 30天后归档 NEUTRAL
搜索时
- 1. 使用搜索脚本快速跨文件 grep
- 先检查 MEMORY.md 查找已建立的模式
- 回退到每日文件获取具体上下文
- 优先使用最近条目,除非查找历史记录
每周清理
- 1. 阅读最近7天的每日文件
- 提取 [GOOD] 和 [BAD] 条目
- 添加到 MEMORY.md 的 GOOD 和 BAD 部分
- 删除重复项,合并相似项
- 确保 MEMORY.md 不超过150行
反模式
❌ 不要跳过标记 - 每个条目都需要分类
❌ 不要将 NEUTRAL 放入 MEMORY.md
❌ 不要让 MEMORY.md 超过200行
❌ 不要永久保留 NEUTRAL 条目(最多30天)
❌ 不要创建主题文件 - 使用每日文件 + 搜索
✅ 要先搜索再问用户我们试过这个吗?
✅ 要每周迁移 GOOD/BAD
✅ 要在失败/成功描述中具体明确
✅ 要相信搜索脚本能找到上下文
从旧系统迁移
如果 MEMORY.md 中有未标记的内容:
- 1. 阅读整个 MEMORY.md
- 分类每条条目:GOOD/BAD/NEUTRAL
- 将 NEUTRAL 移至相应的每日文件
- 在 MEMORY.md 中保留 GOOD/BAD 并添加标签
- 未来条目:始终先在每日文件中标记