一键导入
self-improving-agent
通用的自我改进 agent,从所有 skill 经验中学习。使用多内存架构(语义 + 情景 + 工作)持续演进代码库。通过 hooks 在 skill 完成/错误时自动触发基于自检的自我修正。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
通用的自我改进 agent,从所有 skill 经验中学习。使用多内存架构(语义 + 情景 + 工作)持续演进代码库。通过 hooks 在 skill 完成/错误时自动触发基于自检的自我修正。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
LLM 微调专家。使用场景:微调 LLMs、训练自定义模型、适配基础模型进行特定任务。用于配置 LoRA/QLoRA 适配器、准备 JSONL 训练数据集、设置超参数、适配器训练、迁移学习、Hugging Face PEFT 微调、指令微调、RLHF、DPO 或量化部署微调模型。触发词:LoRA、QLoRA、PEFT、微调、适配器调优、LLM 训练、模型训练、自定义模型。
深度研究工具。仅在用户明确说'深度研究'、'深入调查'、'全面报告'时使用。比普通搜索慢 10-100 倍。对于普通研究/查找请求,使用 parallel-web-search。支持多轮:传递 --previous-interaction-id 以继续之前的上下文。
AI 模型提示工程指南:LLM、图像生成器、视频模型。技术:思维链、少样本、系统提示、负提示。模型:Claude、GPT-4、Gemini、FLUX、Veo、Stable Diffusion 提示。用于:更好的 AI 输出、一致的结果、复杂任务、优化。触发词:提示工程、如何提示、更好的提示、提示技巧、提示指南、LLM 提示、图像提示、AI 提示、提示优化、提示模板、提示结构、有效提示、提示技术。
RAG(检索增强生成)模式专家。用于构建 RAG 管道、嵌入文档、实现混合搜索、上下文检索、HyDE、Agentic RAG、多模态 RAG、查询分解、重排或 pgvector 搜索。触发词:RAG、检索、LLM、上下文、嵌入、HyDE、重排、pgvector、多模态。
Apache Spark 作业优化:分区策略、缓存、shuffle 优化和内存调优。用于提升 Spark 性能、调试慢作业或扩展数据处理管道。触发词:Spark、性能优化、分区、缓存、shuffle、数据倾斜。
Web 研究工具:搜索多个来源、综合发现并生成带引用的研究报告。用于用户要求在线研究主题、搜索网页、查找信息、获取最新信息、对比选项或生成研究报告。触发词:研究、网上搜索、查找信息、最新信息、对比选项、研究报告。
| name | self-improving-agent |
| description | 通用的自我改进 agent,从所有 skill 经验中学习。使用多内存架构(语义 + 情景 + 工作)持续演进代码库。通过 hooks 在 skill 完成/错误时自动触发基于自检的自我修正。 |
"一个从每次交互中学习的 AI agent,积累模式和洞察,持续改进自身能力。"
这是一个通用自我改进系统,从所有 skill 经验中学习。它实现了一个完整的反馈循环:
| 事件 | 触发 | 动作 |
|---|---|---|
| before_start | 任何 skill 启动 | 记录会话开始 |
| after_complete | 任何 skill 完成 | 提取模式,更新 skills |
| on_error | Bash 返回非零退出 | 捕获错误上下文,触发自我修正 |
当新可重用知识出现时触发演进:
| 触发 | 目标 Skill | 优先级 | 动作 |
|---|---|---|---|
| 发现新 PRD 模式 | prd-planner | 高 | 添加到质量检查清单 |
| 架构权衡明确 | architecting-solutions | 高 | 添加到决策模式 |
| API 设计规则学到 | api-designer | 高 | 更新模板 |
| 调试修复发现 | debugger | 高 | 添加到反模式 |
| 审查清单缺口 | code-reviewer | 高 | 添加清单项目 |
| 性能/安全洞察 | performance-engineer | 高 | 添加到模式 |
| UI/UX 规范问题 | prd-planner | 高 | 添加视觉规范要求 |
memory/semantic-patterns.json)存储可跨上下文重用的抽象模式和规则:
{
"patterns": {
"pattern_id": {
"id": "pat-2025-01-11-001",
"name": "Pattern Name",
"source": "user_feedback|implementation_review|retrospective",
"confidence": 0.95,
"applications": 5,
"created": "2025-01-11",
"category": "prd_structure|react_patterns|async_patterns|...",
"pattern": "One-line summary",
"problem": "What problem does this solve?",
"solution": { ... },
"quality_rules": [ ... ],
"target_skills": [ ... ]
}
}
}
memory/episodic/)存储具体经验及发生的事情:
memory/episodic/
├── 2025/
│ ├── 2025-01-11-prd-creation.json
│ ├── 2025-01-11-debug-session.json
│ └── 2025-01-12-refactoring.json
{
"id": "ep-2025-01-11-001",
"timestamp": "2025-01-11T10:30:00Z",
"skill": "debugger",
"situation": "User reported data not refreshing after form submission",
"root_cause": "Empty callback in onRefresh prop",
"solution": "Implement actual refresh logic in callback",
"lesson": "Always verify callbacks are not empty functions",
"related_pattern": "callback_verification",
"user_feedback": {
"rating": 8,
"comments": "This was exactly the issue"
}
}
memory/working/)存储当前会话上下文:
memory/working/
├── current_session.json # 活跃会话数据
├── last_error.json # 错误上下文用于自我修正
└── session_end.json # 会话结束标记
任何 skill 完成后,提取:
What happened:
skill_used: {which skill}
task: {what was being done}
outcome: {success|partial|failure}
Key Insights:
what_went_well: [what worked]
what_went_wrong: [what didn't work]
root_cause: {underlying issue if applicable}
User Feedback:
rating: {1-10 if provided}
comments: {specific feedback}
将经验转换为可重用模式:
| 具体经验 | 抽象模式 | 目标 Skill |
|---|---|---|
| "User forgot to save PRD notes" | "Always persist thinking to files" | prd-planner |
| "Code review missed SQL injection" | "Add security checklist item" | code-reviewer |
| "Callback was empty, didn't work" | "Verify callback implementations" | debugger |
| "Net APY position ambiguous" | "UI specs need exact relative positions" | prd-planner |
抽象规则:
If experience_repeats 3+ times:
pattern_level: critical
action: Add to skill's "Critical Mistakes" section
If solution_was_effective:
pattern_level: best_practice
action: Add to skill's "Best Practices" section
If user_rating >= 7:
pattern_level: strength
action: Reinforce this approach
If user_rating <= 4:
pattern_level: weakness
action: Add to "What to Avoid" section
使用演进标记更新适当的 skill 文件:
<!-- Evolution: 2025-01-12 | source: ep-2025-01-12-001 | skill: debugger -->
## Pattern Added (2025-01-12)
**Pattern**: Always verify callbacks are not empty functions
**Source**: Episode ep-2025-01-12-001
**Confidence**: 0.95
### Updated Checklist
- [ ] Verify all callbacks have implementations
- [ ] Test callback execution paths
修正标记(修复错误指导时):
<!-- Correction: 2025-01-12 | was: "Use callback chain" | reason: caused stale refresh -->
## Corrected Guidance
Use direct state monitoring instead of callback chains:
```typescript
// ✅ Do: Direct state monitoring
const prevPendingCount = usePrevious(pendingCount);
### 阶段 4: 内存整合
1. **更新语义内存**(`memory/semantic-patterns.json`)
2. **存储情景内存**(`memory/episodic/YYYY-MM-DD-{skill}.json`)
3. **基于应用/反馈更新模式置信度**
4. **剪枝过时模式**(低置信度、无近期应用)
## 自我修正(on_error hook)
触发条件:
- Bash 命令返回非零退出码
- 遵循 skill 指导后测试失败
- 用户报告指导产生错误结果
**过程:**
```markdown
## Self-Correction Workflow
1. Detect Error
- 从 working/last_error.json 捕获错误上下文
- 识别遵循了哪个 skill 指导
2. Verify Root Cause
- Skill 指导不正确吗?
- 指导被误解了吗?
- 指导不完整吗?
3. Apply Correction
- 用修正的指导更新 skill 文件
- 添加带原因的修正标记
- 在语义内存中更新相关模式
4. Validate Fix
- 测试修正后的指导
- 请用户验证
任何 skill 完成后,此 agent 自动: