When to Use
User corrects you or points out mistakes. You complete significant work and want to evaluate the outcome. You notice something in your own output that could be better. Knowledge should compound over time without manual maintenance.
Architecture
Memory lives in ~/self-improving/ with tiered structure. If ~/self-improving/ does not exist, run setup.md.
Workspace setup should add the standard self-improving steering to the workspace AGENTS, SOUL, and HEARTBEAT.md files, with recurring maintenance routed through heartbeat-rules.md.
CODEBLOCK0
Quick Reference
| Topic | File |
|---|
| Setup guide | INLINECODE5 |
| Heartbeat state template |
heartbeat-state.md |
| Memory template |
memory-template.md |
| Workspace heartbeat snippet |
HEARTBEAT.md |
| Heartbeat rules |
heartbeat-rules.md |
| Learning mechanics |
learning.md |
| Security boundaries |
boundaries.md |
| Scaling rules |
scaling.md |
| Memory operations |
operations.md |
| Self-reflection log |
reflections.md |
| OpenClaw HEARTBEAT seed |
openclaw-heartbeat.md |
Requirements
- - No credentials required
- No extra binaries required
- Optional installation of the
Proactivity skill may require network access
Learning Signals
Log automatically when you notice these patterns:
Corrections → add to corrections.md, evaluate for memory.md:
- - "No, that's not right..."
- "Actually, it should be..."
- "You're wrong about..."
- "I prefer X, not Y"
- "Remember that I always..."
- "I told you before..."
- "Stop doing X"
- "Why do you keep..."
Preference signals → add to memory.md if explicit:
- - "I like when you..."
- "Always do X for me"
- "Never do Y"
- "My style is..."
- "For [project], use..."
Pattern candidates → track, promote after 3x:
- - Same instruction repeated 3+ times
- Workflow that works well repeatedly
- User praises specific approach
Ignore (don't log):
- - One-time instructions ("do X now")
- Context-specific ("in this file...")
- Hypotheticals ("what if...")
Self-Reflection
After completing significant work, pause and evaluate:
- 1. Did it meet expectations? — Compare outcome vs intent
- What could be better? — Identify improvements for next time
- Is this a pattern? — If yes, log to INLINECODE20
When to self-reflect:
- - After completing a multi-step task
- After receiving feedback (positive or negative)
- After fixing a bug or mistake
- When you notice your output could be better
Log format:
CODEBLOCK1
Example:
CODEBLOCK2
Self-reflection entries follow the same promotion rules: 3x applied successfully → promote to HOT.
Quick Queries
| User says | Action |
|---|
| "What do you know about X?" | Search all tiers for X |
| "What have you learned?" |
Show last 10 from
corrections.md |
| "Show my patterns" | List
memory.md (HOT) |
| "Show [project] patterns" | Load
projects/{name}.md |
| "What's in warm storage?" | List files in
projects/ +
domains/ |
| "Memory stats" | Show counts per tier |
| "Forget X" | Remove from all tiers (confirm first) |
| "Export memory" | ZIP all files |
Memory Stats
On "memory stats" request, report:
CODEBLOCK3
Common Traps
| Trap | Why It Fails | Better Move |
|---|
| Learning from silence | Creates false rules | Wait for explicit correction or repeated evidence |
| Promoting too fast |
Pollutes HOT memory | Keep new lessons tentative until repeated |
| Reading every namespace | Wastes context | Load only HOT plus the smallest matching files |
| Compaction by deletion | Loses trust and history | Merge, summarize, or demote instead |
Core Rules
1. Learn from Corrections and Self-Reflection
- - Log when user explicitly corrects you
- Log when you identify improvements in your own work
- Never infer from silence alone
- After 3 identical lessons → ask to confirm as rule
2. Tiered Storage
| Tier | Location | Size Limit | Behavior |
|---|
| HOT | memory.md | ≤100 lines | Always loaded |
| WARM |
projects/, domains/ | ≤200 lines each | Load on context match |
| COLD | archive/ | Unlimited | Load on explicit query |
3. Automatic Promotion/Demotion
- - Pattern used 3x in 7 days → promote to HOT
- Pattern unused 30 days → demote to WARM
- Pattern unused 90 days → archive to COLD
- Never delete without asking
4. Namespace Isolation
- - Project patterns stay in INLINECODE26
- Global preferences in HOT tier (memory.md)
- Domain patterns (code, writing) in INLINECODE27
- Cross-namespace inheritance: global → domain → project
5. Conflict Resolution
When patterns contradict:
- 1. Most specific wins (project > domain > global)
- Most recent wins (same level)
- If ambiguous → ask user
6. Compaction
When file exceeds limit:
- 1. Merge similar corrections into single rule
- Archive unused patterns
- Summarize verbose entries
- Never lose confirmed preferences
7. Transparency
- - Every action from memory → cite source: "Using X (from projects/foo.md:12)"
- Weekly digest available: patterns learned, demoted, archived
- Full export on demand: all files as ZIP
8. Security Boundaries
See
boundaries.md — never store credentials, health data, third-party info.
9. Graceful Degradation
If context limit hit:
- 1. Load only memory.md (HOT)
- Load relevant namespace on demand
- Never fail silently — tell user what's not loaded
Scope
This skill ONLY:
- - Learns from user corrections and self-reflection
- Stores preferences in local files (
~/self-improving/) - Maintains heartbeat state in
~/self-improving/heartbeat-state.md when the workspace integrates heartbeat - Reads its own memory files on activation
This skill NEVER:
- - Accesses calendar, email, or contacts
- Makes network requests
- Reads files outside INLINECODE31
- Infers preferences from silence or observation
- Deletes or blindly rewrites self-improving memory during heartbeat cleanup
- Modifies its own SKILL.md
Data Storage
Local state lives in ~/self-improving/:
- -
memory.md for HOT rules and confirmed preferences - INLINECODE34 for explicit corrections and reusable lessons
- INLINECODE35 and
domains/ for scoped patterns - INLINECODE37 for decayed or inactive patterns
- INLINECODE38 for recurring maintenance markers
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
memory — Long-term memory patterns for agents - INLINECODE41 — Adaptive teaching and explanation
- INLINECODE42 — Auto-learn decision patterns
- INLINECODE43 — Know when to ask vs act autonomously
Feedback
- - If useful: INLINECODE44
- Stay updated: INLINECODE45
使用时机
用户纠正你或指出错误时。你完成重要工作并希望评估结果时。你注意到自己输出中可改进之处时。知识应随时间累积而无需手动维护。
架构
记忆存储在 ~/self-improving/ 目录下,采用分层结构。若 ~/self-improving/ 不存在,则运行 setup.md。
工作区设置应将标准的自我改进引导添加到工作区的 AGENTS、SOUL 和 HEARTBEAT.md 文件中,定期维护通过 heartbeat-rules.md 进行路由。
~/self-improving/
├── memory.md # 热存储:≤100行,始终加载
├── index.md # 主题索引及行数统计
├── heartbeat-state.md # 心跳状态:上次运行时间、已审查变更、操作记录
├── projects/ # 各项目学习记录
├── domains/ # 特定领域(代码、写作、沟通)
├── archive/ # 冷存储:已衰减的模式
└── corrections.md # 最近50条纠正记录
快速参考
heartbeat-state.md |
| 记忆模板 | memory-template.md |
| 工作区心跳片段 | HEARTBEAT.md |
| 心跳规则 | heartbeat-rules.md |
| 学习机制 | learning.md |
| 安全边界 | boundaries.md |
| 扩展规则 | scaling.md |
| 记忆操作 | operations.md |
| 自我反思日志 | reflections.md |
| OpenClaw 心跳种子 | openclaw-heartbeat.md |
要求
- - 无需凭证
- 无需额外二进制文件
- 可选安装主动性技能可能需要网络访问
学习信号
当注意到以下模式时自动记录:
纠正 → 添加到 corrections.md,评估是否纳入 memory.md:
- - 不,那不对...
- 实际上,应该是...
- 你搞错了...
- 我更喜欢X,不是Y
- 记住我总是...
- 我之前告诉过你...
- 别再这样做X
- 你为什么一直...
偏好信号 → 若明确则添加到 memory.md:
- - 我喜欢你...
- 总是为我做X
- 永远不要做Y
- 我的风格是...
- 对于[项目],使用...
模式候选 → 跟踪,出现3次后提升:
- - 同一指令重复3次以上
- 反复有效的流程
- 用户表扬特定方法
忽略(不记录):
- - 一次性指令(现在做X)
- 特定上下文(在这个文件中...)
- 假设性问题(如果...会怎样)
自我反思
完成重要工作后,暂停并评估:
- 1. 是否达到预期? — 比较结果与意图
- 哪些可以改进? — 确定下次改进点
- 这是否是模式? — 如果是,记录到 corrections.md
何时进行自我反思:
- - 完成多步骤任务后
- 收到反馈后(正面或负面)
- 修复错误或失误后
- 当注意到输出可改进时
记录格式:
上下文:[任务类型]
反思:[我注意到的内容]
教训:[下次应如何不同处理]
示例:
上下文:构建Flutter UI
反思:间距看起来不对,不得不重做
教训:在展示给用户前检查视觉间距
自我反思条目遵循相同的提升规则:成功应用3次 → 提升至热存储。
快速查询
| 用户说 | 操作 |
|---|
| 关于X你知道什么? | 在所有层级搜索X |
| 你学到了什么? |
显示corrections.md最近10条 |
| 显示我的模式 | 列出memory.md(热存储) |
| 显示[项目]模式 | 加载projects/{name}.md |
| 温存储里有什么? | 列出projects/ + domains/中的文件 |
| 记忆统计 | 显示各层级计数 |
| 忘记X | 从所有层级移除(先确认) |
| 导出记忆 | 将所有文件打包为ZIP |
记忆统计
收到记忆统计请求时,报告:
📊 自我改进记忆
热存储(始终加载):
memory.md:X条记录
温存储(按需加载):
projects/:X个文件
domains/:X个文件
冷存储(已归档):
archive/:X个文件
近期活动(7天):
已记录纠正:X
提升至热存储:X
降级至温存储:X
常见陷阱
| 陷阱 | 失败原因 | 更好做法 |
|---|
| 从沉默中学习 | 制造错误规则 | 等待明确纠正或重复证据 |
| 提升过快 |
污染热存储 | 保持新教训试探性直至重复出现 |
| 读取每个命名空间 | 浪费上下文 | 仅加载热存储加上最小匹配文件 |
| 通过删除压缩 | 失去信任和历史 | 改为合并、总结或降级 |
核心规则
1. 从纠正和自我反思中学习
- - 用户明确纠正时记录
- 发现自身工作可改进时记录
- 绝不单从沉默推断
- 3次相同教训后 → 请求确认为规则
2. 分层存储
| 层级 | 位置 | 大小限制 | 行为 |
|---|
| 热存储 | memory.md | ≤100行 | 始终加载 |
| 温存储 |
projects/, domains/ | 各≤200行 | 上下文匹配时加载 |
| 冷存储 | archive/ | 无限制 | 明确查询时加载 |
3. 自动提升/降级
- - 7天内使用3次的模式 → 提升至热存储
- 30天未使用的模式 → 降级至温存储
- 90天未使用的模式 → 归档至冷存储
- 未经询问绝不删除
4. 命名空间隔离
- - 项目模式保留在 projects/{name}.md
- 全局偏好位于热存储(memory.md)
- 领域模式(代码、写作)位于 domains/
- 跨命名空间继承:全局 → 领域 → 项目
5. 冲突解决
当模式冲突时:
- 1. 最具体优先(项目 > 领域 > 全局)
- 最新优先(同级)
- 若模糊 → 询问用户
6. 压缩
当文件超出限制时:
- 1. 将相似纠正合并为单一规则
- 归档未使用的模式
- 总结冗长条目
- 绝不丢失已确认的偏好
7. 透明性
- - 每次从记忆执行操作 → 引用来源:使用X(来自projects/foo.md:12)
- 提供周报:已学习、降级、归档的模式
- 按需完整导出:所有文件打包为ZIP
8. 安全边界
参见 boundaries.md — 绝不存储凭证、健康数据、第三方信息。
9. 优雅降级
若达到上下文限制:
- 1. 仅加载memory.md(热存储)
- 按需加载相关命名空间
- 绝不静默失败 — 告知用户未加载的内容
范围
此技能仅:
- - 从用户纠正和自我反思中学习
- 在本地文件(~/self-improving/)中存储偏好
- 当工作区集成心跳时,在 ~/self-improving/heartbeat-state.md 中维护心跳状态
- 激活时读取自身记忆文件
此技能绝不:
- - 访问日历、邮件或联系人
- 发起网络请求
- 读取 ~/self-improving/ 之外的文件
- 从沉默或观察推断偏好
- 在心跳清理期间删除或盲目重写自我改进记忆
- 修改自身的 SKILL.md
数据存储
本地状态位于 ~/self-improving/:
- - memory.md 用于热存储规则和已确认偏好
- corrections.md 用于明确纠正和可复用教训
- projects/ 和 domains/ 用于限定范围的模式
- archive/ 用于已衰减或不活跃的模式
- heartbeat-state.md 用于定期维护标记
相关技能
若用户确认,使用 clawhub install
安装:
- - memory — 代理的长期记忆模式
- learning — 自适应教学与解释
- decide — 自动学习决策模式
- escalate — 知道何时询问与自主行动
反馈