agent-self-recovery

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agent Self-Recovery

Agent 自我恢复

State file:
~/.openclaw/skill-state/agent-self-recovery/state.yaml
状态文件:
~/.openclaw/skill-state/agent-self-recovery/state.yaml

Signs You're Stuck

陷入卡顿的迹象

  • Tried the same approach 3+ times with the same result
  • Making changes that feel random rather than targeted
  • Lost track of the original goal
  • Taking longer than expected on a 'simple' step
  • 相同方法尝试了3次以上且得到相同结果
  • 做出的改动偏随机而非针对性
  • 忘记了最初的目标
  • 完成「简单」步骤花费的时间远超预期

Recovery Protocol

恢复流程

Step 1: Stop

步骤1:停止

Stop making changes. No more quick tries.
停止所有改动,不要再进行快速尝试。

Step 2: Write State

步骤2:写入状态

Write to the state file:
  • what_trying
    : what were you trying to do?
  • what_tried
    : append this latest approach to the list
  • loop_type
    : name the pattern (see Step 3)
  • attempts
    : increment by 1
  • status: recovering
  • started_at
    : current timestamp (first time only)
向状态文件写入以下内容:
  • what_trying
    : 你当时正在尝试完成什么任务?
  • what_tried
    : 将本次最新的尝试方法追加到列表中
  • loop_type
    : 为当前模式命名(见步骤3)
  • attempts
    : 计数加1
  • status: recovering
  • started_at
    : 当前时间戳(仅首次执行时填写)

Step 3: Name the Loop

步骤3:命名循环类型

Pick the
loop_type
:
  • same-fix-variations
    — trying the same fix with minor changes
  • cascading-dependencies
    — each fix reveals a new dependency
  • unclear-error
    — unclear what the actual error is
  • lost-goal
    — lost track of original requirement
选择对应的
loop_type
  • same-fix-variations
    — 对同一个修复方案做微小改动反复尝试
  • cascading-dependencies
    — 每一次修复都会暴露新的依赖问题
  • unclear-error
    — 无法明确实际错误是什么
  • lost-goal
    — 忘记了最初的需求

Step 4: Break the Loop

步骤4:打破循环

If
loop_type: unclear-error
→ use systematic-debugging first. If
loop_type: lost-goal
→ re-read the original requirement. If genuinely blocked → document clearly, ask the user. Update state
status: escalated
. If context too large → use context-window-management. If truly lost → use task-handoff, ask user to redirect. Update state
status: escalated
.
如果
loop_type: unclear-error
→ 优先使用systematic-debugging。 如果
loop_type: lost-goal
→ 重新阅读原始需求。 如果确实遭遇阻塞 → 清晰记录问题,向用户求助。更新状态
status: escalated
。 如果上下文体积过大 → 使用context-window-management。 如果完全失去方向 → 使用task-handoff,请用户调整任务方向。更新状态
status: escalated

Step 5: Resume with a New Approach

步骤5:使用新方法恢复执行

Choose a genuinely different approach. Update state
last_approach
, append to
what_tried
. On success: update state
status: recovered
.
选择一个完全不同的方案。更新状态
last_approach
,追加到
what_tried
列表中。 执行成功后:更新状态
status: recovered