debug

A structured debugging process that records symptoms, evidence, possible causes, attempted fixes, and the final resolution in a file. It requires the actual root cause to be identified before code is changed.

In plain words
What is it for?
Use it to investigate bugs, regressions, or failing tests through evidence gathering, eliminated hypotheses, controlled fix attempts, and verification.
Why use it?
It prevents guesswork and symptom-only patches from replacing an investigation of what really caused the defect or test failure.

Command

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/dwarvesf/dwarves-kit/debug
Clone the repo
git clone --depth 1 https://github.com/dwarvesf/dwarves-kit
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,216 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.00026 $0.02216
Opus 5 $0.00013 $0.01108
Sonnet 5 $0.00005 $0.00443
Haiku 4.5 $0.00003 $0.00222

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

Security

Grade A, and why

debug 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 2d 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.

commands/debug.md · 125 lines

How it starts

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

You are debugging a defect, regression, or test failure. You are not here to guess. Random fixes waste time and create new bugs.

The Iron Law

NO FIX WITHOUT A RECORDED ROOT CAUSE.

You may not edit code to "fix" the bug until the ledger's ## Root cause is filled with the actual cause, traced to its source. A symptom patch is a failure, not a fix.

Before you start: open the ledger

Pick a short <slug> for this bug, sanitized to [a-z0-9-]+ (lowercase, digits, hyphens only; no spaces, no /, no .). Reject anything else; never let a slug contain a path separator.

Write .claude/debug/<slug>.md from this template, and append to it before each action, not after, so a context reset shows what you were about to do:

## Symptoms
(immutable: exactly what was reported, the error text, the failing test name)

## Root cause

## Evidence
(append: timestamp / what you checked / what you found / what it implies)

## Eliminated
(append: each hypothesis you falsified + the evidence that killed it)

## Fix attempts
(append: a count; the 3-fix wall reads this)

## Resolution
(the fix + the verification result)

Leave ## Root cause blank until you have actually found it. While it is blank, the anti-rationalization hook will block any guess-fix "done" claim and send you back here. That is intended.

Escaped-defect marker (SPEC-062). If this defect traces to a SHIPPED spec whose test plan should have caught it, record the indictment so lane telemetry can aggregate test-design quality per spec: bash lib/gate/gate-ledger.sh action <slug> "escaped-from=<spec-slug>". Skip when the defect predates the kit or traces to no spec; never guess the spec.

Phase 0: Build a feedback loop

This is most of the skill. A fast, deterministic, agent-runnable pass/fail signal for the bug is what every later phase consumes: reproduction, bisection, hypothesis tests, and the Phase-4 failing test all just re-run it. Spend disproportionate effort here; with the loop, the bug is mostly found.

Read the full file on GitHub · 125 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. 2d ago First seen · 125 lines · 26 tokens per session scan A ad0c29013378

Subscribe to this mod's changes

debug is a command published in the GitHub repository dwarvesf/dwarves-kit (11 stars, last pushed 2d ago), licensed MIT. It adds 26 tokens to every session and 2,216 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.