debug

debug is a command for coding agents from MadAppGang/magus. It costs 26 tokens per session (2,023 once invoked), scanned A, original, MIT.

Structured debugging — routes to quick patch (inline), standard debug (skill), or production-grade fix (/dev:fix).

Command

Installs and runs on its own, but its text points at files inside the plugin that ships it — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed.

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/madappgang/magus/debug
Clone the repo
git clone --depth 1 https://github.com/MadAppGang/magus

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 debug

README.md
[![agentmods](https://agentmods.dev/badge/commands/madappgang/magus/debug.svg)](https://agentmods.dev/commands/madappgang/magus/debug)
Your own site
<a href="https://agentmods.dev/commands/madappgang/magus/debug"><img src="https://agentmods.dev/badge/commands/madappgang/magus/debug.svg" alt="Measured on agentmods" height="20"></a>
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,023 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown 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.02023
Opus 5 $0.00013 $0.01012
Sonnet 5 $0.00005 $0.00405
Haiku 4.5 $0.00003 $0.00202

Measured today against content hash a6ceda4bba87, 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 today.

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.

plugins/dev/commands/debug.md · 189 lines

How it starts

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

<user_request> $ARGUMENTS </user_request>

<value_banner> Display ONCE at the start of the command:

/dev:debug — Structured Debugging Workflow Beyond what Claude does natively, this command adds:

  • 3 depth levels: quick patch / systematic 6-phase debug / production-grade TDD fix
  • Fault localization with stack trace, keyword, and AST strategies
  • Auto-inference detects the right depth from your description
  • Escalation: quick-patch auto-upgrades when complexity grows

For quick debugging, just ask Claude directly. </value_banner>

<critical_override> THIS COMMAND OVERRIDES THE CLAUDE.md TASK ROUTING TABLE FOR AGENT SELECTION.

Routing rules for this command only:

  • Stack detection → dev:stack-detector agent
  • Error analysis → dev:debugger agent (standard debug path only, via skill)
  • Applying fixes → dev:developer agent

QUICK-PATCH: root cause analysis is INLINE (no agent delegation) DO NOT use code-analysis:detective (READ-ONLY agent, not for fixing) </critical_override>

<scope_selection> MANDATORY: Determine debugging scope before starting.

Auto-inference rules (skip the question when any of these match):

  • Stack trace present + single file mentioned → Quick patch
  • Keywords: "production", "critical", "intermittent", "uncertain root cause" → /dev:fix
  • Keywords: "root cause", "investigate first", "systematic" → Standard debug
  • Simple error message with obvious single-location cause → Quick patch
  • --downgrade flag in $ARGUMENTS → Standard debug (bypass all inference)
  • Default (none of the above): Ask user

If auto-inference cannot determine scope, use AskUserQuestion with these options:

  • Quick patch: "Fast: stack trace → inline analysis → patch. Auto-escalates if scope grows."
  • Standard debug: "Thorough: reproduce → localize (3 strategies) → root cause → patch → validate"
  • Production-grade fix: "Full TDD + multimodel review. Run /dev:fix for this depth."

Decision:

  • "Quick patch" → execute the Quick-Patch Workflow below
  • "Standard debug" → load dev:systematic-debugging and follow workflow.md exactly
  • "Production-grade fix" → output: "Scope: Production-grade fix. Run /dev:fix {bug description} for the full TDD + review workflow." then STOP </scope_selection>

<quick_patch_workflow> Execute this workflow inline when scope = Quick patch.

Phase 0: Initialize

  • Follow dev:systematic-debugging → session-setup.md for session setup (prefix: "dev-debug-quickfix")
  • Parse flags from $ARGUMENTS:
    • --review: opt-in multimodel patch quality vote at Phase 4
    • --tdd: write RED test before applying patch
    • --interactive: approval gate before PATCH phase

Phase 1: REPRODUCE

  • Use context from session-setup.md
  • If reproduction steps were provided in $ARGUMENTS, attempt reproduction via Bash
  • Document reproduction result in session

Phase 2: LOCALIZE (Strategy A — stack trace first)

  • If stack trace present: extract file:line with Grep, Read ±20 lines of surrounding context
  • If no stack trace: fall back to keyword search across codebase with Grep
  • Write localization.md to session directory

Escalation check #1: if candidates span > 3 files → offer upgrade to Standard debug

Phase 3: PLAN (inline root cause — no agent delegation)

  • Perform root cause analysis directly in this context
  • Generate: hypothesis, fix approach, files to modify
  • Self-critique checklist:
    • MINIMAL_CHANGE: is the fix as small as possible?
    • ROOT_CAUSE_NOT_SYMPTOM: does this fix the cause, not mask it?
    • REGRESSION_SAFETY: what existing behavior could break?
    • TEST_COVERAGE: is there a test that would catch this?
    • REGRESSION_RISK: LOW / MEDIUM / HIGH
    • COMPETING_HYPOTHESES: YES / NO
  • Write root-cause.md to session directory

Read the full file on GitHub · 189 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. today First seen · 189 lines · 26 tokens per session scan A a6ceda4bba87

Subscribe to this mod's changes

debug is a command published in the GitHub repository MadAppGang/magus (9 stars, last pushed yesterday), licensed MIT. It adds 26 tokens to every session and 2,023 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-09-04.