crank
Original:🇺🇸 English
Translated
1 scripts
Fully autonomous epic execution. Runs until ALL children are CLOSED. Local mode uses /swarm with runtime-native spawning (Codex sub-agents or Claude teams). Distributed mode uses /swarm --mode=distributed (tmux + Agent Mail) for persistence and coordination. NO human prompts, NO stopping.
3installs
Sourceboshu2/agentops
Added on
NPX Install
npx skill4agent add boshu2/agentops crankTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Crank Skill
Quick Ref: Autonomous epic execution. Local mode:for each wave with runtime-native spawning. Distributed mode:/swarm(tmux + Agent Mail). Output: closed issues + final vibe./swarm --mode=distributed
YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.
Autonomous execution: implement all issues until the epic is DONE.
CLI dependencies: bd (issue tracking), ao (knowledge flywheel). Both optional — see for fallback table. If bd is unavailable, use TaskList for issue tracking and skip beads sync. If ao is unavailable, skip knowledge injection/extraction.
skills/shared/SKILL.mdArchitecture: Crank + Swarm
Beads mode (bd available):
Crank (orchestrator) Swarm (executor)
| |
+-> bd ready (wave issues) |
| |
+-> TaskCreate from beads --->+-> Select spawn backend (codex sub-agents | claude teams | fallback)
| |
+-> /swarm --->+-> Spawn workers per backend
| | (fresh context per wave)
+-> Verify + bd update <---+-> Workers report via backend channel
| |
+-> Loop until epic DONE <---+-> Cleanup backend resources after waveTaskList mode (bd unavailable):
Crank (orchestrator, TaskList mode) Swarm (executor)
| |
+-> TaskList() (wave tasks) |
| |
+-> /swarm --->+-> Select spawn backend per wave
| |
+-> Verify via TaskList() <---+-> Workers report via backend channel
| |
+-> Loop until all completed <---+-> Cleanup backend resources after waveSeparation of concerns:
- Crank = Orchestration, epic/task lifecycle, knowledge flywheel
- Swarm = Runtime-native parallel execution (Ralph Wiggum pattern via fresh worker set per wave)
Global Limits
MAX_EPIC_WAVES = 50 (hard limit across entire epic)
This prevents infinite loops on circular dependencies or cascading failures.
Why 50?
- Typical epic: 5-10 issues
- With retries: ~5 waves max
- 50 = safe upper bound
Completion Enforcement (The Sisyphus Rule)
THE SISYPHUS RULE: Not done until explicitly DONE.
After each wave, output completion marker:
- - Epic truly complete, all issues closed
<promise>DONE</promise> - - Cannot proceed (with reason)
<promise>BLOCKED</promise> - - Incomplete (with remaining items)
<promise>PARTIAL</promise>
Never claim completion without the marker.
Execution Steps
Given :
/crank [epic-id | plan-file.md | "description"]Step 0: Load Knowledge Context (ao Integration)
Search for relevant learnings before starting the epic:
bash
# If ao CLI available, inject prior knowledge about epic execution
if command -v ao &>/dev/null; then
# Search for relevant learnings
ao search "epic execution implementation patterns" 2>/dev/null | head -20
# Check flywheel status
ao flywheel status 2>/dev/null
# Get current ratchet state
ao ratchet status 2>/dev/null
fiIf ao not available, skip this step and proceed. The knowledge flywheel enhances but is not required.
Step 0.5: Detect Tracking Mode
bash
if command -v bd &>/dev/null; then
TRACKING_MODE="beads"
else
TRACKING_MODE="tasklist"
echo "Note: bd CLI not found. Using TaskList for issue tracking."
fiTracking mode determines the source of truth for the rest of the workflow:
| Beads Mode | TaskList Mode | |
|---|---|---|
| Source of truth | | TaskList (Claude-native) |
| Find work | | |
| Get details | | |
| Mark complete | | |
| Track retries | | Task description update |
| Epic tracking | | In-memory wave counter |
Step 1: Identify the Epic / Work Source
Beads mode:
If epic ID provided: Use it directly. Do NOT ask for confirmation.
If no epic ID: Discover it:
bash
bd list --type epic --status open 2>/dev/null | head -5If multiple epics found, ask user which one.
TaskList mode:
If input is an epic ID → Error: "bd CLI required for beads epic tracking. Install bd or provide a plan file / task list."
If input is a plan file path ():
.md- Read the plan file
- Decompose into TaskList tasks (one per distinct work item)
TaskCreate - Set up dependencies via
TaskUpdate(addBlockedBy) - Proceed to Step 3
If no input:
- Check for existing pending tasks
TaskList() - If tasks exist, use them as the work items
- If no tasks, ask user what to work on
If input is a description string:
- Decompose into tasks (for each)
TaskCreate - Set up dependencies
- Proceed to Step 3
Step 1a: Initialize Wave Counter
Beads mode:
bash
# Initialize crank tracking in epic notes
bd update <epic-id> --append-notes "CRANK_START: wave=0 at $(date -Iseconds)" 2>/dev/nullTaskList mode: Track wave counter in memory only. No external state needed.
Track in memory:
wave=0Step 2: Get Epic Details
Beads mode:
bash
bd show <epic-id> 2>/dev/nullTaskList mode: to see all tasks and their status/dependencies.
TaskList()Step 3: List Ready Issues (Current Wave)
Beads mode:
Find issues that can be worked on (no blockers):
bash
bd ready 2>/dev/nullbd readyTaskList mode:
TaskList()Step 3a: Pre-flight Check - Issues Exist
Verify there are issues to work on:
If 0 ready issues found (beads mode) or 0 pending unblocked tasks (TaskList mode):
STOP and return error:
"No ready issues found for this epic. Either:
- All issues are blocked (check dependencies)
- Epic has no child issues (run /plan first)
- All issues already completed"Also verify: epic has at least 1 child issue total. An epic with 0 children means /plan was not run.
Do NOT proceed with empty issue list - this produces false "epic complete" status.
Step 4: Execute Wave via Swarm
BEFORE each wave:
bash
wave=$((wave + 1))
WAVE_START_SHA=$(git rev-parse HEAD)
if [[ "$TRACKING_MODE" == "beads" ]]; then
bd update <epic-id> --append-notes "CRANK_WAVE: $wave at $(date -Iseconds)" 2>/dev/null
fi
# CHECK GLOBAL LIMIT
if [[ $wave -ge 50 ]]; then
echo "<promise>BLOCKED</promise>"
echo "Global wave limit (50) reached."
# STOP - do not continue
fiCross-cutting constraint injection (SDD):
Before spawning workers, check for cross-cutting constraints:
bash
# Guard clause: skip if plan has no boundaries (backward compat)
PLAN_FILE=$(ls -t .agents/plans/*.md 2>/dev/null | head -1)
if [[ -n "$PLAN_FILE" ]] && grep -q "## Boundaries" "$PLAN_FILE"; then
# Extract "Always" boundaries and convert to cross_cutting checks
# Read the plan's ## Cross-Cutting Constraints section or derive from ## Boundaries
# Inject into every TaskCreate's metadata.validation.cross_cutting
fi
# "Ask First" boundaries: in auto mode, log as annotation only (no blocking)
# In --interactive mode, prompt before proceedingWhen creating TaskCreate for each wave issue, include cross-cutting constraints in metadata:
json
{
"validation": {
"files_exist": [...],
"content_check": {...},
"cross_cutting": [
{"name": "...", "type": "content_check", "file": "...", "pattern": "..."}
]
}
}For wave execution details (beads sync, TaskList bridging, swarm invocation), read .
skills/crank/references/team-coordination.mdCross-cutting validation (SDD):
After per-task validation passes, run cross-cutting checks across all files modified in the wave:
bash
# Only if cross_cutting constraints were injected
if [[ -n "$CROSS_CUTTING_CHECKS" ]]; then
WAVE_FILES=$(git diff --name-only "${WAVE_START_SHA}..HEAD")
for check in $CROSS_CUTTING_CHECKS; do
run_validation_check "$check" "$WAVE_FILES"
done
fiStep 5: Verify and Sync to Beads (MANDATORY)
Swarm executes per-task validation (see). Crank trusts swarm validation and focuses on beads sync.skills/shared/validation-contract.md
For verification details, retry logic, and failure escalation, read and .
skills/crank/references/team-coordination.mdskills/crank/references/failure-recovery.mdStep 5.5: Wave Vibe Gate (MANDATORY)
Principle: Fresh context catches what saturated context misses. No self-grading.
For wave vibe gate details (diff computation, acceptance criteria, verdict gating), read .
skills/crank/references/wave-patterns.mdStep 5.7: Wave Checkpoint
After each wave completes (post-vibe-gate, pre-next-wave), write a checkpoint file:
bash
mkdir -p .agents/crank
cat > ".agents/crank/wave-${wave}-checkpoint.json" <<EOF
{
"wave": ${wave},
"timestamp": "$(date -Iseconds)",
"tasks_completed": $(echo "$COMPLETED_IDS" | jq -R 'split(" ")'),
"tasks_failed": $(echo "$FAILED_IDS" | jq -R 'split(" ")'),
"files_changed": $(git diff --name-only "${WAVE_START_SHA}..HEAD" | jq -R . | jq -s .),
"git_sha": "$(git rev-parse HEAD)"
}
EOF- /
COMPLETED_IDS: space-separated issue IDs from the wave results.FAILED_IDS - On retry of the same wave, the file is overwritten (same path).
- Checkpoint files are informational — no resume logic reads them yet (future work).
Step 6: Check for More Work
After completing a wave, check for newly unblocked issues (beads: , TaskList: ). Loop back to Step 4 if work remains, or proceed to Step 7 when done.
bd readyTaskList()For detailed check/retry logic, read .
skills/crank/references/team-coordination.mdStep 7: Final Batched Validation
When all issues complete, run ONE comprehensive vibe on recent changes. Fix CRITICAL issues before completion.
For detailed validation steps, read .
skills/crank/references/failure-recovery.mdStep 8: Extract Learnings (ao Integration)
If ao CLI available: run , , and to extract and review learnings. If ao unavailable, skip and recommend manually.
ao forge transcriptao flywheel statusao pool list --tier=pending/post-mortemStep 9: Report Completion
Tell the user:
- Epic ID and title
- Number of issues completed
- Total iterations used (of 50 max)
- Final vibe results
- Flywheel status (if ao available)
- Suggest running to review and promote learnings
/post-mortem
Output completion marker:
<promise>DONE</promise>
Epic: <epic-id>
Issues completed: N
Iterations: M/50
Flywheel: <status from ao flywheel status>If stopped early:
<promise>BLOCKED</promise>
Reason: <global limit reached | unresolvable blockers>
Issues remaining: N
Iterations: M/50The FIRE Loop
Crank follows FIRE (Find → Ignite → Reap → Vibe → Escalate) for each wave. Loop until all issues are CLOSED (beads) or all tasks are completed (TaskList).
For FIRE loop details, parallel wave models, and wave vibe gate, read .
skills/crank/references/wave-patterns.mdKey Rules
- Auto-detect tracking - check for at start; use TaskList if absent
bd - Plan files as input - decomposes plan into tasks automatically
/crank plan.md - If epic ID given, USE IT - don't ask for confirmation (beads mode only)
- Swarm for each wave - delegates parallel execution to swarm
- Fresh context per issue - swarm provides Ralph pattern isolation
- Batch validation at end - ONE vibe at the end saves context
- Fix CRITICAL before completion - address findings before reporting done
- Loop until done - don't stop until all issues closed / tasks completed
- Autonomous execution - minimize human prompts
- Respect wave limit - STOP at 50 waves (hard limit)
- Output completion markers - DONE, BLOCKED, or PARTIAL (required)
- Knowledge flywheel - load learnings at start, forge at end (ao optional)
- Beads ↔ TaskList sync - in beads mode, crank bridges beads issues to TaskList for swarm
Distributed Mode: Agent Mail Orchestration (Experimental)
Status: Experimental. Local mode (TaskList + swarm) is the recommended execution method.
For distributed mode details (architecture, execution steps, Chiron pattern, file reservations, checkpoint handling), read .
skills/crank/references/distributed-mode.mdReferences
- Wave patterns:
skills/crank/references/wave-patterns.md - Team coordination:
skills/crank/references/team-coordination.md - Failure recovery:
skills/crank/references/failure-recovery.md - Distributed mode:
skills/crank/references/distributed-mode.md - Agent Mail Protocol:
skills/shared/agent-mail-protocol.md - Parser (Go):
cli/internal/agentmail/