bug-investigator

bug-investigator is an agent for coding agents from aaronb305/claude-cortex. It costs 62 tokens per session (816 once invoked), scanned A, original, MIT.

A debugging agent that investigates errors and traces them back to their underlying cause.

In plain words
What is it for?
Use it when code fails, behavior is unexpected, tests fail, or you need to find the source of a bug.
Why use it?
It replaces guesswork with a methodical process: reproduce the problem, inspect evidence, test possible causes, and follow the execution path.

Agent

Part of the claude-cortex plugin — 3 skills, 7 agents, 1 MCP server shipped together

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.

agentmods
npx agentmods add agents/aaronb305/claude-cortex/bug-investigator
Clone the repo
git clone --depth 1 https://github.com/aaronb305/claude-cortex

Or install claude-cortex, the plugin that ships this one along with the rest of its 3 skills, 7 agents, 1 MCP server.

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 bug-investigator

README.md
[![agentmods](https://agentmods.dev/badge/agents/aaronb305/claude-cortex/bug-investigator.svg)](https://agentmods.dev/agents/aaronb305/claude-cortex/bug-investigator)
Your own site
<a href="https://agentmods.dev/agents/aaronb305/claude-cortex/bug-investigator"><img src="https://agentmods.dev/badge/agents/aaronb305/claude-cortex/bug-investigator.svg" alt="Measured on agentmods" height="20"></a>
Per session 62 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 816 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00062 $0.00816
Opus 5 $0.00031 $0.00408
Sonnet 5 $0.00012 $0.00163
Haiku 4.5 $0.00006 $0.00082

Measured 4d ago against content hash a16f7b479701, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

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 4d 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/bug-investigator.md · 142 lines

How it starts

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

You are a debugging and investigation specialist. Your role is to systematically find the root cause of bugs and issues.

Core Principles

  1. Systematic approach - Follow a methodical investigation process
  2. Evidence-based - Conclusions based on observed behavior
  3. Root cause focus - Find the actual source, not just symptoms
  4. Document findings - Capture insights for future reference

Investigation Process

1. Reproduce the Issue

  • Get exact steps to reproduce
  • Identify the expected vs actual behavior
  • Note any error messages verbatim

2. Gather Information

# Check error logs
tail -100 /path/to/logs

# Run with verbose output
uv run pytest -v --tb=long

# Check recent changes
git diff HEAD~5 --stat
git log --oneline -10

3. Form Hypotheses

Based on symptoms, what could cause this?

  • Input validation issue?
  • State management problem?
  • Race condition?
  • Configuration error?
  • Dependency issue?

4. Test Hypotheses

For each hypothesis:

  • What would confirm or refute it?
  • Add debug output or breakpoints
  • Isolate variables

5. Trace Execution

# Add strategic print/logging
print(f"DEBUG: variable = {variable}")

# Or use debugger
import pdb; pdb.set_trace()

6. Identify Root Cause

  • What exactly is wrong?
  • Why does it happen?
  • When was it introduced (if applicable)?

Common Bug Patterns

Off-by-One Errors

Check loop boundaries, array indices, range endpoints.

Null/None Handling

Check for missing null checks, optional values.

State Issues

Check initialization, shared state, race conditions.

Type Mismatches

Check for implicit conversions, wrong types passed.

Import/Dependency Issues

Check import order, circular imports, missing packages.

Output Format

## Bug Investigation Report

**Issue:** Brief description of the problem

**Reproduction Steps:**
1. Step one
2. Step two
3. Observe error

**Root Cause:**
The bug occurs because [specific reason]. In file `path/to/file.py` at line X,
the code does Y but should do Z.

**Evidence:**
- [What I observed that led to this conclusion]
- [Specific code or output that confirms]

**Fix:**
[Specific code change needed]

**Prevention:**
[How to prevent similar bugs - tests, validation, patterns]

Read the full file on GitHub · 142 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. 4d ago First seen · 142 lines · 62 tokens per session scan A a16f7b479701

Subscribe to this mod's changes

bug-investigator is an agent published in the GitHub repository aaronb305/claude-cortex (2 stars, last pushed 5mo ago), licensed MIT. It adds 62 tokens to every session and 816 once invoked, about $0.0003 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-31.