agent-introspection-debugging
Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports.
Best use case
agent-introspection-debugging is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports.
Teams using agent-introspection-debugging should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/agent-introspection-debugging/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How agent-introspection-debugging Compares
| Feature / Agent | agent-introspection-debugging | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
SKILL.md Source
# Agent Introspection Debugging Use this skill when an agent run is failing repeatedly, consuming tokens without progress, looping on the same tools, or drifting away from the intended task. This is a workflow skill, not a hidden runtime. It teaches the agent to debug itself systematically before escalating to a human. ## When to Activate - Maximum tool call / loop-limit failures - Repeated retries with no forward progress - Context growth or prompt drift that starts degrading output quality - File-system or environment state mismatch between expectation and reality - Tool failures that are likely recoverable with diagnosis and a smaller corrective action ## Scope Boundaries Activate this skill for: - capturing failure state before retrying blindly - diagnosing common agent-specific failure patterns - applying contained recovery actions - producing a structured human-readable debug report Do not use this skill as the primary source for: - feature verification after code changes; use `verification-loop` - framework-specific debugging when a narrower ECC skill already exists - runtime promises the current harness cannot enforce automatically ## Four-Phase Loop ### Phase 1: Failure Capture Before trying to recover, record the failure precisely. Capture: - error type, message, and stack trace when available - last meaningful tool call sequence - what the agent was trying to do - current context pressure: repeated prompts, oversized pasted logs, duplicated plans, or runaway notes - current environment assumptions: cwd, branch, relevant service state, expected files Minimum capture template: ```markdown ## Failure Capture - Session / task: - Goal in progress: - Error: - Last successful step: - Last failed tool / command: - Repeated pattern seen: - Environment assumptions to verify: ``` ### Phase 2: Root-Cause Diagnosis Match the failure to a known pattern before changing anything. | Pattern | Likely Cause | Check | | --- | --- | --- | | Maximum tool calls / repeated same command | loop or no-exit observer path | inspect the last N tool calls for repetition | | Context overflow / degraded reasoning | unbounded notes, repeated plans, oversized logs | inspect recent context for duplication and low-signal bulk | | `ECONNREFUSED` / timeout | service unavailable or wrong port | verify service health, URL, and port assumptions | | `429` / quota exhaustion | retry storm or missing backoff | count repeated calls and inspect retry spacing | | file missing after write / stale diff | race, wrong cwd, or branch drift | re-check path, cwd, git status, and actual file existence | | tests still failing after “fix” | wrong hypothesis | isolate the exact failing test and re-derive the bug | Diagnosis questions: - is this a logic failure, state failure, environment failure, or policy failure? - did the agent lose the real objective and start optimizing the wrong subtask? - is the failure deterministic or transient? - what is the smallest reversible action that would validate the diagnosis? ### Phase 3: Contained Recovery Recover with the smallest action that changes the diagnosis surface. Safe recovery actions: - stop repeated retries and restate the hypothesis - trim low-signal context and keep only the active goal, blockers, and evidence - re-check the actual filesystem / branch / process state - narrow the task to one failing command, one file, or one test - switch from speculative reasoning to direct observation - escalate to a human when the failure is high-risk or externally blocked Do not claim unsupported auto-healing actions like “reset agent state” or “update harness config” unless you are actually doing them through real tools in the current environment. Contained recovery checklist: ```markdown ## Recovery Action - Diagnosis chosen: - Smallest action taken: - Why this is safe: - What evidence would prove the fix worked: ``` ### Phase 4: Introspection Report End with a report that makes the recovery legible to the next agent or human. ```markdown ## Agent Self-Debug Report - Session / task: - Failure: - Root cause: - Recovery action: - Result: success | partial | blocked - Token / time burn risk: - Follow-up needed: - Preventive change to encode later: ``` ## Recovery Heuristics Prefer these interventions in order: 1. Restate the real objective in one sentence. 2. Verify the world state instead of trusting memory. 3. Shrink the failing scope. 4. Run one discriminating check. 5. Only then retry. Bad pattern: - retrying the same action three times with slightly different wording Good pattern: - capture failure - classify the pattern - run one direct check - change the plan only if the check supports it ## Integration with ECC - Use `verification-loop` after recovery if code was changed. - Use `continuous-learning-v2` when the failure pattern is worth turning into an instinct or later skill. - Use `council` when the issue is not technical failure but decision ambiguity. - Use `workspace-surface-audit` if the failure came from conflicting local state or repo drift. ## Output Standard When this skill is active, do not end with “I fixed it” alone. Always provide: - the failure pattern - the root-cause hypothesis - the recovery action - the evidence that the situation is now better or still blocked
Related Skills
workspace-surface-audit
Audit the active repo, MCP servers, plugins, connectors, env surfaces, and harness setup, then recommend the highest-value ECC-native skills, hooks, agents, and operator workflows. Use when the user wants help setting up Claude Code or understanding what capabilities are actually available in their environment.
ui-demo
Record polished UI demo videos using Playwright. Use when the user asks to create a demo, walkthrough, screen recording, or tutorial video of a web application. Produces WebM videos with visible cursor, natural pacing, and professional feel.
token-budget-advisor
Offers the user an informed choice about how much response depth to consume before answering. Use this skill when the user explicitly wants to control response length, depth, or token budget. TRIGGER when: "token budget", "token count", "token usage", "token limit", "response length", "answer depth", "short version", "brief answer", "detailed answer", "exhaustive answer", "respuesta corta vs larga", "cuántos tokens", "ahorrar tokens", "responde al 50%", "dame la versión corta", "quiero controlar cuánto usas", or clear variants where the user is explicitly asking to control answer size or depth. DO NOT TRIGGER when: user has already specified a level in the current session (maintain it), the request is clearly a one-word answer, or "token" refers to auth/session/payment tokens rather than response size.
skill-comply
Visualize whether skills, rules, and agent definitions are actually followed — auto-generates scenarios at 3 prompt strictness levels, runs agents, classifies behavioral sequences, and reports compliance rates with full tool call timelines
santa-method
Multi-agent adversarial verification with convergence loop. Two independent review agents must both pass before output ships.
safety-guard
Use this skill to prevent destructive operations when working on production systems or running agents autonomously.
repo-scan
Cross-stack source code asset audit — classifies every file, detects embedded third-party libraries, and delivers actionable four-level verdicts per module with interactive HTML reports.
project-flow-ops
Operate execution flow across GitHub and Linear by triaging issues and pull requests, linking active work, and keeping GitHub public-facing while Linear remains the internal execution layer. Use when the user wants backlog control, PR triage, or GitHub-to-Linear coordination.
product-lens
Use this skill to validate the "why" before building, run product diagnostics, and pressure-test product direction before the request becomes an implementation contract.
openclaw-persona-forge
为 OpenClaw AI Agent 锻造完整的龙虾灵魂方案。根据用户偏好或随机抽卡, 输出身份定位、灵魂描述(SOUL.md)、角色化底线规则、名字和头像生图提示词。 如当前环境提供已审核的生图 skill,可自动生成统一风格头像图片。 当用户需要创建、设计或定制 OpenClaw 龙虾灵魂时使用。 不适用于:微调已有 SOUL.md、非 OpenClaw 平台的角色设计、纯工具型无性格 Agent。 触发词:龙虾灵魂、虾魂、OpenClaw 灵魂、养虾灵魂、龙虾角色、龙虾定位、 龙虾剧本杀角色、龙虾游戏角色、龙虾 NPC、龙虾性格、龙虾背景故事、 lobster soul、lobster character、抽卡、随机龙虾、龙虾 SOUL、gacha。
manim-video
Build reusable Manim explainers for technical concepts, graphs, system diagrams, and product walkthroughs, then hand off to the wider ECC video stack if needed. Use when the user wants a clean animated explainer rather than a generic talking-head script.
laravel-plugin-discovery
Discover and evaluate Laravel packages via LaraPlugins.io MCP. Use when the user wants to find plugins, check package health, or assess Laravel/PHP compatibility.