Skip to main content
Glama

culprit

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

Related MCP server: Task Agent MCP

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.

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 alone

agent alone

agent + culprit

Introducing commit ranked #1

80%

90%

90%

Introducing commit in top 5

90%

100%

100%

Mean tool calls to get there

1

14.9

8.8 (-41%)

Mean tokens to get there

~0

55,534

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

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

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

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.

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.

Available Tools

11 tools
analyzeA

Full RCA in one call: classify -> suspects (bugfix) or blast-radius (feature) -> risk score -> test impact.

Returns the complete structured result. Use the individual tools to drill into specific signals.

Inputs: repo (required), pr, base, head.

check_completenessA

Is the fix complete? Find other references to changed symbols not touched by this fix.

Returns: {symbols: [...], other_call_sites: {...}, untouched_count: int, adds_test: bool, is_revert: bool, notes: [...]}

Inputs: repo (required), base, head.

classify_changeC

Classify whether a change is a bugfix or a feature, with evidence.

Returns: {verdict: "bugfix"|"feature"|"unknown", evidence: [...], signals: {...}}

Inputs: repo (required), base, head.

find_suspectsA

Find the commits most likely to have introduced a bug.

Pass trace_text (a stack trace / crash log) to run RCA from a runtime error with no diff needed. Otherwise diffs base..head to find suspects.

Returns: {suspects: [{hash, short, author, date, subject, pr_number, weight, lines}], origin_on_branch: bool, notes: [...]}

Inputs: repo (required), base, head, trace_text.

from_traceA

RCA from a stack trace or crash log; no diff or PR needed.

Parses the stack trace, blames the crashing lines in git history, and returns the suspect set. Works for Python, JavaScript, Java, and Go stack traces.

Returns: {suspects: [...], frames: [{file, line, func}], skipped_frames: [...], notes: [...]}

Inputs: repo (required), trace_text (required), head.

get_blast_radiusB

Map what a feature change affects: who imports the changed modules, covering tests, high-risk areas.

Returns: {dependents: {...}, covering_tests: [...], high_risk: [...], notes: [...]}

Inputs: repo (required), base, head.

get_evolutionA

git log -L over a line range: every commit that touched those lines, oldest to newest, with per-step diffs.

Returns: {steps: [{hash, short, author, date, subject, diff}], notes: [...]}

Inputs: file (required), repo (required), end_line (required), start_line (required), +1 more.

get_intentB

Commit body + the PR it came from (title, body, url) + linked issues (Fixes/Closes/Resolves #N).

Returns: {body: str, pr: {number, title, body, url} | null, linked_issues: [...]}

Inputs: repo (required), commit_hash (required).

get_risk_scoreB

QA risk score for a change: 0-100 with level (low/medium/high) and contributing factors.

Combines test gap, fix completeness, hotspot recurrence, blast radius, and churn.

Returns: {score: int, level: "low"|"medium"|"high", factors: [{name, detail, points}]}

Inputs: repo (required), pr, base, head.

get_test_impactA

Which existing tests should be run for this change.

Walks the reverse-import graph from changed files to tests that cover them directly or transitively (up to 2 hops).

Returns: {tests: [...], by_test: {test: [reasons]}, notes: [...]}

Inputs: repo (required), base, head.

verify_fixA

Check fix completeness against a raw unified diff before committing.

Runs completeness + test-impact analysis on the proposed diff and returns a verdict. Iterate until verdict == "complete" (no untouched call sites). "complete" covers the root cause but does not imply a test exists - a complete but untested fix comes back at risk_level "medium" with a note, so check risk_level/notes and add the test before committing.

Returns: {verdict: "complete"|"partial"|"risky", symbols_fixed: [...], untouched_references: [...], tests_to_run: [...], adds_test: bool, risk_level: "low"|"medium"|"high", notes: [...]}

Inputs: repo (required), proposed_diff (required), base.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 11 tools

    Disambiguation2/5

    Several tool pairs have overlapping responsibilities: from_trace and find_suspects both take a stack trace and return suspects, verify_fix and check_completeness both assess fix completeness, and get_test_impact/get_blast_radius both surface covering tests. The descriptions are detailed, but an agent could easily select the wrong tool for the same underlying task.

    Naming Consistency3/5

    Most names are lowercase snake_case verb_noun, but the verbs are inconsistent across get_, classify_, find_, check_, verify_, and two tools break the pattern entirely: from_trace and analyze. The naming is readable but not predictable enough to be considered a consistent convention.

    Tool Count4/5

    Eleven tools is within a reasonable range for a change-analysis server, but the set is slightly larger than necessary because some tools duplicate or wrap each other's functionality. It is not bloated, just a bit redundant.

    Completeness5/5

    The tool surface covers the full RCA workflow: classify, identify suspects, map blast radius, compute test impact, score risk, verify completeness, inspect evolution, and read intent. The analyze tool also provides an orchestrated end-to-end path, while individual tools allow drilling into specific signals without obvious dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers