Configuration
Configuration
Section titled “Configuration”ralph uses a TOML configuration file located at .ralph/config.toml.
Configuration File
Section titled “Configuration File”Run ralph init to create the configuration:
ralph initFull Configuration Example
Section titled “Full Configuration Example”# AI adapter: claude, opencode, or geminiadapter = "claude"
# Directory for plans, prompts, and progressplansDir = ".plans"
# Maximum iterations before stoppingmaxIterations = 10
# Enable verbose outputverbose = false
# Enable Terminal UItui = true
# Show token usage infoshowUsage = false
# Lifecycle hooks (shell commands)[hooks]ralph_start = ""ralph_loop_start = ""ralph_loop_end = ""ralph_complete = ""ralph_max_iterations = ""Configuration Options
Section titled “Configuration Options”Adapter
Section titled “Adapter”adapter = "claude"The AI CLI tool to use. Options:
| Adapter | Status | Description |
|---|---|---|
claude | Complete | Anthropic’s Claude Code CLI |
opencode | Complete | Open-source AI coding assistant |
gemini | Under Development | Google’s Gemini CLI |
Plans Directory
Section titled “Plans Directory”plansDir = ".plans"Directory containing your PRD, prompt template, and progress file. Created by ralph init.
Max Iterations
Section titled “Max Iterations”maxIterations = 10Safety limit on loop iterations. ralph stops when this limit is reached, even if the task isn’t complete.
Verbose Mode
Section titled “Verbose Mode”verbose = falseEnable detailed output for debugging.
Terminal UI
Section titled “Terminal UI”tui = trueEnable the interactive terminal UI. Set to false for plain text output (useful in CI).
Show Usage
Section titled “Show Usage”showUsage = falseDisplay token usage and cost information after each iteration.
Hooks allow you to run shell commands at key points in the loop lifecycle.
[hooks]ralph_start = "npm run lint:fix"ralph_loop_start = ""ralph_loop_end = "npm run format"ralph_complete = "npm run notify"ralph_max_iterations = ""Available Hooks
Section titled “Available Hooks”| Hook | Timing |
|---|---|
ralph_start | Before the first iteration |
ralph_loop_start | Before each iteration |
ralph_loop_end | After each iteration |
ralph_complete | When task completes successfully |
ralph_max_iterations | When max iterations limit is reached |
Configuration Precedence
Section titled “Configuration Precedence”Configuration is merged in this order (later overrides earlier):
- Default values
- User-level config (
~/.ralph/config.toml) - Project-level config (
.ralph/config.toml) - CLI options
Example:
# Config says maxIterations = 10# This overrides to 5ralph run --max-iterations 5Project Structure
Section titled “Project Structure”After running ralph init, your project will have:
project/├── .ralph/│ └── config.toml # Configuration└── .plans/ ├── prd.json # Product requirements (features to build) ├── PROMPT.md # System prompt for the AI └── progress.txt # Learning log across iterationsThe AI reads and modifies files in .plans/ during execution, persisting state between context resets.