Brownian Ratchet progress gates for RPI workflow. Check, record, verify. Triggers: "check gate", "verify progress", "ratchet status".
Track progress through the RPI workflow with permanent gates.
Note: $ratchet tracks and locks progress. It does not “run the loop” by itself—pair it with $crank (epic loop) or $swarm (Ralph loop) to actually execute work.
Progress = Chaos × Filter → Ratchet
| Phase | What Happens |
|---|---|
| Chaos | Multiple attempts (exploration, implementation) |
| Filter | Validation gates (tests, $vibe, review) |
| Ratchet | Lock progress permanently (merged, closed, stored) |
Key insight: Progress is permanent. You can't un-ratchet.
Given $ratchet [command]:
ao ratchet status 2>/dev/null
Or check the chain manually:
cat .agents/ao/chain.jsonl 2>/dev/null | tail -10
ao ratchet check <step> 2>/dev/null
Steps: research, plan, implement, vibe, post-mortem
ao ratchet record <step> --output "<artifact-path>" 2>/dev/null
Or record manually by writing to chain:
echo '{"step":"<step>","status":"completed","output":"<path>","time":"<ISO-timestamp>"}' >> .agents/ao/chain.jsonl
ao ratchet skip <step> --reason "<why>" 2>/dev/null
| Step | Gate | Output |
|---|---|---|
research | Research artifact exists | .agents/research/*.md |
plan | Plan artifact exists | .agents/plans/*.md |
implement | Code + tests pass | Source files |
vibe | $vibe passes | .agents/vibe/*.md |
post-mortem | Learnings extracted | .agents/learnings/*.md |
Progress stored in .agents/ao/chain.jsonl:
{"step":"research","status":"completed","output":".agents/research/auth.md","time":"2026-01-25T10:00:00Z"}
{"step":"plan","status":"completed","output":".agents/plans/auth-plan.md","time":"2026-01-25T11:00:00Z"}
{"step":"implement","status":"in_progress","time":"2026-01-25T12:00:00Z"}
User says: $ratchet status
What happens:
ao ratchet status 2>/dev/null to check current state.agents/ao/chain.jsonl and parses progressResult: Single-screen view of RPI workflow progress, showing which gates passed and what's next.
Skill says: After $research completes
What happens:
ao ratchet record research --output ".agents/research/auth.md".agents/ao/chain.jsonlResult: Progress permanently recorded, gate locked, workflow advances without backsliding.
| Problem | Cause | Solution |
|---|---|---|
| ao ratchet status fails | ao CLI not available or chain.jsonl missing | Manually check .agents/ao/chain.jsonl or create empty file |
| Step already completed error | Attempting to re-ratchet locked step | Use ao ratchet status to check state; skip if already done |
| chain.jsonl corrupted | Malformed JSON entries | Manually edit to fix JSON; validate each line with jq -c '.' <file> |
| Out-of-order steps | Implementing before planning | Follow RPI order strictly; use --skip only with explicit reason |
scripts/validate.sh