failure-mode-capture

failure-mode-capture is a skill for Claude Code, Codex from sjarmak/coding-agent-workflows. It costs 92 tokens per session (943 once invoked), scanned A, original, MIT.

A workflow for recording lessons from bugs or near-misses in AGENTS.md, a file that gives coding agents project instructions.

In plain words
What is it for?
Use it after a bug, regression, near-miss, or code review when a reusable prevention should be added to the project’s instructions.
Why use it?
It helps prevent an agent from repeating a known mistake and avoids adding duplicate or overly specific rules.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/sjarmak/coding-agent-workflows/failure-mode-capture
Any agent
npx skills add sjarmak/coding-agent-workflows --skill failure-mode-capture
Clone the repo
git clone --depth 1 https://github.com/sjarmak/coding-agent-workflows

Made for: Claude Code, Codex.

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 failure-mode-capture

README.md
[![agentmods](https://agentmods.dev/badge/skills/sjarmak/coding-agent-workflows/failure-mode-capture.svg)](https://agentmods.dev/skills/sjarmak/coding-agent-workflows/failure-mode-capture)
Your own site
<a href="https://agentmods.dev/skills/sjarmak/coding-agent-workflows/failure-mode-capture"><img src="https://agentmods.dev/badge/skills/sjarmak/coding-agent-workflows/failure-mode-capture.svg" alt="Measured on agentmods" height="20"></a>
Per session 92 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 943 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 $0.00092 $0.00943
Opus 5 $0.00046 $0.00472
Sonnet 5 $0.00018 $0.00189
Haiku 4.5 $0.00009 $0.00094

Measured 4d ago against content hash c5dfd56938cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

failure-mode-capture 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 4d 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.

source/skills/failure-mode-capture/SKILL.md · 85 lines

How it starts

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

Failure-Mode Capture

Turn a real incident into a one-line prevention in AGENTS.md, so the next agent doesn't repeat it. This is how the failure-mode layer accumulates — deliberately, one verified lesson at a time, not by dumping everything that ever went wrong.

Read context-layering first: AGENTS.md owns project-wide preventions; area-only lessons go in that area's COMPASS.md; host/session habits stay in memory.

When to use

  • Right after a bug, regression, or near-miss whose cause generalizes
  • The user says "capture this" / "don't let this happen again" / "add a guardrail"
  • A code review surfaces a repeated mistake worth encoding once

ZFC boundary

  • Mechanism: read AGENTS.md and the memory files, run the similarity scan, count lines against the budget, write the entry.
  • Model: decide whether the lesson generalizes, which layer it belongs in, whether it duplicates an existing entry, and how to phrase the prevention.

How it works

1. Phrase the prevention (model)

One line: the action to avoid, then the consequence it prevents. Concrete and checkable.

Don't run migrations against the read replica — it has no write grant and fails silently mid-batch.

If you can't name a concrete consequence, it's not a failure-mode prevention — it's a style preference, and belongs in the bundle or a code review, not here.

2. Decide the layer (model)

  • Generalizes across the repo → AGENTS.md failure-mode log.
  • Specific to one area → that area's COMPASS.md "Failure modes seen here".
  • A local command or personal habit → memory, not here.

3. Dedup guard against memory (mechanism + model)

First, if CLAUDE.md is a symlink to AGENTS.md (a single-source project per context-layering), there is no separate memory layer — the dedup is moot and you simply append to the one file. Otherwise, scan CLAUDE.md and any instinct store for an overlapping fact (mechanical similarity flag over the candidate text). If a match surfaces:

Read the full file on GitHub · 85 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. 4d ago First seen · 85 lines · 92 tokens per session scan A c5dfd56938cf

Subscribe to this mod's changes

failure-mode-capture is a skill published in the GitHub repository sjarmak/coding-agent-workflows (2 stars, last pushed 1mo ago), licensed MIT. It adds 92 tokens to every session and 943 once invoked, about $0.0005 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-31.

Related

Other skills, from other repositories

deep-init

Generate an agent-agnostic, two-tier context layer for a codebase — a lean, always-loaded CLAUDE.md plus a deep, on-demand .ai/docs/ layer (business rules, live DB schema + ORM drift, cross-component workflows, and the WHY: ADRs + a knowledge log), every claim grounded to file:line and verified to exist. Built for…

deepfusionlabs/deep-init · 128 tokens

context-engineering

Optimizes agent context setup. Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure rules files and context for a project.

addyosmani/agent-skills · 43 tokens

comet-memory

使用于 Comet 需要根据有界语义评审包判断是否值得保存个人记忆、候选、更新、遗忘或跳过时。.

rpamis/comet · 38 tokens

recall-memory

Recall relevant long-term memories on demand. Given a topic or question, judges relevance from pre-loaded metadata, loads only relevant files, and returns a concise summary to the main agent.

clacky-ai/openclacky · 40 tokens

planning-with-files

Persistent file-based planning for multi-step AI-agent work. Keeps taskplan.md, findings.md, and progress.md on disk; lifecycle hooks inject selected project planning context. Automatic recovery reads project planning files only. Explicit session-catchup.py --metadata reads same-project local agent session records and…

mxyhi/ok-skills · 117 tokens

immune

Hybrid adaptive memory: Cheatsheet (positive patterns pre-generation) and Immune (negative patterns post-generation) with Hot/Cold tiered auto-learning. Triggers on: "scan for errors", "immune scan", "check output quality", "antibody scan". NOT for PR review (use pr-review) or repo audits (use repo-sentinel).

Mathews-Tom/armory · 73 tokens