Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Recovers broken agent state via crash recovery, context overflow, and merge conflict protocols. Use when an agent session fails or a worktree is corrupted.
.claude/skills/majiayu000-damage-control/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-08 | ✗→✓ | ▲ Improved | -19% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -26% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 87% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 33% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 17% | 0% |
Provides recovery protocols for agents that encounter broken state mid-session. Damage control covers four failure classes: agent crashes with partial work on disk, context window overflow that causes state loss, merge conflicts blocking forward progress, and general session state corruption requiring reconciliation.
The skill does not prevent failures. It defines what to do after one has already happened, so recovery is consistent, auditable, and does not silently discard work.
git merge or git rebase produced conflicts the agent cannotresolve automatically
with expected state
been produced upstream
Skill(leyline:risk-classification) instead)
Skill(attune:war-room) instead)
Skill(leyline:error-patterns) instead)
Use this decision tree to route to the correct module:
mermaidflowchart TD A[Failure detected] --> B{Agent process crashed\nor exited unexpectedly?} B -->|Yes| C[modules/crash-recovery.md] B -->|No| D{Context limit hit or\nprior decisions unavailable?} D -->|Yes| E[modules/context-overflow.md] D -->|No| F{git merge / rebase /\ncherry-pick conflicts?} F -->|Yes| G[modules/merge-conflict-resolution.md] F -->|No| H{State internally inconsistent?\ntask list vs disk vs git index} H -->|Yes| I[modules/state-reconciliation.md] H -->|No| J[No damage-control needed]
When multiple failure types overlap, start with state-reconciliation.md to establish a known baseline, then address the specific failure class.
Before executing Level 1+ tasks, complete the risk assessment checklist from modules/risk-assessment-checklist.md. Answer these five questions:
scenarios
logs
procedure
dependencies
the plan
Required for Level 1 (Watch) and above. See modules/risk-assessment-checklist.md for the full template and examples.
safe resume or rollback after an agent crash.
decision context when the window is exhausted.
resolution strategies for git conflicts, including escalation to human review.
divergent state across task list, git index, and on-disk artifacts.
Level 1+ tasks.
yaml# In your skill's frontmatter dependencies: [leyline:damage-control]
Invoke a specific module when a failure class is identified:
# Crash detected
Skill(leyline:damage-control) → modules/crash-recovery.md
# Context limit reached
Skill(leyline:damage-control) → modules/context-overflow.mdFor orchestrators managing multiple agents, invoke state-reconciliation at session boundaries regardless of whether a failure occurred. This establishes a verified checkpoint before the next work phase begins.
verified
reverted scope is documented in the task list
record exists before the session closes
Other measured skills in the registry, with their headline benchmark lift.