agentleFS
epicsagasepicsagas/epic-harness/skills/agent-introspection/SKILL.md

agent-introspection

Skill20 starsChanged 2 months agoApache-2.0View on GitHub

Loop-breaking self-diagnosis. Use when 3+ consecutive failures occur, circular retries persist, or context overwhelms the session.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    NO UNSUPPORTED SELF-HEALING CLAIMS.

    line 9
  2. Distinctive:

    Stop immediately and record:

    line 21
  3. Distinctive:

    Not recording the failure pattern in memory

    line 85

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  • 3+ consecutive failures on the same task
  • Repeating the same approach with different parameters (loop detection)
  • Context window exceeds 70% without resolution
  • Error messages repeat with no progress
  • User explicitly says "you're stuck" or "try a different approach"

Process

1. Failure Capture

Stop immediately and record:

  • Error type: syntax_error / type_error / test_fail / lint_fail / build_fail / runtime_error / permission_denied / not_found
  • Last 3 tool calls: what was attempted and what failed
  • Context pressure: approximate context usage percentage
  • What changed: what was the last successful state

2. Root Cause Diagnosis

Match against known patterns:

PatternSymptomsRoot Cause
Loop trapSame error 3+ timesWrong approach, not wrong parameters
Context overflowIncreasingly confused responsesToo much information, need compaction
Environment drift"Works locally" failuresMissing env var, different tool version
Cascade failureFix A breaks BUnderlying assumption is wrong
Tool mismatchWrong tool for the jobNeed a different approach entirely

3. Controlled Recovery

Execute ONLY the smallest safe action:

  • Loop trap → Abandon current approach entirely. Try a fundamentally different strategy.
  • Context overflow → Run /compact or summarize current state, then continue.
  • Environment drift → Verify environment with explicit checks (which, --version).
  • Cascade failure → Revert to last known good state. Re-analyze assumptions.
  • Tool mismatch → Switch tools. If Edit fails 3 times, try Write. If Bash fails, try Read first.

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

ExcuseRebuttalWhat 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

  • Failure type classified correctly
  • Root cause matched to known pattern
  • Recovery action is the smallest safe action
  • Introspection report generated
  • Failure pattern recorded in memory

Red Flags

  • Trying the same command more than 3 times with minor variations
  • Claiming "fixed!" without running the actual test
  • Not recording the failure pattern in memory
  • Continuing after 70% context usage without compacting

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.