claude-skills/engineering-team/self-improving-agent/CLAUDE.md
Claude 3349509db4
fix(scripts,plugins): exclude tool-sync dirs from convert.sh; rename si plugin's status/review skills
- convert.sh's SKILL.md finder now excludes .claude, .codex, .codex-plugin,
  .gemini, .hermes, .vibe, and docs — these are generated/symlinked mirrors
  for other tools, not source-of-truth skills. On platforms where git
  materializes symlinks as plain text (e.g. Git Bash on Windows), the
  mirrored files were being parsed as SKILL.md candidates and failing
  frontmatter extraction, flooding the run with "Skipping invalid
  frontmatter" warnings (#897).

- Renamed the self-improving-agent (si) plugin's `status` and `review`
  skills to `memory-status` and `memory-review` so their bare `name:`
  values no longer collide with Claude Code's built-in `/status` and
  `/review` commands (#885). Updated all in-plugin references
  (CLAUDE.md, README, agents, hooks, references, settings.json,
  plugin.json) to the new `/si:memory-status` / `/si:memory-review`
  invocations.

Fixes #897 (duplicate of #896), #885.
2026-07-08 05:37:03 +00:00

84 lines
3.2 KiB
Markdown

# Self-Improving Agent — Claude Code Instructions
This plugin helps you curate Claude Code's auto-memory into durable project knowledge.
## Commands
Use the `/si:` namespace for all commands:
- `/si:memory-review` — Analyze auto-memory health and find promotion candidates
- `/si:promote <pattern>` — Graduate a learning to CLAUDE.md or `.claude/rules/`
- `/si:extract <pattern>` — Create a reusable skill from a proven pattern
- `/si:memory-status` — Quick memory health dashboard
- `/si:remember <knowledge>` — Explicitly save something to auto-memory
## How auto-memory works
Claude Code maintains `~/.claude/projects/<project-path>/memory/MEMORY.md` automatically. The first 200 lines load into every session. When it grows too large, Claude moves details into topic files like `debugging.md` or `patterns.md`.
This plugin reads that directory — it never creates its own storage.
## When to use each command
### After completing a feature or debugging session
```
/si:memory-review
```
Check if anything Claude learned should become a permanent rule.
### When a pattern keeps coming up
```
/si:promote "Always run migrations before tests in this project"
```
Moves it from MEMORY.md (background note) to CLAUDE.md (enforced rule).
### When you solved something non-obvious that could help other projects
```
/si:extract "Docker build fix for ARM64 platform mismatch"
```
Creates a standalone skill with SKILL.md, ready to install elsewhere.
### To check memory capacity
```
/si:memory-status
```
Shows line counts, topic files, stale entries, and recommendations.
## Key principle
**Don't fight auto-memory — orchestrate it.**
- Auto-memory is great at capturing patterns. Let it do its job.
- This plugin adds judgment: what's worth keeping, what should be promoted, what's stale.
- Promoted rules in CLAUDE.md have higher priority than MEMORY.md entries.
- Removing promoted entries from MEMORY.md frees space for new learnings.
## Agents
- **memory-analyst**: Spawned by `/si:memory-review` to analyze patterns across memory files
- **skill-extractor**: Spawned by `/si:extract` to generate complete skill packages
## Hooks
The `error-capture.sh` hook fires on `PostToolUse` (Bash only). It detects command failures and appends structured entries to auto-memory. Zero overhead on successful commands.
When you install this plugin via `/plugin install self-improving-agent@claude-code-skills`, the hook is registered automatically from `.claude-plugin/hooks.json` — you don't need to configure anything manually.
If you ever need to wire it up by hand (e.g. you copied the skill directly instead of installing as a plugin), use the `${CLAUDE_PLUGIN_ROOT}` variable so the path resolves against the plugin root rather than your current working directory:
```json
// .claude/settings.json
{
"hooks": {
"PostToolUse": [{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/error-capture.sh"
}]
}]
}
}
```
**Do not use a relative path like `./hooks/error-capture.sh`** — Claude Code resolves hook commands against the user's current working directory, not the plugin root. A relative path will silently fail (non-blocking) in every session started outside the plugin install dir.