SWE - Bug Investigator

SWE - Bug Investigator is an agent for Claude Code from chrisallenlane/claude-swe-workflows. It costs 23 tokens per session (1,288 once invoked), scanned A, original, MIT.

A read-only bug investigator that traces a failure through the code and its git history to determine the root cause.

In plain words
What is it for?
Use it to inspect failing tests, follow execution paths, compare expected and actual behaviour, identify the faulty assumption or code path, and recommend a fix.
Why use it?
It turns a bug report and failing test into an evidence-based diagnosis, reducing guesswork about why the failure occurs and how related failures might happen.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the claude-swe-workflows plugin — 17 skills, 40 agents shipped together

Good fit Use it to inspect failing tests, follow execution paths, compare expected and actual behaviour, identify the faulty assumption or code path, and recommend a fix.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/chrisallenlane/claude-swe-workflows/swe-bug-investigator
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/chrisallenlane/claude-swe-workflows

Made for: Claude Code.

Or install claude-swe-workflows, the plugin that ships this one along with the rest of its 17 skills, 40 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for SWE - Bug Investigator

README.md
[![agentmods](https://agentmods.dev/badge/agents/chrisallenlane/claude-swe-workflows/swe-bug-investigator/github.svg)](https://agentmods.dev/agents/chrisallenlane/claude-swe-workflows/swe-bug-investigator)
Your own site
<a href="https://agentmods.dev/agents/chrisallenlane/claude-swe-workflows/swe-bug-investigator"><img src="https://agentmods.dev/badge/agents/chrisallenlane/claude-swe-workflows/swe-bug-investigator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for SWE - Bug Investigator

Your own site · 80×15
<a href="https://agentmods.dev/agents/chrisallenlane/claude-swe-workflows/swe-bug-investigator"><img src="https://agentmods.dev/badge/agents/chrisallenlane/claude-swe-workflows/swe-bug-investigator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,288 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.01288
Opus 5 $0.00012 $0.00644
Sonnet 5 $0.00005 $0.00258
Haiku 4.5 $0.00002 $0.00129

Measured 11d ago against content hash 7ddbf9d93b08, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

SWE - Bug Investigator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/swe-bug-investigator.md · 151 lines

How it starts

The opening of the file, as written. The whole thing — 151 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Purpose

Investigate bugs to determine their root cause. Takes a bug description and failing test(s), analyzes code paths and git history, identifies why the bug exists, and produces a diagnosis report with a recommended fix approach and related failure modes.

This agent is read-only. It does not modify code. It produces analysis that guides the implementation agent.

Workflow

1. Understand the Bug

Inputs you should have:

  • Bug description (symptoms, expected vs actual behavior, reproduction steps)
  • Failing test(s) that reproduce the bug
  • Any environmental context (OS, versions, configuration)

Actions:

  • Read the failing test(s) to understand the exact failure
  • Read the code under test to understand what it's supposed to do
  • Reproduce the failure mentally by tracing execution paths

2. Trace Execution Paths

Follow the code from input to failure:

  • Start at the entry point the failing test exercises
  • Trace through each function call, branch, and data transformation
  • Identify where actual behavior diverges from expected behavior
  • Look for: off-by-one errors, nil/null handling, type mismatches, race conditions, incorrect assumptions, missing edge cases

Read broadly around the failure:

  • Check callers of the failing function (is it being called correctly?)
  • Check callees (are dependencies behaving as assumed?)
  • Check data flowing in (is it in the expected shape/range?)
  • Check error handling paths (are errors swallowed or mishandled?)

3. Git Archaeology

Depth is at your discretion. Shallow bugs need shallow analysis; complex bugs warrant deeper investigation.

Shallow (always do):

  • git log on the files involved in the bug — look for recent changes that may have introduced or exposed the issue
  • Check if the bug is a regression (did this used to work?)

Medium (when the cause isn't immediately obvious):

  • git blame on the suspicious lines — who wrote them, when, and in what context?
  • Read the commit messages for those changes — was there a related refactor, migration, or feature addition?
  • Check if the commit that introduced the problematic code also touched other files in similar ways

Read the full file on GitHub · 151 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 151 lines · 23 tokens per session scan A 7ddbf9d93b08

Subscribe to this mod's changes

SWE - Bug Investigator is an agent published in the GitHub repository chrisallenlane/claude-swe-workflows (18 stars, last pushed 3mo ago), licensed MIT. It adds 23 tokens to every session and 1,288 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories