Source profileQuality 79/100

affaan-m/ECC/skills/agent-introspection-debugging/SKILL.md

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports.

Source repository stars
234,327
Declared platforms
0
Static risk flags
0
Last source update
2026-07-27
Source checked
2026-07-28

Decision brief

What it does—and where it fits

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.

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/affaan-m/ECC --skill "skills/agent-introspection-debugging"
    Safe inspection promptEditorial

    Inspect the Agent Skill "agent-introspection-debugging" from https://github.com/affaan-m/ECC/blob/4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38/skills/agent-introspection-debugging/SKILL.md at commit 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      Four-Phase Loop

      Before trying to recover, record the failure precisely.

      error type, message, and stack trace when availablelast meaningful tool call sequencewhat the agent was trying to do
    2. 02

      Phase 1: Failure Capture

      Before trying to recover, record the failure precisely.

      error type, message, and stack trace when availablelast meaningful tool call sequencewhat the agent was trying to do
    3. 03

      Phase 2: Root-Cause Diagnosis

      Match the failure to a known pattern before changing anything.

      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?
    4. 04

      Phase 3: Contained Recovery

      Recover with the smallest action that changes the diagnosis surface.

      stop repeated retries and restate the hypothesistrim low-signal context and keep only the active goal, blockers, and evidencere-check the actual filesystem / branch / process state
    5. 05

      Phase 4: Introspection Report

      End with a report that makes the recovery legible to the next agent or human.

      End with a report that makes the recovery legible to the next agent or human.

    Permission review

    Static risk signals and limitations

    No configured static risk pattern was detected

    This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score79/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars234,327SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    affaan-m/ECC
    Skill path
    skills/agent-introspection-debugging/SKILL.md
    Commit
    4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38
    License
    MIT
    Collected
    2026-07-28
    Default branch
    main
    View the original SKILL.md

    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:

    ## 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.

    PatternLikely CauseCheck
    Maximum tool calls / repeated same commandloop or no-exit observer pathinspect the last N tool calls for repetition
    Context overflow / degraded reasoningunbounded notes, repeated plans, oversized logsinspect recent context for duplication and low-signal bulk
    ECONNREFUSED / timeoutservice unavailable or wrong portverify service health, URL, and port assumptions
    429 / quota exhaustionretry storm or missing backoffcount repeated calls and inspect retry spacing
    file missing after write / stale diffrace, wrong cwd, or branch driftre-check path, cwd, git status, and actual file existence
    tests still failing after “fix”wrong hypothesisisolate 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:

    ## 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.

    ## 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

    Alternatives

    Compare before choosing