By theabecaster
Claude Code remembers your corrections and preferences. Auto-captures rules from your prompts, writes them to CLAUDE.md, and audits for conflicts and expiry.
Run the audit script to prune expired rules, remove duplicates, and resolve conflicts.
Ask the user to confirm before making any changes:
Read the `## Learned Preferences` section of `CLAUDE.md` in the current project directory.
Claude Code that learns from you
Every time you correct Claude Code mid-session, claude-learns captures the correction, extracts a clean rule, and saves it to your project's CLAUDE.md. Next session, Claude already knows. Rules are automatically audited — expiring stale ones, removing duplicates, resolving conflicts — so your preferences stay sharp and CLAUDE.md stays slim.
Step 1 — Add the marketplace (one time):
/plugin marketplace add theabecaster/claude-plugins
Step 2 — Install the plugin:
/plugin install claude-learns@abe-plugins
Step 3 — Install tsx (TypeScript runner, required):
npm install -g tsx
That's it. Restart Claude Code and the plugin is active.
tsx: npm install -g tsx"don't", "never", "always", "I prefer", "from now on", etc.). When matched, the claude CLI extracts a clean ≤15-word rule and appends it to CLAUDE.md.## Learned Preferences section in your project's CLAUDE.md, which Claude Code reads automatically at every session start.CLAUDE.md stays lean.Type any correction in Claude Code:
never use var, always use const or let
You'll see:
✅ claude-learns: Captured → Use const or let instead of var
Your CLAUDE.md gets updated automatically:
## Learned Preferences
<!-- Last audited: 2026-03-18 | Rules: 1 | TTL: 30d -->
- [2026-03-18] Use const or let instead of var
Next session, Claude already knows. No repeating yourself.
Create a .claude-learns.json in your project root to customize behavior:
{
"ttlDays": 30,
"maxRules": 50,
"conflictResolution": "keep-newer"
}
| Key | Default | Description |
|---|---|---|
ttlDays | 30 | Days before a rule expires and is pruned |
maxRules | 50 | Maximum rules to keep (trims oldest when exceeded) |
conflictResolution | "keep-newer" | Strategy when conflicting rules are detected |
| Command | Description |
|---|---|
/claude-learns:review | List all active learned preferences with dates and total count |
/claude-learns:audit | Manually trigger audit (prune expired, dedup, resolve conflicts) |
/claude-learns:clear | Remove all learned preferences from CLAUDE.md (with confirmation) |
Three hooks run automatically:
UserPromptSubmit — detect-correction.ts scans every prompt for correction signals. On a match, it calls the claude CLI to extract a clean rule, deduplicates against existing rules, and appends to CLAUDE.md.
SessionStart — session-count.ts counts active rules and prints a brief summary so you know your preferences are loaded.
SessionEnd — audit.ts runs async. Expires rules older than ttlDays, removes near-exact duplicates, resolves semantic conflicts via the claude CLI, trims to maxRules, and updates the Last audited comment.
All scripts exit 0 and handle errors gracefully — failures never interrupt your session.
MIT © theabecaster
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.
npx claudepluginhub theabecaster/claude-plugins --plugin claude-learnsSelf-improving Claude Code plugin — learns from corrections across sessions via reflexio
Self-learning system for Claude Code that captures corrections and updates CLAUDE.md automatically
Self-evolving Claude Code system that learns from corrections, manages context, and improves every session
Self-improving learning system that detects friction signals (corrections, repetitions, tool failures), extracts improvement candidates, and proposes rule/skill updates with explicit approval workflow.
Continuous learning hooks for gladiator MCP (observe patterns, reflect on them)
Automatic context engineering — observes your coding sessions and generates rules, suggestions, skills, and hooks so Claude gets smarter on your codebase over time