Ralph
Generate a Ralph Wiggum-style iterative automation for large tasks. The Ralph Wiggum technique runs an AI CLI in a stateless loop…
Claude CodeGeneric
# Generate Ralph Wiggum Automation
Generate a Ralph Wiggum-style iterative automation for large tasks. The Ralph Wiggum technique runs an AI CLI in a stateless loop where each iteration does ONE unit of work, then stops. Progress is tracked via git history and filesystem state.
Supports three AI engines: **Claude CLI** (default), **GitHub Copilot CLI** (`--type copilot`), and **Codex CLI** (`--type codex`).
## Task Description
$ARGUMENTS
## CLI Engine Parameters
Parse these from `$ARGUMENTS` if present (flags like `--type copilot --model opus --effort high` or `--type codex --model gpt-5.5 --effort xhigh`):
| Parameter | Values | Default |
|-----------|--------|---------|
| `--type` | `claude`, `copilot`, `codex` | `claude` |
| `--model` | See model table below | `opus` |
| `--effort` | `low`, `medium`, `high`, `max`, `xhigh` | `high` |
### Model Name Mapping
The CLIs use different model name formats:
| Alias | Claude CLI (`--model`) | Copilot CLI (`--model`) | Codex CLI (`--model`) |
|-------|----------------------|------------------------|----------------------|
| `opus` | `claude-opus-4-6` | `claude-opus-4.6` | `gpt-5.5` |
| `sonnet` | `claude-sonnet-4-6` | `claude-sonnet-4.6` | `gpt-5.4` |
| `haiku` | `claude-haiku-4-5` | `claude-haiku-4.5` | `gpt-5.4-mini` |
| `codex` | n/a | n/a | `gpt-5.5` |
| `gpt-5.5` | n/a | n/a | `gpt-5.5` |
### Effort Support
| Engine | Flag | Values | Notes |
|--------|------|--------|-------|
| Claude | `--effort` | `low`, `medium`, `high`, `max` | `max` is Opus-only |
| Copilot | `--reasoning-effort` | `low`, `medium`, `high`, `xhigh` | Map `max` -> `xhigh` |
| Codex | `-c model_reasoning_effort="..."` | `low`, `medium`, `high`, `xhigh` | Map `max` -> `xhigh` |
Strip `--type`, `--model`, and `--effort` from `$ARGUMENTS` before processing the task description.
## Modes
This command operates in two modes based on context:
### Mode 1: Wrap Existing Work
If there are **uncommitted changes** or a **recent commit pattern** to follow:
- Analyze the changes to infer task parameters
- Generate wrapper for "more of the same"
### Mode 2: Full Planning
If the user provides a **project description** or asks for a full plan:
- Analyze the entire project/codebase
- Create a comprehensive plan with all work items
- Generate a TRACKER.md with all items as PENDING
- Generate the wiggum wrapper to execute the plan
## Instructions
### Step 1: Determine Mode
Check the arguments and current state:
- If `$ARGUMENTS` describes a project or feature -> **Full Planning Mode**
- If `$ARGUMENTS` is a task name or empty with uncommitted changes -> **Wrap Existing Mode**
### Step 2A: Full Planning Mode
1. **Analyze the project scope**
2. **Create a tracker file** at `docs/trackers/features/{TASK}-TRACKER.md`
3. **Count items** to calculate max iterations: `N + 10`
4. **Generate the prompt and orchestrator**
### Step 2B: Wrap Existing Mode
1. **Analyze current state** via git status/diff
2. **Infer task parameters** from the changes
3. **If ambiguous**, ask the user
### Step 3: Generate Files
#### File 1: `scripts/{task}-prompt.md`
The generated prompt MUST include ALL 8 quality check sections from the "Quality Checks" section below. Copy them verbatim into the prompt — these are the instructions Claude will follow headlessly, so if they're not in the prompt, they won't happen. The quality checks must appear AFTER the work instructions and BEFORE any "mark DONE" step.
#### File 2: `scripts/{task}.ps1`
**CRITICAL**: Set `$MaxIterations` to **item count + 5**.
**Resolve template placeholders** from the parsed CLI parameters:
- `{TYPE}` -> `claude`, `copilot`, or `codex` (default: `claude`)
- `{MODEL}` -> resolved model name for the chosen engine (use the Model Name Mapping table above; default: `opus` alias -> `claude-opus-4-6` for claude, `claude-opus-4.6` for copilot, `gpt-5.5` for codex)
- `{EFFORT}` -> `low`, `medium`, `high`, `max`, or `xhigh` (default: `high`)
Use this template for the PowerShell orchestrator - it streams tool use with file details:
```powershell
#!/usr/bin/env pwsh
param(
[int]$MaxIterations = {ITEM_COUNT + 10},
[ValidateSet('claude', 'copilot', 'codex')]
[string]$Type = '{TYPE}',
[string]$Model = '{MODEL}',
[ValidateSet('low', 'medium', 'high', 'max', 'xhigh')]
[string]$Effort = '{EFFORT}',
[switch]$DryRun
)
$ErrorActionPreference = 'Stop'
if (Get-Variable -Name PSNativeCommandUseErrorActionPreference -ErrorAction SilentlyContinue) {
$PSNativeCommandUseErrorActionPreference = $false
}
$TrackerPath = "/workspace/docs/trackers/features/{TASK}-TRACKER.md"
$PromptPath = "/workspace/scripts/{task}-prompt.md"
# Resolve engine binary
if ($Type -eq 'copilot') {
$EngineBin = "/home/vscode/.local/bin/copilot"
if (-not (Test-Path $EngineBin)) {
Write-Host "ERROR: Copilot CLI not found at $EngineBin" -ForegroundColor Red
exit 1
}
} elseif ($Type -eq 'codex') {
$EngineBin = "codex"
} else {
$EngineBin = "claude"
}
function Get-PendingCount {
$tracker = Get-Content $TrackerPath -Raw
return ([regex]::Matches($tracker, '\| PENDING[\s|]')).Count
}
function Get-CompletedCount {
$tracker = Get-Content $TrackerPath -Raw
$done = ([regex]::Matches($tracker, '\| DONE[\s|✓]')).Count
$needsWork = ([regex]::Matches($tracker, '\| NEEDS_WORK[\s|✓]')).Count
$blocked = ([regex]::Matches($tracker, '\| BLOCKED[\s|✓]')).Count
return $done + $needsWork + $blocked
}
function Invoke-Iteration {
param([int]$Iteration)
Write-Host ""
Write-Host ("=" * 5) -ForegroundColor Yellow
Write-Host " Iteration $Iteration of $MaxIterations ($Type)" -ForegroundColor Yellow
Write-Host ("=" * 5) -ForegroundColor Yellow
$prompt = Get-Content $PromptPath -Raw
if ($Type -eq 'copilot') {
$engineArgs = @(
'-p', $prompt
'--model', $Model
'--allow-all'
)
$copilotEffort = if ($Effort -eq 'max') { 'xhigh'
Maintain Ralph?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[](https://getagentictools.com/loops/dataplat-generate-ralph-wiggum-automation?ref=badge)