Loading...
Loading...
Post-compaction context recovery. Detects in-progress RPI and evolve sessions, loads knowledge, shows recent work and pending tasks. Triggers: "recover", "lost context", "where was I", "what was I working on".
npx skill4agent add boshu2/agentops recoverPurpose: 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.
/recover # Full recovery dashboard
/recover --json # Machine-readable JSON outputif [ -f .agents/rpi/phased-state.json ]; then
echo "=== RPI_STATE ==="
cat .agents/rpi/phased-state.json
else
echo "RPI_STATE=NONE"
fiif [ -f .agents/evolve/cycle-history.jsonl ]; then
echo "=== EVOLVE_STATE ==="
tail -3 .agents/evolve/cycle-history.jsonl
else
echo "EVOLVE_STATE=NONE"
fiecho "=== GIT_STATUS ==="
git status --short
echo "=== GIT_LOG ==="
git log --oneline -5
echo "=== GIT_BRANCH ==="
git branch --show-currentif 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# 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"
fiif command -v ao &>/dev/null; then
ao inject --apply-decay --format markdown --max-tokens 2000
fi.agents/rpi/phased-state.jsongoalepic_idphasecyclestarted_at.agents/evolve/cycle-history.jsonlgoals_fixedresulttimestamp══════════════════════════════════════════════════════════════
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
══════════════════════════════════════════════════════════════| Priority | Condition | Suggestion |
|---|---|---|
| 1 | Unread messages in inbox | "Check messages: |
| 2 | RPI run in-progress + phase=research | "Continue research: |
| 3 | RPI run in-progress + phase=plan | "Review plan: |
| 4 | RPI run in-progress + phase=implement | "Resume implementation: |
| 5 | RPI run in-progress + phase=validate | "Complete cycle: |
| 6 | Evolve cycle in-progress | "Continue autonomous improvements: |
| 7 | In-progress issues exist | "Continue work: |
| 8 | Ready issues available | "Pick next issue: |
| 9 | Uncommitted changes | "Review changes: |
| 10 | Clean state, nothing pending | "Session recovered. Start with |
--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/recoverao inject/pre-mortem/recoverao inject/evolve --resume/recover/status| Problem | Cause | Solution |
|---|---|---|
| Shows "BD_UNAVAILABLE" or "GT_UNAVAILABLE" | CLI tools not installed or not in PATH | Install missing tools: |
| RPI state shows wrong phase | Stale phased-state.json not updated | Check timestamp of |
| Evolve history shows wrong cycle | Old cycle-history.jsonl entries not pruned | Tail -3 shows most recent entries. Check all entries with |
| Knowledge injection fails silently | ao CLI not installed or no knowledge artifacts | Ensure ao installed: |
| Suggested action doesn't match context | State-aware rules didn't capture edge case | Use |
| 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. |