Skip to content

Getting Started with lgtmaybe

This tutorial walks you through your first review using ollama — a fully local model that costs nothing and needs no API keys. By the end you will have reviewed a branch and seen the findings in your terminal, with no GitHub token and no pull request required.

What you need

  • Python 3.11 or later
  • ollama running locally
  • A local git repository with some changes on a branch to review

Step 1 — Install lgtmaybe

pip install lgtmaybe

On macOS you can install from the Homebrew tap instead:

brew tap MattJColes/tap
brew trust MattJColes/tap   # current Homebrew requires trusting third-party taps
brew install lgtmaybe

See Install the CLI for details. It explains the brew trust step, and which providers the base install covers: API-key and local ones. Keyless cloud providers need the pip extras.

Verify the install:

lgtmaybe --help

Step 2 — Start ollama and pull a model

ollama serve          # starts the local server on http://localhost:11434
ollama pull qwen3.6:27b    # or any model you prefer

Leave ollama serve running in a separate terminal.

Step 3 — Review your changes

From inside a git repo, on a branch with some changes, run:

lgtmaybe review \
  --provider ollama \
  --model qwen3.6:27b \
  --api-base http://localhost:11434

lgtmaybe diffs your current branch against the remote primary branch (origin/HEAD, falling back to origin/main / origin/master, then a local main / master), sends the changed lines to your local qwen3.6:27b instance, and prints the findings to your terminal:

src/app.py:2  [MEDIUM] Import order
  sys should be sorted before os

1 finding · provider ollama · model qwen3.6:27b

To review the whole worktree — your branch's commits plus uncommitted edits — add --working. To review only the uncommitted edits, add --uncommitted. To diff against a different base, pass --base main.

Step 4 — Change the output format

--format controls what review prints. --json (shorthand for --format json) emits a JSON array ready to pipe into other tooling:

lgtmaybe review --provider ollama --model qwen3.6:27b \
  --api-base http://localhost:11434 --json

--format agent instead prints the findings as correction instructions an AI coding agent can read and apply, for a local review-and-fix loop — see Fix findings with an AI agent.

Step 5 — See the whole change

lgtmaybe diagram runs the same local diff through three concurrent model calls and prints the change overview: a description of what you changed, a High Impact Areas section calling out anything that could bite (infrastructure, security posture, outage risk, migrations, backups and more), and a picture of the components your change touches — plus, when it alters a run-time flow, a sequence diagram of that flow:

lgtmaybe diagram \
  --provider ollama \
  --model qwen3.6:27b \
  --api-base http://localhost:11434

It takes the same --base / --working / --uncommitted flags as review, so review then diagram is a natural pair before you open a pull request: what's wrong with the change, then what the change is and what it could break. The diagrams print as Mermaid source plus a text rendering — the text is what reads in a terminal; paste the Mermaid into a GitHub comment or mermaid.live to see it drawn. See Generate a change overview.

Step 6 — Post reviews on real pull requests

The CLI reviews local changes. To run lgtmaybe on actual pull requests — inline comments and a summary posted back to the change — wire it into your code host. The review is the same on all three; only the plumbing differs:

What happened under the hood

lgtmaybe ran its pipeline over your local diff:

  1. fetch — read the diff from your local repo with git diff
  2. compress — stripped generated files, binaries, and lockfiles
  3. prompt — built a structured prompt asking for JSON output
  4. parse — validated the model's JSON against the ReviewFinding schema
  5. gate — dropped defect findings without a concrete failure_scenario
  6. render — printed the findings (the Action posts them to the PR instead)

Next steps