Skip to content

Configuration

ralph uses a TOML configuration file located at .ralph/config.toml.

Run ralph init to create the configuration:

Terminal window
ralph init
# AI adapter: claude, opencode, or gemini
adapter = "claude"
# Directory for plans, prompts, and progress
plansDir = ".plans"
# Maximum iterations before stopping
maxIterations = 10
# Enable verbose output
verbose = false
# Enable Terminal UI
tui = true
# Show token usage info
showUsage = false
# Lifecycle hooks (shell commands)
[hooks]
ralph_start = ""
ralph_loop_start = ""
ralph_loop_end = ""
ralph_complete = ""
ralph_max_iterations = ""
adapter = "claude"

The AI CLI tool to use. Options:

AdapterStatusDescription
claudeCompleteAnthropic’s Claude Code CLI
opencodeCompleteOpen-source AI coding assistant
geminiUnder DevelopmentGoogle’s Gemini CLI
plansDir = ".plans"

Directory containing your PRD, prompt template, and progress file. Created by ralph init.

maxIterations = 10

Safety limit on loop iterations. ralph stops when this limit is reached, even if the task isn’t complete.

verbose = false

Enable detailed output for debugging.

tui = true

Enable the interactive terminal UI. Set to false for plain text output (useful in CI).

showUsage = false

Display 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 = ""
HookTiming
ralph_startBefore the first iteration
ralph_loop_startBefore each iteration
ralph_loop_endAfter each iteration
ralph_completeWhen task completes successfully
ralph_max_iterationsWhen max iterations limit is reached

Configuration is merged in this order (later overrides earlier):

  1. Default values
  2. User-level config (~/.ralph/config.toml)
  3. Project-level config (.ralph/config.toml)
  4. CLI options

Example:

Terminal window
# Config says maxIterations = 10
# This overrides to 5
ralph run --max-iterations 5

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 iterations

The AI reads and modifies files in .plans/ during execution, persisting state between context resets.