返回 Skills
boshu2/agentops· Apache-2.0 内容可用

ratchet

Record Brownian Ratchet gates.

安装

与 skills.sh 相同的 Command / Prompt 安装方式


name: ratchet description: Record Brownian Ratchet gates. practices:

  • dora-metrics
  • refactoring
  • continuous-integration hexagonal_role: domain consumes:
  • validate
  • vibe
  • post-mortem produces:
  • .agents/rpi/*.md context_rel:
  • kind: shared-kernel with: standards skill_api_version: 1 user-invocable: false context: window: isolated intent: mode: none sections: exclude:
    • HISTORY
    • INTEL
    • TASK intel_scope: none metadata: tier: background dependencies: [] internal: true output_contract: 'stdout: gate check result'

Ratchet Skill

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.

The Brownian Ratchet

Progress = Chaos × Filter → Ratchet
PhaseWhat Happens
ChaosMultiple attempts (exploration, implementation)
FilterValidation gates (tests, /vibe, review)
RatchetLock progress permanently (merged, closed, stored)

Key insight: Progress is permanent. You can't un-ratchet.

Execution Steps

Given /ratchet [command]:

status - Check Current State

ao ratchet status 2>/dev/null

Or check the chain manually:

cat .agents/ao/chain.jsonl 2>/dev/null | tail -10

check [step] - Verify Gate

ao ratchet check <step> 2>/dev/null

Steps: research, plan, implement, vibe, post-mortem

record [step] - Record Completion

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

skip [step] - Skip Intentionally

ao ratchet skip <step> --reason "<why>" 2>/dev/null

Workflow Steps

StepGateOutput
researchResearch artifact exists.agents/research/*.md
planPlan artifact exists.agents/plans/*.md
implementCode + tests passSource files
vibe/vibe passes.agents/vibe/*.md
post-mortemLearnings extracted.agents/learnings/*.md

Chain Storage

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"}

Key Rules

  • Progress is permanent - can't un-ratchet
  • Gates must pass - validate before proceeding
  • Record everything - maintain the chain
  • Skip explicitly - document why if skipping a step

Examples

Check RPI Progress

User says: /ratchet status

What happens:

  1. Agent calls ao ratchet status 2>/dev/null to check current state
  2. CLI reads .agents/ao/chain.jsonl and parses progress
  3. Agent reports which steps are completed, in-progress, or pending
  4. Agent shows output artifact paths for completed steps
  5. Agent identifies next gate to pass

Result: Single-screen view of RPI workflow progress, showing which gates passed and what's next.

Record Step Completion

Skill says: After /research completes

What happens:

  1. Agent calls ao ratchet record research --output ".agents/research/auth.md"
  2. CLI appends completion entry to .agents/ao/chain.jsonl
  3. Agent locks research step as permanently completed
  4. Agent proceeds to plan phase knowing research gate passed

Result: Progress permanently recorded, gate locked, workflow advances without backsliding.

Troubleshooting

ProblemCauseSolution
ao ratchet status failsao CLI not available or chain.jsonl missingManually check .agents/ao/chain.jsonl or create empty file
Step already completed errorAttempting to re-ratchet locked stepUse ao ratchet status to check state; skip if already done
chain.jsonl corruptedMalformed JSON entriesManually edit to fix JSON; validate each line with jq -c '.' <file>
Out-of-order stepsImplementing before planningFollow RPI order strictly; use --skip only with explicit reason

Reference Documents

  • references/ratchet.feature — Executable spec: Chaos×Filter→Ratchet, record/check loop-step gates, monotonic chain (soc-qk4b.2)

附带文件

references/.gitkeep
references/ratchet.feature
# Executable spec for the /ratchet skill — permanent progress gates (BC3 Loop).
# /ratchet is the Brownian Ratchet: Chaos × Filter → Ratchet. It records passed
# loop-step gates to .agents/ao/chain.jsonl so progress is locked and monotonic —
# you cannot un-ratchet. Hexagon: domain; consumes validation, vibe, post-mortem
# (the filter outputs it locks); produces .agents/rpi/*.md + chain entries. (soc-qk4b.2)

Feature: Ratchet locks loop progress permanently
  As the loop's progress lock
  I want passed gates recorded to a monotonic chain
  So that progress is permanent — chaos is filtered, then ratcheted, never undone

  Scenario: Chaos is filtered, then ratcheted
    Given multiple attempts (chaos) that pass their validation gate (filter)
    When the gate result is ratcheted
    Then the progress is locked permanently in the chain

  Scenario: A passed gate is recorded to the chain
    When /ratchet records a completed step (research, plan, implement, vibe, post-mortem)
    Then a chain entry is appended to .agents/ao/chain.jsonl with step, status, and output

  Scenario: Gate state is checkable before advancing
    When /ratchet checks a step
    Then it reports whether that gate is satisfied
    And the loop does not advance past an unsatisfied required gate

  Scenario: A recorded gate cannot be un-ratcheted
    Given a step already recorded as completed in the chain
    Then progress is monotonic — the recorded gate is not reversed
scripts/validate.sh
#!/usr/bin/env bash
set -euo pipefail
SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)"
PASS=0; FAIL=0
check() { if bash -c "$2"; then echo "PASS: $1"; PASS=$((PASS + 1)); else echo "FAIL: $1"; FAIL=$((FAIL + 1)); fi; }

check "SKILL.md exists" "[ -f '$SKILL_DIR/SKILL.md' ]"
check "SKILL.md has YAML frontmatter" "head -1 '$SKILL_DIR/SKILL.md' | grep -q '^---$'"
check "name is ratchet" "grep -q '^name: ratchet' '$SKILL_DIR/SKILL.md'"
check "mentions gates" "grep -qi 'gates' '$SKILL_DIR/SKILL.md'"
check "mentions progress" "grep -qi 'progress' '$SKILL_DIR/SKILL.md'"
check "mentions record" "grep -qi 'record' '$SKILL_DIR/SKILL.md'"
check "mentions chain storage" "grep -q 'chain' '$SKILL_DIR/SKILL.md'"

echo ""; echo "Results: $PASS passed, $FAIL failed"
[ $FAIL -eq 0 ] && exit 0 || exit 1
    ratchet | Prompt Minder