Execute Ralph orchestration system for autonomous task execution
Executes autonomous multi-step tasks using Ralph orchestrator with Codex CLI agent.
/plugin marketplace add jleechanorg/claude-commands/plugin install claude-commands@claude-commands-marketplacePurpose: Launch Ralph task agent to autonomously execute complex multi-step goals with continuous iteration until completion.
Ralph = Standalone ralph-orchestrator fork at /Users/$USER/projects_other/ralph-orchestrator
python -m ralph_orchestratorGenesis = WorldArchitect.ai orchestration system (different from Ralph!)
/Users/$USER/projects/worktree_ralph/genesis/--claude flag)python genesis/genesis.py/gene command for Genesis executionRequired: /Users/$USER/projects_other/ralph-orchestrator
This command will verify the Ralph repo exists before executing. If you want to use a different Ralph installation, specify the repo path as the first argument.
/ralph <goal-file-path> [max-iterations] [ralph-repo-path]
Parameters:
goal-file-path: Path to markdown goal file defining the autonomous taskmax-iterations: (Optional) Maximum iterations before stopping (default: 20)ralph-repo-path: (Optional) Path to Ralph repo (default: /Users/$USER/projects_other/ralph-orchestrator)Ralph is an autonomous task agent that:
Default Agent: --agent codex (can override with --agent claude, --agent gemini, or --agent auto)
Fallback Mode: Use --agent auto to try Codex → Claude → Gemini automatically
Ralph goal files must follow this structure:
# Goal: [Clear one-sentence goal statement]
## Current Status
[Document starting state]
## Tasks
1. **Task Name**: Clear, actionable task description
2. **Task Name**: Next sequential task
## Success Criteria
✅ Criterion 1 (measurable outcome)
✅ Criterion 2 (verification method)
✅ Criterion 3 (deliverable exists)
## Autonomous Execution
Ralph should:
1. Read this goal file
2. Execute all tasks sequentially
3. Test after each step
4. Document results
5. Commit and push when complete
# Goal: Complete Production MCP Server Deployment
## Current Status
✅ Mock server working (15/15 tests passing)
❌ Production server crashes (Firebase initialization error)
## Tasks
### Task 1: Fix Firebase Authentication
**Location**: `/path/to/project/src/config/firebase.ts`
**Issue**: Server crashes with "Service account object must contain 'private_key'"
**Fix**: Implement Application Default Credentials (ADC) support
```typescript
// Add ADC fallback path
else if (process.env.FIREBASE_PROJECT_ID) {
console.log('🔑 Using Application Default Credentials (ADC)');
firebaseApp = initializeApp({ projectId: process.env.FIREBASE_PROJECT_ID });
}
Validation:
cd /path/to/project
npm run build
npm start
curl http://localhost:3001/health # Should return 200 OK
After server starts successfully:
curl -X POST http://localhost:3001/api/campaigns \
-H "Content-Type: application/json" \
-d '{"user_id":"test","title":"Test Campaign","setting":"fantasy"}'
curl -X POST http://localhost:3001/api/campaigns/{id}/interaction \
-H "Content-Type: application/json" \
-d '{"user_id":"test","user_input":"I explore the dungeon"}'
Create PRODUCTION_DEPLOYMENT.md with:
git add -A
git commit -m "feat: add production deployment support with ADC authentication
- Implement Application Default Credentials fallback
- Add production deployment documentation
- Validate with real Firebase/Gemini credentials
Tested with campaign creation and interaction endpoints."
git push origin HEAD:production-deployment-work
✅ Production server starts without errors (health endpoint responds) ✅ Campaign creation works with real Firebase (document exists in Firestore) ✅ Interaction endpoint works with real Gemini (response generated) ✅ PRODUCTION_DEPLOYMENT.md exists with complete deployment guide ✅ All changes committed and pushed to remote branch ✅ Final validation report created with test results
Ralph should:
## Ralph Orchestration Workflow
When you execute `/ralph`:
1. **Verify Ralph Repository**
```bash
# Default location
RALPH_REPO="/Users/$USER/projects_other/ralph-orchestrator"
# Or use custom location from parameter
if [ $# -ge 3 ]; then
RALPH_REPO="$3"
fi
# Verify repo exists
if [ ! -d "$RALPH_REPO" ]; then
echo "❌ ERROR: Ralph repository not found at: $RALPH_REPO"
echo "Please ensure ralph-orchestrator is cloned to the expected location"
echo "Or specify custom path: /ralph <goal-file> <iterations> <ralph-repo-path>"
exit 1
fi
echo "✅ Found Ralph repository at: $RALPH_REPO"
Goal File Validation
Launch Ralph Orchestrator
cd "$RALPH_REPO"
# Activate virtual environment if it exists
if [ -d ".venv" ]; then
source .venv/bin/activate
fi
# Run Ralph with Codex agent (explicit default)
python -m ralph_orchestrator "$GOAL_FILE" \
--agent codex \
--max-iterations "$MAX_ITERATIONS" \
--verbose
Monitor Ralph Progress
Verify Completion
Ralph may refuse tasks that appear to violate security policies (credential harvesting, malicious code). If this happens:
For testing with real services:
.env file isTo avoid infinite loops, always specify commit frequency:
## 🚨 MANDATORY COMMIT PROTOCOL
After creating or modifying ANY file, immediately commit:
```bash
git add <filename>
git commit -m "feat: add <filename>"
Progress Validation (every 5 files):
git log --oneline | head -10git status shows clean
## Troubleshooting
### Ralph Gets Stuck in Analysis Paralysis
**Symptom**: Ralph runs for hours but generates minimal code
**Solutions**:
1. Kill Ralph process: `pkill -f "orchestrate_unified.py.*<goal-file-name>"`
2. Review goal file - may be too vague or lack measurable success criteria
3. Add explicit commit protocol to force progress tracking
4. Reduce max iterations to force completion
### Ralph Refuses Security-Sensitive Tasks
**Symptom**: Ralph stops with "violates security policy" message
**Solutions**:
1. Update goal file to clarify legitimate intent
2. Change task framing from "search for" to "use existing"
3. Document that credentials/resources already exist
4. Provide exact file paths to eliminate search behavior
### Ralph Claims Success Without Changes
**Symptom**: Ralph reports task complete but `git status` shows no changes
**Solutions**:
1. Add verification checklist to goal file:
- File existence check
- Git diff validation
- Commit verification
- Work evidence (file paths + line numbers)
2. Require Ralph to provide specific evidence of changes
3. Mandate git commit after each task
## Integration with Other Commands
- **`/orch`**: Launch generic orchestration (use Ralph for autonomous task execution)
- **`/converge`**: Similar autonomous execution with different iteration strategy
- **`/cons`**: Review Ralph's code quality after completion
- **`/checkpoint`**: Save Ralph's progress before major changes
## Real-World Ralph Usage Example
From TypeScript migration benchmark (commit 09ab17d):
```bash
# Ralph command (uses Codex by default)
/ralph /Users/$USER/projects/orch_worldai_ralph/complete-production-deployment.md 30
# Explicit execution (what Ralph does internally)
cd /Users/$USER/projects_other/ralph-orchestrator
python -m ralph_orchestrator \
/Users/$USER/projects/orch_worldai_ralph/complete-production-deployment.md \
--agent codex \
--max-iterations 30 \
--verbose
Goal: Fix undefined field bug, document Firestore index requirement, validate production functionality
Ralph's Autonomous Execution:
npm run build)Evidence: All success criteria met, working production server, complete documentation
Use Ralph (/ralph) for:
Use Genesis (/gene) for:
Use Ralph for:
Manual work for:
Ralph = Standalone ralph-orchestrator, Codex by default, large context (200K) Genesis = WorldArchitect.ai integrated, Codex by default, fast-gen mode with Cerebras