AI Review — Automated code review
Обновлено 7 апреля 2026 г.
Heuristic + LLM code review with custom presets, runs in CI or locally.
One line: Run linters and an LLM analyzer over a set of files, get back actionable issues with file/line/fix recommendations.
Source: plugins/kb-labs-ai-review
The problem
There are two failure modes for code review tools:
- Linters alone catch style and obvious bugs but say nothing about architecture, naming, or whether the change makes sense.
- LLMs alone are slow, expensive, and tend to hallucinate or "review" things that aren't in the diff.
AI Review combines them: linters (ESLint, Ruff, etc.) for fast deterministic checks, LLM analyzers for the things linters can't see, with presets so a team can codify "what we actually care about".
What it does
# Fast mode for CI — heuristic engines only, no LLM
pnpm kb review run --mode=heuristic --scope=staged
# Local pre-PR run — full analysis
pnpm kb review run --mode=full --files="src/**/*.ts"
# Use a custom preset
pnpm kb review run --mode=full --preset=my-team-rules
# Agent-friendly output ({ passed, issues, summary })
pnpm kb review run --mode=full --files="src/**/*.ts" --agent
# Or full machine-readable result (findings, metadata, ...)
pnpm kb review run --mode=full --files="src/**/*.ts" --jsonThe three modes form a clean ladder:
| Mode | Engines | Speed | When |
|---|---|---|---|
heuristic | ESLint / Ruff / etc. | Fast | CI, every push |
full | Heuristic + LLM, cached | Medium | Local pre-commit |
llm | LLM only | Slow | Deep PR review |
Presets
The interesting part is custom presets. You declare them in .kb/kb.config.json:
{
"profiles": [{
"id": "default",
"products": {
"review": {
"defaultPreset": "my-rules",
"presets": [{
"id": "my-rules",
"extends": "kb-labs",
"llm": {
"enabled": true,
"analyzers": ["naming", "architecture", "security"]
},
"context": {
"conventions": {
"naming": "Prefer verb-noun for functions. Avoid abbreviations.",
"architecture": "Domain types live in *-contracts. See ADR-0012.",
"security": "Never log request bodies. Sanitize SQL inputs."
}
}
}]
}
}
}]
}Then --preset=my-rules and the LLM gets your team's actual rules as context. Presets can extend built-ins (default, typescript-strict, react, security, kb-labs, kb-labs-strict) so you only override what's different.
KB Labs primitives used
From the manifest:
platform: {
requires: ['storage', 'cache'],
optional: ['llm', 'analytics', 'logger'],
},llm— optional, so--mode=heuristicworks without any AI configured.cache— namespacereview:, dedupes LLM calls per file+config hash. Re-running on an unchanged file is free.- Profile system — presets live in the standard profile config, so they roam with the workspace.
- Permissions — read-only over
**/*(you don't want a review tool that can write).
What to steal
Mode laddering. Don't make users pick "fast or smart" at install time. Ship three modes with sensible defaults, document which one belongs in CI vs local vs pre-PR, and let the cache make repeated runs cheap. Most users will end up using all three at different points without thinking about it — which is exactly right.