### Ralph v2 Initialization with Presets Source: https://mikeyobrien.github.io/ralph-orchestrator/reference/migration-v1_q= Example of initializing Ralph v2 using a pre-configured workflow or 'preset'. Demonstrates the command to start a new project with a specific setup, such as 'tdd-red-green'. ```bash ralph init --preset tdd-red-green ``` -------------------------------- ### Example Task: Markdown to HTML Converter CLI Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/quick-start_q= An example task prompt for building a command-line tool that converts Markdown to HTML. The tool should support input/output file arguments and a watch mode. ```markdown Build a markdown to HTML converter: - Accept input/output file arguments - Support basic markdown syntax - Add --watch mode ``` -------------------------------- ### Install and Verify Claude AI Backend CLI Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/quick-start_q= Installs the Claude AI backend CLI and verifies its installation. Ralph requires at least one AI CLI tool to function. ```bash # Claude Code npm install -g @anthropic-ai/claude-code # Verify the CLI is available claude --version ``` -------------------------------- ### Install Ralph Orchestrator using npm Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started_q= Installs the Ralph Orchestrator CLI globally using npm. This is the recommended installation method. Ensure Node.js and npm are installed on your system. ```bash npm install -g @ralph-orchestrator/ralph-cli ``` -------------------------------- ### Install and Configure Gemini CLI Backend Source: https://mikeyobrien.github.io/ralph-orchestrator/guide/backends Provides instructions for installing the Gemini CLI using npm, configuring the `GEMINI_API_KEY` environment variable for authentication, and verifying the installation with `gemini --version`. ```bash # Install npm install -g @google/gemini-cli # Configure API key export GEMINI_API_KEY=your-key # Verify gemini --version ``` -------------------------------- ### Example Ralph Orchestrator Log Output Source: https://mikeyobrien.github.io/ralph-orchestrator/quick-start Illustrates typical output from Ralph Orchestrator during execution. This log shows the start of the process, agent selection, iteration progress, and completion status. ```log 2025-09-08 10:30:45 - INFO - Starting Ralph Orchestrator v1.0.0 2025-09-08 10:30:45 - INFO - Using agent: claude 2025-09-08 10:30:45 - INFO - Starting iteration 1/100 2025-09-08 10:30:52 - INFO - Iteration 1 complete 2025-09-08 10:30:52 - INFO - Task not complete, continuing... ``` -------------------------------- ### Example Task: Node.js Web Scraper Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/quick-start_q= An example task prompt for building a web scraper using Node.js. The scraper should fetch the Hacker News homepage, extract the top 10 stories, and save them to a JSON file. ```markdown Create a web scraper that: 1. Fetches the Hacker News homepage 2. Extracts the top 10 stories 3. Saves them to JSON Use Node.js with a simple HTML parser. ``` -------------------------------- ### Install and Verify Kiro CLI Backend Source: https://mikeyobrien.github.io/ralph-orchestrator/guide/backends Details the installation process for the Kiro CLI, which involves visiting a URL, and how to verify the installation using `kiro-cli --version`. It mentions AWS/SSO authentication and the optional `KIRO_API_KEY`. ```bash # Install # Visit https://kiro.dev/ # Verify kiro-cli --version ``` -------------------------------- ### Install Q Chat AI Agent (Python) Source: https://mikeyobrien.github.io/ralph-orchestrator/quick-start Installs the Q Chat AI agent using pip. This agent is compatible with Ralph Orchestrator. Ensure you have Python and pip installed. ```bash pip install q-cli # Or follow instructions at https://github.com/qchat/qchat ``` -------------------------------- ### Verify Ralph CLI Installation Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started Commands to verify that the Ralph Orchestrator CLI has been installed correctly. The `--version` flag checks the installed version, while `--help` displays available commands and options. ```bash ralph --version ralph --help ``` -------------------------------- ### Clone Ralph Orchestrator and Install Dependencies (Bash) Source: https://mikeyobrien.github.io/ralph-orchestrator/quick-start Clones the Ralph Orchestrator repository from GitHub and installs optional dependencies like psutil for system monitoring. This is a foundational step before running Ralph. ```bash # Clone the repository git clone https://github.com/mikeyobrien/ralph-orchestrator.git cd ralph-orchestrator # Install optional dependencies for monitoring pip install psutil # Recommended for system metrics ``` -------------------------------- ### Ralph Command-Line Options for Running Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/quick-start_q= Provides examples of various command-line options for the `ralph run` command. These options allow customization of the orchestration process, such as limiting iterations, specifying config files, resuming sessions, and enabling quiet mode. ```bash # Limit iterations ralph run --max-iterations 50 # Use different config file ralph run -c custom-ralph.yml # Resume interrupted session ralph run --continue # Quiet mode for CI ralph run -q ``` -------------------------------- ### Install and Verify OpenCode Backend Source: https://mikeyobrien.github.io/ralph-orchestrator/guide/backends Provides instructions for installing the OpenCode CLI using a curl script and verifying the installation with `opencode --version`. It also details the environment variables (`OPENCODE_API_KEY`, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`) that can be used for authentication. ```bash # Install curl -fsSL https://opencode.ai/install | bash # Verify opencode --version ``` -------------------------------- ### Example Task: Web Scraper (Python) Source: https://mikeyobrien.github.io/ralph-orchestrator/quick-start An example task prompt for creating a web scraper using Python's `requests` and `BeautifulSoup` libraries. It specifies fetching the HackerNews homepage, extracting top stories, and saving them to a JSON file. ```markdown Create a web scraper that: 1. Fetches the HackerNews homepage 2. Extracts the top 10 stories 3. Saves them to a JSON file Use requests and BeautifulSoup. ``` -------------------------------- ### Prompt Engineering Examples Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/first-task Illustrates effective prompt writing techniques for Ralph, emphasizing specificity, inclusion of acceptance criteria, and defining constraints to guide the AI. ```markdown # Bad Make a web app. # Good Create an Axum web app with: - GET /health endpoint returning {"status": "ok"} - POST /users accepting JSON {name, email} - SQLite database for persistence ## Acceptance Criteria - [ ] All endpoints respond correctly - [ ] Invalid JSON returns 400 error - [ ] Database persists across restarts ## Constraints - Use Axum (not Actix) - Rust 1.75+ - No external API calls ``` -------------------------------- ### Build Ralph from Source Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/installation Installs the latest development version of Ralph Orchestrator by cloning the repository, building the release binary with Cargo, and adding it to the system's PATH. ```bash # Clone the repository git clone https://github.com/mikeyobrien/ralph-orchestrator.git cd ralph-orchestrator # Build release binary cargo build --release # Add to PATH export PATH="$PATH:$(pwd)/target/release" # Or create symlink sudo ln -s $(pwd)/target/release/ralph /usr/local/bin/ralph ``` -------------------------------- ### Install and Authenticate Copilot CLI Backend Source: https://mikeyobrien.github.io/ralph-orchestrator/guide/backends Guides users through installing the Copilot CLI using npm, authenticating via `copilot auth login`, and verifying the installation with `copilot --version`. It mentions that Copilot authentication does not rely on specific environment variables checked by `ralph doctor`. ```bash # Install npm install -g @github/copilot # Authenticate copilot auth login # Verify copilot --version ``` -------------------------------- ### Troubleshoot Permission Denied (npm) Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/installation_q= Installs the Ralph CLI globally using npm with sudo privileges to overcome permission errors. ```bash # For npm sudo npm install -g @ralph-orchestrator/ralph-cli ``` -------------------------------- ### Ralph Hats Configuration Example (YAML) Source: https://mikeyobrien.github.io/ralph-orchestrator/reference/troubleshooting An example of Ralph hats configuration, defining triggers and publishes for different hats. This snippet illustrates how to manage event routing and avoid conflicts. ```yaml hats: builder: triggers: ["build.task"] publishes: ["build.done"] reviewer: triggers: ["review.request"] publishes: ["review.done"] ``` -------------------------------- ### Ralph Init Command Examples Source: https://mikeyobrien.github.io/ralph-orchestrator/guide/cli-reference_q= Shows how to initialize Ralph configuration files using different backends, presets, and options. Includes listing available presets and forcing overwrites. ```bash # Traditional mode with Claude ralph init --backend claude # Use TDD preset ralph init --preset tdd-red-green # List all presets ralph init --list-presets # Force overwrite ralph init --preset debug --force ``` -------------------------------- ### Verify Ralph Environment Setup Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/quick-start_q= Runs the `ralph doctor` command to check the environment and identify any potential issues with the Ralph installation and its dependencies. It helps in troubleshooting setup problems. ```bash ralph doctor ``` -------------------------------- ### Ralph Plan Command Examples Source: https://mikeyobrien.github.io/ralph-orchestrator/guide/cli-reference_q= Demonstrates how to initiate a PDD planning session with or without an initial idea, and how to specify a backend. ```bash # Interactive planning ralph plan # Plan with idea ralph plan "build a REST API" # Use specific backend ralph plan --backend kiro "my idea" ``` -------------------------------- ### Verify Ralph Orchestrator Installation Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started_q= Commands to verify that the Ralph Orchestrator CLI has been installed correctly. These commands will display the installed version and the help menu. ```bash ralph --version ralph --help ``` -------------------------------- ### Best Practice: Start Small with Iterations Source: https://mikeyobrien.github.io/ralph-orchestrator/guide/agents_q= This command demonstrates the best practice of starting with a small number of iterations for testing. This allows for quicker feedback cycles and reduces unnecessary computation. ```shell python ralph_orchestrator.py --agent auto --max-iterations 5 ``` -------------------------------- ### Install Claude AI Agent (Node.js) Source: https://mikeyobrien.github.io/ralph-orchestrator/quick-start Installs the Claude AI agent using npm. This is a recommended agent for Ralph Orchestrator. Ensure you have Node.js and npm installed. ```bash npm install -g @anthropic-ai/claude-code # Or visit https://claude.ai/code for setup instructions ``` -------------------------------- ### Install and Verify Amp Backend Source: https://mikeyobrien.github.io/ralph-orchestrator/guide/backends Provides instructions for installing the Amp backend by visiting a GitHub repository and verifying the installation using `amp --version`. It notes that Amp does not rely on specific auth environment variables checked by `ralph doctor`. ```bash # Install # Visit https://github.com/sourcegraph/amp # Verify amp --version ``` -------------------------------- ### Install ACP-Compliant Agent (Node.js) Source: https://mikeyobrien.github.io/ralph-orchestrator/quick-start Installs an ACP-compliant AI agent, such as the Gemini CLI, for use with Ralph Orchestrator. This allows Ralph to interact with agents supporting the ACP protocol. Ensure you have Node.js and npm installed. ```bash # Any ACP-compliant agent can be used # Example: Gemini CLI with ACP mode npm install -g @google/gemini-cli # Run with: ralph run -a acp --acp-agent gemini ``` -------------------------------- ### Setup Python Package with setuptools Source: https://mikeyobrien.github.io/ralph-orchestrator/examples/cli-tool Configures the Python package 'fman' for distribution using setuptools. It specifies metadata like name, version, author, description, long description from README.md, URL, package discovery, classifiers, Python version requirements, dependencies, and entry points for console scripts. It also includes instructions for including package data. ```python from setuptools import setup, find_packages with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name="fman", version="1.0.0", author="Your Name", author_email="your.email@example.com", description="A powerful file manager CLI tool", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/yourusername/fman", packages=find_packages(), classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Environment :: Console", "Topic :: System :: Filesystems", ], python_requires=">=3.7", install_requires=[ "rich>=10.0.0", "tqdm>=4.60.0", "click>=8.0.0", ], entry_points={ "console_scripts": [ "fman=fman.cli:main", ], }, include_package_data=True, ) ``` -------------------------------- ### Install Gemini CLI AI Agent (Node.js) Source: https://mikeyobrien.github.io/ralph-orchestrator/quick-start Installs the Gemini CLI AI agent using npm. This agent can be configured with your API key and used with Ralph Orchestrator. Ensure you have Node.js and npm installed. ```bash npm install -g @google/gemini-cli # Configure with your API key ``` -------------------------------- ### Run Ralph Orchestrator (Bash) Source: https://mikeyobrien.github.io/ralph-orchestrator/examples/simple-task_q= These bash commands demonstrate how to execute the Ralph Orchestrator. The first shows basic execution using a prompt file. Subsequent examples illustrate running with specific agent choices and cost/iteration limits for budget-conscious or quality-focused approaches. ```bash python ralph_orchestrator.py --prompt todo-prompt.md ``` ```bash # Budget-conscious approach python ralph_orchestrator.py \ --agent q \ --prompt todo-prompt.md \ --max-cost 2.0 \ --max-iterations 20 ``` ```bash # Quality-focused approach python ralph_orchestrator.py \ --agent claude \ --prompt todo-prompt.md \ --max-cost 10.0 \ --checkpoint-interval 3 ``` -------------------------------- ### Install Ralph CLI using Cargo Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started Installs the Ralph Orchestrator CLI using Cargo, Rust's package manager. This method is for users who have Rust and Cargo installed and prefer to build from source or manage Rust-based tools. ```bash cargo install ralph-cli ``` -------------------------------- ### Initialize a New Ralph Project Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/quick-start_q= Initializes a new Ralph project by creating a directory, initializing git, and generating a default configuration file. This sets up the basic structure for an orchestration project. ```bash mkdir my-ralph-project cd my-ralph-project git init # Ralph works best with git # Create a default config ralph init --backend claude ``` -------------------------------- ### Install Ralph CLI using npm Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started Installs the Ralph Orchestrator CLI globally using npm, the recommended package manager. This is a straightforward command for users who have Node.js and npm set up. ```bash npm install -g @ralph-orchestrator/ralph-cli ``` -------------------------------- ### Run Ralph Orchestrations Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/quick-start_q= Demonstrates how to run Ralph orchestrations using different modes and configurations. It includes traditional mode, hat-based mode, and running with an inline prompt. ```bash # Traditional mode (uses ralph.yml) ralph run # Hat-based mode (uses hats.yml) ralph run --config hats.yml # Inline prompt example ralph run -p "Add input validation to the user API endpoints" ``` -------------------------------- ### Custom Event Loop Example in Rust Source: https://mikeyobrien.github.io/ralph-orchestrator/api/ralph-core Provides an example of setting up and running a custom event loop using Ralph. It demonstrates loading configuration, creating the EventLoop, and optionally adding custom event listeners. ```rust use ralph_core::{Config, EventLoop}; use ralph_proto::{EventBus, Event}; #[tokio::main] async fn main() -> Result<()> { // Load config let config = Config::load("ralph.yml")?; // Create event loop let mut event_loop = EventLoop::new(config); // Optional: Add custom event listener event_loop.on_event(|event| { println!("Event: {:?}", event.topic); }); // Run let result = event_loop.run().await?; println!("Completed in {} iterations", result.iterations); Ok(()) } ``` -------------------------------- ### Troubleshooting: Agent Not Found Error Source: https://mikeyobrien.github.io/ralph-orchestrator/quick-start Displays an error message indicating that no AI agents were detected by Ralph Orchestrator. The solution is to install one of the supported agents as outlined in Step 1 of the guide. ```log ERROR: No AI agents detected. Please install claude, q, gemini, or an ACP-compliant agent. ``` -------------------------------- ### Running Ralph Orchestrator Locally Source: https://mikeyobrien.github.io/ralph-orchestrator/contributing/setup Demonstrates various ways to run the Ralph Orchestrator binary locally from source code. Includes commands for debug builds, release builds, and direct execution of the compiled binary. ```bash # From source cargo run --bin ralph -- run -p "test prompt" # With release build cargo run --release --bin ralph -- run -p "test prompt" # Direct binary ./target/release/ralph run -p "test prompt" ``` -------------------------------- ### Convert Ralph v1 Configuration to v2 YAML Source: https://mikeyobrien.github.io/ralph-orchestrator/reference/migration-v1_q= Step-by-step guide and code examples for converting Ralph v1's Python dictionary configuration to Ralph v2's YAML format. Highlights mapping of old keys like 'agent' to new ones like 'cli.backend'. ```yaml cli: backend: "claude" # was "agent" event_loop: completion_promise: "LOOP_COMPLETE" max_iterations: 100 # same as before ``` -------------------------------- ### Example Task: TypeScript Email Validation Function Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/quick-start_q= An example task prompt for creating a TypeScript function that validates email addresses, including unit tests. This illustrates the type of tasks Ralph can handle. ```markdown Write a TypeScript function that validates email addresses. Include unit tests. ``` -------------------------------- ### Install Ralph CLI using Homebrew (macOS) Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started Installs the Ralph Orchestrator CLI on macOS using the Homebrew package manager. This command is suitable for macOS users who prefer using Homebrew for managing their software. ```bash brew install ralph-orchestrator ``` -------------------------------- ### Test Ralph v2 Installation Source: https://mikeyobrien.github.io/ralph-orchestrator/reference/migration-v1_q= Commands to test the newly installed Ralph v2 orchestrator. Includes running in dry-run mode to preview actions and a standard run command to start the TUI. ```bash ralph run --dry-run ralph run ``` -------------------------------- ### Load Testing Command Line Example Source: https://mikeyobrien.github.io/ralph-orchestrator/03-best-practices/best-practices Provides an example command for initiating load testing using the `locust` tool. This command specifies the locust file and the target host for the performance tests. ```bash # Use tools like locust for load testing locust -f load_test.py --host=http://localhost:8000 ``` -------------------------------- ### Adaptive Entry Point Workflow Example (code-assist.yml) Source: https://mikeyobrien.github.io/ralph-orchestrator/concepts/coordination-patterns Demonstrates a 'code-assist' workflow using hats for planning, building, validating, and committing. It illustrates event triggers and publications between different stages of the workflow, showing how Ralph orchestrates tasks based on input and validation results. ```yaml hats: planner: triggers: ["build.start"] publishes: ["tasks.ready"] # Detects: PDD directory vs. code task file vs. description builder: triggers: ["tasks.ready", "validation.failed", "task.complete"] publishes: ["implementation.ready", "task.complete"] validator: triggers: ["implementation.ready"] publishes: ["validation.passed", "validation.failed"] committer: triggers: ["validation.passed"] publishes: ["commit.complete"] ``` -------------------------------- ### Example Task: Email Validation Function (Python) Source: https://mikeyobrien.github.io/ralph-orchestrator/quick-start An example task prompt requesting a Python function to validate email addresses using regular expressions, including comprehensive unit tests. This demonstrates the type of tasks Ralph Orchestrator can handle. ```markdown Write a Python function that validates email addresses using regex. Include comprehensive unit tests. ``` -------------------------------- ### Initialize Ralph with Presets (CLI) Source: https://mikeyobrien.github.io/ralph-orchestrator/guide/presets Demonstrates how to use the Ralph CLI to initialize project configurations with various presets. This includes listing available presets, applying specific presets like 'feature' or 'spec-driven', combining presets with backends, and forcing an overwrite of existing configurations. ```bash # List all presets ralph init --list-presets # Initialize with a preset ralph init --preset feature # Combine with backend ralph init --preset spec-driven --backend kiro # Overwrite existing config ralph init --preset debug --force ``` -------------------------------- ### Install and Configure Codex Backend Source: https://mikeyobrien.github.io/ralph-orchestrator/guide/backends Details the installation of the Codex backend by visiting a GitHub repository, configuring the `OPENAI_API_KEY` or `CODEX_API_KEY` environment variable, and verifying with `codex --version`. ```bash # Install # Visit https://github.com/openai/codex # Configure export OPENAI_API_KEY=your-key # Verify codex --version ``` -------------------------------- ### Create a Task Prompt (Markdown) Source: https://mikeyobrien.github.io/ralph-orchestrator/quick-start Defines a task for Ralph Orchestrator in a Markdown file. This example outlines the creation of a Python command-line todo list application with specific features and error handling. ```markdown # Task: Create a Todo List CLI Build a Python command-line todo list application with: - Add tasks - List tasks - Mark tasks as complete - Save tasks to a JSON file Include proper error handling and a help command. The orchestrator will continue iterations until all requirements are met or limits reached. ``` -------------------------------- ### Install Ralph via Cargo Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/installation Installs the Ralph CLI using Cargo, the Rust package manager. This method requires Rust to be installed on the system. ```bash cargo install ralph-cli ``` -------------------------------- ### Start New Feature with Ralph Source: https://mikeyobrien.github.io/ralph-orchestrator/guide Guides through starting a new feature development using Ralph Orchestrator. It involves initializing with a 'feature' preset, editing the prompt, and running the orchestrator. ```bash ralph init --preset feature # Edit PROMPT.md with your feature spec ralph run ``` -------------------------------- ### Configuration: v1 Python vs. v2 YAML Source: https://mikeyobrien.github.io/ralph-orchestrator/reference/migration-v1 Compares the configuration formats for Ralph v1 (Python dictionary) and v2 (YAML). Demonstrates the structure for defining agent, cost limits, iterations, and checkpoint intervals in both versions. ```python # ralph_config.py config = { "max_iterations": 100, "agent": "claude", "cost_limit": 10.0, "checkpoint_interval": 10, } ``` ```yaml # ralph.yml cli: backend: "claude" event_loop: completion_promise: "LOOP_COMPLETE" max_iterations: 100 checkpoint_interval: 10 ``` -------------------------------- ### Common Configuration: Research (Solo Mode) Source: https://mikeyobrien.github.io/ralph-orchestrator/migration/v2-hatless-ralph_q= An example of a common Ralph configuration for research tasks, utilizing solo mode. This setup omits the 'hats' section, indicating that Ralph will handle all tasks directly without specialized hats, simplifying the configuration for research-oriented workflows. ```yaml cli: backend: claude # No hats - Ralph does everything ``` -------------------------------- ### PROMPT.md File Format Example Source: https://mikeyobrien.github.io/ralph-orchestrator/reference/migration-v1_q= An example of the PROMPT.md file format used with Ralph orchestrator. Details the structure including task title, description, and requirements. Notes changes in completion markers from v1 to v2. ```markdown # Task: My Task Description here. ## Requirements - Requirement 1 - Requirement 2 **Changes:** * `- [x] TASK_COMPLETE` marker is no longer used * Use `LOOP_COMPLETE` in output instead * Acceptance criteria still work the same ``` -------------------------------- ### Install Ralph via Homebrew (macOS) Source: https://mikeyobrien.github.io/ralph-orchestrator/getting-started/installation Installs Ralph Orchestrator on macOS using the Homebrew package manager. This is a convenient method for macOS users. ```bash brew install ralph-orchestrator ``` -------------------------------- ### Example Todo List Data Format (JSON) Source: https://mikeyobrien.github.io/ralph-orchestrator/examples/simple-task_q= This JSON structure represents the data format for storing todo items. It includes fields for unique ID, description, completion status, creation timestamp, and completion timestamp, along with a counter for the next available ID. ```json { "todos": [ { "id": 1, "description": "Buy groceries", "completed": false, "created_at": "2024-01-10T10:00:00", "completed_at": null } ], "next_id": 2 } ```