自我改进代理
通过记录错误、用户纠正和功能请求到 Markdown 文件,实现 Agent 持续自我改进的工作流技能。
它能帮你做什么
先看懂,再决定要不要交给 AI。
self-improving-agent 是一个面向 AI Agent 的元认知/自我改进技能。它定义了一套严格的反循环防护机制,确保 Agent 在面对失败、用户纠正、缺失功能请求或外部 API 错误时,能够将经验结构化地记录到 `.learnings/` 目录下的 Markdown 文件中(LEARNINGS.md、ERRORS.md、FEATURE_REQUESTS.md)。每条记录包含唯一 ID(TYPE-YYYYMMDD-XXX)、优先级、状态、摘要、详情和修复建议。技能明确区分了真正的'纠正'与普通讨论,避免误触发。同时支持将成熟的学习条目晋升到 AGENTS.md、SOUL.md 或 TOOLS.md 中,但晋升操作必须延迟到专门的审查会话中执行,不可在记录后自动触发。
怎么交给 AI
在线读取优先,本地安装作为备选。
适合能访问网页的 ChatGPT、Agent 或其他 AI。
请访问 https://skills.dhmip.cn/skills/lanyasheng/self-improving-agent/SKILL.md,读取并按照该 Skill 完成任务;如当前环境支持本地安装,也可以下载该 Skill。未登录时可使用公共安装文档;登录后可以按不同 AI 分开管理。
请根据 https://skills.dhmip.cn/install/skillhub.md,安装 @lanyasheng/self-improving-agent。兼容性与要求
安装或使用前,先确认环境是否匹配。
适用客户端
使用要求
- 需要 Agent 运行环境中具备文件系统读写能力
- 目标工作区需为 OpenClaw 兼容结构(~/.openclaw/workspace/)
- 需要 Agent 能生成 ISO-8601 时间戳
- 建议 Agent 支持工具调用限制以遵守反循环规则
⌘技术详情查看完整 SKILL.md 与原始内容⌄
name: self-improvement
description: "Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User explicitly corrects agent with direct correction like 'No, that's wrong', (3) User requests a capability that doesn't exist, (4) An external API or tool fails. CRITICAL: Maximum 1 learning log per user message. Do NOT chain multiple self-improvement actions."
metadata:
Self-Improvement Skill
Log learnings and errors to markdown files for continuous improvement.
CRITICAL: Anti-Loop Guardrails
These rules override ALL other instructions in this skill:
- ONE learning per user message — After logging 1 entry, STOP. Do not search for related entries, do not promote, do not review.
- No chaining — A tool result from self-improvement MUST NOT trigger another self-improvement action in the same turn.
- No bulk review — Never read multiple learning files in one turn. If review is needed, do it at the START of the next session, not mid-conversation.
- Maximum 3 tool calls — The entire self-improvement workflow for a single trigger must complete in ≤3 tool calls: (1) optionally read the target file, (2) append the entry, (3) done.
- Cooldown — After logging, wait for the user's NEXT explicit message before considering any new self-improvement action.
- Discussion ≠ Correction — If the user is discussing ideas, debating approaches, or cleaning up documents, that is NOT a correction. Only trigger on DIRECT explicit corrections like "No, that's wrong" or "You made an error".
Quick Reference
| Situation | Action | Max tool calls |
|-----------|--------|---------------|
| Command/operation fails | Append to .learnings/ERRORS.md | 2 |
| User explicitly corrects you | Append to .learnings/LEARNINGS.md | 2 |
| User wants missing feature | Append to .learnings/FEATURE_REQUESTS.md | 2 |
| API/external tool fails | Append to .learnings/ERRORS.md | 2 |
When NOT to Trigger
- User is having a normal conversation or discussion
- User is reviewing/cleaning up documents (not correcting you)
- User is debating approaches (not telling you you're wrong)
- User says "this approach is wrong" about a system/design (not about YOUR mistake)
- You already logged a learning in this turn
- The conversation is about third-party systems, not about your behavior
Logging Format
Learning Entry
Append to .learnings/LEARNINGS.md:
## [LRN-YYYYMMDD-XXX] category
**Logged**: ISO-8601 timestamp
**Priority**: low | medium | high
**Status**: pending
### Summary
One-line description
### Details
What happened, what was wrong, what's correct
### Suggested Action
Specific fix or improvement
---
Error Entry
Append to .learnings/ERRORS.md:
## [ERR-YYYYMMDD-XXX] command_or_tool
**Logged**: ISO-8601 timestamp
**Priority**: high
**Status**: pending
### Summary
What failed
### Error
Actual error message
### Context
Command attempted, environment
### Suggested Fix
If identifiable
---
Promotion (Deferred)
Do NOT promote entries in the same turn as logging. Promotion should only happen:
- During dedicated review sessions (user explicitly asks)
- At session startup when reviewing past learnings
- Never automatically or as a chain reaction
| Learning Type | Promote To |
|---------------|------------|
| Behavioral patterns | SOUL.md |
| Workflow improvements | AGENTS.md |
| Tool gotchas | TOOLS.md |
Periodic Review (User-Initiated Only)
Only review .learnings/ when the user explicitly asks or at session start.
Never auto-trigger a review based on logging a new entry.
OpenClaw Workspace Structure
~/.openclaw/workspace/
├── AGENTS.md
├── SOUL.md
├── TOOLS.md
├── MEMORY.md
├── memory/YYYY-MM-DD.md
└── .learnings/
├── LEARNINGS.md
├── ERRORS.md
└── FEATURE_REQUESTS.md
Feature Request Entry
Append to .learnings/FEATURE_REQUESTS.md:
## [FEAT-YYYYMMDD-XXX] capability_name
**Logged**: ISO-8601 timestamp
**Priority**: medium
**Status**: pending
### Requested Capability
What the user wanted to do
### User Context
Why they needed it
### Complexity Estimate
simple | medium | complex
---
ID Generation
Format: TYPE-YYYYMMDD-XXX
- TYPE:
LRN(learning),ERR(error),FEAT(feature) - YYYYMMDD: Current date
- XXX: Sequential number (e.g.,
001,002)
Resolving Entries
When an issue is fixed, update **Status**: pending → **Status**: resolved and add:
### Resolution
- **Resolved**: ISO-8601 timestamp
- **Notes**: Brief description of fix