mistake-reflection

A procedure for recording mistakes made during coding-agent work in a project learning file. It also requires reviewing recent mistakes so the same problems are less likely to happen again.

In plain words
What is it for?
It helps document incorrect claims, failed tests, missing files, skipped required steps and statements that were not properly verified.
Why use it?
It turns corrections, failed checks and skipped instructions into a visible record instead of letting them disappear after the task. This helps the agent respond to errors systematically.

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/a2aproject/a2a-python/mistake-reflection
Any agent
npx skills add a2aproject/a2a-python --skill mistake-reflection
Clone the repo
git clone --depth 1 https://github.com/a2aproject/a2a-python

Made for: Claude Code, Codex.

Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,209 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.00060 $0.01209
Opus 5 $0.00030 $0.00605
Sonnet 5 $0.00012 $0.00242
Haiku 4.5 $0.00006 $0.00121

Measured yesterday against content hash 22e4f978515b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mistake-reflection 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 yesterday.

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.

.agents/skills/mistake-reflection/SKILL.md · 111 lines

How it starts

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

Mistake Reflection

Implements the mistake-handling step of AGENTS.md §"Mandatory workflow".

When to load this skill

Trigger on ANY of these, without waiting for the user to ask:

  • The user corrects a factual claim, code change, or assumption.
  • A tool result contradicts something you just stated or did (lint failure, test failure, type-check failure, file not found, command exit non-zero on something you said would succeed).
  • You re-read a file or doc and realize a prior statement was wrong or unverified.
  • You realize mid-task that you skipped a required step (e.g. didn't read docs/ai/coding_conventions.md, docs/ai/mandatory_checks.md, or docs/ai/evidence_rules.md at task start).
  • You stated an inference as a fact without a file:line citation and later had to walk it back.

If unsure whether something counts: it counts. False positives are cheap; false negatives are how the same mistake recurs.

Procedure

Do these in order. Do NOT defer to the end of the task.

  1. Acknowledge the mistake to the user explicitly in the current response. One or two sentences. No hedging, no minimization.
  2. Read recent entries in docs/ai/ai_learnings.md (at minimum the last 5 entries, or the whole file if shorter). If the current mistake is a recurrence of an existing rule, say so explicitly and reference the prior entry's date — do not silently duplicate.
  3. Append a new entry to docs/ai/ai_learnings.md using the template below. Append; do not rewrite existing entries.
  4. Continue the original task only after steps 1–3 are done.

Entry template

Copy this verbatim, fill in each field, append to the end of the file (after the existing --- separator):

## YYYY-MM-DD — <one-line summary>

- **Mistake**: What went wrong. Be concrete. Quote the wrong claim or
  describe the wrong action. Include `file:line` references where
  applicable.
- **Trigger**: How the mistake surfaced (user correction, tool output,
  self-review). Include the specific signal if it was a tool result.
- **Root cause**: Why it happened. Distinguish between (a) missing
  knowledge, (b) skipped verification step, (c) false assumption from
  pattern-matching, (d) workflow gap. Avoid generic "I didn't think
  carefully" — name the specific failure mode.
- **Recurrence of**: If this matches an existing rule, link to the
  prior entry's date. Otherwise write "new".
- **Rule**: A concrete, checkable rule that would have prevented this.
  Phrase as an imperative ("Before X, do Y"). If the rule already
  exists and was violated, the rule should be about *enforcement*
  (e.g. a check to add to a skill, a step to add to AGENTS.md), not a
  restatement of the existing rule.

Read the full file on GitHub · 111 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. yesterday First seen · 111 lines · 60 tokens per session scan A 22e4f978515b

Subscribe to this mod's changes

mistake-reflection is a skill published in the GitHub repository a2aproject/a2a-python (2,116 stars, last pushed 5d ago), licensed Apache-2.0. It adds 60 tokens to every session and 1,209 once invoked, about $0.0003 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.