Skip to content

CLI Reference

Complete reference for all ralph commands and options.

Start the agentic loop.

Terminal window
ralph run [options]

Options:

OptionAliasTypeDescription
--max-iterations-nnumberMaximum loop iterations (default from config)
--once-obooleanRun single iteration (no loop)
--prompt-pstringPrompt text or path to prompt file
--cwd-cstringWorking directory
--verbose-vbooleanEnable verbose output
--no-tui-booleanDisable TUI (plain text output)
--output-format-fstringOutput format: stream-json, opencode-json, text
--log-file-lstringWrite raw stream-json output to file

Examples:

Terminal window
# Run with default config
ralph run
# Run with specific prompt file
ralph run --prompt .plans/PROMPT.md
# Run single iteration (no loop)
ralph run --once
# Limit iterations
ralph run --max-iterations 5
# Verbose output for debugging
ralph run -v
# Disable TUI for CI/plain output
ralph run --no-tui

Exit Reasons:

The run command exits with one of these reasons:

  • complete - Task finished (AI output <promise>COMPLETE</promise> marker)
  • error - Process exited with non-zero code
  • user_abort - User interrupted (Ctrl+C)
  • max_iterations - Reached maximum iteration limit

Initialize ralph in a project directory.

Terminal window
ralph init [options]

Options:

OptionAliasTypeDescription
--cwd-cstringWorking directory for initialization
--force-fbooleanOverwrite existing files

What it creates:

project/
├── .ralph/
│ └── config.toml # Ralph configuration
└── .plans/
├── prd.json # Product requirements document
├── PROMPT.md # System prompt template
└── progress.txt # Progress tracking log

Interactive prompts:

  • Plans directory name (default: .plans)
  • AI CLI adapter selection (claude, opencode, or gemini)

Example:

Terminal window
# Initialize in current directory
ralph init
# Initialize with force overwrite
ralph init --force
# Initialize in specific directory
ralph init --cwd /path/to/project

Validate the prd.json against the schema.

Terminal window
ralph check [options]

Options:

OptionAliasTypeDescription
--cwd-cstringWorking directory

Example:

Terminal window
$ ralph check
prd.json is valid (3 features)

If validation fails, errors are listed and the command exits with code 1.


These options work with all commands:

OptionDescription
--help, -hShow help
--versionShow version
CodeMeaning
0Success
1Error

ralph uses a TOML configuration file at .ralph/config.toml. See the Configuration page for details.