skills/ralph-pipeline-full-auto/SKILL.md
Run the complete Ralphetamine pipeline fully autonomously with zero user input: PRD creation, spec generation, double premortem review, and run script generation. Triggers on: /ralph-pipeline-full-auto, ralph autopilot, ralph full auto, ralph autonomous pipeline, ralph auto.
npx skillsauth add becerra-alberto/ralphetamine ralph-pipeline-full-autoInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Run the complete Ralphetamine pipeline from idea to execution-ready project with zero user interaction. Every decision point that would normally require user input instead uses structured self-evaluation: weigh risks, cons, and value — then proceed with the strongest proposal.
This variant includes worktree isolation (so the main branch stays clean) and a double premortem — a second review pass that accounts for changes made by the first — to compensate for the lack of human oversight.
At every phase, maximally delegate work to sub-agents via the Task tool. The main conversation context is a finite resource that must survive the entire pipeline. Follow these rules:
This pipeline is fully autonomous. Do not pause to request write approval from the user.
mkdir -p behavior).skills/oss-prep/SKILL.md), create it directly instead of attempting edit-only operations..ralph/write-blockers.md using:
ralph run only. Do not generate custom per-story loops that call claude directly..ralph/stories.txt must include at least one active N.M | Title entry.| Phase | What Happens | Autonomous? |
|-------|-------------|-------------|
| 0. Worktree | Create isolated git worktree for the feature | Auto — slug derived from description |
| 1. PRD | Generate a Product Requirements Document | Self-directed — Claude decides scope |
| 2. Commit PRD | Commit the PRD to git | Auto |
| 3. Specs | Convert PRD into epics, stories, batch queue | Self-directed — Claude decides breakdown |
| 4. Commit Specs | Commit specs and stories.txt to git | Auto |
| 5. Premortem 1 | Analyze plan for failure modes, apply fixes | Self-directed — Claude evaluates and fixes |
| 6. Commit Fixes | Commit premortem 1 fixes to git | Auto |
| 7. Premortem 2 | Re-analyze after fixes, catch cascading issues | Self-directed — Claude evaluates and fixes |
| 8. Commit Fixes | Commit premortem 2 fixes to git | Auto |
| 9. Run Script | Generate run-ralph.sh for autonomous execution | Auto |
No user input is requested at any phase. Announce each phase transition clearly so the user can follow progress.
Create an isolated git worktree so all feature work happens on a dedicated branch, leaving the main branch clean for continued development.
Derive a kebab-case feature slug from the user's feature description. Use the first 3-4 meaningful words, lowercase, hyphen-separated:
user-authenticationbudget-tracking-dashboardRun the following steps using the Bash tool:
Clean stale state:
rm -f .git/index.lock .git/HEAD.lock 2>/dev/null || true
git worktree prune 2>/dev/null || true
Create the worktree:
git worktree add .ralph/worktrees/feature-<slug> -b ralph/feature-<slug>
If the branch or worktree already exists (from a previous run), clean up and retry:
git worktree unlock .ralph/worktrees/feature-<slug> 2>/dev/null || true
git worktree remove .ralph/worktrees/feature-<slug> --force 2>/dev/null || true
rm -rf .ralph/worktrees/feature-<slug> 2>/dev/null || true
git worktree prune 2>/dev/null || true
git branch -D ralph/feature-<slug> 2>/dev/null || true
git worktree add .ralph/worktrees/feature-<slug> -b ralph/feature-<slug>
Resolve the absolute worktree path and store it for all subsequent phases:
WORKTREE_DIR="$(cd .ralph/worktrees/feature-<slug> && pwd)"
All subsequent phases (1-9) operate inside the worktree directory. When using the Bash tool, prefix commands with cd "$WORKTREE_DIR" && or use absolute paths within the worktree. When using Read/Write/Edit tools, use the absolute worktree path.
Create the .ralph/ directory and initialize ralph init inside the worktree if .ralph/config.json does not already exist:
cd "$WORKTREE_DIR" && ralph init
Announce: "Phase 0 complete — Worktree created at .ralph/worktrees/feature-<slug> on branch ralph/feature-<slug>. All work will happen in this isolated environment."
Sub-agent delegation: Spawn a Task agent (subagent_type: general-purpose, model: opus) to generate the full PRD. Pass it the user's feature description and the PRD format below. The sub-agent writes the file directly. The main context only receives the file path and a one-paragraph summary.
Where the interactive version would ask the user clarifying questions, instead:
## Design Decisions section so the user can review what was decided on their behalf.The sub-agent must generate a PRD with these sections:
Save to tasks/prd-[feature-name].md.
Announce: "Phase 1 complete — PRD saved. Design decisions documented in the PRD header."
tasks/prd-*.md (the newly created PRD file)docs: add PRD for [feature-name]Announce: "Phase 2 complete — PRD committed. Moving to Phase 3."
Sub-agent delegation: This phase is the heaviest. Maximize sub-agent usage:
Where the interactive version would show the epic/story breakdown and ask the user to confirm:
Every spec file (specs/epic-{N}/story-{N.M}-{slug}.md) must use this exact format:
---
id: "N.M"
epic: N
title: "Short Descriptive Title"
status: pending
source_prd: "tasks/prd-<name>.md"
priority: critical|high|medium|low
estimation: small|medium|large
depends_on: []
---
# Story N.M — Short Descriptive Title
## User Story
As a [role], I want [capability] so that [benefit].
## Technical Context
[Implementation approach, architecture, key decisions.]
## Acceptance Criteria
### AC1: [Criterion Name]
- **Given** [precondition]
- **When** [action]
- **Then** [expected result]
### AC2: [Criterion Name]
- **Given** [precondition]
- **When** [action]
- **Then** [expected result]
## Test Definition
### Unit Tests
- [Test case description]
### Integration/E2E Tests (if applicable)
- [Test scenario]
## Files to Create/Modify
- `path/to/file` — [what changes] (create|modify)
Path normalization rule (critical):
Files to Create/Modify path must be relative to the current project root.skills/oss-prep/, use SKILL.md, not skills/oss-prep/SKILL.md.# Source: tasks/prd-<name>.md
# Generated: <ISO timestamp>
# Stories: 1.1, 1.2, ..., N.M
# Ralph Story Queue
# Format: ID | Title
# [batch:1] — foundational / independent
1.1 | Story Title
# [batch:2] — depends on batch 1
2.1 | Story Title
After all specs are written, the consistency review sub-agent must verify:
stories.txt has a matching spec fileFiles to Create/Modify path is project-root-relative (no duplicated root prefix).ralph/stories.txt has at least one active story line (N.M | Title)Report: "Created X specs across Y epics (Z consistency issues auto-fixed)"
Announce: "Phase 3 complete — Specs generated. Moving to Phase 4."
specs/, .ralph/stories.txt, PRD file (if frontmatter updated)ralph: add specs for [feature-name] (N stories across M epics)Announce: "Phase 4 complete — Specs committed. Moving to Phase 5: Premortem 1."
Sub-agent delegation: Spawn a single Task agent (model: opus) to perform the full premortem analysis. Pass it the list of spec file paths and stories.txt path. The agent reads all files, runs the analysis, and returns a structured report. The main context receives only the report summary.
The premortem imagines the project has already failed and works backward to identify what went wrong.
The premortem sub-agent must check all six categories:
depends_on?Where the interactive version would present findings and wait for user approval:
premortem-1-report.md file in .ralph/ for the user to review later.After applying fixes: Spawn a validation sub-agent to re-verify consistency (same checks as Phase 3 validation).
Announce: "Phase 5 complete — Premortem 1: X issues found, Y fixed, Z skipped. Moving to Phase 6."
specs/, .ralph/stories.txt, .ralph/premortem-1-report.mdralph: premortem 1 fixes for [feature-name] (N issues resolved)Announce: "Phase 6 complete — Premortem 1 fixes committed. Moving to Phase 7: Premortem 2."
Sub-agent delegation: Spawn a fresh Task agent (model: opus) for Premortem 2. This agent receives:
.ralph/premortem-1-report.md) so it knows what was already changedThis second premortem exists because fixes to one story can create new problems:
depends_on references may have created a circular dependencyIn addition to re-running all six categories from Premortem 1, specifically check:
depends_on entries create circular dependencies?stories.txt with correct batch annotations?small)Apply critical fixes unconditionally. Apply low-risk warning fixes. Log everything to .ralph/premortem-2-report.md.
If Premortem 2 finds zero issues, log: "Premortem 2 clean — no cascading issues detected."
Announce: "Phase 7 complete — Premortem 2: X issues found, Y fixed. Moving to Phase 8."
specs/, .ralph/stories.txt, .ralph/premortem-2-report.mdralph: premortem 2 fixes for [feature-name] (N issues resolved)Announce: "Phase 8 complete — Premortem 2 fixes committed. Moving to Phase 9: Run Script."
Create run-ralph.sh in the project root. This is a lightweight step — no sub-agent needed.
#!/usr/bin/env bash
# Run Ralphetamine autonomous implementation loop
# Generated by /ralph-pipeline-full-auto on <date>
# PRD: tasks/prd-<name>.md
# Stories: <N> stories across <M> epics
# Premortems: 2 passes completed
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# Preflight checks
command -v ralph >/dev/null 2>&1 || { echo "Error: ralph not found on PATH. Run install.sh first."; exit 1; }
command -v jq >/dev/null 2>&1 || { echo "Error: jq not found on PATH."; exit 1; }
[[ -f .ralph/config.json ]] || { echo "Error: .ralph/config.json not found."; exit 1; }
[[ -f .ralph/stories.txt ]] || { echo "Error: .ralph/stories.txt not found."; exit 1; }
active_stories=$(grep -cE '^[[:space:]]*[0-9]+(\.[0-9]+)+[[:space:]]*\|' .ralph/stories.txt || true)
if [[ "$active_stories" -eq 0 ]]; then
echo "Error: .ralph/stories.txt has no active stories."
echo "Regenerate the queue before running Ralph."
exit 1
fi
spec_pattern=$(jq -r '.specs.pattern // ""' .ralph/config.json 2>/dev/null || echo "")
if [[ "$spec_pattern" != *"{{epic}}"* || "$spec_pattern" != *"{{id}}"* ]]; then
echo "Error: invalid .ralph/config.json specs.pattern: $spec_pattern"
echo "Expected: specs/epic-{{epic}}/story-{{id}}-*.md"
exit 1
fi
# Count stories and batches
total_stories=$(grep -cE '^[[:space:]]*[0-9]+(\.[0-9]+)+[[:space:]]*\|' .ralph/stories.txt || true)
total_batches=$(grep -c '^[[:space:]]*# \[batch:' .ralph/stories.txt || true)
# Infer conflict risk from Files to Create/Modify sections.
target_count=$(
{
while IFS= read -r spec; do
awk '
/^## Files to Create\/Modify/ {in_files=1; next}
/^## / {in_files=0}
in_files && /^- `/ {
line=$0
sub(/^- `/, "", line)
sub(/`.*/, "", line)
gsub(/^[[:space:]]+|[[:space:]]+$/, "", line)
if (length(line) > 0) print line
}
' "$spec"
done < <(find specs -type f -name 'story-*.md' 2>/dev/null)
} | sort -u | sed '/^$/d' | wc -l | tr -d ' '
)
run_mode="${RALPH_RUN_MODE:-auto}"
if [[ "$run_mode" == "auto" ]]; then
if [[ "${target_count:-0}" -le 1 ]]; then
run_mode="sequential"
else
run_mode="parallel"
fi
fi
echo "Ralphetamine — Autonomous Implementation"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Stories: ${total_stories}"
echo "Batches: ${total_batches}"
echo "Targets: ${target_count:-0} unique file paths"
echo "Mode: ${run_mode}"
echo ""
echo "Starting in 3 seconds... (Ctrl+C to cancel)"
sleep 3
# Run Ralph
if [[ "$run_mode" == "parallel" ]]; then
ralph run --parallel --no-interactive "$@"
else
ralph run --no-interactive "$@"
fi
Save and chmod +x run-ralph.sh.
After generating the script, automatically launch it in a new iTerm2 window so Ralph runs in its own dedicated terminal session inside the worktree.
Use the Bash tool to run this AppleScript via osascript:
osascript -e '
tell application "iTerm2"
activate
set newWindow to (create window with default profile)
tell current session of newWindow
write text "cd \"'"$WORKTREE_DIR"'\" && ./run-ralph.sh"
end tell
end tell
'
Where $WORKTREE_DIR is the absolute path to the worktree directory (resolved in Phase 0).
Fallback: If iTerm2 is not installed or the AppleScript fails, fall back to:
cd "$WORKTREE_DIR" && open -a Terminal.app "./run-ralph.sh"
If both fail, tell the user: "Could not auto-launch. Run ./run-ralph.sh from the worktree directory manually."
Announce: "Phase 9 complete — Ralph is running in a new iTerm2 window (worktree: feature-<slug>)."
Print the final summary:
Ralphetamine Full-Auto Pipeline Complete
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Worktree: .ralph/worktrees/feature-<slug>
Branch: ralph/feature-<slug>
PRD: tasks/prd-[name].md
Specs: N stories across M epics
Premortem 1: X issues found, Y fixed
Premortem 2: X issues found, Y fixed
Reports: .ralph/premortem-1-report.md
.ralph/premortem-2-report.md
Run script: ./run-ralph.sh
Execution: Launched in iTerm2 window
Ralph is running autonomously in an isolated worktree.
Check the iTerm2 window for progress.
Premortem reports are available for review at any time.
When complete, merge back to your main branch:
cd <project-root>
git merge ralph/feature-<slug>
git worktree remove .ralph/worktrees/feature-<slug>
→ Then update the changelog:
# Update CHANGELOG.md and bump version
If any phase fails:
rm -f .git/index.lock), prune worktrees (git worktree prune), and retry. If the branch already exists, delete it and recreate..ralph/write-blockers.md and continue without asking for interactive approval.Use these templates when spawning Task agents to ensure consistent behavior.
You are generating a Product Requirements Document for: [user's feature description].
Since this is fully autonomous (no user to ask), you must:
1. Identify the 3-5 clarifying questions you would ask
2. For each, choose the safest, most conventional answer
3. Document these choices in a "Design Decisions" section at the top of the PRD
Write the PRD to: tasks/prd-[name].md
[Include full PRD format from Phase 1]
You are writing a single Ralphetamine story spec.
Project context: [one-paragraph PRD summary]
Full story breakdown: [epic/story outline]
Your assignment: Story [N.M] — [title]
Write the spec to: specs/epic-{N}/story-{N.M}-{slug}.md
[Include spec file format]
Consistency rules:
- Use file paths exactly as they appear in the breakdown
- Match project naming conventions
- Do not duplicate scope from other stories
- Include 3-5 acceptance criteria; final criterion must include validation
- Maximally focus on this one file — do not read or modify other specs
You are performing a premortem analysis on a Ralphetamine project plan.
Read all spec files in specs/ and .ralph/stories.txt.
[If Premortem 2: Also read .ralph/premortem-1-report.md for context on what was already changed.]
Check all failure mode categories: [list categories]
For each issue:
1. Assess: value (likelihood of causing failure), risk of fix, cost of fix
2. Classify as: critical (fix unconditionally), warning (fix if low-risk), observation (log only)
3. Apply critical and low-risk warning fixes directly to the files
4. Write the full report to .ralph/premortem-[N]-report.md
Report format:
## Premortem [N] Report
### Critical Issues (fixed)
### Warnings (fixed / skipped with reason)
### Observations
### Summary: X issues found, Y fixed, Z skipped
development
Audit and reconcile the latest Ralph run in Codex-driven repositories. Use when Ralph finishes and you want a post-run diagnostic or remediation pass to catch unmerged story branches, failures, state/spec drift, and merge issues, then execute a bounded recovery plan.
development
Audit and reconcile the latest Ralph run in Claude Code. Use when Ralph finishes with failures, tentative outcomes, or suspected missing merges; inspect story branches, state/spec drift, and merge conflicts, then produce or execute a prioritized remediation plan.
testing
Run the complete Ralphetamine pipeline interactively: PRD creation, multi-perspective Review Party gates, spec generation, premortem review, and run script generation. Pauses for user input at key decision points. Triggers on: /ralph-pipeline-interactive, interactive ralph pipeline, ralph guided pipeline.
tools
Convert a PRD into Ralphetamine story specs and queue. Reads a PRD file and generates specs/epic-{N}/story-{N.M}-{slug}.md files plus .ralph/stories.txt. Triggers on: /ralph, convert prd to specs, generate ralph specs, create story specs.