trusty-review 0.4.0

LLM-backed code review service — reviews GitHub PRs and unified diffs via AWS Bedrock or OpenRouter
Documentation

trusty-review

Fast local PR-review service — LLM-backed code review with search and analysis context.

trusty-review fetches GitHub PR diffs, retrieves code context from trusty-search, queries trusty-analyze for complexity data, then calls an LLM (AWS Bedrock by default) to produce a structured review verdict with actionable findings.

It ships as:

  • a one-shot CLI (run / compare subcommands)
  • a long-lived HTTP webhook server (serve subcommand, port 7880)
  • a JSON-RPC 2.0 / MCP stdio service (serve --stdio) for Claude Code integration

Installation

Install from prebuilt binary

Download the latest prebuilt binary for your platform from the GitHub Releases page. Binaries follow the tag convention trusty-review-v<version>:

Platform Archive name
macOS arm64 trusty-review-aarch64-apple-darwin.tar.gz
Linux x86_64 (glibc) trusty-review-x86_64-unknown-linux-gnu.tar.gz

Extract and place the trusty-review binary on your PATH.

Install with cargo

cargo install --git https://github.com/bobmatnyc/trusty-tools trusty-review --locked

This builds and installs the trusty-review binary from the latest main branch.

With Homebrew (recommended)

brew tap bobmatnyc/trusty
brew install trusty-review

Or install directly without tapping:

brew install bobmatnyc/trusty/trusty-review

Homebrew provides:

  • Automatic updates via brew upgrade trusty-review
  • Standard macOS / Linux PATH integration
  • Easy dependency management

Prerequisites

Required: A GitHub token (GITHUB_TOKEN) or GitHub App credentials for PR fetching and (optionally) posting review comments. Set PR_INTELLIGENCE_DRY_RUN=false to enable comment posting (default: dry-run).

LLM credentials: AWS Bedrock credentials (env vars, ~/.aws/credentials, IAM role, or SSO) for the default bedrock/ provider, or OPENROUTER_API_KEY for OpenRouter models.

Contributor profiling (trusty-review profile): requires a pre-populated tga SQLite database. Set TRUSTY_TGA_DB or pass --db <path>. Compiled in by default; omit with --no-default-features --features http-server,mcp for a slimmer build without tga/rusqlite compilation.

Sidecar services (optional, degrade gracefully when absent):

  • trusty-search on :7878 — code-context hybrid search for richer reviews
  • trusty-analyze on :7879 — complexity and quality metrics
cargo install --git https://github.com/bobmatnyc/trusty-tools trusty-search --locked
cargo install --git https://github.com/bobmatnyc/trusty-tools trusty-analyze --locked
trusty-search start
trusty-analyze serve

Quick start — one-shot review

# Review a GitHub PR (Bedrock credentials required)
trusty-review run owner repo 123

# Review a local unified diff
trusty-review run --local-diff /path/to/patch.diff

# Override the reviewer model
trusty-review run owner repo 123 --reviewer-model bedrock/us.anthropic.claude-haiku-4-5

# Compare models
trusty-review compare owner repo 123

HTTP server

# Start the HTTP daemon on port 7880
trusty-review serve

# Custom port / bind address
trusty-review serve --port 8080 --bind 0.0.0.0

Endpoints:

Method Path Description
GET /health Liveness, dependency + inference status (see MCP review_health for schema)
GET /status In-flight count + last error
POST /review Synchronous on-demand review
POST /pr/github/webhook GitHub PR webhook (HMAC-validated)

MCP stdio service (Claude Code integration)

# Start the MCP stdio server
trusty-review serve --stdio

Wire into Claude Code via .mcp.json:

{
  "mcpServers": {
    "trusty-review": {
      "command": "trusty-review",
      "args": ["serve", "--stdio"]
    }
  }
}

MCP tools

Tool Description
review_pr Review a GitHub PR by owner/repo/number
review_diff Review a raw unified diff string
review_health Probe service liveness and configuration

review_pr

{
  "name": "review_pr",
  "arguments": {
    "owner": "bobmatnyc",
    "repo":  "trusty-tools",
    "pr":    625,
    "reviewer_model": "bedrock/us.anthropic.claude-haiku-4-5"
  }
}

Returns a ReviewResult JSON object with:

  • grade (A+ | A | A- | B+ | B | B- | C+ | C | C- | D+ | D | D- | F) — letter grade
  • verdict (APPROVE | APPROVE* | REQUEST_CHANGES | BLOCK | UNKNOWN)
  • findings (array of findings with severity + confidence)
  • input_tokens / output_tokens — LLM token usage
  • cost_estimate_usd — estimated API cost

Grade → Verdict mapping

The verdict is derived from the grade per a fixed product decision (APPROVE floor = B-):

Grade band Verdict
A+, A, A-, B+, B, B- APPROVE
C+, C, C- APPROVE*
D+, D, D- REQUEST_CHANGES
F BLOCK

The final verdict is max(grade_verdict, severity_floor(findings)) — the grade never produces a verdict weaker than what the severity floor already requires. After verification (Phase 2), the grade is re-clamped to stay consistent with the post-verification verdict.

When posted to GitHub, the review comment includes a footer:

Grade: B+ · 🤖 Reviewed by Trusty-Review (`us.anthropic.claude-sonnet-4-6`) · tokens ↑1234 ↓567 · est. $0.01

(↑ = input tokens, ↓ = output tokens). The footer appears identically in dry-run output.

review_diff

{
  "name": "review_diff",
  "arguments": {
    "diff": "diff --git a/src/lib.rs ...",
    "context": "Refactoring the auth module",
    "reviewer_model": "bedrock/us.anthropic.claude-sonnet-4-6"
  }
}

review_health

{ "name": "review_health", "arguments": {} }

Returns a health status object:

{
  "status": "ok",
  "version": "0.3.2",
  "dry_run": true,
  "reviewer_model": "us.anthropic.claude-sonnet-4-6",
  "inference": "ok",
  "deps": {
    "trusty_search": {
      "required": true,
      "reachable": true
    },
    "trusty_analyze": {
      "required": false,
      "reachable": true
    }
  }
}

Status values:

  • ok — all dependencies healthy and inference reachable.
  • degraded — a required dependency (trusty-search) or inference is unreachable.
  • unknown — cannot determine health state.

Inference field values:

  • ok — AWS Bedrock and/or OpenRouter accessible.
  • unreachable — both inference providers unreachable (network/DNS error).
  • auth_error — inference provider reachable but auth failed (bad API key).
  • unknown — inference probe could not determine status.

Environment variables

Variable Default Purpose
PR_INTELLIGENCE_DRY_RUN true When true, no GitHub comments are posted
TRUSTY_SEARCH_URL http://127.0.0.1:7878 trusty-search daemon URL
PR_INTELLIGENCE_ANALYZER_URL http://127.0.0.1:7879 trusty-analyze daemon URL
GITHUB_TOKEN GitHub personal access token for review_pr
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY AWS credentials for Bedrock
OPENROUTER_API_KEY OpenRouter API key (when using OpenRouter provider)
RUST_LOG warn Tracing filter (logs to stderr)

AWS credentials can also be supplied via ~/.aws/credentials, IAM roles, or SSO. The full AWS credential chain is supported.

Context sources & the conformance gate

trusty-review enriches a review with external context sources (JIRA, Confluence, GitHub Issues, and the intent/method-conformance back gate). Each source resolves independently from layered config — an env var beats a TOML key beats the built-in default (the ContextSourcesConfig struct):

Source Enable env var Mode env var TOML table Default
JIRA TRUSTY_REVIEW_CONTEXT_JIRA_ENABLED …_JIRA_MODE [context.sources.jira] auto (on creds)
Confluence TRUSTY_REVIEW_CONTEXT_CONFLUENCE_ENABLED …_CONFLUENCE_MODE [context.sources.confluence] auto (on creds)
GitHub Issues TRUSTY_REVIEW_CONTEXT_GITHUB_ISSUES_ENABLED …_GITHUB_ISSUES_MODE [context.sources.github_issues] auto (on creds)
Conformance TRUSTY_REVIEW_CONTEXT_CONFORMANCE_ENABLED …_CONFORMANCE_MODE [context.sources.conformance] DISABLED

Enable values are lenient (true/1/yes/on); mode is live (only mode supported today) or semantic (not yet implemented for these sources).

The conformance back gate (DOC-15)

The conformance source is the BACK gate of the intent/method-conformance capability (docs/specs/intent-conformance.md). During review it resolves "what method did the ticket/spec prescribe?" via the shared intent-source resolver (ISR) and surfaces it so the reviewer LLM can flag a diff that explicitly contradicts that method (matrix M5). A gap or an unresolved intent surfaces nothing — the gate is conservative and fail-open, so it never manufactures a false-positive finding.

It is default-DISABLED (unlike the other sources, it does not auto-enable on mere credential presence) because it issues a GitHub ticket fetch and is opt-in. Turn it on explicitly:

# Env (one-shot)
TRUSTY_REVIEW_CONTEXT_CONFORMANCE_ENABLED=true trusty-review serve

# …or in $XDG_CONFIG_HOME/trusty-review/config.toml
[context.sources.conformance]
enabled = true
mode = "live"

The gate is backed by the intent_source module in trusty-common, gated behind that crate's intent-source Cargo feature (which trusty-review already enables). See the Cargo features note below.

Reviewer model

The default reviewer model is us.anthropic.claude-sonnet-4-6 on AWS Bedrock.

Override via:

  • CLI flag: --reviewer-model bedrock/us.anthropic.claude-haiku-4-5
  • Env var: PR_INTELLIGENCE_REVIEWER_MODEL=bedrock/us.anthropic.claude-haiku-4-5
  • Config file: $XDG_CONFIG_HOME/trusty-review/config.toml

Provider prefix convention:

  • bedrock/<id> — AWS Bedrock Converse API (no API key needed, uses AWS credential chain)
  • openrouter/<id> — OpenRouter (requires OPENROUTER_API_KEY)
  • Bare id — uses the configured default provider

Cargo features

Feature Default Description
http-server yes Axum HTTP daemon (serve subcommand without --stdio)
mcp yes MCP stdio JSON-RPC service (serve --stdio)
profile yes Longitudinal contributor-profiling pipeline (profile subcommand); pulls in tga + rusqlite

The conformance back gate (above) is backed by trusty-common's intent-source feature, which trusty-review enables unconditionally (it is part of the dependency declaration, not a trusty-review feature). That feature gates the shared intent-source resolver (ISR) so the other trusty-common consumers that do not need it pay nothing.

Slim build (no contributor profiling, no tga/rusqlite compilation):

cargo install --git https://github.com/bobmatnyc/trusty-tools trusty-review \
  --locked --no-default-features --features http-server,mcp

License

MIT — see LICENSE.