self-healing-fallbacks
Skill1 starsChanged 5 months agoApache-2.0View on GitHub
Use when an AI workflow has to survive a model that fails, stalls, or answers with low confidence instead of shipping a confident wrong answer - when they say "what happens when the model is down", "it gave a fluent wrong answer", "the API timed out and the whole thing broke", "a pilot user hit a dead end and stopped trusting it", "we need a fallback", "it should never guess on a dose/allergen/threshold", or an agent looped and burned tokens at 3am. Produces a fallback map for each critical path (trigger, fallback behaviour, escalation) and the confidence thresholds that fire them. Invoke after eval-and-safety-harness, with design-the-mva.
In this repository27 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/ai-native-os.mdcCursor rule
- agentic-build-loopSkill
- ai-assisted-salesSkill
- apply-ai-native-modelsSkill
- architect-before-codeSkill
- capture-learningSkill
- cognitive-architecture-reviewSkill
- compliance-readinessSkill
- customer-discovery-that-doesnt-lieSkill
- design-a-loopSkill
- design-the-mvaSkill
- eval-and-safety-harnessSkill
- frame-the-hypothesisSkill
- gateway-agent-opsSkill
- geo-contentSkill
- hypothesis-miningSkill
- map-the-terrainSkill
- measure-ai-native-pmfSkill
- moat-strategySkill
- pay-down-agentic-debtSkill
- red-team-the-agentSkill
- secure-the-connectorsSkill
- share-of-model-auditSkill
- start-hereSkill
- write-the-claude-mdSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
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 43
Every retry and reroute gets a max-iteration cap, a wall-clock timeout, and a budget ceiling, set tight before you ship.
- Distinctive: line 54
No silent failure. The fallback must make wrong loud: a flag, a log, an escalation.
- Distinctive: line 55
No infinite retry. Self-healing without a cap is a runaway agent in a costume.
- Distinctive: line 56
Never let the model guess fluently under low confidence on an irreversible path.
≈ “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
Self-Healing Fallbacks
Your workflow sits behind an API, and that API will sometimes be slow, down, or wrong. The failure that quietly kills pilots is not a crash; it is a confident wrong answer, or a dead end a user hits twice before going back to doing the job by hand. You did not lose them on capability. You lost them on reliability. Self-healing without a hard limit is just an infinite loop in a nicer coat, so the discipline is to retry within bounds, reroute within bounds, then fall to a fixed, boring, non-AI path that cannot guess fluently on a dose, an allergen, or anything irreversible.
The method
Map each critical path to a pattern, size what to automate, set the threshold that fires the floor. Full framework: references/fallback-patterns.md. Source: Handbook Chapter 09.
Step 1: List the critical paths and their reversibility
For each path the workflow depends on, write what it touches and whether a wrong answer can be undone. Reversibility, not value, decides how hard the fallback must be.
| Path touches | Reversibility | Fallback hardness |
| A screenshot, a draft, a suggestion | Fully reversible | Retry, then best-effort, log it |
| A stored record, an outbound message | Partly reversible | Retry, reroute, then conservative default |
| A dose, an allergen, a threshold, a trade, a release | Irreversible | No guess ever: deterministic floor + named human |
Step 2: Choose the pattern per path
Pick from the catalogue by risk and reversibility. The full decision table is in references.
| Pattern | Fires when | Behaviour |
| Retry-with-backoff | Transient failure (timeout, 429, overload) | Retry N times, widening gaps, then escalate |
| Confidence-gated fallback | Model confidence below threshold | Stop, drop to the floor, do not answer |
| Deterministic floor | High-risk path, any uncertainty | Fixed rule or conservative default, no model |
| Cached-last-good | Live call fails, a recent answer exists | Serve the last verified answer, flag it stale |
| Circuit breaker | Repeated failures on a dependency | Stop calling it, fail fast to the floor |
| Human escalation | Floor reached on an irreversible path | Hand to a named human with the context |
Step 3: Set the confidence thresholds
Name the number that fires each gate, and the action below it. Below threshold the system refuses rather than guesses. A model with no floor does not stop on a case it does not understand; it answers anyway, confidently, because that is what it was trained to do.
Step 4: Bound every loop
Every retry and reroute gets a max-iteration cap, a wall-clock timeout, and a budget ceiling, set tight before you ship. Recovery that never gives up does not heal; it burns tokens in a circle until someone notices the bill.
Output
- A fallback map: for each critical path, the trigger, the fallback behaviour, and the escalation target.
- The confidence thresholds: the number that fires each gate and the action below it.
- The loop bounds: max iterations, timeout, and budget cap per recovery path.
- Next: wrap this into the
design-the-mvaspec so the fallback ships with the first agent, not after.
Constraints
- No silent failure. The fallback must make wrong loud: a flag, a log, an escalation. A confident wrong answer that nobody catches is the recall waiting to happen.
- No infinite retry. Self-healing without a cap is a runaway agent in a costume. Bound every loop before it ships.
- Never let the model guess fluently under low confidence on an irreversible path. Keep a human on the loop where the answer touches a person.
- This is not legal or medical advice. Confirm clinical, food-safety, or financial thresholds with a qualified professional.
- Stay theme-agnostic; the founder supplies the domain, you supply the rigour.
Dictionary
self-healing fallback · deterministic fallback · silent failure · human-on-the-loop · infinite loop
Copy-paste version
For non-coders: paste into any chatbot or no-code builder (Claude.ai, ChatGPT, Lovable, Bolt, v0).
Act as my reliability engineer. My product: [ONE_LINER]. Domain: [DOMAIN]. The job my agent owns:
[AGENT_TASK]. I need it to survive a model that fails, stalls, or is unsure, instead of shipping a
confident wrong answer.
1. List the critical paths and their reversibility. For each, decide fallback hardness: reversible
(screenshot, draft) = retry then best-effort; partly reversible (a stored record, a sent message)
= retry, reroute, conservative default; irreversible (a dose, allergen, threshold, trade) = NO
guess ever, drop to a fixed non-AI answer and a named human.
2. For each path pick a pattern: retry-with-backoff, confidence-gated fallback, deterministic floor,
cached-last-good, circuit breaker, or human escalation. Give the trigger and the exact behaviour.
3. Set the confidence threshold that fires each gate, and what happens below it (refuse, do not guess).
4. Bound every loop: max retries, a timeout, a budget cap. Tell me self-healing with no cap is just an
infinite loop.
Make wrong LOUD: every fallback must flag, log, or escalate, never fail silently.
End with the single highest-risk path I must wire a deterministic floor under first.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.

