rpi
npx skills add https://github.com/boshu2/agentops --skill rpi
Agent 安装分布
Skill 文档
/rpi â Full RPI Lifecycle Orchestrator
Quick Ref: One command, full lifecycle. Discovery â Implementation â Validation. The session is the lead; sub-skills manage their own teams.
YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.
Quick Start
/rpi "add user authentication" # full lifecycle
/rpi --interactive "add user authentication" # human gates in discovery only
/rpi --from=discovery "add auth" # resume discovery
/rpi --from=implementation ag-23k # skip to crank with existing epic
/rpi --from=validation # run vibe + post-mortem only
/rpi --loop --max-cycles=3 "add auth" # optional iterate-on-fail loop
/rpi --test-first "add auth" # pass --test-first to /crank
Architecture
/rpi <goal | epic-id> [--from=<phase>] [--interactive]
â (session = lead, no TeamCreate)
â
âââ Phase 1: Discovery
â âââ /research
â âââ /plan
â âââ /pre-mortem (gate)
â
âââ Phase 2: Implementation
â âââ /crank (autonomous execution)
â
âââ Phase 3: Validation
âââ /vibe (gate)
âââ /post-mortem (retro + flywheel)
Human gates (default): 0 â fully autonomous.
Human gates (--interactive): discovery approvals in /research and /plan.
Retry gates: pre-mortem FAIL â re-plan, implementation BLOCKED/PARTIAL â re-crank, vibe FAIL â re-crank (max 3 attempts each).
Optional loop (--loop): post-mortem FAIL can spawn another RPI cycle.
Phase Data Contracts
All phase transitions use filesystem-based artifacts (no in-memory coupling):
| Transition | Key Artifacts | How Next Phase Reads Them |
|---|---|---|
| Start -> Discovery | Goal string | Passed as argument to /research |
| Discovery -> Implementation | Epic ID, pre-mortem verdict, phase-1 summary | phased-state.json + .agents/rpi/phase-1-summary-*.md |
| Implementation -> Validation | Crank completion status, phase-2 summary | bd children <epic-id> + .agents/rpi/phase-2-summary-*.md |
| Validation -> Next Cycle (optional) | Vibe/post-mortem verdicts, harvested follow-up work | Council reports + .agents/rpi/next-work.jsonl |
Execution Steps
Given /rpi <goal | epic-id> [--from=<phase>] [--interactive]:
Step 0: Setup
mkdir -p .agents/rpi
Determine starting phase:
- default:
discovery --from=implementation(alias:crank)--from=validation(aliases:vibe,post-mortem)- aliases
research,plan, andpre-mortemmap todiscovery
If input looks like an epic ID (ag-*) and --from is not set, start at implementation.
Initialize state:
rpi_state = {
goal: "<goal string>",
epic_id: null,
phase: "<discovery|implementation|validation>",
auto: <true unless --interactive>,
test_first: <true if --test-first>,
complexity: null,
cycle: 1,
parent_epic: null,
verdicts: {}
}
Phase 1: Discovery
Discovery is one context window that runs research, planning, and pre-mortem together:
/research <goal> [--auto]
/plan <goal> [--auto]
/pre-mortem
After discovery completes:
- Extract epic ID from
bd list --type epic --status openand store inrpi_state.epic_id. - Extract pre-mortem verdict (PASS/WARN/FAIL) from latest pre-mortem council report.
- Store verdict in
rpi_state.verdicts.pre_mortem. - Write summary to
.agents/rpi/phase-1-summary-YYYY-MM-DD-<goal-slug>.md. - Record ratchet and telemetry:
ao ratchet record research 2>/dev/null || true
bash scripts/checkpoint-commit.sh rpi "phase-1" "discovery complete" 2>/dev/null || true
bash scripts/log-telemetry.sh rpi phase-complete phase=1 phase_name=discovery 2>/dev/null || true
Gate behavior:
- PASS/WARN: proceed to implementation.
- FAIL: re-run
/planwith findings context (top 5 structured findings: description, fix, ref), then/pre-mortemagain. Max 3 total attempts. If still FAIL after 3, stop and require manual intervention.
Phase 2: Implementation
Requires rpi_state.epic_id.
/crank <epic-id> [--test-first]
After implementation completes:
- Check completion via crank output / epic child statuses.
- Gate result:
- DONE: proceed to validation
- BLOCKED: re-run
/crankwith block context (max 3 total attempts). If still BLOCKED, stop and require manual intervention. - PARTIAL: re-run
/crankwith epic-id; it picks up unclosed issues (max 3 total attempts). If still PARTIAL, stop and require manual intervention.
- Write summary to
.agents/rpi/phase-2-summary-YYYY-MM-DD-<goal-slug>.md. - Record ratchet and telemetry:
ao ratchet record implement 2>/dev/null || true
bash scripts/checkpoint-commit.sh rpi "phase-2" "implementation complete" 2>/dev/null || true
bash scripts/log-telemetry.sh rpi phase-complete phase=2 phase_name=implementation 2>/dev/null || true
Phase 3: Validation
Validation runs final review and lifecycle close-out:
/vibe recent # use --quick recent for low/medium complexity
/post-mortem <epic-id> # use --quick for low/medium complexity
After validation completes:
- Extract vibe verdict and store
rpi_state.verdicts.vibe. - If present, extract post-mortem verdict and store
rpi_state.verdicts.post_mortem. - Gate result:
- PASS/WARN: finish RPI
- FAIL: re-run implementation with findings, then re-run validation (max 3 total attempts)
- Write summary to
.agents/rpi/phase-3-summary-YYYY-MM-DD-<goal-slug>.md. - Record ratchet and telemetry:
ao ratchet record vibe 2>/dev/null || true
bash scripts/checkpoint-commit.sh rpi "phase-3" "validation complete" 2>/dev/null || true
bash scripts/log-telemetry.sh rpi phase-complete phase=3 phase_name=validation 2>/dev/null || true
Optional loop (--loop): If post-mortem verdict is FAIL and --loop is enabled, extract 3 concrete fixes from the report and re-invoke /rpi from Phase 1 with a tightened goal (up to --max-cycles total cycles). PASS/WARN stops the loop.
Optional spawn-next (--spawn-next): After a PASS/WARN finish, read .agents/rpi/next-work.jsonl for harvested follow-up items. Report them to the user with a suggested next /rpi command but do NOT auto-invoke.
Step Final: Report
Read references/report-template.md for the final output format and next-work handoff pattern.
Read references/error-handling.md for failure semantics and retries.
Complexity-Aware Ceremony
RPI automatically classifies each goal’s complexity at startup and adjusts the ceremony accordingly. This prevents trivial tasks from paying the full validation overhead of a refactor.
Classification Levels
| Level | Criteria | Behavior |
|---|---|---|
fast |
Goal â¤30 chars, no complex/scope keywords | Skips Phase 3 (validation). Runs discovery â implementation only. |
standard |
Goal 31â120 chars, or 1 scope keyword | Full 3-phase lifecycle. Gates use --quick shortcuts. |
full |
Complex-operation keyword (refactor, migrate, rewrite, â¦), 2+ scope keywords, or >120 chars | Full 3-phase lifecycle. Gates use full council (no shortcuts). |
Keyword Signals
Complex-operation keywords (trigger full): refactor, migrate, migration, rewrite, redesign, rearchitect, overhaul, restructure, reorganize, decouple, deprecate, split, extract module, port
Scope keywords (1 â standard; 2+ â full): all, entire, across, everywhere, every file, every module, system-wide, global, throughout, codebase
All keywords are matched as whole words to prevent false positives (e.g. “support” does not match “port”).
Logged Output
At RPI start you will see:
RPI mode: rpi-phased (complexity: fast)
Complexity: fast â skipping validation phase (phase 3)
or for standard/full:
RPI mode: rpi-phased (complexity: standard)
The complexity level is persisted in .agents/rpi/phased-state.json as the complexity field.
Override
--fast-path: force fast-path regardless of classification (useful for quick patches).--deep: force full-ceremony regardless of classification (useful for sensitive changes).
Flags
| Flag | Default | Description |
|---|---|---|
--from=<phase> |
discovery |
Start from discovery, implementation, or validation (aliases accepted) |
--interactive |
off | Enable human gates in discovery (/research, /plan) |
--auto |
on | Legacy flag; autonomous is default |
--loop |
off | Enable post-mortem FAIL loop into next cycle |
--max-cycles=<n> |
1 |
Max cycle count when --loop is enabled |
--spawn-next |
off | Surface harvested follow-up work after post-mortem |
--test-first |
off | Pass --test-first to /crank |
--fast-path |
auto | Force low-complexity gate mode (--quick) |
--deep |
auto | Force high-complexity gate mode (full council) |
--dry-run |
off | Report actions without mutating next-work queue |
Examples
Full Lifecycle
User says: /rpi "add user authentication"
What happens:
- Discovery runs
/research,/plan,/pre-mortemand produces epicag-5k2. - Implementation runs
/crank ag-5k2until children are complete. - Validation runs
/vibethen/post-mortem, extracts learnings, and suggests next work.
Resume from Implementation
User says: /rpi --from=implementation ag-5k2
What happens:
- Skips discovery.
- Runs
/crank ag-5k2. - Runs validation (
/vibe+/post-mortem).
Interactive Discovery
User says: /rpi --interactive "refactor payment module"
What happens:
- Discovery runs with human gates in
/researchand/plan. - Implementation and validation remain autonomous.
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| Supervisor spiraled branch count | Detached HEAD healing or legacy codex/auto-rpi-* naming created detached branches |
Keep --detached-heal off for supervisor mode (default), prefer detached worktree execution, then use external operator cleanup controls to preview and prune stale branches/worktrees. |
| Discovery retries hit max attempts | Plan has unresolved risks | Review pre-mortem findings, re-run /rpi --from=discovery |
| Implementation retries hit max attempts | Epic has blockers or unresolved dependencies | Inspect bd show <epic-id>, fix blockers, re-run /rpi --from=implementation |
| Validation retries hit max attempts | Vibe found critical defects repeatedly | Apply findings, re-run /rpi --from=validation |
| Missing epic ID at implementation start | Discovery did not produce a parseable epic | Verify latest open epic with bd list --type epic --status open |
| Large-repo context pressure | Too much context in one window | Use references/context-windowing.md and summarize phase outputs aggressively |
Emergency control (external operator loop)
Use external operator controls from a terminal to cancel in-flight runs and
clean stale worktrees/branches. Keep these controls out-of-band from /rpi
skill chaining.
See Also
skills/research/SKILL.mdâ discovery explorationskills/plan/SKILL.mdâ discovery decompositionskills/pre-mortem/SKILL.mdâ discovery risk gateskills/crank/SKILL.mdâ implementation executionskills/vibe/SKILL.mdâ validation gateskills/post-mortem/SKILL.mdâ validation close-out