Skip to content

Use cases & recipes

Recipes for reviewing your own changes before they leave your machine. Modes, the gate, output formats, and exit codes are covered in Usage. Runnable artifacts (git hook, Makefile, agent script) are in examples/review-local/.

Terminal window
miucr review --staged --gate high

Block the commit on a high or critical finding:

Terminal window
miucr review --staged --gate high
  • --staged reviews the staged blobs, not your unstaged tree, so it sees what the commit will contain.
  • Exit 2 when a finding reaches the gate, 0 otherwise. From a hook, a non-zero exit aborts the commit.
  • Install the pre-commit example as .git/hooks/pre-commit (chmod +x). Bypass once with git commit --no-verify.

Review everything your branch adds over main:

Terminal window
miucr review --from main --to HEAD -o pretty
  • It reviews HEAD against the merge-base of the two refs: the changes a PR would introduce, not a raw main..HEAD diff.
  • Add --gate high to also fail non-zero in scripts.
  • The whole branch is one change, so cross-file issues a single-commit review misses can show up.
Terminal window
miucr review --commit <sha> --gate medium

<sha> is any ref (HEAD, HEAD~1, a tag), diffed against its first parent. A lower gate suits a hotfix where you want more surfaced before it ships.

Terminal window
miucr review --staged -o pretty

pretty shows jumpable file:line, severity, rationale, a code excerpt, and a patch preview. Color only on a TTY. The default -o json is for agents and scripts. See Output formats.

An agent reviews, parses, fixes, and re-reviews until clean:

Terminal window
miucr review --staged -o json
  • Each entry in .data.findings has file, line, end_line, severity, category, rationale, suggested_patch, and quoted_code. Stop when summary.findings is 0 or .data.stats.max_severity is below your bar.
  • A gate hit is exit 2, and the findings still print to stdout. Read the JSON either way. See Exit codes.
  • Without a shell loop: install the agent skill or run miucr mcp so the agent calls review_run directly. See MCP integration. The agent-review.sh example shows the shell-loop shape.

Open the report in a SARIF viewer extension (for example VS Code “SARIF Viewer”):

Terminal window
miucr review --staged -o sarif > review.sarif # SARIF only
miucr review --staged --sarif-out review.sarif # JSON on stdout plus a SARIF file

--sarif-out comes from the same single review run, with no second LLM pass. Details: --sarif-out.

review:
miucr review --staged --gate high -o pretty
{
"scripts": {
"review": "miucr review --staged --gate high"
}
}

Use it as a local pre-push check or a CI step. The example directory has a Makefile with review and review-range targets.

Terminal window
miucr rules init # scaffold .miu/cr/rules/example.md
miucr rules check internal/foo/bar.go # which rules apply to a path

Markdown files in .miu/cr/rules/*.md (repo) or ~/.config/miu/cr/rules/*.md (personal) are injected as review context for matching files. They never gate. See Project rules and examples/rules/.

Every review is saved locally unless you pass --no-save:

Terminal window
miucr history # recent reviews, newest first
miucr history --since 7d # 7d, 24h, or 2026-06-01
miucr history show <id> # findings, stats, transcript, raw I/O

The review_id in a review’s envelope is the <id>. See Review history.