### Install azure extra, sign in, set endpoint, and run review Source: https://lgtmaybe.coles.codes/how-to/review-with-azure Keyless local setup: install the azure extra, sign in with az login (or use a managed identity), set AZURE_API_BASE, and run lgtmaybe review with --provider azure and --model my-gpt-4o-deployment. DefaultAzureCredential finds the az login session or managed identity; no static key is stored. ```bash pip install 'lgtmaybe[azure]' az login export AZURE_API_BASE="https://.openai.azure.com" lgtmaybe review \ --provider azure \ --model my-gpt-4o-deployment ``` -------------------------------- ### Full .lgtmaybe.yml example Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Complete example configuration file with provider, model, severity, path filters, token limits, and categories. ```yaml provider: openai model: gpt-5.5 min_severity: low include_paths: - "src/**" - "lib/**" exclude_paths: - "**/__pycache__/**" - "**/*.min.js" max_files: 30 max_input_tokens: 80000 categories: - security - correctness - tests ``` -------------------------------- ### vLLM with max-model-len and max-concurrency Source: https://lgtmaybe.coles.codes/how-to/use-a-custom-openai-compatible-endpoint Start vLLM with a larger max-model-len and run lgtmaybe with a higher max-concurrency. The commands show the recommended setup for latency-sensitive reviews, with the server allocating KV blocks dynamically. ```bash vllm serve --port 8000 --max-model-len 32768 ``` ```bash lgtmaybe review --provider openai-compatible --model \ --api-base http://localhost:8000/v1 --max-concurrency 6 ``` -------------------------------- ### Install lgtmaybe with cloud provider extras Source: https://lgtmaybe.coles.codes/how-to/install-the-cli Install the CLI with specific cloud SDKs required for keyless authentication. ```bash pip install 'lgtmaybe[bedrock]' # or [vertex] / [azure] ``` -------------------------------- ### Install lgtmaybe on Windows via WinGet Source: https://lgtmaybe.coles.codes/how-to/install-the-cli Install the portable executable for Windows x86_64 using WinGet. ```bash winget install --id MattJColes.lgtmaybe --exact ``` -------------------------------- ### Run lgtmaybe review with OpenRouter and qwen/qwen3.8-max Source: https://lgtmaybe.coles.codes/how-to/choose-a-review-model Runs a review with the OpenRouter provider and the qwen/qwen3.8-max model. Swapping in another hosted model only changes the model ID; the provider setup stays the same. See Review with OpenRouter for authentication and GitHub Action examples. ```bash lgtmaybe review --provider openrouter --model qwen/qwen3.8-max ``` -------------------------------- ### Example review output Source: https://lgtmaybe.coles.codes/tutorial/getting-started Example output from the review command, showing a finding and summary line. ```text src/app.py:2 [MEDIUM] Import order sys should be sorted before os 1 finding · provider ollama · model qwen3.6:27b ``` -------------------------------- ### Install lgtmaybe on macOS via Homebrew Source: https://lgtmaybe.coles.codes/how-to/install-the-cli Install the CLI from the project's Homebrew tap. ```bash brew tap MattJColes/tap brew trust MattJColes/tap brew install lgtmaybe ``` -------------------------------- ### Install lgtmaybe with Vertex extra and run review Source: https://lgtmaybe.coles.codes/how-to/review-with-vertex-wif Install the 'vertex' extra for lgtmaybe, set the required environment variables, and run a review with the Vertex provider. The command uses the gemini-3-pro model and does not accept a static API key. ```bash pip install 'lgtmaybe[vertex]' export VERTEXAI_PROJECT=my-project export VERTEXAI_LOCATION=us-central1 lgtmaybe review \ --provider vertex \ --model gemini-3-pro ``` -------------------------------- ### llama.cpp local server: start server and review with lgtmaybe Source: https://lgtmaybe.coles.codes/how-to/use-a-custom-openai-compatible-endpoint For local servers like llama.cpp, no API key is needed. Start the server, then run lgtmaybe with the local base URL. lgtmaybe uses a placeholder key because the OpenAI client requires one. ```bash llama-server -m ./model.gguf --port 8000 # serves the OpenAI API at /v1 ``` ```bash lgtmaybe review \ --provider openai-compatible \ --model local-model \ --api-base http://localhost:8000/v1 ``` -------------------------------- ### Install lgtmaybe via pip Source: https://lgtmaybe.coles.codes/how-to/install-the-cli Install the CLI on any OS with Python 3.11+. ```bash pip install lgtmaybe ``` -------------------------------- ### Start ollama and pull a model Source: https://lgtmaybe.coles.codes/tutorial/getting-started Starts the local ollama server and pulls the qwen3.6:27b model. Leave `ollama serve` running in a separate terminal. ```bash ollama serve # starts the local server on http://localhost:11434 ollama pull qwen3.6:27b # or any model you prefer ``` -------------------------------- ### Install lgtmaybe with Bedrock extra and run review Source: https://lgtmaybe.coles.codes/how-to/review-with-bedrock-oidc Install the 'bedrock' extra via pip, then run lgtmaybe review with the Bedrock provider and a model ID. Requires Python 3.11+ and ambient AWS credentials. The Action image already bundles boto3. ```bash pip install 'lgtmaybe[bedrock]' lgtmaybe review \ --provider bedrock \ --model us.anthropic.claude-sonnet-4-6 ``` -------------------------------- ### Verify lgtmaybe installation Source: https://lgtmaybe.coles.codes/how-to/install-the-cli Verify the installation by checking the command list. ```bash lgtmaybe --help ``` -------------------------------- ### Install static analysis tools Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost Installs the lgtmaybe static-analysis extra, which includes ruff, bandit, mypy, and semgrep with local rules. These tools run over changed files and feed findings to lenses as hints. ```bash pip install 'lgtmaybe[static-analysis]' ``` -------------------------------- ### Complete OpenAI workflow with github_identity: lgtmaybe Source: https://lgtmaybe.coles.codes/how-to/post-as-a-github-app Use this workflow to post as lgtmaybe[bot] with the public App. Requires installing the App, adding id-token: write, and setting github_identity: lgtmaybe. The job fails with setup guidance if id-token: write is missing, the App is not installed, the workflow is not trusted, or the identity service is unavailable. ```yaml name: lgtmaybe on: pull_request_target: issue_comment: types: [created] permissions: contents: read id-token: write jobs: review: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 # base repository only - uses: MattJColes/lgtmaybe@v2 with: github_identity: lgtmaybe provider: openai model: gpt-5.5 api_key: ${{ secrets.OPENAI_API_KEY }} ``` -------------------------------- ### vLLM server startup and review command Source: https://lgtmaybe.coles.codes/how-to/use-a-custom-openai-compatible-endpoint Start a vLLM server on port 8000 and then run lgtmaybe against it. The server command uses the meta-llama/Llama-3.1-8B-Instruct model; the review command specifies the same model and the local API base. ```bash vllm serve meta-llama/Llama-3.1-8B-Instruct --port 8000 ``` ```bash lgtmaybe review \ --provider openai-compatible \ --model meta-llama/Llama-3.1-8B-Instruct \ --api-base http://localhost:8000/v1 ``` -------------------------------- ### Use --fallback-model CLI flag Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Command-line example to set the fallback model for a single review run. ```bash lgtmaybe review --fallback-model qwen/qwen3.8-max ``` -------------------------------- ### Configure fallback_model with openrouter Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Example configuration using openrouter provider with a fallback model for reviews. ```yaml provider: openrouter model: google/gemini-3.7-flash fallback_model: qwen/qwen3.8-max ``` -------------------------------- ### Save agent instructions to review.txt Source: https://lgtmaybe.coles.codes/how-to/fix-findings-with-an-ai-agent Redirect the --format agent output to review.txt so an AI agent can read and apply the corrections. Uses the same ollama provider and model as the previous example. ```bash lgtmaybe review --provider ollama --model qwen3.6:27b \ --api-base http://localhost:11434 --format agent > review.txt ``` -------------------------------- ### Check lgtmaybe version Source: https://lgtmaybe.coles.codes/how-to/install-the-cli Check the installed version of the CLI. ```bash lgtmaybe --version ``` -------------------------------- ### directory_rules configuration with path-scoped instructions Source: https://lgtmaybe.coles.codes/how-to/scope-review-instructions-to-a-directory Example configuration for a code review tool (likely `code-review` or similar) that defines directory rules. It shows how to scope instructions to specific paths using globs, with separate rules for payments/billing, tests, and Terraform files. The rules are independent and applied in the order written. ```yaml provider: bedrock model: bedrock/anthropic.claude-sonnet-4-5-20250929-v1:0 directory_rules: - paths: ["payments/**", "billing/**"] instructions: | This is money-handling code. Treat any rounding, currency-conversion or retry change as high severity, and flag any write path that is not idempotent under a duplicated webhook. - paths: ["tests/**"] instructions: | Test code. Do not flag duplication, long functions, or missing docstrings here — explicit and repetitive is the house style for tests. Do still flag assertions that can never fail. - paths: ["infra/**/*.tf"] instructions: | Terraform. Flag any IAM policy with a `*` action or resource, and any storage bucket or database that becomes publicly reachable. ``` -------------------------------- ### Example models summary line Source: https://lgtmaybe.coles.codes/reference/profile A summary line displayed under the table when multiple models are used during a run. ```text models: luna (7 calls), sonnet (1 call) ``` -------------------------------- ### Enable static analysis Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost Enables static analysis in the configuration. Installed tools run over changed files and their findings are fed to lenses as hints to confirm or discard, costing no tokens. ```yaml static_analysis: enabled: true ``` -------------------------------- ### Check concurrency with --profile output Source: https://lgtmaybe.coles.codes/how-to/run-locally-with-ollama This example output shows how to tell if calls ran sequentially or overlapped. Compare the sum of per-call elapsed times to the review stage total; if they sum to roughly the stage time, they ran one after another. ```text review 95.32s <- stage total correctness 52.02s | spec 45.64s | sum is ~3x the stage, artefacts 43.67s | so these overlapped security 43.30s | ``` -------------------------------- ### Run lgtmaybe review with a local OpenAI-compatible model Source: https://lgtmaybe.coles.codes/how-to/choose-a-review-model Configures lgtmaybe to use an OpenAI-compatible local server via the '--provider openai-compatible' flag, targeting the 'nvidia/Qwen3.6-35B-A3B-NVFP4' model at a local API base. The example uses 'http://127.0.0.1:8000/v1'. Budget more memory than the model weights alone, as the context window, KV cache, serving engine, quantisation, and concurrency affect results. ```bash lgtmaybe review \ --provider openai-compatible \ --model nvidia/Qwen3.6-35B-A3B-NVFP4 \ --api-base http://127.0.0.1:8000/v1 ``` -------------------------------- ### Verify prompt caching from profile cache line Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost Example cache line from a profile showing tokens read and created across calls. Reads climbing across a run indicates caching is working; reads near zero mean paying full price for every lens. ```text cache: 412000 tokens read / 38000 created across 12 calls ``` -------------------------------- ### Configure lgtmaybe for key-based providers (Anthropic, OpenRouter, ZAI) Source: https://lgtmaybe.coles.codes/how-to/use-as-github-action Swap the provider, model, and api_key inputs to use Anthropic, OpenRouter, or ZAI (GLM/Zhipu AI). One-time setup: generate an API key in the provider's console and add it as a repo secret (Settings → Secrets and variables → Actions), then reference it as api_key. ```yaml # anthropic - uses: MattJColes/lgtmaybe@v2 with: provider: anthropic model: claude-sonnet-4-6 api_key: ${{ secrets.ANTHROPIC_API_KEY }} # openrouter - uses: MattJColes/lgtmaybe@v2 with: provider: openrouter model: anthropic/claude-sonnet-4-6 api_key: ${{ secrets.OPENROUTER_API_KEY }} # zai (GLM / Zhipu AI) - uses: MattJColes/lgtmaybe@v2 with: provider: zai model: glm-4.6 api_key: ${{ secrets.ZAI_API_KEY }} ``` -------------------------------- ### lgtmaybe per-call budget log output Source: https://lgtmaybe.coles.codes/how-to/use-a-custom-openai-compatible-endpoint Example log line showing the resolved per-call budget, timeout source, and concurrency. This appears in each run's output. ```text per-call budget resolved timeout_s=3600 timeout_source="provider default" concurrency=6 ``` -------------------------------- ### Set provider to anthropic Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Example showing how to set the provider field to anthropic. ```yaml provider: anthropic ``` -------------------------------- ### Run lgtmaybe review with default output Source: https://lgtmaybe.coles.codes/explanation/what-gets-reviewed Runs the review on the current branch's diff against the remote primary branch, printing a readable listing followed by a summary line. The example uses the `--provider`, `--model`, and `--api-base` flags to specify the Ollama provider and model. ```bash $ lgtmaybe review --provider ollama --model qwen3.6:27b --api-base http://localhost:11434 src/app.py:2 [MEDIUM] Import order sys should be sorted before os 1 finding · provider ollama · model qwen3.6:27b ``` -------------------------------- ### Get findings as JSON Source: https://lgtmaybe.coles.codes/how-to/run-locally-with-ollama Add --json to get a machine-readable array of findings that can be piped into other tooling. The CLI prints a readable listing by default and never posts anywhere. ```bash lgtmaybe review \ --provider ollama \ --model qwen3.6:27b \ --api-base http://localhost:11434 \ --json ``` -------------------------------- ### Set max_tokens to 8192 in configuration Source: https://lgtmaybe.coles.codes/how-to/review-with-openrouter Configuration example to lower the token cap to 8192, reducing the credit reservation. Use with caution as a low cap can truncate the findings JSON and reasoning models need more headroom. ```yaml max_tokens: 8192 ``` -------------------------------- ### lgtmaybe diagram output with Mermaid and text Source: https://lgtmaybe.coles.codes/how-to/generate-a-change-diagram Example output of the lgtmaybe diagram command. It shows the Mermaid sequence diagram and its plain text version, which is what you paste into a GitHub comment or Markdown file. ```text $ lgtmaybe diagram --provider ollama --model llama3 ### Sequence ```mermaid sequenceDiagram participant n0 as Order API (changed) participant n1 as Payments n0->>n1: POST /charge n1-->>n0: 503 Unavailable n0->>n0: backs off 200ms ``` Text version: ``` 1. [Order API (changed)] -> [Payments]: POST /charge 2. [Payments] --> [Order API (changed)]: 503 Unavailable 3. [Order API (changed)] -> [Order API (changed)]: backs off 200ms ``` ``` -------------------------------- ### Set max_concurrency to 1 in .lgtmaybe.yml Source: https://lgtmaybe.coles.codes/how-to/use-a-custom-openai-compatible-endpoint Configuration file example to set max_concurrency to 1 for single-slot servers, preventing queueing. The comment indicates the file name. ```yaml # .lgtmaybe.yml max_concurrency: 1 ``` -------------------------------- ### Run review with profiling Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost Use the --profile flag to get a detailed token breakdown for a review run. The last line of output is the token meter, which is also printed to stderr on every local review even without the flag. ```bash lgtmaybe review --profile ``` -------------------------------- ### Bounded lens notice example Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost Shown as the output notice when a lens exceeds the default 50-finding bound. Indicates the lens name and how many findings were dropped, typically signaling a model problem rather than a bound set too low. ```text ⚠️ Bounded a lens to the top 50 findings by severity: `intent` (269 dropped). ``` -------------------------------- ### Disable structured output with --no-structured-output flag Source: https://lgtmaybe.coles.codes/how-to/use-a-custom-openai-compatible-endpoint Command-line example for gateways that reject response_format with a 400 error. The flag prevents the request from carrying the parameter; the prompt still asks for JSON and the lenient parser handles the response. ```bash lgtmaybe review \ --provider openai-compatible \ --model gemini-3.5-flash \ --api-base https://api.myllm.com/v1 \ --no-structured-output ``` -------------------------------- ### Output findings as JSON with --json Source: https://lgtmaybe.coles.codes/explanation/what-gets-reviewed Uses the `--json` flag (shorthand for `--format json`) to print findings as a JSON array, enabling piping into other tooling. The example shows the same review command with the `--json` flag and its resulting JSON output. ```bash $ lgtmaybe review --provider ollama --model qwen3.6:27b --api-base http://localhost:11434 --json [{"path": "src/app.py", "line": 2, "side": "RIGHT", "severity": "medium", "title": "Import order", "body": "sys should be sorted before os", "suggestion": null}] ``` -------------------------------- ### Inline custom lens in .lgtmaybe.yml Source: https://lgtmaybe.coles.codes/how-to/add-a-custom-lens Defines a custom lens named 'house-style' directly in the repo config. It enforces team conventions by flagging bare dict returns and logging without correlation IDs. The example_diff and example_finding fields provide a worked example to improve model accuracy. ```yaml provider: ollama model: qwen3.6:27b extra_lenses: - id: house-style title: House style instructions: | Enforce our team conventions on changed code. Flag new public functions that return bare dicts instead of a typed dataclass, and any logging at WARNING or above that doesn't include a correlation id. example_diff: | --- a/api.py +++ b/api.py @@ -10,1 +10,2 @@ def make_user(name): + return {"name": name, "active": True} example_finding: path: api.py line: 11 severity: low title: Public function returns a bare dict body: House style returns a typed dataclass from public functions, not a dict. suggestion: " return User(name=name, active=True)" ``` -------------------------------- ### Configure provider, model, and fallback Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost Sets provider to openrouter, primary model to google/gemini-3.7-flash, and fallback to qwen/qwen3.8-max. Both models use the same provider and credentials. A failed call still spends the primary model's attempts before adding the second model. ```yaml provider: openrouter model: google/gemini-3.7-flash fallback_model: qwen/qwen3.8-max ``` -------------------------------- ### Run LGTMaybe review with custom lens (CLI) Source: https://lgtmaybe.coles.codes/how-to/add-a-custom-lens Runs a review with a custom lens using the Ollama provider and a specific model. The command is `lgtmaybe review --provider ollama --model qwen3.6:27b --api-base http://localhost:11434`. This is the only command shown; no output is displayed. ```bash lgtmaybe review --provider ollama --model qwen3.6:27b --api-base http://localhost:11434 ``` -------------------------------- ### Run lgtmaybe diagram with ollama provider Source: https://lgtmaybe.coles.codes/how-to/generate-a-change-diagram Prints the change overview of local changes. The output includes a description, High Impact Areas, and each diagram's Mermaid source and text rendering. ```bash $ lgtmaybe diagram --provider ollama --model llama3 ``` -------------------------------- ### Run lgtmaybe locally with OpenAI Source: https://lgtmaybe.coles.codes/how-to/review-with-openai Sets the OPENAI_API_KEY environment variable and runs lgtmaybe review with the openai provider and gpt-5.5 model. The key can also be passed inline with --api-key; it is never persisted to config. ```bash export OPENAI_API_KEY=sk-... lgtmaybe review --provider openai --model gpt-5.5 ``` -------------------------------- ### Scope review instructions with directory_rules Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Scopes extra review instructions and reference files to part of the repo. Each rule has paths (fnmatch globs), free-text instructions, and context_files. An empty or omitted paths list applies the rule everywhere. Context files are redacted like the diff, share max_input_tokens / 8, and are capped at five files per review. Both instructions and context text are trusted config. Default is no rules. ```yaml directory_rules: - paths: ["payments/**", "billing/**"] instructions: | Money-handling code. Treat rounding, currency-conversion and retry changes as high severity, and flag any write path that is not idempotent. - paths: ["tests/**"] instructions: | Test code — do not flag duplication, long functions, or missing docstrings here. - paths: ["src/**"] instructions: Check changes against the architecture described below. context_files: [ARCHITECTURE.md] ``` -------------------------------- ### Set default provider and model in .lgtmaybe.yml Source: https://lgtmaybe.coles.codes/how-to/review-with-openrouter Create a .lgtmaybe.yml file with the provider set to 'openrouter' and the model set to 'anthropic/claude-sonnet-4-6'. With this file in place, the 'lgtmaybe review' command needs no flags. ```yaml provider: openrouter model: anthropic/claude-sonnet-4-6 ``` -------------------------------- ### Run review with local ollama model Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost Runs lgtmaybe review using the ollama provider with the qwen2.5-coder:14b model, useful when cost is the binding constraint rather than latency. ```bash lgtmaybe review --provider ollama --model qwen2.5-coder:14b ``` -------------------------------- ### Run lgtmaybe locally with Anthropic Source: https://lgtmaybe.coles.codes/how-to/review-with-anthropic Set the ANTHROPIC_API_KEY environment variable and run lgtmaybe review with the Anthropic provider. The key is never persisted to config. ```bash export ANTHROPIC_API_KEY=sk-ant-... lgtmaybe review --provider anthropic --model claude-sonnet-4-6 ``` -------------------------------- ### Load extra_lenses from lens_paths skill files Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Loads extra_lenses from separate skill files instead of inlining them. Each entry is a YAML file or directory of lens files. Paths are resolved relative to the repo root. Lenses loaded this way are appended to any inline extra_lenses. Default is none. ```yaml lens_paths: - .lgtmaybe/skills # a directory of one-lens-per-file skill files - team-lenses/house-style.yml # or a single file ``` -------------------------------- ### Set max_tokens in .lgtmaybe.yml Source: https://lgtmaybe.coles.codes/how-to/run-locally-with-ollama Shows how to set the output ceiling in the .lgtmaybe.yml configuration file, which is also how the GitHub Action picks it up. ```yaml # or in .lgtmaybe.yml (also how the GitHub Action picks it up): max_tokens: 32768 ``` -------------------------------- ### Run lgtmaybe locally with z.ai Source: https://lgtmaybe.coles.codes/how-to/review-with-zai Sets the ZAI_API_KEY environment variable and runs lgtmaybe review with the zai provider and glm-4.6 model. The key is read from the environment or the --api-key flag and is never persisted to config. ```bash export ZAI_API_KEY=... lgtmaybe review --provider zai --model glm-4.6 ``` -------------------------------- ### Print findings as agent instructions with lgtmaybe review --format agent Source: https://lgtmaybe.coles.codes/how-to/fix-findings-with-an-ai-agent Run lgtmaybe review with --format agent to output correction instructions for an AI agent. Uses ollama with the qwen3.6:27b model and a local API base. The output is directive, listing each finding with file path, line, issue, and suggested fix. ```bash lgtmaybe review \ --provider ollama \ --model qwen3.6:27b \ --api-base http://localhost:11434 \ --format agent ``` ```text Code review findings for your local changes. Act as the developer and apply each correction below: open the file at the given path and line, fix the issue, and apply the suggested change where one is given. [1] src/app.py:42 (HIGH) possible NPE Issue: `user` may be None here. Suggested fix: if user is not None: do_thing(user) 1 finding(s) to address. After applying the fixes, re-run `lgtmaybe review` to confirm they are resolved. ``` -------------------------------- ### GitHub Actions if condition for review job gating Source: https://lgtmaybe.coles.codes/explanation/trust-and-cost Used in the example workflows to gate the review job on the triggering user's author association. The condition runs the job when the event is pull_request_target with author association OWNER, MEMBER, or COLLABORATOR, or when an issue comment contains a slash command (/review, /improve, /ask, /describe, /diagram) and the comment author has the same association. The clause is deliberately looser than the parser (substring, case-insensitive) to avoid disabling commands. ```yaml if: >- (github.event_name == 'pull_request_target' && contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)) || (github.event.issue.pull_request && contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) && (contains(github.event.comment.body, '/review') || contains(github.event.comment.body, '/improve') || contains(github.event.comment.body, '/ask') || contains(github.event.comment.body, '/describe') || contains(github.event.comment.body, '/diagram'))) ``` -------------------------------- ### Pull recommended coding models with ollama Source: https://lgtmaybe.coles.codes/how-to/run-locally-with-ollama Pulls the Qwen3.6-27B model for strong coding performance or the smaller Gemma4-4B for limited RAM. Use the model that fits your hardware; larger models are more accurate. ```bash ollama pull qwen3.6:27b # strong all-round coding model ollama pull gemma4:e4b # smaller — for devices with limited RAM ``` -------------------------------- ### Configure lgtmaybe with Ollama in .lgtmaybe.yml Source: https://lgtmaybe.coles.codes/how-to/run-locally-with-ollama Use this YAML configuration to set Ollama as the provider with a custom model, timeout, and context window. This is also how the GitHub Action picks up the settings. ```yaml # or in .lgtmaybe.yml (also how the GitHub Action picks it up): provider: ollama model: qwen3.6:35b timeout: 1800 num_ctx: 65536 ``` -------------------------------- ### LM Studio local server review command Source: https://lgtmaybe.coles.codes/how-to/use-a-custom-openai-compatible-endpoint Use this command to run lgtmaybe against a local LM Studio server that serves the OpenAI API on the default port 1234. The server must be enabled first; the command specifies the provider, model, and API base URL. ```bash lgtmaybe review \ --provider openai-compatible \ --model your-loaded-model \ --api-base http://localhost:1234/v1 ``` -------------------------------- ### llama.cpp server with concurrency and context sizing Source: https://lgtmaybe.coles.codes/how-to/use-a-custom-openai-compatible-endpoint Run llama-server with 4 slots and a total context of 131072 tokens (4 × 32k) to avoid truncation when using -np. The comment explains the sizing: 4 slots each with 32k context. ```bash llama-server -m ./model.gguf --port 8000 -np 4 -c 131072 # 4 slots × 32k each ``` -------------------------------- ### Run lgtmaybe locally with OpenRouter Source: https://lgtmaybe.coles.codes/how-to/review-with-openrouter Sets the OPENROUTER_API_KEY environment variable and runs lgtmaybe review with the openrouter provider and model anthropic/claude-sonnet-4-6. The key can also be passed inline with --api-key; it is never persisted to config. ```bash export OPENROUTER_API_KEY=sk-or-... lgtmaybe review --provider openrouter --model anthropic/claude-sonnet-4-6 ``` -------------------------------- ### Review with JSON output Source: https://lgtmaybe.coles.codes/tutorial/getting-started Emits a JSON array ready to pipe into other tooling. `--json` is shorthand for `--format json`. ```bash lgtmaybe review --provider ollama --model qwen3.6:27b \ --api-base http://localhost:11434 --json ``` -------------------------------- ### Generate change overview with lgtmaybe diagram Source: https://lgtmaybe.coles.codes/tutorial/getting-started Runs the same local diff through three concurrent model calls and prints a change overview with high impact areas and diagrams. ```bash lgtmaybe diagram \ --provider ollama \ --model qwen3.6:27b \ --api-base http://localhost:11434 ``` -------------------------------- ### directory_rules configuration with context_files Source: https://lgtmaybe.coles.codes/how-to/scope-review-instructions-to-a-directory Defines a directory rule for paths under src/ with instructions and context files. Context files are read from the workspace and redacted for secrets. The rule is YAML-only and must be placed in .lgtmaybe.yml. ```yaml directory_rules: - paths: ["src/**"] instructions: | Check changes against the architecture described below. Flag a new import that crosses a boundary the document forbids. context_files: - ARCHITECTURE.md - docs/data-model.md ``` -------------------------------- ### Enable mid_review_retrieval configuration Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost Configuration to turn on mid-review retrieval, which allows lenses to fetch files outside the diff. Default is false; enabling it can add up to one extra model call per (batch, lens) and should be budgeted for accordingly. ```yaml mid_review_retrieval: true # default false ``` -------------------------------- ### Enable Vertex AI API with gcloud Source: https://lgtmaybe.coles.codes/how-to/review-with-vertex-wif Command to enable the Vertex AI API for a GCP project, used when encountering PERMISSION_DENIED errors. Replace 'my-project' with your actual project ID. ```bash gcloud services enable aiplatform.googleapis.com --project=my-project ``` -------------------------------- ### mid_review_retrieval: true Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Allows a review lens to defer once for bounded, read-only codebase context. Opt-in due to extra model calls and token cost. CLI: --mid-review-retrieval; Action input: mid_review_retrieval. ```yaml mid_review_retrieval: true # trade tokens for cross-file recall ``` -------------------------------- ### Configuration file for timeout Source: https://lgtmaybe.coles.codes/how-to/run-locally-with-ollama Set the timeout in .lgtmaybe.yml to configure it for the GitHub Action or local runs. The provider, model, and timeout are specified. ```yaml provider: ollama model: qwen3.6:35b timeout: 1800 ``` -------------------------------- ### List available ollama models Source: https://lgtmaybe.coles.codes/how-to/run-locally-with-ollama Lists models available locally in ollama. Useful for verifying the pulled models are present before running a review. ```bash ollama list ``` -------------------------------- ### Self-managed GitHub App workflow with app_id and app_private_key Source: https://lgtmaybe.coles.codes/how-to/post-as-a-github-app Use this workflow when using your own GitHub App. Requires configuring the App with repository permissions contents: read, pull requests: write, and issues: write (add checks: write only when using fail_on). Store the App ID as LGTMAYBE_APP_ID repository variable and the PEM private key as LGTMAYBE_APP_PRIVATE_KEY secret. Do not combine app_id/app_private_key with github_identity: lgtmaybe. ```yaml permissions: contents: read steps: - uses: actions/checkout@v7 - uses: MattJColes/lgtmaybe@v2 with: provider: openai model: gpt-5.5 api_key: ${{ secrets.OPENAI_API_KEY }} app_id: ${{ vars.LGTMAYBE_APP_ID }} app_private_key: ${{ secrets.LGTMAYBE_APP_PRIVATE_KEY }} ``` -------------------------------- ### DeepSeek hosted endpoint: set API key and run lgtmaybe review Source: https://lgtmaybe.coles.codes/how-to/use-a-custom-openai-compatible-endpoint For hosted endpoints like DeepSeek, an API key is required. Set OPENAI_COMPATIBLE_API_KEY or pass --api-key. The base URL is required. The key is never persisted to config. ```bash export OPENAI_COMPATIBLE_API_KEY=sk-... # your DeepSeek key lgtmaybe review \ --provider openai-compatible \ --model deepseek-chat \ --api-base https://api.deepseek.com/v1 ``` -------------------------------- ### Configure Ollama in GitHub Action container Source: https://lgtmaybe.coles.codes/how-to/run-locally-with-ollama Set these settings in .lgtmaybe.yml to reach Ollama on the runner host from within the Action's container. The Action reads provider settings from config, so use host.docker.internal instead of localhost. ```yaml provider: ollama model: qwen3.6:27b api_base: http://host.docker.internal:11434 ``` -------------------------------- ### Manage WinGet package Source: https://lgtmaybe.coles.codes/how-to/install-the-cli Commands to upgrade or uninstall the lgtmaybe package via WinGet. ```bash winget upgrade --id MattJColes.lgtmaybe --exact winget uninstall --id MattJColes.lgtmaybe --exact ``` -------------------------------- ### Enable bundled lens packs with pack: scheme Source: https://lgtmaybe.coles.codes/how-to/add-a-custom-lens Enables curated lens packs by name using the pack: scheme in lens_paths. Packs are off by default and can be combined; an unknown pack name fails loudly, listing available packs. ```yaml # .lgtmaybe.yml provider: ollama model: qwen3.6:27b lens_paths: - pack:design # combine as many as you like - pack:robustness ``` -------------------------------- ### Persist non-secret defaults in .lgtmaybe.yml Source: https://lgtmaybe.coles.codes/how-to/review-with-anthropic Create a .lgtmaybe.yml file with these defaults so that lgtmaybe review needs no flags. The provider and model are specified. ```yaml provider: anthropic model: claude-sonnet-4-6 ``` -------------------------------- ### Static Analysis Configuration Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Configures static analysis tools with global and per-tool severity floors, tool modes, and optional rule overrides. Default is disabled; enabling runs tools in a sandboxed subprocess with a scrubbed environment. ```yaml static_analysis: enabled: true tools: [ruff, bandit, mypy, gitleaks, zizmor] # default: all supported tools min_severity: low # floor on mapped tool severity (default info) tool_min_severity: # per-tool overrides of the global floor ruff: medium # only medium+ from ruff; bandit keeps `low` tool_mode: # per-tool overrides of hint vs finding gitleaks: hint # route secrets through the model instead # semgrep_rules: .semgrep.yml # override the bundled MIT pack # ast_grep_rules: .ast-grep/ # your own structural rules (skipped when unset) ``` -------------------------------- ### summary_template: Custom summary line template Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Customize the review summary line with placeholders {count}, {provider}, {model}, and {version}. If formatting fails, falls back to the built-in line. Default is unset (built-in line). ```yaml summary_template: "🤖 {count} finding(s) · {model} · lgtmaybe {version}" ``` -------------------------------- ### Review changes with lgtmaybe review Source: https://lgtmaybe.coles.codes/tutorial/getting-started Reviews the current branch against the remote primary branch using the local ollama model. Prints findings to the terminal. ```bash lgtmaybe review \ --provider ollama \ --model qwen3.6:27b \ --api-base http://localhost:11434 ``` -------------------------------- ### Review with remote Ollama instance Source: https://lgtmaybe.coles.codes/how-to/run-locally-with-ollama Use this command to run lgtmaybe against an Ollama instance on another machine, such as a Tailscale peer. No authentication is added; ensure network access is restricted at the host or firewall level. ```bash lgtmaybe review \ --provider ollama \ --model qwen3.6:27b \ --api-base http://100.x.x.x:11434 ``` -------------------------------- ### Configure lens_paths to a skills directory Source: https://lgtmaybe.coles.codes/how-to/add-a-custom-lens Points lens_paths at a directory containing skill files. Lenses from these files are appended to any inline extra_lenses, and ids must be unique across the whole set. ```yaml # .lgtmaybe.yml provider: ollama model: qwen3.6:27b lens_paths: - .lgtmaybe/skills ``` -------------------------------- ### Define extra_lenses with custom review lens Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Defines a custom review lens with an id, title, instructions, and optional example_diff/example_finding. The example_diff and example_finding are supplied together to improve small model output. Lenses are trusted config and should only be defined in files you control. ```yaml extra_lenses: - id: simplify title: Simplify or delete instructions: | Flag code that should not exist at all. The best code is the code you never wrote: prefer the standard library, an existing dependency, or one line over a new abstraction. Call out needless wrappers, premature generality, and "just in case" code with no caller. example_diff: | --- a/util.py +++ b/util.py @@ -4,1 +4,3 @@ def get_name(user): + name = user.name + return name example_finding: path: util.py line: 5 severity: low title: Needless local variable body: The temporary adds nothing; return user.name directly. suggestion: " return user.name" ``` -------------------------------- ### Minimal workflow — openai Source: https://lgtmaybe.coles.codes/how-to/use-as-github-action A GitHub Actions workflow that triggers on pull_request_target and issue_comment events, with permissions for reading contents and writing pull requests. It only runs for trusted authors (OWNER, MEMBER, COLLABORATOR) and when a comment contains a slash command like /review, /improve, /ask, /describe, or /diagram. The job checks out the base repo for the .lgtmaybe.yml config and uses MattJColes/lgtmaybe@v2 with the openai provider, model gpt-5.5, auto_diagram enabled, and the OPENAI_API_KEY secret. ```yaml name: lgtmaybe on: pull_request_target: issue_comment: types: [created] permissions: contents: read pull-requests: write jobs: review: # Only trusted authors (owner / member / collaborator) can trigger a review, # and a comment only starts a job when it carries a slash command. if: >- (github.event_name == 'pull_request_target' && contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)) || (github.event.issue.pull_request && contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) && (contains(github.event.comment.body, '/review') || contains(github.event.comment.body, '/improve') || contains(github.event.comment.body, '/ask') || contains(github.event.comment.body, '/describe') || contains(github.event.comment.body, '/diagram'))) runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 # base repo only — for .lgtmaybe.yml config - uses: MattJColes/lgtmaybe@v2 with: provider: openai model: gpt-5.5 auto_diagram: true api_key: ${{ secrets.OPENAI_API_KEY }} ``` -------------------------------- ### Enable triage with triage_model Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost Sets the triage model to claude-haiku-4-5. A cheap model reads files first and drops those that don't need review, saving cost on low-substance churn. Triage failures review everything and skipped files are named in the summary. ```yaml triage_model: claude-haiku-4-5 ``` -------------------------------- ### Pin to a specific version with full version tag Source: https://lgtmaybe.coles.codes/how-to/use-as-github-action Use a full version tag like `v2.0.0` to pin the action exactly, instead of the floating `@v2` tag which tracks the latest `v2.x.x` release. ```yaml uses: MattJColes/lgtmaybe@v2.0.0 ``` -------------------------------- ### OpenRouter unsupported parameter warning Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost This log line indicates that a configured parameter is not supported by the selected model and will be ignored. If you see it naming a setting you intended to apply, that setting is not in effect; choose a different model or remove the setting. ```text configured params are not supported by this model and will be ignored ``` -------------------------------- ### Auto Describe Configuration Source: https://lgtmaybe.coles.codes/how-to/configure-lgtmaybe-yml Enables or disables the structured description in the overview comment. Default is true. When enabled, it adds a suggested title, change type, summary, per-file table, and intent check. ```yaml auto_describe: false ``` -------------------------------- ### Token usage formula for one review Source: https://lgtmaybe.coles.codes/how-to/reduce-review-cost Approximate input token usage per review: batches times lenses times the sum of diff, context padding, and hints. Lenses and batches are the main multipliers. ```text input tokens ≈ batches × lenses × (diff + context padding + hints) ``` -------------------------------- ### Run lgtmaybe with Ollama for large diffs Source: https://lgtmaybe.coles.codes/how-to/run-locally-with-ollama Use this command to review a large multi-file diff with a local Ollama model. It sets a longer timeout and a larger context window (--num-ctx) to accommodate big diffs. The default context is 32768; increase it for very large diffs. ```bash # A large multi-file diff on a local model — more time and more context # (32768 is already the default; go above it for very large diffs): lgtmaybe review --provider ollama --model qwen3.6:35b \ --api-base http://localhost:11434 --timeout 1800 --num-ctx 65536 ``` -------------------------------- ### Use China or coding-plan endpoint with --api-base Source: https://lgtmaybe.coles.codes/how-to/review-with-zai Points the zai provider to the China or coding-plan endpoint by setting --api-base to https://open.bigmodel.cn/api/paas/v4. The native route targets the international endpoint by default. ```bash lgtmaybe review \ --provider zai \ --model glm-4.6 \ --api-base https://open.bigmodel.cn/api/paas/v4 ``` -------------------------------- ### GitHub Actions workflow for lgtmaybe with Vertex AI Source: https://lgtmaybe.coles.codes/how-to/review-with-vertex-wif Workflow that triggers on pull_request_target and issue_comment events, with permissions for OIDC token exchange and posting review comments. It uses the lgtmaybe action with provider 'vertex' and model 'gemini-3-pro', passing the WIF provider and service account from secrets. The condition restricts reviews to trusted authors. ```yaml name: lgtmaybe on: pull_request_target: issue_comment: types: [created] permissions: id-token: write # required for the WIF token exchange (keyless) pull-requests: write # required to post review comments contents: read jobs: review: # Only trusted authors (repo owner / org member / collaborator) can trigger # a review, so fork PRs and drive-by comments cannot spend your provider # budget. A maintainer can still opt in to an external PR with /review. if: >- (github.event_name == 'pull_request_target' && contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)) || (github.event.issue.pull_request && contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) && (contains(github.event.comment.body, '/review') || contains(github.event.comment.body, '/improve') || contains(github.event.comment.body, '/ask') || contains(github.event.comment.body, '/describe') || contains(github.event.comment.body, '/diagram'))) runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: MattJColes/lgtmaybe@v2 with: provider: vertex model: gemini-3-pro gcp_wif_provider: ${{ secrets.GCP_WIF_PROVIDER }} gcp_service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} ``` -------------------------------- ### Refresh WinGet sources Source: https://lgtmaybe.coles.codes/how-to/install-the-cli Update WinGet package sources if a new version is not found. ```bash winget source update ```