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.
npx skills add alexmond/alexmskills --skill learn-on-failuregit clone --depth 1 https://github.com/alexmond/alexmskillsWrote 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.
[](https://agentmods.dev/skills/alexmond/alexmskills/learn-on-failure)<a href="https://agentmods.dev/skills/alexmond/alexmskills/learn-on-failure"><img src="https://agentmods.dev/badge/skills/alexmond/alexmskills/learn-on-failure/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/alexmond/alexmskills/learn-on-failure"><img src="https://agentmods.dev/badge/skills/alexmond/alexmskills/learn-on-failure.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00045 | $0.00927 |
| Opus 5.5 | $0.00018 | $0.00371 |
| Sonnet 5.5 | $0.00009 | $0.00185 |
| Haiku 4.5 | $0.00005 | $0.00093 |
Grade A, and why
learn-on-failure 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 2mo 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.
How it starts
The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Codex: Read the client path before applying this workflow.
Save a learning to project memory
Try it:
/learn-on-failure:learn-on-failure testing "BCrypt accepts $2a$ but not $2y$ hashes"— or just say "remember this: ...". Mostly it fires automatically after a multi-cycle fix.
$ARGUMENTS
Locate the project memory directory
Claude Code keeps per-project memory at ~/.claude/projects/<project-slug>/memory/, where
<project-slug> is derived from the current project's absolute path. Do not hardcode a path —
the active project's memory directory is provided in the session's memory/system context. Use that
path. Within it:
MEMORY.mdis the index.- Topic files (e.g.
dependencies.md,testing.md,debugging.md) hold detailed, subject-specific notes.
If the memory directory or MEMORY.md does not yet exist, create them.
Determine the learning
If triggered automatically (multi-cycle resolution), synthesise the learning from the conversation:
- What was the root cause of the extra cycle(s)?
- What assumption or gap in knowledge caused the first attempt to fail?
- What is the correct approach / API / behaviour?
- What should be checked first next time to avoid the same detour?
If triggered by the user, record exactly what they stated in $ARGUMENTS.
Steps
-
Read the current
MEMORY.mdindex in the project's memory directory. -
Check whether a relevant topic file already exists in that same directory. If so, read it too.
-
Decide where to write:
- Short, self-contained insight that fits an existing
MEMORY.mdsection → add it there (keep file ≤ 200 lines). - Detailed or topic-specific learning → append to or create a dedicated topic file, then add/update a one-line
reference in
MEMORY.md.
- Short, self-contained insight that fits an existing
-
Write in concise, actionable form:
- Bullet points, not prose.
- Lead with what to do / what to check, follow with why.
- If it supersedes an existing note, update or remove the old one.
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 2mo ago Changed · -55 tokens per session a7709af63a7e
- 3mo ago First seen · 92 lines · 100 tokens per session scan A 46cd6648da3f
learn-on-failure is a skill published in the GitHub repository alexmond/alexmskills (11 stars, last pushed 1mo ago), licensed MIT. It adds 45 tokens to every session and 927 once invoked, about $0.0002 per session on Opus 5.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.
learn-on-failure compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| learn-on-failurealexmond/alexmskills | Skill | 11 | 1mo ago | MIT | A | 45 | Claude Code |
| weekly-digeststhedotmack/claude-mem | Skill | 122k | today | Apache-2.0 | A | 93 | Claude Code |
| cloud-syncthedotmack/claude-mem | Skill | 122k | today | Apache-2.0 | A | 64 | Claude Code |
| screenpipethedotmack/claude-mem | Skill | 122k | today | Apache-2.0 | A | 46 | Claude Code |
| emerging-techniques-long-contextdavila7/claude-code-templates | Skill | 35k | today | MIT | A | 78 | Claude Code, Codex |
| forgetasgeirtj/system_prompts_leaks | Skill | 74k | today | CC0-1.0 | A | 0 | Claude Code, Codex |
| hive.note-takingaden-hive/hive | Skill | 11k | 4d ago | Apache-2.0 | A | 30 | Claude Code, Codex |