Damage control

From athola/claude-night-market · View interactive version

Damage control is an AI agent skill from the GitHub repository athola/claude-night-market. Recovers broken agent state via crash recovery, context overflow, and merge conflict protocols. Use when an agent session fails or a worktree is corrupted.

How to use this skill

Skill file

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

resolve automatically

with expected state

been produced upstream

When NOT to Use

Skill(leyline:risk-classification) instead)

Skill(attune:war-room) instead)

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.

  1. How would we detect it quickly? Monitoring, alerts,

logs.

  1. What is the fastest safe rollback? Step-by-step

procedure.

  1. What dependency could invalidate this plan? External

dependencies.

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

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.

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

verified

reverted scope is documented in the task list

record exists before the session closes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.