| name | workspace-ralph-orchestrator |
| description | Orchestrate Ralph automation loops for spec-driven development. Use when starting, stopping, monitoring, or checking status of Ralph loops. Triggers on Ralph start, Ralph stop, Ralph status, spec automation, task loop, run tasks, check progress, kill Ralph, resume Ralph, or tmux session management. |
Workspace Ralph Orchestrator
Orchestrate Ralph automation loops via tmux sessions with full control from Claude Code.
Quick Reference
| Command | Description |
|---|
ralph start <spec_dir> | Start Ralph loop (parallel batches enabled by default) |
ralph --no-parallel <spec_dir> | Run sequentially (disable parallel batches) |
ralph stop | Hard kill Ralph processes |
ralph stop --graceful | Graceful stop after current task |
ralph status <spec_dir> | Show current progress |
ralph context <spec_dir> --simple --loop | Live dashboard (recommended) |
ralph --worktree <spec_dir> | Run in isolated worktree |
Graceful Stop (Recommended)
Stop Ralph after the current task completes, preserving state:
touch <spec_dir>/.ralph/.stop
touch specs/001-my-feature/.ralph/.stop
Ralph will:
- Finish the current task
- Update progress.json with final state
- Log the graceful stop
- Exit cleanly
From Claude Code, use this pattern:
SPEC_DIR="specs/001-my-feature"
touch "$SPEC_DIR/.ralph/.stop"
echo "Stop file created - Ralph will stop after current task"
Hard Stop (Immediate)
When you need to stop immediately:
tmux kill-session -t ralph-001 2>/dev/null
pkill -f "ralph.sh"
pkill -f "timeout.*claude"
pkill -f "playwright"
pkill -f "npx.*playwright"
tmux kill-server
Complete cleanup script:
tmux kill-session -t ralph-001 2>/dev/null
pkill -f "ralph.sh"
pkill -f "timeout.*claude"
pkill -f "playwright"
pkill -f "npx.*playwright"
Important: After hard stop, manually update progress.json to document state.
Viewing Claude Session Context
Ralph spawns a Claude Code session for each task. Use the included helper script for a complete overview.
Quick Context (Recommended)
.claude/skills/workspace-ralph-orchestrator/ralph-context.sh <spec_dir> --simple --loop
.claude/skills/workspace-ralph-orchestrator/ralph-context.sh <spec_dir>
.claude/skills/workspace-ralph-orchestrator/ralph-context.sh specs/001-my-feature --simple --loop
This shows:
- Progress: Current task, completed count, status
- Active Session: Which Claude session is running
- Claude's Todo List: Subtasks Claude is tracking (from TodoWrite)
- Skills Used: Any skills invoked in the session
- Recent Actions: Last 10 tool calls and messages
- Control: Stop file status
- Processes: Running Claude processes
- Docker Containers: Container status and health
- Port Health: Whether frontend/backend are responding
- Session Log: Recent Ralph log entries
Manual Inspection
If you need more detail:
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
CLAUDE_PROJECT_PATH="$HOME/.claude/projects/-$(echo "$PROJECT_ROOT" | tr '/' '-' | sed 's/^-//')"
ls -lt "$CLAUDE_PROJECT_PATH"/*.jsonl | head -5
ps aux | grep claude | grep -v grep
Starting a Single Loop
Start Ralph in a tmux session:
tmux kill-session -t ralph 2>/dev/null
SPEC_NAME="010-feature"
tmux new-session -d -s "ralph-$SPEC_NAME" -c <project_root>
tmux send-keys -t "ralph-$SPEC_NAME" '<ralph_path>/ralph.sh start specs/<spec_name>/' Enter
Example:
tmux kill-session -t ralph-001 2>/dev/null
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
tmux new-session -d -s ralph-001 -c "$PROJECT_ROOT"
tmux send-keys -t ralph-001 './ralph start specs/001-my-feature/' Enter
Auto-Open Context Viewer (Default: On)
When starting Ralph, automatically open the context viewer in a separate Warp tab for real-time monitoring. This is enabled by default but can be disabled.
Complete start with context viewer:
SPEC_DIR="specs/001-my-feature"
SPEC_NAME="010"
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
SKILL_PATH="$PROJECT_ROOT/.claude/skills/workspace-ralph-orchestrator"
tmux kill-session -t ralph-$SPEC_NAME 2>/dev/null
tmux new-session -d -s ralph-$SPEC_NAME -c "$PROJECT_ROOT"
tmux send-keys -t ralph-$SPEC_NAME "./ralph start $SPEC_DIR/" Enter
OPEN_CONTEXT_VIEWER=${OPEN_CONTEXT_VIEWER:-true}
if [[ "$OPEN_CONTEXT_VIEWER" == "true" ]]; then
osascript -e 'tell application "Warp" to activate' \
-e 'delay 0.5' \
-e 'tell application "System Events" to tell process "Warp" to keystroke "t" using command down' \
-e 'delay 0.3' \
-e "tell application \"System Events\" to tell process \"Warp\" to keystroke \"watch -n5 '$SKILL_PATH/ralph-context.sh' '$SPEC_DIR'\"" \
-e 'tell application "System Events" to tell process "Warp" to key code 36'
fi
To disable auto-open:
OPEN_CONTEXT_VIEWER=false
Flags for ralph-context.sh: --loop (auto-refresh, RALPH_CONTEXT_REFRESH_SECS overrides the 1s default), --simple (single-column), --width=N. What it shows: see "Quick Context" above.
Parallel Task Batches
Tasks marked with [P] are automatically batched and executed in parallel using Claude Code subagents:
## Phase 5: Theming Fixes
- [ ] T085 [P] Fix light mode for IconPickerField
- [ ] T086 [P] Fix light mode for URLField
- [ ] T087 [P] Fix Section overlay colors
When Ralph detects consecutive [P] tasks:
- Groups them into a batch (up to
MAX_PARALLEL_TASKS, default: 5)
- Spawns a single Claude session with batch context
- Claude launches parallel subagents via the Task tool
- Each subagent implements one task independently
- After all complete, Ralph verifies build and commits
Configuration (ralph.config):
PARALLEL_ENABLED=true
MAX_PARALLEL_TASKS=5
PARALLEL_TIMEOUT=14400
Dashboard shows batch progress:
- Batch section with per-task status icons (✓ completed, ~ running, ○ pending)
- Progress bar for batch completion
- Batch timing vs timeout
Recent actions show subagents:
→ T085: Fix light mode... (purple arrow) - Subagent spawned
> Read (blue) - Direct tool calls
Parallel Features with Worktrees
Run multiple Ralph loops on different features simultaneously:
tmux new-session -d -s ralph-001 -c /path/to/project
tmux send-keys -t ralph-001 './ralph.sh start specs/010-feature-a/' Enter
tmux new-session -d -s ralph-002 -c /path/to/project
tmux send-keys -t ralph-002 './ralph.sh --worktree start specs/012-feature-b/' Enter
Each loop runs in isolation:
- Separate git worktree with its own branch
- Independent commits and pushes
- Separate tmux sessions (
ralph-001, ralph-002)
Worktree Options
./ralph.sh --worktree start specs/012-feature/
./ralph.sh --worktree-base ~/worktrees start specs/012-feature/
./ralph.sh --worktree --branch feature-branch start specs/012-feature/
Configuration
Global Config (.specify/ralph/config.sh)
WORKTREE_ENABLED=true
WORKTREE_BASE="../worktrees"
RALPH_SPEC_LINES=0
RALPH_PLAN_LINES=0
MAX_RETRIES=3
SLACK_ENABLED=true
Per-Spec Config (<spec_dir>/ralph.config)
FEATURE_BRANCH="010-schedule-improvements"
MAX_RETRIES=5
Prompt Files (Two-Level Hierarchy)
Ralph injects prompts at two levels:
| File | Scope | Purpose |
|---|
.specify/ralph/ralph-global.md | Workspace-global | All specs - project-wide skill mappings |
<spec_dir>/ralph-spec.md | Spec-specific | One feature - patterns for this spec |
Example ralph-global.md:
# MANDATORY: Skill Usage
| When Task Involves | YOU MUST USE |
|--------------------|--------------|
| Starting servers | `Skill(skill="hf-app-docker-dev-server")` |
| Running E2E tests | `Skill(skill="hf-app-playwright-runner")` |
Example ralph-spec.md:
## Feature-Specific Context
This is a frontend-only feature. Focus on:
- React components in `components/schedule/`
- Run Playwright tests after UI changes
Do NOT modify backend code.
Monitoring Ralph
Quick Status Check
cat <spec_dir>/.ralph/progress.json | jq .
tail -20 <spec_dir>/.ralph/session.log
git log --oneline -10 | grep "Ralph:"
./ralph.sh status specs/010-feature/
Live tmux Output
tmux capture-pane -t ralph-001 -p | tail -20
tmux capture-pane -t ralph-001 -p -S -500 | tail -100
tmux list-sessions | grep ralph
Monitor Claude's Background Tasks
Ralph's Claude may run commands in background. Check output files:
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
CLAUDE_TMP_PATH="/private/tmp/claude/-$(echo "$PROJECT_ROOT" | tr '/' '-' | sed 's/^-//')/tasks"
ls -lt "$CLAUDE_TMP_PATH"/*.output | head -5
tail -f "$CLAUDE_TMP_PATH"/<task_id>.output
Opening View for User
Open tmux in Warp:
osascript -e 'tell application "Warp" to activate' \
-e 'delay 0.5' \
-e 'tell application "System Events" to tell process "Warp" to keystroke "t" using command down' \
-e 'delay 0.3' \
-e 'tell application "System Events" to tell process "Warp" to keystroke "tmux attach -t ralph-001"' \
-e 'tell application "System Events" to tell process "Warp" to key code 36'
Workflow: Multiple Features
-
Start first loop on main branch:
git checkout 010-feature-branch
tmux new-session -d -s ralph-001 -c /path/to/project
tmux send-keys -t ralph-001 './ralph.sh start specs/010-feature/' Enter
-
Start second loop with worktree:
tmux new-session -d -s ralph-002 -c /path/to/project
tmux send-keys -t ralph-002 './ralph.sh --worktree start specs/012-feature/' Enter
-
Monitor both:
tmux attach -t ralph-001
tmux attach -t ralph-002
-
When done:
gh pr create --base main --head 010-feature-branch
gh pr create --base main --head 012-feature-branch
Troubleshooting
Ralph Stuck / Not Progressing
-
Check if Claude is running:
ps aux | grep claude | grep -v grep
-
Check session file activity:
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
CLAUDE_PROJECT_PATH="$HOME/.claude/projects/-$(echo "$PROJECT_ROOT" | tr '/' '-' | sed 's/^-//')"
find "$CLAUDE_PROJECT_PATH" -name "*.jsonl" -mmin -5
-
View Claude's recent actions (see "Viewing Claude Session Context" above)
-
If stuck, graceful stop and resume:
touch <spec_dir>/.ralph/.stop
./ralph.sh --resume start <spec_dir>
Session File Not Updating
Claude may be waiting for:
- User input (shouldn't happen with
--dangerously-skip-permissions)
- A long-running background task
- Rate limiting
Check background task output files in /private/tmp/claude/.
Docker/Server Issues
Ralph's Claude often needs running servers. If tests fail:
docker compose -f docker-compose.local.yml down
docker compose -f docker-compose.local.yml up -d --build
Tmux Scrolling Issues (macOS)
If scrolling with trackpad in tmux creates escape sequences like ^[OA^[OA^[[A:
tmux set -g mouse on
echo "set -g mouse on" >> ~/.tmux.conf
This fixes trackpad scrolling in attached tmux sessions.
Resources
speckit-ralph Repository
lib/ralph.sh - Main orchestrator
lib/context-builder.sh - Prompt assembly
lib/task-parser.sh - Parse tasks.md
lib/progress-tracker.sh - State management
Project Files
.specify/ralph/config.sh - Global config
.specify/ralph/ralph-global.md - Workspace-global prompt (skill mappings)
<spec>/ralph.config - Per-spec config
<spec>/ralph-spec.md - Spec-specific prompt (feature patterns)
<spec>/.ralph/progress.json - Task progress state
<spec>/.ralph/session.log - Execution log
<spec>/.ralph/.stop - Graceful stop trigger file
Skill Files
.claude/skills/workspace-ralph-orchestrator/SKILL.md - This documentation
.claude/skills/workspace-ralph-orchestrator/ralph-context.sh - Context helper script