Onboard a monorepo to AI code review
Connect a 1k–100k-file monorepo to LGTM in under 10 minutes. Tree-sitter indexes all 12 languages, PageRank ranks cross-package context, BYOK keeps per-PR cost manageable.
Monorepos break naive code review tools — too many files for diff-only review, too much cross-package context to ignore. LGTM's indexed approach handles them natively.
Why monorepos break diff-only review
A PR in a monorepo often touches 3-5 packages: API contract change in one package, consumer updates in others, test fixes in a fourth. Diff-only AI review sees each change in isolation, can't reason about the API contract's downstream consumers.
Result: the review approves changes that look fine in isolation but break callers in other packages. Bugs ship. The team learns to ignore the AI review.
Indexed monorepo review fixes this: the indexer builds a cross-package symbol graph at install time. PR review pulls the changed symbols + their downstream callers + relevant tests from the index. Agents see the FULL impact, not just the diff.
Setup
(1) Install the LGTM GitHub App on the monorepo. (2) First-index runs automatically — for typical monorepos (1k-10k files), 1-3 minutes; for large monorepos (100k+ files), 5-15 minutes. Progress streams to the dashboard via Socket.IO.
(3) Configuration: by default, every file gets indexed. To exclude paths (vendor/, third-party/, generated/, build/), create `.lgtmignore` at the monorepo root using gitignore syntax. Common exclusions: `node_modules/`, `dist/`, `*.pb.go`, `generated/`.
(4) Per-package overrides: Pro plan. Each package can have its own review configuration — different model, different focus areas, different verdict thresholds. Marketing-site package on Haiku 4.5 for cheap reviews; payments package on Opus 4.7 for thorough reviews.
How review scales to monorepo PR sizes
A typical monorepo PR might touch 50 files across 5 packages — that's 5,000-50,000 lines of context if you tried to send it all to an LLM. Frontier models can handle that context, but the per-PR cost would balloon.
LGTM's approach: PageRank-ranked context retrieval. The diff's 50 changed files get embedded as graph seeds; personalized PageRank ranks the rest of the symbol graph by structural relevance. The top 15-30 symbols across all packages get attached to the prompt, NOT all 50,000 lines.
Net result: a 50-file monorepo PR review costs about the same in tokens as a 5-file single-package PR (the context budget is bounded), but the agents see the cross-package dependencies that matter.
Per-package configuration
Different packages have different needs. The auth-service package might need strict Security gating; the marketing-site package might only need Readability.
Configure per-package: Settings → Repos → Per-Path Config. Patterns are glob-based (`packages/auth/**`, `apps/marketing/**`). Each pattern can specify: enabled agents, model override, verdict threshold, ignore patterns.
Inheritance: package config inherits from repo defaults; repo config inherits from org defaults. Effective config is computed on every review by walking the file path and matching patterns longest-first.
Cost economics on monorepo scale
Naive math: 50 PRs/week × 10 engineers × 6 agents × ~3,000 tokens per agent × $0.005/1k tokens = ~$45/week ≈ $180/month in pure tokens. That's the worst-case for a busy monorepo on gpt-5.4.
Optimized math: per-package model tuning (mini/haiku/nano on low-stakes packages, flagship only on critical packages) drops average per-PR cost by 60-80%. Realistic: $30-$60/month in tokens for a busy 10-engineer monorepo.
LGTM's flat subscription (₹399/mo Pro) is separate from token cost. Combined: ~$30-$80/month total for unlimited reviews on a busy monorepo. No per-seat tax, no per-repo tax.
Configuration examples
# Standard ignores
node_modules/
dist/
build/
.next/
.nuxt/
# Generated code
**/*.pb.go
**/*.gen.ts
**/generated/
# Third-party
vendor/
third-party/
# Snapshots and fixtures
**/__snapshots__/
**/fixtures/Read about LGTM's monorepo-aware indexer
12 languages · tree-sitter + PageRank · incremental updates
Go to the product pageFAQs
How big a monorepo can LGTM handle?
Tested up to ~100k files / 10M lines of code. Index time scales linearly (~30s per 10k files on typical hardware). Per-review time is bounded by context retrieval (sub-second) + agent execution (30-90s) — same as small repos.
Yarn workspaces / NX / Turborepo / pnpm — all supported?
Yes. The indexer reads package.json files at any depth, builds the package graph from workspace declarations. Turborepo's pipeline definitions aren't directly used (we don't run your build) but the package boundaries are respected.
What about Bazel monorepos?
Tree-sitter parses BUILD files. Package graph extraction works but with caveats — Bazel's load() + macros can produce complex dependency graphs that the indexer simplifies. Most Bazel projects work; some edge cases require manual `.lgtmignore` tweaking.
Can different packages have different reviewers required?
GitHub-side: yes, via CODEOWNERS. LGTM's review is one Check Run; it doesn't differentiate per-package owners. Combine LGTM (one quality check) with CODEOWNERS (human reviewer routing) for full coverage.
How do I exclude experimental packages?
Add the package path to .lgtmignore. Or use per-path config to disable LGTM on that pattern. Either approach prevents reviews from running on those files.
Related across LGTM
Tree-sitter explained
The parser primitive that makes 12-language monorepo indexing tractable.
PageRank context explained
How cross-package symbol importance ranks for context retrieval.
Context indexer feature page
Architecture deep-dive — symbol graph + personalised PageRank end-to-end.
BYOK on Gemini
Why Gemini's 1M-2M context window pairs well with monorepo PRs.
Related use cases
Roll out LGTM across many repos
Install LGTM org-wide once, then enroll specific repos progressively. Per-repo config inherits from org defaults. Multi-repo rollout in days, not months.
Use LGTM as a CI gate
Configure LGTM's review verdict as a required Check Run in branch protection. A failed review blocks the merge until findings are resolved — automated quality gate, no human bottleneck.
Pre-push local review
Review your working diff locally with the lgtm CLI before pushing — catch issues before the PR opens, save round-trips with reviewers, faster iteration.