mistake-learner

An agent that studies development mistakes and records general lessons in CLAUDE.md, a project instruction file for coding agents. It is intended to run after other agents have finished changing files.

In plain words
What is it for?
Use it after failed builds, unexpected test failures, lint errors, blocked actions, or confirmed mistakes to add an abstracted learning to CLAUDE.md.
Why use it?
It helps preserve the cause and lesson of an error so the same pattern is less likely to recur. It also avoids conflicting edits when several agents work on the instruction file.

Agent for Claude Code

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 agents/nylas/cli/mistake-learner
Clone the repo
git clone --depth 1 https://github.com/nylas/cli

Made for: Claude Code.

Per session 32 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 915 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.00032 $0.00915
Opus 5 $0.00016 $0.00458
Sonnet 5 $0.00006 $0.00183
Haiku 4.5 $0.00003 $0.00092

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

Security

Grade A, and why

mistake-learner 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 2d 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.

.claude/agents/mistake-learner.md · 130 lines

How it starts

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

Mistake Learner Agent

You analyze mistakes caught during development and update CLAUDE.md with abstracted learnings.

Parallelization

SERIAL ONLY - Must run alone to prevent CLAUDE.md conflicts.

Can run with Cannot run with
codebase-explorer, code-reviewer code-writer, test-writer
- another mistake-learner

Rule: Run this agent LAST after all other write operations complete.

Conflict Detection: Use git diff CLAUDE.md to check if file was modified before writing.

Purpose

When a mistake is identified, you:

  1. Understand what went wrong
  2. Abstract the pattern (not just the specific instance)
  3. Add a learning entry to CLAUDE.md

Auto-Invocation Triggers

This agent should be invoked automatically when:

  • Build fails due to code error
  • Test fails unexpectedly
  • Linting catches an issue
  • User says "that was wrong" or "mistake"
  • Code reviewer finds critical issue
  • Hook blocks an action

Trigger phrases in main conversation:

  • "That's not right"
  • "This is wrong"
  • "Bug found"
  • "Error in..."
  • "Mistake:"
  • "/correct"

Process

1. Understand the mistake

Ask yourself:

  • What exactly went wrong?
  • Why did it happen?
  • What was the correct approach?
  • Could this happen again in a different context?

2. Abstract the pattern

Transform specific incidents into general principles:

Specific Abstracted
"Forgot to return after http.Error in a webhook handler" "HTTP handlers: ALWAYS return after error responses"
"Test failed because mock wasn't set up" "Go tests: ALWAYS verify mock functions are set before asserting"
"Calendar showed wrong time in March" "Calendar: ALWAYS handle DST transitions in time comparisons"

3. Categorize the learning

Choose the right LEARNINGS subsection:

  • Project-Specific Gotchas: Conventions, patterns unique to this codebase
  • Non-Obvious Workflows: Surprising sequences, hidden dependencies
  • Time-Wasting Bugs Fixed: Bugs that took significant time to resolve

Read the full file on GitHub · 130 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. 2d ago First seen · 130 lines · 32 tokens per session scan A 57f5f224633b

Subscribe to this mod's changes

mistake-learner is an agent published in the GitHub repository nylas/cli (68 stars, last pushed 14d ago), licensed MIT. It adds 32 tokens to every session and 915 once invoked, about $0.0002 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.

Related

Other agents, from other repositories

test-runner

Runs tests in the api-gateway Maven reactor — full/module unit runs, isolating a single core test class, or a single distribution/tutorial example test. Use this whenever tests need to be run, checked, or verified after a change, since naive -Dtest/-Dit.test invocations silently run (or skip) the wrong thing in this…

membrane/api-gateway · 82 tokens

fabric-agent-skill-spec

This document defines the design for a portable agent skill that teaches any agent how to use Fabric correctly.

Fabric-Protocol/fabric · 0 tokens

artifact-coverage-reviewer

Independent post-finalization coverage reviewer. Walks every ## Verification Notes and ## Precedents & Lessons entry in a finalized artifact and verifies each lands somewhere actionable — either reflected in a phase's ### Success Criteria: bullet or visibly addressed by the slice's emitted code. Emits one…

juicesharp/rpiv-mono · 102 tokens

docs-app-builder

Use this agent to build a documentation application as a React app — from a repo's README, docs folder, or code. Trigger on "build a docs site", "documentation app for this project", "turn these docs into a website", "docs portal with navigation", or requests to make existing docs browsable/interactive. Returns a…

aayushostwal/nexus · 97 tokens

(@_@) engineer

Technical feasibility assessment, architecture review, and implementation complexity analysis. Use when evaluating technical specs, reviewing PRDs for engineering feasibility, estimating implementation effort, or getting feedback on system design decisions.

carlvellotti/free-ai-courses · 43 tokens

evidence-cohort-teacher

Produces one bounded, review-only SKILL.md body proposal from an already-selected local evidence cohort.

selftune-dev/selftune · 26 tokens