Evolver 使用指南
Capability Evolver 是自我改进引擎的核心,分析会话日志中的错误模式并自动修复。
🎯 使用场景
| 场景 | 建议 | 命令 |
|---|---|---|
| 遇到重复错误 | 运行一次分析 | node index.js run |
| 系统不稳定 | 使用 harden 策略 | EVOLVE_STRATEGY=harden node index.js run |
| 需要新功能 | 使用 innovate 策略 | EVOLVE_STRATEGY=innovate node index.js run |
| 日常维护 | 每周运行一次 | node index.js run |
🚀 快速开始
1. 运行一次进化分析
bash
cd ~/.openclaw/workspace/skills/evolver
node index.js run输出示例:
Starting capability evolver...
Scanning session logs...
[QuestionGenerator] Generated 2 proactive question(s).
[SearchFirst] No hub match. Proceeding with local evolution.
[BRIDGE ENABLED] Spawning executor agent via sessions_spawn.
=======================================================
Capability evolver finished.
=======================================================2. 查看产生的文件
bash
# 查看进化周期文件
ls -lh ../memory/evolution/gep_prompt_*.txt
# 查看记忆图谱更新
tail -20 ../memory/evolution/memory_graph.jsonl3. 清理临时文件
bash
# 清理 7 天前的文件
/root/.openclaw/workspace/scripts/evolver-cleanup.sh 7⚙️ 配置说明
环境变量 (skills/evolver/.env)
bash
# 节点身份(首次运行时自动生成)
A2A_NODE_ID=node_xxxxxxxxxxxx
A2A_NODE_SECRET=<绑定后获取>
# Hub 配置
A2A_HUB_URL=https://evomap.ai
# 进化策略
EVOLVE_STRATEGY=balanced # balanced | innovate | harden | repair-only
# 文件控制
EVOLVER_KEEP_PROMPT_FILES=false # 不保留提示词文件
EVOLVER_MAX_SAVED_CYCLES=10 # 只保留最近 10 个周期策略选择
| 策略 | 创新 | 优化 | 修复 | 适用场景 |
|---|---|---|---|---|
balanced | 50% | 30% | 20% | 日常运行 |
innovate | 80% | 15% | 5% | 开发新功能 |
harden | 20% | 40% | 40% | 系统不稳定 |
repair-only | 0% | 20% | 80% | 紧急修复 |
🧬 基因库
核心基因(3 个)
位置: skills/evolver/assets/gep/genes.json
| 基因 ID | 类别 | 触发信号 | 用途 |
|---|---|---|---|
gene_gep_repair_from_errors | repair | error, failed, unstable | 修复错误 |
gene_gep_optimize_prompt_and_assets | optimize | protocol, prompt, audit | 优化提示词 |
gene_gep_innovate_from_opportunity | innovate | user_feature_request, bottleneck | 创新功能 |
选择器逻辑
会话日志 → 提取信号 → 匹配基因 → 执行策略示例:
信号:["log_error", "high_tool_usage:exec"]
匹配:gene_gep_repair_from_errors (repair)
执行:最小化修复补丁📊 运行结果
成功案例
json
{
"type": "EvolutionEvent",
"id": "evt_1774032236356",
"intent": "repair",
"signals": ["log_error", "repeated_tool_usage:exec"],
"genes_used": ["gene_gep_repair_from_errors"],
"outcome": {
"status": "success",
"score": 0.85
}
}失败案例
json
{
"type": "EvolutionEvent",
"outcome": {
"status": "failed",
"score": 0.2,
"note": "error_persisted"
}
}🔍 故障排查
问题 1: 运行失败
错误信息:
Error: dotenv not found解决方案:
bash
cd ~/.openclaw/workspace/skills/evolver
npm install dotenv问题 2: Git 检测警告
警告信息:
[evolver] Detected .git in parent directory -- ignoring.解决方案(可选):
bash
# 在 .env 中添加
EVOLVER_USE_PARENT_GIT=true
EVOLVER_REPO_ROOT=/root/.openclaw/workspace问题 3: Hub 连接超时
错误信息:
[SearchFirst] No hub match (reason: hub_http_503)解决方案:
bash
# 检查网络连接
curl -I https://evomap.ai
# 使用本地模式(不影响功能)
# Hub 仅用于下载/发布资产,本地进化完全可用🎯 最佳实践
1. 按需触发,避免自动循环
bash
# ✅ 推荐:手动触发
node index.js run
# ❌ 不推荐:自动循环(产生垃圾文件)
node index.js --loop2. 定期清理文件
bash
# 每周清理一次
/root/.openclaw/workspace/scripts/evolver-cleanup.sh 7
# 或每月清理(保留更多历史)
/root/.openclaw/workspace/scripts/evolver-cleanup.sh 303. 审查重要修改
bash
# 使用审查模式
node index.js --review
# 查看生成的补丁
cat ../memory/evolution/gep_prompt_*.txt4. 监控成功率
bash
# 查看最近 10 次进化结果
tail -10 ../memory/evolution/memory_graph.jsonl | jq -r '.outcome.status'健康指标: 成功率 >70%
🌐 EvoMap Hub(可选)
发布资产
成功修复后自动发布(如果配置正确):
bash
# 检查发布状态
grep "asset_publish" ../memory/evolution/memory_graph.jsonl | wc -l下载资产
bash
# 查询 Hub 可用资产
curl -X POST https://evomap.ai/a2a/fetch \
-H "Authorization: Bearer <secret>" \
-H "Content-Type: application/json" \
-d '{"signals":["log_error"]}'📚 相关文档
提示: Evolver 是工具,不是负担。按需使用,不刻意追求进化次数。