Agent introspection

From epicsagas/epic-harness · View interactive version

Agent introspection is an AI agent skill from the GitHub repository epicsagas/epic-harness. Loop-breaking self-diagnosis. Use when 3+ consecutive failures occur, circular retries persist, or context overwhelms the session.

How to use this skill

Skill file

Agent Introspection — Systematic Self-Diagnosis

Iron Law

NO UNSUPPORTED SELF-HEALING CLAIMS. Only assert recovery actions you can actually perform with available tools.

When to Trigger

Process

1. Failure Capture

Stop immediately and record:

2. Root Cause Diagnosis

Match against known patterns:

| Pattern | Symptoms | Root Cause |

|---------|----------|------------|

| Loop trap | Same error 3+ times | Wrong approach, not wrong parameters |

| Context overflow | Increasingly confused responses | Too much information, need compaction |

| Environment drift | "Works locally" failures | Missing env var, different tool version |

| Cascade failure | Fix A breaks B | Underlying assumption is wrong |

| Tool mismatch | Wrong tool for the job | Need a different approach entirely |

3. Controlled Recovery

Execute ONLY the smallest safe action:

4. Introspection Report

Generate a structured report:

## Introspection Report
- **Failure type**: [type]
- **Root cause**: [diagnosis]
- **Recovery action**: [what was done]
- **Confidence**: [high/medium/low]
- **Next step**: [what to do if this happens again]

Save to memory:

epic mem add \
  --title "Self-diagnosis: {error_type} in {file}" \
  --type error \
  --body "Pattern: ...\nRoot cause: ...\nRecovery: ...\n"

Anti-Rationalization

| Excuse | Rebuttal | What to do instead |

|--------|----------|-------------------|

| "One more try might work" | 3 failures means the approach is wrong, not unlucky. | Stop and run the full 4-step introspection process. |

| "I just need to tweak the parameters" | Tweaking a failing approach is not debugging. Step back and reassess. | Abandon the current approach and try a fundamentally different strategy. |

| "I can fix this myself" | Asking for help is not weakness. Escalation saves everyone time. | Escalate to the user with a clear summary of what was tried and what failed. |

| "The error is clear, I know the fix" | You said that 3 times already. Prove it with a different approach. | Run the introspection report and verify the fix with a test before claiming success. |

Evidence Required

Red Flags

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.