{"id":"d4e84caf-7811-40cd-b53c-246be40c6892","entityType":"agent","slug":"clawhub-brucetangc-self-improvement-llm","name":"Self Improvement Llm","canonicalUrl":"https://www.xpersona.co/agent/clawhub-brucetangc-self-improvement-llm","canonicalPath":"/agent/clawhub-brucetangc-self-improvement-llm","generatedAt":"2026-10-10T21:48:31.313Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-10T16:27:28.548Z","emptyReason":null},"description":"Autonomous AI memory and self-learning system that logs, extracts lessons, verifies improvements, adapts behavior, manages preferences, and generates reusabl... Skill: Self Improvement Llm Owner: brucetangc Summary: Autonomous AI memory and self-learning system that logs, extracts lessons, verifies improvements, adapts behavior, manages preferences, and generates reusabl... Tags: latest:2.3.0 Version history: v2.3.0 | 2026-07-29T11:54:50.774Z | auto Version 2.3.0 - Added a CLI references document (references/cli_ref.md) for command-line usage. - Updated procedural instructio","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.3K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s17c86x64fn6cy26y1t8rwnn4983f35d:self-improvement-llm","sourceUrl":"https://clawhub.ai/brucetangc/self-improvement-llm","homepage":"https://clawhub.ai/brucetangc/skills/self-improvement-llm","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/brucetangc/self-improvement-llm","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/brucetangc/skills/self-improvement-llm","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":63,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Autonomous AI memory and self-learning system that logs, extracts lessons, verifies improvements, adapts behavior, manages preferences, and generates reusabl..."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T16:27:28.548Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T16:27:28.548Z","emptyReason":null},"stars":null,"forks":null,"downloads":1339,"packageName":null,"latestVersion":"2.3.0","tractionLabel":"1.3K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T16:27:28.548Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T16:27:28.548Z","lastCrawledAt":"2026-10-10T16:27:28.548Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T16:27:28.548Z","lastVerifiedAt":null,"highlights":[{"version":"2.3.0","createdAt":"2026-07-29T11:54:50.774Z","changelog":"Version 2.3.0 - Added a CLI references document (`references/cli_ref.md`) for command-line usage. - Updated procedural instructions: micro-events (corrections, errors, tool failures) now log only to `.learning-trail.json`; daily logs (`memory/YYYY-MM-DD.md`) now contain only session summaries. - Clarified session summary format and made daily log entries more concise. - Adjusted memory architecture section for brevity and added tabular summary. - Removed superseded documentation (`skill-card.md`).","fileCount":13,"zipByteSize":57387},{"version":"2.2.3","createdAt":"2026-06-17T02:50:10.660Z","changelog":"新增：编辑文件前必须先 read 的硬规则，防止 cron 假性 error；修复：匹配逻辑支持多段前缀（如 AW-G5000-P-05）；统一 name 为 self-improvement-llm","fileCount":12,"zipByteSize":57864},{"version":"2.2.2","createdAt":"2026-06-16T05:21:35.028Z","changelog":"Added export/import sync for backup and multi-server migration","fileCount":12,"zipByteSize":57609},{"version":"2.2.1","createdAt":"2026-06-16T05:14:32.670Z","changelog":"Added migration script and compatibility checks for smoother updates","fileCount":11,"zipByteSize":55179},{"version":"2.2.0","createdAt":"2026-06-16T04:50:28.830Z","changelog":"Synced with local workspace, MiMo model support, improved memory architecture","fileCount":10,"zipByteSize":53342},{"version":"1.1.0","createdAt":"2026-06-16T04:46:25.705Z","changelog":"Updated for MiMo model support, improved memory architecture, added knowledge graph features","fileCount":10,"zipByteSize":53502},{"version":"2.1.0","createdAt":"2026-05-28T05:37:05.747Z","changelog":"新增 Phase 7 auto-detect: 自动扫描 daily log 发现学习点，不再依赖 agent 手动调用；补完 9 phase 完整闭环","fileCount":9,"zipByteSize":48114},{"version":"2.0.0","createdAt":"2026-05-28T04:42:41.057Z","changelog":"完整重构：精简为核心四路径（记忆→检测→记录→提炼），中文检测支持，8 phase cycle 自动闭环，修复 stats 漂移、ID 生成、promotion 去重等 bug","fileCount":9,"zipByteSize":47446}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17c86x64fn6cy26y1t8rwnn4983f35d:self-improvement-llm","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-brucetangc-self-improvement-llm/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-brucetangc-self-improvement-llm/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-brucetangc-self-improvement-llm/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-brucetangc-self-improvement-llm/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-brucetangc-self-improvement-llm/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-brucetangc-self-improvement-llm/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T21:48:31.310Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-brucetangc-self-improvement-llm/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-brucetangc-self-improvement-llm/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-brucetangc-self-improvement-llm/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-brucetangc-self-improvement-llm/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-10T16:27:28.548Z","emptyReason":null},"readme":"Skill: Self Improvement Llm\n\nOwner: brucetangc\n\nSummary: Autonomous AI memory and self-learning system that logs, extracts lessons, verifies improvements, adapts behavior, manages preferences, and generates reusabl...\n\nTags: latest:2.3.0\n\nVersion history:\n\nv2.3.0 | 2026-07-29T11:54:50.774Z | auto\n\nVersion 2.3.0\n\n- Added a CLI references document (`references/cli_ref.md`) for command-line usage.\n- Updated procedural instructions: micro-events (corrections, errors, tool failures) now log only to `.learning-trail.json`; daily logs (`memory/YYYY-MM-DD.md`) now contain only session summaries.\n- Clarified session summary format and made daily log entries more concise.\n- Adjusted memory architecture section for brevity and added tabular summary.\n- Removed superseded documentation (`skill-card.md`).\n\nv2.2.3 | 2026-06-17T02:50:10.660Z | user\n\n新增：编辑文件前必须先 read 的硬规则，防止 cron 假性 error；修复：匹配逻辑支持多段前缀（如 AW-G5000-P-05）；统一 name 为 self-improvement-llm\n\nv2.2.2 | 2026-06-16T05:21:35.028Z | user\n\nAdded export/import sync for backup and multi-server migration\n\nv2.2.1 | 2026-06-16T05:14:32.670Z | user\n\nAdded migration script and compatibility checks for smoother updates\n\nv2.2.0 | 2026-06-16T04:50:28.830Z | user\n\nSynced with local workspace, MiMo model support, improved memory architecture\n\nv1.1.0 | 2026-06-16T04:46:25.705Z | user\n\nUpdated for MiMo model support, improved memory architecture, added knowledge graph features\n\nv2.1.0 | 2026-05-28T05:37:05.747Z | user\n\n新增 Phase 7 auto-detect: 自动扫描 daily log 发现学习点，不再依赖 agent 手动调用；补完 9 phase 完整闭环\n\nv2.0.0 | 2026-05-28T04:42:41.057Z | user\n\n完整重构：精简为核心四路径（记忆→检测→记录→提炼），中文检测支持，8 phase cycle 自动闭环，修复 stats 漂移、ID 生成、promotion 去重等 bug\n\nv1.0.0 | 2026-05-27T10:58:27.878Z | user\n\n三层记忆架构（借鉴 Hermes Agent）、自动技能生成、会话自动摘要、标准化技能格式、preferences.json 用户模型\n\nArchive index:\n\nArchive v2.3.0: 13 files, 57387 bytes\n\nFiles: _meta.json (139b), hooks/openclaw/handler.js (3763b), hooks/openclaw/HOOK.md (934b), references/cli_ref.md (5802b), references/reflection_frameworks.md (13191b), scripts/dream.py (13334b), scripts/learn.py (69553b), scripts/migrate.py (4798b), scripts/reflect.py (7430b), scripts/skillgen.py (18014b), scripts/sync.py (6508b), skill-card.md (2636b), SKILL.md (20517b)\n\nFile v2.3.0:SKILL.md\n\n---\nname: self-improvement-llm\ndescription: Autonomous memory and self-learning system for AI agents. Continuously collects experience, manages memory (daily logs, user preferences, knowledge extraction), builds knowledge graphs connecting events→lessons→principles, extracts principles, auto-adjusts behavior, and verifies improvements. Proposes actionable changes for user review before applying. Use when: (1) Agent needs to learn from past sessions, (2) User asks \"improve yourself\" or \"learn from this\", (3) Periodic self-evaluation is needed, (4) Agent needs to auto-correct recurring mistakes, (5) Updating AGENTS.md/SOUL.md/MEMORY.md/TOOLS.md based on experience, (6) Extracting universal principles from episodic experiences, (7) Processing user feedback to permanently adapt behavior, (8) Managing daily memory logs, user preferences, or knowledge retention.\n---\n\n# Self-Learning System\n\nA continuous learning loop that automatically captures learnings, tracks improvements, and verifies their effectiveness.\n\n**Inspiration:** This skill fuses the structured recording format and detection triggers from [pskoett/self-improving-agent](https://clawhub.ai/pskoett/self-improving-agent) (6.1k installs) with a verification/hypothesis loop that most agent learning systems lack.\n\n## 🤖 Agent: What You Must Do (Not Optional)\n\nThese are **required behaviors**, not suggestions. Execute them during conversation without being told.\n\n### During Every Conversation\n\n1. **Detect learning opportunities in real-time.** After every user message or tool result, mentally check:\n   - Did the user correct me? → run `python3 scripts/reflect.py --detect \"USER_MESSAGE\"`\n   - Did a tool fail? → log to `.learning-trail.json` immediately\n   - Did I learn something new? → log to `.learning-trail.json` immediately\n\n2. **Log corrections immediately.** When the user says \"不对\", \"错了\", \"no\", \"actually\", etc.:\n   ```bash\n   python3 scripts/learn.py --log correction \"具体纠正了什么\"\n   ```\n   Set pattern_key for dedup: `--log correction \"message\" --area behavior --priority high`\n\n3. **Log errors automatically.** When a tool call fails or returns unexpected output:\n   ```bash\n   python3 scripts/learn.py --log error \"工具名: 错误简述\" --area tooling --priority medium\n   ```\n\n4. **After significant tasks,** append to today's daily log:\n   ```bash\n   python3 scripts/reflect.py --log \"完成了什么\"\n   ```\n\n### At Session Start\n\n5. **Check `.hook-context.txt`** (written by plugin hook at gateway startup):\n   Use `read(path=\"memory/.hook-context.txt\")` to check it.\n   If it shows pending verifications or patterns ready for promotion, act on them.\n\n6. **Run a quick status check:**\n   ```bash\n   python3 scripts/learn.py --status\n   ```\n\n### During Daily Cycle (via cron, 3AM)\n\n7. The full cycle runs automatically: `python3 scripts/learn.py --cycle`\n   - **🌙 Dream:** Distills recent daily logs into MEMORY.md (dedup + compress)\n   - Auto-promotes patterns (≥2 occurrences across ≥2 sessions)\n   - Auto-generates session summaries (L1)\n   - Auto-triggers skill generation (via `skillgen.py --auto`)\n   - Records `record_change` for verification tracking\n   - Checks for overdue verifications\n\n### ⚠️ Mandatory: Read Before Edit\n\n**CRITICAL RULE — 任何文件编辑前必须先 read 获取当前内容。**\n\n```bash\n# ❌ 错误：凭记忆构造 oldText\nedit(path=\"MEMORY.md\", oldText=\"我印象中的内容\", newText=\"新内容\")\n\n# ✅ 正确：先读文件，拿到实际内容\nread(path=\"MEMORY.md\")\n# 然后用实际内容构造 oldText\nedit(path=\"MEMORY.md\", oldText=\"从 read 结果中复制的精确文本\", newText=\"新内容\")\n```\n\n**为什么：** edit 工具要求 oldText 与文件内容**逐字符匹配**（含空白和换行）。凭记忆构造几乎必然失败，导致 cron 假性 error。\n\n**适用场景：** 编辑 MEMORY.md、TOOLS.md、USER.md、AGENTS.md、SOUL.md 等任何文件。\n\n### Record Changes for Verification\n\n8. **When you modify any core file** (MEMORY.md, TOOLS.md, SOUL.md, AGENTS.md):\n   ```bash\n   python3 scripts/learn.py --record-change MEMORY.md \"what was changed\" \"why this should help\"\n   ```\n   This populates the verification loop so 7 days later the system checks if it helped.\n\n### Score Conversations\n\n9. **At the end of significant conversations,** rate yourself:\n   ```bash\n   python3 scripts/learn.py --score 8 7 9 8 7 \"brief justification\"\n   ```\n   (accuracy, usefulness, efficiency, tone, proactiveness, 0-10 each)\n\n## Learning Loop\n\n```\nSession / Task\n    ↓\n  [DETECT]     ← Automatic triggers: corrections, errors, feature requests\n    ↓\n  [LOG]        ← Structured entries with IDs, priorities, categories\n    ↓\n  [EXTRACT]    ← Distill patterns from repeated entries\n    ↓\n  [PROMOTE]    ← To AGENTS.md / SOUL.md / TOOLS.md / MEMORY.md\n    ↓\n  [VERIFY]     ← 7-day check: did this change actually help?\n    ↓\n  [ADAPT]      ← Reinforce success, revert failure\n    ↓\n  (back to detect on next interaction)\n```\n\n## Memory Management\n\nThe skill also manages the agent's memory system — daily logs, user preferences, and knowledge retention.\n\n### Memory Architecture (三层)\n\n| Layer | Store | Content |\n|-------|-------|--------|\n| **L1** Session Context | `memory/sessions/*.md` | 会话摘要 |\n| **L2** Persistent Store | `MEMORY.md`, `memory/*.md`, `memory/skills/` | 蒸馏知识、经验教训 |\n| **L3** User Model | `memory/preferences.json`, `USER.md` | 用户偏好、沟通风格 |\n\nInspired by Nous Research [Hermes Agent](https://github.com/NousResearch/hermes-agent).\n\n### Auto-Daily-Log\n\nAt the end of each session or significant task, write a summary to `memory/YYYY-MM-DD.md`. Do NOT log individual micro-events (corrections, errors, tool failures) here — those go to `.learning-trail.json` only.\n\n```markdown\n### 📝 Session summary\nCompleted tasks, user requests, decisions, key outcomes.\n```\n\nKeep entries concise (3-5 lines per session).\n\n### Memory Types\n\n| Type | Layer | Where | Example |\n|------|-------|-------|---------|\n| **Session summaries** | L1 | `memory/sessions/*.md` | \"2026-05-27 搜了苏超、装了 SearXNG\" |\n| **Daily logs** | L2 | `memory/YYYY-MM-DD.md` | \"10:30 创建 self-improvement skill\" |\n| **Distilled principles** | L2 | `MEMORY.md` | \"Simple before powerful\" |\n| **Auto-generated skills** | L2 | `memory/skills/*.md` | \"SearXNG 部署流程\" |\n| **User preferences** | L3 | `memory/preferences.json` | \"直接回答，不要解释\" |\n| **User profile** | L3 | `USER.md` | \"技术背景强，中文沟通\" |\n| **Structured learning** | — | `.learning-trail.json` | 所有 LRN/ERR/FEAT 条目 |\n\n### Memory Retention\n\n| Memory | Retention | Action |\n|--------|-----------|--------|\n| Daily logs | Keep forever | Append-only, never delete |\n| Learning entries | 90 days | Auto-resolve pending items after 90d |\n| Verified principles | Keep forever | Part of long-term knowledge |\n| User preferences | Keep until changed | Update when user says otherwise |\n| Tool notes | Keep until outdated | Update when tools change |\n\n### Memory Search\n\nWhen user asks \"之前说过什么\" or \"帮我回忆一下\":\n\n1. First check `MEMORY.md` (distilled knowledge)\n2. Then check `USER.md` (preferences)\n3. Then check `.learning-trail.json` for structured entries\n4. Then `grep` recent `memory/*.md` files\n\n### Memory Flow\n\n```\n会话中\n  → 检测到用户偏好 / 知识 / 错误\n  → 仅写入 .learning-trail.json（结构化）\n\n会话结束（每次对话结束）\n  → 自动生成 L1 会话摘要到 memory/sessions/YYYY-MM-DD-NNN.md\n  → 摘要包含：做了什么任务、学到了什么、用户反馈、生成了哪些技能\n  → 追加概要到 memory/YYYY-MM-DD.md\n  \n心跳/空闲\n  → 读取 .learning-trail.json 的 patterns\n  → 达到阈值的晋升为 MEMORY.md 原则或 memory/preferences.json 偏好\n  → 检查是否有值得生成技能的任务（8+ 工具调用且含写操作/脚本执行）\n  \n新会话开始\n  → MEMORY.md 自动注入上下文\n  → .learning-trail.json 的 watchlist 提醒我注意\n```\n\n## Auto-Trigger Points\n\n### Detection Triggers\n\nAutomatically log when you notice:\n\n**Corrections** → log to `.learning-trail.json` (category: correction)\n- \"No, that's not right...\"\n- \"Actually, it should be...\"\n- \"You're wrong about...\"\n- \"That's outdated...\"\n- User explicitly correcting your output\n\n**Feature Requests** → log to `.learning-trail.json`\n- \"Can you also...\"\n- \"I wish you could...\"\n- \"Is there a way to...\"\n- \"Why can't you...\"\n\n**Knowledge Gaps** → log to `.learning-trail.json` (category: knowledge_gap)\n- User provides info you didn't know\n- Documentation you referenced is outdated\n- API behavior differs from your understanding\n\n**Errors** → log to `.learning-trail.json`\n- Command returns non-zero exit code\n- Exception or stack trace\n- Timeout or connection failure\n\n**Successes** → log to `.learning-trail.json` (category: best_practice)\n- Found a better approach\n- Quicker way to do something\n- Cleaner pattern emerged\n\n### Scheduled Triggers\n\n| Trigger | When | Action |\n|---------|------|--------|\n| **Session end** | After completion | Auto-log summary to memory/YYYY-MM-DD.md + memory/sessions/ L1 summary |\n| **Skill gen check** | After complex task | Auto-generate skill if 8+ tool calls (with write/exec/workflow) or user says \"记住\" |\n| **Heartbeat** | Idle time | Run learn.py --cycle: check verifications, promote patterns |\n| **Improve yourself** | On demand | Full cycle + report |\n| **Hook** | Session start | If hook installed, review pending learnings |\n\n## Session Summary (L1)\n\n每次会话/任务完成后，自动生成会话摘要到 `memory/sessions/YYYY-MM-DD-NNN.md`：\n\n```markdown\n# Session Summary: 2026-05-27-001\n\n## Tasks Completed\n- [任务名称] 做了什么，结果是什么\n\n## Learnings\n- [学到了什么]\n\n## Skills Generated\n- [生成了哪些技能文件]\n\n## User Feedback\n- [用户说了什么重要反馈]\n\n## Open Items\n- [未完成的或待确认的]\n```\n\n**生成时机：** 一个完整的任务流程结束后（如装完 SearXNG、搜完新闻等）\n\n## Auto Skill Generation\n\n当完成一个复杂度达标的任务后，自动生成标准化技能文件。\n\n**生成条件（满足任意一个）：**\n- 任务涉及 **8+ 工具调用且包含写操作/脚本执行/链式工作流**（纯查询类跳过）\n- 用户明确要求\"记住这个\"或\"记下来\"\n- 重复做过类似任务 ≥ 2 次\n- 发现了新的工作流或最佳实践\n\n**自动检测机制：**\n1. 任务完成后，检查是否满足以上条件\n2. 满足则生成技能文件，以短横线命名：`memory/skills/<task-slug>.md`\n3. 先检查是否已存在类似技能（grep memory/skills/ 目录），有则更新而非新建\n\n## Structured Log Format\n\nAll entries use `TYPE-YYYYMMDD-XXX` IDs (LRN/ERR/FEAT) and go into `memory/.learning-trail.json`. Full entry formats: [references/cli_ref.md](references/cli_ref.md).\n\n## Recurring Pattern Detection\n\nWhen logging something that might already exist:\n\n1. Search `.learning-trail.json` for matching Pattern-Key\n2. If found: increment Recurrence-Count, update Last-Seen\n3. If not found: create new entry with Recurrence-Count: 1\n\n### Promotion Rule\n\nPromote a pattern to workspace core files when **all** are true:\n- Recurrence-Count >= 3\n- Seen across at least 2 distinct sessions\n- Occurred within a 30-day window\n\n**Promotion targets:**\n\n| Entry Type | Promote To | Example |\n|-----------|-----------|---------|\n| Behavioral pattern | SOUL.md | \"Be concise, skip disclaimers\" |\n| Workflow improvement | AGENTS.md | \"Spawn sub-agents for long tasks\" |\n| Tool gotcha | TOOLS.md | \"Git push needs auth configured\" |\n| User preference | USER.md / preferences.json | \"User prefers direct answers\" |\n| Universal principle | MEMORY.md | \"Simple before powerful\" |\n| Reusable procedure | memory/skills/*.md | \"SearXNG 部署流程\" |\n\n**技能复用流程：**\n1. 新任务到来 → 搜索 `memory/skills/` 目录匹配关键词\n2. 找到匹配 → 读取技能文件，从 Procedure 开始执行\n3. 未找到 → 从头推理，完成后生成新技能文件\n\nAuto-generated skill template: [references/cli_ref.md](references/cli_ref.md).\n\n## Verification Loop\n\n`learn.py --cycle` checks after 7 days if the change helped. Verification API and outcomes: [references/cli_ref.md](references/cli_ref.md).\n\n## CLI Commands\n\n```bash\npython3 scripts/learn.py --cycle     # Full cycle: check verifications + promote patterns\npython3 scripts/learn.py --verify    # Only check pending verifications\npython3 scripts/learn.py --status    # Show learning stats\npython3 scripts/learn.py --log learning \"message\" --area behavior --priority high\n```\n\nCLI params reference: [references/cli_ref.md](references/cli_ref.md).\n\n## Hook Integration (Session Start)\n\nFor automatic reminders at session start, install the hook:\n\n```bash\n# Copy hook files (HOOK.md + handler.js) to OpenClaw hooks directory\ncp skills/self-improvement/hooks/openclaw/HOOK.md ~/.openclaw/hooks/self-improvement/HOOK.md\ncp skills/self-improvement/hooks/openclaw/handler.js ~/.openclaw/hooks/self-improvement/handler.js\n\n# Enable it\nopenclaw hooks enable self-improvement\n\n# Verify\nopenclaw hooks list\n```\n\n> **Important:** OpenClaw hooks require `HOOK.md` + `handler.js` at the top level of the hook directory. Shell scripts (`hook.sh`) are not supported.\n\nThe hook checks `.learning-trail.json` on session start for:\n- Pending high-priority items\n- Verifications due for review\n- Patterns ready for promotion\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| Command/operation fails | Log to `.learning-trail.json` |\n| User corrects you | Log to `.learning-trail.json` (correction) |\n| User wants missing feature | Log to `.learning-trail.json` |\n| API/external tool fails | Log to `.learning-trail.json` |\n| Knowledge was outdated | Log to `.learning-trail.json` (knowledge_gap) |\n| Found better approach | Log to `.learning-trail.json` (best_practice) |\n| Same error 3x across sessions | Promote to core file |\n| Change applied 7+ days ago | Run verification check |\n\n## Priority Guidelines\n\n| Priority | When to Use |\n|----------|-------------|\n| **critical** | Blocks core functionality, data loss risk, security issue |\n| **high** | Significant impact, affects common workflows, recurring issue |\n| **medium** | Moderate impact, workaround exists |\n| **low** | Minor inconvenience, nice-to-have |\n\n## Conflict Resolution\n\nPriority scoring when principles contradict: [references/cli_ref.md](references/cli_ref.md).\n\n## Forgetting & Auto-Revert\n\n- 30d without reinforcement → priority demoted; 60d → stale; 90d → `wont_fix`\n- Verification overdue 21+ days → auto-revert\n- Details: [references/cli_ref.md](references/cli_ref.md).\n\n## Proposal Workflow\n\nWhen the learning system detects a pattern ready for promotion or a change that needs verification, it generates a **proposal** for user review:\n\n```\nPattern detected (≥3x across ≥2 sessions)\n    ↓\nGenerate proposal: what to change, why, risk level\n    ↓\nPresent to user for approval\n    ↓\nUser says \"approve N\" or \"skip N\"\n    ↓\nApply approved changes, track for verification\n```\n\n### Proposal Format\n\nEach proposal includes:\n- **Type**: promotion / verification / critical_fix\n- **Target**: Which file to change (TOOLS.md, MEMORY.md, SOUL.md, AGENTS.md)\n- **Change**: Specific text to add/modify\n- **Motivation**: Why this change (pattern evidence)\n- **Risk**: Low (adds info) / Medium (changes behavior)\n- **Effort**: low / medium / high\n- **Impact**: low / medium / high\n\n### Auto-apply vs Propose\n\n| Change Type | Action | Example |\n|-----------|--------|---------|\n| Add note to TOOLS.md | ✅ Auto-apply | \"QWeather needs custom host\" |\n| Add principle to MEMORY.md | ✅ Auto-apply | \"Simple before powerful\" |\n| Add preference to USER.md | ✅ Auto-apply | \"User prefers direct answers\" |\n| Add guideline to SOUL.md | ⚠️ Propose | \"Be concise, skip disclaimers\" |\n| Add rule to AGENTS.md | ⚠️ Propose | \"Spawn sub-agents for long tasks\" |\n| Create new skill | ❌ Always ask | New skill for recurring task |\n\n### Usage\n\n```bash\npython3 scripts/learn.py --propose    # Generate proposals for review\n```\n\nThe agent will present proposals and wait for your approval before applying.\n\n## Conversation Scoring\n\nAfter each significant interaction, score the response on 5 dimensions (0-10):\n\n| Dimension | What it measures |\n|-----------|-----------------|\n| **Accuracy** | Was the output factually correct? |\n| **Usefulness** | Did it solve the user's actual problem? |\n| **Efficiency** | Were tool calls optimal? |\n| **Tone** | Matched SOUL.md persona? |\n| **Proactiveness** | Anticipated needs? |\n\n### Usage\n\n```bash\npython3 scripts/learn.py --score 8 9 7 8 6    # Score last conversation\npython3 scripts/learn.py --trends 7            # Show 7-day trend\n```\n\n### Trend Tracking\n\nExample in [references/cli_ref.md](references/cli_ref.md).\n\n## Dynamic Memory Injection\n\nBuild topic index → detect conversation topic → inject relevant memories.\n```bash\npython3 scripts/learn.py --build-index\npython3 scripts/learn.py --query-memory weather\n```\nTopics list: [references/cli_ref.md](references/cli_ref.md). Index rebuilt during `--cycle`.\n\n## Knowledge Graph\n\nConnects 事件 → 教训 → 原则. Node types, edge types, and CLI usage: [references/cli_ref.md](references/cli_ref.md).\n\n## Key Principles\n\n1. **Learn automatically.** The system should work without being told.\n2. **Verify or it didn't happen.** Every change must be checked later.\n3. **Reversible first.** Always track old state so changes can be undone.\n4. **Patterns over anecdotes.** One error is noise. Three identical errors are a pattern.\n5. **Structured over freeform.** Standardized IDs and categories make learnings searchable.\n6. **Don't log secrets.** Never write tokens, keys, or full source files.\n7. **Don't learn from noise.** Not every interaction is a learning opportunity.\n8. **Connect memories.** Events → lessons → principles form a network, not isolated notes.\n\n## References\n\n- [reflection_frameworks.md](references/reflection_frameworks.md) — Detailed frameworks and patterns\n- [scripts/learn.py](scripts/learn.py) — Learning cycle engine\n- [scripts/reflect.py](scripts/reflect.py) — Session data collector + auto-log\n- [hooks/](hooks/) — OpenClaw session-start hook template\n\n## 更新与迁移\n\n### 更新流程\n1. 备份 `memory/` 目录和 `.learning-trail.json`\n2. 安装新版本\n3. 运行迁移检查：`python3 scripts/migrate.py`\n4. 如有问题，运行迁移：`python3 scripts/migrate.py --migrate`\n\n### 版本兼容性\n- V2.x → V2.2.0：数据格式兼容，无需迁移\n- V1.x → V2.2.0：需要迁移，运行 `python3 scripts/migrate.py --migrate`\n\n### 回滚\n如更新后出问题：\n1. 恢复备份的 `memory/` 目录\n2. 恢复备份的 `.learning-trail.json`\n3. 降级到之前的版本\n\n### ⚠️ Windows 已知问题\n\n在 Windows 上，`openclaw skills update` 可能失败，报 `EPERM: operation not permitted`。\n\n**原因：** OpenClaw Gateway（Node.js）运行时持有技能目录的文件句柄，导致 update 流程中的 rename 操作被操作系统拒绝。\n\n**解决方法：**\n1. 手动删除旧目录：`cmd /c rmdir /s /q \"<skills路径>\\self-improvement-llm\"`\n2. 重新安装：`openclaw skills install self-improvement-llm`\n\n**Linux/macOS 不受影响**，目录在被读取时仍可 rename。\n\n## 备份与同步\n\n### 导出数据\n```bash\npython3 scripts/sync.py export                    # 导出到当前目录\npython3 scripts/sync.py export /path/to/backup.zip  # 导出到指定路径\n```\n\n导出内容：\n- `memory/MEMORY.md` — 长期记忆\n- `memory/.learning-trail.json` — 结构化学习数据\n- `memory/.memory-index.json` — 记忆索引\n- `memory/preferences.json` — 用户偏好\n- `memory/sessions/` — 会话摘要\n- `memory/skills/` — 自动生成的技能\n- `memory/.dreams/` — 梦境蒸馏数据\n- `memory/*.md` — 日常日志\n\n### 导入数据\n```bash\npython3 scripts/sync.py import /path/to/backup.zip  # 导入（不覆盖已有）\npython3 scripts/sync.py import /path/to/backup.zip --overwrite  # 覆盖导入\n```\n\n### 多服务器同步\n1. 服务器 A：`python3 scripts/sync.py export`\n2. 传输 zip 到服务器 B\n3. 服务器 B：`python3 scripts/sync.py import backup.zip`\n\n### 查看状态\n```bash\npython3 scripts/sync.py status\n```\n\nFile v2.3.0:_meta.json\n\n{\n  \"ownerId\": \"kn7afdk9ag1ftxjn0btmw2tj3h82y30x\",\n  \"slug\": \"self-improvement-llm\",\n  \"version\": \"2.3.0\",\n  \"publishedAt\": 1785326090774\n}\n\nFile v2.3.0:references/cli_ref.md\n\n# CLI Reference & Detailed Structures\n\n## Structured Log Format\n\nEvery entry uses this format (inspired by pskoett standard):\n\n### Learning Entry\n\n```\n## [LRN-YYYYMMDD-XXX] category:brief_title\n\n**Logged**: ISO-8601 timestamp\n**Priority**: low | medium | high | critical\n**Status**: pending | in_progress | resolved | wont_fix | promoted\n**Area**: frontend | backend | infra | tests | docs | config | behavior | tooling\n\n### Summary\nOne-line description\n\n### Details\nWhat happened, what was wrong, what's correct\n\n### Suggested Action\nSpecific fix or improvement\n\n### Metadata\n- Source: conversation | error | user_feedback | self_discovery\n- Related Files: path/to/file\n- Tags: tag1, tag2\n- Pattern-Key: unique_key_for_dedup (optional, for recurring patterns)\n- Recurrence-Count: 1\n- First-Seen: YYYY-MM-DD\n- Last-Seen: YYYY-MM-DD\n```\n\n### Error Entry\n\n```\n## [ERR-YYYYMMDD-XXX] tool_or_command_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: high\n**Status**: pending\n**Area**: infra | tooling | config\n\n### Summary\nBrief description of what failed\n\n### Error\nActual error message or output\n\n### Context\n- Command/operation attempted\n- Input or parameters used\n\n### Suggested Fix\nWhat might resolve this\n\n### Metadata\n- Reproducible: yes | no | unknown\n- Related Files: path/to/file\n- See Also: ERR-YYYYMMDD-XXX (if recurring)\n```\n\n### Feature Request Entry\n\n```\n## [FEAT-YYYYMMDD-XXX] capability_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: medium\n**Status**: pending\n**Area**: as appropriate\n\n### Summary\nWhat the user wanted to do\n\n### User Context\nWhy they needed it\n\n### Complexity Estimate\nsimple | medium | complex\n\n### Metadata\n- Frequency: first_time | recurring\n- Related Features: existing_feature_name\n```\n\n### ID Generation\n\nFormat: `TYPE-YYYYMMDD-XXX`\n- TYPE: LRN (learning), ERR (error), FEAT (feature)\n- YYYYMMDD: Current date\n- XXX: Sequential number or random 3 chars (e.g., 001, A7B)\n\n## Auto-Generated Skill Format\n\n```markdown\n---\nname: skill-slug-name\ndescription: 一句话描述这个技能做什么\ncreated: 2026-05-27\nupdated: 2026-05-27\nsource: auto\ntriggers: [\"触发关键词或场景\"]\ntools: [web_fetch, exec, read]\n---\n\n## Procedure\n\n1. 步骤一：做了什么\n2. 步骤二：怎么做的\n3. 步骤三：验证结果\n\n## Pitfalls\n\n- 已知问题或陷阱\n- 容易出错的地方\n- 环境依赖\n\n## Verification\n\n- 如何验证结果正确\n- 预期输出是什么\n```\n\n## Verification Loop — JSON Entry\n\n```json\n{\n  \"id\": \"change-20260505-001\",\n  \"source\": \"LRN-20260505-003\",\n  \"target\": \"TOOLS.md\",\n  \"change\": \"Added 'prefer read over exec for files'\",\n  \"hypothesis\": \"This will reduce file-viewing errors\",\n  \"verified\": false,\n  \"next_check\": \"2026-05-12\",\n  \"evidence\": []\n}\n```\n\n### Verification Outcomes\n\n| Result | Action |\n|--------|--------|\n| ✅ Confirmed effective | Mark verified, reduce monitoring to monthly |\n| ❌ Ineffective | Revert change, log why it failed |\n| ❌ Made worse | Revert immediately, escalate |\n| ❓ Inconclusive | Extend monitoring, add more data points |\n\n## Conflict Resolution — Priority Score\n\n```\nScore = BasePriority(100/60/30/10) + RecurrenceBonus(×10 each) + RecencyBonus(up to 30) + AreaWeight(up to 50)\nHighest score wins.\n```\n\n## Forgetting Mechanism\n\n| Time without reinforcement | Action |\n|---------------------------|--------|\n| 30 days | Priority demoted one level (high→medium, etc.) |\n| 60 days | Priority → low, flagged as stale |\n| 90 days | Auto-resolved as `wont_fix` |\n\n## Auto-Revert\n\n| Overdue | Action |\n|---------|--------|\n| 7 days | Grace period — reminder only |\n| 14 days | First extension + evidence request |\n| 21+ days | Auto-revert: change undone, logged as `auto_reverted` |\n\n## Conversation Scoring — Trend Example\n\n```\n📈 Score Trends (last 7 days, 12 scores):\n\n  Date         Avg  Acc  Use  Eff  Ton  Pro\n  ──────────────────────────────────────────\n  2026-05-01   7.2    8    8    7    7    6\n  2026-05-02   7.8    8    9    7    8    7\n  2026-05-03   8.0    8    9    8    8    7\n\n  Trend: ↑ (7.2 → 8.0)\n```\n\n## CLI --log Parameters\n\n| Param | Values | Default |\n|-------|--------|--------|\n| `--source` | `conversation`, `error`, `user_feedback`, `self_discovery` | `self_discovery` |\n| `--priority` | `critical`, `high`, `medium`, `low` | `medium` |\n| `--area` | any string | `tooling` |\n| `--pattern-key` | any string | none |\n\n## Dynamic Memory Topics\n\n| Topic | Keywords |\n|-------|----------|\n| weather | 天气, 温度, wind, rain, 预报 |\n| code | 代码, script, python, bug, fix |\n| finance | 金融, 股票, stock, 交易 |\n| skill | skill, clawhub, 技能 |\n| learning | improve, learn, reflect, 学习 |\n| memory | memory, remember, recall, 记忆 |\n| browser | browser, playwright, 自动化 |\n| config | config, 配置, setup, API, key |\n\n## Knowledge Graph\n\n### Node Types\n\n| Type | Icon | Description |\n|------|------|-------------|\n| **event** | 📌 | 具体事件 |\n| **lesson** | 💡 | 从事件中学到的教训 |\n| **principle** | 📜 | 通用原则 |\n| **knowledge** | 📖 | 事实知识 |\n| **pattern** | 🔍 | 重复出现的模式 |\n\n### Edge Types\n\n| Type | Direction | Meaning |\n|------|-----------|---------|\n| **caused_by** | A → B | A 是由 B 引起的 |\n| **led_to** | A → B | A 导致了 B |\n| **supports** | A → B | A 支持 B |\n| **contradicts** | A → B | A 与 B 矛盾 |\n| **related_to** | A → B | A 与 B 相关 |\n| **derived_from** | A → B | A 是从 B 推导出来的 |\n\n### Auto-Link Rules\n\n- **Keyword overlap ≥ 2** → `related_to`\n- **Error words** (error, fail, wrong) → `caused_by`\n- **Support words** (should, prefer, use) → `supports`\n- **Contradiction words** (not, instead, rather) → `contradicts`\n\nFile v2.3.0:references/reflection_frameworks.md\n\n# Reflection Frameworks\n\nDeep-dive reference for types of reflection, depth levels, score rubrics, proposal patterns, and the learning system.\n\n## Learning System Architecture\n\nThe self-learning system runs as a background process, not an on-demand command:\n\n```\n                    ┌──────────┐\n                    │  AGENT    │\n                    │  (LLM)    │\n                    └────┬─────┘\n                         │\n         ┌───────────────┼───────────────┐\n         │               │               │\n         ▼               ▼               ▼\n   ┌──────────┐   ┌──────────┐   ┌──────────┐\n   │ Session  │   │  Memory  │   │ Learning │\n   │  Log     │   │  Files   │   │  Trail   │\n   └──────────┘   └──────────┘   └──────────┘\n         │               │               │\n         └───────────────┼───────────────┘\n                         ▼\n                  ┌──────────────┐\n                  │  Heartbeat   │\n                  │  (Idle)      │\n                  └──────┬───────┘\n                         │\n                         ▼\n                  ┌──────────────┐\n                  │ Learn Cycle  │\n                  │  extract →   │\n                  │  verify →    │\n                  │  integrate   │\n                  └──────────────┘\n                         │\n                         ▼\n                  ┌──────────────┐\n                  │  Self-Modify │\n                  │  (files)     │\n                  └──────────────┘\n```\n\n### Data Flow\n\n1. **Session Logging** — After each task, auto-append to `memory/YYYY-MM-DD.md`\n2. **Learning Trail** — `memory/.learning-trail.json` tracks every change, its hypothesis, and verification status\n3. **Heartbeat** — During idle time, triggers `python3 scripts/learn.py --cycle`\n4. **Verify** — Checks if past changes actually improved behavior (measured by error rate)\n5. **Adapt** — Reverts failed changes, reinforces successful ones\n\n### Auto-Logging Format\n\n```markdown\n### ✅ 14:32 - Fetched weather data for Rugao\n### ❌ 14:35 - Tried to send screenshot via exec\n   Error: Platform requires MEDIA directive, not curl\n```\n\nThree lines max per entry. Keep it scannable.\n\n### Learning Trail Structure\n\n```json\n{\n  \"changes\": [\n    {\n      \"id\": \"change-20260505-001\",\n      \"target\": \"TOOLS.md\",\n      \"hypothesis\": \"Adding MEDIA note prevents file delivery failures\",\n      \"verified\": false,\n      \"next_check\": \"2026-05-12\"\n    }\n  ],\n  \"watchlist\": [\n    {\"issue\": \"Using exec instead of read for files\", \"count\": 3, \"status\": \"watch\"}\n  ]\n}\n```\n\n## Industry Patterns\n\nThese are the real-world patterns used by mature agent frameworks:\n\n### 1. Reflexion (Academic, 388⭐)\n**Paper:** Shinn et al., NeurIPS 2023 — [arXiv:2303.11366](https://arxiv.org/abs/2303.11366)\n**Official Code:** [noahshinn/reflexion-draft](https://github.com/noahshinn/reflexion-draft)\n\n```\n┌──────────┐    task + reflections    ┌──────────────┐\n│  Actor   │ ─────────────────────► │     LLM       │\n└──────────┘ ◄──────────────────── └──────────────┘\n     │            output\n     ▼\n┌───────────┐\n│ Evaluator │  → score + feedback\n└───────────┘\n     │  (if score < threshold)\n     ▼\n┌───────────┐\n│ Reflector │  → verbal reflection\n└───────────┘\n     │\n     └──► injected into next actor call\n```\n\n**Key insight:** Reflection is verbal — the agent writes natural language notes about why it failed, then reads those notes as part of the prompt on the next attempt. No gradient updates needed.\n\n### 2. AutoGPT Post-Task Reflection (184k⭐)\n**Repo:** [Significant-Gravitas/AutoGPT](https://github.com/Significant-Gravitas/AutoGPT)\n\n```\n1. Execute task\n2. Evaluate result\n3. Write reflection (what worked, what didn't, patterns observed)\n4. Update memory with reflection\n5. Next task reads previous reflections as context\n```\n\n**Key insight:** Simple but effective at scale. Each task run appends to a \"reflection\" buffer that's included in future context.\n\n### 3. LangGraph Self-Critique Node (31k⭐)\n**Repo:** [langchain-ai/langgraph](https://github.com/langchain-ai/langgraph)\n\n```\n   ┌─────────────┐\n   │  Generate    │\n   └──────┬──────┘\n          │ output\n          ▼\n   ┌─────────────┐\n   │  Critique    │  ← separate LLM call, different prompt\n   └──────┬──────┘\n          │ feedback\n          ▼\n   ┌─────────────┐\n   │  Revise      │  ← original output + critique → improved output\n   └──────┬──────┘\n          │\n          ▼ (final output or loop back)\n```\n\n**Key insight:** The critique node is a **separate call** with a different system prompt (\"find flaws, be harsh\") from the generation node (\"be creative\"). This separation prevents the agent from being too nice to itself.\n\n### 4. CrewAI Multi-Agent Feedback (51k⭐)\n**Repo:** [crewAIInc/crewAI](https://github.com/crewAIInc/crewAI)\n\n```\n┌──────────┐     output     ┌──────────┐\n│  Agent A  │ ────────────► │  Agent B  │\n│ (writer)  │               │ (critic)  │\n└──────────┘               └─────┬────┘\n     ▲                          │ feedback\n     │                          ▼\n     └───────────────────── revise\n```\n\n**Key insight:** Use multi-agent for reflection — one agent generates, another critiques. Avoids the \"LLM is nice to itself\" problem.\n\n### 5. Constitutional AI / Claude Code (120k⭐)\n**Repo:** [anthropics/claude-code](https://github.com/anthropics/claude-code)\n**Paper:** [Constitutional AI: Harmlessness from AI Feedback](https://arxiv.org/abs/2212.08073)\n\n```\n1. Generate output\n2. Self-critique against constitution (set of principles)\n3. Revise based on critique\n4. Repeat until output satisfies constitution\n```\n\n**Key insight:** Instead of ad-hoc reflection, use a fixed \"constitution\" or set of principles to guide self-evaluation. This makes reflection consistent and measurable.\n\n---\n\n## Types of Reflection\n\n### Task-Level Reflection\nAnalysis of a single task execution:\n\n```\nTask: \"Generate an Excel report\"\nResult: Created file but formatting was wrong\nReflection: \"I used openpyxl without setting column widths first.\"\n```\n\n### Session-Level Reflection\nAnalysis of an entire conversation:\n\n```\nSession performance:\n- 3 correct answers, 2 corrections from user\n- 1 unnecessary tool call (2-step process that could be 1)\nReflection: \"I tend to over-tool. Asking for clarification first would reduce unnecessary exec calls.\"\n```\n\n### Skill-Level Reflection\nAnalysis of how well a skill performed:\n\n```\nSkill used: pdf-extractor\nPerformance: Extracted text accurately but missed table structure\nReflection: \"pdf-extractor needs a table extraction mode. Should add PyMuPDF table detection.\"\n```\n\n### Meta-Level Reflection\nReflection on reflection patterns themselves:\n\n```\nReflection pattern observed:\n- I keep finding the same class of error (\"wrong tool for the job\")\n- My reflections are shallow (Level 1 fix, not Level 2/3)\nMeta-reflection: \"Need to push to deeper root cause analysis. Maybe a checklist helps?\"\n```\n\n## Depth Levels\n\n### Level 1 — Symptom Fix\nAddresses the immediate failure.\n\n```\n\"What happened: I used web_fetch when I should have used gh api.\"\n\"Fix: Use gh api for GitHub queries in the future.\"\n```\n\n**Good for:** Quick corrections, obvious mistakes.\n**Bad for:** Systemic issues. Missing the bigger picture.\n\n### Level 2 — Pattern Fix\nIdentifies the pattern across instances.\n\n```\n\"What happened: I keep choosing web_fetch over more specific tools.\"\n\"Pattern: 3 instances in the last 5 sessions.\"\n\"Root cause: web_fetch is my default 'get data from web' tool. I don't consider alternatives.\"\n\"Fix: Add a tool-selection decision tree to TOOLS.md: Web data → gh api if GitHub, web_fetch if generic site.\"\n```\n\n**Good for:** Recurring issues, habit modification.\n**Bad for:** Deep assumptions about how to work.\n\n### Level 3 — Belief Revision\nChallenges fundamental assumptions.\n\n```\n\"What happened: I often fail on multi-step tasks by doing them sequentially.\"\n\"Assumption: 'Do things one at a time' — but that ignores available parallelism.\"\n\"New belief: 'When tasks have no dependencies, parallel is better than sequential.'\"\n\"Fix: Update AGENTS.md workflow section to prefer parallel execution for independent subtasks.\"\n```\n\n**Good for:** Fundamental behavior changes, paradigm shifts.\n**Bad for:** Quick fixes needed immediately.\n\n## Score Rubric (Detailed)\n\n### Accuracy (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Perfect — no errors, no corrections needed |\n| 8-9 | Minor issues — one small correction |\n| 5-7 | Significant error but recoverable |\n| 0-4 | Critical failure — wrong answer, hallucination, destructive action |\n\n**Checklist:**\n- [ ] Facts check out against known data\n- [ ] Code runs without errors\n- [ ] File modifications are correct\n- [ ] No hallucinations (plausible-sounding but false statements)\n\n### Usefulness (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Solved the problem completely, exceeded expectations |\n| 8-9 | Solved the problem, met expectations |\n| 5-7 | Partial solution, user needed to supplement |\n| 0-4 | Did not solve the problem or made it worse |\n\n**Checklist:**\n- [ ] User expressed satisfaction (or at least didn't ask for changes)\n- [ ] Output is directly usable, not \"just a starting point\"\n- [ ] Response addressed the implicit need, not just the explicit ask\n\n### Efficiency (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Minimum possible tool calls, optimal tool choice |\n| 8-9 | Good tool selection, one minor extra step |\n| 5-7 | Acceptable but could be 30% more efficient |\n| 0-4 | Too many calls, wrong tools, redundant work |\n\n**Checklist:**\n- [ ] Chose the right tool for each step\n- [ ] No duplicate calls\n- [ ] Batched operations when possible\n- [ ] Didn't over-fetch (too much data, too many calls)\n\n### Tone/Persona (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Perfectly matched SOUL.md persona, natural, engaging |\n| 8-9 | Good tone, minor stiffness |\n| 5-7 | Acceptable but could be more personable |\n| 0-4 | Wrong tone — too corporate, too chatty, too stiff |\n\n**Checklist:**\n- [ ] No \"I'd be happy to help!\" style filler\n- [ ] No markdown tables in Discord/WhatsApp contexts\n- [ ] Matched user's communication style\n- [ ] Natural, not performative\n\n### Proactiveness (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Anticipated needs, offered relevant extras |\n| 8-9 | Good proactive suggestion |\n| 5-7 | Reactive but thorough |\n| 0-4 | Needed prompting for every step |\n\n**Checklist:**\n- [ ] Offered next steps without being asked\n- [ ] Identified potential issues before they arise\n- [ ] Suggested improvements beyond the immediate ask\n\n## Proposal Impact Matrix\n\nUse this matrix to decide how to apply proposals:\n\n```\nImpact \\ Effort  |  Low Effort  |  Medium Effort  |  High Effort\n-----------------|--------------|-----------------|--------------\nHigh Impact      |  Auto-apply  |  Propose        |  Plan & propose\nMedium Impact    |  Auto-apply  |  Propose        |  Note for later\nLow Impact       |  Note/queue  |  Note/queue     |  Discard\n```\n\n**Auto-apply threshold:**\n- File updated in last 24h: require review\n- File is MEMORY.md or TOOLS.md: safe to auto-apply\n- Change is <10 lines: safe to auto-apply\n- Changes AGENTS.md or SOUL.md: always propose\n- New skill creation: always propose\n\n## Anti-Patterns\n\n1. **Vague reflections** — \"I should be more careful\" → useless. \"I should verify file paths before writing\" → actionable.\n2. **Over-correction** — One failure → entirely new behavior. \"I used web_fetch once when gh was better\" does not mean \"never use web_fetch.\"\n3. **Analysis paralysis** — Spending hours reflecting on minor issues. Use the Impact/Effort matrix.\n4. **Self-serving bias** — Attributing failures to \"bad prompt\" or \"model limitation\" rather than own choices.\n5. **Forgetting the loop** — Propose changes but never check if they worked. Schedule follow-up verification.\n\nFile v2.3.0:hooks/openclaw/HOOK.md\n\n---\nname: self-improvement\ndescription: Self-learning system — checks pending learnings, writes session context, and tracks patterns at gateway startup\nmetadata:\n  openclaw:\n    emoji: \"🧠\"\n    events: [\"gateway:startup\"]\n---\n\n# Self-Improvement Gateway Hook\n\nRuns at gateway startup. Writes actionable context to `memory/.hook-context.txt` for the agent to read at session start.\n\n## What It Does\n\n- Checks `.learning-trail.json` for pending high-priority items\n- Checks for overdue verifications\n- Detects patterns ready for promotion (≥2 occurrences)\n- Checks if recent session summaries exist\n- Writes findings to `memory/.hook-context.txt`\n\n## Agent Usage\n\nAt session start, the agent should:\n```bash\ncat memory/.hook-context.txt\n```\n\nThis file is regenerated at each gateway startup and contains the current state of the learning system.\n\n## Installation\n\nThe hook is auto-installed by OpenClaw when the skill is enabled.\n\nFile v2.3.0:skill-card.md\n\n## Description:\n\nAutonomous memory and self-learning system for AI agents that logs experience, extracts reusable lessons, manages persistent memory, proposes behavior changes, and verifies whether improvements worked.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[brucetangc](https://clawhub.ai/user/brucetangc)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and agent operators use this skill to add persistent self-improvement workflows to an AI agent, including learning logs, memory distillation, preference tracking, skill draft generation, and later verification of behavior changes.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Conversation-derived text can persist into future agent memory and instruction files.\n\nMitigation: Install only when persistent agent memory is intended, and review generated changes before allowing them to influence future behavior.\n\nRisk: Automatic promotion, dream distillation, and startup hooks can change local workspace behavior without direct prompting.\n\nMitigation: Disable or manually gate automatic promotion, dream distillation, and the startup hook unless those behaviors are explicitly desired.\n\nRisk: ZIP import and skill approval helpers can introduce untrusted local files.\n\nMitigation: Use backup import and skill approval helpers only with trusted archives or reviewed drafts, and keep backups before migration or restore operations.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/brucetangc/skills/self-improvement-llm)\n- [CLI Reference & Detailed Structures](references/cli_ref.md)\n- [Reflection Frameworks](references/reflection_frameworks.md)\n- [pskoett/self-improving-agent](https://clawhub.ai/pskoett/self-improving-agent)\n- [Hermes Agent](https://github.com/NousResearch/hermes-agent)\n- [Reflexion](https://arxiv.org/abs/2303.11366)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown guidance with inline shell commands, JSON memory records, and generated skill or configuration files]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May create or update local memory, preference, hook-context, and skill draft files when its workflows are run.]\n\n## Skill Version(s):\n\n2.3.0 (source: ClawHub release metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v2.2.3: 12 files, 57864 bytes\n\nFiles: _meta.json (139b), hooks/openclaw/handler.js (3763b), hooks/openclaw/HOOK.md (934b), references/reflection_frameworks.md (13191b), scripts/dream.py (13334b), scripts/learn.py (69553b), scripts/migrate.py (4798b), scripts/reflect.py (7430b), scripts/skillgen.py (18014b), scripts/sync.py (6508b), skill-card.md (2724b), SKILL.md (29943b)\n\nFile v2.2.3:SKILL.md\n\n---\nname: self-improvement-llm\ndescription: Autonomous memory and self-learning system for AI agents. Continuously collects experience, manages memory (daily logs, user preferences, knowledge extraction), builds knowledge graphs connecting events→lessons→principles, extracts principles, auto-adjusts behavior, and verifies improvements. Proposes actionable changes for user review before applying. Use when: (1) Agent needs to learn from past sessions, (2) User asks \"improve yourself\" or \"learn from this\", (3) Periodic self-evaluation is needed, (4) Agent needs to auto-correct recurring mistakes, (5) Updating AGENTS.md/SOUL.md/MEMORY.md/TOOLS.md based on experience, (6) Extracting universal principles from episodic experiences, (7) Processing user feedback to permanently adapt behavior, (8) Managing daily memory logs, user preferences, or knowledge retention.\n---\n\n# Self-Learning System\n\nA continuous learning loop that automatically captures learnings, tracks improvements, and verifies their effectiveness.\n\n**Inspiration:** This skill fuses the structured recording format and detection triggers from [pskoett/self-improving-agent](https://clawhub.ai/pskoett/self-improving-agent) (6.1k installs) with a verification/hypothesis loop that most agent learning systems lack.\n\n## 🤖 Agent: What You Must Do (Not Optional)\n\nThese are **required behaviors**, not suggestions. Execute them during conversation without being told.\n\n### During Every Conversation\n\n1. **Detect learning opportunities in real-time.** After every user message or tool result, mentally check:\n   - Did the user correct me? → run `python3 scripts/reflect.py --detect \"USER_MESSAGE\"`\n   - Did a tool fail? → log to `.learning-trail.json` immediately\n   - Did I learn something new? → append to `memory/YYYY-MM-DD.md`\n\n2. **Log corrections immediately.** When the user says \"不对\", \"错了\", \"no\", \"actually\", etc.:\n   ```bash\n   python3 scripts/learn.py --log correction \"具体纠正了什么\"\n   ```\n   Set pattern_key for dedup: `--log correction \"message\" --area behavior --priority high`\n\n3. **Log errors automatically.** When a tool call fails or returns unexpected output:\n   ```bash\n   python3 scripts/learn.py --log error \"工具名: 错误简述\" --area tooling --priority medium\n   ```\n\n4. **After significant tasks,** append to today's daily log:\n   ```bash\n   python3 scripts/reflect.py --log \"完成了什么\"\n   ```\n\n### At Session Start\n\n5. **Check `.hook-context.txt`** (written by plugin hook at gateway startup):\n   ```bash\n   cat memory/.hook-context.txt 2>/dev/null\n   ```\n   If it shows pending verifications or patterns ready for promotion, act on them.\n\n6. **Run a quick status check:**\n   ```bash\n   python3 scripts/learn.py --status\n   ```\n\n### During Daily Cycle (via cron, 3AM)\n\n7. The full cycle runs automatically: `python3 scripts/learn.py --cycle`\n   - **🌙 Dream:** Distills recent daily logs into MEMORY.md (dedup + compress)\n   - Auto-promotes patterns (≥2 occurrences across ≥2 sessions)\n   - Auto-generates session summaries (L1)\n   - Auto-triggers skill generation (via `skillgen.py --auto`)\n   - Records `record_change` for verification tracking\n   - Checks for overdue verifications\n\n### ⚠️ Mandatory: Read Before Edit\n\n**CRITICAL RULE — 任何文件编辑前必须先 read 获取当前内容。**\n\n```bash\n# ❌ 错误：凭记忆构造 oldText\nedit(path=\"MEMORY.md\", oldText=\"我印象中的内容\", newText=\"新内容\")\n\n# ✅ 正确：先读文件，拿到实际内容\nread(path=\"MEMORY.md\")\n# 然后用实际内容构造 oldText\nedit(path=\"MEMORY.md\", oldText=\"从 read 结果中复制的精确文本\", newText=\"新内容\")\n```\n\n**为什么：** edit 工具要求 oldText 与文件内容**逐字符匹配**（含空白和换行）。凭记忆构造几乎必然失败，导致 cron 假性 error。\n\n**适用场景：** 编辑 MEMORY.md、TOOLS.md、USER.md、AGENTS.md、SOUL.md 等任何文件。\n\n### Record Changes for Verification\n\n8. **When you modify any core file** (MEMORY.md, TOOLS.md, SOUL.md, AGENTS.md):\n   ```bash\n   python3 scripts/learn.py --record-change MEMORY.md \"what was changed\" \"why this should help\"\n   ```\n   This populates the verification loop so 7 days later the system checks if it helped.\n\n### Score Conversations\n\n9. **At the end of significant conversations,** rate yourself:\n   ```bash\n   python3 scripts/learn.py --score 8 7 9 8 7 \"brief justification\"\n   ```\n   (accuracy, usefulness, efficiency, tone, proactiveness, 0-10 each)\n\n## Learning Loop\n\n```\nSession / Task\n    ↓\n  [DETECT]     ← Automatic triggers: corrections, errors, feature requests\n    ↓\n  [LOG]        ← Structured entries with IDs, priorities, categories\n    ↓\n  [EXTRACT]    ← Distill patterns from repeated entries\n    ↓\n  [PROMOTE]    ← To AGENTS.md / SOUL.md / TOOLS.md / MEMORY.md\n    ↓\n  [VERIFY]     ← 7-day check: did this change actually help?\n    ↓\n  [ADAPT]      ← Reinforce success, revert failure\n    ↓\n  (back to detect on next interaction)\n```\n\n## Memory Management\n\nThe skill also manages the agent's memory system — daily logs, user preferences, and knowledge retention.\n\n### Memory Architecture (借鉴 Hermes Agent 三层设计)\n\n```\n┌─────────────────────────────────────────────────────────┐\n│              THREE-LAYER MEMORY ARCHITECTURE             │\n├──────────────┬──────────────────┬───────────────────────┤\n│  L1: Session │  L2: Persistent  │  L3: User Model       │\n│  Context     │  Store           │  Preferences          │\n│──────────────┼──────────────────┼───────────────────────┤\n│  memory/     │  MEMORY.md       │  memory/              │\n│  sessions/   │  memory/*.md     │  preferences.json     │\n│  (session    │  memory/skills/  │  USER.md              │\n│   summaries) │  (generated      │                       │\n│              │   skills)        │                       │\n└──────────────┴──────────────────┴───────────────────────┘\n\nL1 — 会话上下文\n  存储: memory/sessions/YYYY-MM-DD-NNN.md\n  内容: 每次会话的摘要（做了什么、学到了什么、用户说了什么）\n  生命周期: 自动归档到 memory/YYYY-MM-DD.md，长期保留\n\nL2 — 持久存储\n  存储: MEMORY.md（蒸馏知识）+ memory/*.md（原始日志）+ memory/skills/（自动生成技能）\n  内容: 完成的任务结果、经验教训、可复用技能文件\n  生命周期: 永久保留，MEMORY.md 定期蒸馏\n\nL3 — 用户模型\n  存储: memory/preferences.json + USER.md\n  内容: 用户偏好、沟通风格、技术背景、兴趣、已知痛点\n  生命周期: 持续更新，漂移调整\n```\n\n**Inspiration:** Nous Research [Hermes Agent](https://github.com/NousResearch/hermes-agent) 三层记忆架构。SQLite + FTS5 被我们替换为文件存储（更轻量，适合 OpenClaw）。\n\n### Auto-Daily-Log\n\nAt the end of each significant task or session, automatically append to `memory/YYYY-MM-DD.md`:\n\n```markdown\n### ✅ 10:30 - Task description\n### ❌ 10:35 - Error: brief description\n### 💡 10:40 - Insight: what was learned\n### 📌 10:45 - User preference: user said X\n```\n\nKeep entries short (1-2 lines). Don't log every tool call — only significant events.\n\n### Memory Types\n\n| Type | Layer | Where | Example |\n|------|-------|-------|---------|\n| **Session summaries** | L1 | `memory/sessions/*.md` | \"2026-05-27 搜了苏超、装了 SearXNG\" |\n| **Daily logs** | L2 | `memory/YYYY-MM-DD.md` | \"10:30 创建 self-improvement skill\" |\n| **Distilled principles** | L2 | `MEMORY.md` | \"Simple before powerful\" |\n| **Auto-generated skills** | L2 | `memory/skills/*.md` | \"SearXNG 部署流程\" |\n| **User preferences** | L3 | `memory/preferences.json` | \"直接回答，不要解释\" |\n| **User profile** | L3 | `USER.md` | \"技术背景强，中文沟通\" |\n| **Structured learning** | — | `.learning-trail.json` | 所有 LRN/ERR/FEAT 条目 |\n\n### Memory Retention\n\n| Memory | Retention | Action |\n|--------|-----------|--------|\n| Daily logs | Keep forever | Append-only, never delete |\n| Learning entries | 90 days | Auto-resolve pending items after 90d |\n| Verified principles | Keep forever | Part of long-term knowledge |\n| User preferences | Keep until changed | Update when user says otherwise |\n| Tool notes | Keep until outdated | Update when tools change |\n\n### Memory Search\n\nWhen user asks \"之前说过什么\" or \"帮我回忆一下\":\n\n1. First check `MEMORY.md` (distilled knowledge)\n2. Then check `USER.md` (preferences)\n3. Then `grep` recent `memory/*.md` files\n4. Then check `.learning-trail.json` for structured entries\n\n### Memory Flow\n\n```\n会话中\n  → 检测到用户偏好 / 知识 / 错误\n  → 同时写入 memory/YYYY-MM-DD.md（原始）和 .learning-trail.json（结构化）\n\n会话结束（每次对话结束）\n  → 自动生成 L1 会话摘要到 memory/sessions/YYYY-MM-DD-NNN.md\n  → 摘要包含：做了什么任务、学到了什么、用户反馈、生成了哪些技能\n  → 同时追加到 memory/YYYY-MM-DD.md\n  \n心跳/空闲\n  → 读取 .learning-trail.json 的 patterns\n  → 达到阈值的晋升为 MEMORY.md 原则或 memory/preferences.json 偏好\n  → 检查是否有值得生成技能的任务（5+ 工具调用）\n  \n新会话开始\n  → MEMORY.md 自动注入上下文\n  → .learning-trail.json 的 watchlist 提醒我注意\n```\n\n## Auto-Trigger Points\n\n### Detection Triggers\n\nAutomatically log when you notice:\n\n**Corrections** → log to LEARNINGS.md (category: correction)\n- \"No, that's not right...\"\n- \"Actually, it should be...\"\n- \"You're wrong about...\"\n- \"That's outdated...\"\n- User explicitly correcting your output\n\n**Feature Requests** → log to FEATURE_REQUESTS.md\n- \"Can you also...\"\n- \"I wish you could...\"\n- \"Is there a way to...\"\n- \"Why can't you...\"\n\n**Knowledge Gaps** → log to LEARNINGS.md (category: knowledge_gap)\n- User provides info you didn't know\n- Documentation you referenced is outdated\n- API behavior differs from your understanding\n\n**Errors** → log to ERRORS.md\n- Command returns non-zero exit code\n- Exception or stack trace\n- Timeout or connection failure\n\n**Successes** → log to LEARNINGS.md (category: best_practice)\n- Found a better approach\n- Quicker way to do something\n- Cleaner pattern emerged\n\n### Scheduled Triggers\n\n| Trigger | When | Action |\n|---------|------|--------|\n| **Session end** | After completion | Auto-log summary to memory/YYYY-MM-DD.md + memory/sessions/ L1 summary |\n| **Skill gen check** | After complex task | Auto-generate skill if 5+ tool calls or user says \"记住\" |\n| **Heartbeat** | Idle time | Run learn.py --cycle: check verifications, promote patterns |\n| **Improve yourself** | On demand | Full cycle + report |\n| **Hook** | Session start | If hook installed, review pending learnings |\n\n## Session Summary (L1)\n\n每次会话/任务完成后，自动生成会话摘要到 `memory/sessions/YYYY-MM-DD-NNN.md`：\n\n```markdown\n# Session Summary: 2026-05-27-001\n\n## Tasks Completed\n- [任务名称] 做了什么，结果是什么\n\n## Learnings\n- [学到了什么]\n\n## Skills Generated\n- [生成了哪些技能文件]\n\n## User Feedback\n- [用户说了什么重要反馈]\n\n## Open Items\n- [未完成的或待确认的]\n```\n\n**生成时机：** 一个完整的任务流程结束后（如装完 SearXNG、搜完新闻等）\n\n## Auto Skill Generation\n\n当完成一个复杂度达标的任务后，自动生成标准化技能文件。\n\n**生成条件（满足任意一个）：**\n- 任务涉及 5+ 工具调用\n- 用户明确要求\"记住这个\"或\"记下来\"\n- 重复做过类似任务 ≥ 2 次\n- 发现了新的工作流或最佳实践\n\n**自动检测机制：**\n1. 任务完成后，回看本次会话的工具调用次数\n2. 如果 ≥ 5 次，且该任务不是日常操作（如简单查天气），则生成技能文件\n3. 技能文件名用短横线命名：`memory/skills/<task-slug>.md`\n4. 检查是否已存在类似技能（grep memory/skills/ 目录），有则更新而非新建\n\n## Structured Log Format\n\nEvery entry uses this format (inspired by pskoett standard):\n\n### Learning Entry (LEARNINGS.md / auto-log)\n\n```\n## [LRN-YYYYMMDD-XXX] category:brief_title\n\n**Logged**: ISO-8601 timestamp\n**Priority**: low | medium | high | critical\n**Status**: pending | in_progress | resolved | wont_fix | promoted\n**Area**: frontend | backend | infra | tests | docs | config | behavior | tooling\n\n### Summary\nOne-line description\n\n### Details\nWhat happened, what was wrong, what's correct\n\n### Suggested Action\nSpecific fix or improvement\n\n### Metadata\n- Source: conversation | error | user_feedback | self_discovery\n- Related Files: path/to/file\n- Tags: tag1, tag2\n- Pattern-Key: unique_key_for_dedup (optional, for recurring patterns)\n- Recurrence-Count: 1\n- First-Seen: YYYY-MM-DD\n- Last-Seen: YYYY-MM-DD\n```\n\n### Error Entry (ERRORS.md)\n\n```\n## [ERR-YYYYMMDD-XXX] tool_or_command_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: high\n**Status**: pending\n**Area**: infra | tooling | config\n\n### Summary\nBrief description of what failed\n\n### Error\nActual error message or output\n\n### Context\n- Command/operation attempted\n- Input or parameters used\n\n### Suggested Fix\nWhat might resolve this\n\n### Metadata\n- Reproducible: yes | no | unknown\n- Related Files: path/to/file\n- See Also: ERR-YYYYMMDD-XXX (if recurring)\n```\n\n### Feature Request Entry (FEATURE_REQUESTS.md)\n\n```\n## [FEAT-YYYYMMDD-XXX] capability_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: medium\n**Status**: pending\n**Area**: as appropriate\n\n### Summary\nWhat the user wanted to do\n\n### User Context\nWhy they needed it\n\n### Complexity Estimate\nsimple | medium | complex\n\n### Metadata\n- Frequency: first_time | recurring\n- Related Features: existing_feature_name\n```\n\n### ID Generation\n\nFormat: `TYPE-YYYYMMDD-XXX`\n- TYPE: LRN (learning), ERR (error), FEAT (feature)\n- YYYYMMDD: Current date\n- XXX: Sequential number or random 3 chars (e.g., 001, A7B)\n\n**Where to log:** The agent logs structured entries to `memory/.learning-trail.json` (structured, queryable). The helper scripts also write human-readable copies to `.learnings/` files if they exist.\n\n## Recurring Pattern Detection\n\nWhen logging something that might already exist:\n\n1. Search `.learning-trail.json` for matching Pattern-Key\n2. If found: increment Recurrence-Count, update Last-Seen\n3. If not found: create new entry with Recurrence-Count: 1\n\n### Promotion Rule\n\nPromote a pattern to workspace core files when **all** are true:\n- Recurrence-Count >= 3\n- Seen across at least 2 distinct sessions\n- Occurred within a 30-day window\n\n**Promotion targets:**\n\n| Entry Type | Promote To | Example |\n|-----------|-----------|---------|\n| Behavioral pattern | SOUL.md | \"Be concise, skip disclaimers\" |\n| Workflow improvement | AGENTS.md | \"Spawn sub-agents for long tasks\" |\n| Tool gotcha | TOOLS.md | \"Git push needs auth configured\" |\n| User preference | USER.md / preferences.json | \"User prefers direct answers\" |\n| Universal principle | MEMORY.md | \"Simple before powerful\" |\n| Reusable procedure | memory/skills/*.md | \"SearXNG 部署流程\" |\n\n### Auto-Generated Skill Format (借鉴 Hermes Agent)\n\n```markdown\n---\nname: skill-slug-name\ndescription: 一句话描述这个技能做什么\ncreated: 2026-05-27\nupdated: 2026-05-27\nsource: auto\ntriggers: [\"触发关键词或场景\"]\ntools: [web_fetch, exec, read]\n---\n\n## Procedure\n\n1. 步骤一：做了什么\n2. 步骤二：怎么做的\n3. 步骤三：验证结果\n\n## Pitfalls\n\n- 已知问题或陷阱\n- 容易出错的地方\n- 环境依赖\n\n## Verification\n\n- 如何验证结果正确\n- 预期输出是什么\n```\n\n**技能复用流程：**\n1. 新任务到来 → 搜索 `memory/skills/` 目录匹配关键词\n2. 找到匹配 → 读取技能文件，从 Procedure 开始执行\n3. 未找到 → 从头推理，完成后生成新技能文件\n\n## Verification Loop\n\nWhen a change is promoted or applied, record a verification entry:\n\n```json\n{\n  \"id\": \"change-20260505-001\",\n  \"source\": \"LRN-20260505-003\",\n  \"target\": \"TOOLS.md\",\n  \"change\": \"Added 'prefer read over exec for files'\",\n  \"hypothesis\": \"This will reduce file-viewing errors\",\n  \"verified\": false,\n  \"next_check\": \"2026-05-12\",\n  \"evidence\": []\n}\n```\n\nAfter 7 days, `learn.py --cycle` checks:\n- Did the error rate drop for the addressed issue?\n- Was the change relevant to the root cause?\n- Did the change cause any regressions?\n\n**Verification outcomes:**\n\n| Result | Action |\n|--------|--------|\n| ✅ Confirmed effective | Mark verified, reduce monitoring to monthly |\n| ❌ Ineffective | Revert change, log why it failed |\n| ❌ Made worse | Revert immediately, escalate |\n| ❓ Inconclusive | Extend monitoring, add more data points |\n\n## Verification Script\n\n```bash\npython3 scripts/learn.py --cycle     # Full cycle: check verifications + promote patterns\npython3 scripts/learn.py --verify    # Only check pending verifications\npython3 scripts/learn.py --status    # Show learning stats\n\n# Logging with source\npython3 scripts/learn.py --log learning \"user corrected me on X\" --area behavior --source user_feedback --priority high\n```\n\n**CLI `--log` parameters:**\n\n| Param | Values | Default |\n|-------|--------|--------|\n| `--source` | `conversation`, `error`, `user_feedback`, `self_discovery` | `self_discovery` |\n| `--priority` | `critical`, `high`, `medium`, `low` | `medium` |\n| `--area` | any string | `tooling` |\n| `--pattern-key` | any string | none |\n\n## Hook Integration (Session Start)\n\nFor automatic reminders at session start, install the hook:\n\n```bash\n# Copy hook files (HOOK.md + handler.js) to OpenClaw hooks directory\ncp skills/self-improvement/hooks/openclaw/HOOK.md ~/.openclaw/hooks/self-improvement/HOOK.md\ncp skills/self-improvement/hooks/openclaw/handler.js ~/.openclaw/hooks/self-improvement/handler.js\n\n# Enable it\nopenclaw hooks enable self-improvement\n\n# Verify\nopenclaw hooks list\n```\n\n> **Important:** OpenClaw hooks require `HOOK.md` + `handler.js` at the top level of the hook directory. Shell scripts (`hook.sh`) are not supported.\n\nThe hook checks `.learning-trail.json` on session start for:\n- Pending high-priority items\n- Verifications due for review\n- Patterns ready for promotion\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| Command/operation fails | Log to ERRORS.md + auto-log |\n| User corrects you | Log to LEARNINGS.md (correction) |\n| User wants missing feature | Log to FEATURE_REQUESTS.md |\n| API/external tool fails | Log to ERRORS.md |\n| Knowledge was outdated | Log to LEARNINGS.md (knowledge_gap) |\n| Found better approach | Log to LEARNINGS.md (best_practice) |\n| Same error 3x across sessions | Promote to core file |\n| Change applied 7+ days ago | Run verification check |\n\n## Priority Guidelines\n\n| Priority | When to Use |\n|----------|-------------|\n| **critical** | Blocks core functionality, data loss risk, security issue |\n| **high** | Significant impact, affects common workflows, recurring issue |\n| **medium** | Moderate impact, workaround exists |\n| **low** | Minor inconvenience, nice-to-have |\n\n## Conflict Resolution\n\nWhen two principles contradict, the system uses **priority scoring** to decide which wins:\n\n```\nScore = BasePriority(100/60/30/10) + RecurrenceBonus(×10 each) + RecencyBonus(up to 30) + AreaWeight(up to 50)\n\nHighest score wins.\n```\n\nExample conflict:\n- \"Use headless browser for automation\" (tooling, score: 85)\n- \"Show browser window for demos\" (behavior, score: 40)\n- **Winner:** headless automation (85 > 40)\n\nWhen a tie is detected, the system logs it for human review.\n\n## Forgetting Mechanism\n\nOld learnings that aren't reinforced automatically fade:\n\n| Time without reinforcement | Action |\n|---------------------------|--------|\n| 30 days | Priority demoted one level (high→medium, etc.) |\n| 60 days | Priority → low, flagged as stale |\n| 90 days | Auto-resolved as `wont_fix` |\n\nReinforcement happens when:\n- The same error pattern reoccurs → Recurrence-Count increases → freshness reset\n- The agent actively references the principle → logged in evidence\n- User confirms the learning is still relevant\n\n## Auto-Revert\n\nWhen a verification is overdue by 7+ days without evidence:\n\n| Overdue | Action |\n|---------|--------|\n| 7 days | Grace period — reminder only |\n| 14 days | First extension + evidence request |\n| 21+ days | Auto-revert: change undone, logged as `auto_reverted` |\n\nThe revert is safe because all changes are file-based (TOOLS.md, USER.md, etc.) and the old state is tracked in the learning trail.\n\n## Proposal Workflow\n\nWhen the learning system detects a pattern ready for promotion or a change that needs verification, it generates a **proposal** for user review:\n\n```\nPattern detected (≥3x across ≥2 sessions)\n    ↓\nGenerate proposal: what to change, why, risk level\n    ↓\nPresent to user for approval\n    ↓\nUser says \"approve N\" or \"skip N\"\n    ↓\nApply approved changes, track for verification\n```\n\n### Proposal Format\n\nEach proposal includes:\n- **Type**: promotion / verification / critical_fix\n- **Target**: Which file to change (TOOLS.md, MEMORY.md, SOUL.md, AGENTS.md)\n- **Change**: Specific text to add/modify\n- **Motivation**: Why this change (pattern evidence)\n- **Risk**: Low (adds info) / Medium (changes behavior)\n- **Effort**: low / medium / high\n- **Impact**: low / medium / high\n\n### Auto-apply vs Propose\n\n| Change Type | Action | Example |\n|-----------|--------|---------|\n| Add note to TOOLS.md | ✅ Auto-apply | \"QWeather needs custom host\" |\n| Add principle to MEMORY.md | ✅ Auto-apply | \"Simple before powerful\" |\n| Add preference to USER.md | ✅ Auto-apply | \"User prefers direct answers\" |\n| Add guideline to SOUL.md | ⚠️ Propose | \"Be concise, skip disclaimers\" |\n| Add rule to AGENTS.md | ⚠️ Propose | \"Spawn sub-agents for long tasks\" |\n| Create new skill | ❌ Always ask | New skill for recurring task |\n\n### Usage\n\n```bash\npython3 scripts/learn.py --propose    # Generate proposals for review\n```\n\nThe agent will present proposals and wait for your approval before applying.\n\n## Conversation Scoring\n\nAfter each significant interaction, score the response on 5 dimensions (0-10):\n\n| Dimension | What it measures |\n|-----------|-----------------|\n| **Accuracy** | Was the output factually correct? |\n| **Usefulness** | Did it solve the user's actual problem? |\n| **Efficiency** | Were tool calls optimal? |\n| **Tone** | Matched SOUL.md persona? |\n| **Proactiveness** | Anticipated needs? |\n\n### Usage\n\n```bash\npython3 scripts/learn.py --score 8 9 7 8 6    # Score last conversation\npython3 scripts/learn.py --trends 7            # Show 7-day trend\n```\n\n### Trend Tracking\n\nScores are stored in `.learning-trail.json` and displayed as trends:\n\n```\n📈 Score Trends (last 7 days, 12 scores):\n\n  Date         Avg  Acc  Use  Eff  Ton  Pro\n  ──────────────────────────────────────────\n  2026-05-01   7.2    8    8    7    7    6\n  2026-05-02   7.8    8    9    7    8    7\n  2026-05-03   8.0    8    9    8    8    7\n\n  Trend: ↑ (7.2 → 8.0)\n```\n\n**No scores yet** = no way to measure improvement. Start scoring after each meaningful interaction.\n\n## Dynamic Memory Injection\n\nInstead of injecting ALL of MEMORY.md into every session, the system builds a **topic-indexed memory index** and injects only relevant memories.\n\n### How It Works\n\n1. **Build index** — Scan `memory/*.md` files, detect topics, create `.memory-index.json`\n2. **Detect topic** — When a conversation starts, detect the topic from the user's message\n3. **Inject relevant memory** — Only memories matching the topic are injected\n\n### Topics\n\n| Topic | Keywords |\n|-------|----------|\n| weather | 天气, 温度, wind, rain, 预报 |\n| code | 代码, script, python, bug, fix |\n| finance | 金融, 股票, stock, 交易 |\n| skill | skill, clawhub, 技能 |\n| learning | improve, learn, reflect, 学习 |\n| memory | memory, remember, recall, 记忆 |\n| browser | browser, playwright, 自动化 |\n| config | config, 配置, setup, API, key |\n\n### Usage\n\n```bash\npython3 scripts/learn.py --build-index    # Build topic index\npython3 scripts/learn.py --query-memory weather    # Query weather memories\n```\n\nThe index is automatically rebuilt during `--cycle`. When a new session starts, the agent detects the topic and queries relevant memories instead of loading everything.\n\n## Knowledge Graph\n\nConnect memories into a network: **事件 → 教训 → 原则**。\n\n### Node Types\n\n| Type | Icon | Description |\n|------|------|-------------|\n| **event** | 📌 | 具体事件（\"用了 exec 读文件\"） |\n| **lesson** | 💡 | 从事件中学到的教训 |\n| **principle** | 📜 | 通用原则（\"Simple before powerful\"） |\n| **knowledge** | 📖 | 事实知识（\"QWeather 需要自定义 Host\"） |\n| **pattern** | 🔍 | 重复出现的模式 |\n\n### Edge Types\n\n| Type | Direction | Meaning |\n|------|-----------|---------|\n| **caused_by** | A → B | A 是由 B 引起的 |\n| **led_to** | A → B | A 导致了 B |\n| **supports** | A → B | A 支持 B |\n| **contradicts** | A → B | A 与 B 矛盾 |\n| **related_to** | A → B | A 与 B 相关 |\n| **derived_from** | A → B | A 是从 B 推导出来的 |\n\n### Usage\n\n```bash\n# Create nodes\npython3 scripts/learn.py --graph-node event \"用了 exec 读文件\" manual\npython3 scripts/learn.py --graph-node lesson \"应该用 read 工具\" manual\npython3 scripts/learn.py --graph-node principle \"Simple before powerful\" manual\n\n# Create edges\npython3 scripts/learn.py --graph-edge eve-XXXX-001 les-XXXX-001 caused_by\npython3 scripts/learn.py --graph-edge les-XXXX-001 pri-XXXX-001 led_to\n\n# Auto-link (based on content similarity)\npython3 scripts/learn.py --graph-auto-link eve-XXXX-001 \"用了 exec 读文件\"\n\n# Query graph\npython3 scripts/learn.py --graph-query              # Show full graph\npython3 scripts/learn.py --graph-query type:lesson  # Query by type\npython3 scripts/learn.py --graph-query eve-XXXX-001 # Query by node ID\n```\n\n### Auto-Link\n\nWhen creating a node, the system automatically links it to existing nodes based on content similarity:\n\n- **Keyword overlap ≥ 2** → `related_to`\n- **Error words** (error, fail, wrong) → `caused_by`\n- **Support words** (should, prefer, use) → `supports`\n- **Contradiction words** (not, instead, rather) → `contradicts`\n\n### Example Graph\n\n```\n🕸️  Knowledge Graph (4 nodes, 3 edges):\n\n  📌 EVENTs (1):\n    [eve-20260505-001] Used exec for file read instead of read tool\n  💡 LESSONs (1):\n    [les-20260505-002] Always use read tool for file viewing, not exec\n  📜 PRINCIPLEs (1):\n    [pri-20260505-003] Simple before powerful\n  📖 KNOWLEDGEs (1):\n    [kno-20260505-004] QWeather needs custom API host\n\n  🔗 Edges:\n    Always use read tool... ──caused_by──► Used exec for file...\n    Always use read tool... ──led_to──► Simple before powerful...\n```\n\n## Key Principles\n\n1. **Learn automatically.** The system should work without being told.\n2. **Verify or it didn't happen.** Every change must be checked later.\n3. **Reversible first.** Always track old state so changes can be undone.\n4. **Patterns over anecdotes.** One error is noise. Three identical errors are a pattern.\n5. **Structured over freeform.** Standardized IDs and categories make learnings searchable.\n6. **Don't log secrets.** Never write tokens, keys, or full source files.\n7. **Don't learn from noise.** Not every interaction is a learning opportunity.\n8. **Connect memories.** Events → lessons → principles form a network, not isolated notes.\n\n## References\n\n- [reflection_frameworks.md](references/reflection_frameworks.md) — Detailed frameworks and patterns\n- [scripts/learn.py](scripts/learn.py) — Learning cycle engine\n- [scripts/reflect.py](scripts/reflect.py) — Session data collector + auto-log\n- [hsoks/](hooks/) — OpenClaw session-start hook template\n\n## 更新与迁移\n\n### 更新流程\n1. 备份 `memory/` 目录和 `.learning-trail.json`\n2. 安装新版本\n3. 运行迁移检查：`python3 scripts/migrate.py`\n4. 如有问题，运行迁移：`python3 scripts/migrate.py --migrate`\n\n### 版本兼容性\n- V2.x → V2.2.0：数据格式兼容，无需迁移\n- V1.x → V2.2.0：需要迁移，运行 `python3 scripts/migrate.py --migrate`\n\n### 回滚\n如更新后出问题：\n1. 恢复备份的 `memory/` 目录\n2. 恢复备份的 `.learning-trail.json`\n3. 降级到之前的版本\n\n## 备份与同步\n\n### 导出数据\n```bash\npython3 scripts/sync.py export                    # 导出到当前目录\npython3 scripts/sync.py export /path/to/backup.zip  # 导出到指定路径\n```\n\n导出内容：\n- `memory/MEMORY.md` — 长期记忆\n- `memory/.learning-trail.json` — 结构化学习数据\n- `memory/.memory-index.json` — 记忆索引\n- `memory/preferences.json` — 用户偏好\n- `memory/sessions/` — 会话摘要\n- `memory/skills/` — 自动生成的技能\n- `memory/.dreams/` — 梦境蒸馏数据\n- `memory/*.md` — 日常日志\n\n### 导入数据\n```bash\npython3 scripts/sync.py import /path/to/backup.zip  # 导入（不覆盖已有）\npython3 scripts/sync.py import /path/to/backup.zip --overwrite  # 覆盖导入\n```\n\n### 多服务器同步\n1. 服务器 A：`python3 scripts/sync.py export`\n2. 传输 zip 到服务器 B\n3. 服务器 B：`python3 scripts/sync.py import backup.zip`\n\n### 查看状态\n```bash\npython3 scripts/sync.py status\n```\n\nFile v2.2.3:_meta.json\n\n{\n  \"ownerId\": \"kn7afdk9ag1ftxjn0btmw2tj3h82y30x\",\n  \"slug\": \"self-improvement-llm\",\n  \"version\": \"2.2.3\",\n  \"publishedAt\": 1781664610660\n}\n\nFile v2.2.3:references/reflection_frameworks.md\n\n# Reflection Frameworks\n\nDeep-dive reference for types of reflection, depth levels, score rubrics, proposal patterns, and the learning system.\n\n## Learning System Architecture\n\nThe self-learning system runs as a background process, not an on-demand command:\n\n```\n                    ┌──────────┐\n                    │  AGENT    │\n                    │  (LLM)    │\n                    └────┬─────┘\n                         │\n         ┌───────────────┼───────────────┐\n         │               │               │\n         ▼               ▼               ▼\n   ┌──────────┐   ┌──────────┐   ┌──────────┐\n   │ Session  │   │  Memory  │   │ Learning │\n   │  Log     │   │  Files   │   │  Trail   │\n   └──────────┘   └──────────┘   └──────────┘\n         │               │               │\n         └───────────────┼───────────────┘\n                         ▼\n                  ┌──────────────┐\n                  │  Heartbeat   │\n                  │  (Idle)      │\n                  └──────┬───────┘\n                         │\n                         ▼\n                  ┌──────────────┐\n                  │ Learn Cycle  │\n                  │  extract →   │\n                  │  verify →    │\n                  │  integrate   │\n                  └──────────────┘\n                         │\n                         ▼\n                  ┌──────────────┐\n                  │  Self-Modify │\n                  │  (files)     │\n                  └──────────────┘\n```\n\n### Data Flow\n\n1. **Session Logging** — After each task, auto-append to `memory/YYYY-MM-DD.md`\n2. **Learning Trail** — `memory/.learning-trail.json` tracks every change, its hypothesis, and verification status\n3. **Heartbeat** — During idle time, triggers `python3 scripts/learn.py --cycle`\n4. **Verify** — Checks if past changes actually improved behavior (measured by error rate)\n5. **Adapt** — Reverts failed changes, reinforces successful ones\n\n### Auto-Logging Format\n\n```markdown\n### ✅ 14:32 - Fetched weather data for Rugao\n### ❌ 14:35 - Tried to send screenshot via exec\n   Error: Platform requires MEDIA directive, not curl\n```\n\nThree lines max per entry. Keep it scannable.\n\n### Learning Trail Structure\n\n```json\n{\n  \"changes\": [\n    {\n      \"id\": \"change-20260505-001\",\n      \"target\": \"TOOLS.md\",\n      \"hypothesis\": \"Adding MEDIA note prevents file delivery failures\",\n      \"verified\": false,\n      \"next_check\": \"2026-05-12\"\n    }\n  ],\n  \"watchlist\": [\n    {\"issue\": \"Using exec instead of read for files\", \"count\": 3, \"status\": \"watch\"}\n  ]\n}\n```\n\n## Industry Patterns\n\nThese are the real-world patterns used by mature agent frameworks:\n\n### 1. Reflexion (Academic, 388⭐)\n**Paper:** Shinn et al., NeurIPS 2023 — [arXiv:2303.11366](https://arxiv.org/abs/2303.11366)\n**Official Code:** [noahshinn/reflexion-draft](https://github.com/noahshinn/reflexion-draft)\n\n```\n┌──────────┐    task + reflections    ┌──────────────┐\n│  Actor   │ ─────────────────────► │     LLM       │\n└──────────┘ ◄──────────────────── └──────────────┘\n     │            output\n     ▼\n┌───────────┐\n│ Evaluator │  → score + feedback\n└───────────┘\n     │  (if score < threshold)\n     ▼\n┌───────────┐\n│ Reflector │  → verbal reflection\n└───────────┘\n     │\n     └──► injected into next actor call\n```\n\n**Key insight:** Reflection is verbal — the agent writes natural language notes about why it failed, then reads those notes as part of the prompt on the next attempt. No gradient updates needed.\n\n### 2. AutoGPT Post-Task Reflection (184k⭐)\n**Repo:** [Significant-Gravitas/AutoGPT](https://github.com/Significant-Gravitas/AutoGPT)\n\n```\n1. Execute task\n2. Evaluate result\n3. Write reflection (what worked, what didn't, patterns observed)\n4. Update memory with reflection\n5. Next task reads previous reflections as context\n```\n\n**Key insight:** Simple but effective at scale. Each task run appends to a \"reflection\" buffer that's included in future context.\n\n### 3. LangGraph Self-Critique Node (31k⭐)\n**Repo:** [langchain-ai/langgraph](https://github.com/langchain-ai/langgraph)\n\n```\n   ┌─────────────┐\n   │  Generate    │\n   └──────┬──────┘\n          │ output\n          ▼\n   ┌─────────────┐\n   │  Critique    │  ← separate LLM call, different prompt\n   └──────┬──────┘\n          │ feedback\n          ▼\n   ┌─────────────┐\n   │  Revise      │  ← original output + critique → improved output\n   └──────┬──────┘\n          │\n          ▼ (final output or loop back)\n```\n\n**Key insight:** The critique node is a **separate call** with a different system prompt (\"find flaws, be harsh\") from the generation node (\"be creative\"). This separation prevents the agent from being too nice to itself.\n\n### 4. CrewAI Multi-Agent Feedback (51k⭐)\n**Repo:** [crewAIInc/crewAI](https://github.com/crewAIInc/crewAI)\n\n```\n┌──────────┐     output     ┌──────────┐\n│  Agent A  │ ────────────► │  Agent B  │\n│ (writer)  │               │ (critic)  │\n└──────────┘               └─────┬────┘\n     ▲                          │ feedback\n     │                          ▼\n     └───────────────────── revise\n```\n\n**Key insight:** Use multi-agent for reflection — one agent generates, another critiques. Avoids the \"LLM is nice to itself\" problem.\n\n### 5. Constitutional AI / Claude Code (120k⭐)\n**Repo:** [anthropics/claude-code](https://github.com/anthropics/claude-code)\n**Paper:** [Constitutional AI: Harmlessness from AI Feedback](https://arxiv.org/abs/2212.08073)\n\n```\n1. Generate output\n2. Self-critique against constitution (set of principles)\n3. Revise based on critique\n4. Repeat until output satisfies constitution\n```\n\n**Key insight:** Instead of ad-hoc reflection, use a fixed \"constitution\" or set of principles to guide self-evaluation. This makes reflection consistent and measurable.\n\n---\n\n## Types of Reflection\n\n### Task-Level Reflection\nAnalysis of a single task execution:\n\n```\nTask: \"Generate an Excel report\"\nResult: Created file but formatting was wrong\nReflection: \"I used openpyxl without setting column widths first.\"\n```\n\n### Session-Level Reflection\nAnalysis of an entire conversation:\n\n```\nSession performance:\n- 3 correct answers, 2 corrections from user\n- 1 unnecessary tool call (2-step process that could be 1)\nReflection: \"I tend to over-tool. Asking for clarification first would reduce unnecessary exec calls.\"\n```\n\n### Skill-Level Reflection\nAnalysis of how well a skill performed:\n\n```\nSkill used: pdf-extractor\nPerformance: Extracted text accurately but missed table structure\nReflection: \"pdf-extractor needs a table extraction mode. Should add PyMuPDF table detection.\"\n```\n\n### Meta-Level Reflection\nReflection on reflection patterns themselves:\n\n```\nReflection pattern observed:\n- I keep finding the same class of error (\"wrong tool for the job\")\n- My reflections are shallow (Level 1 fix, not Level 2/3)\nMeta-reflection: \"Need to push to deeper root cause analysis. Maybe a checklist helps?\"\n```\n\n## Depth Levels\n\n### Level 1 — Symptom Fix\nAddresses the immediate failure.\n\n```\n\"What happened: I used web_fetch when I should have used gh api.\"\n\"Fix: Use gh api for GitHub queries in the future.\"\n```\n\n**Good for:** Quick corrections, obvious mistakes.\n**Bad for:** Systemic issues. Missing the bigger picture.\n\n### Level 2 — Pattern Fix\nIdentifies the pattern across instances.\n\n```\n\"What happened: I keep choosing web_fetch over more specific tools.\"\n\"Pattern: 3 instances in the last 5 sessions.\"\n\"Root cause: web_fetch is my default 'get data from web' tool. I don't consider alternatives.\"\n\"Fix: Add a tool-selection decision tree to TOOLS.md: Web data → gh api if GitHub, web_fetch if generic site.\"\n```\n\n**Good for:** Recurring issues, habit modification.\n**Bad for:** Deep assumptions about how to work.\n\n### Level 3 — Belief Revision\nChallenges fundamental assumptions.\n\n```\n\"What happened: I often fail on multi-step tasks by doing them sequentially.\"\n\"Assumption: 'Do things one at a time' — but that ignores available parallelism.\"\n\"New belief: 'When tasks have no dependencies, parallel is better than sequential.'\"\n\"Fix: Update AGENTS.md workflow section to prefer parallel execution for independent subtasks.\"\n```\n\n**Good for:** Fundamental behavior changes, paradigm shifts.\n**Bad for:** Quick fixes needed immediately.\n\n## Score Rubric (Detailed)\n\n### Accuracy (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Perfect — no errors, no corrections needed |\n| 8-9 | Minor issues — one small correction |\n| 5-7 | Significant error but recoverable |\n| 0-4 | Critical failure — wrong answer, hallucination, destructive action |\n\n**Checklist:**\n- [ ] Facts check out against known data\n- [ ] Code runs without errors\n- [ ] File modifications are correct\n- [ ] No hallucinations (plausible-sounding but false statements)\n\n### Usefulness (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Solved the problem completely, exceeded expectations |\n| 8-9 | Solved the problem, met expectations |\n| 5-7 | Partial solution, user needed to supplement |\n| 0-4 | Did not solve the problem or made it worse |\n\n**Checklist:**\n- [ ] User expressed satisfaction (or at least didn't ask for changes)\n- [ ] Output is directly usable, not \"just a starting point\"\n- [ ] Response addressed the implicit need, not just the explicit ask\n\n### Efficiency (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Minimum possible tool calls, optimal tool choice |\n| 8-9 | Good tool selection, one minor extra step |\n| 5-7 | Acceptable but could be 30% more efficient |\n| 0-4 | Too many calls, wrong tools, redundant work |\n\n**Checklist:**\n- [ ] Chose the right tool for each step\n- [ ] No duplicate calls\n- [ ] Batched operations when possible\n- [ ] Didn't over-fetch (too much data, too many calls)\n\n### Tone/Persona (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Perfectly matched SOUL.md persona, natural, engaging |\n| 8-9 | Good tone, minor stiffness |\n| 5-7 | Acceptable but could be more personable |\n| 0-4 | Wrong tone — too corporate, too chatty, too stiff |\n\n**Checklist:**\n- [ ] No \"I'd be happy to help!\" style filler\n- [ ] No markdown tables in Discord/WhatsApp contexts\n- [ ] Matched user's communication style\n- [ ] Natural, not performative\n\n### Proactiveness (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Anticipated needs, offered relevant extras |\n| 8-9 | Good proactive suggestion |\n| 5-7 | Reactive but thorough |\n| 0-4 | Needed prompting for every step |\n\n**Checklist:**\n- [ ] Offered next steps without being asked\n- [ ] Identified potential issues before they arise\n- [ ] Suggested improvements beyond the immediate ask\n\n## Proposal Impact Matrix\n\nUse this matrix to decide how to apply proposals:\n\n```\nImpact \\ Effort  |  Low Effort  |  Medium Effort  |  High Effort\n-----------------|--------------|-----------------|--------------\nHigh Impact      |  Auto-apply  |  Propose        |  Plan & propose\nMedium Impact    |  Auto-apply  |  Propose        |  Note for later\nLow Impact       |  Note/queue  |  Note/queue     |  Discard\n```\n\n**Auto-apply threshold:**\n- File updated in last 24h: require review\n- File is MEMORY.md or TOOLS.md: safe to auto-apply\n- Change is <10 lines: safe to auto-apply\n- Changes AGENTS.md or SOUL.md: always propose\n- New skill creation: always propose\n\n## Anti-Patterns\n\n1. **Vague reflections** — \"I should be more careful\" → useless. \"I should verify file paths before writing\" → actionable.\n2. **Over-correction** — One failure → entirely new behavior. \"I used web_fetch once when gh was better\" does not mean \"never use web_fetch.\"\n3. **Analysis paralysis** — Spending hours reflecting on minor issues. Use the Impact/Effort matrix.\n4. **Self-serving bias** — Attributing failures to \"bad prompt\" or \"model limitation\" rather than own choices.\n5. **Forgetting the loop** — Propose changes but never check if they worked. Schedule follow-up verification.\n\nFile v2.2.3:hooks/openclaw/HOOK.md\n\n---\nname: self-improvement\ndescription: Self-learning system — checks pending learnings, writes session context, and tracks patterns at gateway startup\nmetadata:\n  openclaw:\n    emoji: \"🧠\"\n    events: [\"gateway:startup\"]\n---\n\n# Self-Improvement Gateway Hook\n\nRuns at gateway startup. Writes actionable context to `memory/.hook-context.txt` for the agent to read at session start.\n\n## What It Does\n\n- Checks `.learning-trail.json` for pending high-priority items\n- Checks for overdue verifications\n- Detects patterns ready for promotion (≥2 occurrences)\n- Checks if recent session summaries exist\n- Writes findings to `memory/.hook-context.txt`\n\n## Agent Usage\n\nAt session start, the agent should:\n```bash\ncat memory/.hook-context.txt\n```\n\nThis file is regenerated at each gateway startup and contains the current state of the learning system.\n\n## Installation\n\nThe hook is auto-installed by OpenClaw when the skill is enabled.\n\nFile v2.2.3:skill-card.md\n\n## Description: <br>\nSelf-Improvement (LLM Memory) gives agents a local memory and reflection workflow for logging experience, extracting lessons, tracking preferences, proposing behavior updates, and checking whether changes helped. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[brucetangc](https://clawhub.ai/user/brucetangc) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and agent operators use this skill when they want an agent to maintain local long-term memory, capture feedback, summarize sessions, extract recurring patterns, and propose or apply updates to local guidance files. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill keeps long-term local memory, including logs and preferences, which can retain sensitive or outdated information. <br>\nMitigation: Review the memory directory before enabling the skill, periodically inspect or delete stored logs and preferences, and use it only when persistent local memory is intended. <br>\nRisk: Automatic learning cycles and promotions can change local guidance files and influence future agent behavior with too little user control. <br>\nMitigation: Avoid or disable automatic cycles where possible, review proposed promotions before relying on them, and verify changes before deployment. <br>\nRisk: Backup ZIP import can restore untrusted memory data into the local workspace. <br>\nMitigation: Import only trusted backups, prefer non-overwrite imports, and inspect restored memory files before running learning or promotion commands. <br>\n\n\n## Reference(s): <br>\n- [ClawHub Skill Page](https://clawhub.ai/brucetangc/self-improvement-llm) <br>\n- [Reflection Frameworks](references/reflection_frameworks.md) <br>\n- [pskoett/self-improving-agent](https://clawhub.ai/pskoett/self-improving-agent) <br>\n- [Hermes Agent](https://github.com/NousResearch/hermes-agent) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance] <br>\n**Output Format:** [Markdown guidance with inline shell commands and local file-change proposals] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May create or update local memory logs, indexes, generated skill drafts, and guidance files when its scripts are run.] <br>\n\n## Skill Version(s): <br>\n2.2.3 (source: server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v2.2.2: 12 files, 57609 bytes\n\nFiles: hooks/openclaw/handler.js (3763b), hooks/openclaw/HOOK.md (934b), references/reflection_frameworks.md (13191b), scripts/dream.py (13334b), scripts/learn.py (69553b), scripts/migrate.py (4798b), scripts/reflect.py (7430b), scripts/skillgen.py (18014b), scripts/sync.py (6508b), skill-card.md (2970b), SKILL.md (29214b), _meta.json (139b)\n\nFile v2.2.2:SKILL.md\n\n---\nname: self-improvement\ndescription: Autonomous memory and self-learning system for AI agents. Continuously collects experience, manages memory (daily logs, user preferences, knowledge extraction), builds knowledge graphs connecting events→lessons→principles, extracts principles, auto-adjusts behavior, and verifies improvements. Proposes actionable changes for user review before applying. Use when: (1) Agent needs to learn from past sessions, (2) User asks \"improve yourself\" or \"learn from this\", (3) Periodic self-evaluation is needed, (4) Agent needs to auto-correct recurring mistakes, (5) Updating AGENTS.md/SOUL.md/MEMORY.md/TOOLS.md based on experience, (6) Extracting universal principles from episodic experiences, (7) Processing user feedback to permanently adapt behavior, (8) Managing daily memory logs, user preferences, or knowledge retention.\n---\n\n# Self-Learning System\n\nA continuous learning loop that automatically captures learnings, tracks improvements, and verifies their effectiveness.\n\n**Inspiration:** This skill fuses the structured recording format and detection triggers from [pskoett/self-improving-agent](https://clawhub.ai/pskoett/self-improving-agent) (6.1k installs) with a verification/hypothesis loop that most agent learning systems lack.\n\n## 🤖 Agent: What You Must Do (Not Optional)\n\nThese are **required behaviors**, not suggestions. Execute them during conversation without being told.\n\n### During Every Conversation\n\n1. **Detect learning opportunities in real-time.** After every user message or tool result, mentally check:\n   - Did the user correct me? → run `python3 scripts/reflect.py --detect \"USER_MESSAGE\"`\n   - Did a tool fail? → log to `.learning-trail.json` immediately\n   - Did I learn something new? → append to `memory/YYYY-MM-DD.md`\n\n2. **Log corrections immediately.** When the user says \"不对\", \"错了\", \"no\", \"actually\", etc.:\n   ```bash\n   python3 scripts/learn.py --log correction \"具体纠正了什么\"\n   ```\n   Set pattern_key for dedup: `--log correction \"message\" --area behavior --priority high`\n\n3. **Log errors automatically.** When a tool call fails or returns unexpected output:\n   ```bash\n   python3 scripts/learn.py --log error \"工具名: 错误简述\" --area tooling --priority medium\n   ```\n\n4. **After significant tasks,** append to today's daily log:\n   ```bash\n   python3 scripts/reflect.py --log \"完成了什么\"\n   ```\n\n### At Session Start\n\n5. **Check `.hook-context.txt`** (written by plugin hook at gateway startup):\n   ```bash\n   cat memory/.hook-context.txt 2>/dev/null\n   ```\n   If it shows pending verifications or patterns ready for promotion, act on them.\n\n6. **Run a quick status check:**\n   ```bash\n   python3 scripts/learn.py --status\n   ```\n\n### During Daily Cycle (via cron, 3AM)\n\n7. The full cycle runs automatically: `python3 scripts/learn.py --cycle`\n   - **🌙 Dream:** Distills recent daily logs into MEMORY.md (dedup + compress)\n   - Auto-promotes patterns (≥2 occurrences across ≥2 sessions)\n   - Auto-generates session summaries (L1)\n   - Auto-triggers skill generation (via `skillgen.py --auto`)\n   - Records `record_change` for verification tracking\n   - Checks for overdue verifications\n\n### Record Changes for Verification\n\n8. **When you modify any core file** (MEMORY.md, TOOLS.md, SOUL.md, AGENTS.md):\n   ```bash\n   python3 scripts/learn.py --record-change MEMORY.md \"what was changed\" \"why this should help\"\n   ```\n   This populates the verification loop so 7 days later the system checks if it helped.\n\n### Score Conversations\n\n9. **At the end of significant conversations,** rate yourself:\n   ```bash\n   python3 scripts/learn.py --score 8 7 9 8 7 \"brief justification\"\n   ```\n   (accuracy, usefulness, efficiency, tone, proactiveness, 0-10 each)\n\n## Learning Loop\n\n```\nSession / Task\n    ↓\n  [DETECT]     ← Automatic triggers: corrections, errors, feature requests\n    ↓\n  [LOG]        ← Structured entries with IDs, priorities, categories\n    ↓\n  [EXTRACT]    ← Distill patterns from repeated entries\n    ↓\n  [PROMOTE]    ← To AGENTS.md / SOUL.md / TOOLS.md / MEMORY.md\n    ↓\n  [VERIFY]     ← 7-day check: did this change actually help?\n    ↓\n  [ADAPT]      ← Reinforce success, revert failure\n    ↓\n  (back to detect on next interaction)\n```\n\n## Memory Management\n\nThe skill also manages the agent's memory system — daily logs, user preferences, and knowledge retention.\n\n### Memory Architecture (借鉴 Hermes Agent 三层设计)\n\n```\n┌─────────────────────────────────────────────────────────┐\n│              THREE-LAYER MEMORY ARCHITECTURE             │\n├──────────────┬──────────────────┬───────────────────────┤\n│  L1: Session │  L2: Persistent  │  L3: User Model       │\n│  Context     │  Store           │  Preferences          │\n│──────────────┼──────────────────┼───────────────────────┤\n│  memory/     │  MEMORY.md       │  memory/              │\n│  sessions/   │  memory/*.md     │  preferences.json     │\n│  (session    │  memory/skills/  │  USER.md              │\n│   summaries) │  (generated      │                       │\n│              │   skills)        │                       │\n└──────────────┴──────────────────┴───────────────────────┘\n\nL1 — 会话上下文\n  存储: memory/sessions/YYYY-MM-DD-NNN.md\n  内容: 每次会话的摘要（做了什么、学到了什么、用户说了什么）\n  生命周期: 自动归档到 memory/YYYY-MM-DD.md，长期保留\n\nL2 — 持久存储\n  存储: MEMORY.md（蒸馏知识）+ memory/*.md（原始日志）+ memory/skills/（自动生成技能）\n  内容: 完成的任务结果、经验教训、可复用技能文件\n  生命周期: 永久保留，MEMORY.md 定期蒸馏\n\nL3 — 用户模型\n  存储: memory/preferences.json + USER.md\n  内容: 用户偏好、沟通风格、技术背景、兴趣、已知痛点\n  生命周期: 持续更新，漂移调整\n```\n\n**Inspiration:** Nous Research [Hermes Agent](https://github.com/NousResearch/hermes-agent) 三层记忆架构。SQLite + FTS5 被我们替换为文件存储（更轻量，适合 OpenClaw）。\n\n### Auto-Daily-Log\n\nAt the end of each significant task or session, automatically append to `memory/YYYY-MM-DD.md`:\n\n```markdown\n### ✅ 10:30 - Task description\n### ❌ 10:35 - Error: brief description\n### 💡 10:40 - Insight: what was learned\n### 📌 10:45 - User preference: user said X\n```\n\nKeep entries short (1-2 lines). Don't log every tool call — only significant events.\n\n### Memory Types\n\n| Type | Layer | Where | Example |\n|------|-------|-------|---------|\n| **Session summaries** | L1 | `memory/sessions/*.md` | \"2026-05-27 搜了苏超、装了 SearXNG\" |\n| **Daily logs** | L2 | `memory/YYYY-MM-DD.md` | \"10:30 创建 self-improvement skill\" |\n| **Distilled principles** | L2 | `MEMORY.md` | \"Simple before powerful\" |\n| **Auto-generated skills** | L2 | `memory/skills/*.md` | \"SearXNG 部署流程\" |\n| **User preferences** | L3 | `memory/preferences.json` | \"直接回答，不要解释\" |\n| **User profile** | L3 | `USER.md` | \"技术背景强，中文沟通\" |\n| **Structured learning** | — | `.learning-trail.json` | 所有 LRN/ERR/FEAT 条目 |\n\n### Memory Retention\n\n| Memory | Retention | Action |\n|--------|-----------|--------|\n| Daily logs | Keep forever | Append-only, never delete |\n| Learning entries | 90 days | Auto-resolve pending items after 90d |\n| Verified principles | Keep forever | Part of long-term knowledge |\n| User preferences | Keep until changed | Update when user says otherwise |\n| Tool notes | Keep until outdated | Update when tools change |\n\n### Memory Search\n\nWhen user asks \"之前说过什么\" or \"帮我回忆一下\":\n\n1. First check `MEMORY.md` (distilled knowledge)\n2. Then check `USER.md` (preferences)\n3. Then `grep` recent `memory/*.md` files\n4. Then check `.learning-trail.json` for structured entries\n\n### Memory Flow\n\n```\n会话中\n  → 检测到用户偏好 / 知识 / 错误\n  → 同时写入 memory/YYYY-MM-DD.md（原始）和 .learning-trail.json（结构化）\n\n会话结束（每次对话结束）\n  → 自动生成 L1 会话摘要到 memory/sessions/YYYY-MM-DD-NNN.md\n  → 摘要包含：做了什么任务、学到了什么、用户反馈、生成了哪些技能\n  → 同时追加到 memory/YYYY-MM-DD.md\n  \n心跳/空闲\n  → 读取 .learning-trail.json 的 patterns\n  → 达到阈值的晋升为 MEMORY.md 原则或 memory/preferences.json 偏好\n  → 检查是否有值得生成技能的任务（5+ 工具调用）\n  \n新会话开始\n  → MEMORY.md 自动注入上下文\n  → .learning-trail.json 的 watchlist 提醒我注意\n```\n\n## Auto-Trigger Points\n\n### Detection Triggers\n\nAutomatically log when you notice:\n\n**Corrections** → log to LEARNINGS.md (category: correction)\n- \"No, that's not right...\"\n- \"Actually, it should be...\"\n- \"You're wrong about...\"\n- \"That's outdated...\"\n- User explicitly correcting your output\n\n**Feature Requests** → log to FEATURE_REQUESTS.md\n- \"Can you also...\"\n- \"I wish you could...\"\n- \"Is there a way to...\"\n- \"Why can't you...\"\n\n**Knowledge Gaps** → log to LEARNINGS.md (category: knowledge_gap)\n- User provides info you didn't know\n- Documentation you referenced is outdated\n- API behavior differs from your understanding\n\n**Errors** → log to ERRORS.md\n- Command returns non-zero exit code\n- Exception or stack trace\n- Timeout or connection failure\n\n**Successes** → log to LEARNINGS.md (category: best_practice)\n- Found a better approach\n- Quicker way to do something\n- Cleaner pattern emerged\n\n### Scheduled Triggers\n\n| Trigger | When | Action |\n|---------|------|--------|\n| **Session end** | After completion | Auto-log summary to memory/YYYY-MM-DD.md + memory/sessions/ L1 summary |\n| **Skill gen check** | After complex task | Auto-generate skill if 5+ tool calls or user says \"记住\" |\n| **Heartbeat** | Idle time | Run learn.py --cycle: check verifications, promote patterns |\n| **Improve yourself** | On demand | Full cycle + report |\n| **Hook** | Session start | If hook installed, review pending learnings |\n\n## Session Summary (L1)\n\n每次会话/任务完成后，自动生成会话摘要到 `memory/sessions/YYYY-MM-DD-NNN.md`：\n\n```markdown\n# Session Summary: 2026-05-27-001\n\n## Tasks Completed\n- [任务名称] 做了什么，结果是什么\n\n## Learnings\n- [学到了什么]\n\n## Skills Generated\n- [生成了哪些技能文件]\n\n## User Feedback\n- [用户说了什么重要反馈]\n\n## Open Items\n- [未完成的或待确认的]\n```\n\n**生成时机：** 一个完整的任务流程结束后（如装完 SearXNG、搜完新闻等）\n\n## Auto Skill Generation\n\n当完成一个复杂度达标的任务后，自动生成标准化技能文件。\n\n**生成条件（满足任意一个）：**\n- 任务涉及 5+ 工具调用\n- 用户明确要求\"记住这个\"或\"记下来\"\n- 重复做过类似任务 ≥ 2 次\n- 发现了新的工作流或最佳实践\n\n**自动检测机制：**\n1. 任务完成后，回看本次会话的工具调用次数\n2. 如果 ≥ 5 次，且该任务不是日常操作（如简单查天气），则生成技能文件\n3. 技能文件名用短横线命名：`memory/skills/<task-slug>.md`\n4. 检查是否已存在类似技能（grep memory/skills/ 目录），有则更新而非新建\n\n## Structured Log Format\n\nEvery entry uses this format (inspired by pskoett standard):\n\n### Learning Entry (LEARNINGS.md / auto-log)\n\n```\n## [LRN-YYYYMMDD-XXX] category:brief_title\n\n**Logged**: ISO-8601 timestamp\n**Priority**: low | medium | high | critical\n**Status**: pending | in_progress | resolved | wont_fix | promoted\n**Area**: frontend | backend | infra | tests | docs | config | behavior | tooling\n\n### Summary\nOne-line description\n\n### Details\nWhat happened, what was wrong, what's correct\n\n### Suggested Action\nSpecific fix or improvement\n\n### Metadata\n- Source: conversation | error | user_feedback | self_discovery\n- Related Files: path/to/file\n- Tags: tag1, tag2\n- Pattern-Key: unique_key_for_dedup (optional, for recurring patterns)\n- Recurrence-Count: 1\n- First-Seen: YYYY-MM-DD\n- Last-Seen: YYYY-MM-DD\n```\n\n### Error Entry (ERRORS.md)\n\n```\n## [ERR-YYYYMMDD-XXX] tool_or_command_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: high\n**Status**: pending\n**Area**: infra | tooling | config\n\n### Summary\nBrief description of what failed\n\n### Error\nActual error message or output\n\n### Context\n- Command/operation attempted\n- Input or parameters used\n\n### Suggested Fix\nWhat might resolve this\n\n### Metadata\n- Reproducible: yes | no | unknown\n- Related Files: path/to/file\n- See Also: ERR-YYYYMMDD-XXX (if recurring)\n```\n\n### Feature Request Entry (FEATURE_REQUESTS.md)\n\n```\n## [FEAT-YYYYMMDD-XXX] capability_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: medium\n**Status**: pending\n**Area**: as appropriate\n\n### Summary\nWhat the user wanted to do\n\n### User Context\nWhy they needed it\n\n### Complexity Estimate\nsimple | medium | complex\n\n### Metadata\n- Frequency: first_time | recurring\n- Related Features: existing_feature_name\n```\n\n### ID Generation\n\nFormat: `TYPE-YYYYMMDD-XXX`\n- TYPE: LRN (learning), ERR (error), FEAT (feature)\n- YYYYMMDD: Current date\n- XXX: Sequential number or random 3 chars (e.g., 001, A7B)\n\n**Where to log:** The agent logs structured entries to `memory/.learning-trail.json` (structured, queryable). The helper scripts also write human-readable copies to `.learnings/` files if they exist.\n\n## Recurring Pattern Detection\n\nWhen logging something that might already exist:\n\n1. Search `.learning-trail.json` for matching Pattern-Key\n2. If found: increment Recurrence-Count, update Last-Seen\n3. If not found: create new entry with Recurrence-Count: 1\n\n### Promotion Rule\n\nPromote a pattern to workspace core files when **all** are true:\n- Recurrence-Count >= 3\n- Seen across at least 2 distinct sessions\n- Occurred within a 30-day window\n\n**Promotion targets:**\n\n| Entry Type | Promote To | Example |\n|-----------|-----------|---------|\n| Behavioral pattern | SOUL.md | \"Be concise, skip disclaimers\" |\n| Workflow improvement | AGENTS.md | \"Spawn sub-agents for long tasks\" |\n| Tool gotcha | TOOLS.md | \"Git push needs auth configured\" |\n| User preference | USER.md / preferences.json | \"User prefers direct answers\" |\n| Universal principle | MEMORY.md | \"Simple before powerful\" |\n| Reusable procedure | memory/skills/*.md | \"SearXNG 部署流程\" |\n\n### Auto-Generated Skill Format (借鉴 Hermes Agent)\n\n```markdown\n---\nname: skill-slug-name\ndescription: 一句话描述这个技能做什么\ncreated: 2026-05-27\nupdated: 2026-05-27\nsource: auto\ntriggers: [\"触发关键词或场景\"]\ntools: [web_fetch, exec, read]\n---\n\n## Procedure\n\n1. 步骤一：做了什么\n2. 步骤二：怎么做的\n3. 步骤三：验证结果\n\n## Pitfalls\n\n- 已知问题或陷阱\n- 容易出错的地方\n- 环境依赖\n\n## Verification\n\n- 如何验证结果正确\n- 预期输出是什么\n```\n\n**技能复用流程：**\n1. 新任务到来 → 搜索 `memory/skills/` 目录匹配关键词\n2. 找到匹配 → 读取技能文件，从 Procedure 开始执行\n3. 未找到 → 从头推理，完成后生成新技能文件\n\n## Verification Loop\n\nWhen a change is promoted or applied, record a verification entry:\n\n```json\n{\n  \"id\": \"change-20260505-001\",\n  \"source\": \"LRN-20260505-003\",\n  \"target\": \"TOOLS.md\",\n  \"change\": \"Added 'prefer read over exec for files'\",\n  \"hypothesis\": \"This will reduce file-viewing errors\",\n  \"verified\": false,\n  \"next_check\": \"2026-05-12\",\n  \"evidence\": []\n}\n```\n\nAfter 7 days, `learn.py --cycle` checks:\n- Did the error rate drop for the addressed issue?\n- Was the change relevant to the root cause?\n- Did the change cause any regressions?\n\n**Verification outcomes:**\n\n| Result | Action |\n|--------|--------|\n| ✅ Confirmed effective | Mark verified, reduce monitoring to monthly |\n| ❌ Ineffective | Revert change, log why it failed |\n| ❌ Made worse | Revert immediately, escalate |\n| ❓ Inconclusive | Extend monitoring, add more data points |\n\n## Verification Script\n\n```bash\npython3 scripts/learn.py --cycle     # Full cycle: check verifications + promote patterns\npython3 scripts/learn.py --verify    # Only check pending verifications\npython3 scripts/learn.py --status    # Show learning stats\n\n# Logging with source\npython3 scripts/learn.py --log learning \"user corrected me on X\" --area behavior --source user_feedback --priority high\n```\n\n**CLI `--log` parameters:**\n\n| Param | Values | Default |\n|-------|--------|--------|\n| `--source` | `conversation`, `error`, `user_feedback`, `self_discovery` | `self_discovery` |\n| `--priority` | `critical`, `high`, `medium`, `low` | `medium` |\n| `--area` | any string | `tooling` |\n| `--pattern-key` | any string | none |\n\n## Hook Integration (Session Start)\n\nFor automatic reminders at session start, install the hook:\n\n```bash\n# Copy hook files (HOOK.md + handler.js) to OpenClaw hooks directory\ncp skills/self-improvement/hooks/openclaw/HOOK.md ~/.openclaw/hooks/self-improvement/HOOK.md\ncp skills/self-improvement/hooks/openclaw/handler.js ~/.openclaw/hooks/self-improvement/handler.js\n\n# Enable it\nopenclaw hooks enable self-improvement\n\n# Verify\nopenclaw hooks list\n```\n\n> **Important:** OpenClaw hooks require `HOOK.md` + `handler.js` at the top level of the hook directory. Shell scripts (`hook.sh`) are not supported.\n\nThe hook checks `.learning-trail.json` on session start for:\n- Pending high-priority items\n- Verifications due for review\n- Patterns ready for promotion\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| Command/operation fails | Log to ERRORS.md + auto-log |\n| User corrects you | Log to LEARNINGS.md (correction) |\n| User wants missing feature | Log to FEATURE_REQUESTS.md |\n| API/external tool fails | Log to ERRORS.md |\n| Knowledge was outdated | Log to LEARNINGS.md (knowledge_gap) |\n| Found better approach | Log to LEARNINGS.md (best_practice) |\n| Same error 3x across sessions | Promote to core file |\n| Change applied 7+ days ago | Run verification check |\n\n## Priority Guidelines\n\n| Priority | When to Use |\n|----------|-------------|\n| **critical** | Blocks core functionality, data loss risk, security issue |\n| **high** | Significant impact, affects common workflows, recurring issue |\n| **medium** | Moderate impact, workaround exists |\n| **low** | Minor inconvenience, nice-to-have |\n\n## Conflict Resolution\n\nWhen two principles contradict, the system uses **priority scoring** to decide which wins:\n\n```\nScore = BasePriority(100/60/30/10) + RecurrenceBonus(×10 each) + RecencyBonus(up to 30) + AreaWeight(up to 50)\n\nHighest score wins.\n```\n\nExample conflict:\n- \"Use headless browser for automation\" (tooling, score: 85)\n- \"Show browser window for demos\" (behavior, score: 40)\n- **Winner:** headless automation (85 > 40)\n\nWhen a tie is detected, the system logs it for human review.\n\n## Forgetting Mechanism\n\nOld learnings that aren't reinforced automatically fade:\n\n| Time without reinforcement | Action |\n|---------------------------|--------|\n| 30 days | Priority demoted one level (high→medium, etc.) |\n| 60 days | Priority → low, flagged as stale |\n| 90 days | Auto-resolved as `wont_fix` |\n\nReinforcement happens when:\n- The same error pattern reoccurs → Recurrence-Count increases → freshness reset\n- The agent actively references the principle → logged in evidence\n- User confirms the learning is still relevant\n\n## Auto-Revert\n\nWhen a verification is overdue by 7+ days without evidence:\n\n| Overdue | Action |\n|---------|--------|\n| 7 days | Grace period — reminder only |\n| 14 days | First extension + evidence request |\n| 21+ days | Auto-revert: change undone, logged as `auto_reverted` |\n\nThe revert is safe because all changes are file-based (TOOLS.md, USER.md, etc.) and the old state is tracked in the learning trail.\n\n## Proposal Workflow\n\nWhen the learning system detects a pattern ready for promotion or a change that needs verification, it generates a **proposal** for user review:\n\n```\nPattern detected (≥3x across ≥2 sessions)\n    ↓\nGenerate proposal: what to change, why, risk level\n    ↓\nPresent to user for approval\n    ↓\nUser says \"approve N\" or \"skip N\"\n    ↓\nApply approved changes, track for verification\n```\n\n### Proposal Format\n\nEach proposal includes:\n- **Type**: promotion / verification / critical_fix\n- **Target**: Which file to change (TOOLS.md, MEMORY.md, SOUL.md, AGENTS.md)\n- **Change**: Specific text to add/modify\n- **Motivation**: Why this change (pattern evidence)\n- **Risk**: Low (adds info) / Medium (changes behavior)\n- **Effort**: low / medium / high\n- **Impact**: low / medium / high\n\n### Auto-apply vs Propose\n\n| Change Type | Action | Example |\n|-----------|--------|---------|\n| Add note to TOOLS.md | ✅ Auto-apply | \"QWeather needs custom host\" |\n| Add principle to MEMORY.md | ✅ Auto-apply | \"Simple before powerful\" |\n| Add preference to USER.md | ✅ Auto-apply | \"User prefers direct answers\" |\n| Add guideline to SOUL.md | ⚠️ Propose | \"Be concise, skip disclaimers\" |\n| Add rule to AGENTS.md | ⚠️ Propose | \"Spawn sub-agents for long tasks\" |\n| Create new skill | ❌ Always ask | New skill for recurring task |\n\n### Usage\n\n```bash\npython3 scripts/learn.py --propose    # Generate proposals for review\n```\n\nThe agent will present proposals and wait for your approval before applying.\n\n## Conversation Scoring\n\nAfter each significant interaction, score the response on 5 dimensions (0-10):\n\n| Dimension | What it measures |\n|-----------|-----------------|\n| **Accuracy** | Was the output factually correct? |\n| **Usefulness** | Did it solve the user's actual problem? |\n| **Efficiency** | Were tool calls optimal? |\n| **Tone** | Matched SOUL.md persona? |\n| **Proactiveness** | Anticipated needs? |\n\n### Usage\n\n```bash\npython3 scripts/learn.py --score 8 9 7 8 6    # Score last conversation\npython3 scripts/learn.py --trends 7            # Show 7-day trend\n```\n\n### Trend Tracking\n\nScores are stored in `.learning-trail.json` and displayed as trends:\n\n```\n📈 Score Trends (last 7 days, 12 scores):\n\n  Date         Avg  Acc  Use  Eff  Ton  Pro\n  ──────────────────────────────────────────\n  2026-05-01   7.2    8    8    7    7    6\n  2026-05-02   7.8    8    9    7    8    7\n  2026-05-03   8.0    8    9    8    8    7\n\n  Trend: ↑ (7.2 → 8.0)\n```\n\n**No scores yet** = no way to measure improvement. Start scoring after each meaningful interaction.\n\n## Dynamic Memory Injection\n\nInstead of injecting ALL of MEMORY.md into every session, the system builds a **topic-indexed memory index** and injects only relevant memories.\n\n### How It Works\n\n1. **Build index** — Scan `memory/*.md` files, detect topics, create `.memory-index.json`\n2. **Detect topic** — When a conversation starts, detect the topic from the user's message\n3. **Inject relevant memory** — Only memories matching the topic are injected\n\n### Topics\n\n| Topic | Keywords |\n|-------|----------|\n| weather | 天气, 温度, wind, rain, 预报 |\n| code | 代码, script, python, bug, fix |\n| finance | 金融, 股票, stock, 交易 |\n| skill | skill, clawhub, 技能 |\n| learning | improve, learn, reflect, 学习 |\n| memory | memory, remember, recall, 记忆 |\n| browser | browser, playwright, 自动化 |\n| config | config, 配置, setup, API, key |\n\n### Usage\n\n```bash\npython3 scripts/learn.py --build-index    # Build topic index\npython3 scripts/learn.py --query-memory weather    # Query weather memories\n```\n\nThe index is automatically rebuilt during `--cycle`. When a new session starts, the agent detects the topic and queries relevant memories instead of loading everything.\n\n## Knowledge Graph\n\nConnect memories into a network: **事件 → 教训 → 原则**。\n\n### Node Types\n\n| Type | Icon | Description |\n|------|------|-------------|\n| **event** | 📌 | 具体事件（\"用了 exec 读文件\"） |\n| **lesson** | 💡 | 从事件中学到的教训 |\n| **principle** | 📜 | 通用原则（\"Simple before powerful\"） |\n| **knowledge** | 📖 | 事实知识（\"QWeather 需要自定义 Host\"） |\n| **pattern** | 🔍 | 重复出现的模式 |\n\n### Edge Types\n\n| Type | Direction | Meaning |\n|------|-----------|---------|\n| **caused_by** | A → B | A 是由 B 引起的 |\n| **led_to** | A → B | A 导致了 B |\n| **supports** | A → B | A 支持 B |\n| **contradicts** | A → B | A 与 B 矛盾 |\n| **related_to** | A → B | A 与 B 相关 |\n| **derived_from** | A → B | A 是从 B 推导出来的 |\n\n### Usage\n\n```bash\n# Create nodes\npython3 scripts/learn.py --graph-node event \"用了 exec 读文件\" manual\npython3 scripts/learn.py --graph-node lesson \"应该用 read 工具\" manual\npython3 scripts/learn.py --graph-node principle \"Simple before powerful\" manual\n\n# Create edges\npython3 scripts/learn.py --graph-edge eve-XXXX-001 les-XXXX-001 caused_by\npython3 scripts/learn.py --graph-edge les-XXXX-001 pri-XXXX-001 led_to\n\n# Auto-link (based on content similarity)\npython3 scripts/learn.py --graph-auto-link eve-XXXX-001 \"用了 exec 读文件\"\n\n# Query graph\npython3 scripts/learn.py --graph-query              # Show full graph\npython3 scripts/learn.py --graph-query type:lesson  # Query by type\npython3 scripts/learn.py --graph-query eve-XXXX-001 # Query by node ID\n```\n\n### Auto-Link\n\nWhen creating a node, the system automatically links it to existing nodes based on content similarity:\n\n- **Keyword overlap ≥ 2** → `related_to`\n- **Error words** (error, fail, wrong) → `caused_by`\n- **Support words** (should, prefer, use) → `supports`\n- **Contradiction words** (not, instead, rather) → `contradicts`\n\n### Example Graph\n\n```\n🕸️  Knowledge Graph (4 nodes, 3 edges):\n\n  📌 EVENTs (1):\n    [eve-20260505-001] Used exec for file read instead of read tool\n  💡 LESSONs (1):\n    [les-20260505-002] Always use read tool for file viewing, not exec\n  📜 PRINCIPLEs (1):\n    [pri-20260505-003] Simple before powerful\n  📖 KNOWLEDGEs (1):\n    [kno-20260505-004] QWeather needs custom API host\n\n  🔗 Edges:\n    Always use read tool... ──caused_by──► Used exec for file...\n    Always use read tool... ──led_to──► Simple before powerful...\n```\n\n## Key Principles\n\n1. **Learn automatically.** The system should work without being told.\n2. **Verify or it didn't happen.** Every change must be checked later.\n3. **Reversible first.** Always track old state so changes can be undone.\n4. **Patterns over anecdotes.** One error is noise. Three identical errors are a pattern.\n5. **Structured over freeform.** Standardized IDs and categories make learnings searchable.\n6. **Don't log secrets.** Never write tokens, keys, or full source files.\n7. **Don't learn from noise.** Not every interaction is a learning opportunity.\n8. **Connect memories.** Events → lessons → principles form a network, not isolated notes.\n\n## References\n\n- [reflection_frameworks.md](references/reflection_frameworks.md) — Detailed frameworks and patterns\n- [scripts/learn.py](scripts/learn.py) — Learning cycle engine\n- [scripts/reflect.py](scripts/reflect.py) — Session data collector + auto-log\n- [hsoks/](hooks/) — OpenClaw session-start hook template\n\n## 更新与迁移\n\n### 更新流程\n1. 备份 `memory/` 目录和 `.learning-trail.json`\n2. 安装新版本\n3. 运行迁移检查：`python3 scripts/migrate.py`\n4. 如有问题，运行迁移：`python3 scripts/migrate.py --migrate`\n\n### 版本兼容性\n- V2.x → V2.2.0：数据格式兼容，无需迁移\n- V1.x → V2.2.0：需要迁移，运行 `python3 scripts/migrate.py --migrate`\n\n### 回滚\n如更新后出问题：\n1. 恢复备份的 `memory/` 目录\n2. 恢复备份的 `.learning-trail.json`\n3. 降级到之前的版本\n\n## 备份与同步\n\n### 导出数据\n```bash\npython3 scripts/sync.py export                    # 导出到当前目录\npython3 scripts/sync.py export /path/to/backup.zip  # 导出到指定路径\n```\n\n导出内容：\n- `memory/MEMORY.md` — 长期记忆\n- `memory/.learning-trail.json` — 结构化学习数据\n- `memory/.memory-index.json` — 记忆索引\n- `memory/preferences.json` — 用户偏好\n- `memory/sessions/` — 会话摘要\n- `memory/skills/` — 自动生成的技能\n- `memory/.dreams/` — 梦境蒸馏数据\n- `memory/*.md` — 日常日志\n\n### 导入数据\n```bash\npython3 scripts/sync.py import /path/to/backup.zip  # 导入（不覆盖已有）\npython3 scripts/sync.py import /path/to/backup.zip --overwrite  # 覆盖导入\n```\n\n### 多服务器同步\n1. 服务器 A：`python3 scripts/sync.py export`\n2. 传输 zip 到服务器 B\n3. 服务器 B：`python3 scripts/sync.py import backup.zip`\n\n### 查看状态\n```bash\npython3 scripts/sync.py status\n```\n\nFile v2.2.2:_meta.json\n\n{\n  \"ownerId\": \"kn7afdk9ag1ftxjn0btmw2tj3h82y30x\",\n  \"slug\": \"self-improvement-llm\",\n  \"version\": \"2.2.2\",\n  \"publishedAt\": 1781587295028\n}\n\nFile v2.2.2:references/reflection_frameworks.md\n\n# Reflection Frameworks\n\nDeep-dive reference for types of reflection, depth levels, score rubrics, proposal patterns, and the learning system.\n\n## Learning System Architecture\n\nThe self-learning system runs as a background process, not an on-demand command:\n\n```\n                    ┌──────────┐\n                    │  AGENT    │\n                    │  (LLM)    │\n                    └────┬─────┘\n                         │\n         ┌───────────────┼───────────────┐\n         │               │               │\n         ▼               ▼               ▼\n   ┌──────────┐   ┌──────────┐   ┌──────────┐\n   │ Session  │   │  Memory  │   │ Learning │\n   │  Log     │   │  Files   │   │  Trail   │\n   └──────────┘   └──────────┘   └──────────┘\n         │               │               │\n         └───────────────┼───────────────┘\n                         ▼\n                  ┌──────────────┐\n                  │  Heartbeat   │\n                  │  (Idle)      │\n                  └──────┬───────┘\n                         │\n                         ▼\n                  ┌──────────────┐\n                  │ Learn Cycle  │\n                  │  extract →   │\n                  │  verify →    │\n                  │  integrate   │\n                  └──────────────┘\n                         │\n                         ▼\n                  ┌──────────────┐\n                  │  Self-Modify │\n                  │  (files)     │\n                  └──────────────┘\n```\n\n### Data Flow\n\n1. **Session Logging** — After each task, auto-append to `memory/YYYY-MM-DD.md`\n2. **Learning Trail** — `memory/.learning-trail.json` tracks every change, its hypothesis, and verification status\n3. **Heartbeat** — During idle time, triggers `python3 scripts/learn.py --cycle`\n4. **Verify** — Checks if past changes actually improved behavior (measured by error rate)\n5. **Adapt** — Reverts failed changes, reinforces successful ones\n\n### Auto-Logging Format\n\n```markdown\n### ✅ 14:32 - Fetched weather data for Rugao\n### ❌ 14:35 - Tried to send screenshot via exec\n   Error: Platform requires MEDIA directive, not curl\n```\n\nThree lines max per entry. Keep it scannable.\n\n### Learning Trail Structure\n\n```json\n{\n  \"changes\": [\n    {\n      \"id\": \"change-20260505-001\",\n      \"target\": \"TOOLS.md\",\n      \"hypothesis\": \"Adding MEDIA note prevents file delivery failures\",\n      \"verified\": false,\n      \"next_check\": \"2026-05-12\"\n    }\n  ],\n  \"watchlist\": [\n    {\"issue\": \"Using exec instead of read for files\", \"count\": 3, \"status\": \"watch\"}\n  ]\n}\n```\n\n## Industry Patterns\n\nThese are the real-world patterns used by mature agent frameworks:\n\n### 1. Reflexion (Academic, 388⭐)\n**Paper:** Shinn et al., NeurIPS 2023 — [arXiv:2303.11366](https://arxiv.org/abs/2303.11366)\n**Official Code:** [noahshinn/reflexion-draft](https://github.com/noahshinn/reflexion-draft)\n\n```\n┌──────────┐    task + reflections    ┌──────────────┐\n│  Actor   │ ─────────────────────► │     LLM       │\n└──────────┘ ◄──────────────────── └──────────────┘\n     │            output\n     ▼\n┌───────────┐\n│ Evaluator │  → score + feedback\n└───────────┘\n     │  (if score < threshold)\n     ▼\n┌───────────┐\n│ Reflector │  → verbal reflection\n└───────────┘\n     │\n     └──► injected into next actor call\n```\n\n**Key insight:** Reflection is verbal — the agent writes natural language notes about why it failed, then reads those notes as part of the prompt on the next attempt. No gradient updates needed.\n\n### 2. AutoGPT Post-Task Reflection (184k⭐)\n**Repo:** [Significant-Gravitas/AutoGPT](https://github.com/Significant-Gravitas/AutoGPT)\n\n```\n1. Execute task\n2. Evaluate result\n3. Write reflection (what worked, what didn't, patterns observed)\n4. Update memory with reflection\n5. Next task reads previous reflections as context\n```\n\n**Key insight:** Simple but effective at scale. Each task run appends to a \"reflection\" buffer that's included in future context.\n\n### 3. LangGraph Self-Critique Node (31k⭐)\n**Repo:** [langchain-ai/langgraph](https://github.com/langchain-ai/langgraph)\n\n```\n   ┌─────────────┐\n   │  Generate    │\n   └──────┬──────┘\n          │ output\n          ▼\n   ┌─────────────┐\n   │  Critique    │  ← separate LLM call, different prompt\n   └──────┬──────┘\n          │ feedback\n          ▼\n   ┌─────────────┐\n   │  Revise      │  ← original output + critique → improved output\n   └──────┬──────┘\n          │\n          ▼ (final output or loop back)\n```\n\n**Key insight:** The critique node is a **separate call** with a different system prompt (\"find flaws, be harsh\") from the generation node (\"be creative\"). This separation prevents the agent from being too nice to itself.\n\n### 4. CrewAI Multi-Agent Feedback (51k⭐)\n**Repo:** [crewAIInc/crewAI](https://github.com/crewAIInc/crewAI)\n\n```\n┌──────────┐     output     ┌──────────┐\n│  Agent A  │ ────────────► │  Agent B  │\n│ (writer)  │               │ (critic)  │\n└──────────┘               └─────┬────┘\n     ▲                          │ feedback\n     │                          ▼\n     └───────────────────── revise\n```\n\n**Key insight:** Use multi-agent for reflection — one agent generates, another critiques. Avoids the \"LLM is nice to itself\" problem.\n\n### 5. Constitutional AI / Claude Code (120k⭐)\n**Repo:** [anthropics/claude-code](https://github.com/anthropics/claude-code)\n**Paper:** [Constitutional AI: Harmlessness from AI Feedback](https://arxiv.org/abs/2212.08073)\n\n```\n1. Generate output\n2. Self-critique against constitution (set of principles)\n3. Revise based on critique\n4. Repeat until output satisfies constitution\n```\n\n**Key insight:** Instead of ad-hoc reflection, use a fixed \"constitution\" or set of principles to guide self-evaluation. This makes reflection consistent and measurable.\n\n---\n\n## Types of Reflection\n\n### Task-Level Reflection\nAnalysis of a single task execution:\n\n```\nTask: \"Generate an Excel report\"\nResult: Created file but formatting was wrong\nReflection: \"I used openpyxl without setting column widths first.\"\n```\n\n### Session-Level Reflection\nAnalysis of an entire conversation:\n\n```\nSession performance:\n- 3 correct answers, 2 corrections from user\n- 1 unnecessary tool call (2-step process that could be 1)\nReflection: \"I tend to over-tool. Asking for clarification first would reduce unnecessary exec calls.\"\n```\n\n### Skill-Level Reflection\nAnalysis of how well a skill performed:\n\n```\nSkill used: pdf-extractor\nPerformance: Extracted text accurately but missed table structure\nReflection: \"pdf-extractor needs a table extraction mode. Should add PyMuPDF table detection.\"\n```\n\n### Meta-Level Reflection\nReflection on reflection patterns themselves:\n\n```\nReflection pattern observed:\n- I keep finding the same class of error (\"wrong tool for the job\")\n- My reflections are shallow (Level 1 fix, not Level 2/3)\nMeta-reflection: \"Need to push to deeper root cause analysis. Maybe a checklist helps?\"\n```\n\n## Depth Levels\n\n### Level 1 — Symptom Fix\nAddresses the immediate failure.\n\n```\n\"What happened: I used web_fetch when I should have used gh api.\"\n\"Fix: Use gh api for GitHub queries in the future.\"\n```\n\n**Good for:** Quick corrections, obvious mistakes.\n**Bad for:** Systemic issues. Missing the bigger picture.\n\n### Level 2 — Pattern Fix\nIdentifies the pattern across instances.\n\n```\n\"What happened: I keep choosing web_fetch over more specific tools.\"\n\"Pattern: 3 instances in the last 5 sessions.\"\n\"Root cause: web_fetch is my default 'get data from web' tool. I don't consider alternatives.\"\n\"Fix: Add a tool-selection decision tree to TOOLS.md: Web data → gh api if GitHub, web_fetch if generic site.\"\n```\n\n**Good for:** Recurring issues, habit modification.\n**Bad for:** Deep assumptions about how to work.\n\n### Level 3 — Belief Revision\nChallenges fundamental assumptions.\n\n```\n\"What happened: I often fail on multi-step tasks by doing them sequentially.\"\n\"Assumption: 'Do things one at a time' — but that ignores available parallelism.\"\n\"New belief: 'When tasks have no dependencies, parallel is better than sequential.'\"\n\"Fix: Update AGENTS.md workflow section to prefer parallel execution for independent subtasks.\"\n```\n\n**Good for:** Fundamental behavior changes, paradigm shifts.\n**Bad for:** Quick fixes needed immediately.\n\n## Score Rubric (Detailed)\n\n### Accuracy (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Perfect — no errors, no corrections needed |\n| 8-9 | Minor issues — one small correction |\n| 5-7 | Significant error but recoverable |\n| 0-4 | Critical failure — wrong answer, hallucination, destructive action |\n\n**Checklist:**\n- [ ] Facts check out against known data\n- [ ] Code runs without errors\n- [ ] File modifications are correct\n- [ ] No hallucinations (plausible-sounding but false statements)\n\n### Usefulness (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Solved the problem completely, exceeded expectations |\n| 8-9 | Solved the problem, met expectations |\n| 5-7 | Partial solution, user needed to supplement |\n| 0-4 | Did not solve the problem or made it worse |\n\n**Checklist:**\n- [ ] User expressed satisfaction (or at least didn't ask for changes)\n- [ ] Output is directly usable, not \"just a starting point\"\n- [ ] Response addressed the implicit need, not just the explicit ask\n\n### Efficiency (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Minimum possible tool calls, optimal tool choice |\n| 8-9 | Good tool selection, one minor extra step |\n| 5-7 | Acceptable but could be 30% more efficient |\n| 0-4 | Too many calls, wrong tools, redundant work |\n\n**Checklist:**\n- [ ] Chose the right tool for each step\n- [ ] No duplicate calls\n- [ ] Batched operations when possible\n- [ ] Didn't over-fetch (too much data, too many calls)\n\n### Tone/Persona (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Perfectly matched SOUL.md persona, natural, engaging |\n| 8-9 | Good tone, minor stiffness |\n| 5-7 | Acceptable but could be more personable |\n| 0-4 | Wrong tone — too corporate, too chatty, too stiff |\n\n**Checklist:**\n- [ ] No \"I'd be happy to help!\" style filler\n- [ ] No markdown tables in Discord/WhatsApp contexts\n- [ ] Matched user's communication style\n- [ ] Natural, not performative\n\n### Proactiveness (0-10)\n\n| Score | Meaning |\n|-------|---------|\n| 10 | Anticipated needs, offered relevant extras |\n| 8-9 | Good proactive suggestion |\n| 5-7 | Reactive but thorough |\n| 0-4 | Needed prompting for every step |\n\n**Checklist:**\n- [ ] Offered next steps without being asked\n- [ ] Identified potential issues before they arise\n- [ ] Suggested improvements beyond the immediate ask\n\n## Proposal Impact Matrix\n\nUse this matrix to decide how to apply proposals:\n\n```\nImpact \\ Effort  |  Low Effort  |  Medium Effort  |  High Effort\n-----------------|--------------|-----------------|--------------\nHigh Impact      |  Auto-apply  |  Propose        |  Plan & propose\nMedium Impact    |  Auto-apply  |  Propose        |  Note for later\nLow Impact       |  Note/queue  |  Note/queue     |  Discard\n```\n\n**Auto-apply threshold:**\n- File updated in last 24h: require review\n- File is MEMORY.md or TOOLS.md: safe to auto-apply\n- Change is <10 lines: safe to auto-apply\n- Changes AGENTS.md or SOUL.md: always propose\n- New skill creation: always propose\n\n## Anti-Patterns\n\n1. **Vague reflections** — \"I should be more careful\" → useless. \"I should verify file paths before writing\" → actionable.\n2. **Over-correction** — One failure → entirely new behavior. \"I used web_fetch once when gh was better\" does not mean \"never use web_fetch.\"\n3. **Analysis paralysis** — Spending hours reflecting on minor issues. Use the Impact/Effort matrix.\n4. **Self-serving bias** — Attributing failures to \"bad prompt\" or \"model limitation\" rather than own choices.\n5. **Forgetting the loop** — Propose changes but never check if they worked. Schedule follow-up verification.\n\nFile v2.2.2:hooks/openclaw/HOOK.md\n\n---\nname: self-improvement\ndescription: Self-learning system — checks pending learnings, writes session context, and tracks patterns at gateway startup\nmetadata:\n  openclaw:\n    emoji: \"🧠\"\n    events: [\"gateway:startup\"]\n---\n\n# Self-Improvement Gateway Hook\n\nRuns at gateway startup. Writes actionable context to `memory/.hook-context.txt` for the agent to read at session start.\n\n## What It Does\n\n- Checks `.learning-trail.json` for pending high-priority items\n- Checks for overdue verifications\n- Detects patterns ready for promotion (≥2 occurrences)\n- Checks if recent session summaries exist\n- Writes findings to `memory/.hook-context.txt`\n\n## Agent Usage\n\nAt session start, the agent should:\n```bash\ncat memory/.hook-context.txt\n```\n\nThis file is regenerated at each gateway startup and contains the current state of the learning system.\n\n## Installation\n\nThe hook is auto-installed by OpenClaw when the skill is enabled.\n\nFile v2.2.2:skill-card.md\n\n## Description: <br>\nProvides an agent memory and self-learning workflow that logs task history, extracts lessons and user preferences, verifies behavior changes, and proposes reusable improvements. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[brucetangc](https://clawhub.ai/user/brucetangc) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and agent operators use this skill to give an agent persistent memory for task history, corrections, preferences, and recurring lessons. It is intended for agents that should review past sessions, track improvement hypotheses, and surface proposed behavior or skill changes for review. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Conversation-derived memory may store sensitive personal data, secrets, or unwanted preferences over time. <br>\nMitigation: Review or disable automatic logging before use, avoid sharing secrets while enabled, and periodically inspect memory files and preference records. <br>\nRisk: The learning cycle can change files that influence future agent behavior, including memory, tool notes, generated skill drafts, and hook context. <br>\nMitigation: Require human review for promoted patterns and core-file changes, inspect diffs before accepting proposed behavior changes, and disable hook or scheduled cycle behavior until trusted. <br>\nRisk: Sync import and export can move memory data between environments or restore files from an archive. <br>\nMitigation: Use backups, validate archive provenance before import, inspect archive contents, and avoid overwrite mode unless the target workspace is prepared. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill release](https://clawhub.ai/brucetangc/self-improvement-llm) <br>\n- [Reflection Frameworks](artifact/references/reflection_frameworks.md) <br>\n- [pskoett/self-improving-agent](https://clawhub.ai/pskoett/self-improving-agent) <br>\n- [NousResearch/hermes-agent](https://github.com/NousResearch/hermes-agent) <br>\n- [Reflexion paper](https://arxiv.org/abs/2303.11366) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance] <br>\n**Output Format:** [Markdown guidance with Python and shell command examples; supporting scripts may create JSON, Markdown, text, and zip files in the agent workspace.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May write or update memory files, learning trail JSON, generated skill drafts, hook context, and backup archives when run by an agent.] <br>\n\n## Skill Version(s): <br>\n2.2.2 (source: server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v2.2.1: 11 files, 55179 bytes\n\nFiles: hooks/openclaw/handler.js (3763b), hooks/openclaw/HOOK.md (934b), references/reflection_frameworks.md (13191b), scripts/dream.py (13334b), scripts/learn.py (69553b), scripts/migrate.py (4798b), scripts/reflect.py (7430b), scripts/skillgen.py (18014b), skill-card.md (2852b), SKILL.md (28234b), _meta.json (139b)\n\nFile v2.2.1:SKILL.md\n\n---\nname: self-improvement\ndescription: Autonomous memory and self-learning system for AI agents. Continuously collects experience, manages memory (daily logs, user preferences, knowledge extraction), builds knowledge graphs connecting events→lessons→principles, extracts principles, auto-adjusts behavior, and verifies improvements. Proposes actionable changes for user review before applying. Use when: (1) Agent needs to learn from past sessions, (2) User asks \"improve yourself\" or \"learn from this\", (3) Periodic self-evaluation is needed, (4) Agent needs to auto-correct recurring mistakes, (5) Updating AGENTS.md/SOUL.md/MEMORY.md/TOOLS.md based on experience, (6) Extracting universal principles from episodic experiences, (7) Processing user feedback to permanently adapt behavior, (8) Managing daily memory logs, user preferences, or knowledge retention.\n---\n\n# Self-Learning System\n\nA continuous learning loop that automatically captures learnings, tracks improvements, and verifies their effectiveness.\n\n**Inspiration:** This skill fuses the structured recording format and detection triggers from [pskoett/self-improving-agent](https://clawhub.ai/pskoett/self-improving-agent) (6.1k installs) with a verification/hypothesis loop that most agent learning systems lack.\n\n## 🤖 Agent: What You Must Do (Not Optional)\n\nThese are **required behaviors**, not suggestions. Execute them during conversation without being told.\n\n### During Every Conversation\n\n1. **Detect learning opportunities in real-time.** After every user message or tool result, mentally check:\n   - Did the user correct me? → run `python3 scripts/reflect.py --detect \"USER_MESSAGE\"`\n   - Did a tool fail? → log to `.learning-trail.json` immediately\n   - Did I learn something new? → append to `memory/YYYY-MM-DD.md`\n\n2. **Log corrections immediately.** When the user says \"不对\", \"错了\", \"no\", \"actually\", etc.:\n   ```bash\n   python3 scripts/learn.py --log correction \"具体纠正了什么\"\n   ```\n   Set pattern_key for dedup: `--log correction \"message\" --area behavior --priority high`\n\n3. **Log errors automatically.** When a tool call fails or returns unexpected output:\n   ```bash\n   python3 scripts/learn.py --log error \"工具名: 错误简述\" --area tooling --priority medium\n   ```\n\n4. **After significant tasks,** append to today's daily log:\n   ```bash\n   python3 scripts/reflect.py --log \"完成了什么\"\n   ```\n\n### At Session Start\n\n5. **Check `.hook-context.txt`** (written by plugin hook at gateway startup):\n   ```bash\n   cat memory/.hook-context.txt 2>/dev/null\n   ```\n   If it shows pending verifications or patterns ready for promotion, act on them.\n\n6. **Run a quick status check:**\n   ```bash\n   python3 scripts/learn.py --status\n   ```\n\n### During Daily Cycle (via cron, 3AM)\n\n7. The full cycle runs automatically: `python3 scripts/learn.py --cycle`\n   - **🌙 Dream:** Distills recent daily logs into MEMORY.md (dedup + compress)\n   - Auto-promotes patterns (≥2 occurrences across ≥2 sessions)\n   - Auto-generates session summaries (L1)\n   - Auto-triggers skill generation (via `skillgen.py --auto`)\n   - Records `record_change` for verification tracking\n   - Checks for overdue verifications\n\n### Record Changes for Verification\n\n8. **When you modify any core file** (MEMORY.md, TOOLS.md, SOUL.md, AGENTS.md):\n   ```bash\n   python3 scripts/learn.py --record-change MEMORY.md \"what was changed\" \"why this should help\"\n   ```\n   This populates the verification loop so 7 days later the system checks if it helped.\n\n### Score Conversations\n\n9. **At the end of significant conversations,** rate yourself:\n   ```bash\n   python3 scripts/learn.py --score 8 7 9 8 7 \"brief justification\"\n   ```\n   (accuracy, usefulness, efficiency, tone, proactiveness, 0-10 each)\n\n## Learning Loop\n\n```\nSession / Task\n    ↓\n  [DETECT]     ← Automatic triggers: corrections, errors, feature requests\n    ↓\n  [LOG]        ← Structured entries with IDs, priorities, categories\n    ↓\n  [EXTRACT]    ← Distill patterns from repeated entries\n    ↓\n  [PROMOTE]    ← To AGENTS.md / SOUL.md / TOOLS.md / MEMORY.md\n    ↓\n  [VERIFY]     ← 7-day check: did this change actually help?\n    ↓\n  [ADAPT]      ← Reinforce success, revert failure\n    ↓\n  (back to detect on next interaction)\n```\n\n## Memory Management\n\nThe skill also manages the agent's memory system — daily logs, user preferences, and knowledge retention.\n\n### Memory Architecture (借鉴 Hermes Agent 三层设计)\n\n```\n┌─────────────────────────────────────────────────────────┐\n│              THREE-LAYER MEMORY ARCHITECTURE             │\n├──────────────┬──────────────────┬───────────────────────┤\n│  L1: Session │  L2: Persistent  │  L3: User Model       │\n│  Context     │  Store           │  Preferences          │\n│──────────────┼──────────────────┼───────────────────────┤\n│  memory/     │  MEMORY.md       │  memory/              │\n│  sessions/   │  memory/*.md     │  preferences.json     │\n│  (session    │  memory/skills/  │  USER.md              │\n│   summaries) │  (generated      │                       │\n│              │   skills)        │                       │\n└──────────────┴──────────────────┴───────────────────────┘\n\nL1 — 会话上下文\n  存储: memory/sessions/YYYY-MM-DD-NNN.md\n  内容: 每次会话的摘要（做了什么、学到了什么、用户说了什么）\n  生命周期: 自动归档到 memory/YYYY-MM-DD.md，长期保留\n\nL2 — 持久存储\n  存储: MEMORY.md（蒸馏知识）+ memory/*.md（原始日志）+ memory/skills/（自动生成技能）\n  内容: 完成的任务结果、经验教训、可复用技能文件\n  生命周期: 永久保留，MEMORY.md 定期蒸馏\n\nL3 — 用户模型\n  存储: memory/preferences.json + USER.md\n  内容: 用户偏好、沟通风格、技术背景、兴趣、已知痛点\n  生命周期: 持续更新，漂移调整\n```\n\n**Inspiration:** Nous Research [Hermes Agent](https://github.com/NousResearch/hermes-agent) 三层记忆架构。SQLite + FTS5 被我们替换为文件存储（更轻量，适合 OpenClaw）。\n\n### Auto-Daily-Log\n\nAt the end of each significant task or session, automatically append to `memory/YYYY-MM-DD.md`:\n\n```markdown\n### ✅ 10:30 - Task description\n### ❌ 10:35 - Error: brief description\n### 💡 10:40 - Insight: what was learned\n### 📌 10:45 - User preference: user said X\n```\n\nKeep entries short (1-2 lines). Don't log every tool call — only significant events.\n\n### Memory Types\n\n| Type | Layer | Where | Example |\n|------|-------|-------|---------|\n| **Session summaries** | L1 | `memory/sessions/*.md` | \"2026-05-27 搜了苏超、装了 SearXNG\" |\n| **Daily logs** | L2 | `memory/YYYY-MM-DD.md` | \"10:30 创建 self-improvement skill\" |\n| **Distilled principles** | L2 | `MEMORY.md` | \"Simple before powerful\" |\n| **Auto-generated skills** | L2 | `memory/skills/*.md` | \"SearXNG 部署流程\" |\n| **User preferences** | L3 | `memory/preferences.json` | \"直接回答，不要解释\" |\n| **User profile** | L3 | `USER.md` | \"技术背景强，中文沟通\" |\n| **Structured learning** | — | `.learning-trail.json` | 所有 LRN/ERR/FEAT 条目 |\n\n### Memory Retention\n\n| Memory | Retention | Action |\n|--------|-----------|--------|\n| Daily logs | Keep forever | Append-only, never delete |\n| Learning entries | 90 days | Auto-resolve pending items after 90d |\n| Verified principles | Keep forever | Part of long-term knowledge |\n| User preferences | Keep until changed | Update when user says otherwise |\n| Tool notes | Keep until outdated | Update when tools change |\n\n### Memory Search\n\nWhen user asks \"之前说过什么\" or \"帮我回忆一下\":\n\n1. First check `MEMORY.md` (distilled knowledge)\n2. Then check `USER.md` (preferences)\n3. Then `grep` recent `memory/*.md` files\n4. Then check `.learning-trail.json` for structured entries\n\n### Memory Flow\n\n```\n会话中\n  → 检测到用户偏好 / 知识 / 错误\n  → 同时写入 memory/YYYY-MM-DD.md（原始）和 .learning-trail.json（结构化）\n\n会话结束（每次对话结束）\n  → 自动生成 L1 会话摘要到 memory/sessions/YYYY-MM-DD-NNN.md\n  → 摘要包含：做了什么任务、学到了什么、用户反馈、生成了哪些技能\n  → 同时追加到 memory/YYYY-MM-DD.md\n  \n心跳/空闲\n  → 读取 .learning-trail.json 的 patterns\n  → 达到阈值的晋升为 MEMORY.md 原则或 memory/preferences.json 偏好\n  → 检查是否有值得生成技能的任务（5+ 工具调用）\n  \n新会话开始\n  → MEMORY.md 自动注入上下文\n  → .learning-trail.json 的 watchlist 提醒我注意\n```\n\n## Auto-Trigger Points\n\n### Detection Triggers\n\nAutomatically log when you notice:\n\n**Corrections** → log to LEARNINGS.md (category: correction)\n- \"No, that's not right...\"\n- \"Actually, it should be...\"\n- \"You're wrong about...\"\n- \"That's outdated...\"\n- User explicitly correcting your output\n\n**Feature Requests** → log to FEATURE_REQUESTS.md\n- \"Can you also...\"\n- \"I wish you could...\"\n- \"Is there a way to...\"\n- \"Why can't you...\"\n\n**Knowledge Gaps** → log to LEARNINGS.md (category: knowledge_gap)\n- User provides info you didn't know\n- Documentation you referenced is outdated\n- API behavior differs from your understanding\n\n**Errors** → log to ERRORS.md\n- Command returns non-zero exit code\n- Exception or stack trace\n- Timeout or connection failure\n\n**Successes** → log to LEARNINGS.md (category: best_practice)\n- Found a better approach\n- Quicker way to do something\n- Cleaner pattern emerged\n\n### Scheduled Triggers\n\n| Trigger | When | Action |\n|---------|------|--------|\n| **Session end** | After completion | Auto-log summary to memory/YYYY-MM-DD.md + memory/sessions/ L1 summary |\n| **Skill gen check** | After complex task | Auto-generate skill if 5+ tool calls or user says \"记住\" |\n| **Heartbeat** | Idle time | Run learn.py --cycle: check verifications, promote patterns |\n| **Improve yourself** | On demand | Full cycle + report |\n| **Hook** | Session start | If hook installed, review pending learnings |\n\n## Session Summary (L1)\n\n每次会话/任务完成后，自动生成会话摘要到 `memory/sessions/YYYY-MM-DD-NNN.md`：\n\n```markdown\n# Session Summary: 2026-05-27-001\n\n## Tasks Completed\n- [任务名称] 做了什么，结果是什么\n\n## Learnings\n- [学到了什么]\n\n## Skills Generated\n- [生成了哪些技能文件]\n\n## User Feedback\n- [用户说了什么重要反馈]\n\n## Open Items\n- [未完成的或待确认的]\n```\n\n**生成时机：** 一个完整的任务流程结束后（如装完 SearXNG、搜完新闻等）\n\n## Auto Skill Generation\n\n当完成一个复杂度达标的任务后，自动生成标准化技能文件。\n\n**生成条件（满足任意一个）：**\n- 任务涉及 5+ 工具调用\n- 用户明确要求\"记住这个\"或\"记下来\"\n- 重复做过类似任务 ≥ 2 次\n- 发现了新的工作流或最佳实践\n\n**自动检测机制：**\n1. 任务完成后，回看本次会话的工具调用次数\n2. 如果 ≥ 5 次，且该任务不是日常操作（如简单查天气），则生成技能文件\n3. 技能文件名用短横线命名：`memory/skills/<task-slug>.md`\n4. 检查是否已存在类似技能（grep memory/skills/ 目录），有则更新而非新建\n\n## Structured Log Format\n\nEvery entry uses this format (inspired by pskoett standard):\n\n### Learning Entry (LEARNINGS.md / auto-log)\n\n```\n## [LRN-YYYYMMDD-XXX] category:brief_title\n\n**Logged**: ISO-8601 timestamp\n**Priority**: low | medium | high | critical\n**Status**: pending | in_progress | resolved | wont_fix | promoted\n**Area**: frontend | backend | infra | tests | docs | config | behavior | tooling\n\n### Summary\nOne-line description\n\n### Details\nWhat happened, what was wrong, what's correct\n\n### Suggested Action\nSpecific fix or improvement\n\n### Metadata\n- Source: conversation | error | user_feedback | self_discovery\n- Related Files: path/to/file\n- Tags: tag1, tag2\n- Pattern-Key: unique_key_for_dedup (optional, for recurring patterns)\n- Recurrence-Count: 1\n- First-Seen: YYYY-MM-DD\n- Last-Seen: YYYY-MM-DD\n```\n\n### Error Entry (ERRORS.md)\n\n```\n## [ERR-YYYYMMDD-XXX] tool_or_command_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: high\n**Status**: pending\n**Area**: infra | tooling | config\n\n### Summary\nBrief description of what failed\n\n### Error\nActual error message or output\n\n### Context\n- Command/operation attempted\n- Input or parameters used\n\n### Suggested Fix\nWhat might resolve this\n\n### Metadata\n- Reproducible: yes | no | unknown\n- Related Files: path/to/file\n- See Also: ERR-YYYYMMDD-XXX (if recurring)\n```\n\n### Feature Request Entry (FEATURE_REQUESTS.md)\n\n```\n## [FEAT-YYYYMMDD-XXX] capability_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: medium\n**Status**: pending\n**Area**: as appropriate\n\n### Summary\nWhat the user wanted to do\n\n### User Context\nWhy they needed it\n\n### Complexity Estimate\nsimple | medium | complex\n\n### Metadata\n- Frequency: first_time | recurring\n- Related Features: existing_feature_name\n```\n\n### ID Generation\n\nFormat: `TYPE-YYYYMMDD-XXX`\n- TYPE: LRN (learning), ERR (error), FEAT (feature)\n- YYYYMMDD: Current date\n- XXX: Sequential number or random 3 chars (e.g., 001, A7B)\n\n**Where to log:** The agent logs structured entries to `memory/.learning-trail.json` (structured, queryable). The helper scripts also write human-readable copies to `.learnings/` files if they exist.\n\n## Recurring Pattern Detection\n\nWhen logging something that might already exist:\n\n1. Search `.learning-trail.json` for matching Pattern-Key\n2. If found: increment Recurrence-Count, update Last-Seen\n3. If not found: create new entry with Recurrence-Count: 1\n\n### Promotion Rule\n\nPromote a pattern to workspace core files when **all** are true:\n- Recurrence-Count >= 3\n- Seen across at least 2 distinct sessions\n- Occurred within a 30-day window\n\n**Promotion targets:**\n\n| Entry Type | Promote To | Example |\n|-----------|-----------|---------|\n| Behavioral pattern | SOUL.md | \"Be concise, skip disclaimers\" |\n| Workflow improvement | AGENTS.md | \"Spawn sub-agents for long tasks\" |\n| Tool gotcha | TOOLS.md | \"Git push needs auth configured\" |\n| User preference | USER.md / preferences.json | \"User prefers direct answers\" |\n| Universal principle | MEMORY.md | \"Simple before powerful\" |\n| Reusable procedure | memory/skills/*.md | \"SearXNG 部署流程\" |\n\n### Auto-Generated Skill Format (借鉴 Hermes Agent)\n\n```markdown\n---\nname: skill-slug-name\ndescription: 一句话描述这个技能做什么\ncreated: 2026-05-27\nupdated: 2026-05-27\nsource: auto\ntriggers: [\"触发关键词或场景\"]\ntools: [web_fetch, exec, read]\n---\n\n## Procedure\n\n1. 步骤一：做了什么\n2. 步骤二：怎么做的\n3. 步骤三：验证结果\n\n## Pitfalls\n\n- 已知问题或陷阱\n- 容易出错的地方\n- 环境依赖\n\n## Verification\n\n- 如何验证结果正确\n- 预期输出是什么\n```\n\n**技能复用流程：**\n1. 新任务到来 → 搜索 `memory/skills/` 目录匹配关键词\n2. 找到匹配 → 读取技能文件，从 Procedure 开始执行\n3. 未找到 → 从头推理，完成后生成新技能文件\n\n## Verification Loop\n\nWhen a change is promoted or applied, record a verification entry:\n\n```json\n{\n  \"id\": \"change-20260505-001\",\n  \"source\": \"LRN-20260505-003\",\n  \"target\": \"TOOLS.md\",\n  \"change\": \"Added 'prefer read over exec for files'\",\n  \"hypothesis\": \"This will reduce file-viewing errors\",\n  \"verified\": false,\n  \"next_check\": \"2026-05-12\",\n  \"evidence\": []\n}\n```\n\nAfter 7 days, `learn.py --cycle` checks:\n- Did the error rate drop for the addressed issue?\n- Was the change relevant to the root cause?\n- Did the change cause any regressions?\n\n**Verification outcomes:**\n\n| Result | Action |\n|--------|--------|\n| ✅ Confirmed effective | Mark verified, reduce monitoring to monthly |\n| ❌ Ineffective | Revert change, log why it failed |\n| ❌ Made worse | Revert immediately, escalate |\n| ❓ Inconclusive | Extend monitoring, add more data points |\n\n## Verification Script\n\n```bash\npython3 scripts/learn.py --cycle     # Full cycle: check verifications + promote patterns\npython3 scripts/learn.py --verify    # Only check pending verifications\npython3 scripts/learn.py --status    # Show learning stats\n\n# Logging with source\npython3 scripts/learn.py --log learning \"user corrected me on X\" --area behavior --source user_feedback --priority high\n```\n\n**CLI `--log` parameters:**\n\n| Param | Values | Default |\n|-------|--------|--------|\n| `--source` | `conversation`, `error`, `user_feedback`, `self_discovery` | `self_discovery` |\n| `--priority` | `critical`, `high`, `medium`, `low` | `medium` |\n| `--area` | any string | `tooling` |\n| `--pattern-key` | any string | none |\n\n## Hook Integration (Session Start)\n\nFor automatic reminders at session start, install the hook:\n\n```bash\n# Copy hook files (HOOK.md + handler.js) to OpenClaw hooks directory\ncp skills/self-improvement/hooks/openclaw/HOOK.md ~/.openclaw/hooks/self-improvement/HOOK.md\ncp skills/self-improvement/hooks/openclaw/handler.js ~/.openclaw/hooks/self-improvement/handler.js\n\n# Enable it\nopenclaw hooks enable self-improvement\n\n# Verify\nopenclaw hooks list\n```\n\n> **Important:** OpenClaw hooks require `HOOK.md` + `handler.js` at the top level of the hook directory. Shell scripts (`hook.sh`) are not supported.\n\nThe hook checks `.learning-trail.json` on session start for:\n- Pending high-priority items\n- Verifications due for review\n- Patterns ready for promotion\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| Command/operation fails | Log to ERRORS.md + auto-log |\n| User corrects you | Log to LEARNINGS.md (correction) |\n| User wants missing feature | Log to FEATURE_REQUESTS.md |\n| API/external tool fails | Log to ERRORS.md |\n| Knowledge was outdated | Log to LEARNINGS.md (knowledge_gap) |\n| Found better approach | Log to LEARNINGS.md (best_practice) |\n| Same error 3x across sessions | Promote to core file |\n| Change applied 7+ days ago | Run verification check |\n\n## Priority Guidelines\n\n| Priority | When to Use |\n|----------|-------------|\n| **critical** | Blocks core functionality, data loss risk, security issue |\n| **high** | Significant impact, affects common workflows, recurring issue |\n| **medium** | Moderate impact, workaround exists |\n| **low** | Minor inconvenience, nice-to-have |\n\n## Conflict Resolution\n\nWhen two principles contradict, the system uses **priority scoring** to decide which wins:\n\n```\nScore = BasePriority(100/60/30/10) + RecurrenceBonus(×10 each) + RecencyBonus(up to 30) + AreaWeight(up to 50)\n\nHighest score wins.\n```\n\nExample\n\nArchive v2.2.0: 10 files, 53342 bytes\n\nFiles: hooks/openclaw/handler.js (3763b), hooks/openclaw/HOOK.md (934b), references/reflection_frameworks.md (13191b), scripts/dream.py (13334b), scripts/learn.py (69553b), scripts/reflect.py (7430b), scripts/skillgen.py (18014b), skill-card.md (2564b), SKILL.md (27700b), _meta.json (139b)\n\nArchive v1.1.0: 10 files, 53502 bytes\n\nFiles: hooks/openclaw/handler.js (3763b), hooks/openclaw/HOOK.md (934b), references/reflection_frameworks.md (13191b), scripts/dream.py (13334b), scripts/learn.py (69553b), scripts/reflect.py (7430b), scripts/skillgen.py (18014b), skill-card.md (3055b), SKILL.md (27700b), _meta.json (139b)\n\nArchive v2.1.0: 9 files, 48114 bytes\n\nFiles: hooks/openclaw/handler.js (3763b), hooks/openclaw/HOOK.md (934b), references/reflection_frameworks.md (13191b), scripts/learn.py (68629b), scripts/reflect.py (7430b), scripts/skillgen.py (18014b), skill-card.md (2649b), SKILL.md (27618b), _meta.json (139b)\n\nArchive v2.0.0: 9 files, 47446 bytes\n\nFiles: hooks/openclaw/handler.js (3763b), hooks/openclaw/HOOK.md (934b), references/reflection_frameworks.md (13191b), scripts/learn.py (68189b), scripts/reflect.py (7430b), scripts/skillgen.py (18014b), skill-card.md (2610b), SKILL.md (27618b), _meta.json (139b)\n\nArchive v1.0.0: 9 files, 42929 bytes\n\nFiles: hooks/openclaw/handler.js (2667b), hooks/openclaw/HOOK.md (688b), references/reflection_frameworks.md (13191b), scripts/learn.py (57692b), scripts/reflect.py (6574b), scripts/skillgen.py (18014b), skill-card.md (3097b), SKILL.md (25200b), _meta.json (139b)","readmeExcerpt":"Skill: Self Improvement Llm Owner: brucetangc Summary: Autonomous AI memory and self-learning system that logs, extracts lessons, verifies improvements, adapts behavior, manages preferences, and generates reusabl... Tags: latest:2.3.0 Version history: v2.3.0 | 2026-07-29T11:54:50.774Z | auto Version 2.3.0 - Added a CLI references document (references/cli_ref.md) for command-line usage. - Updated procedural instructio","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python3 scripts/learn.py --log correction \"具体纠正了什么\""},{"language":"bash","snippet":"python3 scripts/learn.py --log error \"工具名: 错误简述\" --area tooling --priority medium"},{"language":"bash","snippet":"python3 scripts/reflect.py --log \"完成了什么\""},{"language":"bash","snippet":"python3 scripts/learn.py --status"},{"language":"bash","snippet":"# ❌ 错误：凭记忆构造 oldText\nedit(path=\"MEMORY.md\", oldText=\"我印象中的内容\", newText=\"新内容\")\n\n# ✅ 正确：先读文件，拿到实际内容\nread(path=\"MEMORY.md\")\n# 然后用实际内容构造 oldText\nedit(path=\"MEMORY.md\", oldText=\"从 read 结果中复制的精确文本\", newText=\"新内容\")"},{"language":"bash","snippet":"python3 scripts/learn.py --record-change MEMORY.md \"what was changed\" \"why this should help\""}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: self-improvement-llm\ndescription: Autonomous memory and self-learning system for AI agents. Continuously collects experience, manages memory (daily logs, user preferences, knowledge extraction), builds knowledge graphs connecting events→lessons→principles, extracts principles, auto-adjusts behavior, and verifies improvements. Proposes actionable changes for user review before applying. Use when: (1) Agent needs to learn from past sessions, (2) User asks \"improve yourself\" or \"learn from this\", (3) Periodic self-evaluation is needed, (4) Agent needs to auto-correct recurring mistakes, (5) Updating AGENTS.md/SOUL.md/MEMORY.md/TOOLS.md based on experience, (6) Extracting universal principles from episodic experiences, (7) Processing user feedback to permanently adapt behavior, (8) Managing daily memory logs, user preferences, or knowledge retention.\n---\n\n# Self-Learning System\n\nA continuous learning loop that automatically captures learnings, tracks improvements, and verifies their effectiveness.\n\n**Inspiration:** This skill fuses the structured recording format and detection triggers from [pskoett/self-improving-agent](https://clawhub.ai/pskoett/self-improving-agent) (6.1k installs) with a verification/hypothesis loop that most agent learning systems lack.\n\n## 🤖 Agent: What You Must Do (Not Optional)\n\nThese are **required behaviors**, not suggestions. Execute them during conversation without being told.\n\n### During Every Conversation\n\n1. **Detect learning opportunities in real-time.** After every user message or tool result, mentally check:\n   - Did the user correct me? → run `python3 scripts/reflect.py --detect \"USER_MESSAGE\"`\n   - Did a tool fail? → log to `.learning-trail.json` immediately\n   - Did I learn something new? → log to `.learning-trail.json` immediately\n\n2. **Log corrections immediately.** When the user says \"不对\", \"错了\", \"no\", \"actually\", etc.:\n   ```bash\n   python3 scripts/learn.py --log correction \"具体纠正了什么\"\n   ```\n   Set pattern_key for dedup: `--log correction \"message\" --area behavior --priority high`\n\n3. **Log errors automatically.** When a tool call fails or returns unexpected output:\n   ```bash\n   python3 scripts/learn.py --log error \"工具名: 错误简述\" --area tooling --priority medium\n   ```\n\n4. **After significant tasks,** append to today's daily log:\n   ```bash\n   python3 scripts/reflect.py --log \"完成了什么\"\n   ```\n\n### At Session Start\n\n5. **Check `.hook-context.txt`** (written by plugin hook at gateway startup):\n   Use `read(path=\"memory/.hook-context.txt\")` to check it.\n   If it shows pending verifications or patterns ready for promotion, act on them.\n\n6. **Run a quick status check:**\n   ```bash\n   python3 scripts/learn.py --status\n   ```\n\n### During Daily Cycle (via cron, 3AM)\n\n7. The full cycle runs automatically: `python3 scripts/learn.py --cycle`\n   - **🌙 Dream:** Distills recent daily logs into MEMORY.md (dedup + compress)\n   - Auto-promotes patterns (≥2 occurrences across ≥2 sessions)\n   - Auto-generates session summ"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7afdk9ag1ftxjn0btmw2tj3h82y30x\",\n  \"slug\": \"self-improvement-llm\",\n  \"version\": \"2.3.0\",\n  \"publishedAt\": 1785326090774\n}"},{"path":"references/cli_ref.md","content":"# CLI Reference & Detailed Structures\n\n## Structured Log Format\n\nEvery entry uses this format (inspired by pskoett standard):\n\n### Learning Entry\n\n```\n## [LRN-YYYYMMDD-XXX] category:brief_title\n\n**Logged**: ISO-8601 timestamp\n**Priority**: low | medium | high | critical\n**Status**: pending | in_progress | resolved | wont_fix | promoted\n**Area**: frontend | backend | infra | tests | docs | config | behavior | tooling\n\n### Summary\nOne-line description\n\n### Details\nWhat happened, what was wrong, what's correct\n\n### Suggested Action\nSpecific fix or improvement\n\n### Metadata\n- Source: conversation | error | user_feedback | self_discovery\n- Related Files: path/to/file\n- Tags: tag1, tag2\n- Pattern-Key: unique_key_for_dedup (optional, for recurring patterns)\n- Recurrence-Count: 1\n- First-Seen: YYYY-MM-DD\n- Last-Seen: YYYY-MM-DD\n```\n\n### Error Entry\n\n```\n## [ERR-YYYYMMDD-XXX] tool_or_command_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: high\n**Status**: pending\n**Area**: infra | tooling | config\n\n### Summary\nBrief description of what failed\n\n### Error\nActual error message or output\n\n### Context\n- Command/operation attempted\n- Input or parameters used\n\n### Suggested Fix\nWhat might resolve this\n\n### Metadata\n- Reproducible: yes | no | unknown\n- Related Files: path/to/file\n- See Also: ERR-YYYYMMDD-XXX (if recurring)\n```\n\n### Feature Request Entry\n\n```\n## [FEAT-YYYYMMDD-XXX] capability_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: medium\n**Status**: pending\n**Area**: as appropriate\n\n### Summary\nWhat the user wanted to do\n\n### User Context\nWhy they needed it\n\n### Complexity Estimate\nsimple | medium | complex\n\n### Metadata\n- Frequency: first_time | recurring\n- Related Features: existing_feature_name\n```\n\n### ID Generation\n\nFormat: `TYPE-YYYYMMDD-XXX`\n- TYPE: LRN (learning), ERR (error), FEAT (feature)\n- YYYYMMDD: Current date\n- XXX: Sequential number or random 3 chars (e.g., 001, A7B)\n\n## Auto-Generated Skill Format\n\n```markdown\n---\nname: skill-slug-name\ndescription: 一句话描述这个技能做什么\ncreated: 2026-05-27\nupdated: 2026-05-27\nsource: auto\ntriggers: [\"触发关键词或场景\"]\ntools: [web_fetch, exec, read]\n---\n\n## Procedure\n\n1. 步骤一：做了什么\n2. 步骤二：怎么做的\n3. 步骤三：验证结果\n\n## Pitfalls\n\n- 已知问题或陷阱\n- 容易出错的地方\n- 环境依赖\n\n## Verification\n\n- 如何验证结果正确\n- 预期输出是什么\n```\n\n## Verification Loop — JSON Entry\n\n```json\n{\n  \"id\": \"change-20260505-001\",\n  \"source\": \"LRN-20260505-003\",\n  \"target\": \"TOOLS.md\",\n  \"change\": \"Added 'prefer read over exec for files'\",\n  \"hypothesis\": \"This will reduce file-viewing errors\",\n  \"verified\": false,\n  \"next_check\": \"2026-05-12\",\n  \"evidence\": []\n}\n```\n\n### Verification Outcomes\n\n| Result | Action |\n|--------|--------|\n| ✅ Confirmed effective | Mark verified, reduce monitoring to monthly |\n| ❌ Ineffective | Revert change, log why it failed |\n| ❌ Made worse | Revert immediately, escalate |\n| ❓ Inconclusive | Extend monitoring, add more data points |\n\n## Conflict Resolution — Priority Score\n\n```\nScore = BasePriority(100/60/30/10) + RecurrenceBonus(×10 each) + RecencyBonus("},{"path":"references/reflection_frameworks.md","content":"# Reflection Frameworks\n\nDeep-dive reference for types of reflection, depth levels, score rubrics, proposal patterns, and the learning system.\n\n## Learning System Architecture\n\nThe self-learning system runs as a background process, not an on-demand command:\n\n```\n                    ┌──────────┐\n                    │  AGENT    │\n                    │  (LLM)    │\n                    └────┬─────┘\n                         │\n         ┌───────────────┼───────────────┐\n         │               │               │\n         ▼               ▼               ▼\n   ┌──────────┐   ┌──────────┐   ┌──────────┐\n   │ Session  │   │  Memory  │   │ Learning │\n   │  Log     │   │  Files   │   │  Trail   │\n   └──────────┘   └──────────┘   └──────────┘\n         │               │               │\n         └───────────────┼───────────────┘\n                         ▼\n                  ┌──────────────┐\n                  │  Heartbeat   │\n                  │  (Idle)      │\n                  └──────┬───────┘\n                         │\n                         ▼\n                  ┌──────────────┐\n                  │ Learn Cycle  │\n                  │  extract →   │\n                  │  verify →    │\n                  │  integrate   │\n                  └──────────────┘\n                         │\n                         ▼\n                  ┌──────────────┐\n                  │  Self-Modify │\n                  │  (files)     │\n                  └──────────────┘\n```\n\n### Data Flow\n\n1. **Session Logging** — After each task, auto-append to `memory/YYYY-MM-DD.md`\n2. **Learning Trail** — `memory/.learning-trail.json` tracks every change, its hypothesis, and verification status\n3. **Heartbeat** — During idle time, triggers `python3 scripts/learn.py --cycle`\n4. **Verify** — Checks if past changes actually improved behavior (measured by error rate)\n5. **Adapt** — Reverts failed changes, reinforces successful ones\n\n### Auto-Logging Format\n\n```markdown\n### ✅ 14:32 - Fetched weather data for Rugao\n### ❌ 14:35 - Tried to send screenshot via exec\n   Error: Platform requires MEDIA directive, not curl\n```\n\nThree lines max per entry. Keep it scannable.\n\n### Learning Trail Structure\n\n```json\n{\n  \"changes\": [\n    {\n      \"id\": \"change-20260505-001\",\n      \"target\": \"TOOLS.md\",\n      \"hypothesis\": \"Adding MEDIA note prevents file delivery failures\",\n      \"verified\": false,\n      \"next_check\": \"2026-05-12\"\n    }\n  ],\n  \"watchlist\": [\n    {\"issue\": \"Using exec instead of read for files\", \"count\": 3, \"status\": \"watch\"}\n  ]\n}\n```\n\n## Industry Patterns\n\nThese are the real-world patterns used by mature agent frameworks:\n\n### 1. Reflexion (Academic, 388⭐)\n**Paper:** Shinn et al., NeurIPS 2023 — [arXiv:2303.11366](https://arxiv.org/abs/2303.11366)\n**Official Code:** [noahshinn/reflexion-draft](https://github.com/noahshinn/reflexion-draft)\n\n```\n┌──────────┐    task + reflections    ┌──────────────┐\n│  Actor   │ ─────────────────────► │     LLM       │\n└──────────┘ ◄──────────────────── └──────────────┘\n     │ "},{"path":"hooks/openclaw/HOOK.md","content":"---\nname: self-improvement\ndescription: Self-learning system — checks pending learnings, writes session context, and tracks patterns at gateway startup\nmetadata:\n  openclaw:\n    emoji: \"🧠\"\n    events: [\"gateway:startup\"]\n---\n\n# Self-Improvement Gateway Hook\n\nRuns at gateway startup. Writes actionable context to `memory/.hook-context.txt` for the agent to read at session start.\n\n## What It Does\n\n- Checks `.learning-trail.json` for pending high-priority items\n- Checks for overdue verifications\n- Detects patterns ready for promotion (≥2 occurrences)\n- Checks if recent session summaries exist\n- Writes findings to `memory/.hook-context.txt`\n\n## Agent Usage\n\nAt session start, the agent should:\n```bash\ncat memory/.hook-context.txt\n```\n\nThis file is regenerated at each gateway startup and contains the current state of the learning system.\n\n## Installation\n\nThe hook is auto-installed by OpenClaw when the skill is enabled."}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Autonomous AI memory and self-learning system that logs, extracts lessons, verifies improvements, adapts behavior, manages preferences, and generates reusabl... Skill: Self Improvement Llm Owner: brucetangc Summary: Autonomous AI memory and self-learning system that logs, extracts lessons, verifies improvements, adapts behavior, manages preferences, and generates reusabl... Tags: latest:2.3.0 Version history: v2.3.0 | 2026-07-29T11:54:50.774Z | auto Version 2.3.0 - Added a CLI references document (references/cli_ref.md) for command-line usage. - Updated procedural instructio","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1175,"uniquenessScore":55,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T16:27:28.548Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-10T16:27:28.548Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T21:48:31.313Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}