name: epci:ralph-exec
description: >-
Executes a single user story from PRD.json with TDD Red-Green cycle.
Selects next pending story respecting dependencies, implements via @implementer,
updates PRD with results, and emits RALPH_STATUS block for shell detection.
Use when: Ralph autonomous loop, story-by-story execution, overnight batch runs.
Triggers: ralph-exec, execute story, run next story, ralph execute.
Not for: batch story execution, debugging (use /debug), full features (use /implement).
user-invocable: true
argument-hint: "--prd "
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Task
Ralph Exec
Execute a single user story from PRD.json with TDD workflow.
Quick Start
/ralph-exec --prd .ralph/my-feature/prd.json
MANDATORY EXECUTION RULES (READ FIRST):
- ๐ด NEVER execute multiple stories in one invocation
- ๐ด NEVER skip TDD cycle (Red-Green required)
- ๐ด NEVER proceed without valid PRD.json
- ๐ด NEVER modify PRD without RALPH_STATUS emission
- โ ALWAYS start with step-00-init.md
- โ ALWAYS follow next_step from each step
- โ ALWAYS emit RALPH_STATUS block at end
- โ ALWAYS respect story dependency order
- โ FORBIDDEN skipping the RALPH_STATUS emission
- ๐ต YOU ARE A DISCIPLINED SINGLE-STORY EXECUTOR
EXECUTION PROTOCOLS:
- Load step-00-init.md
- Execute current step protocols completely
- Proceed to next_step
- Complete until step-02-report.md with RALPH_STATUS
CONTEXT BOUNDARIES:
- IN scope: Single story execution, TDD cycle, PRD update, status emission
- OUT scope: Multiple stories, debugging, circuit breaker logic, rollback
Workflow Overview
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ RALPH-EXEC WORKFLOW โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Step 00: INIT โ
โ โโ Parse --prd argument โ
โ โโ Load and validate PRD.json โ
โ โโ Select next story (pending + !passes + deps OK) โ
โ โโ If no story โ ABORT with ALL_DONE status โ
โ โ
โ Step 01: EXECUTE โ
โ โโ Load story context (AC, tasks) โ
โ โโ TDD Red-Green cycle via @implementer โ
โ โ โโ RED: Write failing test โ
โ โ โโ GREEN: Implement to pass โ
โ โโ Track files_modified โ
โ โ
โ Step 02: REPORT โ
โ โโ Update PRD.json โ
โ โ โโ status, passes, attempts++ โ
โ โ โโ files_modified[], completed_at โ
โ โโ Emit RALPH_STATUS block โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Steps
| Step | Name | Description | Skippable |
|---|---|---|---|
| 00 | init | Parse PRD, validate, select next story | No |
| 01 | execute | TDD Red-Green implementation | No |
| 02 | report | Update PRD, emit RALPH_STATUS | No |
Step Files
- steps/step-00-init.md โ Initialization
- steps/step-01-execute.md โ TDD Execution
- steps/step-02-report.md โ Report & Status
Reference Files
- references/status-block.md โ RALPH_STATUS format
Shared Components Used
epci:tdd-enforcerโ TDD cycle enforcement (Red-Green mode)
Story Selection Algorithm
FOR each story IN prd.userStories ORDER BY id:
IF story.status == "pending" AND story.passes == false:
deps_satisfied = ALL(dep.passes == true FOR dep IN story.dependencies.depends_on)
IF deps_satisfied:
RETURN story
RETURN null # No story available
RALPH_STATUS Format (Summary)
<<<RALPH_STATUS>>>
story_id: {US1}
status: {SUCCESS|FAILURE|BLOCKED|ALL_DONE}
passes: {true|false}
error: {null|"error message"}
files_modified: [{list}]
next_story: {US2|null}
timestamp: {ISO-8601}
<<<END_RALPH_STATUS>>>
See references/status-block.md for complete specification.
Error Handling
| Error | Cause | Resolution |
|---|---|---|
| PRD not found | Invalid --prd path | RALPH_STATUS with FAILURE |
| PRD invalid | Schema validation fails | RALPH_STATUS with FAILURE |
| No story available | All done or blocked | RALPH_STATUS with ALL_DONE or BLOCKED |
| Test fails 2x | Implementation issue | RALPH_STATUS with FAILURE |
| Dependency missing | Story blocked | Skip and emit BLOCKED |
Limitations
This skill does NOT:
- Execute multiple stories at once
- Handle circuit breaker logic (done by ralph.sh)
- Perform rollback on failure
- Run code review or security audit (speed priority)
- Create Feature Documents (handled by /spec)