agent-failure-recovery
Skill3 starsChanged 38 days agoMITView on GitHub
Design bounded retries and durable recovery for AI-agent runs and side effects. Use when handling interrupted agent execution, ambiguous tool commits, partial completion, checkpoints/resume, poison tasks or retry/timeout policy. Do not use for general bug diagnosis, ordinary synchronous exception handling, or session handoff with no runtime recovery problem.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- quokkify/skillstheir own version, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- quokkify/skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- agent-architectureSkill
- agent-cost-and-latencySkill
- agent-development-workflowSkill
- agent-evalsSkill
- agent-guardrailsSkill
- agent-observabilitySkill
- agent-orchestrationSkill
- agent-securitySkill
- agent-state-and-memorySkill
- agent-testingSkill
- deterministic-authoritySkill
- evidence-provenanceSkill
- human-in-the-loopSkill
- prompt-engineeringSkill
- rag-engineeringSkill
- structured-output-designSkill
- tool-designSkill
- tool-evalsSkill
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
- Distinctive: line 12
Start by classifying what is known about the effect.
- Distinctive: line 18
Use circuit breakers for repeated dependency failures where traffic warrants them.
- Distinctive: line 24
When the provider offers no idempotency or reliable status query, do not claim exactly-once.
≈ “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.
Files
Agent Failure Recovery
Start by classifying what is known about the effect. A lost response is not evidence that execution failed. Recovery preserves authorized progress without duplicating irreversible work.
Classify and budget
- Distinguish validation/policy denial (permanent until inputs/authority legitimately change), not-found, version conflict, rate limit, transient dependency failure, cancellation, and unknown side-effect outcome. Keep unknown separate from success and failure.
- Set per-operation and per-run retry ceilings, cumulative deadline, spend and model-call limits. Preserve remaining budgets across restarts. Use exponential backoff with jitter for eligible transient failures, honor bounded retry-after, and avoid synchronized storms. Do not retry authorization/schema failures unchanged or allow infinite model repair loops.
- Use circuit breakers for repeated dependency failures where traffic warrants them; define open/half-open conditions and controlled probes. A tiny process may need only a deadline and retry ceiling. Do not add queues/breakers merely to appear distributed.
Make effects recoverable
- Give each logical operation a stable idempotency key bound to principal/action/canonical arguments. Atomically claim it, retain pending/committed/unknown status and result for a stated retry horizon, and reject conflicting payload reuse. Do not mint a new key after a timeout to force progress.
- Checkpoint durable state and receipts at operation boundaries. Include pending effects, source/state versions and remaining budget. Define crash behavior before claim, after claim, after external commit and before local receipt persistence. Reconcile against a status API or authoritative store before replaying unknown effects.
- When the provider offers no idempotency or reliable status query, do not claim exactly-once. Choose at-most-once dispatch with unresolved/manual review, or acknowledge possible duplicates only if the task policy permits them. Indefinite uncertainty is an escalation/terminal status, not a license to retry.
- Resume by validating checkpoint compatibility, principal/access and current policy. Reuse completed evidence; reauthorize pending actions; recompute stale proposals against fresh state. A restart does not restore expired approval or replenish exhausted budgets.
Handle partial work
- Report completed, pending/unknown, failed and compensated operations separately. Roll back transactional changes where supported. For external effects, define explicit authorized compensating actions; they can fail or need their own approval and are not equivalent to erasing history. Do not attempt unauthorized reversal merely because an earlier step failed.
- Quarantine poison tasks after a bounded number of attempts. Use dead-letter handling when a durable queue already exists; include sanitized cause, provenance, safe redrive requirements and an owner. Re-drive only after a specific cause is corrected and effects reconciled.
Deliver a failure-to-action table, budgets, checkpoint/operation ledger, retry/reconciliation pseudocode, partial-result statuses and crash/restart tests. Verify one committed effect survives a lost response and retry exactly once in an idempotent fake; test permanent denial, expired grant, exhausted budget and failed compensation.
Defect diagnosis belongs to ordinary debugging (or a debugging skill, if available); this skill owns runtime recovery semantics. agent-state-and-memory owns the state representation and tool-design owns the interface contract.
Plan model-boundary degradation
For each boundary define primary path → eligible bounded retry → repair/alternative → supported partial result, human escalation or terminal failure. Distinguish retry (same eligible request), repair (new candidate under the same facts/contract), fallback (different implementation meeting the same acceptance gate), escalation (authorized external judgment) and terminal failure. Cover empty/malformed output, semantic contradiction, invented IDs, refusal, timeout and provider failure. Deterministic fallback is useful only for behavior it reliably specifies; regex guessing is not a semantic fallback. Construct → verify → admit within remaining budgets when valid candidates may exist. Fallback success requires evidence under the original policy; never bypass validation or resend an unknown committed effect for a reassuring result.
Plan input-evidence degradation
Before implementation, define for each required input (file, image, audio, message history, record, retrieved document) what happens when it is missing, unreadable/corrupt (truncated, wrong encoding or type, failed decode, checksum/schema mismatch), stale or contradictory. Detect corruption with deterministic checks—size, type, decode, checksum, schema—before model interpretation; a model's description of an unreadable input is not evidence of its content. Choose an explicit action per case: request or re-fetch the input, use a validated alternate source, return a typed partial result naming the gap, escalate, or fail. Do not fill missing or corrupt evidence with plausible model output. Route contradictory inputs to the declared reconciliation rule (evidence-provenance). Test each case with a fixture and assert the typed status and absence of unsupported fields or effects.
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
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.

