Related ToolsClaude CodeCursor

Saguaro Lets AI Coding Agents Review and Fix Their Own Mistakes

AI news: Saguaro Lets AI Coding Agents Review and Fix Their Own Mistakes

Anyone who has spent a full day pair-programming with Claude Code or Codex knows the pattern: the agent ships working code fast, you spot a logic error or security gap during review, but the agent session is already gone. The context that produced the bug has evaporated. You fix it yourself and move on.

Saguaro, a new open-source CLI from Mesa, tries to close that loop. It runs as a background daemon that reviews AI-generated code while the agent session is still active, then feeds violations back to the same agent so it can fix its own mistakes with full context intact.

How It Actually Works

The tool operates in three phases. First, it matches changed files against rules you define as markdown files in a .saguaro/rules/ directory. Each rule has glob patterns, a severity level (error, warning, or info), and plain-language instructions with code examples showing what's compliant and what isn't.

Second, it builds an import graph using tree-sitter and SWC parsers to understand the "blast radius" of changes - which files depend on the modified code. This stays token-budgeted so it doesn't slow things down.

Third, an AI model (your choice of Claude, GPT-4o, o3, or Gemini) evaluates each batch of files against the matched rules, the diff, and surrounding context. Violations trigger exit code 1. Clean reviews pass silently.

The key difference from tools like CodeRabbit or Greptile: Saguaro runs during development, not after you push a PR. The agent gets feedback while it still remembers why it wrote the code that way.

Integration and Setup

Claude Code gets the deepest integration with automatic MCP server setup, pre-tool-use hooks that inject rules before code generation, and stop hooks that trigger review after completion. Codex, Gemini CLI, and Cursor are also supported, though with less automation.

Installation is straightforward: npm install -g @mesadev/saguaro or npx @mesadev/saguaro review for one-off use. You can also auto-generate rules from your existing codebase with sag rules generate, which analyzes your code and produces starter rules.

The background daemon uses an HTTP server with a SQLite job queue, so reviews happen asynchronously during long coding sessions without blocking the agent.

Saguaro is Apache-2.0 licensed, written in TypeScript, and currently at v0.4.1. It supports import graph analysis for TypeScript, JavaScript, Python, Go, Rust, Java, and Kotlin. The project is early - just 2 GitHub stars at the time of writing - but the approach of enforcing rules during AI coding sessions rather than in post-commit review addresses a real friction point in agent-assisted development workflows.