agent-recovery
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Recovery Skill
Agent恢复技能
Protocols for when the agent is stuck, context is degraded, or session needs migration.
当Agent陷入停滞、上下文质量下降或需要迁移会话时的处理协议。
When to Use
适用场景
- Agent is making repeated mistakes
- Long conversation causing hallucinations
- Need to hand off to fresh agent
- Context window is full
- Agent持续重复犯错
- 长对话导致幻觉问题
- 需要切换至全新Agent
- 上下文窗口已满
Option 1: Escalate (Handoff Report)
选项1:升级(交接报告)
Use when: Agent is stuck and can't solve the problem.
适用场景:Agent陷入停滞且无法解决问题。
Steps
步骤
- Undo broken changes:
bash
git status
git checkout -- .- Generate :
docs/escalation_report.md
markdown
undefined- 撤销错误更改:
bash
git status
git checkout -- .- 生成:
docs/escalation_report.md
markdown
undefinedEscalation Handoff Report
升级交接报告
Generated: [Date/Time]
Original Issue: [GitHub Issue # or description]
生成时间: [日期/时间]
原始问题: [GitHub Issue编号或描述]
PART 1: THE DAMAGE REPORT
第一部分:问题报告
1.1 Original Goal
1.1 初始目标
[The task you were asked to complete]
[被要求完成的任务]
1.2 Observed Failure
1.2 观察到的故障
[EXACT error message]
[精确的错误信息]
1.3 Failed Approach
1.3 尝试过的失败方案
[Strategy you attempted]
[所采用的策略]
1.4 Key Files Involved
1.4 涉及的关键文件
path/to/file1.ts
path/to/file1.ts
1.5 Best-Guess Diagnosis
1.5 初步诊断
[Why approach failed]
[方案失败的原因]
PART 2: FULL FILE CONTENTS
第二部分:完整文件内容
[EMBED entire content of each file]
[嵌入每个文件的全部内容]
PART 3: DIRECTIVE FOR ORCHESTRATOR
第三部分:协调器指令
- Analyze the failure
- Formulate a new plan
- Execute or hand off
3. **Open new session** and paste the report content.
---- 分析故障原因
- 制定新方案
- 执行或移交任务
3. **开启新会话**并粘贴报告内容。
---Option 2: Migrate (Context Snapshot)
选项2:迁移(上下文快照)
Use when: Chat is stale, need fresh session with same context.
适用场景:对话已失效,需要在保留相同上下文的情况下开启新会话。
Auto-Detect Context
自动检测上下文
bash
cat docs/Project_Requirements.md 2>/dev/null
git log --oneline -20
gh issue list --state open --limit 10 --json number,title
cat docs/Coding_Guidelines.md 2>/dev/nullbash
cat docs/Project_Requirements.md 2>/dev/null
git log --oneline -20
gh issue list --state open --limit 10 --json number,title
cat docs/Coding_Guidelines.md 2>/dev/nullGenerate docs/migration_snapshot.md
:
docs/migration_snapshot.md生成docs/migration_snapshot.md
:
docs/migration_snapshot.mdmarkdown
undefinedmarkdown
undefinedState Snapshot Handoff Prompt
状态快照交接提示
To the New AI: Adopt This Identity
致新AI:承接以下身份
You are the VibeCode Project Orchestrator...
你是VibeCode项目协调器...
Project Details
项目详情
- Name: [from PRD]
- Stack: [from PRD]
- 名称: [来自PRD]
- 技术栈: [来自PRD]
Milestones
里程碑
[From git log]
[来自git日志]
Current Status
当前状态
- In Progress: [from GitHub]
- Next: [from roadmap]
- 进行中:[来自GitHub]
- 下一步:[来自路线图]
Key Files
关键文件
docs/Project_Requirements.mddocs/Coding_Guidelines.md
docs/Project_Requirements.mddocs/Coding_Guidelines.md
First Action
首要行动
Read files above, then ask: "What would you like to work on next?"
---阅读上述文件,然后询问:“接下来你想处理什么任务?”
---Option 3: Reset (Mid-Conversation)
选项3:重置(对话中途)
Use when: Agent is making mistakes but can recover.
适用场景:Agent出现错误但仍可恢复。
🛑 HARD STOP CHECKLIST
🛑 强制检查清单
□ Did I READ the target file with view_file BEFORE editing?
□ Did I copy the EXACT target content, including whitespace?
□ Am I editing LESS than 50 lines at a time?
□ Did I verify all variable names exist in scope?
□ Did I check props are destructured in function signature?□ 我是否在编辑前用view_file读取了目标文件?
□ 我是否复制了包含空格在内的精确目标内容?
□ 我是否每次编辑不超过50行?
□ 我是否验证了所有变量名在作用域内存在?
□ 我是否检查了函数签名中是否解构了props?Common Mistakes
常见错误
| Pattern | Fix |
|---|---|
| Duplicate lines | Read file first, count declarations |
| Missing destructuring | Check props signature |
| Broken JSX | Close tags in same edit |
| Phantom variables | grep in file before using |
| Edit offset drift | Re-read file after each edit |
| 错误模式 | 修复方案 |
|---|---|
| 重复行 | 先读取文件,统计声明数量 |
| 缺少解构 | 检查props签名 |
| 损坏的JSX | 在同一次编辑中闭合标签 |
| 不存在的变量 | 使用前在文件中grep查找 |
| 编辑偏移偏差 | 每次编辑后重新读取文件 |
File Edit Protocol
文件编辑协议
- → Understand structure
view_file_outline - (exact range) → Copy PRECISE content
view_file - Make edit with MINIMAL scope
- Re-check file before next edit
- → 理解文件结构
view_file_outline - (精确范围)→ 复制精准内容
view_file - 以最小范围进行编辑
- 下次编辑前重新检查文件
Verified Completion
验证完成
Before saying "done":
bash
npx tsc --noEmit # MUST pass- No duplicate declarations?
- No missing imports?
- Task actually solved?
If errors persist after 3 fix attempts → use Escalate.
在说“完成”之前:
bash
npx tsc --noEmit # 必须通过- 无重复声明?
- 无缺失的导入?
- 任务是否真正解决?
如果经过3次修复尝试后错误仍存在 → 使用升级方案。