Claude Error Learning Plugin
Automated error detection, fix tracking, and prevention for Claude Code. Learns from mistakes and teaches future sessions the fixes.
The Complete Loop
ERROR OCCURS FIX APPLIED FUTURE SESSIONS
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Capture │ │ Capture │ │ Prevent │
│ Error │────────────────▶│ Fix │─────────────────▶ │ + Teach │
│ │ same session │ │ curator pairs │ │
└──────────┘ same tool type └──────────┘ error → fix └──────────┘
│ │ │
▼ ▼ ▼
errors.jsonl errors.jsonl learned.json
{cmd, error} {fix, linked_to} {block, learned_fix}
Result: Claude makes mistake once → learns the fix → never makes that mistake again.
Smart Detection
The plugin analyzes error messages, not just command patterns, to create precise blocking rules:
| Error Type | What Gets Blocked | Example |
|---|
Bad flag --xyz | Only that specific flag | ls --invalid blocked, ls -la works |
| Command not found | Only that command | choco blocked, other commands work |
| Path not found | Nothing (environmental) | Won't learn from missing files |
| Permission denied | Nothing (environmental) | Won't learn from access errors |
This prevents false positives like blocking all ls commands just because one bad flag failed.
Proactive Injection (v1.1)
Beyond reactive blocking, the plugin now injects the most-relevant learned
rules into Claude's context at the moment you submit a prompt. Each prompt
triggers a TF-IDF ranking over your learned patterns; the top 10
(configurable) get rendered as a short natural-language bullet list under a
400-token cap, so Claude avoids the mistake in the first place.
Key knobs in config.json:
| Key | Default | Purpose |
|---|
injection_enabled | true | Turn off for reactive-only |
injection_top_k | 10 | Max patterns per prompt |
injection_token_cap | 400 | Hard ceiling on injected content |
injection_scope | "top_learned" | top_learned, all_active, learned_only, high_confidence |
decay_max_age_days | 30 | Stale patterns drop from the pool |
vote_down_threshold | 3 | Down-votes before auto-disable |
llm_curate_enabled | false | Opt in (requires ANTHROPIC_API_KEY) |
Disagree with a block? /error-learning vote <pattern_id> down.
Three down-votes disables it permanently.
Installation
Recommended: Install as a Claude Code plugin
From any Claude Code session:
/plugin marketplace add jonathondouglasyager-debug/claude-error-learning
/plugin install error-learning@yager-plugins
That's it. Hooks register automatically — no need to edit settings.json. Start a new Claude session for the hooks to take effect.
To enable your OS-specific pattern pack after installing:
# macOS/Linux
python3 ~/.claude/plugins/cache/**/error-learning/**/hooks/error-curator.py --enable linux
# Windows (PowerShell)
python "$env:USERPROFILE\.claude\plugins\cache\*\error-learning\*\hooks\error-curator.py" --enable windows
(You can also just run the slash command /error-learning packs enable linux once the plugin is installed.)
Manual install (alternative)
If you'd rather install from a clone — e.g. to hack on the plugin locally — follow these steps instead.
Manual install steps
Step 1: Clone the Repository
# macOS/Linux
git clone https://github.com/jonathondouglasyager-debug/claude-error-learning.git ~/claude-error-learning
# Windows
git clone https://github.com/jonathondouglasyager-debug/claude-error-learning.git %USERPROFILE%\claude-error-learning
Step 2: Add Hooks to Global Settings
Add the following to your ~/.claude/settings.json (macOS/Linux) or %USERPROFILE%\.claude\settings.json (Windows):