culprit

io.github.noordeen123由 GitHub 账号 noordeen123 发布v0.4.0更新于 Oct 24, 2026

Deterministic, offline root-cause analysis and pre-commit fix verification for coding agents.

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

为编码代理提供确定性的离线根因分析,并在提交前验证修复是否完整。

可以做什么
在本地 git 仓库上执行只读分析并返回结构化 JSON。工具包括 analyze 完整根因分析、find_suspects 排序引入缺陷的提交、verify_fix 提交前检查差异、check_completeness 查找未改动的调用点、get_blast_radius 查看依赖与覆盖测试、get_risk_score、get_test_impact、classify_change、get_evolution、get_intent,以及从堆栈跟踪分析的 from_trace。另附命令行工具和可选 HTML 报告。
适用场景
适合代理需要找出缺陷由哪次提交引入、在提交前判断自己的修复是否完整,或评估改动可能影响什么时使用。它是代理自身 git 排查的加速器而非替代品,适用于任何 git 可读取的仓库。
运行要求
以 uvx 从 PyPI 包 culprit 启动的本地进程;MCP 服务器需要 Python 3.10+ 和 uv(命令行工具支持 3.9+)。核心分析无需 API 密钥或网络;可选的 GITHUB_TOKEN 或 GITLAB_TOKEN 可提高 PR 元数据接口限额,示例 CI 工作流使用 GH_TOKEN。
安装前请注意
设计上只读且离线:不会写入仓库或 PR。可选的 GITHUB_TOKEN、GITLAB_TOKEN、GH_TOKEN 属于凭据,应最小化授权范围。可选的 LLM 叙述步骤是非确定性的,启用后可能将数据发送给模型提供方。

安装

在 SourceWeft 中

  1. 打开 控制台中的 culprit,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

culprit

[CI] [PyPI] [Python versions] [License: MIT]

Root-cause analysis for agent-driven development.
Your coding agent finds what introduced a bug, and verifies its own fix is complete before it commits.

Quick start · Tools · Accuracy · Architecture · MCP registry

[An agent's fix scores partial with two missed call sites, then complete after patching them]
A real run. The fix patched one caller of parse_config and missed two, so it scores partial.

Why an agent needs this

An agent can dig through git history to find what broke, and it is good at it. What it will not reliably do is spend a dozen tool calls on that every time, or stop and check whether the helper it just changed has three other callers before it commits. culprit turns both into one deterministic call that returns structured JSON it can act on:

The agent asksculprit answers
"What introduced this bug?"Ranked suspect commits, the author's intent, the releases it shipped in
"Is my fix complete?"verify_fix: missed call sites, whether a test shipped, a risk level
"What could this change break?"Reverse-import dependents, covering tests, high-risk shared modules
  • ⚡️ Instant. No test runs, no bisect. Benchmarked at 41% fewer agent tool calls.
  • 🔒 Read-only and offline. Never writes to your repo or PR. No API key, no network.
  • 🔌 MCP-native. 11 tools over stdio, on the official MCP registry, plus a one-command plugin.
  • 🗣️ Language-agnostic. Suspects work anywhere git does. Blast radius reads 12 language families.

Does it actually work?

Benchmarked against 50 real regressions, 25 from git and 25 from systemd, where the introducing commit is known from each fix's Fixes: trailer (author-verified ground truth). Given only the fix commit, culprit blames the removed lines to rank the commits that introduced the bug.

MetricResult
Introducing commit ranked #150% (25/50)
Introducing commit in the top-5 suspect set66% (33/50)

Deterministic and offline, on large C codebases the engine has never seen. Reproduce with python benchmarks/run.py, which clones the repos and scores every case.

But an agent can run git blame itself

It can, and it is good at it. So the honest question is not whether culprit is accurate, but whether it beats or helps an agent that has git and no culprit. Same 10 regressions, three arms, isolated so no arm can read the answer from the fix commit:

culprit aloneagent aloneagent + culprit
Introducing commit ranked #180%90%90%
Introducing commit in top 590%100%100%
Mean tool calls to get there114.98.8 (-41%)
Mean tokens to get there~055,53447,616 (-14%)

The agent wins on accuracy, and culprit does not make it more accurate. What culprit does is get it there in roughly half the steps for about 8,000 fewer tokens per investigation. Tool calls dropped in 10 of 10 cases, tokens in 7 of 10. On the hardest case the agent needed 42 tool calls and 124k tokens alone, against 16 calls and 84k with culprit.

Those savings are already net of reading culprit's output, which is counted in the third column. culprit's own run is one deterministic call, no model, under a second.

So culprit is an accelerator for an agent, not a replacement for one, and not a smarter blamer than one. Method, caveats (n=10, and this slice is easier than the full 50), and reproduction: benchmarks/agent/.

Quick start

Claude Code plugin (installs the MCP server plus a skill that tells the agent when to use it):

bash
/plugin marketplace add noordeen123/culprit/plugin install culprit@culprit

Any MCP client (Cursor, Windsurf, VS Code, Codex CLI, Zed, Continue, Cline, Amazon Q, Goose):

json
{  "mcpServers": {    "culprit": {      "command": "uvx",      "args": ["--from", "culprit[mcp]", "culprit-mcp"]    }  }}

CLI, no agent required:

bash
uvx culprit                     # run from PyPI on demandrca --verify-fix patch.diff     # exit 0 if complete, 1 otherwise

Needs Python 3.10+ and uv for the MCP server. The CLI runs on 3.9+.

The tools

ToolWhat it answers
analyzeFull RCA in one call: classify, suspects or blast radius, risk, test impact
verify_fixIs this diff safe to commit? complete / partial / risky, plus the missed call sites
find_suspectsRank the commits that introduced the bug
check_completenessCall sites of the changed symbol the fix did not touch
get_intentThe introducing commit's message, linked PR, referenced issues
get_evolutionPer-commit history of the buggy lines via git log -L
get_risk_scoreQA gate score (0 to 100, low/medium/high) with contributing factors
get_blast_radiusFeature impact: dependents, covering tests, high-risk files
get_test_impactMinimal test set to run for this change
classify_changeBugfix vs feature, with evidence
from_traceRCA straight from a stack trace, no diff or PR needed

verify_fix, the pre-commit gate

The agent runs this on its own diff before committing:

  • verdict: complete when no untouched call site is left behind, partial when one was missed, risky when risk is high. The verdict is the completeness axis; test coverage is the separate confidence axis on risk_level.
  • untouched_references: the exact files that still use the changed symbol. This is the list the agent goes and patches.
  • skipped_symbols, adds_test, notes: what was too widely used to check, whether a test shipped, and what to do next.

Loop until complete, then commit. That is the whole idea.

CLI and CI

bash
rca                            # current branch vs the configured baserca --last                     # the latest commit onlyrca --pr 16786                 # a specific PR (uses the PR's own base)rca --trace crash.txt          # RCA from a stack trace, no fix or PR neededrca --verify-fix patch.diff    # check a diff before committingrca --select-tests             # print the tests to run for this changerca --html report.html --open  # a single self-contained HTML reportrca --pr 16889 --fail-on high  # exit non-zero when QA risk is highrca serve --repo /path         # local web UI with a base picker

CI gate: risk via exit code only, no PR comments, no writes. Copy examples/github-actions/culprit-pr.yml into .github/workflows/:

yaml
- run: pip install "culprit>=0.3.0"- env: { GH_TOKEN: "${{ github.token }}" }  run: rca --pr ${{ github.event.pull_request.number }} --fail-on high

HTML report

--html writes one self-contained file. No CDN, opens offline, attaches to CI. It opens with the verdict: a scored QA risk with the factors behind it, and the prime suspect with how long the bug lived.

[QA risk scored medium 48 out of 100 with contributing factors, and the prime suspect commit with the releases it shipped in]

Then it reconstructs how the bug got there. Every commit that touched the buggy line, from creation through the commit that broke it (red, with the exact diff) to the fix (green):

[Line evolution timeline: origin, three modifications, the breaking commit changing w times h to w plus h, then the fix restoring it]

Every node expands to its diff. See the full report.

vs git bisect

git bisectculprit
InputA reliable failing testThe fix diff (or a stack trace)
MethodChecks out commits and runs the testBlames the fix's lines plus git log -L
SpeedMinutes (about log2(N) test runs)Instant
OutputFirst bad commitSuspect set, intent, lifecycle, completeness, risk
ConfidenceProofStrong heuristic

--bisect "<cmd>" runs a real bisect as an optional confirmation layer, in a throwaway git worktree so your checkout is never touched. When the first failing commit matches the blamed suspect, the report stamps it confirmed by git bisect.

Architecture

One normalized context in, one structured JSON result out. The only non-deterministic step is the optional LLM narrative, isolated behind an adapter so the engine runs with no API key.

[Two pipelines. Root cause: input, pr_context, classify, suspect, risk score, output. Verify: proposed diff, verify_fix, verdict.]

Two lanes, one engine. Every module writes one slice of the result, so nothing cares whether the target came from gh, the REST API, local git, or a pasted stack trace. Full module map: docs/ARCHITECTURE.md.

Configuration

The base branch resolves in order: the --base flag, then CULPRIT_BASE, then .culprit.toml (base = "origin/main"), then HEAD~1. --last forces the latest-commit view.

PR titles and labels use the GitHub CLI when present, or the unauthenticated REST API for public repos (set GITHUB_TOKEN or GITLAB_TOKEN to raise limits). Deep links cover GitHub, GitLab, Bitbucket, and Gitea. Blast radius reads imports across JS/TS, Python, Go, Java/Kotlin, Ruby, C/C++, C#, PHP, Rust, Scala, and Swift.

Contributing

bash
pip install -e ".[dev]" && pytest

Module map and data shapes: docs/ARCHITECTURE.md. Publishing the MCP server to the registries: docs/PUBLISHING.md. MIT licensed.

[culprit MCP server]

来源:README.md,提交 5f426e5

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.4.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分