leveret
This server provides static-analysis review tooling for a git repository — deterministic scanning, structural search, review prioritization context, and persistent review memory — all as review leads rather than verdicts.
scan — Run static-analysis engines (semgrep, gitleaks, shellcheck, ruff, actionlint, etc.) over a change set (git
base...HEADor an explicit file list) and get normalized findings, with profile-based scoping and tallied suppressions.ast_search — Perform syntax-aware structural code searches via ast-grep using patterns with metavariables (
$X,$$$ARGS) to find every call site shaped like a pattern, better than text grep.context — Get prioritization signals (not findings) for files: per-function cyclomatic complexity, 12-month git churn, and last-touched dates to decide where to dig deepest.
remember — Persist a graded verdict (
priced-noiseorfalse-positive, with mandatory reason) to.leveret/memory.jsonl, optionally anchored to a source line or applied class-wide via glob, so noise never re-surfaces ungraded.memory — Inspect the repo's stored review-memory entries (fingerprint, grade, reason, timestamps) to spot dead pricing or candidates for glob/profile promotion.
Enables autonomous code reviews on GitHub through a self-hosted GitHub App, receiving pull request webhooks, checking out the head commit, running scans and review agents, and posting inline comments plus a walkthrough report.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@leveret scan my repo for leaked secrets and security vulnerabilities"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Leveret
A leveret is a young hare — small, fast, and born with its eyes open.
Leveret is a self-hosted, hybrid engine for private code reviews: the successor to hosted AI review bots for teams that want reviews to run on their own infrastructure. It combines a deterministic static-analysis layer, a code graph built into every checkout, a graded noise filter with durable memory, and adversarial agent contracts — driven by the AI you bring (BYOAI: your provider and model — Anthropic or OpenAI by API key or subscription, or a local OpenAI-compatible endpoint). The engine layer itself never calls an LLM, and Leveret operates no hosted analysis service: reviewed-checkout analysis and provider credentials are never routed through Leveret-operated infrastructure. The model provider you configure does receive the prompts and source excerpts the runner sends it; use a local endpoint to keep even that on your network. An optional webhook relay, if you choose one, sees webhook payloads and a scoped token (see DESIGN.md); self-hosting without it involves no relay.
Priorities are working end-to-end reviews, accurate and actionable reports,
consequential defect recall with independent verification and beyond-diff evidence,
and honest coverage reporting. The target policy is no arbitrary file-count limits
by default, with optional client limits. Today the Java path on main still rejects
more than 2,000 files outside its configured roots; #80
removes that default and is not yet merged. Evidence-pack file-detail caps also
remain and must be evaluated against coverage quality, not service economics. See
DESIGN.md.
How a review works
flowchart TD
D[/"📄 PR diff"/]:::gh
S["🔍 scan<br>engines + delta vs base<br>+ profile + memory"]:::core
R["🐇 review agent<br>five lenses,<br>cross-file blast radius"]:::agent
V["⚖️ verification agent<br>refute or evidence,<br>three grades"]:::agent
T[/"📋 tiered findings<br>+ walkthrough report"/]:::gh
D --> S
D --> R -- concerns --> V -- survivors only --> T
S -- bounded post-walk leads --> V
classDef gh fill:#6ea8fe,stroke:#3d6fd9,color:#111
classDef tun fill:#ffc86b,stroke:#cc8f22,color:#111
classDef core fill:#7ed6a2,stroke:#3d9e6a,color:#111
classDef agent fill:#c9a0f5,stroke:#9059d1,color:#111
classDef store fill:#9fd8e3,stroke:#4d9aab,color:#111Deterministic first pass. Engines run only against what the change touches: semgrep (registry security + per-language rulesets, offline-capable), gitleaks (secrets over the commit range), shellcheck, ruff, actionlint, zizmor (workflow security), osv-scanner (lockfile CVEs), typos, jscpd (duplication, corpus-gated), custom semgrep/ast-grep rule packs, and any SARIF-emitting command via profile
custom:entries (recipes: psalm taint, hadolint, trivy, …). Delta scanning is on by default with a base ref: findings already present at the base tree are dropped as pre-existing — counted, never silent — with multiset identity (a copy of a known-bad line still surfaces), rename tracking, and surfaced base-pass failures. A code graph is generated into the checkout at the exact reviewed commit, so agents query structure instead of grepping for it.Accounted filter. After discovery completes, surviving deterministic leads enter verification as one bounded, routed stream. Every supplied concern and lead ends as
actionable,priced-noise,false-positive, ordropped; profile and memory suppression happens before routing. Nothing is silent: suppression, exact-mechanism deduplication, overflow IDs/bytes, verifier rationale, and publication state remain separate structured accounting.Memory that learns from humans.
.leveret/memory.jsonl, versioned in the reviewed repo: fingerprint verdicts (optionally anchored to a source line — the memory dies when the line changes) plus conventions — free-text rulings taught by maintainers vialearn, injected into the agent prompts as repo case law, able both to suppress noise and to raise findings that violate them.Adversarial contracts. The discovery walk runs five lenses (correctness and hostile inputs, contract conformance, test honesty, blast radius, and explicitly deferred leads triage) without deterministic lead material, and traces changed symbols to call sites outside the diff. After the walk, the verification agent tries to refute every concern and routed lead; claims it can neither refute nor ground in executed evidence are dropped, not published.
Reporting. Findings publish in importance tiers (
critical / major / minor / nit, distinct from engine severity), out-of-diff findings appear with their stated correlation to the change, pre-existing defects adjacent to edited lines return as reminders, and every review carries a walkthrough: per-lens outcomes (clean included), per-file verdicts, post-walk lead/overflow metrics, the engine table, and a run-configuration line naming the harness, model, and thinking level that produced the review.
Related MCP server: reporelay
Ways to run it
GitHub App (autonomous). A self-hosted App layer receives PR webhooks, checks
out the head, builds the code graph, runs the scan, drives the standardized runner,
and posts the review — inline comments plus walkthrough. The App holds only a GitHub
App key and webhook secret; model credentials live exclusively in the runner. Human
replies on findings feed learn. Getting started + diagram: docs/app.md.
Standardized runner. leveret-runner-pi drives the review/verify contracts
through a pinned Pi runtime. Leveret supplies
the system prompt, phase-specific terminal submission schema, and read-only review
tools; Pi supplies the provider/model runtime and trusted host resources. Models
submit phase results through leveret_submit_phase; assistant text is not parsed as
JSON. Host-installed Pi/OMP extensions and hooks, Pi/Claude/
Codex skills, prompt templates, and context are loaded. The reviewed checkout is
never Pi's working directory, so its settings, hooks, skills, prompts, MCP
configuration, and context cannot extend the session. You choose provider, model,
and effort (--model / --effort / --provider, or the matching
LEVERET_RUNNER_* env vars; defaults openai/gpt-5.6-sol at high). Every
walkthrough records the effective client, model, prompt hash, capabilities, and tool
metrics. A custom LEVERET_RUNNER remains the bring-your-own-harness escape hatch.
Autonomous reviews retain a private, owner-controlled audit trace by default:
Pi's native per-attempt sessions, normalized harness events, App/scanner/subprocess
activity, exact failed output, checksums, and a verified zstd-or-gzip archive under
LEVERET_DATA. Raw content never enters default stdout. See
Private audit traces for policy, retention,
export, security, and inspection controls.
Interactive (MCP). Register the server in any MCP-capable client and drive
reviews yourself — the served review/verify prompts arrive with your repo's
accumulated rulings substituted in (getting started + diagram:
docs/interactive.md):
npm install && npm run build
claude mcp add leveret -- node /path/to/leveret/dist/server.jsMCP tools: scan, ast_search (structural search via ast-grep), context
(per-function complexity, churn, recency — prioritization signal, not findings),
remember (persist a graded verdict), memory (inspect the store), learn
(persist a human-taught convention); MCP prompts: review, verify.
The reviewer toolbelt
The engines and structural indexes are capabilities of the reviewer, not the
reviewed repository: install them beside Leveret. Full belt: codegraph,
semgrep, gitleaks, shellcheck, ruff, actionlint, zizmor,
osv-scanner, typos, jscpd, ast-grep, lizard, and a pre-staged Serena
LSP bundle for semantic navigation. From a clone, build one with
node dist/runner/prefetch-serena.js --bundle /opt/leveret/serena-bundle and run
with LEVERET_SERENA_BUNDLE set to that path (the installed package also exposes
leveret-prefetch-serena). Runtime downloads are refused.
Before autonomous model work, Leveret builds and validates exact-checkout
CodeGraph index, then warms one Serena symbol query per
detected packaged language. Missing indexes fail closed by default; set
LEVERET_REQUIRE_INDEXES=0 only for an explicitly degraded run.
Optional Java reference evidence requires the installed Inspect distribution,
cache-only artifacts, Linux Bubblewrap and prlimit, and paired
LEVERET_INSPECT_JAVA_CONFIG / LEVERET_INSPECT_JAVA_CONFIG_SHA256 host values.
It supports one Java module with main/test sources, distinguishes exact
overloads and method-reference expressions, and reports unresolved or skipped
scope separately. A complete response is not proof a change is safe.
See Inspect's supported host and configuration.
npm test # integration suite; exercises the real toolsRepository layout
This is the canonical Leveret monorepo. Inspect is Leveret's JVM inspection module; it retains an independent Gradle build:
Path | Component | Toolchain |
repository root ( | Leveret: engine, MCP server, runner, GitHub App | Node.js, TypeScript, npm |
Inspect: Java classpath and checked method-reference evidence for Leveret | JDK 25+, Gradle wrapper |
With a hash-pinned host configuration outside the reviewed checkout, the TypeScript reviewer calls Inspect's isolated JVM worker for exact Java method references outside a pinned diff. Without it, the capability is reported unavailable; structural matches do not become checked calls. Inspect has no separate service or product lifecycle. Its original private history and research are not imported into this public monorepo.
Command | Runs |
| TypeScript build / test suite (Leveret) |
|
|
| Both components, TypeScript first |
The JVM build requires JDK 25 or newer. build:inspect and build:all also run the
JVM tests, including Linux-only classpath oracles requiring Bubblewrap, Git, Maven,
JDK 21, and network access for cold fixture caches. See
Inspect build prerequisites. Inspect can also be built from
inspect/ with ./gradlew build.
Once per clone, run sh scripts/setup-hooks.sh from the repository root to bootstrap
CodeGraph and configure Worktrunk. Inspect has no separate setup.
Design and status
DESIGN.md holds the architecture and decisions: the three-grade filter, memory and learnings, runner standardization, the GitHub App split, and the validation benchmark that gates replacing a hosted review bot with Leveret.
License
Available Tools
5 toolsast_searchA
Structural code search via ast-grep: match a syntax-aware pattern (metavariables like $X, $$$ARGS) instead of text. Use for 'every call site shaped like this' questions a text grep gets wrong. Returns file/line/matched text.
Inputs: lang (required), repo (required), pattern (required), paths.
contextA
Prioritization context for reviewing a change — NOT findings: per-function cyclomatic complexity (lizard, multi-language), 12-month git churn, and last-touched date per file. High complexity in a high-churn file deserves the deepest review; use this to decide where to dig before reading code.
Inputs: repo (required), files (required).
memoryA
List the repo's review-memory entries (fingerprint, grade, reason, created, lastApplied). Use lastApplied to spot dead pricing worth deleting, and repeated same-rule entries under one subtree as candidates for promotion to a glob memory or a .leveret.yml profile rule.
Inputs: repo (required).
rememberA
Persist a graded verdict to the repo's review memory (.leveret/memory.jsonl) so the finding class never re-surfaces ungraded. Grades: priced-noise (true but the repo prices fixing it at zero) or false-positive (the claim is wrong). Only drops are stored — actionable findings are reported, not remembered. Give anchorFile + anchorLine to pin an instance verdict to its source line: the memory dies when that line changes. Omit the anchor for a class-wide verdict (fp may use a glob).
Inputs: fp (required), repo (required), grade (required), reason (required), +3 more.
scanA
Run the applicable static-analysis engines (semgrep security rules, gitleaks secrets, shellcheck, ruff, actionlint) over a change set and return normalized findings. Findings are review LEADS, not verdicts: validate each against current code. Give either base (git ref; scans base...HEAD changed files, secrets over base..HEAD commits) or an explicit files list (repo-relative). A .leveret.yml profile in the repo (or profilePath) scopes engines by path and suppresses priced rules; suppressions come back tallied with their reasons, never silently.
Inputs: repo (required), base, files, engines, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool serves a distinct function: context for prioritization, scan for finding issues, ast_search for syntactic search, remember for storing verdicts, and memory for listing stored verdicts. There is no overlap or ambiguity in their purposes.
Tool names are concise and lowercase, but ast_search uses an underscore while others are single words. This is a minor deviation, but the naming style is otherwise consistent and intuitive.
With 5 tools, the server is well-scoped for a code review assistant. Each tool covers a necessary step in the workflow without redundancy, and the count is neither too sparse nor excessive.
The tools cover the core review lifecycle: contextual prioritization, scanning, code search, verdict memory, and memory inspection. Minor gaps exist (e.g., no explicit update/delete for memory entries), but the surface is otherwise complete and functional.
Maintenance
Related MCP Connectors
Shared context for your codebase: a hosted code knowledge graph over MCP. Free plan, OAuth sign-up.
IaC, CI and dependency security review for coding agents: local scan CLI plus hosted OAuth MCP.
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
Related MCP Servers
- AlicenseAqualityCmaintenanceLocal-first code intelligence MCP server with hybrid BM25 + ONNX vector search, symbol-level impact analysis, diff-aware PR review with risk scoring, and persistent memory tied to git state.36383 npm82MIT
- AlicenseNot gradedqualityDmaintenanceSelf-hosted MCP server for indexing and searching code repositories via hybrid search and deep code understanding.19MIT
- AlicenseNot gradedqualityCmaintenanceOpen-source AI code review MCP server for local git diff auditing with deterministic security rules and AI-powered analysis using any OpenAI-compatible model.4MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for automated code review using AI agents. It analyzes code diffs or file paths for bugs, security issues, and style violations.MIT