incident-patterns

incident-patterns is a command for Claude Code from studioKjm/ai-harness-template. It costs 17 tokens per session (1,020 once invoked), scanned A, original, MIT.

A command that compares multiple past incidents to find repeated root causes and contributing factors. An incident is a production problem; the command groups them over a chosen period, with the default covering the last 90 days.

In plain words
What is it for?
Use it for quarterly reviews, after a serious outage, before a major architecture change, or when deciding where reliability work should be invested.
Why use it?
It shows whether failures are isolated events or signs of a recurring system weakness. That evidence can guide decisions about monitoring, testing, documentation, refactoring, or architecture changes.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python3 .harness/methodologies/incident-review/scripts/inc.py patterns --days 90.

Part of the harness plugin — 44 commands, 11 agents shipped together

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/studioKjm/ai-harness-template
agentmods
npx agentmods add commands/studiokjm/ai-harness-template/incident-patterns

Made for: Claude Code.

Or install harness, the plugin that ships this one along with the rest of its 44 commands, 11 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for incident-patterns

README.md
[![agentmods](https://agentmods.dev/badge/commands/studiokjm/ai-harness-template/incident-patterns.svg)](https://agentmods.dev/commands/studiokjm/ai-harness-template/incident-patterns)
Your own site
<a href="https://agentmods.dev/commands/studiokjm/ai-harness-template/incident-patterns"><img src="https://agentmods.dev/badge/commands/studiokjm/ai-harness-template/incident-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,020 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.01020
Opus 5 $0.00009 $0.00510
Sonnet 5 $0.00003 $0.00204
Haiku 4.5 $0.00002 $0.00102

Measured 6d ago against content hash 27bd882ce701, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

incident-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

methodologies/incident-review/commands/incident-patterns.md · 127 lines

How it starts

The opening of the file, as written. The whole thing — 127 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/incident-patterns — Pattern Analysis Across Incidents

One incident is bad luck. Three with the same root cause is a system flaw.

When to use

  • Quarterly retrospective — surface recurring causes
  • Before deciding on a major architecture change — validate it addresses real pain
  • After a sev1 — check if you've seen the same pattern before
  • When deciding what to invest in (monitoring? testing? refactoring?)

Usage

/incident-patterns [--days N]

Default: last 90 days. Adjust based on incident volume.

Output format

Incident pattern analysis (last 90 days)
──────────────────────────────────────────────────
Total incidents: 12
By severity:
  sev1: 1
  sev2: 3
  sev3: 6
  sev4: 2

Top root causes (recurring):
  [3x] DB connection pool exhausted under load spike
  [2x] Stale cache served deleted data

Contributing factor categories:
   5x  monitoring
   4x  documentation
   3x  testing
   2x  deployment

Instructions

Step 1 — Run the script

python3 .harness/methodologies/incident-review/scripts/inc.py patterns --days 90

Step 2 — Interpret recurrence

Recurrence Meaning Action
1x cause Probably bad luck Note, but don't over-engineer
2x cause (different incidents) Suspicious Investigate why action items from first didn't prevent second
3x+ cause Systemic flaw Major investment justified — refactor / new monitoring / process change

Step 3 — Interpret contributing factors

Categories aggregate across all incidents (not just recurring ones). Top categories indicate investment areas:

  • monitoring >5x → invest in observability (consider + observability-first methodology when added)
  • documentation >5x → invest in runbooks
  • testing >5x → invest in test coverage / CI
  • deployment >5x → invest in rollout safety
  • dependencies >5x → audit external services

Step 4 — Convert pattern findings to durable artifacts

Recurring patterns should become:

Read the full file on GitHub · 127 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 127 lines · 17 tokens per session scan A 27bd882ce701

Subscribe to this mod's changes

incident-patterns is a command published in the GitHub repository studioKjm/ai-harness-template (43 stars, last pushed 3mo ago), licensed MIT. It adds 17 tokens to every session and 1,020 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.