crashlens

Logs tell you where your program was. crashlens tells you why it died.
crashlens gives your coding agent a crash investigator. When a test panics, a
service throws or a binary segfaults, the agent hands crashlens the output (or a
core dump) and gets back a bug report: the failing line in your code, why it
failed, and where the bad value was made, often in a different file. The
agent then fixes that, instead of wrapping the crash line in an if.
It reads files only. It never runs your program and needs no SDK.
Quick start for coding agents
Claude Code: install the plugin (a skill plus an MCP server):
/plugin install crashlens --marketplace mingleiw/crashlens
On Claude Code older than 2.1.275, use two steps:
/plugin marketplace add mingleiw/crashlens, then /plugin install crashlens@crashlens.
Any other MCP client (Cursor, Codex, Claude Desktop, Hermes, ...): add the
server. It needs only Node.js 22.19+; the first run builds crashlens, so it takes a minute.
{ "mcpServers": { "crashlens": { "command": "npx", "args": ["-y", "github:mingleiw/crashlens", "mcp"] } } }
From a checkout, use "command": "node", "args": ["/path/to/crashlens/plugin/crashlens.mjs", "mcp"].
Then work as usual. You don't need to mention crashlens: the skill tells the
agent to reach for it whenever something fails with a stack trace, panic,
exception, sanitizer report or core dump.
What your agent gets
Four read-only MCP tools:
| Tool | Use it for | Key arguments |
|---|
analyze_failure | a panic, exception, pytest failure, Sentry event or sanitizer report, as text or a log file | text or path, source_dir |
analyze_core_dump | a Linux native crash | core_path, binary_path, log_path, source_dir |
decompile_function | reading a caller in a stripped binary, to see where a bad pointer was set | binary_path, function |
analyze_crash_folder | a CI artifacts folder or crash directory: groups hundreds of files into distinct bugs, ranked by count, in about a second | dir, binary_path, source_dir |
Passing source_dir (the repository root) is what makes the report useful to
an agent: it adds the failing lines, who last changed them, and the trace of
the bad value back to where it was produced, with named hypotheses (a missing
await, a key that differs in case, a field the producer spells differently,
a config merge that drops a nested key, ...).
The skill (plugin/skills/crashlens/SKILL.md)
then has the agent:
- capture the whole failure (
2>&1, RUST_BACKTRACE=1, pytest -l),
- read the hypotheses and "where the bad value came from" first,
- say in one sentence where the bad value was produced, and fix that code, not
the line that blew up,
- rerun and check the bug's signature is gone.
The skill uses only portable frontmatter, so it also works as a standalone
Agent Skill. No MCP at all? Agents can call the CLI
(<command> 2>&1 | crashlens - --source "$PWD", add --json for fields), and
docs/prompts/crash-triage.md is a copy-paste
prompt that walks any agent with REA connected from a core dump to a root cause.
Text failures need nothing but Node.js. Core dumps also need REA and
REA_PWNTOOLS_PYTHON (see Install).
Why: the crash line is the smoke alarm, not the fire
An orders service crashes in the email code: 'NoneType' object has no attribute 'name'. A comment next to the crash says the customer "can be
missing for guest checkouts". Given only the error, Claude Code fixed it like
this in 12 of 18 runs:
customer = repository.get_customer(order.customer_ref)
+ if customer is None:
+ # Guest checkout or deleted account: there is no address to send a receipt to.
+ log.warning("no customer for order %s; skipping receipt", order.id)
+ return
The crash is gone, and no customer ever gets a receipt again. The real bug is
three files away: the API sends customerId and models.py reads
customer_id. With the same error plus a crashlens report, which traced
customer back to that lookup and said "the lookup found nothing, check the
key before guarding the crash site", 13 of 18 runs fixed models.py.
The report now goes one step further and names the field: customer_ref is
read from data.get("customer_id") at models.py:23, and the project's data
sample has customerId instead. With that, 5 of 5 runs fixed models.py.