Incident

From shenxingy/Clade · View interactive version

Incident is an AI agent skill from the GitHub repository shenxingy/Clade. Incident response mode — diagnose a production issue, write a postmortem, add follow-up tasks to TODO.md. Use when user says \"/incident [description]\".

How to use this skill

Skill file

Clade for Codex

This workflow runs directly in Codex. Do not launch the claude CLI or

delegate the workflow to Clade's MCP bridge.

Codex compatibility rules:

$clade:incident; a bare $name does not select the installed Clade plugin.

has only CLAUDE.md, treat it as legacy project guidance and read it too.

state). Existing legacy Claude state may be read for migration, but do not

create new vendor-specific state.

$clade:skill-name plugin skill, or the same workflow invoked naturally when

explicit skill invocation is not available.

workflow names a vendor-specific tool. If a capability is unavailable, use

the documented fallback instead of spawning another agent CLI.

containing this SKILL.md; resolve that root before invoking a helper.

Canonical Clade workflow

/incident Skill: Structured Incident Logging

Overview

This skill helps you systematically capture incidents, analyze their root causes, and extract lessons learned to prevent future recurrence.

Workflow

Step 1: Gather Incident Details

If the user provided a description with /incident <description>, use that. Otherwise, ask the user:

Step 2: Perform Root Cause Analysis

Once you have the details, conduct a structured RCA:

Step 3: Write Incident Entry

Create or update .clade/incidents.md with a new entry:

## Incident — {date: YYYY-MM-DD}
**What:** {1-2 sentence symptom - what went wrong}
**Context:** {1-2 sentences - what was being done, what changed}
**Root cause:** {1-2 sentences - why did it happen, which category}
**Fix applied:** {how was it resolved, if immediate fix exists}
**Prevention:** {what should prevent this next time - concrete steps, not vague}

Example:

## Incident — 2026-02-26
**What:** API endpoint returned 500 on startup, database connection string missing from error response.
**Context:** Deploying to production with new secrets management; assumed .env would be loaded from system but it wasn't.
**Root cause:** Secrets loading hook defined in config but never called during server startup. [deploy-gap]
**Fix applied:** Added explicit `await loadSecrets()` call in server init before database connect.
**Prevention:** Add startup checklist: (1) required envvars defined, (2) all config-loading hooks executed, (3) test startup on fresh container.

Agent-caused incidents: extra fields

If the failure came from an agent run (unattended loop, dispatched worker,

cron session) rather than a human-driven edit, the standard entry is not

enough — agent incidents carry delegated authority, so the postmortem must

reconstruct what the agent was allowed to do, not just what it did. Add:

Agent: {which run/worker/session, with its log or evidence-bundle path}

Authority scope: {permissions granted vs. the ones actually exercised}

Tool-call trace: {replayable record — session transcript, hook log, or evidence bundle}

Blast radius: {compute/API spend and external side effects (messages sent, pushes, deploys), not just code damage}

Facts vs. hypotheses: {what the trace proves vs. what is inferred — mark each}

An agent-incident postmortem that names no trace is UNVERIFIED by

construction: an agent's own summary of its run is a claim, not evidence.

Step 4: Extract Corrective Rule (Optional)

If the incident reveals a pattern worth remembering, offer to append a rule to corrections/rules.md:

Format:

- [YYYY-MM-DD] {domain} ({root-cause-category}): {do this} instead of {not this}

Example:

- [2026-02-26] deploy (deploy-gap): Call `loadSecrets()` explicitly in server init — not rely on framework autoload

Ask the user if they want to add the rule. If yes, append it to the file. If no, skip.

Step 5: Confirm and Close

Once the incident entry is written, print:

✓ Incident logged to .clade/incidents.md — [link to timestamp]

If a rule was added:

✓ Corrective rule added to corrections/rules.md

Implementation Notes


User Interaction Model

  1. User runs /incident with optional description: /incident "API timeout during batch job"
  2. If no description, ask for what/context/impact
  3. Conduct RCA together (ask clarifying questions if needed)
  4. Write the incident entry to .clade/incidents.md
  5. Append the prevention work to TODO.md. The entry's Prevention field is

already the follow-up task; a postmortem whose prevention lives only in an

incidents file is a postmortem nobody acts on. One checkbox per preventable

cause, each naming the file or gate that would have caught it. Say so if

there is genuinely nothing to prevent — that is a finding, not an omission.

  1. Offer to extract a rule — get user confirmation before appending
  2. Confirm logging is complete, and name the TODO items you added

Completion Status

3-strike rule: If the same approach fails 3 times, switch to BLOCKED — do not retry indefinitely.

Delivery completion

If this workflow changes files or external state:

repository task.

$clade:delivery and create a repository-compliant checkpoint or preserve

the work when committing is unavailable.

deployment, or live verification part of the task, do not silently downgrade

the result to local-only work.

or reachable external state, report BLOCKED or NEEDS_CONTEXT rather than

appending a "not committed/pushed/deployed" caveat after DONE.

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.