Incident Classification
When to Use
Use this skill when an incident, issue, or anomaly report arrives and needs to be classified before anyone can act on it. The goal is to produce a structured classification card that tells responders what they are dealing with, how urgent it is, and who should handle it. This is typically the first step in any incident response workflow.
Severity Definitions
| Level |
Name |
Criteria |
Response Target |
Examples |
| P0 |
Critical |
Complete outage or data loss affecting all users; security breach with active exploitation; safety risk |
Immediate (within minutes) |
System entirely down, credentials leaked publicly, data corruption spreading |
| P1 |
High |
Major functionality broken for a significant portion of users; performance degraded beyond usable thresholds; security vulnerability with known exploit |
Within 1 hour |
Primary workflow broken, response times >10x normal, known CVE with public exploit |
| P2 |
Medium |
Non-critical functionality impaired; workaround exists; issue affects a subset of users |
Within 1 business day |
Secondary feature broken, intermittent errors with retry success, single-tenant issue |
| P3 |
Low |
Cosmetic issue, minor inconvenience, improvement request, or documentation gap |
Next planning cycle |
Typo in output, minor UI inconsistency, feature request, stale documentation |
Category Definitions
| Category |
Scope |
Keywords |
| System |
Infrastructure, availability, deployment, configuration |
down, crash, restart, deploy, container, disk, memory, CPU, OOM, timeout |
| Data |
Data integrity, loss, corruption, migration, backup |
data, corrupt, missing, duplicate, migration, backup, restore, sync, inconsistent |
| Security |
Authentication, authorization, vulnerability, exposure |
auth, permission, denied, leak, vulnerability, CVE, injection, token, certificate |
| Performance |
Latency, throughput, resource exhaustion, scaling |
slow, latency, throughput, queue, backlog, memory, CPU, scaling, bottleneck |
| Integration |
Third-party services, APIs, external dependencies |
API, upstream, downstream, webhook, callback, partner, external, federation |
| Process |
Workflow, procedure, communication, coordination failures |
workflow, missed, notification, handoff, SLA, escalation, procedure |
Output: Classification Card
# Incident Classification
**Incident ID:** INC-[YYYYMMDD]-[NNN]
**Classified by:** [agent name]
**Classified at:** [ISO timestamp]
## Summary
[One-sentence description of the incident]
## Classification
| Field | Value |
|-------|-------|
| **Severity** | P[0-3]: [Name] |
| **Category** | [System / Data / Security / Performance / Integration / Process] |
| **Urgency** | [Immediate / High / Standard / Low] |
| **Affected Components** | [list of components] |
| **Blast Radius** | [All users / Subset / Single user / Internal only] |
| **Workaround Available** | [Yes: describe / No] |
## Initial Assessment
[2-3 sentences: what appears to be happening, what evidence supports this, what is unknown]
## Routing
| Role | Reason |
|------|--------|
| **Primary:** [persona] | [why this role should lead] |
| **Secondary:** [persona] | [why this role should assist] |
| **Notify:** [persona(s)] | [why they need to know] |
## Evidence
- [Observation 1 with source]
- [Observation 2 with source]
## Recommended First Actions
1. [Immediate action for the responder]
2. [Second action]
3. [Third action]
Procedure
1. Read the Incident Report
# Read from incoming mail (Maildir format)
mail -f ~/Maildir -H 2>/dev/null | tail -20
# Or read from a file
INCIDENT_FILE="${1:-/home/shared/inbox/incident.txt}"
if [ -f "$INCIDENT_FILE" ]; then
cat "$INCIDENT_FILE"
else
echo "No incident file at $INCIDENT_FILE"
fi
# Or read from the task board (pending, unclassified tasks)
bash /home/shared/scripts/task.sh list --status pending 2>/dev/null | jq '
.[] | select(.tags == null or (.tags | index("classified") | not)) |
{id: .id, subject: .subject, description: .description}
' 2>/dev/null
Capture the raw text for analysis:
INCIDENT_TEXT=$(cat "$INCIDENT_FILE" 2>/dev/null || echo "$1")
echo "$INCIDENT_TEXT" > /tmp/incident-raw.txt
echo "Incident text captured: $(wc -w < /tmp/incident-raw.txt) words"
2. Classify Severity
Apply the severity decision tree. Work through each level starting from P0:
INCIDENT_LOWER=$(echo "$INCIDENT_TEXT" | tr '[:upper:]' '[:lower:]')
classify_severity() {
local text="$1"
# P0: Complete outage, active data loss, active security breach
if echo "$text" | grep -qE '(complete|total).*(outage|down|failure)'; then
echo "P0"; return
fi
if echo "$text" | grep -qE 'data.*(loss|corrupt|destroy).*active|active.*(breach|exploit)'; then
echo "P0"; return
fi
if echo "$text" | grep -qE 'all users.*(affected|cannot|unable)|everyone.*(down|broken)'; then
echo "P0"; return
fi
# P1: Major functionality broken, severe degradation, known exploit
if echo "$text" | grep -qE 'major.*(broken|failure|outage)|cannot.*(login|access|use)'; then
echo "P1"; return
fi
if echo "$text" | grep -qE '(response|load).*(time|latency).*[0-9]+.*(second|minute)|extremely slow'; then
echo "P1"; return
fi
if echo "$text" | grep -qE 'cve-[0-9]|known.*(exploit|vulnerability)|security.*(hole|flaw)'; then
echo "P1"; return
fi
# P2: Partial impact, workaround exists, subset affected
if echo "$text" | grep -qE '(some|few|subset|intermittent|partial).*(user|fail|error|broken)'; then
echo "P2"; return
fi
if echo "$text" | grep -qE 'workaround|can still|alternative|retry.*(work|succeed)'; then
echo "P2"; return
fi
# P3: Everything else
echo "P3"
}
SEVERITY=$(classify_severity "$INCIDENT_LOWER")
echo "Severity: $SEVERITY"
3. Classify Category
classify_category() {
local text="$1"
# Security takes priority -- always check first
if echo "$text" | grep -qE 'auth|permission|denied|leak|vulnerab|cve|inject|token|certif|credential|password|unauthorized'; then
echo "Security"; return
fi
# Data integrity
if echo "$text" | grep -qE 'data.*(corrupt|loss|missing|duplicate|inconsist)|backup|restore|migration|sync'; then
echo "Data"; return
fi
# Performance
if echo "$text" | grep -qE 'slow|latency|throughput|queue|backlog|bottleneck|scaling|response.time'; then
echo "Performance"; return
fi
# Integration
if echo "$text" | grep -qE 'api|upstream|downstream|webhook|external|third.party|partner|federation|integration'; then
echo "Integration"; return
fi
# Process
if echo "$text" | grep -qE 'workflow|missed|notification|handoff|sla|escalat|procedure|communication'; then
echo "Process"; return
fi
# Default: System
echo "System"
}
CATEGORY=$(classify_category "$INCIDENT_LOWER")
echo "Category: $CATEGORY"
4. Identify Affected Components
# Extract component names by looking for known system terms
identify_components() {
local text="$1"
local components=""
# Check for known shared infrastructure
echo "$text" | grep -oE '(task.board|artifact|mail|orchestrat|agent|script|shared|workspace|heartbeat|health.check)' \
| sort -u | tr '\n' ', ' | sed 's/,$//'
}
COMPONENTS=$(identify_components "$INCIDENT_LOWER")
if [ -z "$COMPONENTS" ]; then
COMPONENTS="Unknown -- requires investigation"
fi
echo "Affected components: $COMPONENTS"
5. Determine Blast Radius
determine_blast_radius() {
local text="$1"
if echo "$text" | grep -qE 'all (user|agent|system)|every(one|thing)|complete|total|entire'; then
echo "All users"
elif echo "$text" | grep -qE 'some (user|agent)|subset|group|team|partial'; then
echo "Subset"
elif echo "$text" | grep -qE 'single|one (user|agent)|specific|individual|only I|only my'; then
echo "Single user"
elif echo "$text" | grep -qE 'internal|backend|infra|admin|operator'; then
echo "Internal only"
else
echo "Unknown -- requires investigation"
fi
}
BLAST_RADIUS=$(determine_blast_radius "$INCIDENT_LOWER")
echo "Blast radius: $BLAST_RADIUS"
6. Check for Similar Past Incidents
# Search for past classification cards
find /home/shared/ -name 'incident-classification-*' -type f 2>/dev/null | while read f; do
MATCH=$(grep -l "$CATEGORY" "$f" 2>/dev/null)
if [ -n "$MATCH" ]; then
echo "=== Similar past incident: $f ==="
head -20 "$f"
echo ""
fi
done
# Search the triage log
if [ -f ~/triage/log.jsonl ]; then
jq -r "select(.type == \"$(echo "$CATEGORY" | tr '[:upper:]' '[:lower:]')\")" ~/triage/log.jsonl 2>/dev/null \
| tail -5
fi
7. Route to Appropriate Specialist
route_incident() {
local severity="$1"
local category="$2"
case "$category" in
Security)
PRIMARY="security"; SECONDARY="coder"; NOTIFY="manager" ;;
Data)
PRIMARY="coder"; SECONDARY="analyst"; NOTIFY="manager" ;;
Performance)
PRIMARY="coder"; SECONDARY="analyst"; NOTIFY="architect" ;;
Integration)
PRIMARY="coder"; SECONDARY="devops"; NOTIFY="architect" ;;
Process)
PRIMARY="manager"; SECONDARY="planner"; NOTIFY="" ;;
System|*)
PRIMARY="devops"; SECONDARY="coder"; NOTIFY="manager" ;;
esac
# P0 always notifies manager
if [ "$severity" = "P0" ]; then
NOTIFY="manager"
fi
echo "PRIMARY=$PRIMARY SECONDARY=$SECONDARY NOTIFY=$NOTIFY"
}
eval $(route_incident "$SEVERITY" "$CATEGORY")
echo "Route: primary=$PRIMARY, secondary=$SECONDARY, notify=$NOTIFY"
8. Write the Classification Card
INCIDENT_ID="INC-$(date +%Y%m%d)-$(printf '%03d' $((RANDOM % 999 + 1)))"
CLASSIFICATION_FILE="/home/shared/incident-classification-${INCIDENT_ID}.md"
TIMESTAMP=$(date -Iseconds)
AGENT_NAME=$(whoami)
SUMMARY_LINE=$(echo "$INCIDENT_TEXT" | head -1 | cut -c1-120)
# Map severity to urgency
case "$SEVERITY" in
P0) URGENCY="Immediate" ;;
P1) URGENCY="High" ;;
P2) URGENCY="Standard" ;;
P3) URGENCY="Low" ;;
esac
cat > "$CLASSIFICATION_FILE" <<EOF
# Incident Classification
**Incident ID:** ${INCIDENT_ID}
**Classified by:** ${AGENT_NAME}
**Classified at:** ${TIMESTAMP}
## Summary
${SUMMARY_LINE}
## Classification
| Field | Value |
|-------|-------|
| **Severity** | ${SEVERITY}: $(echo "$SEVERITY" | sed 's/P0/Critical/;s/P1/High/;s/P2/Medium/;s/P3/Low/') |
| **Category** | ${CATEGORY} |
| **Urgency** | ${URGENCY} |
| **Affected Components** | ${COMPONENTS} |
| **Blast Radius** | ${BLAST_RADIUS} |
| **Workaround Available** | [FILL IN: Yes -- describe / No] |
## Initial Assessment
[FILL IN: 2-3 sentences describing what appears to be happening based on the report, what evidence supports this assessment, and what remains unknown.]
## Routing
| Role | Reason |
|------|--------|
| **Primary:** ${PRIMARY} | Lead responder for ${CATEGORY} incidents |
| **Secondary:** ${SECONDARY} | Supporting expertise for ${CATEGORY} |
| **Notify:** ${NOTIFY:-none} | Awareness for ${SEVERITY} severity |
## Evidence
$(echo "$INCIDENT_TEXT" | head -10 | sed 's/^/- /')
## Recommended First Actions
1. Acknowledge the incident and update the task board
2. Reproduce or verify the reported symptoms
3. Assess actual blast radius and confirm severity
EOF
echo "Classification card written to: $CLASSIFICATION_FILE"
9. Notify the Assigned Responder
# Send classification to primary responder
bash /home/shared/scripts/send-mail.sh "$PRIMARY" <<EOF
[${SEVERITY}] Incident ${INCIDENT_ID} assigned to you
Classification: ${SEVERITY} ${CATEGORY}
Urgency: ${URGENCY}
Affected: ${COMPONENTS}
Blast radius: ${BLAST_RADIUS}
Summary: ${SUMMARY_LINE}
Full classification card: ${CLASSIFICATION_FILE}
Recommended first actions:
1. Acknowledge by updating task status to in_progress
2. Reproduce or verify the reported symptoms
3. Assess actual blast radius and confirm severity
$(if [ "$SEVERITY" = "P0" ]; then
echo "This is a P0 -- drop everything and respond immediately."
fi)
EOF
# Notify secondary
bash /home/shared/scripts/send-mail.sh "$SECONDARY" <<EOF
[FYI] Incident ${INCIDENT_ID} -- you are secondary responder
${SEVERITY} ${CATEGORY} incident assigned to ${PRIMARY}.
You may be pulled in for assistance.
Classification card: ${CLASSIFICATION_FILE}
EOF
# Notify manager for P0/P1
if [ -n "$NOTIFY" ]; then
bash /home/shared/scripts/send-mail.sh "$NOTIFY" <<EOF
[${SEVERITY}] Incident ${INCIDENT_ID} classified and routed
Category: ${CATEGORY}
Assigned to: ${PRIMARY} (primary), ${SECONDARY} (secondary)
Blast radius: ${BLAST_RADIUS}
Summary: ${SUMMARY_LINE}
Classification card: ${CLASSIFICATION_FILE}
EOF
fi
echo "Notifications sent."
10. Create Task and Register Artifact
# Create a task for tracking
TASK_ID=$(bash /home/shared/scripts/task.sh add \
--subject "[${SEVERITY}] ${INCIDENT_ID}: ${SUMMARY_LINE}" \
--description "Classified incident. See ${CLASSIFICATION_FILE} for details." \
--owner "$PRIMARY" 2>/dev/null | jq -r '.id' 2>/dev/null)
echo "Task created: $TASK_ID"
# Register the classification card as an artifact
bash /home/shared/scripts/artifact.sh register \
--name "classification-${INCIDENT_ID}" \
--type "incident-classification" \
--path "$CLASSIFICATION_FILE" \
--description "${SEVERITY} ${CATEGORY} incident: ${SUMMARY_LINE}"
echo "Artifact registered."
# Log the classification
mkdir -p ~/classifications
cat >> ~/classifications/log.jsonl <<EOF
{"timestamp":"${TIMESTAMP}","incident_id":"${INCIDENT_ID}","severity":"${SEVERITY}","category":"${CATEGORY}","urgency":"${URGENCY}","blast_radius":"${BLAST_RADIUS}","components":"${COMPONENTS}","primary":"${PRIMARY}","secondary":"${SECONDARY}","task_id":"${TASK_ID}","classified_by":"${AGENT_NAME}"}
EOF
Quality Checklist
1---2name: incident-classification3description: Classify, prioritize, and route incoming incidents based on severity, category, and affected components4---56# Incident Classification78## When to Use910Use this skill when an incident, issue, or anomaly report arrives and needs to be classified before anyone can act on it. The goal is to produce a structured classification card that tells responders what they are dealing with, how urgent it is, and who should handle it. This is typically the first step in any incident response workflow.1112## Severity Definitions1314| Level | Name | Criteria | Response Target | Examples |15|-------|------|----------|-----------------|---------|16| **P0** | Critical | Complete outage or data loss affecting all users; security breach with active exploitation; safety risk | Immediate (within minutes) | System entirely down, credentials leaked publicly, data corruption spreading |17| **P1** | High | Major functionality broken for a significant portion of users; performance degraded beyond usable thresholds; security vulnerability with known exploit | Within 1 hour | Primary workflow broken, response times >10x normal, known CVE with public exploit |18| **P2** | Medium | Non-critical functionality impaired; workaround exists; issue affects a subset of users | Within 1 business day | Secondary feature broken, intermittent errors with retry success, single-tenant issue |19| **P3** | Low | Cosmetic issue, minor inconvenience, improvement request, or documentation gap | Next planning cycle | Typo in output, minor UI inconsistency, feature request, stale documentation |2021## Category Definitions2223| Category | Scope | Keywords |24|----------|-------|----------|25| **System** | Infrastructure, availability, deployment, configuration | down, crash, restart, deploy, container, disk, memory, CPU, OOM, timeout |26| **Data** | Data integrity, loss, corruption, migration, backup | data, corrupt, missing, duplicate, migration, backup, restore, sync, inconsistent |27| **Security** | Authentication, authorization, vulnerability, exposure | auth, permission, denied, leak, vulnerability, CVE, injection, token, certificate |28| **Performance** | Latency, throughput, resource exhaustion, scaling | slow, latency, throughput, queue, backlog, memory, CPU, scaling, bottleneck |29| **Integration** | Third-party services, APIs, external dependencies | API, upstream, downstream, webhook, callback, partner, external, federation |30| **Process** | Workflow, procedure, communication, coordination failures | workflow, missed, notification, handoff, SLA, escalation, procedure |3132## Output: Classification Card3334```markdown35# Incident Classification3637**Incident ID:** INC-[YYYYMMDD]-[NNN]38**Classified by:** [agent name]39**Classified at:** [ISO timestamp]4041## Summary42[One-sentence description of the incident]4344## Classification45| Field | Value |46|-------|-------|47| **Severity** | P[0-3]: [Name] |48| **Category** | [System / Data / Security / Performance / Integration / Process] |49| **Urgency** | [Immediate / High / Standard / Low] |50| **Affected Components** | [list of components] |51| **Blast Radius** | [All users / Subset / Single user / Internal only] |52| **Workaround Available** | [Yes: describe / No] |5354## Initial Assessment55[2-3 sentences: what appears to be happening, what evidence supports this, what is unknown]5657## Routing58| Role | Reason |59|------|--------|60| **Primary:** [persona] | [why this role should lead] |61| **Secondary:** [persona] | [why this role should assist] |62| **Notify:** [persona(s)] | [why they need to know] |6364## Evidence65- [Observation 1 with source]66- [Observation 2 with source]6768## Recommended First Actions691. [Immediate action for the responder]702. [Second action]713. [Third action]72```7374## Procedure7576### 1. Read the Incident Report7778```bash79# Read from incoming mail (Maildir format)80mail -f ~/Maildir -H 2>/dev/null | tail -208182# Or read from a file83INCIDENT_FILE="${1:-/home/shared/inbox/incident.txt}"84if [ -f "$INCIDENT_FILE" ]; then85 cat "$INCIDENT_FILE"86else87 echo "No incident file at $INCIDENT_FILE"88fi8990# Or read from the task board (pending, unclassified tasks)91bash /home/shared/scripts/task.sh list --status pending 2>/dev/null | jq '92 .[] | select(.tags == null or (.tags | index("classified") | not)) |93 {id: .id, subject: .subject, description: .description}94' 2>/dev/null95```9697Capture the raw text for analysis:9899```bash100INCIDENT_TEXT=$(cat "$INCIDENT_FILE" 2>/dev/null || echo "$1")101echo "$INCIDENT_TEXT" > /tmp/incident-raw.txt102echo "Incident text captured: $(wc -w < /tmp/incident-raw.txt) words"103```104105### 2. Classify Severity106107Apply the severity decision tree. Work through each level starting from P0:108109```bash110INCIDENT_LOWER=$(echo "$INCIDENT_TEXT" | tr '[:upper:]' '[:lower:]')111112classify_severity() {113 local text="$1"114115 # P0: Complete outage, active data loss, active security breach116 if echo "$text" | grep -qE '(complete|total).*(outage|down|failure)'; then117 echo "P0"; return118 fi119 if echo "$text" | grep -qE 'data.*(loss|corrupt|destroy).*active|active.*(breach|exploit)'; then120 echo "P0"; return121 fi122 if echo "$text" | grep -qE 'all users.*(affected|cannot|unable)|everyone.*(down|broken)'; then123 echo "P0"; return124 fi125126 # P1: Major functionality broken, severe degradation, known exploit127 if echo "$text" | grep -qE 'major.*(broken|failure|outage)|cannot.*(login|access|use)'; then128 echo "P1"; return129 fi130 if echo "$text" | grep -qE '(response|load).*(time|latency).*[0-9]+.*(second|minute)|extremely slow'; then131 echo "P1"; return132 fi133 if echo "$text" | grep -qE 'cve-[0-9]|known.*(exploit|vulnerability)|security.*(hole|flaw)'; then134 echo "P1"; return135 fi136137 # P2: Partial impact, workaround exists, subset affected138 if echo "$text" | grep -qE '(some|few|subset|intermittent|partial).*(user|fail|error|broken)'; then139 echo "P2"; return140 fi141 if echo "$text" | grep -qE 'workaround|can still|alternative|retry.*(work|succeed)'; then142 echo "P2"; return143 fi144145 # P3: Everything else146 echo "P3"147}148149SEVERITY=$(classify_severity "$INCIDENT_LOWER")150echo "Severity: $SEVERITY"151```152153### 3. Classify Category154155```bash156classify_category() {157 local text="$1"158159 # Security takes priority -- always check first160 if echo "$text" | grep -qE 'auth|permission|denied|leak|vulnerab|cve|inject|token|certif|credential|password|unauthorized'; then161 echo "Security"; return162 fi163164 # Data integrity165 if echo "$text" | grep -qE 'data.*(corrupt|loss|missing|duplicate|inconsist)|backup|restore|migration|sync'; then166 echo "Data"; return167 fi168169 # Performance170 if echo "$text" | grep -qE 'slow|latency|throughput|queue|backlog|bottleneck|scaling|response.time'; then171 echo "Performance"; return172 fi173174 # Integration175 if echo "$text" | grep -qE 'api|upstream|downstream|webhook|external|third.party|partner|federation|integration'; then176 echo "Integration"; return177 fi178179 # Process180 if echo "$text" | grep -qE 'workflow|missed|notification|handoff|sla|escalat|procedure|communication'; then181 echo "Process"; return182 fi183184 # Default: System185 echo "System"186}187188CATEGORY=$(classify_category "$INCIDENT_LOWER")189echo "Category: $CATEGORY"190```191192### 4. Identify Affected Components193194```bash195# Extract component names by looking for known system terms196identify_components() {197 local text="$1"198 local components=""199200 # Check for known shared infrastructure201 echo "$text" | grep -oE '(task.board|artifact|mail|orchestrat|agent|script|shared|workspace|heartbeat|health.check)' \202 | sort -u | tr '\n' ', ' | sed 's/,$//'203}204205COMPONENTS=$(identify_components "$INCIDENT_LOWER")206if [ -z "$COMPONENTS" ]; then207 COMPONENTS="Unknown -- requires investigation"208fi209echo "Affected components: $COMPONENTS"210```211212### 5. Determine Blast Radius213214```bash215determine_blast_radius() {216 local text="$1"217218 if echo "$text" | grep -qE 'all (user|agent|system)|every(one|thing)|complete|total|entire'; then219 echo "All users"220 elif echo "$text" | grep -qE 'some (user|agent)|subset|group|team|partial'; then221 echo "Subset"222 elif echo "$text" | grep -qE 'single|one (user|agent)|specific|individual|only I|only my'; then223 echo "Single user"224 elif echo "$text" | grep -qE 'internal|backend|infra|admin|operator'; then225 echo "Internal only"226 else227 echo "Unknown -- requires investigation"228 fi229}230231BLAST_RADIUS=$(determine_blast_radius "$INCIDENT_LOWER")232echo "Blast radius: $BLAST_RADIUS"233```234235### 6. Check for Similar Past Incidents236237```bash238# Search for past classification cards239find /home/shared/ -name 'incident-classification-*' -type f 2>/dev/null | while read f; do240 MATCH=$(grep -l "$CATEGORY" "$f" 2>/dev/null)241 if [ -n "$MATCH" ]; then242 echo "=== Similar past incident: $f ==="243 head -20 "$f"244 echo ""245 fi246done247248# Search the triage log249if [ -f ~/triage/log.jsonl ]; then250 jq -r "select(.type == \"$(echo "$CATEGORY" | tr '[:upper:]' '[:lower:]')\")" ~/triage/log.jsonl 2>/dev/null \251 | tail -5252fi253```254255### 7. Route to Appropriate Specialist256257```bash258route_incident() {259 local severity="$1"260 local category="$2"261262 case "$category" in263 Security)264 PRIMARY="security"; SECONDARY="coder"; NOTIFY="manager" ;;265 Data)266 PRIMARY="coder"; SECONDARY="analyst"; NOTIFY="manager" ;;267 Performance)268 PRIMARY="coder"; SECONDARY="analyst"; NOTIFY="architect" ;;269 Integration)270 PRIMARY="coder"; SECONDARY="devops"; NOTIFY="architect" ;;271 Process)272 PRIMARY="manager"; SECONDARY="planner"; NOTIFY="" ;;273 System|*)274 PRIMARY="devops"; SECONDARY="coder"; NOTIFY="manager" ;;275 esac276277 # P0 always notifies manager278 if [ "$severity" = "P0" ]; then279 NOTIFY="manager"280 fi281282 echo "PRIMARY=$PRIMARY SECONDARY=$SECONDARY NOTIFY=$NOTIFY"283}284285eval $(route_incident "$SEVERITY" "$CATEGORY")286echo "Route: primary=$PRIMARY, secondary=$SECONDARY, notify=$NOTIFY"287```288289### 8. Write the Classification Card290291```bash292INCIDENT_ID="INC-$(date +%Y%m%d)-$(printf '%03d' $((RANDOM % 999 + 1)))"293CLASSIFICATION_FILE="/home/shared/incident-classification-${INCIDENT_ID}.md"294TIMESTAMP=$(date -Iseconds)295AGENT_NAME=$(whoami)296SUMMARY_LINE=$(echo "$INCIDENT_TEXT" | head -1 | cut -c1-120)297298# Map severity to urgency299case "$SEVERITY" in300 P0) URGENCY="Immediate" ;;301 P1) URGENCY="High" ;;302 P2) URGENCY="Standard" ;;303 P3) URGENCY="Low" ;;304esac305306cat > "$CLASSIFICATION_FILE" <<EOF307# Incident Classification308309**Incident ID:** ${INCIDENT_ID}310**Classified by:** ${AGENT_NAME}311**Classified at:** ${TIMESTAMP}312313## Summary314${SUMMARY_LINE}315316## Classification317| Field | Value |318|-------|-------|319| **Severity** | ${SEVERITY}: $(echo "$SEVERITY" | sed 's/P0/Critical/;s/P1/High/;s/P2/Medium/;s/P3/Low/') |320| **Category** | ${CATEGORY} |321| **Urgency** | ${URGENCY} |322| **Affected Components** | ${COMPONENTS} |323| **Blast Radius** | ${BLAST_RADIUS} |324| **Workaround Available** | [FILL IN: Yes -- describe / No] |325326## Initial Assessment327[FILL IN: 2-3 sentences describing what appears to be happening based on the report, what evidence supports this assessment, and what remains unknown.]328329## Routing330| Role | Reason |331|------|--------|332| **Primary:** ${PRIMARY} | Lead responder for ${CATEGORY} incidents |333| **Secondary:** ${SECONDARY} | Supporting expertise for ${CATEGORY} |334| **Notify:** ${NOTIFY:-none} | Awareness for ${SEVERITY} severity |335336## Evidence337$(echo "$INCIDENT_TEXT" | head -10 | sed 's/^/- /')338339## Recommended First Actions3401. Acknowledge the incident and update the task board3412. Reproduce or verify the reported symptoms3423. Assess actual blast radius and confirm severity343EOF344345echo "Classification card written to: $CLASSIFICATION_FILE"346```347348### 9. Notify the Assigned Responder349350```bash351# Send classification to primary responder352bash /home/shared/scripts/send-mail.sh "$PRIMARY" <<EOF353[${SEVERITY}] Incident ${INCIDENT_ID} assigned to you354355Classification: ${SEVERITY} ${CATEGORY}356Urgency: ${URGENCY}357Affected: ${COMPONENTS}358Blast radius: ${BLAST_RADIUS}359360Summary: ${SUMMARY_LINE}361362Full classification card: ${CLASSIFICATION_FILE}363364Recommended first actions:3651. Acknowledge by updating task status to in_progress3662. Reproduce or verify the reported symptoms3673. Assess actual blast radius and confirm severity368369$(if [ "$SEVERITY" = "P0" ]; then370 echo "This is a P0 -- drop everything and respond immediately."371fi)372EOF373374# Notify secondary375bash /home/shared/scripts/send-mail.sh "$SECONDARY" <<EOF376[FYI] Incident ${INCIDENT_ID} -- you are secondary responder377378${SEVERITY} ${CATEGORY} incident assigned to ${PRIMARY}.379You may be pulled in for assistance.380Classification card: ${CLASSIFICATION_FILE}381EOF382383# Notify manager for P0/P1384if [ -n "$NOTIFY" ]; then385 bash /home/shared/scripts/send-mail.sh "$NOTIFY" <<EOF386[${SEVERITY}] Incident ${INCIDENT_ID} classified and routed387388Category: ${CATEGORY}389Assigned to: ${PRIMARY} (primary), ${SECONDARY} (secondary)390Blast radius: ${BLAST_RADIUS}391Summary: ${SUMMARY_LINE}392393Classification card: ${CLASSIFICATION_FILE}394EOF395fi396397echo "Notifications sent."398```399400### 10. Create Task and Register Artifact401402```bash403# Create a task for tracking404TASK_ID=$(bash /home/shared/scripts/task.sh add \405 --subject "[${SEVERITY}] ${INCIDENT_ID}: ${SUMMARY_LINE}" \406 --description "Classified incident. See ${CLASSIFICATION_FILE} for details." \407 --owner "$PRIMARY" 2>/dev/null | jq -r '.id' 2>/dev/null)408409echo "Task created: $TASK_ID"410411# Register the classification card as an artifact412bash /home/shared/scripts/artifact.sh register \413 --name "classification-${INCIDENT_ID}" \414 --type "incident-classification" \415 --path "$CLASSIFICATION_FILE" \416 --description "${SEVERITY} ${CATEGORY} incident: ${SUMMARY_LINE}"417418echo "Artifact registered."419420# Log the classification421mkdir -p ~/classifications422cat >> ~/classifications/log.jsonl <<EOF423{"timestamp":"${TIMESTAMP}","incident_id":"${INCIDENT_ID}","severity":"${SEVERITY}","category":"${CATEGORY}","urgency":"${URGENCY}","blast_radius":"${BLAST_RADIUS}","components":"${COMPONENTS}","primary":"${PRIMARY}","secondary":"${SECONDARY}","task_id":"${TASK_ID}","classified_by":"${AGENT_NAME}"}424EOF425```426427## Quality Checklist428429- [ ] Incident report has been read completely before classifying430- [ ] Severity is justified by matching specific criteria (not a gut feeling)431- [ ] Category is assigned based on the primary nature of the issue432- [ ] Affected components are identified (or explicitly marked as unknown)433- [ ] Blast radius is assessed (all users / subset / single / internal)434- [ ] Past similar incidents were checked for patterns435- [ ] Primary and secondary responders are assigned based on category436- [ ] Classification card is written with all fields populated437- [ ] Primary responder is notified with severity, summary, and first actions438- [ ] Manager is notified for P0 and P1 incidents439- [ ] Task is created on the task board with the correct owner440- [ ] Classification is logged for future pattern analysis