Ralphloop
A powerful CLI tool for creating and running Ralphiloops with adaptive LLM integration
๐ Overview
Ralphloop is a Rust-based command-line tool that enables you to create and execute Ralphiloops - structured, iterative workflows that leverage Large Language Models (LLMs) to automate complex reasoning tasks. Whether you're doing code reviews, content creation, research, or problem-solving, Ralphloop provides a flexible framework to build repeatable AI-powered workflows.
โจ Key Features
- ๐ค Multi-Provider Support: Works with OpenAI, Anthropic, Google Gemini, and local LLMs
- ๐ Template System: Pre-built templates for common workflows
- ๐ง Configuration Management: Secure, flexible configuration with multiple profiles
- ๐ฏ Variable Management: Dynamic variable substitution and context passing
- โก Async Execution: Fast, non-blocking execution with proper error handling
- ๐ก๏ธ Type Safety: Built with Rust for memory safety and performance
- ๐ฆ Easy Distribution: Single binary distribution with no runtime dependencies
๐ฆ Installation
From Crates.io (Recommended)
From Source
The binary will be available at target/release/ralphloop.
๐ Quick Start
1. Configure Your LLM Provider
First, set up your preferred LLM provider:
# OpenAI
# Anthropic Claude
# Local LLM (Ollama)
2. Create Your First Ralph Loop
Create a loop from a template:
# Create a code review loop
Or create a custom loop manually:
3. Run Your Loop
# Run once
# Run multiple iterations
๐ Usage Guide
Configuration
Setting Up Providers
Each LLM provider requires specific configuration:
OpenAI
Anthropic
Google Gemini
Local LLM (Ollama/Llama.cpp)
Multiple Profiles
You can create multiple configuration profiles:
# Create a development profile
# Use a specific profile
Loop Creation
Using Templates
Ralph CLI comes with several built-in templates:
Available Templates
| Template | Description | Use Case |
|---|---|---|
code-review |
Automated code analysis and improvement suggestions | Development workflow |
content-creation |
Structured content generation with refinement | Blog posts, documentation |
research |
Systematic information gathering and synthesis | Academic or market research |
creative-writing |
Story development with narrative structure | Creative projects |
problem-solving |
Structured approach to complex problems | Decision making |
Custom Loop Structure
Ralphiloops are defined in JSON format:
Loop Execution
Basic Execution
Advanced Options
# Run multiple iterations
# Run with specific profile
# Dry run (show prompts without executing)
Variable Substitution
Ralph CLI supports dynamic variable substitution:
{{variable}}: Use variables from thevariablessection{{context.key}}: Use context from previous step outputs{{iteration}}: Current iteration number (for multi-iteration runs){{timestamp}}: Current timestamp
๐๏ธ Architecture
Core Components
ralphloop/
โโโ src/
โ โโโ main.rs # CLI entry point and command handling
โ โโโ ralph_loop.rs # Core loop structure and execution engine
โ โโโ llm.rs # LLM provider abstractions and implementations
โ โโโ config.rs # Configuration management
โ โโโ templates.rs # Built-in templates
โโโ examples/ # Example loops and configurations
Key Concepts
- Ralph Loop: A structured workflow with steps that execute sequentially based on dependencies
- Step: Individual unit of work that calls an LLM with a specific prompt
- Variable: Named values that can be passed between steps
- Template: Predefined loop structure for common use cases
- Provider: LLM service implementation (OpenAI, Anthropic, etc.)
๐งช Examples
Code Review Loop
Content Creation Loop
๐ง Configuration
Configuration File Location
- macOS:
~/Library/Application Support/com.ralph.ralphloop/config.json - Linux:
~/.local/share/com.ralph.ralphloop/config.json - Windows:
%APPDATA%\com.ralph\ralphloop\config.json
Environment Variables
You can override configuration with environment variables:
๐งช Testing
Running Tests
# Run all tests
# Run with coverage
# Run integration tests
Mock Mode
For testing without API calls:
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
Code Style
# Format code
# Run clippy
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- The Rust community for excellent tooling and libraries
- OpenAI, Anthropic, and other LLM providers for their APIs
- The concept of "Ralphiloops" inspired by iterative AI workflows
๐ Additional Resources
๐ Support
- ๐ Documentation
- ๐ Issue Tracker
- ๐ฌ Discussions
- ๐ง Email Support
Made with โค๏ธ by the Ralphloop community