Rev - Autonomous AI Development System with Multi-Agent Orchestration
Project description
rev.py โ Production-Grade Agentic Development System
A robust, pattern-based autonomous development system powered by Ollama for local LLM inference. Built on 21 Agentic Design Patterns for production-grade code generation, testing, and validation.
๐ What Makes Rev Different
Rev isn't just another AI coding assistant โ it's a complete agentic development system implementing industry-proven design patterns:
- ๐ง Agentic Design Patterns โ Built on 21 patterns from research (Goal Setting, Routing, RAG, Recovery, Resource Budgets, etc.)
- ๐ Hybrid Search โ Combines symbolic (regex) + semantic (RAG/TF-IDF) code search for superior context gathering
- ๐ Resource-Aware โ Tracks steps, tokens, and time budgets to prevent runaway execution
- ๐ฏ Goal-Oriented โ Derives measurable goals from requests and validates they're met
- ๐ก๏ธ Production-Ready โ Multi-layer validation, security scanning, auto-recovery, and rollback planning
- โก Intelligent โ Self-routing, priority scheduling, and adaptive agent configuration
Key Features
Agentic Design Patterns (NEW!)
- ๐ฏ Goal Setting & Monitoring โ Automatic goal derivation with measurable success metrics
- ๐ Intelligent Routing โ Analyzes requests and configures optimal agent pipeline
- ๐ RAG (Retrieval-Augmented Generation) โ Semantic code search using TF-IDF for better context
- ๐ Resource Budgets โ Tracks and enforces limits on steps, tokens, and execution time
- ๐ Exception Recovery โ Automatic rollback plans and recovery strategies
- ๐ก Inter-Agent Communication โ Message bus for coordinated multi-agent workflows
- โ๏ธ Coding Workflows โ Multi-stage chains (analyze โ design โ plan โ implement โ test โ refine)
Core Capabilities
- ๐ค 6-Agent System โ Planning, Research, Review, Execution, Validation, and Learning agents
- ๐ญ Orchestrator Mode โ Meta-agent coordinates all agents with resource tracking
- ๐ Research Agent โ Pre-planning codebase exploration (symbolic + semantic search)
- ๐ Learning Agent โ Project memory that learns from past executions
- โ Validation Agent โ Post-execution verification with goal evaluation
- ๐ก๏ธ Intelligent Review โ Automatic validation with security vulnerability detection
- ๐ Complex Task Handling โ Recursive breakdown of large features
- ๐ Smart Automation โ Autonomous execution with review-based approval
- ๐ Planning Mode โ Comprehensive task checklists with recursive decomposition
- โก Execution Mode โ Iterative completion with optional action-level review
- ๐ Parallel Execution โ Run 2+ tasks concurrently for 2-4x faster completion
- ๐งช Automatic Testing โ Runs tests after each change to validate correctness
- ๐ง Full Code Operations โ Review, edit, add, delete, rename files
- ๐ Local LLM โ Uses Ollama (no API keys, fully private)
- ๐ฏ Advanced Planning โ Dependency analysis, impact assessment, risk evaluation
- ๐ ๏ธ Built-in Utilities โ File conversion, code refactoring, dependency management
- โก Intelligent Caching โ File content, LLM responses, repo context, dependency trees
Architecture
Multi-Agent Orchestration System (v2.0)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ USER REQUEST โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโดโโโโโโโโโ
โ ORCHESTRATOR โ (Optional - coordinates all agents)
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. LEARNING AGENT (NEW!) โ
โ โข Recall similar past tasks โ
โ โข Provide success patterns โ
โ โข Estimate execution time โ
โ โข Warn about past failures โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 2. RESEARCH AGENT (NEW!) โ
โ โข Explore codebase before planning โ
โ โข Find relevant files and patterns โ
โ โข Identify similar implementations โ
โ โข Suggest approach based on codebase style โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 3. PLANNING AGENT โ
โ โข Break down request into atomic tasks โ
โ โข Recursive breakdown for complex features โ
โ โข Generate ordered execution checklist โ
โ โข Assess dependencies, risks, and impact โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 4. REVIEW AGENT โ
โ โข Validate plan completeness โ
โ โข Identify security vulnerabilities โ
โ โข Check for missing or unnecessary tasks โ
โ โข Decision: Approved / Suggestions / Rejected โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 5. EXECUTION AGENT โ
โ โข Execute tasks sequentially or in parallel โ
โ โข [Optional] Review Agent validates each action โ
โ โข Make changes, run tests, validate โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 6. VALIDATION AGENT (NEW!) โ
โ โข Run test suite โ
โ โข Check syntax errors โ
โ โข Run linter โ
โ โข Semantic validation (did changes match request?)โ
โ โข Auto-fix minor issues (optional) โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ LEARNING AGENT (POST) โ
โ โข Store successful patterns โ
โ โข Update project context โ
โ โข Record for future reference โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Agentic Design Patterns
Rev implements 21 Agentic Design Patterns from cutting-edge AI agent research, making it a production-grade development system rather than a simple code assistant.
Pattern Implementations
Phase 1: Foundational Patterns โ
- Goal Setting & Monitoring โ Automatic derivation of measurable goals from user requests
- Prompt Chaining (Coding Workflows) โ Multi-stage workflows: analyze โ design โ plan โ implement โ test โ refine
- Routing โ Intelligent request analysis that selects optimal agent configuration
- Inter-Agent Communication โ Message bus with pub/sub for coordinated workflows
- RAG (Retrieval-Augmented Generation) โ Semantic code search using TF-IDF alongside symbolic search
- Exception Handling & Recovery โ Automatic rollback plans and recovery strategies
- Resource-Aware Optimization โ Budget tracking for steps, tokens, and execution time
Phase 2: Core Integrations โ
- TaskRouter Integration โ Routes every request to determine coding mode and agent configuration
- Goal Integration โ Goals automatically derived and validated post-execution
- Priority Scheduling โ Higher-priority tasks execute first for critical path optimization
- Metrics Emission โ JSONL metrics for evaluation and monitoring (
.rev-metrics/)
Phase 3: Advanced Integration โ
- RAG Integration โ Research Agent uses hybrid symbolic + semantic search (enabled by default)
- Resource Budget Tracking โ Orchestrator tracks and enforces budgets across all phases
- Goal Validation โ Validation Agent evaluates whether goals were met
Pattern Benefits
๐ฏ Superior Context Gathering
# Research Agent uses both approaches:
# Symbolic: Finds exact matches for "authenticate", "login", "jwt"
# Semantic: Finds conceptually related code even without keywords
python rev.py "Add OAuth2 authentication"
๐ Controlled Execution
# Resource budgets prevent runaway execution:
# - Max steps: 200 (configurable via REV_MAX_STEPS)
# - Max tokens: 100,000 (REV_MAX_TOKENS)
# - Max time: 1800s / 30min (REV_MAX_SECONDS)
python rev.py "Refactor entire authentication system"
# Output: "๐ Resource Usage: Steps: 45/200 | Tokens: 12000/100000 | Time: 120s/1800s"
๐ฏ Goal-Oriented Validation
# Goals automatically derived and validated:
python rev.py "Fix all failing tests"
# Derives goal: "All tests must pass"
# Validation checks: Tests passed? โ
# Goal met? โ
๐ Adaptive Configuration
# Router analyzes request and optimizes:
python rev.py "Quick typo fix in README"
# โ Route: quick_edit (skips research, minimal review)
python rev.py "Implement payment processing system"
# โ Route: full_feature (enables all agents, strict review)
Pattern Usage
Most patterns are enabled by default with graceful degradation:
- RAG Search: Enabled (falls back to symbolic if unavailable)
- Resource Budgets: Always tracking (configurable limits)
- Goal Validation: Runs if goals exist (auto-derived for most tasks)
- Routing: Always active (optimizes agent pipeline)
Configuration:
# Disable RAG for faster execution
python rev.py --research-depth shallow "Quick task"
# Adjust resource budgets
export REV_MAX_STEPS=500
export REV_MAX_TOKENS=200000
export REV_MAX_SECONDS=3600 # 1 hour
# Control routing behavior via strictness
python rev.py --review-strictness strict "Critical production change"
See IMPLEMENTATION_SUMMARY.md for complete pattern documentation and usage examples.
Installation
Quick Install (Recommended)
# Install via pip (coming soon to PyPI)
pip install rev-agentic
# Or install from source
git clone https://github.com/redsand/rev
cd rev
pip install -e .
1. Install Ollama
# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.ai/install.sh | sh
# Windows - Download from https://ollama.ai
2. Pull a Code Model
โ ๏ธ Important: rev.py requires a model with function/tool calling support for full functionality.
Recommended models with tool support:
# Best for code tasks
ollama pull llama3.1:latest # Best overall (tool support)
ollama pull qwen2.5:7b # Good for code (tool support)
ollama pull mistral-nemo:latest # Fast with tools
# Legacy (no tool support - limited functionality)
ollama pull codellama:latest # โ ๏ธ No tool support
ollama pull deepseek-coder:latest # โ ๏ธ Check version for tool support
๐ Ollama Cloud Models (NEW!):
# Ensure Ollama is running (cloud models proxy through local Ollama)
ollama serve
# Use powerful cloud-hosted models (requires authentication)
python rev.py --model qwen3-coder:480b-cloud "Your task"
python rev.py --model llama3.3:90b-cloud "Complex refactoring task"
Important: Cloud models require your local Ollama instance to be running. The local instance automatically proxies requests to Ollama's cloud service.
On first use, you'll be prompted to authenticate:
- A browser URL will be displayed
- Visit the URL and sign in with your Ollama account
- Authorize your device
- Press Enter to continue
Verify tool support:
# List models
ollama list
# Check model info
ollama show llama3.1:latest
3. Install Dependencies
pip install -r requirements.txt
Usage
One-Shot Mode
Execute a single task with fully autonomous operation:
python rev.py "Add error handling to all API endpoints"
The agent will:
- Analyze your repository
- Generate an execution plan
- Execute autonomously (no approval needed)
- Prompt ONLY for destructive operations (delete, force push, etc.)
- Show final summary
New in v2: Autonomous by default! No more repeated approval prompts. The agent only asks permission for potentially destructive operations.
Interactive REPL
For iterative development with session memory:
python rev.py --repl
The REPL now maintains context across multiple prompts:
agent> Review all documentation files
โน๏ธ Running in autonomous mode - destructive operations will prompt
... reviews README.md, COVERAGE.md, etc ...
agent> Now create a project overview document based on what you reviewed
... uses knowledge from previous reviews to create comprehensive overview ...
agent> /status
Session Summary:
- Tasks completed: 15
- Files reviewed: 8
- Files modified: 1
New REPL Commands:
/status- Show what's been done in this session/clear- Clear session memory/help- Show all commands/exit- Exit with session summary/mode- Control execution depth and thinking level (NEW in v2.0!)
Execution Modes (NEW!)
Rev v2.0 introduces flexible execution modes that control the depth of analysis, research, and validation. Use /mode in REPL or configure via command-line:
# In REPL
rev> /mode thorough
Mode: thorough
โ Orchestrator mode enabled
Research: Enabled (deep)
Learning: Enabled
Review: Enabled (strict)
Validation: Enabled + auto-fix
Parallel Workers: 3
rev> Implement user authentication
# Executes with thorough mode settings...
Available Modes:
Mode Feature Matrix
| Feature | simple | standard | thorough | max |
|---|---|---|---|---|
| Orchestration | โ | โ | โ | โ |
| Research | โ | Medium | Deep | Deep |
| Learning | โ | โ | โ | โ |
| Review | Lenient | Moderate | Strict | Strict |
| Validation | โ | โ | โ + auto-fix | โ + auto-fix |
| Action Review | โ | โ | โ | โ |
| Parallel Workers | 1 | 2 | 3 | 4 |
| Best For | Quick fixes | Daily development | Complex features | Critical changes |
Mode Descriptions:
-
simple- Fast execution with minimal overhead. No research or learning. Sequential execution. Perfect for quick fixes and testing. -
standard- Balanced approach (DEFAULT). Medium research depth, moderate review, validation enabled, 2 parallel workers. Ideal for daily development. -
thorough- Comprehensive analysis. Deep research + learning, strict review, full validation with auto-fix, 3 parallel workers. Use for complex features and refactoring. -
max- Maximum capabilities. Full orchestration with all agents, deep research + learning, strict review with action-level validation, auto-fix, 4 parallel workers. For critical architectural changes.
Command-Line Mode Control:
# Standard mode (default)
rev "Add feature X"
# Simple mode for quick tasks
rev --no-orchestrate "Fix typo in README"
# Thorough mode for complex tasks
rev --orchestrate --research-depth deep --learn --auto-fix "Refactor auth system"
Manual Approval Mode
If you want to manually approve the execution plan (old behavior):
python rev.py --prompt "Run all tests and fix any failures"
With --prompt, the agent will ask for approval before starting execution.
Default behavior: Runs autonomously without prompting (except for scary operations).
What Operations Require Confirmation?
Even in autonomous mode, the agent will always prompt for potentially destructive operations:
Scary Operations (will prompt):
- File deletion or removal
- Git operations:
reset --hard,clean -f,push --force - Commands containing: delete, remove, rm, clean, reset, force, destroy, drop, truncate
- Applying patches without dry-run first
- Tasks with "delete" action type
Safe Operations (no prompt):
- Reading files
- Searching code
- Running tests
- Creating/modifying files
- Git diff/log/status
- Running linters/formatters
Configuration
Environment Variables
# Ollama configuration
export OLLAMA_BASE_URL="http://localhost:11434" # Default
export OLLAMA_MODEL="codellama:latest" # Default
# Then run agent
python rev.py "Your task here"
Command-Line Options
python rev.py [OPTIONS] "task description"
Options:
--repl Interactive REPL mode
--model MODEL Ollama model to use (default: codellama:latest)
--base-url URL Ollama API URL (default: http://localhost:11434)
--prompt Prompt for approval before execution (default: auto-approve)
-j N, --parallel N Number of concurrent tasks (default: 2, use 1 for sequential)
# Agent Control
--orchestrate Enable orchestrator mode (full multi-agent coordination)
--learn Enable learning agent for project memory
--research Enable research agent for pre-planning exploration
--research-depth LEVEL Research depth: shallow, medium, deep (default: medium)
--review / --no-review Enable/disable review agent (default: enabled)
--review-strictness LEVEL Review strictness: lenient, moderate, strict (default: moderate)
--action-review Enable action-level review during execution
--validate / --no-validate Enable/disable validation agent (default: enabled)
--auto-fix Enable auto-fix for minor validation issues
-h, --help Show help message
Parallel Execution
New in v2.0: Concurrent task execution for faster completion!
By default, rev.py now runs 2 tasks in parallel when they don't have dependencies on each other. This dramatically speeds up execution for complex tasks.
Examples:
# Use default (2 concurrent tasks)
python rev.py "Review all API endpoints and add tests"
# Run 4 tasks in parallel for maximum speed
python rev.py -j 4 "Refactor all components and update tests"
# Run sequentially (old behavior) for debugging
python rev.py -j 1 "Complex refactoring that needs careful sequencing"
# Run 8 tasks in parallel for large codebases
python rev.py -j 8 "Update all imports across the project"
How it works:
- The agent automatically tracks task dependencies
- Independent tasks (like reviewing different files) run in parallel
- Dependent tasks (like "run tests" after "fix bug") wait for prerequisites
- Thread-safe execution ensures no conflicts
Performance benefits:
- 2x-4x faster execution for typical tasks
- Scales well with more workers for large codebases
- No manual intervention needed - dependencies are automatic
Examples
Example 1: Add Feature
python rev.py "Add rate limiting middleware to Express app"
Generated Plan:
- [REVIEW] Analyze current Express middleware structure
- [ADD] Create rate-limiting middleware module
- [EDIT] Integrate rate limiter into main app
- [ADD] Add tests for rate limiting
- [TEST] Run test suite to validate
Example 2: Fix Bugs
python rev.py "Fix all ESLint errors in src/ directory"
Generated Plan:
- [REVIEW] Run ESLint to identify all errors
- [EDIT] Fix import order issues
- [EDIT] Fix unused variable warnings
- [EDIT] Fix indentation errors
- [TEST] Run ESLint again to verify fixes
Example 3: Refactoring
python rev.py "Refactor authentication logic into separate service"
Generated Plan:
- [REVIEW] Analyze current authentication code
- [ADD] Create AuthService class
- [EDIT] Extract auth logic to service
- [EDIT] Update controllers to use AuthService
- [EDIT] Update dependency injection
- [TEST] Run integration tests
How It Works
Planning Phase
The agent uses Ollama to:
- Analyze repository context (git status, file structure, recent commits)
- Understand your request
- Break it into atomic, ordered tasks
- Classify each task by type (review, edit, add, delete, test)
Execution Phase
For each task, the agent:
- Gathers context using tools like
read_file,search_code,list_dir - Makes changes using
write_fileorapply_patch(unified diffs) - Validates changes by running
run_tests - Reports completion and moves to next task
Available Tools
The agent has access to 36 powerful tools across multiple categories:
New in v2.7: SSH remote execution! Connect to remote hosts, execute commands, and transfer files for managing your infrastructure.
New in v2.6: Cross-platform OS detection! The agent automatically detects your operating system (Windows, Linux, macOS) and adapts tool usage accordingly - choosing bash vs PowerShell, correct path separators, and platform-specific commands.
Core File Operations
| Tool | Description |
|---|---|
read_file |
Read file contents |
write_file |
Create or overwrite files |
delete_file |
Delete a file |
move_file |
Move or rename files |
copy_file |
Copy a file to a new location |
append_to_file |
Append content to a file |
replace_in_file |
Find and replace text within a file (supports regex) |
create_directory |
Create directories |
get_file_info |
Get file metadata (size, modified time, etc.) |
file_exists |
Check if a file or directory exists |
read_file_lines |
Read specific line range from a file |
tree_view |
Generate a tree view of directory structure |
Code Discovery & Search
| Tool | Description |
|---|---|
list_dir |
List files matching glob pattern |
search_code |
Search code with regex (symbolic search) |
rag_search |
Semantic code search using RAG/TF-IDF (NEW!) |
Git Operations
| Tool | Description |
|---|---|
git_diff |
View current uncommitted changes |
git_status |
Get detailed git status |
git_log |
Get git commit history |
git_commit |
Commit changes with a message |
git_branch |
Git branch operations (list, create, switch, current) |
apply_patch |
Apply unified diff patches |
get_repo_context |
Get git status and repo structure |
Command Execution
| Tool | Description |
|---|---|
run_cmd |
Execute shell commands |
run_tests |
Run test suite (pytest, npm test, etc.) |
Utility Tools
| Tool | Description |
|---|---|
install_package |
Install Python packages using pip |
web_fetch |
Fetch content from URLs |
execute_python |
Execute Python code snippets |
get_system_info |
Get system info (OS, version, architecture, shell type) |
SSH Remote Execution
| Tool | Description |
|---|---|
ssh_connect |
Connect to a remote host via SSH |
ssh_exec |
Execute commands on a remote host |
ssh_copy_to |
Copy a file to a remote host |
ssh_copy_from |
Copy a file from a remote host |
ssh_disconnect |
Disconnect from a remote host |
ssh_list_connections |
List all active SSH connections |
MCP (Model Context Protocol) Support
| Tool | Description |
|---|---|
mcp_add_server |
Add an MCP server for extended capabilities |
mcp_list_servers |
List configured MCP servers |
mcp_call_tool |
Call tools on MCP servers |
New in v2.5: MCP support allows the agent to connect to external tools and data sources through the Model Context Protocol, enabling integration with databases, APIs, and other development tools.
Comparison with agent.py
| Feature | agent.py | rev.py |
|---|---|---|
| LLM | OpenAI API | Ollama (local) |
| Approval | Multiple prompts | Single approval |
| Planning | None | Comprehensive |
| Execution | Manual steps | Autonomous iteration |
| Testing | Manual | Automatic |
| Privacy | API calls | Fully local |
| Cost | Pay per token | Free |
Troubleshooting
"Ollama API error: Connection refused"
Ensure Ollama is running:
ollama serve
"Model not found"
Pull the model first:
ollama pull codellama:latest
"401 Unauthorized" for Cloud Models
Cloud models (ending with -cloud) require authentication. The agent will:
- Detect the 401 error automatically
- Display a signin URL
- Wait for you to authenticate
Steps to authenticate:
# When you see the authentication prompt:
# 1. Visit the displayed URL in your browser
# 2. Sign in with your Ollama account
# 3. Authorize the device
# 4. Press Enter to continue
# The authentication persists, so you only need to do this once per device
Example:
python rev.py --model qwen3-coder:480b-cloud "Review code"
# Output:
# ============================================================
# OLLAMA CLOUD AUTHENTICATION REQUIRED
# ============================================================
# Model 'qwen3-coder:480b-cloud' requires authentication.
#
# To authenticate:
# 1. Visit this URL in your browser:
# https://ollama.com/connect?name=YOUR-DEVICE&key=...
#
# 2. Sign in with your Ollama account
# 3. Authorize this device
# ============================================================
#
# Press Enter after completing authentication...
"400 Bad Request" or "Model not using tools"
Some Ollama models don't support function/tool calling. This is normal for older or smaller models.
Models with tool support (recommended):
llama3.1(8B, 70B, 405B)mistral-nemomistral-largeqwen2.5(7B and up)phi3.5
How to fix:
-
Use a model with tool support:
ollama pull llama3.1:latest python rev.py --model llama3.1:latest "Your task"
-
Or enable debug mode to see what's happening:
OLLAMA_DEBUG=1 python rev.py "Your task"
The agent will automatically retry without tools if it detects the model doesn't support them, but tool support is highly recommended for best results.
"Path escapes repo"
rev.py only operates within the current repository for safety. Use relative paths.
Tasks not completing
Try a more specific request or use a larger model:
python rev.py --model deepseek-coder:33b "Your task"
Testing & Coverage
Test Coverage: 80% - Production Ready โ
- 136 tests passing (100% pass rate)
- 800+ statements in rev.py
- Cross-platform tested (Linux, macOS, Windows detection)
- SSH remote execution tested (connection management, file transfer)
- 99% test code coverage (tests are well-tested themselves)
What's Tested
- โ File operations (read, write, delete, move, copy, append, replace)
- โ Advanced file operations (file_exists, read_file_lines, tree_view)
- โ Git operations (diff, patch, commit, status, log, branch)
- โ Command execution and validation
- โ Utility tools (install_package, web_fetch, execute_python, get_system_info)
- โ System information detection (OS, version, shell type, caching)
- โ SSH remote execution (connect, execute, file transfer, disconnect)
- โ MCP (Model Context Protocol) integration
- โ Task management (Task, ExecutionPlan)
- โ Tool execution routing
- โ Ollama integration (mocked)
- โ Planning and execution modes
- โ Security validations
- โ REPL mode commands and session tracking
- โ CLI argument parsing
- โ Scary operation detection and prompting
- โ Edge cases and error handling
Code Quality Initiatives
- โ Static code analysis with automated linting
- โ Type hinting for improved code clarity
- โ Comprehensive documentation coverage
- โ Security scanning and vulnerability assessment
- โ Performance benchmarking and optimization
- โ Cross-platform compatibility verification
- โ Dependency security scanning
Running Tests
# Run all tests
python -m pytest tests/test_agent_min.py -v
# Run with coverage report
python -m pytest tests/test_agent_min.py --cov=agent_min --cov-report=term-missing
# Generate HTML coverage report
python -m pytest tests/test_agent_min.py --cov=agent_min --cov-report=html
For detailed coverage information, see COVERAGE.md.
For future testing, quality, documentation, and security improvements, see RECOMMENDATIONS.md.
Advanced Planning
rev.py includes sophisticated planning capabilities that analyze your tasks before execution:
Features
๐ Dependency Analysis
- Automatically determines optimal task ordering
- Identifies parallelization opportunities
- Calculates critical path through task dependencies
๐ Impact Assessment
- Predicts scope of changes before making them
- Identifies affected files and modules
- Estimates change magnitude
โ ๏ธ Risk Evaluation
- Evaluates risk level for each task (๐ข LOW, ๐ก MEDIUM, ๐ HIGH, ๐ด CRITICAL)
- Identifies potentially breaking changes
- Flags dangerous operations (database, security, delete, etc.)
๐ Rollback Planning
- Automatically generates recovery procedures
- Action-specific rollback steps
- Database and production rollback guidance
Example Output:
============================================================
EXECUTION PLAN
============================================================
1. [REVIEW] Analyze current authentication module
Risk: ๐ข LOW
2. [EDIT] Refactor auth to use dependency injection
Risk: ๐ก MEDIUM (Destructive/modifying action: edit)
Depends on: #1
3. [DELETE] Remove deprecated auth helpers
Risk: ๐ด CRITICAL (Destructive/modifying action: delete)
Depends on: #2
โ ๏ธ Warning: Potentially breaking change
============================================================
PLANNING ANALYSIS SUMMARY
============================================================
Total tasks: 5
Risk distribution:
๐ข LOW: 2
๐ก MEDIUM: 2
๐ด CRITICAL: 1
โก Parallelization potential: 3 tasks can run concurrently
Critical path length: 4 steps
๐ด CRITICAL: 1 high-risk task(s) require extra caution
- Task #3: Remove deprecated auth helpers...
Rollback plan available
============================================================
Learn More: See ADVANCED_PLANNING.md for complete documentation.
Multi-Agent Quorum System
New in v4.0: rev.py now uses a 3-agent quorum system that provides intelligent review and validation at multiple stages for more accurate and secure code changes.
The Three Agents
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. PLANNING AGENT โ
โ โข Breaks down complex requests into atomic tasks โ
โ โข Analyzes dependencies and risks โ
โ โข Performs recursive breakdown for complex features โ
โ โข Creates comprehensive execution plans โ
โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 2. REVIEW AGENT (NEW!) โ
โ โข Validates execution plans before execution โ
โ โข Reviews individual actions during execution โ
โ โข Identifies security vulnerabilities โ
โ โข Suggests improvements and alternatives โ
โ โข Checks for missing tasks or unnecessary steps โ
โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 3. EXECUTION AGENT โ
โ โข Executes approved tasks sequentially or in parallel โ
โ โข Calls tools and makes code changes โ
โ โข Validates results โ
โ โข Applies recommendations from Review Agent โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
How It Works
1. Planning Phase - The Planning Agent analyzes your request
python rev.py "Add user authentication with JWT"
The Planning Agent will:
- Analyze your repository structure
- Break down the request into specific tasks
- Identify dependencies between tasks
- Assess risks for each task
- Handle recursive breakdown for complex features
For example, a high-level task like "Implement authentication system" will be automatically broken down into:
- Design authentication architecture
- Create user model and database schema
- Implement JWT token generation
- Add authentication middleware
- Create login/register endpoints
- Write authentication tests
2. Review Phase - The Review Agent validates the plan
============================================================
REVIEW AGENT - PLAN REVIEW
============================================================
โ Analyzing plan with review agent...
============================================================
REVIEW RESULTS
============================================================
Decision: โ
APPROVED WITH SUGGESTIONS
Confidence: 85%
Plan is generally sound but could be improved
๐ก Suggestions (3):
- Add rate limiting to prevent brute force attacks
- Include password reset functionality
- Add integration tests for authentication flow
๐ Security Concerns (1):
- Ensure JWT secrets are stored in environment variables
============================================================
The Review Agent examines:
- Completeness: Are all necessary tasks included?
- Security: Are there potential vulnerabilities?
- Best Practices: Does the plan follow industry standards?
- Edge Cases: Are error cases handled?
- Dependencies: Are task dependencies correct?
3. Execution Phase - The Execution Agent runs the tasks
- Each task is executed with full context
- Optional: Action-level review can validate each tool call
- Results are validated and tested
Review Modes
Plan Review (Default: Enabled)
# Enable plan review (default)
python rev.py "Add authentication"
# Disable plan review
python rev.py --no-review "Add authentication"
# Adjust review strictness
python rev.py --review-strictness strict "Delete old migrations"
python rev.py --review-strictness lenient "Add logging"
Strictness levels:
- Lenient: Only flags critical issues
- Moderate (default): Flags medium+ severity issues
- Strict: Flags all potential issues
Action Review (Optional: Disabled by default)
# Enable action-level review (reviews each tool call)
python rev.py --action-review "Implement payment processing"
Action review provides real-time validation:
- Detects command injection vulnerabilities
- Identifies hardcoded secrets
- Warns about SQL injection risks
- Suggests alternative approaches
- Validates file operations
Review Decision Types
The Review Agent can make four types of decisions:
โ APPROVED - Plan is safe and complete
โ
Plan approved by review agent.
โ APPROVED WITH SUGGESTIONS - Plan is good but has recommendations
โ
Plan approved with suggestions. Review recommendations above.
๐ก Suggestions:
- Add error handling for edge cases
- Consider adding validation tests
โ ๏ธ REQUIRES CHANGES - Plan has issues that should be addressed
โ ๏ธ Plan requires changes. Review the issues above.
Continue anyway? (y/N):
โ REJECTED - Plan has critical issues
โ Plan rejected by review agent. Please revise your request.
๐ด Issues:
- CRITICAL: Hardcoded database credentials
- HIGH: Missing input validation
Benefits of Multi-Agent System
๐ก๏ธ Enhanced Security
- Automatic detection of security vulnerabilities
- Multiple layers of validation before code changes
- Quick security checks without LLM calls (command injection, secrets, etc.)
๐ฏ Better Accuracy
- Identifies missing tasks before execution
- Catches logical errors in plans
- Suggests improvements and alternative approaches
๐ Complex Task Handling
- Recursive breakdown for large features
- Automatic decomposition of high-complexity tasks
- Better handling of multi-step implementations
โก Smart Defaults
- Auto-approves low-risk plans (review only, read-only operations)
- Focuses review effort on high-risk changes
- Configurable strictness for different scenarios
Example: Complex Feature with Review
python rev.py "Implement a REST API for user management with authentication, validation, and tests"
Planning Agent Output:
โ Checking for complex tasks...
โโ Breaking down complex task: Implement REST API authentication...
โโ Expanded into 8 subtasks
EXECUTION PLAN
1. [REVIEW] Analyze current project structure
2. [ADD] Create user model with validation
3. [ADD] Implement JWT authentication middleware
4. [ADD] Create user registration endpoint
5. [ADD] Create user login endpoint
6. [ADD] Add password hashing utilities
7. [ADD] Write unit tests for authentication
8. [ADD] Write integration tests for API endpoints
9. [TEST] Run full test suite
Review Agent Output:
REVIEW RESULTS
Decision: โ
APPROVED WITH SUGGESTIONS
Confidence: 90%
Plan provides comprehensive REST API implementation
๐ก Suggestions (3):
- Add rate limiting to login endpoint
- Include password reset functionality
- Add API documentation (OpenAPI/Swagger)
๐ Security Concerns (2):
- Ensure JWT secrets use environment variables
- Add HTTPS requirement for production
The quorum ensures:
- Planning Agent decomposes the complex request
- Review Agent validates completeness and security
- Execution Agent implements with confidence
Configuration Options
# Full control over review behavior
python rev.py \
--review \ # Enable plan review (default)
--review-strictness moderate \ # Set strictness level
--action-review \ # Enable action-level review
"Your complex task"
# Minimal review for simple tasks
python rev.py \
--review-strictness lenient \
"Update documentation"
# Maximum scrutiny for critical changes
python rev.py \
--review-strictness strict \
--action-review \
"Migrate database schema"
Best Practices with Multi-Agent System:
- Use default settings for most tasks - they provide good balance
- Enable action review for security-critical operations (auth, payments, database)
- Use strict mode when working with production code or critical infrastructure
- Use lenient mode for documentation updates or low-risk refactoring
- Review suggestions even when approved - they often provide valuable insights
Best Practices
-
Be Specific โ Clearer requests generate better plans
- โ "Fix the code"
- โ "Add null checks to user input validation in api/users.js"
-
Start Small โ Test with simple tasks first
- โ "Rewrite entire authentication system"
- โ "Add password strength validation"
-
Use Appropriate Models
- Small tasks:
codellama:7b(fast) - Complex refactoring:
codellama:34bordeepseek-coder:33b
- Small tasks:
-
Review Changes โ Use
git diffbefore committingpython rev.py "Add feature X" git diff # Review changes git commit -am "Add feature X"
-
Iterative Development โ Use REPL for interactive work
python rev.py --repl
-
Documentation First โ Review documentation before making changes
- Use
rev.py "Review all documentation files"to understand the codebase - Keep documentation updated alongside code changes
- Add docstrings and inline comments for complex logic
- See RECOMMENDATIONS.md for documentation improvement ideas
- Use
-
Security Conscious Development โ Follow security best practices
- Review security recommendations in RECOMMENDATIONS.md
- Validate all inputs and sanitize file paths
- Keep dependencies updated and scan for vulnerabilities
- Implement least privilege principles for file operations
- Use secure communication channels for remote execution
Built-in Utilities
rev.py includes powerful utility functions for common development tasks:
File Format Conversion
Convert between common file formats without external tools:
# JSON โ YAML
python rev.py "Convert config.json to YAML format"
python rev.py "Convert docker-compose.yaml to JSON"
# CSV โ JSON
python rev.py "Convert users.csv to JSON array"
python rev.py "Convert data.json to CSV format"
# .env to JSON
python rev.py "Convert .env to JSON configuration"
Code Refactoring
Automated code analysis and improvement:
# Remove unused imports
python rev.py "Remove unused imports from src/app.py"
# Extract magic numbers to constants
python rev.py "Find magic numbers in config.py that should be constants"
# Simplify complex conditionals
python rev.py "Analyze validator.py for overly complex if statements"
Dependency Management
Multi-language dependency analysis and updates:
# Analyze dependencies (auto-detects Python/JavaScript/Rust/Go)
python rev.py "Analyze project dependencies and check for issues"
# Check for outdated packages
python rev.py "Check for outdated dependencies"
python rev.py "Find outdated packages including major version updates"
Security Scanning
Comprehensive security analysis:
# Scan for vulnerabilities
python rev.py "Scan dependencies for known security vulnerabilities"
# Static code security analysis
python rev.py "Run security scan on src/ directory"
# Detect secrets
python rev.py "Scan repository for accidentally committed secrets"
# Check license compliance
python rev.py "Check dependency licenses for GPL and restrictive licenses"
See UTILITIES.md for complete documentation, API reference, and integration examples.
Intelligent Caching
rev.py includes a high-performance caching system that dramatically improves speed by caching frequently accessed data:
Cache Types
File Content Cache (60s TTL)
- Caches file contents with automatic invalidation on file modification
- 10-100x faster for repeatedly accessed files
LLM Response Cache (1 hour TTL)
- Caches identical LLM queries to avoid redundant API calls
- Near-instant responses for repeated questions
- Significant cost savings for cloud models
Repository Context Cache (30s TTL)
- Caches git status, logs, and file trees
- Invalidates automatically on new commits
- 5-20x faster for repository queries
Dependency Tree Cache (10 min TTL)
- Caches dependency analysis results
- Invalidates when dependency files change
- 10-50x faster for dependency operations
Usage
# View cache statistics
python rev.py "Show cache statistics"
# Clear caches (useful after major changes)
python rev.py "Clear all caches"
python rev.py "Clear LLM response cache"
# Caches persist automatically to .rev_cache/
Performance Impact
Real-world improvements:
- File reads: 10-40x faster (repeated access)
- Repo context: 20-100x faster
- Dependency analysis: 40-200x faster
- Identical LLM queries: 400-2000x faster
Overall: 30-50% faster development iteration cycles, 40-60% reduction in cloud API costs.
See CACHING.md for complete documentation, configuration options, and optimization tips.
Advanced Usage
Custom Test Commands
The agent detects test frameworks automatically, but you can customize:
# For Python projects
python rev.py "Fix failing tests" --model codellama:latest
# For Node.js projects
python rev.py "Add tests for new API endpoints"
Chain Multiple Tasks
python rev.py "Add logging, then refactor error handling, then update tests"
The agent will create a plan that sequences these correctly.
CI/CD Integration
# In your CI pipeline
python rev.py --yes "Run tests and fix any linting errors"
if [ $? -eq 0 ]; then
git commit -am "Auto-fix linting issues"
git push
fi
Allowed Commands
For security, only these commands are permitted:
- Python:
python,pip,pytest,ruff,black,isort,mypy - JavaScript:
node,npm,npx,pnpm,prettier,eslint - Version Control:
git - Build:
make
File Structure
.
โโโ rev.py # Main agent script
โโโ requirements.txt # Minimal dependencies (just requests)
โโโ tests/ # Comprehensive test suite
โ โโโ test_agent_min.py # 99% coverage tests
โโโ COVERAGE.md # Detailed coverage report
โโโ RECOMMENDATIONS.md # Future improvement suggestions
โโโ README.md # This file
License
MIT
Contributing
This is a minimal implementation focused on core CI/CD workflows. For advanced features (SSH, WinRM, HTTP client, secrets management), see the full agent.py.
Credits
Based on the hawk-ops-ai framework, streamlined for autonomous CI/CD workflows with Ollama integration.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rev_agentic-2.0.0.tar.gz.
File metadata
- Download URL: rev_agentic-2.0.0.tar.gz
- Upload date:
- Size: 223.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d878649531a70018032dc425abe5e95ce4d180ededef0aba692c8d60d729c6e
|
|
| MD5 |
ae4096e15449ae53515c467c811baa06
|
|
| BLAKE2b-256 |
5e557c64b3bdbf01b6c3b7da15fbec27ce9f16e79e549033eb61e7bf2c1f43ec
|
File details
Details for the file rev_agentic-2.0.0-py3-none-any.whl.
File metadata
- Download URL: rev_agentic-2.0.0-py3-none-any.whl
- Upload date:
- Size: 170.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
657439cef4a1e9b82bafecc98aeae983ef4b66c969a940b021d6ad7ecc4060c6
|
|
| MD5 |
42f2d2ff4d122306c17022df1411dee2
|
|
| BLAKE2b-256 |
3de963ebf96f9105b878586c5ebc6c29e5b27cfea02fb37cb6b9e0cb79b18e32
|