KL8-2026 self-improving
Use when: agent needs to learn from mistakes, improve from errors, review past failures, update coding preferences, apply learned patterns, self-optimize, grow smarter from feedback. Reviews error history and updates workspace instructions to prevent recurrence.
install
source · Clone the upstream repo
git clone https://github.com/meteor-007/KL8-2026
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/meteor-007/KL8-2026 "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.github/skills/self-improving" ~/.claude/skills/meteor-007-kl8-2026-self-improving && rm -rf "$T"
manifest:
.github/skills/self-improving/SKILL.mdsource content
Self-Improving Agent Skill
概述
通过分析错误历史、测试失败和用户反馈,持续优化自身行为,将学到的经验写入记忆和指令文件。
依赖
- MCP 服务器:
(存储学习记录),memory
(读写指令文件)filesystem
工作流程
阶段 1: 错误捕获
当以下情况发生时自动触发:
- 工具调用失败并需要重试
- 用户说"这是错的"、"你又犯了同样的错误"
- 测试运行失败
- 代码编辑引入语法/逻辑错误
阶段 2: 根因分析
1. 记录错误描述和发生上下文 2. 识别错误类型: - 知识错误: 对 API/库/框架认知有误 - 推理错误: 逻辑推断失误 - 遗漏错误: 忽略了重要约束 - 重复错误: 已犯过但再次犯 3. 提取可操作的改进规则
阶段 3: 知识固化
- 调用
存储错误模式:memory/create_entities{type: "LearningRecord", error: "...", fix: "...", date: "...", scope: "..."} - 如果是重复错误,更新
下对应的 instructions 文件.github/instructions/ - 如果是通用原则,更新
.github/copilot-instructions.md
阶段 4: 验证学习效果
下次遇到类似情况时:
- 搜索
中的 LearningRecordmemory - 在响应前主动应用已学习的规则
- 如果规则有效则强化,无效则修订
学习记录格式
type: LearningRecord project: KL8-V1.0 date: 2026-03-07 error: "对 chaos_features.py 中 lyapunov 的实现使用了错误公式" root_cause: "将 np.mean(log_diffs) 误认为是李雅普诺夫指数" fix: "改用 Rosenstein 1993 算法:相空间重构 + 近邻轨迹发散率回归" prevention_rule: "引入非线性动力学指标前必须核查 Physica D 文献"
自动会话总结
每次对话结束时,如果完成了重要修改,生成一条学习记录存入记忆。