Loading...
Loading...
Ralph Wiggum-inspired automation loop for specification-driven development. Orchestrates task implementation, review, cleanup, and synchronization using a Python script. Use when: user runs /loop command, user asks to automate task implementation, user wants to iterate through spec tasks step-by-step, or user wants to run development workflow automation with context window management. One step per invocation. State machine: init → choose_task → implementation → review → fix → cleanup → sync → update_done. Supports --from-task and --to-task for task range filtering. State persisted in fix_plan.json.
npx skill4agent add giuseppe-trisciuoglio/developer-kit ralph-loopBashralph_loop.py/specs:task-implementationfix_plan.jsonfix_plan.jsonralph_loop.py/loop┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ ralph_loop.py │────▶│ fix_plan.json │────▶│ User executes │
│ (orchestrator)│ │ (state file) │ │ command in CLI │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
│ ▼
│ ┌─────────────────┐
└──────────────────────────────────────│ Task result │
│ (success/ │
│ failure) │
└─────────────────┘ralph_loop.py --action=loopfix_plan.json/specs:task-implementationralph_loop.py --action=loopfix_plan.json state machine:
┌─────────────────────────────────────────────────────────────┐
│ state: "init" │
│ → --action=start: Initialize fix_plan.json │
│ → Load tasks from tasks/TASK-*.md files │
│ → Apply task_range filter │
│ │
│ state: "choose_task" │
│ → Pick next pending task (within range, deps satisfied)│
│ → No tasks in range → state: "complete" │
│ → Task found → state: "implementation" │
│ │
│ state: "implementation" │
│ → Show /specs:task-implementation command │
│ → User executes, then runs loop again │
│ → Next state: "review" │
│ │
│ state: "review" │
│ → Show /specs:task-review command │
│ → User reviews results, then runs loop again │
│ → Issues found → state: "fix" (retry ≤ 3) │
│ → Clean → state: "cleanup" │
│ │
│ state: "fix" │
│ → Show commands to fix issues │
│ → User applies fixes, then runs loop again │
│ → Next state: "review" │
│ │
│ state: "cleanup" │
│ → Show /developer-kit-specs:specs-code-cleanup command│
│ → Next state: "sync" │
│ │
│ state: "sync" │
│ → Show /specs:spec-sync-with-code command │
│ → Next state: "update_done" │
│ │
│ state: "update_done" │
│ → Mark task done, commit git changes │
│ → Re-evaluate dependencies │
│ → state: "choose_task" │
│ │
│ state: "complete" | "failed" │
│ → Print result, stop │
└─────────────────────────────────────────────────────────────┘fix_plan.jsondocs/specs/[ID-feature]/_ralph_loop/fix_plan.jsonfix_plan.json_ralph_loop/--action=startfix_plan.jsonpython3 plugins/developer-kit-specs/skills/ralph-loop/scripts/ralph_loop.py \
--action=start \
--spec=docs/specs/001-feature/ \
--from-task=TASK-036 \
--to-task=TASK-041--action=looppython3 plugins/developer-kit-specs/skills/ralph-loop/scripts/ralph_loop.py \
--action=loop \
--spec=docs/specs/001-feature/python3 plugins/developer-kit-specs/skills/ralph-loop/scripts/ralph_loop.py \
--action=next \
--spec=docs/specs/001-feature/fix_plan.jsonimplementationreview--action=statuspython3 plugins/developer-kit-specs/skills/ralph-loop/scripts/ralph_loop.py \
--action=status \
--spec=docs/specs/001-feature/python3 plugins/developer-kit-specs/skills/ralph-loop/scripts/ralph_loop.py \
--action=start \
--spec=docs/specs/001-feature/ \
--from-task=TASK-036 \
--to-task=TASK-041 \
--agent=claudepython3 plugins/developer-kit-specs/skills/ralph-loop/scripts/ralph_loop.py \
--action=loop \
--spec=docs/specs/001-feature/python3 plugins/developer-kit-specs/skills/ralph-loop/scripts/ralph_loop.py \
--action=status \
--spec=docs/specs/001-feature/| Argument | Description |
|---|---|
| |
| Spec folder path (e.g. |
| Start of task range (e.g. |
| End of task range (e.g. |
| Default agent: |
| Skip git commits (for testing) |
--action=starttasks/TASK-*.md--from-task--to-taskfix_plan.jsonchoose_taskfix_plan.jsoncurrent_taskimplementation→ Implementation: TASK-037
Execute:
/specs:task-implementation --task=TASK-037
After execution, update state:
python3 ralph_loop.py --action=loop --spec=docs/specs/001-feature/review→ Review: TASK-037 | Retry: 0/3
Execute:
/specs:task-review --task=TASK-037
Review the generated review report, then update state:
python3 ralph_loop.py --action=loop --spec=docs/specs/001-feature/fixcleanup→ Cleanup: TASK-037
Execute:
/developer-kit-specs:specs-code-cleanup --task=TASK-037sync→ Sync: TASK-037
Execute:
/specs:spec-sync-with-code docs/specs/001-feature/ --after-task=TASK-037update_donefix_plan.json--no-commitchoose_taskpython3 ralph_loop.py --action=start --spec=... --agent=codex---
id: TASK-036
title: Refactor user service
status: pending
lang: java
agent: codex
---claudecodexcopilotkimigeminiglm4minimax/loop 5m python3 plugins/developer-kit-specs/skills/ralph-loop/scripts/ralph_loop.py \
--action=loop \
--spec=docs/specs/001-feature//specs:ralph-looptasks/TASK-XXX.md---
id: TASK-036
title: Implement user authentication
status: pending
lang: java
dependencies: []
complexity: medium
agent: claude
---
## Description
Implement JWT-based authentication for the API.
## Acceptance Criteria
- [ ] Login endpoint returns JWT token
- [ ] Token validation middleware
- [ ] Refresh token mechanism# Initialize
python3 ralph_loop.py --action=start \
--spec=docs/specs/001-feature/ \
--from-task=TASK-001 \
--to-task=TASK-005
# Loop until complete
while true; do
python3 ralph_loop.py --action=loop --spec=docs/specs/001-feature/
# Execute the shown command manually
# Then continue loop
done# Start with specific range
/loop 5m python3 plugins/developer-kit-specs/skills/ralph-loop/scripts/ralph_loop.py \
--action=loop \
--spec=docs/specs/002-tdd-command \
--from-task=TASK-001 \
--to-task=TASK-010# Initialize with Claude as default
python3 ralph_loop.py --action=start \
--spec=docs/specs/001-feature/ \
--agent=claude
# Some tasks have "agent: codex" in their frontmatter
# Those will show Codex-formatted commandsfix_plan.jsonfix_plan.jsontask_rangestate.stepinitchoose_taskimplementationreviewfixcleanupsyncupdate_donecompletefailed--action=startpython3 ralph_loop.py --action=start --spec=docs/specs/001-feature/fix_plan.jsondocs/specs/001-feature/_ralph_loop/fix_plan.json# Manual migration if needed
mkdir -p docs/specs/001-feature/_ralph_loop
mv docs/specs/001-feature/fix_plan.json docs/specs/001-feature/_ralph_loop/fix_plan.json--action=startpython3 ralph_loop.py --action=start --spec=docs/specs/001-feature/tasks/TASK-XXX.md--agentagent:references/state-machine.mdreferences/multi-cli-integration.mdreferences/loop-prompt-template.md