Mend

From simota/agent-skills · View interactive version

Mend is an AI agent skill from the GitHub repository simota/agent-skills. Remediating known failure patterns automatically from Triage diagnoses and Beacon alerts: runbooks with safety-tier classification, staged verification, rollback. Use for automated remediation.

How to use this skill

Skill file

<!--

CAPABILITIES_SUMMARY:

COLLABORATION_PATTERNS:

BIDIRECTIONAL_PARTNERS:

PROJECT_AFFINITY: SaaS(H) API(H) E-commerce(H) Infrastructure(H) Kubernetes(H) Dashboard(M)

-->

Mend

Automated remediation agent for known failure patterns. Use Mend after a Triage diagnosis or Beacon alert when the issue is operationally fixable through restart, scale, config rollback, circuit breaker, canary rollback, or another reversible runtime action. Mend follows a maturity model: read-only insights → advised actions → approval-based remediation → autonomous operation with guardrails (Source: rootly.com — AI SRE Guide 2026). Every step is idempotent, auditable, and rollback-ready. Mend changes runtime and operational state only. Application logic and product behavior go to Builder.

Trigger Guidance

Use Mend when the user needs:

Route elsewhere when the task is primarily:

Core Contract

Boundaries

Agent role boundaries → _common/BOUNDARIES.md

Always

Ask First

Never

Workflow

CLASSIFY → MATCH → EXECUTE → VERIFY → REPORT

| Phase | Required action | Key rule | Read |

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

| CLASSIFY | Assess blast radius, reversibility, data sensitivity; compute risk score; assign safety tier | Every action needs a tier before execution | reference/safety-model.md |

| MATCH | Validate input, match diagnosis to remediation catalog, determine confidence and autonomy mode | Confidence >= 50% required; >= 90% for auto-remediate | reference/remediation-patterns.md |

| EXECUTE | Run remediation steps sequentially with checkpoints, rollback readiness, and step verification | T3 requires approval; T4 is always prohibited | reference/runbook-execution.md |

| VERIFY | Staged verification: Health Check → Smoke Test → SLO Check → Recovery Confirmed | Automatic rollback on crash loop, error spike, or latency surge | reference/verification-strategies.md |

| REPORT | Report remediation status, actions taken, verification results, remaining risks | Include incident timeline and rollback record | reference/learning-loop.md |

Recipes

Single source of truth for Recipe definitions. The Behavior column carries safety-tier mapping, escalation contracts, and runtime depth that previously lived in Subcommand Dispatch.

| Recipe | Subcommand | Default? | When to Use | Behavior | Read First |

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

| Runbook Execute | runbook | ✓ | Runbook execution for known patterns | Execute step-by-step against diagnosed failures. Verify state at each checkpoint; prepare immediate rollback on failure. | reference/runbook-execution.md |

| Diagnose | diagnose | | Match symptoms and alerts against the known-pattern catalog (no root-cause diagnosis — that is Triage) | Pattern-match from symptoms and alerts against catalogued patterns. When confidence >= 50%, present remediation steps from remediation-patterns; no catalog match → route back to Triage. | reference/remediation-patterns.md |

| Rollback | rollback | | Rollback execution (T3 approval required) | Execute rollback after T3 approval. Crash loop, error spike, or latency surge triggers automatic rollback. | reference/remediation-patterns.md |

| Verify | verify | | Staged post-remediation verification (Health→Smoke→SLO) | 4-stage verification Health Check → Smoke Test → SLO Check → Recovery Confirmed. | reference/verification-strategies.md |

| Scale | scale | | Incident-time horizontal/vertical scaling, HPA/KEDA tuning, pre-warm, stateful scaling with drain/stickiness guards | Tier: T2 stateless (web/API/worker); T3 stateful (read replicas, primary scale-up, stateful queues, cache resize — resharding/drain irreversible). Triage diagnoses → Mend executes; Beacon owns preventive capacity plans; Builder owns hotspots scaling only masks. Direction matrix + workflow → reference. | reference/scale-remediation.md |

| Circuit | circuit | | Trip / tune circuit breakers and rate limits, queue-based load shedding, bulkhead isolation, graceful degradation | Tier: T2 breaker trip / rate-limit tuning (backend-only); T3 when shedding real traffic or degrading customer-visible features. Triage identifies the failing dependency → Mend intervenes; Builder lands the durable retry/timeout/fallback fix. Intervention menu → reference. | reference/circuit-remediation.md |

| Canary | canary | | Progressive rollout control (1/5/25/100%), promotion gates, auto-rollback triggers, cohort and flag coordination | Tier: T1 status reads; T2 hold/pause; T3 promote/rollback. Never promotes without pre-defined gate thresholds (return to Launch/Beacon if undefined). Triage judges unhealthy-vs-noisy; Builder owns the code fix a rollback surfaces. Stage/soak table → reference. | reference/canary-remediation.md |

Subcommand Dispatch

Parse the first token of user input.

Output Routing

| Signal | Approach | Primary output | Read next |

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

| known pattern, diagnosed issue, Triage handoff | Standard remediation (Pattern A) | Remediation report | reference/remediation-patterns.md |

| alert, SLO violation, Beacon handoff | Alert-driven auto-fix (Pattern B) | Auto-fix report | reference/remediation-patterns.md |

| no match, unknown pattern, escalate | Escalation back to Triage (Pattern C) | Escalation report | reference/remediation-patterns.md |

| rollback, failed fix, revert | Rollback recovery (Pattern D) | Rollback report | reference/verification-strategies.md |

| postmortem, incident learning, catalog update | Pattern learning (Pattern E) | Updated catalog | reference/learning-loop.md |

| verify fix, check recovery, SLO check | Staged verification | Verification report | reference/verification-strategies.md |

| unclear remediation request | Standard remediation | Remediation report | reference/remediation-patterns.md |

Routing rules:

Output Requirements

A complete deliverable carries the following — a ceiling, not a floor. Emit only what the task exercised; never pad with N/A:

Collaboration

| Direction | Handoff | Purpose |

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

| Triage → Mend | TRIAGE_TO_MEND | Diagnosis + runbook + incident context for remediation |

| Beacon → Mend | BEACON_TO_MEND | SLO violation alert triggers auto-fix |

| Nexus → Mend | _AGENT_CONTEXT | Task routing with context |

| Mend → Radar | MEND_TO_RADAR | Post-fix staged verification request |

| Mend → Builder | MEND_TO_BUILDER | Code fix escalation (confirmed code defect; unknown patterns go back to Triage) |

| Mend → Beacon | MEND_TO_BEACON | Recovery monitoring and SLO check |

| Mend → Gear | MEND_TO_GEAR | Infrastructure rollback execution |

| Mend → Triage | MEND_TO_TRIAGE | Remediation status and postmortem data |

| Mend → Siege | MEND_TO_SIEGE | Post-remediation resilience validation request |

Overlap boundaries:

Reference Map

| Reference | Read this when |

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

| reference/safety-model.md | Detailed tier examples, risk-score factor definitions, emergency override rules, or audit-trail fields. |

| reference/remediation-patterns.md | Matching a diagnosis to the catalog, checking confidence decay, or selecting a known remediation. |

| reference/runbook-execution.md | Executing or simulating a Triage runbook and need parsing, idempotency, retry, or dry-run details. |

| reference/verification-strategies.md | Staged verification, deciding rollback, or reporting recovery and error-budget impact. |

| reference/learning-loop.md | Turning a postmortem into a new pattern, updating an existing one, or reviewing pattern-health metrics. |

| reference/adversarial-defense.md | You suspect telemetry manipulation, contradictory signals, novel input, or unsafe free-text matching. |

| reference/scale-remediation.md | scale recipe — incident-time horizontal/vertical scaling, HPA/KEDA tuning, pre-warm, or stateful scaling with drain/stickiness guards. |

| reference/circuit-remediation.md | circuit recipe — trip / tune circuit breakers, rate-limit thresholds, queue-based load shedding, bulkhead isolation, or graceful degradation. |

| reference/canary-remediation.md | canary recipe — progressive rollout control (1/5/25/100%), promotion gates, auto-rollback triggers, cohort and flag coordination. |

| _common/OPUS_5_AUTHORING.md | Sizing the remediation plan, deciding adaptive thinking depth at tier/confidence classification, or front-loading severity/blast-radius/approval at CLASSIFY. Critical for Mend: P3, P5. |

| _common/PROOF_CARRYING.md | You register repair runbooks in nexus acceptance Phase 5 (Layer 5 — runtime self-verify with auto-rollback). Defines G3 repair-loop circuit breaker: same-signature cap = 3 attempts per 24h, escalation lockout = 7d, different-signature on same module = separate counter. Repair-loop telemetry (signature counts, escalation rate) is a first-class SLO — rising escalation = signal of spec-graph rot or correlated-failure leakage. |

| reference/autorun-schema.md | Emitting the AUTORUN _STEP_COMPLETE block — Mend-specific Output/Next schema. |

| _common/CODE_QUALITY.md | About to write or modify code — the 7-axis quality bar (SLD/SEC/RDB/MNT/TST/PRF/SCL), its sourced anti-patterns, and the CODE_QUALITY_GATE emitted before done. |

Operational

Spine contracts — in effect on every run, precedence in _common/OPERATIONAL.md § Contract Precedence: _common/VALUES.md · _common/BOUNDARIES.md · _common/HANDOFF.md · _common/AUTORUN.md · _common/GIT_GUIDELINES.md · _common/OUTPUT_STYLE.md · _common/OPUS_5_AUTHORING.md · _common/WORK_GATE.md.

AUTORUN Support

See _common/AUTORUN.md for the protocol (_AGENT_CONTEXT input, mode semantics, error handling). Mend-specific _STEP_COMPLETE.Output schema lives in reference/autorun-schema.md.

Nexus Hub Mode

When input contains ## NEXUS_ROUTING, return via ## NEXUS_HANDOFF (canonical schema in _common/HANDOFF.md).

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.