Phoenix Loop
Rise from failures. Complete tasks persistently.
When the agent encounters blockers, failures, or repeated friction, this skill starts a self-healing loop: Diagnose -> Extract -> Crystallize -> Verify.
Core Mechanism
1. Diagnose
CODEBLOCK0
Diagnosis Checklist:
- - [ ] Is the failure cause clearly stated?
- [ ] Were at least 2 solution paths attempted?
- [ ] Is minimum unblock input defined?
2. Extract
Extract reusable patterns from failures:
CODEBLOCK1
3. Crystallize
Write the lesson to a local skill:
CODEBLOCK2
Skill Template:
CODEBLOCK3
4. Verify
Next time a similar issue occurs:
- 1. Search
skills/local/ for matching skills - Execute recovery steps
- Log result to INLINECODE1
- Update skill if needed
Privacy Security
All data stored locally:
- - NO external logging of failure data
- NO API keys or tokens in skill files
- NO upload of user task content
- Only pattern names and solution steps recorded
- Skills stored in
skills/local/ local directory
Sensitive Data Filter:
Before writing to any memory or skill, check and remove:
- -
apiKey, token, secret, INLINECODE6 - INLINECODE7 ,
sk-, INLINECODE9 - Personal emails, phones, addresses
Executable Completion Criteria
A phoenix-loop task is complete if and only if:
| Criteria | Verification Command |
|---|
| Failure pattern named | INLINECODE10 |
| Local skill created |
Test-Path skills/local/{name}-recovery.md |
| Skill has trigger section |
Select-String "## Trigger" skills/local/{name}.md |
| Skill has verification steps |
Select-String "## Verification" skills/local/{name}.md |
| Memory updated |
Select-String "phoenix-loop" memory/{today}.md |
| Privacy check passed | Skill file contains no
apiKey|token|secret |
Usage Example
Scenario: Missing API Key Blocks Task
1. Diagnose:
CODEBLOCK4
2. Extract Pattern:
CODEBLOCK5
3. Crystallize Skill:
CODEBLOCK6
4. Verify:
Next time an API key issue occurs, auto-apply this skill.
Heartbeat Integration
Add to HEARTBEAT.md:
CODEBLOCK7
Rollback
If the skill causes issues:
CODEBLOCK8
References
- -
memory/blocked-items.md - Blocker records - INLINECODE18 - Task history
- INLINECODE19 - Local skill library
Rise stronger from every failure.
Phoenix Loop
从失败中崛起。坚持不懈地完成任务。
当智能体遇到阻碍、失败或反复摩擦时,此技能启动自愈循环:诊断 → 提取 → 结晶 → 验证。
核心机制
1. 诊断
powershell
读取最近的阻塞项
Get-Content memory/blocked-items.md | Select-String Blocker -Context 3
提取失败模式
Get-Content memory/tasks.md | Select-String Status: failed -Context 5
诊断清单:
- - [ ] 失败原因是否明确说明?
- [ ] 是否尝试了至少2种解决方案路径?
- [ ] 是否定义了最小解除阻塞输入?
2. 提取
从失败中提取可复用的模式:
markdown
失败模式:{模式名称}
- - 触发条件:{何时发生}
- 根本原因:{根本原因}
- 解决方案:{修复步骤}
- 验证:{验证标准}
3. 结晶
将经验写入本地技能:
skills/local/{模式名称}-recovery.md
技能模板:
markdown
{模式名称} 恢复
触发条件
当{条件}发生时
步骤
- 1. {步骤1}
- {步骤2}
- {步骤3}
验证
回退方案
如果失败,执行{回退操作}
4. 验证
下次出现类似问题时:
- 1. 搜索 skills/local/ 查找匹配的技能
- 执行恢复步骤
- 将结果记录到 memory/{日期}.md
- 根据需要更新技能
隐私安全
所有数据本地存储:
- - 不对外记录失败数据
- 技能文件中不包含API密钥或令牌
- 不上传用户任务内容
- 仅记录模式名称和解决步骤
- 技能存储在 skills/local/ 本地目录
敏感数据过滤器:
在写入任何记忆或技能之前,检查并移除:
- - apiKey、token、secret、password
- Bearer 、sk-、OPENCLAW_
- 个人邮箱、电话、地址
可执行完成标准
一个phoenix-loop任务完成当且仅当:
| 标准 | 验证命令 |
|---|
| 失败模式已命名 | Select-String Failure Pattern memory/blocked-items.md |
| 本地技能已创建 |
Test-Path skills/local/{名称}-recovery.md |
| 技能包含触发条件部分 | Select-String ## Trigger skills/local/{名称}.md |
| 技能包含验证步骤 | Select-String ## Verification skills/local/{名称}.md |
| 记忆已更新 | Select-String phoenix-loop memory/{今天日期}.md |
| 隐私检查通过 | 技能文件不包含 apiKey|token|secret |
使用示例
场景:缺少API密钥阻塞任务
1. 诊断:
阻塞:缺少Brave API密钥
已尝试:web_search(失败)
解除阻塞输入:用户运行 openclaw configure --section web
2. 提取模式:
失败模式:missing-api-key
触发条件:工具需要未配置的API密钥
解决方案:1. 检测缺失密钥 2. 返回配置命令 3. 提供回退方案
3. 结晶技能:
markdown
缺少API密钥恢复
触发条件
当工具返回missing
*api_key错误时
步骤
- 1. 提取所需密钥名称
- 返回配置命令:openclaw configure --section {部分}
- 提供手动回退选项
验证
- - [ ] 用户收到清晰的配置说明
- [ ] 至少提供1种替代方案
4. 验证:
下次出现API密钥问题时,自动应用此技能。
心跳集成
添加到 HEARTBEAT.md:
markdown
自检(每24小时)
- 1. 检查 memory/blocked-items.md 中超过24小时的阻塞项
- 对每个长期阻塞项运行phoenix-loop诊断
- 如果发现可复用模式,创建或更新技能
回滚
如果技能导致问题:
powershell
禁用技能(重命名)
Rename-Item skills/local/{名称}-recovery.md skills/local/{名称}-recovery.md.disabled
删除技能
Remove-Item skills/local/{名称}-recovery.md
参考
- - memory/blocked-items.md - 阻塞记录
- memory/tasks.md - 任务历史
- skills/local/ - 本地技能库
从每次失败中变得更强大。