agent-introspection

agent-introspection is a skill for Claude Code from epicsagas/epic-harness. It costs 31 tokens per session (902 once invoked), scanned A, original, Apache-2.0.

A self-diagnosis workflow for a coding agent that repeatedly fails, retries the same approach, or becomes overloaded with context.

In plain words
What is it for?
Use it after repeated task failures, circular retries, recurring errors, or when the agent says it is stuck.
Why use it?
It helps identify whether the problem is a repeated loop, excessive context, an environment difference, or another known failure pattern before more retries waste time.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the epic plugin — 27 skills, 6 hooks shipped together

Good fit Use it after repeated task failures, circular retries, recurring errors, or when the agent says it is stuck.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/epicsagas/epic-harness/agent-introspection
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 epicsagas/epic-harness --skill agent-introspection
Clone the repo
git clone --depth 1 https://github.com/epicsagas/epic-harness

Made for: Claude Code.

Or install epic, the plugin that ships this one along with the rest of its 27 skills, 6 hooks.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/epicsagas/epic-harness/agent-introspection/github.svg)](https://agentmods.dev/skills/epicsagas/epic-harness/agent-introspection)
Your own site
<a href="https://agentmods.dev/skills/epicsagas/epic-harness/agent-introspection"><img src="https://agentmods.dev/badge/skills/epicsagas/epic-harness/agent-introspection/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-introspection

Your own site · 80×15
<a href="https://agentmods.dev/skills/epicsagas/epic-harness/agent-introspection"><img src="https://agentmods.dev/badge/skills/epicsagas/epic-harness/agent-introspection.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 902 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00031 $0.00902
Opus 5 $0.00015 $0.00451
Sonnet 5 $0.00006 $0.00180
Haiku 4.5 $0.00003 $0.00090

Measured 9d ago against content hash 2dec29a74b61, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

agent-introspection 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 9d 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.

skills/agent-introspection/SKILL.md · 87 lines

How it starts

The opening of the file, as written. The whole thing — 87 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

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:

  • 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]

Read the full file on GitHub · 87 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. 9d ago First seen · 87 lines · 31 tokens per session scan A 2dec29a74b61

Subscribe to this mod's changes

agent-introspection is a skill published in the GitHub repository epicsagas/epic-harness (18 stars, last pushed today), licensed Apache-2.0. It adds 31 tokens to every session and 902 once invoked, about $0.0002 per session on Opus 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-08-30.

Related

Other skills, from other repositories

opensrc

Fetch dependency source code to give AI agents deeper implementation context. Use when the agent needs to understand how a library works internally, read source code for a package, fetch implementation details for a dependency, or explore how an npm/PyPI/crates.io package is built. Triggers include "fetch source for"…

vercel-labs/opensrc · 103 tokens

lx

Codebase exploration tool that reads many files or whole directories in a single call, with per-file headers, glob include/exclude filters, function/type skeleton extraction (signatures only, no bodies), and head/tail line slicing.

rasros/lx · 48 tokens

pypi-release

This skill should be used when releasing tunacode-cli to PyPI. It keeps the existing local release checks, then hands the actual PyPI upload to a GitHub Actions workflow that uses the repository's PYPIAPITOKEN secret.

alchemiststudiosDOTai/tunacode · 52 tokens

audit-harness

Use when auditing HARNESS.md, pre-commit hooks, pre-push hooks, architecture gates, or CI workflows for tunacode-cli. This skill treats any mismatch, skipped gate, or failing check as a critical failure and requires manual one-by-one execution rather than make targets, batch wrappers, or summary-only audits.

alchemiststudiosDOTai/tunacode · 69 tokens

toxic-senior-reviewer

Code review in the voice of a toxic senior developer — dry sarcasm without profanity, no fluff, no empty praise. Use this skill whenever the user asks for a code review, says "how can I improve this", "what do you think of this code", "take a look at this", "rate this solution", "critique this", "do a code review"…

Osipchuk/agent-skills · 206 tokens

execute-plan

Execute an approved plan step-by-step with a checkpoint after each. Triggers on execute the plan, run the plan, do the steps, implement the plan.

AyushParkara/syntra · 35 tokens