recover by boshu2/agentops
npx skills add https://github.com/boshu2/agentops --skill recover用途: 帮助你在 Claude Code 上下文压缩后快速恢复工作状态。自动检测进行中的工作(RPI 运行、演进周期),加载相关知识,并总结你之前的工作内容和后续步骤。
你必须执行此工作流。不要仅仅描述它。
CLI 依赖项: gt, ao, bd — 均为可选。显示可用的内容,跳过不可用的部分。
/recover # 完整的恢复仪表板
/recover --json # 机器可读的 JSON 输出
在并行的 bash 调用中运行以下所有命令:
调用 1 — RPI 阶段状态:
if [ -f .agents/rpi/phased-state.json ]; then
echo "=== RPI_STATE ==="
cat .agents/rpi/phased-state.json
else
echo "RPI_STATE=NONE"
fi
调用 2 — 演进周期历史:
if [ -f .agents/evolve/cycle-history.jsonl ]; then
echo "=== EVOLVE_STATE ==="
tail -3 .agents/evolve/cycle-history.jsonl
else
echo "EVOLVE_STATE=NONE"
fi
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
echo "=== GIT_STATUS ==="
git status --short
echo "=== GIT_LOG ==="
git log --oneline -5
echo "=== GIT_BRANCH ==="
git branch --show-current
调用 4 — 工作队列状态:
if command -v bd &>/dev/null; then
echo "=== IN_PROGRESS ==="
bd list --status in_progress 2>/dev/null | head -3
echo "=== READY ==="
bd ready 2>/dev/null | head -3
else
echo "BD_UNAVAILABLE"
fi
调用 5 — 知识和消息:
# 知识工件
echo "=== KNOWLEDGE_COUNT ==="
echo "Learnings=$(ls .agents/learnings/ 2>/dev/null | wc -l | tr -d ' ')"
echo "Patterns=$(ls .agents/patterns/ 2>/dev/null | wc -l | tr -d ' ')"
# 如果 gt 可用,检查收件箱
if command -v gt &>/dev/null; then
echo "=== MESSAGES ==="
gt mail inbox 2>/dev/null | head -3
else
echo "GT_UNAVAILABLE"
fi
如果检测到 RPI 状态,运行:
if command -v ao &>/dev/null; then
ao lookup --query "rpi recovery context" --limit 5 2>/dev/null || true
fi
从收集的数据中提取:
.agents/rpi/phased-state.json: * 提取 `goal`, `epic_id`, `phase`, `cycle`, `started_at`
* 将阶段编号映射到阶段名称(1=研究, 2=规划, 3=实施, 4=验证)
* 显示自 started_at 以来经过的时间
2. 演进检测: 如果存在 .agents/evolve/cycle-history.jsonl:
* 读取最后一个条目以获取最近的周期
* 提取 `goals_fixed`, `result`, `timestamp`
* 显示最新周期摘要
3. 近期工作: 从 git 日志中:
* 最后 3 次提交(在调用 3 中提取)
* 未提交的变更数量
4. 待处理工作: 从 beads 中:
* 进行中的事项(最多 3 个)
* 就绪事项数量
5. 知识状态:
* 可用的学习和模式总数
* 如果 gt 可用,显示未读消息数量
将收集的数据组装成以下格式:
══════════════════════════════════════════════════════════════
上下文恢复仪表板
══════════════════════════════════════════════════════════════
进行中的 RPI 运行
史诗:<epic_id>
目标:<目标的前 80 个字符>
阶段:<阶段名称:研究 | 规划 | 实施 | 验证>
周期:<周期 #>
开始时间:<时间前(例如,"2 小时前")>
状态:<PHASE_START | IN_PROGRESS | READY_FOR_GATE | ...>
─ 下一步:<来自步骤 5 的基于状态的建议>
或
最近的演进周期(如果没有 RPI)
周期:<周期 #>
最新目标:<goal_id 或摘要>
结果:<result>
完成项:<数量或 "—">
时间戳:<时间前>
─ 下一步:<来自步骤 5 的基于状态的建议>
或
[无活动会话]
没有进行中的 RPI 运行或演进周期。
最后活动:<最后一次提交的时间或 "未知">
进行中的工作
<列出最多 3 个进行中的事项及其 ID>
<或 "无进行中的工作">
就绪工作
<就绪事项数量>
<或 "无就绪事项">
最近提交
<最后 3 次提交>
待处理变更
<未提交的文件数量或 "干净">
可用知识
学习:<数量> 模式:<数量>
收件箱
<消息数量或 "无消息" 或 "gt 未安装">
──────────────────────────────────────────────────────────────
建议的下一步操作
<来自步骤 5 的基于状态的命令>
──────────────────────────────────────────────────────────────
快捷命令
/status 当前工作流仪表板
/research 深度代码库探索
/plan 将工作分解为事项
/implement 执行单个事项
/crank 自主史诗执行
/vibe 验证代码质量
══════════════════════════════════════════════════════════════
从上到下评估上下文。使用第一个匹配的条件:
| 优先级 | 条件 | 建议 |
|---|---|---|
| 1 | RPI 运行进行中 + 阶段=研究 | "继续研究:/research 或如果就绪则 /plan" |
| 2 | RPI 运行进行中 + 阶段=规划 | "审查计划:在编码前使用 /pre-mortem 进行验证" |
| 3 | RPI 运行进行中 + 阶段=实施 | "恢复实施:/implement <下一个事项-id>" |
| 4 | RPI 运行进行中 + 阶段=验证 | "完成周期:使用 /post-mortem 提取学习成果" |
| 5 | 演进周期进行中 | "继续自主改进:/evolve --resume" |
| 6 | 存在进行中的事项 | "继续工作:/implement <事项-id>" |
| 8 | 有就绪事项可用 | "选择下一个事项:/implement <第一个就绪-id>" |
| 9 | 有未提交的变更 | "审查变更:/vibe recent" |
| 10 | 干净状态,无待处理事项 | "会话已恢复。从 /status 开始规划下一步工作" |
如果用户传递了 --json,则以结构化 JSON 格式输出所有恢复数据:
{
"session_type": "rpi|evolve|none",
"rpi": {
"epic_id": "ag-l2pu",
"goal": "Implement...",
"phase": 2,
"phase_name": "plan",
"cycle": 1,
"started_at": "2026-02-15T14:33:36-05:00",
"elapsed_minutes": 120
},
"evolve": {
"cycle": 3,
"result": "improved",
"goals_fixed": ["goal1", "goal2"],
"timestamp": "2026-02-15T22:00:00-05:00"
},
"work_state": {
"in_progress_count": 3,
"in_progress_issues": ["ag-042.1", "ag-042.2"],
"ready_count": 5,
"uncommitted_changes": 2
},
"git": {
"branch": "main",
"recent_commits": [
"7de51c8 feat: wave 2 — structural assertions",
"25004f8 fix: replace per-wave vibe gate"
]
},
"knowledge": {
"learnings_count": 12,
"patterns_count": 5
},
"inbox": {
"unread_count": 0
},
"suggestion": {
"priority": 4,
"message": "Resume implementation: /implement ag-042.1"
}
}
使用单个代码块渲染此内容。当 --json 激活时,不显示可视化仪表板。
用户输入: /recover
发生的情况:
ao lookup --query "rpi recovery context" 以加载相关知识/pre-mortem 进行验证"结果: 仪表板确认了进行中的 RPI 会话,加载了上下文,并建议了下一步。
用户输入: /recover
发生的情况:
ao lookup --query "evolve cycle recovery" 加载知识/evolve --resume"结果: 仪表板确认了演进周期,显示了进度,并提供了恢复命令。
用户输入: /recover
发生的情况:
/status 开始规划下一步工作"结果: 仪表板确认了干净状态,并引导用户到入口点。
| 问题 | 原因 | 解决方案 |
|---|---|---|
| 显示 "BD_UNAVAILABLE" 或 "GT_UNAVAILABLE" | CLI 工具未安装或不在 PATH 中 | 安装缺失的工具:brew install bd 或 brew install gt。技能会优雅降级,仅显示可用状态。 |
| RPI 状态显示错误的阶段 | 过时的 phased-state.json 未更新 | 检查 .agents/rpi/phased-state.json 的时间戳。如果过时,可能来自之前的运行。运行 /status 以验证当前阶段。 |
| 演进历史显示错误的周期 | 旧的 cycle-history.jsonl 条目未被清理 | Tail -3 显示最近的条目。使用 tail -20 .agents/evolve/cycle-history.jsonl 检查所有条目。 |
| 知识注入静默失败 | ao CLI 未安装或无知识工件 | 确保 ao 已安装:brew install ao。如果不存在学习成果,运行 /post-mortem 来填充知识库。 |
| 建议的操作与上下文不匹配 | 基于状态的规则未捕获边缘情况 | 使用 --json 检查原始状态并验证匹配了哪个条件。查看步骤 5 中的优先级表。 |
| JSON 输出格式错误 | 并行 bash 调用返回了意外的格式 | 单独检查每个 bash 调用。确保 jq 解析在实际数据上有效。在返回给用户之前验证 JSON 结构。 |
每周安装量
188
仓库
GitHub 星标数
197
首次出现
2026 年 2 月 16 日
安全审计
安装于
opencode187
codex184
gemini-cli183
github-copilot183
amp182
kimi-cli182
Purpose: Help you get back up to speed after Claude Code context compaction. Automatically detects in-progress work (RPI runs, evolve cycles), loads relevant knowledge, and summarizes what you were doing and what's next.
YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.
CLI dependencies: gt, ao, bd — all optional. Shows what's available, skips what isn't.
/recover # Full recovery dashboard
/recover --json # Machine-readable JSON output
Run ALL of the following in parallel bash calls:
Call 1 — RPI Phased State:
if [ -f .agents/rpi/phased-state.json ]; then
echo "=== RPI_STATE ==="
cat .agents/rpi/phased-state.json
else
echo "RPI_STATE=NONE"
fi
Call 2 — Evolve Cycle History:
if [ -f .agents/evolve/cycle-history.jsonl ]; then
echo "=== EVOLVE_STATE ==="
tail -3 .agents/evolve/cycle-history.jsonl
else
echo "EVOLVE_STATE=NONE"
fi
Call 3 — Git Recent Changes:
echo "=== GIT_STATUS ==="
git status --short
echo "=== GIT_LOG ==="
git log --oneline -5
echo "=== GIT_BRANCH ==="
git branch --show-current
Call 4 — Work Queue State:
if command -v bd &>/dev/null; then
echo "=== IN_PROGRESS ==="
bd list --status in_progress 2>/dev/null | head -3
echo "=== READY ==="
bd ready 2>/dev/null | head -3
else
echo "BD_UNAVAILABLE"
fi
Call 5 — Knowledge and Messages:
# Knowledge artifacts
echo "=== KNOWLEDGE_COUNT ==="
echo "Learnings=$(ls .agents/learnings/ 2>/dev/null | wc -l | tr -d ' ')"
echo "Patterns=$(ls .agents/patterns/ 2>/dev/null | wc -l | tr -d ' ')"
# Inbox if gt available
if command -v gt &>/dev/null; then
echo "=== MESSAGES ==="
gt mail inbox 2>/dev/null | head -3
else
echo "GT_UNAVAILABLE"
fi
If RPI state detected, run:
if command -v ao &>/dev/null; then
ao lookup --query "rpi recovery context" --limit 5 2>/dev/null || true
fi
Extract from collected data:
RPI Detection: If .agents/rpi/phased-state.json exists:
goal, epic_id, phase, cycle, started_atEvolve Detection: If .agents/evolve/cycle-history.jsonl exists:
goals_fixed, , Assemble gathered data into this format:
══════════════════════════════════════════════════════════════
Context Recovery Dashboard
══════════════════════════════════════════════════════════════
IN-PROGRESS RPI RUN
Epic: <epic_id>
Goal: <first 80 chars of goal>
Phase: <phase name: research | plan | implement | validate>
Cycle: <cycle #>
Started: <time ago (e.g., "2 hours ago")>
Status: <PHASE_START | IN_PROGRESS | READY_FOR_GATE | ...>
─ Next Step: <state-aware suggestion from Step 5>
OR
RECENT EVOLVE CYCLE (IF NO RPI)
Cycle: <cycle #>
Latest Goal: <goal_id or summary>
Result: <result>
Items Completed: <count or "—">
Timestamp: <time ago>
─ Next Step: <state-aware suggestion from Step 5>
OR
[NO ACTIVE SESSION]
No RPI run or evolve cycle in progress.
Last activity: <time of last commit or "unknown">
IN-PROGRESS WORK
<list up to 3 in-progress issues with IDs>
<or "No in-progress work">
READY TO WORK
<count of ready issues>
<or "No ready issues">
RECENT COMMITS
<last 3 commits>
PENDING CHANGES
<uncommitted file count or "clean">
KNOWLEDGE AVAILABLE
Learnings: <count> Patterns: <count>
INBOX
<message count or "No messages" or "gt not installed">
──────────────────────────────────────────────────────────────
SUGGESTED NEXT ACTION
<state-aware command from Step 5>
──────────────────────────────────────────────────────────────
QUICK COMMANDS
/status Current workflow dashboard
/research Deep codebase exploration
/plan Decompose work into issues
/implement Execute a single issue
/crank Autonomous epic execution
/vibe Validate code quality
══════════════════════════════════════════════════════════════
Evaluate context top-to-bottom. Use the FIRST matching condition:
| Priority | Condition | Suggestion |
|---|---|---|
| 1 | RPI run in-progress + phase=research | "Continue research: /research or /plan if ready" |
| 2 | RPI run in-progress + phase=plan | "Review plan: /pre-mortem to validate before coding" |
| 3 | RPI run in-progress + phase=implement | "Resume implementation: /implement <next-issue-id>" |
| 4 | RPI run in-progress + phase=validate | "Complete cycle: /post-mortem to extract learnings" |
If the user passed --json, output all recovery data as structured JSON:
{
"session_type": "rpi|evolve|none",
"rpi": {
"epic_id": "ag-l2pu",
"goal": "Implement...",
"phase": 2,
"phase_name": "plan",
"cycle": 1,
"started_at": "2026-02-15T14:33:36-05:00",
"elapsed_minutes": 120
},
"evolve": {
"cycle": 3,
"result": "improved",
"goals_fixed": ["goal1", "goal2"],
"timestamp": "2026-02-15T22:00:00-05:00"
},
"work_state": {
"in_progress_count": 3,
"in_progress_issues": ["ag-042.1", "ag-042.2"],
"ready_count": 5,
"uncommitted_changes": 2
},
"git": {
"branch": "main",
"recent_commits": [
"7de51c8 feat: wave 2 — structural assertions",
"25004f8 fix: replace per-wave vibe gate"
]
},
"knowledge": {
"learnings_count": 12,
"patterns_count": 5
},
"inbox": {
"unread_count": 0
},
"suggestion": {
"priority": 4,
"message": "Resume implementation: /implement ag-042.1"
}
}
Render this with a single code block. No visual dashboard when --json is active.
User says: /recover
What happens:
ao lookup --query "rpi recovery context" to load relevant knowledge/pre-mortem to validate before coding"Result: Dashboard confirms in-progress RPI session, loads context, suggests next step.
User says: /recover
What happens:
ao lookup --query "evolve cycle recovery"/evolve --resume"Result: Dashboard confirms evolve cycle, shows progress, offers resume command.
User says: /recover
What happens:
/status to plan next work"Result: Dashboard confirms clean state, points user to entry points.
| Problem | Cause | Solution |
|---|---|---|
| Shows "BD_UNAVAILABLE" or "GT_UNAVAILABLE" | CLI tools not installed or not in PATH | Install missing tools: brew install bd or brew install gt. Skill gracefully degrades by showing available state only. |
| RPI state shows wrong phase | Stale phased-state.json not updated | Check timestamp of .agents/rpi/phased-state.json. If stale, it may be from a previous run. Run /status to verify current phase. |
| Evolve history shows wrong cycle | Old cycle-history.jsonl entries not pruned | Tail -3 shows most recent entries. Check all entries with tail -20 .agents/evolve/cycle-history.jsonl. |
Weekly Installs
188
Repository
GitHub Stars
197
First Seen
Feb 16, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode187
codex184
gemini-cli183
github-copilot183
amp182
kimi-cli182
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装
resulttimestampRecent Work: From git log:
Pending Work: From beads:
Knowledge State:
| 5 | Evolve cycle in-progress | "Continue autonomous improvements: /evolve --resume" |
| 6 | In-progress issues exist | "Continue work: /implement <issue-id>" |
| 8 | Ready issues available | "Pick next issue: /implement <first-ready-id>" |
| 9 | Uncommitted changes | "Review changes: /vibe recent" |
| 10 | Clean state, nothing pending | "Session recovered. Start with /status to plan next work" |
| Knowledge injection fails silently | ao CLI not installed or no knowledge artifacts | Ensure ao installed: brew install ao. If no learnings exist, run /post-mortem to seed the knowledge base. |
| Suggested action doesn't match context | State-aware rules didn't capture edge case | Use --json to inspect raw state and verify which condition matched. Review priority table in Step 5. |
| JSON output malformed | Parallel bash calls returned unexpected format | Check each bash call individually. Ensure jq parsing works on actual data. Validate JSON structure before returning to user. |