Full-cycle feature development with continuous iteration through all spec-driven workflow phases (Research → Specify → Plan → Work → Review) until feature is complete.
Orchestrates full-cycle feature development through continuous Research, Specify, Plan, Work, and Review iterations until completion.
/plugin marketplace add v1truv1us/ai-eng-system/plugin install ai-eng-system@ai-eng-marketplaceExecute complete feature development cycle: $ARGUMENTS
Phase 0-5 of Spec-Driven Workflow: Orchestrates Research → Specify → Plan → Work → Review in continuous loop
Take a deep breath and orchestrate this complex multi-phase workflow systematically. Manage iteration cycles, track progress across all phases, and ensure comprehensive quality at each stage.
This workflow handles complete feature development from research to review. Poor orchestration leads to wasted cycles, incomplete phases, and features that fail quality gates. This orchestration task is critical for ensuring features are developed thoroughly and meet all requirements.
I bet you can't manage continuous iteration across all workflow phases without getting stuck in loops. The challenge is knowing when to advance to next phase versus when to return for refinement, balancing persistence with efficiency. Success means feature completes all requirements, passes all quality gates, and doesn't exceed reasonable iteration limits.
# Full-cycle feature development
/ai-eng/ralph-wiggum "implement user authentication with JWT tokens"
# Start from existing specification
/ai-eng/ralph-wiggum "user authentication" --from-spec=specs/auth/spec.md
# Start from existing plan (skip research and specify)
/ai-eng/ralph-wiggum "user authentication" --from-plan=specs/auth/plan.md
# With checkpoints for manual review
/ai-eng/ralph-wiggum "user authentication" --checkpoint=all
# Resume interrupted build
/ai-eng/ralph-wiggum "user authentication" --resume
# Dry run to see execution plan
/ai-eng/ralph-wiggum "user authentication" --dry-run
| Option | Type | Default | Description |
|---|---|---|---|
--max-cycles <n> | number | 5 | Maximum full workflow cycles |
--max-phase-iterations <n> | number | 10 | Max iterations per phase |
--checkpoint | string | none | Pause points: all, review, or none |
--from-research <path> | path | - | Start from existing research document |
--from-spec <path> | path | - | Start from existing specification |
--from-plan <path> | path | - | Start from existing plan |
--skip-research | boolean | false | Skip research phase entirely |
--quality-gate <command> | command | - | Custom quality gate command |
--completion-promise <text> | string | (see below) | Custom completion criteria |
--show-progress | boolean | true | Show detailed cycle progress |
--log-history <file> | path | - | Log all iterations to JSON |
--verbose | boolean | false | Enable verbose output |
--quiet | boolean | false | Minimal output (milestones only) |
--dry-run | boolean | false | Show plan without executing |
--resume | boolean | false | Resume from last checkpoint |
--parallel | boolean | false | Run phases in parallel where safe |
--refine-each-phase | boolean | false | Re-invoke prompt-refinement at each phase (interactive mode) |
Default Completion Promise:
"Feature is complete: all acceptance criteria met, quality gates passing, review approved, documentation updated"
Load skills/prompt-refinement/SKILL.md and use phase: plan to transform your prompt into structured TCRO format (Task, Context, Requirements, Output). Ask clarifying questions if feature description, acceptance criteria, technical approach, or quality gates are unclear.
Store the refined output as $REFINED_CONTEXT - this will be used for ALL subsequent phases without re-invoking prompt-refinement.
After Phase 0 completes:
--refine-each-phase is set)--checkpoint flag is explicitly setThis enables overnight/unattended execution as intended by the Ralph Wiggum pattern.
Action: Create and checkout feature branch
git checkout -b feat/[feature-slug]
Feature Slug Generation:
Example: "user authentication with JWT" → feat/user-authentication-jwt
Acceptance:
This is the core Ralph Wiggum pattern - continuous iteration until completion.
Before starting each cycle, verify:
cycle > maxCycles, stop and report completion status--resume): Load from .ralph-wiggum/[feature]/checkpoint.jsonCycle Start Output:
🔄 Ralph Wiggum Cycle 1/5 for "user authentication"
Goal: Gather context, patterns, and technical guidance
Context: Use $REFINED_CONTEXT from Phase 0. Do NOT re-invoke prompt-refinement unless --refine-each-phase is set.
Execute:
/ai-eng/research "$FEATURE_DESCRIPTION" \
--ralph \
--ralph-max-iterations $MAX_PHASE_ITERATIONS \
--ralph-completion-promise "Research is comprehensive and complete" \
--show-progress
If --from-research provided: Skip this phase, use existing document
Acceptance:
docs/research/[date]-[feature].mdCheckpoint (if --checkpoint=all): Pause and ask for approval before proceeding
→ CONTINUE: Immediately proceed to Phase 2.3 (Specify) without waiting for user input.
Goal: Create detailed specification with user stories and acceptance criteria
Context: Use $REFINED_CONTEXT from Phase 0. Do NOT re-invoke prompt-refinement unless --refine-each-phase is set.
Execute:
# If research was generated
/ai-eng/specify "$FEATURE_DESCRIPTION" \
--from-research=$RESEARCH_OUTPUT \
--ralph \
--ralph-max-iterations $MAX_PHASE_ITERATIONS \
--ralph-completion-promise "Specification is complete and ready for implementation" \
--show-progress
# If starting from existing spec, skip
If --from-spec provided: Skip this phase, use existing document
Acceptance:
specs/[feature]/spec.md[NEEDS CLARIFICATION] markers (or marked as resolved)Checkpoint (if --checkpoint=all): Pause and ask for approval
→ CONTINUE: Immediately proceed to Phase 2.4 (Plan) without waiting for user input.
Goal: Create implementation plan with tasks and dependencies
Context: Use $REFINED_CONTEXT from Phase 0. Do NOT re-invoke prompt-refinement unless --refine-each-phase is set.
Execute:
# If spec was generated
/ai-eng/plan \
--from-spec=$SPEC_OUTPUT \
--ralph \
--ralph-max-iterations $MAX_PHASE_ITERATIONS \
--ralph-completion-promise "Plan is comprehensive and ready for execution" \
--show-progress
# If starting from existing plan, skip
If --from-plan provided: Skip this phase, use existing document
Acceptance:
specs/[feature]/plan.mdCheckpoint (if --checkpoint=all): Pause and ask for approval
→ CONTINUE: Immediately proceed to Phase 2.5 (Work) without waiting for user input.
Goal: Implement feature with TDD, quality gates, and iterative refinement
Context: Use $REFINED_CONTEXT from Phase 0. Do NOT re-invoke prompt-refinement unless --refine-each-phase is set.
Execute:
/ai-eng/work $PLAN_OUTPUT \
--ralph \
--ralph-max-iterations $MAX_PHASE_ITERATIONS \
--ralph-completion-promise "$COMPLETION_PROMISE" \
--ralph-quality-gate="$QUALITY_GATE" \
--ralph-show-progress \
--show-progress
Quality Gates (default):
npm test && npm run lint && npm run build
Custom Quality Gate: If --quality-gate provided, use that command
Acceptance:
Checkpoint (if --checkpoint=all or --checkpoint=review): Pause and ask for approval
→ CONTINUE: Immediately proceed to Phase 2.6 (Review) without waiting for user input.
Goal: Comprehensive multi-perspective code review
Context: Use $REFINED_CONTEXT from Phase 0. Do NOT re-invoke prompt-refinement unless --refine-each-phase is set.
Execute:
/ai-eng/review . \
--ralph \
--ralph-max-iterations $MAX_PHASE_ITERATIONS \
--ralph-completion-promise "Review is comprehensive and complete" \
--show-progress
Acceptance:
code-review-report.json (or similar)Checkpoint (if --checkpoint=all or --checkpoint=review): Pause and ask for approval
→ CONTINUE: Immediately proceed to Phase 3 (Gap Analysis) without waiting for user input.
After review phase completes, analyze findings to determine next action:
Read the review report output from phase 2.6
Categorize findings:
| Review Finding Type | Severity | Return To | Rationale |
|---|---|---|---|
| Missing requirements | Any | SPECIFY | Spec needs enhancement |
| Unclear acceptance criteria | Any | SPECIFY | Spec needs clarification |
| Architectural issues | Major/Critical | PLAN | Plan needs restructuring |
| Missing dependencies | Any | PLAN | Plan incomplete |
| Implementation bugs | Any | WORK | Code needs fixing |
| Test coverage gaps | Any | WORK | Tests need adding |
| Documentation gaps | Minor | WORK | Docs need updating |
| Security vulnerabilities | Critical | PLAN | May need architectural change |
| Security vulnerabilities | Major/Minor | WORK | Implementation fix |
| Performance issues | Critical | PLAN | May need architectural change |
| Performance issues | Major/Minor | WORK | Implementation optimization |
Check if completion criteria met:
If ALL criteria met: Proceed to Phase 5 (Create PR)
If NOT all criteria met: Continue to next cycle (Phase 2.1)
If continuing to next cycle, identify which phase to return to:
Based on gap analysis from 3.1:
Decision:
┌─────────────────────────────────────────┐
│ Gap Analysis: SPECIFY gaps found │
└─────────────────────────────────────────┘
│
▼
Return to SPECIFY phase
Log decision for visibility:
📊 Gap Analysis:
- 3 SPECIFY gaps found (missing requirements)
- 0 PLAN gaps
- 2 WORK gaps (test coverage)
Decision: Return to SPECIFY phase
Action: Save current build state to checkpoint file
Checkpoint File: .ralph-wiggum/[feature]/checkpoint.json
Checkpoint Structure:
{
"feature": "user-authentication",
"feature_slug": "user-authentication",
"branch": "feat/user-authentication",
"cycle": 2,
"max_cycles": 5,
"current_phase": "WORK",
"completed_phases": ["RESEARCH", "SPECIFY", "PLAN"],
"refined_context": {
"task": "Specific, actionable task statement",
"context": "Broader system, goals, constraints from CLAUDE.md",
"requirements": ["Must-have requirement 1", "Must-have requirement 2"],
"output": "What should be delivered (working code, tests, docs, PR)"
},
"artifacts": {
"research": "docs/research/2026-01-05-user-authentication.md",
"spec": "specs/user-authentication/spec.md",
"plan": "specs/user-authentication/plan.md"
},
"token_usage": {
"total": 45230,
"this_cycle": 12450,
"by_phase": {
"research": 8450,
"specify": 5230,
"plan": 12100,
"work": 19450
}
},
"last_review": {
"status": "CHANGES_REQUESTED",
"findings_count": 8,
"critical": 2,
"major": 5,
"minor": 1
},
"checkpoint_time": "2026-01-05T14:23:45Z",
"gap_analysis": {
"return_to_phase": "WORK",
"reason": "2 test coverage gaps identified"
}
}
Git Ignore:
.ralph-wiggum/ to .gitignoreAcceptance:
.ralph-wiggum/ added to .gitignore (if not already present)--resume)Action: Load checkpoint and continue from last state
Validate checkpoint:
Resume Process:
git checkout <branch>Resume Output:
✅ Checkpoint found: Cycle 2, WORK phase in progress
🔄 Resuming from cycle 2, phase 4 (WORK)
📋 Last gap analysis: Return to WORK phase
💰 Token usage: 45,230 total
Acceptance:
Action: Create draft pull request with comprehensive summary
Execute:
gh pr create \
--title "[Feature] $FEATURE_DESCRIPTION" \
--body "$PR_BODY" \
--draft
PR Body Template:
## Summary
$FEATURE_SUMMARY
## Cycle History
- Cycle 1: Research + Specify + Plan + Work (32,400 tokens)
- Research: Complete (confidence: 0.9)
- Specify: Complete (5 user stories, 23 AC)
- Plan: Complete (12 tasks, 8 hours)
- Work: 8/12 tasks complete
- Review: CHANGES_REQUESTED (8 findings)
- Gap Analysis: Return to WORK phase
- Cycle 2: Work refinement (12,450 tokens)
- Work: 12/12 tasks complete
- Review: APPROVE
- Gap Analysis: None
## Changes
- [Bullet list of major changes]
- [New files added]
- [Existing files modified]
## Testing
- [x] Unit tests added (N tests)
- [x] Integration tests pass
- [x] Security scans pass (no vulnerabilities)
- [x] Lint passing
- [x] Type checking passing
## Quality Gates
- Lint: ✅ Passing
- Types: ✅ Passing
- Tests: ✅ 20/20 passing (100%)
- Test Coverage: ✅ 80%
- Security: ✅ No vulnerabilities
- Build: ✅ Passing
## Artifacts
- Specification: specs/[feature]/spec.md
- Plan: specs/[feature]/plan.md
- Research: docs/research/[date]-[feature].md
- Review: code-review-report.json
- Checkpoint: .ralph-wiggum/[feature]/checkpoint.json
## Completion Status
✅ Feature complete: All acceptance criteria met, quality gates passing, review approved
Acceptance:
After each phase:
🔄 Ralph Wiggum Cycle 2/5 for "user authentication"
📊 Phase Status:
✅ Research: Complete (confidence: 0.9)
✅ Specify: Complete (5 user stories, 23 acceptance criteria)
✅ Plan: Complete (12 tasks, 8 hours estimated)
🔄 Work: In Progress (8/12 tasks complete)
⏳ Review: Pending
📈 Quality Gates:
✅ Lint: Passing
✅ Types: Passing
🔄 Tests: 15/20 passing (75%)
⏳ Build: Not run
⏳ Security: Not run
📋 Acceptance Criteria: 18/23 complete (78%)
🧪 Test Coverage: 72% (target: 80%)
💰 Token Usage: 45,230 total (this cycle: 12,450)
⏱️ Elapsed: 23m 45s
Adds per-phase iteration details:
📝 Phase Details:
Research: 3 iterations, 8,450 tokens
Specify: 2 iterations, 5,230 tokens
Plan: 4 iterations, 12,100 tokens
Work: 6 iterations (ongoing), 19,450 tokens
Minimal output:
🔄 Cycle 2/5 | Work 8/12 | AC 78% | Tests 75%
Enforcement: Stop execution when cycle > maxCycles
Behavior:
Trigger: No progress in 3 consecutive cycles
Definition of "Progress":
Action on Stuck Detection:
--continue-on-stuck flag setDisplay: Always show cumulative and per-cycle token usage
No Enforcement: Track only, users manage their own API budgets
Output:
💰 Token Usage: 45,230 total (this cycle: 12,450)
Research: 8,450 (3 iterations)
Specify: 5,230 (2 iterations)
Plan: 12,100 (4 iterations)
Work: 19,450 (6 iterations)
--checkpoint is set)After each phase (or after review if --checkpoint=review):
🔶 Checkpoint reached: [PHASE_NAME] phase complete
📊 Phase Summary:
Status: Complete
Artifacts Generated: [list]
Token Usage: [N tokens]
[Phase-specific findings/results]
🤔 Action Required:
[Analysis and recommendation]
Options:
[1] Continue to next phase
[2] Return to [EARLIER PHASE]
[3] Review phase findings
[4] Modify artifacts
[5] Abort build
Enter choice (1-5): _
User Response Handling:
current_phase to specified earlier phase, continuePurpose: Show execution plan without actually running phases
Output:
🔍 DRY RUN: Plan for "$FEATURE_DESCRIPTION"
## Workflow Phases:
1. RESEARCH (3 iterations estimated)
- Command: /ai-eng/research --ralph --max-phase-iterations 5
- Output: docs/research/[date]-[feature].md
2. SPECIFY (2 iterations estimated)
- Command: /ai-eng/specify --from-research=... --ralph --max-phase-iterations 3
- Output: specs/[feature]/spec.md
3. PLAN (4 iterations estimated)
- Command: /ai-eng/plan --from-spec=... --ralph --max-phase-iterations 4
- Output: specs/[feature]/plan.md
4. WORK (6 iterations estimated)
- Command: /ai-eng/work specs/[feature]/plan.md --ralph --max-phase-iterations 8
- Quality gate: npm test && npm run lint
- Output: Implementation + tests
5. REVIEW (3 iterations estimated)
- Command: /ai-eng/review . --ralph --max-phase-iterations 3
- Output: code-review-report.json
## Estimated Completion:
- Max cycles: 5
- Total iterations: 18
- Estimated tokens: ~75,000
- Estimated time: ~2 hours
Proceed with execution? (y/n)
When build completes successfully (all criteria met or max cycles reached):
## Build Complete
**Feature**: $FEATURE_DESCRIPTION
**Status**: ✅ COMPLETE / ⚠️ INCOMPLETE (max cycles reached)
**Final Summary**:
- Total cycles: N
- Total tokens: N
- Total time: N
- Phases completed: Research, Specify, Plan, Work, Review
**Acceptance Criteria**: M / N complete (X%)
**Quality Gates**: All passing
**Review Status**: APPROVE / CHANGES_REQUESTED
**Artifacts Generated**:
- docs/research/[date]-[feature].md
- specs/[feature]/spec.md
- specs/[feature]/plan.md
- [Implementation files]
- code-review-report.json
- .ralph-wiggum/[feature]/checkpoint.json
**Pull Request**:
- Draft PR created: https://github.com/user/repo/pull/N
- Ready for review
**Next Steps**:
- Review draft PR
- Merge when ready
- Delete feature branch after merge
This command orchestrates existing ai-eng-system commands:
/ai-eng/research "$FEATURE" --ralph --ralph-max-iterations $MAX
/ai-eng/specify "$FEATURE" --from-research=$RESEARCH_OUTPUT --ralph --ralph-max-iterations $MAX
/ai-eng/plan --from-spec=$SPEC_OUTPUT --ralph --ralph-max-iterations $MAX
/ai-eng/work $PLAN_OUTPUT --ralph --ralph-max-iterations $MAX --ralph-quality-gate="$QUALITY_GATE"
/ai-eng/review . --ralph --ralph-max-iterations $MAX
See docs/ralph-wiggum-guide.md for comprehensive guidance on:
Successful build achieves:
After creating this command, the agent can invoke it with:
bun run scripts/run-command.ts ralph-wiggum "feature description" [options]
Examples:
bun run scripts/run-command.ts ralph-wiggum "implement user auth" --checkpoint=all --verbosebun run scripts/run-command.ts ralph-wiggum "API caching" --from-spec=specs/cache/spec.md --resumeAfter completing the full cycle, rate your confidence in feature completeness and quality (0.0-1.0). Identify any uncertainties about phase transitions, iterations that were inefficient, or areas where quality gates may have been too lenient or strict. Note any workflow improvements that could enhance future cycles.