self-improving-agent
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. Use when: (1) reviewing what Claude has learned about your project, (2) graduating a pattern from notes to enforced rules, (3) turning a debugging solution into a skill, (4) checking memory health and capacity.
What this skill does
# Self-Improving Agent > Auto-memory captures. This plugin curates. Claude Code's auto-memory (v2.1.32+) automatically records project patterns, debugging insights, and your preferences in `MEMORY.md`. This plugin adds the intelligence layer: it analyzes what Claude has learned, promotes proven patterns into project rules, and extracts recurring solutions into reusable skills. ## Quick Reference | 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 | ## 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 │ ├─────────────┴──────────────────┴────────────────────────┤ │ ↑ /si:promote ↑ /si:review │ │ Self-Improving Agent (this plugin) │ │ ↓ /si:extract ↓ /si:remember │ ├─────────────────────────────────────────────────────────┤ │ .claude/rules/ │ New Skills │ Error Logs │ │ (scoped rules) │ (extracted) │ (auto-captured)│ └─────────────────────────────────────────────────────────┘ ``` ## Installation ### Claude Code (Plugin) ``` /plugin marketplace add alirezarezvani/claude-skills /plugin install self-improving-agent@claude-code-skills ``` ### OpenClaw ```bash clawhub install self-improving-agent ``` ### Codex CLI ```bash ./scripts/codex-install.sh --skill self-improving-agent ``` ## Memory Architecture ### Where things live | File | Who writes | Scope | Loaded | |------|-----------|-------|--------| | `./CLAUDE.md` | You (+ `/si: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 (+ `/si:promote`) | Scoped rules | When matching files open | ### The promotion lifecycle ``` 1. Claude discovers pattern → auto-memory (MEMORY.md) 2. Pattern recurs 2-3x → /si:review flags it as promotion candidate 3. You approve → /si: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's what this plugin 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 Not everything belongs in CLAUDE.md. 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 ``` This loads only when Claude works with API test files — zero overhead otherwise. ## Agents ### memory-analyst Analyzes MEMORY.md and topic files to identify: - Entries that recur across sessions (promotion candidates) - Stale entries referencing deleted files or old patterns - Related entries that should be consolidated - Gaps between what MEMORY.md knows and what CLAUDE.md enforces ### skill-extractor Takes a proven pattern and generates a complete skill: - SKILL.md with proper frontmatter - Reference documentation - Examples and edge cases - Ready for `/plugin install` or `clawhub publish` ## Hooks ### error-capture (PostToolUse → Bash) Monitors command output for errors. When detected, appends a structured entry to auto-memory with: - The command that failed - Error output (truncated) - Timestamp and context - Suggested category **Token overhead:** Zero on success. ~30 tokens only when an error is detected. ## Platform Support | Platform | Memory System | Plugin Works? | |----------|--------------|---------------| | Claude Code | Auto-memory (MEMORY.md) | ✅ Full support | | OpenClaw | workspace/MEMORY.md | ✅ Adapted (reads workspace memory) | | Codex CLI | AGENTS.md | ✅ Adapted (reads AGENTS.md patterns) | | GitHub Copilot | `.github/copilot-instructions.md` | ⚠️ Manual promotion only | ## Related - [Claude Code Memory Docs](https://code.claude.com/docs/en/memory) - [pskoett/self-improving-agent](https://clawhub.ai/pskoett/self-improving-agent) — inspiration - [playwright-pro](../playwright-pro/) — sister plugin in this repo
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.