Claw Self-Improvement Skill
Lightweight, reversible self-improvement for agent sessions.
Use it to:
- - capture raw learnings in INLINECODE0
- preserve detail in incident-style logs
- distill only proven patterns into INLINECODE1
- keep broader workspace prompt files untouched by default
After installation, follow the Setup section to initialize .learnings/, enable the hook, and restart the gateway.
Once active, the model is guided to use the learning workflow in future runs.
The learning process remains model-mediated, so results depend on model capability, instruction-following quality, and task relevance.
Quick Reference
| Situation | Action |
|---|
| Command/operation fails | Log to INLINECODE3 |
| API/external tool fails |
Log to
.learnings/ERRORS.md with integration details |
| User corrects you | Log to
.learnings/LEARNINGS.md |
| Knowledge was outdated | Log to
.learnings/LEARNINGS.md |
| Found a better approach | Log to
.learnings/LEARNINGS.md |
| User wants missing capability | Log to
.learnings/FEATURE_REQUESTS.md |
| Similar to an existing entry | Link with
See Also; update recurrence notes if useful |
| Proven recurring pattern | Distill into
.learnings/PROMOTED.md |
| Behavioral / workflow / tool rule | Store in
.learnings/PROMOTED.md under the right category |
Expected Files
This skill expects these files under ~/.openclaw/workspace/.learnings/:
- -
LEARNINGS.md — raw learnings, corrections, knowledge gaps, best practices - INLINECODE14 — failures, exceptions, unexpected tool behavior
- INLINECODE15 — missing capabilities requested by the user
- INLINECODE16 — distilled, durable rules promoted out of raw learnings
Setup
1. Install the Skill
CODEBLOCK0
2. Initialize .learnings/
Create missing starter files without overwriting existing .learnings/ history:
CODEBLOCK1
3. Enable the Hook
To inject the reminder during agent:bootstrap, install or refresh the hook files:
CODEBLOCK2
4. Verify
CODEBLOCK3
5. (Optional) Enable Visible Learning Notices
Use the OpenClaw config gate below if you want the hook to inject a stronger instruction for visible learning notices:
CODEBLOCK4
If you also want phrasing guidance, add the following preference block to TOOLS.md:
CODEBLOCK5
6. Restart Gateway
CODEBLOCK6
Default Workflow
- 1. Capture the raw event in the appropriate
.learnings/ file. - Keep the source entry detailed enough to understand later.
- If the idea becomes durable, recurring, or broadly useful, distill it into a short entry in
.learnings/PROMOTED.md. - Mark the source entry as promoted:
-
**Status**: promoted
-
**Promoted**: .learnings/PROMOTED.md
- optional:
**Promotion-ID**: PRM-YYYYMMDD-XXX
- optional: INLINECODE26
When to Promote
Promote to .learnings/PROMOTED.md only when the pattern is mature enough to reuse:
- - it has recurred, or clearly will recur
- the solution is resolved, tested, or otherwise trusted
- it can be expressed as a short actionable rule
- it is not just a one-off incident log
- it is safe to keep as durable context
| Learning Type | Promotion Category |
|---|
| Behavioral patterns | INLINECODE28 |
| Workflow improvements |
Workflow Improvements |
| Tool gotchas |
Tool Gotchas |
| Durable facts/rules |
Durable Rules |
When to Keep Raw
Keep the entry in the raw .learnings/ files when it is:
- - still unresolved or uncertain
- highly task-specific
- mostly useful as historical context
- too noisy to distill into a stable rule yet
Format Reference
For exact field definitions, templates, and examples, read:
The files in assets/ are minimal starter templates to copy into .learnings/.
Removal
1. Disable the Hook
CODEBLOCK7
2. Remove the Hook Files
CODEBLOCK8
3. Remove the Skill Files
CODEBLOCK9
4. Remove the ClawHub Lockfile Entry
If the skill was installed via ClawHub, also remove its local install record from ~/.openclaw/workspace/.clawhub/lock.json.
CODEBLOCK10
5. Optional: Remove .learnings/ Files
The .learnings/ directory is your captured history, not the hook itself. You can keep it for reference, or remove the files if you no longer want the data.
Remove only the files created for this workflow:
CODEBLOCK11
If the directory is empty afterward, you can remove it too:
CODEBLOCK12
6. Disable Visible Learning Notices if Enabled
Remove the claw-self-improvement block from TOOLS.md if you added it during installation.
7. Restart Gateway
CODEBLOCK13
After restart, future runs will no longer receive the bootstrap reminder from this skill. Existing Markdown history remains unless you explicitly delete it.
Provenance
Adapted from peterskoett/self-improving-agent.
爪形自我改进技能
轻量级、可逆的代理会话自我改进功能。
使用它来:
- - 在.learnings/中捕获原始学习内容
- 以事件日志形式保留详细信息
- 仅将已验证的模式提炼到.learnings/PROMOTED.md中
- 默认保持更广泛的工作区提示文件不变
安装后,请按照设置部分初始化.learnings/,启用钩子,然后重新启动网关。
一旦激活,模型将在后续运行中遵循学习工作流程。
学习过程仍由模型主导,因此结果取决于模型能力、指令遵循质量和任务相关性。
快速参考
| 情况 | 操作 |
|---|
| 命令/操作失败 | 记录到.learnings/ERRORS.md |
| API/外部工具失败 |
记录到.learnings/ERRORS.md并附带集成详情 |
| 用户纠正你 | 记录到.learnings/LEARNINGS.md |
| 知识已过时 | 记录到.learnings/LEARNINGS.md |
| 发现更好的方法 | 记录到.learnings/LEARNINGS.md |
| 用户需要缺失功能 | 记录到.learnings/FEATURE_REQUESTS.md |
| 与现有条目相似 | 使用另见链接;如有用则更新重复记录 |
| 已验证的重复模式 | 提炼到.learnings/PROMOTED.md |
| 行为/工作流程/工具规则 | 存储在.learnings/PROMOTED.md的相应类别下 |
预期文件
此技能期望在~/.openclaw/workspace/.learnings/下存在以下文件:
- - LEARNINGS.md — 原始学习内容、纠正、知识空白、最佳实践
- ERRORS.md — 失败、异常、意外工具行为
- FEATURE_REQUESTS.md — 用户请求的缺失功能
- PROMOTED.md — 从原始学习内容中提炼出的持久规则
设置
1. 安装技能
bash
clawhub install claw-self-improvement
2. 初始化.learnings/
创建缺失的起始文件,不覆盖现有的.learnings/历史记录:
bash
SKILL_DIR=~/.openclaw/workspace/skills/claw-self-improvement
mkdir -p ~/.openclaw/workspace/.learnings
[ -e ~/.openclaw/workspace/.learnings/LEARNINGS.md ] || cp $SKILL_DIR/assets/LEARNINGS.md ~/.openclaw/workspace/.learnings/LEARNINGS.md
[ -e ~/.openclaw/workspace/.learnings/ERRORS.md ] || cp $SKILL_DIR/assets/ERRORS.md ~/.openclaw/workspace/.learnings/ERRORS.md
[ -e ~/.openclaw/workspace/.learnings/FEATUREREQUESTS.md ] || cp $SKILLDIR/assets/FEATUREREQUESTS.md ~/.openclaw/workspace/.learnings/FEATUREREQUESTS.md
[ -e ~/.openclaw/workspace/.learnings/PROMOTED.md ] || cp $SKILL_DIR/assets/PROMOTED.md ~/.openclaw/workspace/.learnings/PROMOTED.md
3. 启用钩子
要在agent:bootstrap期间注入提醒,安装或刷新钩子文件:
bash
SKILL_DIR=~/.openclaw/workspace/skills/claw-self-improvement
mkdir -p ~/.openclaw/hooks/claw-self-improvement
cp -R $SKILL_DIR/hooks/. ~/.openclaw/hooks/claw-self-improvement/
openclaw hooks enable claw-self-improvement
4. 验证
bash
ls ~/.openclaw/workspace/.learnings
openclaw hooks list
5.(可选)启用可见学习通知
如果你希望钩子注入更强的指令以实现可见学习通知,请使用以下OpenClaw配置门:
json
{
skills: {
entries: {
claw-self-improvement: {
config: {
message: true
}
}
}
}
}
如果你还想要措辞指导,请将以下偏好块添加到TOOLS.md中:
markdown
claw-self-improvement
- - UX偏好:当你在面向用户的回复中添加新条目到.learnings/时,附加一行简短确认。
- 对于原始日志,说:已记录 — 已记录到.learnings/LEARNINGS.md。、已记录 — 已记录到.learnings/ERRORS.md。或已记录 — 已记录到.learnings/FEATUREREQUESTS.md。
- 对于升级条目,说:已升级 — 新规则已添加到.learnings/PROMOTED.md。
- 保持通知简短,每个回复只包含一次。
- 当没有用户可见的回复,或回复NOREPLY时,跳过通知。
6. 重新启动网关
bash
openclaw gateway restart
默认工作流程
- 1. 在相应的.learnings/文件中捕获原始事件。
- 保持源条目足够详细,以便日后理解。
- 如果想法变得持久、重复或广泛有用,将其提炼为.learnings/PROMOTED.md中的简短条目。
- 标记源条目为已升级:
-
状态:已升级
-
升级至:.learnings/PROMOTED.md
- 可选:
升级ID:PRM-YYYYMMDD-XXX
- 可选:
升级类别:行为模式 | 工作流程改进 | 工具陷阱 | 持久规则
何时升级
仅当模式足够成熟可重复使用时,才升级到.learnings/PROMOTED.md:
- - 它已经重复出现,或明显会重复出现
- 解决方案已解决、测试或以其他方式可信
- 可以表达为简短的可操作规则
- 不仅仅是一次性事件日志
- 作为持久上下文保存是安全的
工作流程改进 |
| 工具陷阱 | 工具陷阱 |
| 持久事实/规则 | 持久规则 |
何时保留原始内容
在以下情况下,将条目保留在原始.learnings/文件中:
- - 仍未解决或不确定
- 高度特定于任务
- 主要作为历史上下文有用
- 过于杂乱,尚无法提炼为稳定规则
格式参考
有关确切的字段定义、模板和示例,请阅读:
assets/中的文件是最小起始模板,可复制到.learnings/中。
移除
1. 禁用钩子
bash
openclaw hooks disable claw-self-improvement
2. 移除钩子文件
bash
rm -rf ~/.openclaw/hooks/claw-self-improvement
3. 移除技能文件
bash
rm -rf ~/.openclaw/workspace/skills/claw-self-improvement
4. 移除ClawHub锁定文件条目
如果技能是通过ClawHub安装的,还需从~/.openclaw/workspace/.clawhub/lock.json中移除其本地安装记录。
bash
python3 - <
from pathlib import Path
import json
path = Path.home() / .openclaw/workspace/.clawhub/lock.json
if path.exists():
data = json.loads(path.read_text())
skills = data.get(skills)
if isinstance(skills, dict):
skills.pop(claw-self-improvement, None)
path.write_text(json.dumps(data, indent=2) + \n)
PY
5. 可选:移除.learnings/文件
.learnings/目录是你捕获的历史记录,而非钩子本身。你可以保留它作为参考,如果不再需要这些数据,也可以移除这些文件。
仅移除此工作流程创建的文件:
bash
rm -f ~/.openclaw/workspace/.learnings/LEARNINGS.md \
~/.openclaw/workspace/.learnings/ERRORS.md \
~/.openclaw/workspace/.learnings/FEATURE_REQUESTS.md \
~/.openclaw/workspace/.learnings/PROMOTED.md
如果目录随后为空,你也可以移除它:
bash
rmdir ~/.openclaw/workspace/.learnings 2>/dev/null || true
6. 禁用可见学习通知(如果已启用)
如果在安装期间添加了claw-self-improvement块,请从TOOLS.md中移除它。
7. 重新启动网关
bash
openclaw gateway