Documentation Index
Fetch the complete documentation index at: https://mintlify.com/snarktank/ralph/llms.txt
Use this file to discover all available pages before exploring further.
Command Syntax
Available Options
—tool
Selects which AI coding tool Ralph uses for each iteration.Type: String (required after flag)Default: Validation:The script validates the tool choice and exits with code 1 if invalid:
ampValid values:amp- Uses the Amp CLIclaude- Uses Claude Code
Tool-Specific Behavior
Both tools run with “dangerously” flags to enable fully autonomous operation. This allows Ralph to make file changes, run commands, and commit code without user interaction.
max_iterations
Defines the maximum number of agent iterations before Ralph stops.Type: Positive integerDefault: Early exit:If all tasks complete before reaching
10Position: Can appear anywhere in arguments (detected by regex pattern)Range: Any positive integer (1 to unlimited)Examples:max_iterations, Ralph exits immediately with success (code 0).Parsing Logic
The script identifiesmax_iterations using pattern matching:
max_iterations. Non-numeric arguments are either flags or ignored.
Argument Parsing Order
Ralph processes arguments left-to-right:- —tool flag: Consumes next argument as tool name
- —tool=value: Extracts value after equals sign
- Numeric arguments: Sets
max_iterations - Other arguments: Ignored
Examples
Internal Variables
Ralph sets these variables based on CLI arguments:TOOL
- Source:
--toolflag or default - Used by: Iteration loop to select AI command
- Validation: Must be exactly “amp” or “claude”
MAX_ITERATIONS
- Source: Numeric positional argument or default
- Used by: Loop counter
seq 1 $MAX_ITERATIONS - Validation: None (any positive integer accepted)
Script Paths
These are derived from the script location, not CLI arguments:Error Handling
Invalid Tool Name
Missing Tool Argument
Non-Numeric max_iterations
Invalid numeric values are silently ignored and don’t cause errors. Only the
--tool validation is strict.Exit Codes Reference
| Code | Condition | Meaning |
|---|---|---|
0 | Success | All tasks completed (found <promise>COMPLETE</promise>) |
1 | Error | Invalid tool name provided |
1 | Incomplete | Reached max_iterations without completing all tasks |
Integration with prd.json
While not a CLI option,prd.json affects Ralph’s behavior:
Triggers archive creation when changed between runs.Ralph compares the current
branchName with .last-branch and archives the previous run if they differ.Controls iteration behavior.When all stories have
passes: true, the AI outputs <promise>COMPLETE</promise> and Ralph exits successfully.Environment Configuration
Ralph doesn’t use environment variables for configuration, but the AI tools it invokes might:Amp Configuration
Claude Code Configuration
Ensure these are configured before running Ralph. The script doesn’t validate API credentials.
Best Practices
Setting max_iterations
Small features (1-3 stories):Tool Selection
Choose based on your team’s setup:Advanced Argument Patterns
Using with xargs
Scripting with variables
CI/CD Integration
Comparison with Other Tools
Unlike traditional CLI tools, Ralph’s options are minimal by design: Ralph approach:Ralph’s simplicity is intentional. All configuration lives in the prompt files (
prompt.md and CLAUDE.md), keeping the CLI interface minimal and focused on orchestration.
