Curate Claude Code's auto-memory into durable project knowledge. Analyze MEMORY.md for patterns, promote proven learnings to CLAUDE.md and .claude/rules/, extract recurring solutions into reusable skills.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Self Improving Agent?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/sebastianluser-self-improving-agent)
---
name: self-improving-agent
description: "Curate Claude Code's auto-memory into durable project knowledge. Analyze MEMORY.md for patterns, promote proven learnings to CLAUDE.md and .claude/rules/, extract recurring solutions into reusable skills."
argument-hint: "[extract|promote|remember|review|status] [args]"
category: "arcane"
user-invocable: true
allowed-tools: Read, Glob, Grep, Bash, Write, Edit
---
# Self-Improving Agent
Claude Code's auto-memory (v2.1.32+) automatically records project patterns, debugging insights, and your preferences in `MEMORY.md`. This skill adds the intelligence layer: it analyzes what Claude has learned, promotes proven patterns into project rules, and extracts recurring solutions into reusable skills. May write or edit CLAUDE.md, .claude/rules/ files, and new skill files during promotion and extraction.
## Sub-commands
`/self-improving-agent` with no argument shows this overview. With a sub-command as its first argument, read `skills/<sub-command>/SKILL.md` from this skill's directory and follow it, passing the remaining arguments. Sub-commands: `extract`, `promote`, `remember`, `review`, `status`.
## Quick Reference
| Command | What it does |
|---------|-------------|
| `/self-improving-agent review` | Analyze MEMORY.md -- find promotion candidates, stale entries, consolidation opportunities |
| `/self-improving-agent promote` | Graduate a pattern from MEMORY.md to CLAUDE.md or `.claude/rules/` |
| `/self-improving-agent extract` | Turn a proven pattern into a standalone skill |
| `/self-improving-agent status` | Memory health dashboard -- line counts, topic files, recommendations |
| `/self-improving-agent remember` | Explicitly save important knowledge to auto-memory |
## How It Fits Together
```
┌─────────────────────────────────────────────────────────┐
│ Claude Code Memory Stack │
├─────────────┬──────────────────┬────────────────────────┤
│ CLAUDE.md │ Auto Memory │ Session Memory │
│ (you write)│ (Claude writes)│ (Claude writes) │
│ Rules & │ MEMORY.md │ Conversation logs │
│ standards │ + topic files │ + continuity │
│ Full load │ First 200 lines│ Contextual load │
├─────────────┴──────────────────┴────────────────────────┤
│ /self-improving-agent promote /self-improving-agent review │
│ Self-Improving Agent (this skill) │
│ /self-improving-agent extract /self-improving-agent remember │
├─────────────────────────────────────────────────────────┤
│ .claude/rules/ │ New Skills │ Error Logs │
│ (scoped rules) │ (extracted) │ (auto-captured)│
└─────────────────────────────────────────────────────────┘
```
## Memory Architecture
### Where things live
| File | Who writes | Scope | Loaded |
|------|-----------|-------|--------|
| `./CLAUDE.md` | You (+ `/self-improving-agent promote`) | Project rules | Full file, every session |
| `~/.claude/CLAUDE.md` | You | Global preferences | Full file, every session |
| `~/.claude/projects/<path>/memory/MEMORY.md` | Claude (auto) | Project learnings | First 200 lines |
| `~/.claude/projects/<path>/memory/*.md` | Claude (overflow) | Topic-specific notes | On demand |
| `.claude/rules/*.md` | You (+ `/self-improving-agent promote`) | Scoped rules | When matching files open |
### The promotion lifecycle
```
1. Claude discovers pattern -> auto-memory (MEMORY.md)
2. Pattern recurs 2-3x -> /self-improving-agent review flags it as promotion candidate
3. You approve -> /self-improving-agent promote graduates it to CLAUDE.md or rules/
4. Pattern becomes an enforced rule, not just a note
5. MEMORY.md entry removed -> frees space for new learnings
```
## Core Concepts
### Auto-memory is capture, not curation
Auto-memory is excellent at recording what Claude learns. But it has no judgment about:
- Which learnings are temporary vs. permanent
- Which patterns should become enforced rules
- When the 200-line limit is wasting space on stale entries
- Which solutions are good enough to become reusable skills
That is what this skill does.
### Promotion = graduation
When you promote a learning, it moves from Claude's scratchpad (MEMORY.md) to your project's rule system (CLAUDE.md or `.claude/rules/`). The difference matters:
- **MEMORY.md**: "I noticed this project uses pnpm" (background context)
- **CLAUDE.md**: "Use pnpm, not npm" (enforced instruction)
Promoted rules have higher priority and load in full (not truncated at 200 lines).
### Rules directory for scoped knowledge
Use `.claude/rules/` for patterns that only apply to specific file types:
```yaml
# .claude/rules/api-testing.md
---
paths:
- "src/api/**/*.test.ts"
- "tests/api/**/*"
---
- Use supertest for API endpoint testing
- Mock external services with msw
- Always test error responses, not just happy paths
```