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.
CODEBLOCK0
Quick Reference
| Topic | File |
|---|
| Setup guide | INLINECODE3 |
| Memory template |
memory-template.md |
| Learning mechanics |
learning.md |
| Security boundaries |
boundaries.md |
| Scaling rules |
scaling.md |
| Memory operations |
operations.md |
| Self-reflection log |
reflections.md |
Detection Triggers
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 INLINECODE13
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
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 INLINECODE19
- Global preferences in HOT tier (memory.md)
- Domain patterns (code, writing) in INLINECODE20
- 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/) - Reads its own memory files on activation
This skill NEVER:
- - Accesses calendar, email, or contacts
- Makes network requests
- Reads files outside INLINECODE23
- Infers preferences from silence or observation
- Modifies its own SKILL.md
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
memory — Long-term memory patterns for agents - INLINECODE26 — Adaptive teaching and explanation
- INLINECODE27 — Auto-learn decision patterns
- INLINECODE28 — Know when to ask vs act autonomously
Feedback
- - If useful: INLINECODE29
- Stay updated: INLINECODE30
何时使用
用户纠正你或指出错误。你完成重要工作后想要评估结果。你注意到自己输出中有可以改进之处。知识应随时间累积而无需手动维护。
架构
记忆存储在 ~/self-improving/ 目录下,采用分层结构。若 ~/self-improving/ 不存在,则运行 setup.md。
~/self-improving/
├── memory.md # 热存储:≤100行,始终加载
├── index.md # 主题索引(含行数统计)
├── projects/ # 各项目经验总结
├── domains/ # 领域特定(代码、写作、沟通)
├── archive/ # 冷存储:已衰减的模式
└── corrections.md # 最近50条纠正记录
快速参考
memory-template.md |
| 学习机制 | learning.md |
| 安全边界 | boundaries.md |
| 扩展规则 | scaling.md |
| 记忆操作 | operations.md |
| 自我反思日志 | reflections.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/ 之外的文件
- 从沉默或观察中推断偏好
- 修改自身的 SKILL.md
相关技能
若用户确认,使用 clawhub install
安装:
- - memory — 代理的长时记忆模式
- learning — 自适应教学与解释
- decide — 自动学习决策模式
- escalate — 判断何时询问 vs 自主行动
反馈
- - 若有帮助:clawhub star self-improving
- 保持更新:clawhub sync