Skip to content

Tutorial: LLM-Powered Review

This tutorial sets up LLM-powered review to automatically assess needs_review findings and generate regulatory-quality evidence text.

Without LLM review, 150 Semi findings require manual triage. With it, the LLM examines the code context and determines pass/fail with an evidence paragraph suitable for Module A documentation.

Without LLM: 55 pass, 40 fail, 57 needs_review
With LLM: 85 pass, 48 fail, 19 needs_review

The LLM upgrades many needs_review findings to pass or fail with evidence citations.

  1. Install Ollama:

    Terminal window
    curl -fsSL https://ollama.com/install.sh | sh
  2. Pull a model (70B recommended for code review):

    Terminal window
    ollama pull llama3.1:70b
    # Or faster: ollama pull llama3.1:8b
  3. Scan with LLM:

    Terminal window
    fleet scan --path . --llm ollama --output pretty
  1. Get an Anthropic API key from https://console.anthropic.com

  2. Set the key:

    Terminal window
    export ANTHROPIC_API_KEY=sk-ant-api03-...
  3. Scan with Claude:

    Terminal window
    fleet scan --path . --llm claude --output pretty

Claude produces the highest quality evidence text — well-structured paragraphs with specific code citations.

Here’s the same finding reviewed by different backends:

CRYPTO-01-R1: needs_review (confidence: 0.60)
Message: "SHA-256 usage detected"

No evidence text — requires manual review.

Terminal window
# PR checks: fast, no LLM (3 seconds)
fleet scan --llm off --ci
# Main branch: thorough, with Claude (30-60 seconds)
fleet scan --llm claude --ci
# Nightly: full review with detailed evidence
fleet scan --llm claude --report weekly-report.md

Every LLM-reviewed finding includes provenance tracking:

{
"llm_provenance": {
"backend": "claude",
"model": "claude-sonnet-4-6",
"prompt_version": "v1.0.0",
"token_usage": { "input": 2340, "output": 856 },
"confidence": 0.95
}
}

This ensures traceability: you can always see which model produced which evidence, at what confidence level, using which prompt version.