leveret
leveret
leveret 是指幼小的野兔——体型小、速度快,出生时眼睛就是睁开的。
leveret 是一个自托管的混合引擎,用于私有代码审查:它是托管式 AI 审查机器人的继任者,适用于代码留在本地的团队。它提供确定性静态分析、AST 级搜索和分级过滤管道,通过 MCP 暴露,由你带来的任何审查代理驱动(BYOM——Claude Code、通过任何支持 MCP 的客户端的本地模型,或 CI 运行器)。引擎层本身从不调用 LLM。
项目所针对的管道:
[diff] → [deterministic first pass: leveret scan] → [review agent: leads → concerns]
→ [verification agent: refute-or-evidence filter] → [report]工具
scan
{repo, base? | files?, engines?, delta?}— 运行适用于变更集的引擎,并返回规范化发现(engine, rule, severity, file, line, message, provenance)以及每个引擎的状态报告。当提供 base 引用时,扫描默认进行增量:已存在于基础树中的发现会被视为预先存在而丢弃(会被计数,但不会静默),幸存者会被标记为introduced。引擎:semgrep(注册表安全 + 各语言规则集)、gitleaks(base..HEAD提交中的密钥)、shellcheck、ruff、actionlint、zizmor(工作流安全)、osv-scanner(锁文件 CVE)、typos(拼写)、jscpd(按配置文件门控的重复检测)、配置文件声明的 semgrep/ast-grep 规则包,以及通过custom:配置文件条目运行的任意 SARIF 输出命令(recipes:psalm taint、hadolint、trivy 等)。发现是审查线索,而非结论。ast_search
{repo, pattern, lang, paths?}— 通过 ast-grep 进行结构化模式匹配(元变量、语法感知),用于文本 grep 会出错的调用点形状问题。context
{repo, files}— 优先级信号,而非发现:每个函数的圈复杂度(lizard)、12 个月变更率、最后修改日期。
Related MCP server: reporelay
运行
npm install && npm run build
node dist/server.js # stdio MCP server
npm test # integration tests (need semgrep, gitleaks, shellcheck, ruff, actionlint, ast-grep on PATH)Claude Code 注册:
claude mcp add leveret -- node /Users/andre/git/leveret/dist/server.js状态 / 路线图
参见 DESIGN.md — 架构、三级过滤器(可操作 / 定价噪声 / 误报)、仓库内记忆存储、代理提示词契约,以及控制采用的验证基准。
许可证
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.
| Name | Required | Description | Default |
|---|---|---|---|
| lang | Yes | language id: php, python, bash, javascript, typescript, ... | |
| repo | Yes | absolute path to the repo to search | |
| paths | No | restrict to these paths (default repo root) | |
| pattern | Yes | ast-grep pattern, e.g. foo($$$ARGS) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden. It discloses key behavior: syntax-aware AST matching via ast-grep, the use of metavariables, and the return format. It could add details about error handling or read-only guarantees, but for a search tool the disclosed behavior and output are useful and unambiguous.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences, each earning its place: first states the core capability, second gives usage guidance, third describes the return value. No repetition of schema details; front-loaded with the most important information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a search tool with 4 params and no output schema, the description is largely complete: it covers what the tool does, when to use it, the mechanism, and the return format. Minor gaps include not addressing invalid patterns or language support nuances, but these are not critical for a search-oriented task.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds meaningful semantics for the pattern parameter by explaining metavariables ($X, $$$ARGS) and providing an example, complementing the schema's terse 'ast-grep pattern' description. Other parameters are adequately covered by the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Structural code search via ast-grep' with specific mechanism ('match a syntax-aware pattern'), resource (code), and output ('Returns file/line/matched text'). It also distinguishes itself from text grep by emphasizing syntax-aware matching with metavariables.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states when to use it: "Use for 'every call site shaped like this' questions a text grep gets wrong," providing clear context. It contrasts with text-based grep, which implies an alternative, though it does not name a specific sibling tool or explicit when-not-to-use cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| repo | Yes | absolute path to the repo | |
| files | Yes | repo-relative files to profile |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so the description must disclose behavior. It clearly explains the data it returns (cyclomatic complexity, git churn, last-touched date) and its multi-language coverage via lizard. It doesn't state side effects, but the read-only nature is strongly implied by the context (profiling for review).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences, front-loaded with the core value proposition and ending with actionable guidance. No redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description sufficiently explains the tool's purpose and output for an agent to use it appropriately. It covers what metrics are returned and how to interpret them (high complexity + high churn → deep review). No formal output schema exists, but the described behavior is complete enough for decision-making.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Both parameters (repo and files) are fully described in the schema (100% coverage). The description adds no additional parameter-specific guidance beyond the schema, so the baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states this tool provides prioritization context (complexity, churn, last-touched) for reviewing a change, explicitly distinguishing it from findings. It is specific about what it computes and names the tool's purpose precisely.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives explicit guidance: 'use this to decide where to dig before reading code' and excludes findings ('NOT findings'). It doesn't name sibling tools as alternatives, but the context for when to use is clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| repo | Yes | absolute path to the reviewed repo |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
There are no annotations, so the description carries the burden of disclosing behavior. It explains the output fields and gives interpretive guidance, but does not mention whether the tool is read-only, if it triggers side effects, or if it requires authentication. For a listing tool, this is adequate but not exhaustive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences long, front-loads the core purpose, and each clause adds value: the first lists fields, the second provides actionable guidance. No filler or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (one parameter, no output schema) and no annotations, the description is complete enough. It explains what the output contains and how to interpret it for maintenance actions. It could mention if it only returns a summary or full details, but the field list implies enough.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema fully describes the single parameter 'repo' with a description, so schema coverage is 100%. The description does not add additional semantic meaning beyond what the schema provides, and since parameter count is only 1, the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists repo review-memory entries and specifies the exact fields (fingerprint, grade, reason, created, lastApplied). It distinctly differentiates from siblings like 'remember' (likely adds entries) and 'context' (likely broader context retrieval) by focusing on listing memory entries with a specific purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It provides usage guidance by describing when to use the lastApplied field to identify dead pricing and repeated entries for promotion, but does not explicitly exclude alternatives or mention when not to use it. Sibling tools are not directly referenced, but the workflow context is clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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).
| Name | Required | Description | Default |
|---|---|---|---|
| fp | Yes | fingerprint: engine/RULE/path-or-glob, e.g. shellcheck/SC2016/tests/** | |
| repo | Yes | absolute path to the reviewed repo | |
| grade | Yes | ||
| author | No | who graded (agent id or human) | |
| reason | Yes | why this class is priced or false — mandatory, auditable | |
| anchorFile | No | repo-relative file for an instance anchor | |
| anchorLine | No | 1-based line the verdict anchors to |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description takes on the burden of behavioral disclosure. It explains that only drops are stored, that anchoring ties the verdict to a specific line, and that the memory entry dies when that line changes. It also clarifies grade semantics, adding value beyond the schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core action and then explains grades and anchoring. It is concise, with each sentence contributing meaningful guidance—no fluff. It could be slightly tighter but is well-organized and readable.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a write operation with 7 parameters and no output schema, the description covers the essential behavioral context: what is stored, when to use anchors, and the side effect of anchor invalidation. It does not describe the return value, which is acceptable for a write operation without an output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is high (86%), so the baseline is 3. The description adds semantic detail to the anchor parameters (pin to source line, memory dies on change) and clarifies grade meanings, going beyond the schema's lean field descriptions. This enriches the agent's understanding of parameter usage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: persisting graded verdicts to a review memory file. It specifies the verb (persist), the resource (.leveret/memory.jsonl), and the effect (prevents re-surfacing ungraded findings). It also distinguishes from siblings by noting only drops are stored and actionable findings are reported, not remembered.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides usage context such as when to use anchors (instance verdict) vs omit (class-wide verdict) and explains that only drops are stored, implying when not to use it for actionable findings. It does not explicitly name alternative tools (like 'memory'), but the context makes the appropriate scenario clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| base | No | git base ref, e.g. origin/devel | |
| repo | Yes | absolute path to the git repo / worktree to scan | |
| files | No | explicit repo-relative files | |
| engines | No | restrict to these engine ids (default: all applicable) | |
| profilePath | No | profile file overriding <repo>/.leveret.yml |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that findings are review leads, not verdicts, and must be validated against current code. It also explains that suppressions are tallied with reasons and never silent, which is valuable behavioral context. However, it does not mention side effects, permissions, or performance characteristics, but the core behavioral traits are well covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and front-loaded: it starts with the core action, lists engines, explains the two modes, and ends with profile behavior. Every sentence adds value, and it is concise without being terse. The length is appropriate for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (multiple engines, two modes, profile handling) and the absence of an output schema, the description does a good job covering the essential context. It explains the change-set scope, the profile mechanism, and the nature of findings. It could mention what the normalized findings look like or how to interpret them, but the description already states they are review leads, which is sufficient for an agent to proceed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already provides 100% coverage with descriptions for all five parameters. The description adds context about the base mode (scans base...HEAD changed files, secrets over base..HEAD commits) and the profilePath override, which enriches the schema. However, since the schema is already thorough, the description's added value is moderate, so a baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool runs multiple static-analysis engines over a change set and returns normalized findings. It specifies the engines (semgrep, gitleaks, shellcheck, ruff, actionlint) and the two modes (base ref or explicit files), distinguishing it from sibling tools like ast_search or context.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly explains when to use the tool (scanning a change set) and provides two usage modes with clear instructions: give either a base git ref or an explicit files list. It also mentions the optional profilePath and how profiles scope engines, giving the agent actionable guidance on invocation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v0.1.0- First observed
ast_search - First observed
context - First observed
memory - First observed
remember - First observed
scan
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
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Security reviews for coding agents: diffs checked against your org policy and live infrastructure.
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
Enterprise code intelligence for M&A, security audits, and tech debt. Hosted server with 200k free.
Related MCP Servers
- AlicenseAqualityAmaintenanceLocal-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.36398 npm82MIT
- AlicenseNot gradedqualityFmaintenanceSelf-hosted MCP server for indexing and searching code repositories via hybrid search and deep code understanding.6 npm18MIT
- 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