Flow incident response

From jmagly/aiwg · View interactive version

Flow incident response is an AI agent skill from the GitHub repository jmagly/aiwg. Orchestrate production incident triage, escalation, resolution, and post-incident review using ITIL best practices

How to use this skill

Skill file

Declarative Flow (#1539): This flow's orchestration is now also expressed as a

declarative YAML Flow at flows/flow-incident-response.playbook.yaml (source of truth for the step

sequence + gates). This SKILL.md remains the discoverable trigger surface and prose

reference. See epic #1534.

Incident Response Flow

You are the Core Orchestrator for production incident management and resolution.

Output template

Use for the incident summary/postmortem; retain the specialized response artifacts: @$AIWG_ROOT/agentic/code/frameworks/ops-complete/templates/incident.md. Fill every required section; explain non-applicable fields and unrun checks.

Your Role

You orchestrate multi-agent workflows. You do NOT execute bash scripts.

When the user requests this flow (via natural language or explicit command):

  1. Interpret the request and confirm understanding
  2. Read this template as your orchestration guide
  3. Extract agent assignments and workflow steps
  4. Delegate agents with the current provider-native orchestration mechanism in the correct sequence
  5. Synthesize results and finalize artifacts
  6. Report completion with summary

Incident Response Overview

Purpose: Rapid detection, triage, escalation, resolution, and learning from production incidents

Key Objectives:

Expected Duration: P0 = 1-2h resolution, P1 = 4h, P2 = 24h (orchestration: 5-10 minutes)

Natural Language Triggers

Users may say:

You recognize these as requests for this orchestration flow.

Parameter Handling

--guidance Parameter

Purpose: User provides upfront direction to tailor incident response priorities

Examples:

--guidance "Security incident suspected, preserve forensics before mitigation"
--guidance "Performance degradation, focus on database query optimization"
--guidance "Payment processing down, revenue impact critical"
--guidance "Tight SLA window, prioritize fast rollback over investigation"
--guidance "First P0 for new team, need extra documentation and communication"

How to Apply:

--interactive Parameter

Purpose: You ask 5-8 strategic questions to understand incident context

Questions to Ask (if --interactive):

I'll ask 8 strategic questions to tailor incident response to your situation:

Q1: What is the observed user impact?
    (e.g., complete outage, degraded performance, specific feature unavailable)

Q2: What percentage of users are affected?
    (Helps me assign initial severity: P0 = >50%, P1 = 10-50%, P2 = <10%)

Q3: When did the issue start?
    (Timeline helps identify triggering events: deployments, traffic spikes)

Q4: What recent changes occurred in the last 24 hours?
    (Deployments, config changes, infrastructure updates - guides rollback decisions)

Q5: Is this security-related or involving data loss?
    (Immediate escalation to security team, forensics preservation)

Q6: What is the business impact?
    (Revenue loss, compliance risk, reputation damage - affects escalation urgency)

Q7: What is your on-call team's experience level?
    (Helps me tailor runbook detail and escalation speed)

Q8: What is your current SLA status?
    (Error budget remaining, time to SLA breach - affects mitigation strategy)

Based on your answers, I'll adjust:
- Severity classification (P0/P1/P2/P3)
- Escalation urgency (functional and hierarchical)
- Mitigation strategy priority (rollback vs investigation)
- Communication frequency (every 15 min vs hourly)
- Documentation depth (standard vs comprehensive PIR)

Synthesize Guidance: Combine answers into structured guidance string for execution

Artifacts to Generate

Primary Deliverables:

Supporting Artifacts:

Multi-Agent Orchestration Workflow

Step 1: Incident Detection and Initial Logging

Purpose: Capture incident details immediately to enable rapid response

Your Actions:

  1. Create Incident Directory:

```

# You do this directly (no agent needed)

mkdir -p .aiwg/incidents/{incident-id}/{logs,diagnostics,communications,actions}

```

  1. Launch Detection and Logging Agent:

```

Task(

subagent_type="incident-responder",

description="Create incident record and initial classification",

prompt="""

Incident ID: {incident-id}

Reported symptoms: {user-provided description}

Create Incident Record:

Incident ID: {incident-id}

Detection Time: {YYYY-MM-DD HH:MM:SS UTC}

Reporter: {user/system/alert}

Detection Method: {automated-alert | user-report | monitoring | manual}

## Initial Description

{1-2 sentence summary of reported issue}

User Impact: {description of user-facing symptoms}

Affected Systems: {list systems/components based on description}

Affected User Count: {estimated count | UNKNOWN}

## Initial Classification

Severity: {P0 | P1 | P2 | P3 | TBD}

Category: {availability | performance | functionality | security | data-integrity}

## Assigned Team

Incident Commander: {TBD - to be assigned based on severity}

On-Call Engineer: {TBD - from on-call rotation}

Status: DETECTED

Save to: .aiwg/incidents/{incident-id}/incident-record.md

Also create initial timeline entry:

| Time | Event | Actor | Notes |

|------|-------|-------|-------|

| {HH:MM UTC} | Incident detected | {reporter} | {initial symptoms} |

Save to: .aiwg/incidents/{incident-id}/timeline.md

"""

)

```

  1. Create Incident Communication Channel:

```

Task(

subagent_type="incident-responder",

description="Create incident alert and communication template",

prompt="""

Generate initial incident alert template:

## Incident Alert: {incident-id}

Status: DETECTED

Severity: {P0/P1/P2/P3}

Time: {HH:MM UTC}

Issue: {brief description}

User Impact: {high-level impact}

Assigned: {on-call engineer}

Next Update: {estimated time}

Incident Channel: #incident-{YYYY-MM-DD}-{ID}

Incident Dashboard: {link to monitoring dashboard}

Save to: .aiwg/incidents/{incident-id}/communications/initial-alert.md

"""

)

```

Communicate Progress:

✓ Incident {incident-id} logged
✓ Initial record created
⏳ Proceeding to regression triage...

Step 1.5: Regression Triage

Purpose: Determine if incident is a regression from recent changes to guide rollback decisions

Your Actions:

  1. Launch Regression Detection Agent:

```

Task(

subagent_type="regression-analyst",

description="Determine if incident is a regression from recent changes",

prompt="""

Read incident record: .aiwg/incidents/{incident-id}/incident-record.md

Execute Regression Triage:

## Step 1: Identify Recent Deployments

Check for recent deployments/changes:

Document all recent changes with timestamps.

## Step 2: Symptom Correlation

Compare incident symptoms against baseline:

Symptom Pattern Matching:

Regression Indicators (Check all that apply):

## Step 3: Regression Verdict

Is this a regression?: {CONFIRMED | LIKELY | POSSIBLE | UNLIKELY | NOT_REGRESSION}

Confidence: {HIGH (>90%) | MEDIUM (70-90%) | LOW (<70%)}

Evidence:

1. {evidence point 1}

2. {evidence point 2}

3. {evidence point 3}

Save initial assessment to: .aiwg/incidents/{incident-id}/regression-analysis.md (Step 1-3)

Append timeline:

| {HH:MM UTC} | Regression triage initiated | regression-analyst | Verdict: {CONFIRMED|LIKELY|POSSIBLE|UNLIKELY|NOT_REGRESSION} |

"""

)

```

  1. If Regression Confirmed/Likely, Launch Regression Bisect:

```

# Only if regression verdict is CONFIRMED or LIKELY

Task(

subagent_type="regression-analyst",

description="Identify introducing change via bisect",

prompt="""

Read regression analysis: .aiwg/incidents/{incident-id}/regression-analysis.md

Since regression is {CONFIRMED|LIKELY}, identify introducing change:

## Step 4: Bisect to Find Introducing Commit

Use command: /regression-bisect

Execute bisect process:

Document bisect process and result:

Bisect Results:

Commit Details:

```

{git show {SHA} --stat output}

```

Related Changes:

Append to: .aiwg/incidents/{incident-id}/regression-analysis.md (Step 4)

Append timeline:

| {HH:MM UTC} | Introducing commit identified | regression-analyst | Commit: {SHA}, PR: {PR-number} |

"""

)

```

  1. Rollback Feasibility Assessment:

```

Task(

subagent_type="reliability-engineer",

description="Assess rollback feasibility and calculate blast radius",

prompt="""

Read regression analysis: .aiwg/incidents/{incident-id}/regression-analysis.md

Since introducing change identified, assess rollback options:

## Step 5: Rollback Feasibility

Rollback Options:

### Option A: Full Rollback to Previous Version

### Option B: Revert Specific Commit(s)

### Option C: Feature Flag Disable

### Option D: Hotfix Forward

Recommended Option: {A | B | C | D}

Rationale: {why this option is best given constraints}

## Step 6: Blast Radius Calculation

Scope of Introducing Change:

Rollback Impact Assessment:

Blast Radius Score: {LOW | MEDIUM | HIGH}

Append to: .aiwg/incidents/{incident-id}/regression-analysis.md (Steps 5-6)

Append timeline:

| {HH:MM UTC} | Rollback feasibility assessed | reliability-engineer | Recommended: {option}, Blast radius: {score} |

"""

)

```

  1. Immediate Action Recommendation:

```

Task(

subagent_type="regression-analyst",

description="Recommend immediate action based on regression analysis",

prompt="""

Read complete regression analysis: .aiwg/incidents/{incident-id}/regression-analysis.md

## Step 7: Immediate Action Decision Matrix

Use decision matrix to recommend action:

| Regression Confidence | Rollback Risk | User Impact | Recommendation |

|-----------------------|---------------|-------------|----------------|

| CONFIRMED + HIGH | LOW | HIGH | ROLLBACK IMMEDIATELY |

| CONFIRMED + HIGH | LOW | MEDIUM | ROLLBACK |

| CONFIRMED + HIGH | MEDIUM | HIGH | ROLLBACK with validation |

| CONFIRMED + HIGH | HIGH | HIGH | HOTFIX (rollback blocked) |

| LIKELY + MEDIUM | LOW | HIGH | ROLLBACK after quick validation |

| LIKELY + MEDIUM | MEDIUM | HIGH | INVESTIGATE + prepare rollback |

| POSSIBLE + LOW | ANY | HIGH | INVESTIGATE (parallel to Tier 1) |

| UNLIKELY | ANY | ANY | STANDARD TRIAGE (continue to Step 2) |

Current Situation:

Recommended Immediate Action: {action from matrix}

Action Details:

Communication:

Append to: .aiwg/incidents/{incident-id}/regression-analysis.md (Step 7)

Append timeline:

| {HH:MM UTC} | Immediate action recommended | regression-analyst | Action: {ROLLBACK|HOTFIX|INVESTIGATE|STANDARD_TRIAGE} |

"""

)

```

  1. Update Regression Register:

```

Task(

subagent_type="regression-analyst",

description="Record regression in regression register",

prompt="""

If regression is CONFIRMED or LIKELY, update regression register:

Read regression analysis: .aiwg/incidents/{incident-id}/regression-analysis.md

Update regression register with incident:

Regression Entry:

```yaml

regression_id: REG-{YYYY-MM-DD}-{sequence}

incident_id: {incident-id}

detection_date: {YYYY-MM-DD}

severity: {P0|P1|P2|P3}

introducing_change:

commit_sha: {SHA}

pr_number: {PR-number}

author: {name}

merge_date: {YYYY-MM-DD}

deployment_date: {YYYY-MM-DD}

regression_category: {functional | performance | security | data-integrity}

affected_functionality:

component: {component-name}

feature: {feature-name}

user_facing: {YES|NO}

detection_gap:

escaped_testing: {unit | integration | e2e | manual | staging}

detection_time: {hours from deployment to detection}

reason: {why tests didn't catch this}

mitigation_action: {rollback | hotfix | feature-flag-disable}

mitigation_time: {minutes from detection to resolution}

preventive_actions:

status: {OPEN | MITIGATED | ANALYZED | CLOSED}

```

Save to: .aiwg/regression/register/{regression-id}.yaml

Also update regression summary:

Append one-line entry to: .aiwg/regression/regression-register-summary.md

| {regression-id} | {incident-id} | {YYYY-MM-DD} | {P0|P1|P2} | {commit-SHA} | {category} | {status} |

Cross-reference in incident:

Append to: .aiwg/incidents/{incident-id}/regression-analysis.md

## Regression Register Entry

This incident has been registered as: {regression-id}

See: @.aiwg/regression/register/{regression-id}.yaml

Append timeline:

| {HH:MM UTC} | Regression registered | regression-analyst | Registered as: {regression-id} |

"""

)

```

Decision Flow:

Regression Triage Decision Tree:

1. Is this a regression?
   ├─ CONFIRMED/LIKELY → Proceed to rollback assessment
   │   ├─ Rollback SAFE + HIGH user impact → Execute rollback immediately
   │   ├─ Rollback RISKY or BLOCKED → Proceed to hotfix path
   │   └─ Rollback SAFE + LOW user impact → Prepare rollback, investigate in parallel
   │
   ├─ POSSIBLE → Continue standard triage in parallel with regression investigation
   │
   └─ UNLIKELY/NOT_REGRESSION → Continue to standard triage (Step 2)

Communicate Progress:

✓ Incident logged
⏳ Regression triage in progress...
  ✓ Recent deployments identified: {count} in last {hours}h
  ✓ Regression verdict: {CONFIRMED|LIKELY|POSSIBLE|UNLIKELY|NOT_REGRESSION}
  {✓ Introducing commit identified: {SHA}, PR: {PR-number}}
  {✓ Rollback feasibility: {SAFE|RISKY|BLOCKED}}
  ✓ Recommended action: {ROLLBACK|HOTFIX|INVESTIGATE|STANDARD_TRIAGE}
  {✓ Regression registered: {regression-id}}
⏳ {Executing immediate rollback | Proceeding to hotfix development | Continuing to standard triage}...

Step 2: Triage and Severity Assessment

Purpose: Rapidly assess severity and assign priority using Impact × Urgency matrix

Your Actions:

  1. Launch Triage Agents (parallel):

```

# Agent 1: Impact Assessment

Task(

subagent_type="incident-responder",

description="Assess incident impact (user effect)",

prompt="""

Read incident record: .aiwg/incidents/{incident-id}/incident-record.md

Assess Impact Level:

User Impact Assessment:

Criteria:

Business Impact:

Affected Systems: {list all affected components, services, integrations}

Save to: .aiwg/incidents/{incident-id}/triage-assessment.md (Impact section)

"""

)

# Agent 2: Urgency Assessment

Task(

subagent_type="reliability-engineer",

description="Assess incident urgency (time sensitivity)",

prompt="""

Read incident record: .aiwg/incidents/{incident-id}/incident-record.md

Assess Urgency Level:

Urgency Assessment:

Criteria:

SLA Breach Risk:

Append to: .aiwg/incidents/{incident-id}/triage-assessment.md (Urgency section)

"""

)

```

  1. Synthesize Priority Classification:

```

Task(

subagent_type="incident-responder",

description="Determine incident priority from Impact × Urgency",

prompt="""

Read triage assessment: .aiwg/incidents/{incident-id}/triage-assessment.md

Determine Priority using matrix:

| Impact/Urgency | High Urgency | Medium Urgency | Low Urgency |

|----------------|--------------|----------------|-------------|

| High Impact | P0 (Critical) | P1 (High) | P2 (Medium) |

| Medium Impact | P1 (High) | P2 (Medium) | P3 (Low) |

| Low Impact | P2 (Medium) | P3 (Low) | P3 (Low) |

Priority: {P0 | P1 | P2 | P3}

Response SLA:

Escalation Path:

Incident Commander Assignment (P0/P1 only):

Update incident record with priority and assignments

Save to: .aiwg/incidents/{incident-id}/incident-record.md

Append timeline:

| {HH:MM UTC} | Triage complete, severity {P0/P1/P2/P3} assigned | incident-responder | Impact: {HIGH/MED/LOW}, Urgency: {HIGH/MED/LOW} |

| {HH:MM UTC} | Incident Commander assigned | {name} | {P0/P1 only} |

Append to: .aiwg/incidents/{incident-id}/timeline.md

"""

)

```

Communicate Progress:

✓ Incident detected
⏳ Assessing impact and urgency...
  ✓ Impact: {HIGH/MEDIUM/LOW}
  ✓ Urgency: {HIGH/MEDIUM/LOW}
✓ Priority assigned: {P0/P1/P2/P3}
✓ Incident Commander assigned: {name} (P0/P1)
⏳ Initiating functional escalation (Tier 1)...

Step 3: Functional Escalation (Tier 1 → Tier 2 → Tier 3)

Purpose: Engage appropriate expertise based on incident complexity

Your Actions:

  1. Tier 1 Response (First 15-30 minutes):

```

Task(

subagent_type="reliability-engineer",

description="Tier 1 response: Runbook execution and data gathering",

prompt="""

Read incident record: .aiwg/incidents/{incident-id}/incident-record.md

Execute Tier 1 Response:

## Initial Actions (First 5 minutes)

## Data Gathering

Collect diagnostic data:

Document actions taken and results.

## Escalation Decision (Tier 1 → Tier 2)

Escalate if:

If escalation needed, document:

Save diagnostic data to: .aiwg/incidents/{incident-id}/diagnostics/tier1-data.md

Append timeline with all actions taken.

"""

)

```

  1. Tier 2 Response (If escalated):

```

Task(

subagent_type="component-owner",

description="Tier 2 response: Advanced troubleshooting and code review",

prompt="""

Read incident record: .aiwg/incidents/{incident-id}/incident-record.md

Read Tier 1 data: .aiwg/incidents/{incident-id}/diagnostics/tier1-data.md

Execute Tier 2 Response:

## Handoff from Tier 1

## Advanced Troubleshooting

## Root Cause Hypothesis

Formulate hypothesis:

Hypothesis: {statement of suspected root cause}

Evidence:

1. {log pattern or metric anomaly}

2. {recent deployment or config change}

3. {external dependency status}

Test Plan:

## Escalation Decision (Tier 2 → Tier 3)

Escalate if:

Save hypothesis and findings to: .aiwg/incidents/{incident-id}/diagnostics/tier2-analysis.md

Append timeline with advanced troubleshooting results.

"""

)

```

  1. Tier 3 Response (If escalated):

```

Task(

subagent_type="architecture-designer",

description="Tier 3 response: Architectural analysis and emergency decisions",

prompt="""

Read all prior diagnostics:

Execute Tier 3 Response:

## Architectural Analysis

## Emergency Decision Authority

Provide decisions on:

Document architectural assessment and decisions:

Save to: .aiwg/incidents/{incident-id}/diagnostics/tier3-architecture-assessment.md

Append timeline with architectural decisions.

"""

)

```

Communicate Progress:

✓ Priority assigned: {P0/P1/P2/P3}
⏳ Tier 1 response initiated...
  ✓ Runbook executed: {runbook-name}
  ✓ Diagnostic data collected
  ⚠️ Escalating to Tier 2 (reason: {escalation-reason})
⏳ Tier 2 response: Component Owner engaged...
  ✓ Root cause hypothesis: {hypothesis}
  {✓ Hypothesis confirmed | ⚠️ Escalating to Tier 3}

Step 4: Hierarchical Escalation (Management / Executive)

Purpose: Notify leadership when business impact warrants executive involvement

Your Actions:

  1. Management Notification (P0/P1):

```

Task(

subagent_type="project-manager",

description="Notify management per escalation matrix",

prompt="""

Read incident record: .aiwg/incidents/{incident-id}/incident-record.md

Determine if management notification required:

Trigger:

Generate management notification:

Subject: [{P0 | P1} INCIDENT] {brief-title} - {status}

Incident ID: {incident-id}

Severity: {P0/P1}

Start Time: {HH:MM UTC}

Duration: {elapsed-time}

User Impact: {high-level description}

Affected Users: {count | percentage}

Business Impact: {revenue loss | compliance risk | reputation impact}

Current Status: {INVESTIGATING | MITIGATING | RESOLVED}

Root Cause: {hypothesis or confirmed}

ETA to Resolution: {estimated time | UNKNOWN}

Incident Commander: {name}

Next Update: {time}

Save to: .aiwg/incidents/{incident-id}/communications/management-notification.md

Append timeline: Management notified

"""

)

```

  1. Executive Escalation (P0 Critical):

```

Task(

subagent_type="project-manager",

description="Notify executive leadership for P0 or major business impact",

prompt="""

Read incident record: .aiwg/incidents/{incident-id}/incident-record.md

Determine if executive notification required:

Trigger:

Generate executive notification:

Subject: [EXECUTIVE ALERT] P0 Incident - {brief-title}

Business Impact Summary:

Incident Summary:

{2-3 sentence summary of issue and response}

Current Status: {status}

ETA to Resolution: {time}

Incident Commander: {name}

Executive Action Needed:

{NONE | DECISION REQUIRED | AWARENESS ONLY}

Next Update: {time}

Save to: .aiwg/incidents/{incident-id}/communications/executive-notification.md

Append timeline: Executive leadership notified

"""

)

```

  1. Status Page Communication (P0/P1):

```

Task(

subagent_type="incident-responder",

description="Generate status page update template",

prompt="""

Create public-facing status page update:

{YYYY-MM-DD HH:MM UTC} - Investigating

We are currently investigating an issue affecting {service/feature}.

Users may experience {specific symptoms}. We will provide updates every {15|30|60} minutes.

Save template to: .aiwg/incidents/{incident-id}/communications/status-page-update.md

Note: Update within 30 minutes for P0, 1 hour for P1

"""

)

```

Communicate Progress:

✓ Tier 2 analysis complete
⏳ Escalating per severity matrix...
  ✓ Management notified (P0/P1)
  {✓ Executive notified (P0 >2h or critical business impact) | ⊘ Executive notification not required}
  ✓ Status page update template created
⏳ Proceeding to root cause analysis and mitigation...

Step 5: Root Cause Analysis

Purpose: Identify root cause using structured methodologies (5 Whys, Fishbone)

Your Actions:

  1. Launch RCA Agents (parallel):

```

# Agent 1: 5 Whys Analysis

Task(

subagent_type="incident-responder",

description="Conduct 5 Whys root cause analysis",

prompt="""

Read diagnostics:

Conduct 5 Whys Analysis:

Problem Statement: {what happened}

1. Why did {problem} occur?

2. Why did {reason-1} occur?

3. Why did {reason-2} occur?

4. Why did {reason-3} occur?

5. Why did {reason-4} occur?

Root Cause: {final answer from 5th why}

Validation: {test to confirm root cause}

Save to: .aiwg/incidents/{incident-id}/root-cause-analysis.md (5 Whys section)

"""

)

# Agent 2: Contributing Factors (Fishbone)

Task(

subagent_type="reliability-engineer",

description="Identify contributing factors using Ishikawa diagram",

prompt="""

Read diagnostics and 5 Whys analysis

Analyze Contributing Factors:

Problem: {incident title}

### People

### Process

### Technology

### Environment

Primary Root Cause: {from 5 Whys}

Contributing Factors: {list key factors from above}

Append to: .aiwg/incidents/{incident-id}/root-cause-analysis.md (Contributing Factors section)

"""

)

```

Communicate Progress:

✓ Hierarchical escalation complete
⏳ Conducting root cause analysis...
  ✓ 5 Whys analysis: Root cause identified as {root-cause}
  ✓ Contributing factors analysis: {count} factors identified
✓ Root cause analysis complete: .aiwg/incidents/{incident-id}/root-cause-analysis.md
⏳ Implementing mitigation strategy...

Step 6: Mitigation and Resolution

Purpose: Implement workaround or fix to restore service and eliminate user impact

Your Actions:

  1. Select Mitigation Strategy:

```

Task(

subagent_type="incident-responder",

description="Select mitigation strategy based on root cause",

prompt="""

Read root cause analysis: .aiwg/incidents/{incident-id}/root-cause-analysis.md

Evaluate Mitigation Options:

Option 1: Rollback (fastest, safest for deployment-related incidents)

Option 2: Hotfix (targeted code fix)

Option 3: Configuration Change (parameter adjustment)

Option 4: Workaround (temporary user-side solution)

Option 5: Infrastructure Scaling (resource addition)

Selected Strategy: {option}

Rationale: {why this option was chosen}

Implementation Plan: {specific steps}

Rollback Plan: {if mitigation fails, how to revert}

Save to: .aiwg/incidents/{incident-id}/mitigation-report.md (Strategy section)

"""

)

```

  1. Execute Mitigation (agent depends on strategy):

```

# If Rollback

Task(

subagent_type="devops-engineer",

description="Execute rollback procedure",

prompt="""

Execute rollback based on deployment strategy:

Use existing deployment command:

/flow-deploy-to-production --rollback

Document rollback execution:

Append to: .aiwg/incidents/{incident-id}/mitigation-report.md (Execution section)

Append timeline: Rollback executed

"""

)

# If Hotfix

Task(

subagent_type="devops-engineer",

description="Deploy emergency hotfix",

prompt="""

Execute hotfix deployment:

1. Create hotfix branch: hotfix/INC-{incident-ID}-{brief-description}

2. Implement minimal fix (code change already identified)

3. Test in staging (smoke tests, regression tests)

4. Deploy to production using standard flow

5. Monitor for 15 minutes (metrics validation)

Get Deployment Manager approval before production deploy.

Document hotfix deployment:

Append to: .aiwg/incidents/{incident-id}/mitigation-report.md (Execution section)

Append timeline: Hotfix deployed

"""

)

# If Configuration Change

Task(

subagent_type="reliability-engineer",

description="Apply configuration change",

prompt="""

Apply configuration change:

Document:

Append to: .aiwg/incidents/{incident-id}/mitigation-report.md (Execution section)

Append timeline: Configuration updated

"""

)

```

  1. Validate Resolution:

```

Task(

subagent_type="reliability-engineer",

description="Validate mitigation resolves incident",

prompt="""

Validate mitigation success:

## Validation Tests

## Metrics Validation

Resolution Status: {RESOLVED | PARTIALLY RESOLVED | NOT RESOLVED}

If RESOLVED:

Save validation results to: .aiwg/incidents/{incident-id}/mitigation-report.md (Validation section)

Append timeline:

| {HH:MM UTC} | Mitigation validated, incident RESOLVED | reliability-engineer | Total duration: {duration} |

"""

)

```

  1. User Communication:

```

Task(

subagent_type="incident-responder",

description="Generate resolution communication",

prompt="""

Create resolution communication:

## Status Page Update

{YYYY-MM-DD HH:MM UTC} - Resolved

The issue affecting {service/feature} has been resolved.

Service is operating normally. We apologize for the disruption.

Root cause: {brief explanation}.

A detailed post-incident review will be published within 48 hours.

## Internal Notification

Subject: [RESOLVED] {incident-id} - {title}

Status: RESOLVED

Resolution Time: {HH:MM UTC}

Total Duration: {hours:minutes}

Resolution Summary: {brief description of fix}

User Impact: {summary of user experience during incident}

Next Steps: Post-incident review scheduled for {date/time}

Save to: .aiwg/incidents/{incident-id}/communications/resolution-notification.md

"""

)

```

Communicate Progress:

✓ Root cause identified: {root-cause}
⏳ Implementing mitigation strategy: {strategy}...
  ✓ Mitigation executed: {details}
  ✓ Validation tests: PASSED
  ✓ Metrics returned to baseline
✓ Incident RESOLVED (duration: {HH:MM})
✓ User communication sent
⏳ Scheduling post-incident review...

Step 7: Post-Incident Review (PIR)

Purpose: Conduct blameless retrospective to learn from incident and prevent recurrence

Your Actions:

  1. Schedule PIR Meeting:

```

Task(

subagent_type="project-manager",

description="Schedule post-incident review meeting",

prompt="""

Schedule PIR based on severity:

Timing:

Duration: 60 minutes

Required Attendees:

Optional Attendees:

Agenda:

1. Timeline reconstruction (10 min)

2. Root cause analysis (15 min)

3. Contributing factors discussion (10 min)

4. What went well (10 min)

5. What could improve (10 min)

6. Preventive actions brainstorm (15 min)

Document meeting details:

Save to: .aiwg/incidents/{incident-id}/pir-meeting-invite.md

"""

)

```

  1. Generate PIR Document:

```

Task(

subagent_type="incident-responder",

description="Create comprehensive post-incident review document",

prompt="""

Read all incident artifacts:

Generate Post-Incident Review:

# Post-Incident Review: {incident-id}

Incident ID: {incident-id}

Date: {YYYY-MM-DD}

Severity: {P0/P1/P2}

Duration: {hours:minutes from detection to resolution}

User Impact: {count} users affected, {duration} minutes downtime

## Executive Summary

{2-3 sentence summary of what happened, why, and resolution}

Root Cause: {one-sentence root cause}

Resolution: {one-sentence resolution}

## Timeline

{Copy detailed timeline from timeline.md}

## Regression Analysis (if applicable)

{If regression-analysis.md exists, include summary:}

## Root Cause

{Copy 5 Whys analysis and contributing factors}

## Impact Assessment

### User Impact

### Business Impact

### SLO Impact

## Response Effectiveness

### What Went Well

1. {positive aspect 1}

2. {positive aspect 2}

3. {positive aspect 3}

### What Could Improve

1. {improvement area 1}

2. {improvement area 2}

3. {improvement area 3}

## Preventive Actions

{To be populated in next step}

## Lessons Learned

### Technical Lessons

### Process Lessons

### Communication Lessons

Save to: .aiwg/incidents/{incident-id}/post-incident-review.md

"""

)

```

  1. Create Preventive Actions:

```

Task(

subagent_type="project-manager",

description="Identify and track preventive actions",

prompt="""

Read PIR: .aiwg/incidents/{incident-id}/post-incident-review.md

Identify Preventive Actions in 3 categories:

## Immediate Actions (Complete within 1 week)

| Action | Owner | Due Date | Status |

|--------|-------|----------|--------|

| Fix {specific bug} | {engineer} | {date} | Open |

| Add {metric} to monitoring | {reliability-engineer} | {date} | Open |

| Update runbook with {scenario} | {on-call-engineer} | {date} | Open |

## Short-Term Actions (Complete within 1 month)

| Action | Owner | Due Date | Status |

|--------|-------|----------|--------|

| Add {test} to smoke tests | {test-engineer} | {date} | Open |

| Implement {safeguard} | {architect} | {date} | Open |

| Review {component} for similar issues | {component-owners} | {date} | Open |

## Long-Term Actions (Complete within 3 months)

| Action | Owner | Due Date | Status |

|--------|-------|----------|--------|

| Implement {automation} in CI/CD | {devops} | {date} | Open |

| Conduct chaos engineering drill | {reliability-engineer} | {date} | Open |

| Increase {resource} capacity | {infrastructure} | {date} | Open |

Save to: .aiwg/incidents/{incident-id}/preventive-actions.md

Create tracked tickets for each action (instructions for user):

# Example: JIRA, GitHub Issues

# jira create --project ACT --type Task --summary "[PIR-{incident-id}] {action}" --assignee {owner}

"""

)

```

  1. Update Runbooks and Knowledge Base:

```

Task(

subagent_type="reliability-engineer",

description="Update runbooks with incident learnings",

prompt="""

Create runbook update recommendations:

## Runbook Update: {Scenario}

Scenario: {incident category}

Symptoms:

Diagnosis:

{Commands/checks to identify this issue}

Mitigation:

1. Immediate: {fastest mitigation from incident}

2. Short-term: {temporary fix}

3. Long-term: {permanent fix}

Escalation: If unresolved after {time}, escalate to {Tier 2 role}

Prevention: {monitoring alerts, safeguards to add}

Save to: .aiwg/incidents/{incident-id}/runbook-update-recommendation.md

Also create knowledge base article template:

## Knowledge Base Article: INC-{ID}

Title: How to Troubleshoot {Problem}

Keywords: {relevant keywords}

Problem: {user-facing problem description}

Root Cause: {technical root cause}

Resolution Steps: {link to runbook}

Prevention: {link to monitoring setup, safeguards}

Related Incidents: {list similar past incidents}

Save to: .aiwg/incidents/{incident-id}/knowledge-base-article.md

"""

)

```

  1. Link to Regression-Analyst for Deep Analysis (if regression):

```

Task(

subagent_type="regression-analyst",

description="Conduct deep regression analysis for PIR",

prompt="""

If incident was a regression (regression-analysis.md exists):

Read all regression artifacts:

Conduct deep regression analysis for PIR:

## Regression Deep Dive

### Test Gap Analysis

Why Did Tests Not Catch This?:

Specific Missing Test:

### PR Review Analysis

PR Review Questions:

Review Process Improvement:

### Deployment Process Analysis

Deployment Safety:

Deployment Improvement:

### Pattern Analysis

Similar Regressions:

Query regression register for similar patterns:

Emerging Patterns:

Append to PIR: .aiwg/incidents/{incident-id}/post-incident-review.md (Regression Deep Dive section)

Update regression register with analysis:

.aiwg/regression/register/{regression-id}.yaml

"""

)

```

Communicate Progress:

✓ Incident RESOLVED
⏳ Conducting post-incident review...
  ✓ PIR meeting scheduled: {date/time}
  ✓ PIR document generated
  {✓ Regression deep dive completed (regression incident)}
  ✓ Preventive actions identified: {count} immediate, {count} short-term, {count} long-term
  ✓ Runbook updates recommended
  ✓ Knowledge base article drafted
✓ Post-incident review complete: .aiwg/incidents/{incident-id}/post-incident-review.md

Regression vs New Issue Decision Tree

Use this decision tree during Step 1.5:

┌─────────────────────────────────────────────────────────┐
│ Did this functionality work before?                     │
└───┬───────────────────────────────────────────────┬─────┘
    │ YES                                           │ NO/UNKNOWN
    │                                               │
    v                                               v
┌───────────────────────────────────┐    ┌──────────────────────┐
│ Was there a recent change?        │    │ NOT A REGRESSION     │
│ (deployment, config, infra)       │    │ → Standard Triage    │
└───┬────────────────────────┬──────┘    └──────────────────────┘
    │ YES (<48h)             │ NO
    │                        │
    v                        v
┌───────────────────┐   ┌────────────────────────────┐
│ LIKELY REGRESSION │   │ Check for:                 │
│ → Bisect          │   │ - Traffic pattern change   │
│ → Rollback eval   │   │ - External dependency      │
└───────────────────┘   │ - Data growth              │
                        │ POSSIBLE REGRESSION        │
                        │ → Investigate in parallel  │
                        └────────────────────────────┘

┌─────────────────────────────────────────────────────────┐
│ Rollback vs Hotfix Decision Matrix                     │
├─────────────────┬──────────────┬─────────────┬─────────┤
│ Rollback Risk   │ User Impact  │ Confidence  │ Action  │
├─────────────────┼──────────────┼─────────────┼─────────┤
│ SAFE            │ HIGH         │ CONFIRMED   │ ROLLBACK│
│ SAFE            │ MEDIUM/HIGH  │ LIKELY      │ ROLLBACK│
│ RISKY           │ HIGH         │ CONFIRMED   │ HOTFIX  │
│ BLOCKED         │ ANY          │ CONFIRMED   │ HOTFIX  │
│ SAFE            │ LOW          │ LIKELY      │ INVESTI-│
│                 │              │             │ GATE    │
└─────────────────┴──────────────┴─────────────┴─────────┘

Rollback vs Hotfix Decision Matrix

| Rollback Feasibility | User Impact | Regression Confidence | Recommended Action |

|----------------------|-------------|-----------------------|--------------------|

| SAFE (no schema/data issues) | HIGH (P0) | CONFIRMED (>90%) | Execute rollback immediately |

| SAFE | HIGH (P0) | LIKELY (70-90%) | Rollback after quick validation (5 min) |

| SAFE | MEDIUM (P1) | CONFIRMED | Rollback |

| RISKY (schema/data concerns) | HIGH (P0) | CONFIRMED | Hotfix (rollback too risky) |

| BLOCKED (breaking changes) | HIGH (P0) | CONFIRMED | Emergency hotfix |

| SAFE | LOW (P2) | LIKELY | Investigate, prepare rollback as backup |

| RISKY | MEDIUM (P1) | LIKELY | Investigate + parallel hotfix dev |

| ANY | HIGH (P0) | POSSIBLE (<70%) | Investigate (Tier 1) + prepare rollback |

Quality Gates

Before marking workflow complete, verify:

User Communication

At start: Confirm understanding and initial severity assessment

Understood. I'll orchestrate incident response for {incident-id}.

Initial assessment:
- Reported symptoms: {user-provided description}
- Estimated severity: {P0/P1/P2/P3} (pending triage confirmation)
- Expected resolution SLA: {time}

I'll coordinate incident response across:
- Regression triage (if recent deployment)
- Tier 1 → Tier 2 → Tier 3 escalation
- Management/executive notification (if warranted)
- Root cause analysis
- Mitigation and validation
- Post-incident review

Expected orchestration duration: 5-10 minutes.
Resolution duration: {P0: 1-2h | P1: 4h | P2: 24h}

Starting incident response...

During: Update progress with clear indicators

✓ = Complete
⏳ = In progress
❌ = Error/blocked
⚠️ = Warning/escalation triggered

At end: Summary report with resolution status and PIR schedule

─────────────────────────────────────────────
Incident Response Complete: {incident-id}
─────────────────────────────────────────────

**Overall Status**: RESOLVED
**Severity**: {P0/P1/P2/P3}
**Duration**: {HH:MM} (Detection → Resolution)
**Resolution SLA**: {MET | MISSED by {time}}

**Regression Analysis** (if applicable):
- Regression Detected: {YES|NO}
- Introducing Commit: {SHA} (PR #{PR-number})
- Rollback Executed: {YES|NO}
- Regression Register: @.aiwg/regression/register/{regression-id}.yaml

**Resolution Summary**:
- Root Cause: {one-sentence root cause}
- Mitigation: {strategy applied}
- User Impact: {count} users, {duration} minutes {outage|degradation}

**Response Metrics**:
- Detection Time: {minutes} (SLA: <5 min)
- Regression Triage: {minutes} (for deployment-related incidents)
- Acknowledgment: {minutes} (SLA: {immediate|5 min|30 min})
- Time to Engage: {minutes} (SLA: {15|30|240} min)
- Time to Resolve: {HH:MM} (SLA: {1-2h|4h|24h})

**Escalation Path Executed**:
✓ Tier 1: On-call engineer → {escalated|resolved}
{✓ Tier 2: Component Owner → {escalated|resolved}}
{✓ Tier 3: Architecture team → resolved}
{✓ Management notified (P0/P1)}
{✓ Executive notified (P0 critical)}

**Artifacts Generated**:
- Incident Record (.aiwg/incidents/{incident-id}/incident-record.md)
- Timeline (.aiwg/incidents/{incident-id}/timeline.md)
- Triage Assessment (.aiwg/incidents/{incident-id}/triage-assessment.md)
- Regression Analysis (.aiwg/incidents/{incident-id}/regression-analysis.md) {if regression}
- Root Cause Analysis (.aiwg/incidents/{incident-id}/root-cause-analysis.md)
- Mitigation Report (.aiwg/incidents/{incident-id}/mitigation-report.md)
- Post-Incident Review (.aiwg/incidents/{incident-id}/post-incident-review.md)
- Preventive Actions (.aiwg/incidents/{incident-id}/preventive-actions.md)

**Next Steps**:
- PIR meeting: {date/time}
- Preventive actions: {count} tracked ({immediate|short-term|long-term})
- Runbook updates: Review .aiwg/incidents/{incident-id}/runbook-update-recommendation.md
- Knowledge base: Publish .aiwg/incidents/{incident-id}/knowledge-base-article.md
{- Regression deep dive: .aiwg/regression/register/{regression-id}.yaml}

─────────────────────────────────────────────

Error Handling

If Incident Not Resolving Within SLA:

⚠️ Incident exceeds resolution SLA ({P0 >2h | P1 >4h})

Current status: {INVESTIGATING | MITIGATING}
Elapsed time: {HH:MM}

Actions:
1. Escalating to Incident Commander (if not already involved)
2. Assembling war room with all Component Owners
3. Considering emergency measures:
   - Rollback to last known-good version
   - Enable maintenance mode (planned downtime)
   - Engage vendor support (if third-party dependency)
4. Updating stakeholders every {15|30} minutes
5. Notifying {executive sponsor | management}

Escalation contact: {Incident Commander → Engineering Manager → VP Engineering → CTO}

If Escalation Path Blocked:

⚠️ Key person unavailable: {Tier 2/3 owner | Incident Commander}

Actions:
1. Checking on-call rotation for backup/secondary contact
2. Escalating to engineering manager for alternate assignment
3. Engaging Software Architect for temporary coverage (if Component Owner unavailable)
4. Documenting unavailability in incident timeline

Backup contacts:
- Tier 2 Backup: {name, contact}
- Tier 3 Backup: {name, contact}
- Incident Commander Backup: {name, contact}

If Multiple Concurrent Incidents (Major Incident):

⚠️ Multiple concurrent incidents detected: {count} P0/P1 incidents

Declaring MAJOR INCIDENT status.

Actions:
1. Assigning separate Incident Commander for each incident
2. Establishing central coordination (Senior Incident Commander)
3. Triaging incidents by business impact priority
4. Allocating resources (may pull from non-critical work)
5. Executive notification immediate
6. Status page update: "Multiple service disruptions"

Considerations:
- Implementing change freeze (halt all deployments)
- Scaling back non-essential services to free resources
- Engaging vendor support across all affected systems

Major Incident Coordinator: {Senior Engineering Manager or VP Engineering}

If Rollback Fails (CRITICAL):

❌ Rollback did not resolve incident or rollback itself failed

STOP: No further changes until assessment complete.

Escalating to P0 CRITICAL.

Assembling emergency war room:
- Incident Commander
- Deployment Manager
- Software Architect
- Database Administrator (if data issue)
- Infrastructure Lead

Options under evaluation:
- Rollback to earlier version (skip problematic release)
- Emergency hotfix (if root cause clear)
- Maintenance mode (planned downtime for investigation)
- Manual intervention (database repair, data migration)

Executive notification: IMMEDIATE
Public communication: "Extended outage, team working on resolution"

Emergency contact: {CTO or VP Engineering}

If Security Breach or Data Loss:

❌ SECURITY INCIDENT or DATA LOSS detected

IMMEDIATE ACTIONS:
1. Engaging Security Gatekeeper and Security Incident Response Team
2. Preserving evidence (logs, forensics) before mitigation
3. Isolating affected systems
4. Following Security Incident Response Plan (separate from standard flow)

Notifications:
- Legal and compliance: IMMEDIATE
- Executive: IMMEDIATE
- Regulatory reporting: {GDPR, HIPAA, etc.} within required timeframes
- User notification: Per breach disclosure laws

Forensic analysis required before system restoration.

Security Incident Lead: {Security Gatekeeper or CISO}
Legal Contact: {General Counsel}

Extended PIR with security-specific preventive actions required.

Success Criteria

This orchestration succeeds when:

Metrics to Track

During orchestration, track:

Agent Coordination

Primary Agents:

Supporting Agents:

References

Templates (via $AIWG_ROOT):

Related Commands:

Related Agents:

Related Schemas:

Gate Criteria:

Multi-Agent Pattern:

Orchestrator Architecture:

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.