self-improving-agent
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSelf-Improving Agent
自改进代理(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 . 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.
MEMORY.md自动内存负责捕获,本插件负责整理。
Claude Code的自动内存(v2.1.32+)会自动在中记录项目模式、调试见解和您的偏好。本插件增加了智能层:它会分析Claude的学习内容,将已验证的模式推广为项目规则,并将重复出现的解决方案提取为可复用的Skill。
MEMORY.mdQuick Reference
快速参考
| Command | What it does |
|---|---|
| Analyze MEMORY.md — find promotion candidates, stale entries, consolidation opportunities |
| Graduate a pattern from MEMORY.md → CLAUDE.md or |
| Turn a proven pattern into a standalone skill |
| Memory health dashboard — line counts, topic files, recommendations |
| Explicitly save important knowledge to auto-memory |
| 命令 | 功能 |
|---|---|
| 分析MEMORY.md — 找出可推广候选条目、过时条目和可合并的内容 |
| 将模式从MEMORY.md升级至CLAUDE.md或 |
| 将已验证的模式转化为独立Skill |
| 内存健康仪表盘 — 行数统计、主题文件、优化建议 |
| 将重要知识明确保存至自动内存 |
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)│
└─────────────────────────────────────────────────────────┘┌─────────────────────────────────────────────────────────┐
│ Claude Code Memory Stack │
├─────────────┬──────────────────┬────────────────────────┤
│ CLAUDE.md │ Auto Memory │ Session Memory │
│ (你编写)│ (Claude编写)│ (Claude编写) │
│ 规则与 │ MEMORY.md │ 对话日志 │
│ 标准 │ + 主题文件 │ + 会话连续性 │
│ 完整加载 │ 前200行│ 上下文加载 │
├─────────────┴──────────────────┴────────────────────────┤
│ ↑ /si:promote ↑ /si:review │
│ Self-Improving Agent (本插件) │
│ ↓ /si:extract ↓ /si:remember │
├─────────────────────────────────────────────────────────┤
│ .claude/rules/ │ New Skills │ Error Logs │
│ (范围规则) │ (提取生成) │ (自动捕获)│
└─────────────────────────────────────────────────────────┘Installation
安装方法
Claude Code (Plugin)
Claude Code(插件)
/plugin marketplace add alirezarezvani/claude-skills
/plugin install self-improving-agent@claude-code-skills/plugin marketplace add alirezarezvani/claude-skills
/plugin install self-improving-agent@claude-code-skillsOpenClaw
OpenClaw
bash
clawhub install self-improving-agentbash
clawhub install self-improving-agentCodex CLI
Codex CLI
bash
./scripts/codex-install.sh --skill self-improving-agentbash
./scripts/codex-install.sh --skill self-improving-agentMemory Architecture
内存架构
Where things live
文件存储位置
| File | Who writes | Scope | Loaded |
|---|---|---|---|
| You (+ | Project rules | Full file, every session |
| You | Global preferences | Full file, every session |
| Claude (auto) | Project learnings | First 200 lines |
| Claude (overflow) | Topic-specific notes | On demand |
| You (+ | Scoped rules | When matching files open |
| 文件 | 编写者 | 范围 | 加载方式 |
|---|---|---|---|
| 你(+ | 项目规则 | 每次会话完整加载 |
| 你 | 全局偏好 | 每次会话完整加载 |
| Claude(自动) | 项目学习内容 | 加载前200行 |
| Claude(溢出存储) | 主题特定笔记 | 按需加载 |
| 你(+ | 范围规则 | 打开匹配文件时加载 |
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 learnings1. Claude发现模式 → 自动内存(MEMORY.md)
2. 模式重复出现2-3次 → /si:review标记为可推广候选
3. 你确认批准 → /si:promote将其升级至CLAUDE.md或rules/
4. 模式成为强制执行的规则,而非仅笔记
5. MEMORY.md中对应条目移除 → 为新学习内容腾出空间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.
自动内存擅长记录Claude的学习内容,但无法判断:
- 哪些学习内容是临时的,哪些是永久的
- 哪些模式应成为强制执行的规则
- 200行限制下,过时条目是否占用空间
- 哪些解决方案足够优秀,可成为可复用Skill
而这些正是本插件的功能。
Promotion = graduation
推广 = 升级
When you promote a learning, it moves from Claude's scratchpad (MEMORY.md) to your project's rule system (CLAUDE.md or ). The difference matters:
.claude/rules/- 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).
当您推广某一学习内容时,它会从Claude的草稿本(MEMORY.md)转移至项目的规则系统(CLAUDE.md或)。二者差异显著:
.claude/rules/- MEMORY.md:“我注意到该项目使用pnpm”(背景上下文)
- CLAUDE.md:“使用pnpm,而非npm”(强制执行指令)
已推广的规则优先级更高,且会完整加载(不会被截断为200行)。
Rules directory for scoped knowledge
规则目录用于范围化知识
Not everything belongs in CLAUDE.md. Use for patterns that only apply to specific file types:
.claude/rules/yaml
undefined并非所有内容都适合放在CLAUDE.md中。对于仅适用于特定文件类型的模式,可使用目录:
.claude/rules/yaml
undefined.claude/rules/api-testing.md
.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.paths:
- "src/api/**/*.test.ts"
- "tests/api/**/*"
- 使用supertest进行API端点测试
- 使用msw模拟外部服务
- 始终测试错误响应,而非仅测试正常路径
仅当Claude处理API测试文件时,该规则才会加载——其他场景无额外开销。Agents
代理模块
memory-analyst
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
分析MEMORY.md和主题文件,识别:
- 跨会话重复出现的条目(可推广候选)
- 引用已删除文件或旧模式的过时条目
- 可合并的相关条目
- MEMORY.md记录内容与CLAUDE.md强制执行规则之间的差距
skill-extractor
skill-extractor
Takes a proven pattern and generates a complete skill:
- SKILL.md with proper frontmatter
- Reference documentation
- Examples and edge cases
- Ready for or
/plugin installclawhub publish
将已验证的模式生成完整的Skill:
- 包含正确前置内容的SKILL.md
- 参考文档
- 示例和边缘情况
- 可直接用于或
/plugin installclawhub publish
Hooks
钩子函数
error-capture (PostToolUse → Bash)
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.
监控命令输出中的错误。检测到错误时,会向自动内存添加结构化条目,包含:
- 执行失败的命令
- 错误输出(已截断)
- 时间戳和上下文
- 建议分类
Token开销: 执行成功时为0。仅检测到错误时产生约30个Token的开销。
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 | | ⚠️ Manual promotion only |
| 平台 | 内存系统 | 插件是否可用 |
|---|---|---|
| Claude Code | 自动内存(MEMORY.md) | ✅ 完全支持 |
| OpenClaw | workspace/MEMORY.md | ✅ 适配支持(读取工作区内存) |
| Codex CLI | AGENTS.md | ✅ 适配支持(读取AGENTS.md中的模式) |
| GitHub Copilot | | ⚠️ 仅支持手动推广 |
Related
相关资源
- Claude Code Memory Docs
- pskoett/self-improving-agent — inspiration
- playwright-pro — sister plugin in this repo
- Claude Code Memory Docs
- pskoett/self-improving-agent — 灵感来源
- playwright-pro — 本仓库中的姊妹插件