culprit

culprit

Deterministic, offline root-cause analysis for coding agents: find the commit that introduced a bug, and verify a fix is complete before committing.

Category
访问服务器

README

culprit

<!-- mcp-name: io.github.noordeen123/culprit -->

<p align="center"> <a href="https://github.com/noordeen123/culprit/actions/workflows/ci.yml"><img src="https://github.com/noordeen123/culprit/actions/workflows/ci.yml/badge.svg" alt="CI"></a> <a href="https://pypi.org/project/culprit/"><img src="https://img.shields.io/pypi/v/culprit.svg" alt="PyPI"></a> <a href="https://pypi.org/project/culprit/"><img src="https://img.shields.io/pypi/pyversions/culprit.svg" alt="Python versions"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a> </p>

<p align="center"> <b>Root-cause analysis for agent-driven development.</b><br> Your coding agent finds what introduced a bug, and verifies its own fix is complete before it commits. </p>

<p align="center"> <a href="#quick-start">Quick start</a> · <a href="#the-tools">Tools</a> · <a href="#does-it-actually-work">Accuracy</a> · <a href="docs/ARCHITECTURE.md">Architecture</a> · <a href="https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.noordeen123/culprit">MCP registry</a> </p>

<p align="center"> <img src="docs/demo.gif" width="900" alt="An agent's fix scores partial with two missed call sites, then complete after patching them"> <br> <em>A real run. The fix patched one caller of <code>parse_config</code> and missed two, so it scores <code>partial</code>.</em> </p>

Why an agent needs this

An agent is good at writing a patch and bad at knowing whether the patch is done. It cannot see that the helper it just changed has three other callers, or that the bug it is fixing was introduced by a refactor two years ago. culprit answers both from git history, as structured JSON it can act on rather than prose it has to interpret:

The agent asks culprit 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. It blames the fix's own lines back through refactors.
  • 🔒 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.

Metric Result
Introducing commit ranked #1 50% (25/50)
Introducing commit in the top-5 suspect set 66% (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.

Quick start

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

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

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

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

CLI, no agent required:

uvx culprit                     # run from PyPI on demand
rca --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

Tool What it answers
analyze Full RCA in one call: classify, suspects or blast radius, risk, test impact
verify_fix Is this diff safe to commit? complete / partial / risky, plus the missed call sites
find_suspects Rank the commits that introduced the bug
check_completeness Call sites of the changed symbol the fix did not touch
get_intent The introducing commit's message, linked PR, referenced issues
get_evolution Per-commit history of the buggy lines via git log -L
get_risk_score QA gate score (0 to 100, low/medium/high) with contributing factors
get_blast_radius Feature impact: dependents, covering tests, high-risk files
get_test_impact Minimal test set to run for this change
classify_change Bugfix vs feature, with evidence
from_trace RCA 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

rca                            # current branch vs the configured base
rca --last                     # the latest commit only
rca --pr 16786                 # a specific PR (uses the PR's own base)
rca --trace crash.txt          # RCA from a stack trace, no fix or PR needed
rca --verify-fix patch.diff    # check a diff before committing
rca --select-tests             # print the tests to run for this change
rca --html report.html --open  # a single self-contained HTML report
rca --pr 16889 --fail-on high  # exit non-zero when QA risk is high
rca 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/:

- 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.

<p align="center"> <img src="docs/report-verdict.png" width="820" alt="QA risk scored medium 48 out of 100 with contributing factors, and the prime suspect commit with the releases it shipped in"> </p>

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):

<p align="center"> <img src="docs/report-timeline.png" width="820" alt="Line evolution timeline: origin, three modifications, the breaking commit changing w times h to w plus h, then the fix restoring it"> </p>

<p align="center"><em>Every node expands to its diff. <a href="docs/report.png">See the full report</a>.</em></p>

vs git bisect

git bisect culprit
Input A reliable failing test The fix diff (or a stack trace)
Method Checks out commits and runs the test Blames the fix's lines plus git log -L
Speed Minutes (about log2(N) test runs) Instant
Output First bad commit Suspect set, intent, lifecycle, completeness, risk
Confidence Proof Strong 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.

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="docs/workflow-dark.svg"> <img src="docs/workflow-light.svg" width="980" alt="Two pipelines. Root cause: input, pr_context, classify, suspect, risk score, output. Verify: proposed diff, verify_fix, verdict."> </picture> </p>

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

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选