CLI Reference

Complete reference for all Saguaro CLI commands.

COMMANDS

CommandDescription
sag initSet up Saguaro in your repo
sag reviewReview code changes against your rules
sag rules generateAuto-generate rules by analyzing your codebase
sag rules create [dir]Create a new rule with AI assistance
sag rules listList all rules with IDs, titles, and severity
sag rules explain <id>Show full details for a rule
sag rules validateCheck all rule files for correct structure
sag rules delete <id>Delete a rule
sag rules locatePrint the path to the rules directory
sag indexBuild the import graph for richer review context
sag hook installEnable automatic reviews in Claude Code
sag hook uninstallDisable automatic reviews
sag daemon startStart the background review daemon
sag daemon stopStop the background review daemon
sag daemon statusCheck if the daemon is running
sag modelSwitch AI provider and model interactively
sag statsShow review history and cost analytics

SAG REVIEW

Review code changes. Diffs the current branch against a base branch and runs the selected review mode.

rules (default) — checks changed files against your rules in .saguaro/rules/. Maximum signal, lowest noise.

classic — permissive senior-engineer-style review looking for bugs, security issues, and regressions. No rules needed.

full — runs both rules and classic reviews together.

sag review options
1-m, --mode Review mode: rules, classic, or full [default: "rules"]
2-b, --base Base branch to diff against [default: "main"]
3 --head Head ref to review [default: "HEAD"]
4-o, --output Output format: console, json [default: "console"]
5-v, --verbose Show detailed progress [default: false]
6 --debug Write debug logs to .saguaro/.tmp/ [default: false]
7-c, --config Path to config file [default: ".saguaro/config.yaml"]
8 --rules Path to rules directory [default: ".saguaro/rules/"]

SAG RULES CREATE

Create a new rule with AI assistance. Optionally target a specific directory and provide an intent for what the rule should enforce.

sag rules create options
1sag rules create [target]
2
3 target Directory the rule targets (e.g. src/api)
4 --intent What the rule should enforce
5 --severity error, warning, or info
6 --title Rule title (auto-generated if omitted)
7 --skip-preview Skip the file-match preview step

SAG INIT

Walks through setup — creates .saguaro/config.yaml and the .saguaro/rules/ directory, offers rule generation options (starter rules, generate from codebase, or start empty), and sets up Claude Code integration.

SAG INDEX

Builds the import graph for your codebase. Supports TS/JS (SWC), Python, Go, Rust, Java, and Kotlin (tree-sitter). Run once, then Saguaro uses it automatically during reviews.

SAG HOOK

install — Adds PreToolUse and StopHook to Claude Code's hook configuration.

uninstall — Removes the hooks.

Both commands modify .claude/settings.json.

SAG DAEMON

start — Starts the background review daemon on localhost. Reviews changes asynchronously while the agent continues working.

stop — Stops the running daemon.

Enable in .saguaro/config.yaml under the daemon key.

SAG STATS

Shows review history and cost analytics from .saguaro/history/reviews.jsonl.