failure-add

failure-add is a command for coding agents from smicolon/ai-kit. It costs 16 tokens per session (661 once invoked), scanned A, original, MIT.

A command for recording a project failure or mistake in a shared failure log.

In plain words
What is it for?
Use it to add an incident, error, or lesson from a failed attempt to the project's failure log.
Why use it?
It keeps problems from being forgotten and makes them available for future reference.

Command

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 commands/smicolon/ai-kit/failure-add
Clone the repo
git clone --depth 1 https://github.com/smicolon/ai-kit

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-add

README.md
[![agentmods](https://agentmods.dev/badge/commands/smicolon/ai-kit/failure-add.svg)](https://agentmods.dev/commands/smicolon/ai-kit/failure-add)
Your own site
<a href="https://agentmods.dev/commands/smicolon/ai-kit/failure-add"><img src="https://agentmods.dev/badge/commands/smicolon/ai-kit/failure-add.svg" alt="Measured on agentmods" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 661 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown 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.00016 $0.00661
Opus 5 $0.00008 $0.00331
Sonnet 5 $0.00003 $0.00132
Haiku 4.5 $0.00002 $0.00066

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

Security

Grade A, and why

failure-add 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 3d 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.

packs/failure-log/commands/failure-add.md · 107 lines

How it starts

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

Add Failure to Log

Record a mistake to prevent repeating it in future sessions.

Steps

  1. Parse the user's input to understand the failure:

    • What was the context?
    • What was the mistake?
    • What is the correct approach?
  2. Determine failure type:

    • Pattern Mistake: Recurring pattern violation (imports, naming, structure)
    • Failed Approach: An approach that doesn't work
  3. Determine category (ask if unclear):

    • imports - Wrong import patterns
    • security - Missing security checks
    • testing - Wrong test approaches
    • architecture - Structural mistakes
    • conventions - Code style violations
  4. Check if failure log exists at .claude/failure-log.local.md:

    • If not, create it with the template below
    • If yes, read existing content
  5. Add the new failure entry:

    • Update last_updated timestamp in frontmatter
    • Add entry under appropriate section (Pattern Mistakes or Failed Approaches)
    • Place newest entries first
  6. Confirm the failure was logged with a brief summary

Template for New File

---
enabled: true
last_updated: [CURRENT_ISO_TIMESTAMP]
---

# Failure Log

This log tracks mistakes to prevent repeating them across sessions.

## Pattern Mistakes

[NEW_ENTRY_HERE]

## Failed Approaches

_No failed approaches logged yet._

Entry Format

For Pattern Mistakes

### [YYYY-MM-DD] Brief descriptive title
**Context:** What was being done when the mistake occurred
**Mistake:** The specific error or violation
**Correct:** The correct approach to use instead
**Category:** [category]

For Failed Approaches

### [YYYY-MM-DD] Brief descriptive title
**Context:** What was being attempted
**What failed:** Why the approach didn't work
**Better approach:** What works instead
**Category:** [category]

Examples

User says: "Log that I used relative imports in Django"

Entry created:

### [2026-01-01] Used relative imports in Django service
**Context:** Writing business logic in user service
**Mistake:** Used `from .models import User` relative import
**Correct:** Use `import users.models as _users_models` with alias pattern
**Category:** imports

Read the full file on GitHub · 107 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. 3d ago First seen · 107 lines · 16 tokens per session scan A 4062a06fc190

Subscribe to this mod's changes

failure-add is a command published in the GitHub repository smicolon/ai-kit (6 stars, last pushed today), licensed MIT. It adds 16 tokens to every session and 661 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-31.