Skip to content
Development
Skill

/damage-control

Recovers broken agent state via crash recovery, context overflow, and merge conflict protocols. Use when an agent session fails or a worktree is corrupted.

From plugin
claude-night-market
343200 skills60 agents162 commands1 MCP

Claude Code

$ npx -y skills add athola/claude-night-market --skill damage-control --agent claude-code

SKILL.md

damage-control.SKILL.md
name: damage-control
description: Recovers broken agent state via crash recovery, context overflow, and merge conflict protocols. Use when an agent session fails or a worktree is corrupted.
alwaysApply: false
category: infrastructure
tags:
- recovery
- resilience
- crash
- context
- conflicts
- state
dependencies:
- error-patterns
provides:
  infrastructure:
  - crash-recovery-protocol
  - context-overflow-protocol
  - merge-conflict-resolution
  - state-reconciliation
  patterns:
  - damage-triage
  - recovery-checkpoints
usage_patterns:
- agent-crash-recovery
- context-limit-handling
- conflict-resolution
- session-state-repair
complexity: intermediate
estimated_tokens: 450
progressive_loading: true
modules:
- modules/crash-recovery.md
- modules/context-overflow.md
- modules/merge-conflict-resolution.md
- modules/state-reconciliation.md
- modules/risk-assessment-checklist.md
role: library

Damage Control

Overview

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.

When To Use

  • An agent process crashed and left files in an unknown state
  • A session hit the context limit and cannot load prior decisions
  • `git merge` or `git rebase` produced conflicts the agent cannot

resolve automatically

  • Observed state (files on disk, task list, git index) disagrees

with expected state

  • A downstream agent reports missing artifacts that should have

been produced upstream

When NOT to Use

  • Proactive risk assessment before work starts (use

`Skill(leyline:risk-classification)` instead)

  • Strategic architectural decisions after a failure (use

`Skill(attune:war-room)` instead)

  • Routine error handling within a single tool call (use

`Skill(leyline:error-patterns)` instead)

Damage Triage

Use this decision tree to route to the correct module:

flowchart 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.

Risk Assessment Checklist

Before executing Level 1+ tasks, complete the risk assessment checklist from `modules/risk-assessment-checklist.md`. Answer these five questions:

1. **What could fail in production?** List specific failure scenarios. 2. **How would we detect it quickly?** Monitoring, alerts, logs. 3. **What is the fastest safe rollback?** Step-by-step procedure. 4. **What dependency could invalidate this plan?** External dependencies. 5. **What assumption is least certain?** Weakest link in the plan.

Required for Level 1 (Watch) and above. See `modules/risk-assessment-checklist.md` for the full template and examples.

Module Reference

  • **crash-recovery.md**: Triage, checkpoint inspection, and

safe resume or rollback after an agent crash.

  • **context-overflow.md**: Procedures for reconstructing

decision context when the window is exhausted.

  • **merge-conflict-resolution.md**: Classification and

resolution strategies for git conflicts, including escalation to human review.

  • **state-reconciliation.md**: Protocol for reconciling

divergent state across task list, git index, and on-disk artifacts.

  • **risk-assessment-checklist.md**: Pre-execution checklist for

Level 1+ tasks.

Integration Pattern

# 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.md

For 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.

Exit Criteria

  • [ ] Agent state is unambiguously known (no unknown partial writes)
  • [ ] Git index is clean or all conflicts are resolved
  • [ ] Task list reflects actual completion status of all tasks
  • [ ] All artifacts expected by downstream agents are present and

verified

  • [ ] If rollback was taken, the rollback is committed and the

reverted scope is documented in the task list

  • [ ] If escalation to human review was required, the escalation

record exists before the session closes

Read more
@athola
Ships withclaude-night-market

A plugin marketplace for Claude Code. Install only the plugins you need to run git workflows, code review, spec-driven development, and autonomous agents from inside your Claude Code session.

343200 skills60 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
343
Star history of athola/claude-night-market on GitHub, a chart by star-history.com

Other skills on claude-night-market.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about damage-control.

Which coding agents can use damage-control?
damage-control installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.