recovering-from-failures
Skill4 starsChanged 3 months agoApache-2.0View on GitHub
Named recovery procedures for the 8 framework failure classes — HOOK_BLOCK, QUALITY_GATE_FAIL, CAPTURE_PIPELINE_ERROR, REVIEW_PENDING, EDUCATION_DEFERRED, SESSION_STATE_LOST, COMMIT_HOOK_FAIL, PUSH_BLOCKED. Use when any of these occurs — a PreToolUse hook rejects a Write/Edit, the quality gate or a commit is blocked, a capture script fails, a push to main is blocked, or session state is lost after compaction.
- Reads credentials
- Commits and pushes
In this repository25 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- adr-writingSkill
- authoring-goal-contractsSkill
- collaborating-asyncSkill
- committing-changesSkill
- cross-agent-dispatchSkill
- documenting-decisionsSkill
- feature-status-registrySkill
- grill-meSkill
- grill-yourselfSkill
- handling-micro-fixesSkill
- multi-instance-dispatchSkill
- notifying-the-developerSkill
- orchestrating-goal-loopsSkill
- orchestrating-lean-dispatchSkill
- performance-playbookSkill
- python-project-patternsSkill
- running-build-checkpointsSkill
- searching-prior-artSkill
- security-checklistSkill
- selecting-review-gatesSkill
- severity-calibrationSkill
- syncing-framework-docsSkill
- testing-playbookSkill
- wrapping-up-sessionsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
27 rules. About 0 are common, 15 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Read the hook output — it states the specific reason (protected file, secret pattern, or lock conflict)
- Distinctive: line 24
If secret detected: remove the secret from content, use environment variables instead
- Distinctive: line 25
If protected file: this is intentional — do not attempt to bypass
- Distinctive: line 26
If lock conflict: wait 120s for auto-expiry, or check if another agent operation is in progress
- Distinctive: line 28
Escalation: If the hook blocks after fixing the stated cause, report to developer — the hook regex may be over-matching
- Very specific: line 35
Run python scripts/quality_gate.py --fix to auto-remediate formatting and lint
- Distinctive: line 36
If tests fail: read the test output, fix the code, re-run
- Distinctive: line 37
If coverage low: add tests for uncovered paths
- Very specific: line 38
If review missing: run /review before committing
- Distinctive: line 40
Escalation: If the same check fails after 2 fix attempts, stop and diagnose — the fix may be addressing a symptom, not the root cause
- Distinctive: line 47
Check the error message for the specific script and cause
- Very specific: line 48
If discussion not found: verify the ID matches an existing directory in discussions/
- Distinctive: line 49
If database locked: wait and retry — another script may be writing
- Distinctive: line 50
If discussion already closed: you cannot write events to a closed discussion — this is by design
- Very specific: line 52
Escalation: If SQLite errors persist, check metrics/evaluation.db integrity with python -c "import sqlite3.
- Distinctive: line 59
Stop — do not commit
- Very specific: line 60
Run /review on the changed files
- Distinctive: line 74
Escalation: If the same education gate is deferred twice consecutively, flag in the next retro as a pattern
- Distinctive: line 81
Check git log --oneline -10 for recent commit messages — they describe completed work
- Very specific: line 82
Check discussions/ for the most recent open discussion
- Very specific: line 83
Check docs/reviews/ for the most recent review report
- Distinctive: line 86
Escalation: If no artifacts exist to reconstruct from, ask the developer what was in progress
- Very specific: line 93
Run python scripts/quality_gate.py --fix to fix formatting and lint
- Very specific: line 94
Run python scripts/quality_gate.py to verify all checks pass
- Very specific: line 97
Escalation: If the hook blocks after the quality gate passes cleanly, check whether the cache file (.quality_gate_cache) has a valid …
- Very specific: line 104
Create a feature branch: git checkout -b feature/<description>
- Very specific: line 106
Create a PR via gh pr create
≈ “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
Failure Taxonomy
Named failure classes with recovery steps and escalation paths. Replaces tribal knowledge with a single reference for what can break and what to do about it. Inspired by Claw Code's structured failure taxonomy (ideas-only, ANALYSIS-20260407-002600-claw-code).
Why This Exists
Unnamed failures collapse to "something went wrong." You can't build recovery habits, agent retry logic, or retrospective analysis on unnamed failures. This taxonomy gives every known failure mode a name, a recovery path, and an escalation point.
Failure Classes
HOOK_BLOCK
What: A PreToolUse hook rejects a Write/Edit operation. Common causes: File is protected (.env, .git/, evaluation.db, settings.json), secret pattern detected in content, file lock held by another operation. Recovery:
- Read the hook output — it states the specific reason (protected file, secret pattern, or lock conflict)
- If secret detected: remove the secret from content, use environment variables instead
- If protected file: this is intentional — do not attempt to bypass
- If lock conflict: wait 120s for auto-expiry, or check if another agent operation is in progress Max retries: 1 (after fixing the content) Escalation: If the hook blocks after fixing the stated cause, report to developer — the hook regex may be over-matching
QUALITY_GATE_FAIL
What: python scripts/quality_gate.py exits non-zero.
Common causes: Formatting (ruff), lint errors, test failures, coverage below 80%, missing ADR, missing review report.
Recovery:
- Run
python scripts/quality_gate.py --fixto auto-remediate formatting and lint - If tests fail: read the test output, fix the code, re-run
- If coverage low: add tests for uncovered paths
- If review missing: run
/reviewbefore committing Max retries: 2 (with fixes between each) Escalation: If the same check fails after 2 fix attempts, stop and diagnose — the fix may be addressing a symptom, not the root cause
CAPTURE_PIPELINE_ERROR
What: A capture script (create_discussion.py, write_event.py, close_discussion.py, ingest_events.py) fails. Common causes: Discussion ID not found, SQLite database locked, malformed event data, discussion already closed. Recovery:
- Check the error message for the specific script and cause
- If discussion not found: verify the ID matches an existing directory in
discussions/ - If database locked: wait and retry — another script may be writing
- If discussion already closed: you cannot write events to a closed discussion — this is by design
Max retries: 1
Escalation: If SQLite errors persist, check
metrics/evaluation.dbintegrity withpython -c "import sqlite3; sqlite3.connect('metrics/evaluation.db').execute('PRAGMA integrity_check').fetchone()"
REVIEW_PENDING
What: Code changes exist but no /review has been run before commit.
Common causes: Developer or agent forgot the review step, or the change was incorrectly classified as docs-only.
Recovery:
- Stop — do not commit
- Run
/reviewon the changed files - Address any blocking findings
- Then proceed with commit Max retries: N/A — this is a process gate, not a retryable error Escalation: None — this is always recoverable by running the review
EDUCATION_DEFERRED
What: An education gate (walkthrough + quiz) was required but deferred by the developer. Common causes: Time pressure, low-risk assessment, developer already familiar with the code. Recovery:
- Log the deferral in the retro (automatic via capture pipeline)
- The deferred gate must be completed before the next phase begins, or formally re-deferred with documented rationale (Principle #5) Max retries: N/A — deferral is a deliberate choice, not an error Escalation: If the same education gate is deferred twice consecutively, flag in the next retro as a pattern
SESSION_STATE_LOST
What: BUILD_STATUS.md is stale or missing after compaction, causing the agent to lose context about in-progress work. Common causes: Pre-compact hook didn't fire, agent didn't update BUILD_STATUS.md before compaction, file was accidentally overwritten. Recovery:
- Check
git log --oneline -10for recent commit messages — they describe completed work - Check
discussions/for the most recent open discussion - Check
docs/reviews/for the most recent review report - Reconstruct the current state from these sources and update BUILD_STATUS.md Max retries: N/A — this is a reconstruction task Escalation: If no artifacts exist to reconstruct from, ask the developer what was in progress
COMMIT_HOOK_FAIL
What: The git pre-commit hook blocks a commit. Common causes: Quality gate check failed (formatting, lint, tests, coverage), or the 5-minute verification cache is stale. Recovery:
- Run
python scripts/quality_gate.py --fixto fix formatting and lint - Run
python scripts/quality_gate.pyto verify all checks pass - Re-attempt the commit (the cache will be fresh)
Max retries: 2
Escalation: If the hook blocks after the quality gate passes cleanly, check whether the cache file (
.quality_gate_cache) has a valid timestamp
PUSH_BLOCKED
What: The pre-push hook blocks a push to main/master. Common causes: Attempting to push directly to the main branch instead of using a feature branch and PR. Recovery:
- Create a feature branch:
git checkout -b feature/<description> - Push the feature branch:
git push -u origin feature/<description> - Create a PR via
gh pr createMax retries: N/A — this is a workflow correction, not a retry Escalation: None — the hook is working as intended
Cross-Reference: Claw Code Operational Failures
The following failure modes were documented in Claw Code's ROADMAP (22 items from autonomous development dogfooding). Entries marked with [RELEVANT] have analogues in our framework. Entries marked with [NOT APPLICABLE] address problems specific to their persistent CLI architecture.
Relevant to Our Framework
- Session state ambiguity (their item #20): "working vs blocked vs finished vs truly stale" — maps to our SESSION_STATE_LOST. Their solution: machine-derived state classification. Our mitigation: BUILD_STATUS.md with incremental summary merging.
- Opaque failure surfaces (their item #22): Generic error messages that hide whether the fault was auth, session corruption, command dispatch, or runtime panic. Maps to our need for named failure classes (this taxonomy).
- Stale-branch noise masking real regressions (their item #7): Before running broad tests, check if the branch is behind main. We don't have multi-branch parallel work yet, but this is worth noting if we move toward parallel build lanes.
- Recovery loops too manual (their pain point #4): "restart worker, accept trust prompt, re-inject prompt, detect stale branch, retry failed startup, classify infra vs code failures manually." Maps to our recovery steps being tribal knowledge — now addressed by this taxonomy.
- Truth split across layers (their pain point #2): State distributed across tmux, event streams, git, tests, and plugin runtime. Analogous to our state split across BUILD_STATUS.md, discussions/, metrics/, and git — which is why we have the four-layer capture stack.
Not Applicable to Our Framework
- Worker boot fragility (trust prompts, shell misdelivery) — specific to persistent CLI session management
- Plugin/MCP lifecycle failures — we don't manage MCP servers
- Branch lock collisions — we use sequential workflow, not parallel lanes
- Prompt misdelivery detection — our agents receive prompts via Task(), not terminal injection
- Lane event schema — specific to their multi-lane orchestration model
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.

