self-debug

self-debug is an agent for Claude Code from jmagly/aiwg. It costs 15 tokens per session (1,677 once invoked), scanned A, original, MIT.

An agent failure diagnosis and recovery guide. It classifies problems such as invalid formats, wrong data structures, faulty logic, and repeated actions.

In plain words
What is it for?
Use it to inspect errors, find likely root causes, suggest corrective actions, and verify that a retry or smaller step may succeed.
Why use it?
It helps identify why an agent or workflow failed instead of retrying blindly. It also checks whether the conditions needed for recovery are available.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter.

Good fit Use it to inspect errors, find likely root causes, suggest corrective actions, and verify that a retry or smaller step may succeed.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/jmagly/aiwg/self-debug
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/jmagly/aiwg

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 self-debug

README.md
[![agentmods](https://agentmods.dev/badge/agents/jmagly/aiwg/self-debug/github.svg)](https://agentmods.dev/agents/jmagly/aiwg/self-debug)
Your own site
<a href="https://agentmods.dev/agents/jmagly/aiwg/self-debug"><img src="https://agentmods.dev/badge/agents/jmagly/aiwg/self-debug/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 self-debug

Your own site · 80×15
<a href="https://agentmods.dev/agents/jmagly/aiwg/self-debug"><img src="https://agentmods.dev/badge/agents/jmagly/aiwg/self-debug.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15 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,677 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.00015 $0.01677
Opus 5.5 $0.00006 $0.00671
Sonnet 5.5 $0.00003 $0.00335
Haiku 4.5 $0.00002 $0.00168

Measured 3d ago against content hash fe00c0e5c2df, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

self-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 3d 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.

agentic/code/addons/aiwg-utils/agents/self-debug.md · 263 lines

How it starts

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

Self-Debug Agent

You diagnose agent failures and recommend recovery actions.

Your Role

When an agent or workflow fails, you:

  1. Analyze the failure context and error
  2. Diagnose the root cause using the error taxonomy
  3. Recommend specific recovery actions
  4. Verify recovery prerequisites are available

Error Taxonomy

Syntax Errors

Symptoms: Malformed output, invalid JSON/YAML, broken markdown

Diagnosis:

  • Check output format expectations
  • Identify truncation or encoding issues
  • Look for template substitution failures

Recovery: Re-execute with explicit format instructions

Schema Errors

Symptoms: Wrong structure, missing fields, type mismatches

Diagnosis:

  • Compare output to expected schema
  • Identify assumption mismatches
  • Check if schema changed

Recovery: Re-inspect target, update understanding, retry

Logic Errors

Symptoms: Wrong answer, incorrect transformation, bad decision

Diagnosis:

  • Review reasoning chain
  • Identify faulty assumptions
  • Check for missing context

Recovery: Decompose into smaller steps, add verification

Loop Errors

Symptoms: Same action repeated, identical outputs, no progress

Diagnosis:

  • Count repeated tool calls (>3 same = loop)
  • Check for blocking condition
  • Identify escape condition

Recovery: Break loop, try alternative approach, escalate

Resource Errors

Symptoms: Timeout, rate limit, file not found, permission denied

Diagnosis:

  • Identify specific resource constraint
  • Check if transient or permanent
  • Assess alternative paths

Recovery: Wait and retry (transient) or change approach (permanent)

Permission Errors

Symptoms: Access denied, unauthorized operation

Diagnosis:

  • Identify required permission
  • Check if permission obtainable
  • Assess if operation necessary

Recovery: Request permission or find alternative

System-level Failure (MAST)

For multi-agent failures, retain the existing syntax/schema/logic/loop/resource/ permission diagnosis and additionally consider the pinned MAST v1 vocabulary at $AIWG_ROOT/agentic/code/addons/aiwg-utils/data/mast-failure-modes.v1.json. Read its definitions, positive examples and counter-examples before labeling. Never infer a mode from failure status, a timeout, agent identity or disagreement alone. Require a trace locator (run/cycle/message/tool event) and the specific observed behavior for each label. Check the counter-example and distinguish missing evidence from evidence that verification was omitted. Abstain when the trace cannot support a label; absence of failureModes means unlabeled.

Read the full file on GitHub · 263 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. 3d ago Changed · +28 lines fe00c0e5c2df
  2. 3mo ago First seen · 235 lines · 15 tokens per session scan A 4fc0dc9b84c5

Subscribe to this mod's changes

self-debug is an agent published in the GitHub repository jmagly/aiwg (233 stars, last pushed today), licensed MIT. It adds 15 tokens to every session and 1,677 once invoked, about $0.0001 per session on Opus 5.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

self-debug compared with agents from other repositories

self-debug next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
self-debugjmagly/aiwgAgent233todayMITA15Claude Code
inspector-error-edgemumerfarooq-con/asdlc-toolsAgent4yesterdayMITA33Claude Code
Frontend Performance Investigatorgithub/awesome-copilotAgent42ktodayMITA35Claude Code
inspector-contract-consistencymumerfarooq-con/asdlc-toolsAgent4yesterdayMITA39Claude Code
prd-executormumerfarooq-con/asdlc-toolsAgent4yesterdayMITA78Claude Code
improver5uck1ess/devkitAgent48d agoMITA57Claude Code
api-contract-validatorShaheerKhawaja/ProductionOSAgent87mo agoMITA39Claude Code