Skip to content
Skills Library
AI & agents · Automation

damage-control

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

Licence
MIT
Last repository change
01.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
6
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 01.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

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

Original author 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.

How it works

  1. Overview
  2. When To Use
  3. When NOT to Use
  4. Damage Triage
  5. Risk Assessment Checklist
  6. Module Reference
  7. Integration Pattern
  8. Exit Criteria
Original SKILL.md headings · 126 lines, 560 words
SKILL.md preview
---
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
model_hint: standard
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:

```mermaid
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

```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.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
Files in this package (6)
  • SKILL.md 5 KB
  • modules/context-overflow.md 4 KB
  • modules/crash-recovery.md 4 KB
  • modules/merge-conflict-resolution.md 5 KB
  • modules/risk-assessment-checklist.md 10 KB
  • modules/state-reconciliation.md 5 KB

Versions

The database has no other skills named damage-control.

Database snapshot: 13.11.2026 · package version 21c9f9d6b543 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95agent-workflow
    Plan and improve day-to-day AI coding-agent workflow across Claude Code, Codex, Gemini CLI, and MCP-heavy repos: session startup, context recovery, fast repo loops, runtime verification, worktree use, and multi-agent handoffs. Use when the user wants a practical operating…
  • 100git-worktree
    Use when running /rune:strive with --worktree flag or when work.worktree.enabled is set in talisman. Use when a worker's direct commit fails due to parallel isolation conflicts, when a merge conflict is detected during wave merge (merge broker escalation), or when branches from…
  • 100agent-session-hooks
    Explains how startup scripts run at the start of agent sessions and inject context. Use when an agent session reports a failing hook (e.g. validate-session-branch-name.sh, validate-session-worktree-name.sh, validate-session-commit-signing.sh,…
  • 100context-budget
    Context window management for AI agents. Optimize context usage, prevent overflow, and ensure critical information is always available. Use when working with large codebases or long sessions.
  • 100context-weaving
    Use when spawning 4+ agents, when "Prompt is too long" errors appear, when sessions exceed 50 messages, or when context feels degraded. Prevents overflow before agent summoning, compresses long sessions, and offloads verbose content to filesystem. Keywords: context overflow,…
  • 100worktree-per-agent
    Isolate an agent's work in its own git worktree branched off the default branch, so two agents never land conflicting changes on the shared checkout. Use at the start of any implementation task in a repo where others may also be working, and whenever a repo's instructions say "work in a worktree".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.