From learning-system
Design, audit, and improve agent memory systems across Claude Code's three memory layers (CLAUDE.md, auto-memory, rules/). Use for: reviewing what Claude has learned, promoting proven patterns to enforced rules, extracting recurring solutions into skills, checking memory health and capacity, capturing a pattern explicitly, or wiring up the error-capture hook.
How this skill is triggered — by the user, by Claude, or both
Slash command
/learning-system:memory-managementThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Claude Code has three memory systems that serve different purposes and have different guarantees. Most agents treat them as one blob. This skill treats them as a stack — capture at the bottom, curate in the middle, enforce at the top.
Claude Code has three memory systems that serve different purposes and have different guarantees. Most agents treat them as one blob. This skill treats them as a stack — capture at the bottom, curate in the middle, enforce at the top.
The job of this skill is to move knowledge up the stack deliberately, and prune what no longer belongs.
┌────────────────────────────────────────────────────────┐
│ CLAUDE.md + rules/ │ ← Enforced rules
│ You write. Loaded in full every session. High priority│
├────────────────────────────────────────────────────────┤
│ Auto-memory │ ← Captured patterns
│ Claude writes. MEMORY.md (first 200 lines) + topics │
├────────────────────────────────────────────────────────┤
│ Session memory │ ← Conversation context
│ Claude writes. Loaded contextually, not always. │
└────────────────────────────────────────────────────────┘
↑ /si:promote ↑ /si:review
Self-Improving Agent (this skill)
↓ /si:extract ↓ /si:remember
┌────────────────────────────────────────────────────────┐
│ .claude/rules/ │ ← Scoped rules
│ You write. Loads only when matching file types open. │
└────────────────────────────────────────────────────────┘
For the complete technical reference for each layer, read references/memory-architecture.md.
| Command | What it does |
|---|---|
/si:review | Analyze MEMORY.md — find promotion candidates, stale entries, consolidation opportunities |
/si:promote | Graduate a pattern from MEMORY.md → CLAUDE.md or .claude/rules/ |
/si:extract | Turn a proven pattern into a standalone skill |
/si:status | Memory health dashboard — line counts, topic files, recommendations |
/si:remember | Explicitly save important knowledge to auto-memory |
Trigger this skill when:
.claude/rules/Do not trigger this skill for:
Knowledge moves through a defined lifecycle:
1. Claude discovers pattern → auto-memory (MEMORY.md)
2. Pattern recurs 2-3× → /si:review flags it as promotion candidate
3. You approve → /si:promote graduates it to CLAUDE.md or .claude/rules/
4. Pattern becomes an enforced rule, not just background context
5. MEMORY.md entry removed → frees space for new learnings
Promotion criteria and scoring are in references/promotion-rules.md.
/si:review)Spawn the memory-analyst agent, which:
MEMORY.md (main) and topic files in ~/.claude/projects/*/memory/CLAUDE.md and .claude/rules/ to find duplicates, gaps, and contradictionsRead references/promotion-rules.md for the scoring guide and promotion decision rules.
/si:promote)When a pattern scores ≥ 6 (durability + impact + scope) and has appeared in 2+ sessions:
Promote to CLAUDE.md when:
Promote to .claude/rules/ when:
Promote to ~/.claude/CLAUDE.md when:
Transform the learning from descriptive to prescriptive before writing it:
| Before (descriptive) | After (prescriptive) |
|---|---|
| "I noticed the project uses pnpm workspaces. npm install fails." | "Use pnpm install, not npm." |
| "Sometimes you need to restart after changing env vars." | "Restart dev server after any .env change." |
See the full distillation guide in references/promotion-rules.md.
/si:extract)When a proven pattern or debugging solution should become a reusable standalone skill:
Spawn the skill-extractor agent with the pattern description. The agent:
SKILL.md with proper frontmatter including a "Use when:" triggerQuality bar for extracted skills:
/si:status)Shows:
.claude/rules/ file count and last-modified datesRun this before a big memory cleanup and after. Treat it as a capacity check.
/si:remember)When you want to force a specific pattern into auto-memory immediately:
/si:remember "always run pnpm run generate:api after editing openapi.yaml"
The command classifies the entry as instruction, lesson, or preference and writes it with proper frontmatter to the correct memory file, then updates MEMORY.md.
Use this for:
Use .claude/rules/ files to scope instructions to specific file types. This keeps CLAUDE.md lean and ensures heavy rules only load when they matter.
Format:
---
paths:
- "src/api/**/*.ts"
- "tests/api/**/*"
---
# Rules that only load when API files are open
Full patterns, common rule files, and organization tips in references/rules-directory-patterns.md.
This skill ships with an error-capture hook (registered automatically when the plugin is installed):
/si:rememberThe hook does not save anything automatically. It surfaces the signal; you decide whether to save.
| File | Soft limit | Hard limit | Behavior at limit |
|---|---|---|---|
MEMORY.md | 150 lines | 200 lines | Lines after 200 are not loaded at startup |
CLAUDE.md | 150 lines | No hard limit | Adherence decreases with length |
| Topic files | No limit | No limit | Loaded on demand, not at startup |
| Rules files | No limit per file | No limit | Loaded only when paths match |
Strategy:
/si:review and promote proven patterns.claude/rules/~/.claude/CLAUDE.mdWhen entries conflict:
.claude/rules/ — scoped instructions, high priority, conditional loadAn entry in CLAUDE.md always overrides the same entry in MEMORY.md. After promoting, remove the memory entry.
npx claudepluginhub alvarovillalbaa/plugins --plugin learning-systemGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.