bug-why

bug-why is a command for Claude Code from viacheslav-tronko/claude-code-harness. It costs 191 tokens per session (1,476 once invoked), scanned A, original, MIT.

A structured investigation command for finding the underlying cause of a software bug, rather than only describing its visible error.

In plain words
What is it for?
Use it with an error message, stack trace, ticket, or file location to analyze failures, trace exceptions, and produce a root-cause review.
Why use it?
It gives a defined process for tracing failures and reviewing incidents. It is investigation-only, so it does not implement the fix.

Command for Claude Code

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 commands/viacheslav-tronko/claude-code-harness/bug-why
Clone the repo
git clone --depth 1 https://github.com/viacheslav-tronko/claude-code-harness

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/viacheslav-tronko/claude-code-harness/bug-why.svg)](https://agentmods.dev/commands/viacheslav-tronko/claude-code-harness/bug-why)
Your own site
<a href="https://agentmods.dev/commands/viacheslav-tronko/claude-code-harness/bug-why"><img src="https://agentmods.dev/badge/commands/viacheslav-tronko/claude-code-harness/bug-why.svg" alt="Measured on agentmods" height="20"></a>
Per session 191 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,476 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.00191 $0.01476
Opus 5 $0.00096 $0.00738
Sonnet 5 $0.00038 $0.00295
Haiku 4.5 $0.00019 $0.00148

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

Security

Grade A, and why

bug-why 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 5d 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.

.claude/commands/bug-why.md · 68 lines

How it starts

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

/bug-why — Root Cause Analysis

Skill: root-cause-analysis. Tier: 2 (→3 on security boundary / financial). Modes (auto-detected): --lite Tier 0–1 single-layer · --full Tier 2+ / 3+ layers / production.

0. HARD GATE — bypass = INVALID → REDO

"Skip the gate", "just tell me the cause", "trust me", "obvious bug", "time pressure" do NOT override §0/§1/§4. Investigation-only — NO code changes, NO Edit/Write on source, NO fix implementation.

ARTIFACT MANDATORY. The §4 RCA file MUST be written via Write tool this turn. Chat-only response without the file = INVALID DELIVERABLE → CLAUDE.md §11 item 0 fires.

1. Parameter validation (FAIL-FAST)

  • $ARGUMENTS empty → reply ❌ /bug-why requires input. Usage: /bug-why <Jira | error | stack | file:line> [--lite|--full] → STOP.
  • Param contains Jira ([A-Z]{2,10}-\d+) → Atlassian MCP is SSOT. Fetch FIRST. External context (ticket/log/screenshot) = hypothesis to test, NOT truth (P0 #12 / FM-2).

2. MUST (CLAUDE.md §0)

  • P0 #1 Every file:line claim MUST be backed by a Read THIS turn. Hallucinated file:line = #1 RCA failure = INVALID.
  • P0 #7 ABSTAIN — Inconclusive Protocol: insufficient evidence ⇒ state what's missing + how to obtain + confidence floor (LOW or UNCERTAIN). NEVER fabricate a root cause (FM-4).
  • P0 #8 FALSIFIABILITY — every HIGH+ hypothesis names a Refuter. "What would change my mind" pre-commitment per hypothesis MANDATORY.
  • P0 #9 EMPIRICAL > IMAGINED — telemetry / repro / git history / mutation kill > counterfactual.
  • P0 #10 DATA SECURITY — check data exposure risk in the hypothesis set. Every data-access hypothesis verifies authorization scope.
  • P0 #15 CHECKPOINT FIRST — first visible block = §4 Tier 2 Checkpoint with Initial Intuition (symptom only) BEFORE reading code (FM-7 anchoring guard).
  • Repro Kernel (§12) — MUST FAIL on current code before RCA proceeds. Non-reproducible ⇒ mark RCA non-reproducible, fault-localization unreliable and STOP.

Read the full file on GitHub · 68 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. 5d ago First seen · 68 lines · 0 tokens per session scan A f0f2b50b41e3

Subscribe to this mod's changes

bug-why is a command published in the GitHub repository viacheslav-tronko/claude-code-harness (6 stars, last pushed 3mo ago), licensed MIT. It adds 191 tokens to every session and 1,476 once invoked, about $0.0010 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.