agent-debug-loop

agent-debug-loop is a skill for Claude Code from oyi77/1ai-skills. It costs 50 tokens per session (1,096 once invoked), scanned A, original, MIT.

A step-by-step method for diagnosing an AI agent that is stuck, repeatedly retrying, using tools without progress, or drifting from its task. It captures the situation, identifies likely causes, applies contained recovery, and reports what happened.

In plain words
What is it for?
Use it for repeated tool failures, loop limits, context growth, prompt drift, or mismatches between the expected and actual file or environment state.
Why use it?
Blind retries can waste time and context while leaving the original failure unexplained. This gives the agent a controlled way to investigate before trying again or asking a person for help.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: mentions subagents.

Part of the 1ai-skills plugin — 240 skills, 4 commands shipped together

Good fit Use it for repeated tool failures, loop limits, context growth, prompt drift, or mismatches between the expected and actual file or environment state.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/oyi77/1ai-skills/agent-debug-loop
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.

Any agent
npx skills add oyi77/1ai-skills --skill agent-debug-loop
Clone the repo
git clone --depth 1 https://github.com/oyi77/1ai-skills

Made for: Claude Code.

Or install 1ai-skills, the plugin that ships this one along with the rest of its 240 skills, 4 commands.

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 agent-debug-loop

README.md
[![agentmods](https://agentmods.dev/badge/skills/oyi77/1ai-skills/agent-debug-loop/github.svg)](https://agentmods.dev/skills/oyi77/1ai-skills/agent-debug-loop)
Your own site
<a href="https://agentmods.dev/skills/oyi77/1ai-skills/agent-debug-loop"><img src="https://agentmods.dev/badge/skills/oyi77/1ai-skills/agent-debug-loop/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 agent-debug-loop

Your own site · 80×15
<a href="https://agentmods.dev/skills/oyi77/1ai-skills/agent-debug-loop"><img src="https://agentmods.dev/badge/skills/oyi77/1ai-skills/agent-debug-loop.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,096 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.00050 $0.01096
Opus 5.5 $0.00020 $0.00438
Sonnet 5.5 $0.00010 $0.00219
Haiku 4.5 $0.00005 $0.00110

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

Security

Grade A, and why

agent-debug-loop 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.

agents/agent-debug-loop/SKILL.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.

Agent Debug Loop (Introspection)

Overview

Systematic self-debugging for AI agent failures. Captures state before retrying blindly, diagnoses against known failure patterns, applies contained recovery actions, and produces a structured human-readable report. This is a workflow skill, not a hidden runtime—it teaches the agent to debug itself before escalating to a human.

When to Use

Trigger phrases:

  • "agent loop", "agent stuck", "agent failing", "debug agent"
  • "tool call limit", "context overflow", "repeated retries"

Use directly when:

  • Maximum tool-call / loop-limit failures reached.
  • Repeated retries produce no forward progress.
  • Context growth or prompt drift degrades output quality.
  • File-system or environment state mismatches expectations.
  • Tool failures are likely recoverable via diagnosis + smaller corrective action.

When NOT to Use

  • Feature verification after code changes → use test-agent or verification-loop pattern.
  • Framework-specific bugs where a narrower skill already exists.
  • Runtime promises the current harness cannot enforce automatically.

Anti-Rationalization Table

Rationalization Reality
"I'll just retry the same approach harder." Blind retries burn tokens and worsen context pressure. Capture state first, then change one variable.
"The tool must be broken." Most tool failures are state mismatches (wrong cwd, stale file hash, missing dependency), not tool bugs. Verify assumptions before blaming the tool.
"I can keep everything in memory and figure it out." Agents have no persistent memory across compaction. Write the failure capture to disk (local:// or artifact) so recovery survives context loss.
"One more attempt will fix it." If two identical attempts failed, the third will too. Switch strategy or escalate.

Workflow

Phase 1: Failure Capture

Before recovering, record the failure precisely:

## Failure Capture
- Session / task:
- Goal in progress:
- Error type + message:
- Last successful step:
- Last failed tool / command:
- Repeated pattern seen:
- Context pressure indicators (loop count, token estimate):
- Environment assumptions to verify:

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. 3d ago First seen · 125 lines · 50 tokens per session scan A 647a81ffbe1e

Subscribe to this mod's changes

agent-debug-loop is a skill published in the GitHub repository oyi77/1ai-skills (17 stars, last pushed today), licensed MIT. It adds 50 tokens to every session and 1,096 once invoked, about $0.0002 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-11-04.

Related

agent-debug-loop compared with skills from other repositories

agent-debug-loop next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
agent-debug-loopoyi77/1ai-skillsSkill17todayMITA50Claude Code
adk-debuggoogle/adk-pythonSkill22ktodayApache-2.0A191Claude Code, Codex
rubber-duckkirodotdev/KiroCrewSkill4.8ktodayApache-2.0A161Claude Code, Codex
debug-gatewaykirodotdev/KiroCrewSkill4.8ktodayApache-2.0A63Claude Code, Codex
ai-discoverkirodotdev/KiroCrewSkill4.8ktodayApache-2.0A83Claude Code, Codex
debugging-websocket-issuesAgentWorkforce/relaySkill1.1ktodayApache-2.0A54Claude Code
qa-investigationfugazi/test-automation-skills-agentsSkill26212d agoMITA94Claude Code