Automatic mistake capture and proactive lesson injection for AI coding agents. Mines conversation logs for mistake patterns, structures them as indexed lessons, and injects relevant warnings before the agent repeats the mistake.
Interactively add a new lesson to the store through a short conversation
Retroactively cancel a lesson tag you just emitted — prevents it from being promoted or removes it if already active. Works for lessons in the DB (any status) and for lessons emitted this session but not yet scanned.
View and edit lessons-learned configuration, with explanations of what each setting does
Audit the lessons DB for quality issues — dead triggers, misclassified types, truncated summaries, near-duplicates, and guards that fire too broadly. Reports findings and offers to fix them.
Generate a structured session handoff prompt, or manage precompact automation (auto/on/off). Run with no args to generate a handoff for the current session. Run `auto` to enable automatic handoffs that block /compact.
Executes bash commands
Hook triggers when Bash tool is used
Modifies files
Hook triggers on file write and edit operations
Runs pre-commands
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
Contains inline bash commands via ! syntax
Contains inline bash commands via ! syntax
Stop repeating Claude's mistakes. Every session, automatically.
flowchart LR
A["Claude makes\na mistake"] --> B["Emits #lesson tag\nor scanner detects it"]
B --> C["Candidate in\nlessons.db"]
C --> D["Review and promote\nvia /lessons:review"]
D --> E["lesson-manifest.json\nrebuilt"]
E --> F["Next session:\nPreToolUse hook"]
F --> G{"Pattern\nmatches?"}
G -- Yes --> H["Warning injected\nbefore tool call"]
G -- No --> I["Silently skipped"]
H --> J["Mistake avoided"]
# Step 1 — add the marketplace (once per machine)
claude plugin marketplace add joeblackwaslike/agent-marketplace
# Step 2 — install the plugin
claude plugin install lessons-learned@agent-marketplace
Claude is stateless. Every session forgets every correction, every footgun hit, every git stash that silently dropped untracked files. Over long agentic runs, the same class of mistake appears again and again — because nothing carries forward.
lessons-learned creates a persistent, compounding memory of failure patterns. Mistakes are captured automatically from session logs. A background scanner extracts candidates, you promote the ones worth keeping, and the next time Claude is about to make the same move, a warning surfaces at the exact tool call where it matters.
The feedback loop tightens over time. The more sessions, the stronger the prevention.
Step 1 — Claude makes a mistake and emits a lesson tag:
#lesson
tool: Bash
trigger: git stash
problem: git stash silently omits untracked files — they stay in the working tree
and are not stashed. Running git stash with new files present loses them.
solution: Use `git stash -u` (or `--include-untracked`) to capture all changes.
tags: tool:git, severity:data-loss
#/lesson
Step 2 — Next session startup scans the log:
$ node scripts/lessons.mjs scan --verbose
[scan] Scanning ~/.claude/projects/ for new lessons...
[scan] Processing session: abc123-2024-01-15.jsonl (42.3 KB)
→ tier1: found 1 structured lesson tag (#lesson)
→ tier2: found 1 heuristic pattern (error→correction)
[scan] Processing session: def456-2024-01-16.jsonl (38.1 KB)
→ tier1: no structured tags
→ tier2: no patterns detected
[scan] New candidates: 2 | Duplicates skipped: 0 | Total in DB: 47
Step 3 — Review and promote:
$ node scripts/lessons.mjs review --batch=1
── tool:git (1) ──────────────────────────────────────────
CANDIDATE: git-stash-untracked-files-a3f1
Tool: Bash Priority: 7 Confidence: 0.92
Trigger: git stash
Problem: git stash silently omits untracked files, risking data loss
Solution: Use git stash -u to include untracked files
Validation: PASS (length ok, no placeholders, no duplicates)
Promote? [y]es / [n]o / [s]kip / [q]uit: y
✓ Promoted git-stash-untracked-files-a3f1 → active
[build] Manifest rebuilt: 48 lessons included
Step 4 — Warning fires before the next git stash:
# Claude is about to run: git stash
⚠ Lesson: git stash silently omits untracked files
Problem: git stash silently omits untracked files, risking data loss.
Running git stash when new/untracked files are present does NOT stash them.
Fix: Use `git stash -u` (or `--include-untracked`) to capture all changes.
Intercepts /compact and generates a structured session handoff instead of lossy compaction
Tree/graph-based persistent context store with surgical recall. Exposes ctx-tree.read, ctx-tree.grep, ctx-tree.compose, ctx-tree.search, ctx-tree.neighbors for budget-bounded recall.
Sandboxed code execution MCP server — keep intermediate results out of the context window
Scaffold and maintain production-ready TypeScript projects — the cookiecutter-uv equivalent for the TypeScript ecosystem, sibling of spinup-py
Joe Black's custom skills for AI coding assistants — agentic development, plugin development, and best practices for Claude Code, Codex CLI, Gemini CLI, and Antigravity CLI.
npx claudepluginhub joeblackwaslike/agent-marketplace --plugin lessons-learnedSelf-learning system for Claude Code that captures corrections and updates CLAUDE.md automatically
Self-improving Claude Code plugin — learns from corrections across sessions via reflexio
Operational memory for coding agents: recall past mistakes before you act, encode the lesson when something goes wrong.
A continuous, zero-friction learning layer: the agent learns about you and improves its own skills across every session, and can share anonymized, provenance-verified learnings to a global pool. Inspired by Hermes Agent.
Meta-Cognition tool for Claude Code: session history analysis, workflow optimization, and 21 MCP tools for deep session insights.
Analyze Claude Code agent session transcripts to identify inefficiencies, anti-patterns, repeated mistakes, missing tooling opportunities, and user frustration signals for continuous improvement