{"id":"8159bc77-25c8-4913-ac20-bb3a2a640a1b","entityType":"agent","slug":"clawhub-pskoett-self-improving-agent","name":"self-improving-agent","canonicalUrl":"https://www.xpersona.co/agent/clawhub-pskoett-self-improving-agent","canonicalPath":"/agent/clawhub-pskoett-self-improving-agent","generatedAt":"2026-10-09T00:59:10.303Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"description":"Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 77.6K downloads reported by the source. Last updated 4/15/2026.","installCommand":"clawhub skill install kn70cjr952qdec1nx70zs6wefn7ynq2t:self-improving-agent","sourceUrl":"https://clawhub.ai/pskoett/self-improving-agent","homepage":"https://clawhub.ai/pskoett/self-improving-agent","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/pskoett/self-improving-agent","kind":"source"}],"safetyScore":84,"overallRank":62,"popularityScore":91,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"self-improving-agent technical dossier on Xpersona with source links, trust signals, and execution metadata."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"No protocol or capability metadata is available."},"protocols":[],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":0,"capabilityMatrix":{"rows":[],"flattenedTokens":""}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"stars":null,"forks":null,"downloads":77551,"packageName":null,"latestVersion":"1.0.11","tractionLabel":"77.6K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-02-28T16:47:02.513Z","emptyReason":null},"lastUpdatedAt":"2026-04-15T00:45:39.800Z","lastCrawledAt":"2026-02-28T16:47:02.513Z","lastIndexedAt":null,"nextCrawlAt":"2026-03-01T16:47:02.513Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.11","createdAt":"2026-02-22T16:28:33.337Z","changelog":"No functional or content changes; OpenClaw-specific environment metadata was removed. - Removed the OpenClaw `requires.env` metadata block from the skill definition. - All usage guidance, logging formats, and workflow instructions remain unchanged. - No new features or bug fixes included in this version. - This update does not require any action from users. - Ensures cleaner skill metadata and wider compatibility.","fileCount":16,"zipByteSize":24314},{"version":"1.0.10","createdAt":"2026-02-21T21:34:25.365Z","changelog":"self-improving-agent v1.0.10 - Added attribution: notes that this skill was remade for OpenClaw from the original repository (pskoett-ai-skills). - No functional or structural changes to the skill—documentation only update. - No code files were changed in this version.","fileCount":16,"zipByteSize":24352},{"version":"1.0.9","createdAt":"2026-02-21T20:43:11.283Z","changelog":"- Added OpenClaw integration metadata to SKILL.md (`metadata: openclaw: requires: env: [CLAUDE_TOOL_OUTPUT]`) - No changes to general skill functionality or logging workflows - This update enables better compatibility and environment validation for OpenClaw users","fileCount":null,"zipByteSize":null},{"version":"1.0.8","createdAt":"2026-02-21T20:36:06.961Z","changelog":"self-improving-agent 1.0.8 - Clarified that referencing agent files (AGENTS.md, CLAUDE.md, or .github/copilot-instructions.md) is an alternative to hook-based reminders in the generic setup section. - No code or file changes; documentation only.","fileCount":null,"zipByteSize":null},{"version":"1.0.7","createdAt":"2026-02-21T18:12:28.113Z","changelog":"Version 1.0.7 - Added setup guidance: Now includes instructions to reference agent files (AGENTS.md, CLAUDE.md, or .github/copilot-instructions.md) to remind logging of learnings. - Introduced a new \"Self-Improvement Workflow\" section for logging and promoting learnings. - Clarified promotion steps for broadly applicable learnings, especially for non-OpenClaw environments. - No code or file changes; documentation only update.","fileCount":null,"zipByteSize":null},{"version":"1.0.6","createdAt":"2026-02-21T17:22:45.619Z","changelog":"self-improving-agent 1.0.6 changelog: - Added support for recurring pattern tracking: now supports logging and updating learnings with a stable `Pattern-Key` and new metadata fields like `Recurrence-Count`, `First-Seen`, and `Last-Seen`. - Introduced a \"simplify-and-harden\" source for learnings, enabling simplified/hardened patterns to be tracked and improved over time. - Updated Quick Reference and Learning Entry format to reflect new pattern tracking options. - No code or file structure changes; documentation-only update.","fileCount":null,"zipByteSize":null},{"version":"1.0.5","createdAt":"2026-02-03T07:20:44.219Z","changelog":"- fixed hook sub-agent bug by removing hook for sub-agent processes","fileCount":null,"zipByteSize":null},{"version":"1.0.4","createdAt":"2026-01-31T12:39:00.016Z","changelog":"- Added detailed OpenClaw integration instructions, including workspace structure, installation methods, and inter-session communication tools. - Introduced dedicated section for OpenClaw setup and workflow, separating generic and OpenClaw-specific usage. - Included instructions for enabling automatic prompts via OpenClaw session hooks. - Removed Clawdhub metadata file (.clawdhub/origin.json) from the repository. - Clarified file organization and promotion targets for learnings within the OpenClaw workspace.","fileCount":null,"zipByteSize":null}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install kn70cjr952qdec1nx70zs6wefn7ynq2t:self-improving-agent","setupComplexity":"low","setupSteps":["Install using `clawhub skill install kn70cjr952qdec1nx70zs6wefn7ynq2t:self-improving-agent` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/pskoett/self-improving-agent before using production credentials."],"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-pskoett-self-improving-agent/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-pskoett-self-improving-agent/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-pskoett-self-improving-agent/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-pskoett-self-improving-agent/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-pskoett-self-improving-agent/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-pskoett-self-improving-agent/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":[]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-09T00:59:10.302Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-pskoett-self-improving-agent/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-pskoett-self-improving-agent/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-pskoett-self-improving-agent/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-pskoett-self-improving-agent/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":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"readme":"Skill: self-improving-agent\n\nOwner: pskoett\n\nSummary: Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...\n\nTags: latest:1.0.11\n\nVersion history:\n\nv1.0.11 | 2026-02-22T16:28:33.337Z | user\n\nNo functional or content changes; OpenClaw-specific environment metadata was removed.\n\n- Removed the OpenClaw `requires.env` metadata block from the skill definition.\n- All usage guidance, logging formats, and workflow instructions remain unchanged.\n- No new features or bug fixes included in this version.\n- This update does not require any action from users.\n- Ensures cleaner skill metadata and wider compatibility.\n\nv1.0.10 | 2026-02-21T21:34:25.365Z | user\n\nself-improving-agent v1.0.10\n\n- Added attribution: notes that this skill was remade for OpenClaw from the original repository (pskoett-ai-skills).\n- No functional or structural changes to the skill—documentation only update.\n- No code files were changed in this version.\n\nv1.0.9 | 2026-02-21T20:43:11.283Z | user\n\n- Added OpenClaw integration metadata to SKILL.md (`metadata: openclaw: requires: env: [CLAUDE_TOOL_OUTPUT]`)\n- No changes to general skill functionality or logging workflows\n- This update enables better compatibility and environment validation for OpenClaw users\n\nv1.0.8 | 2026-02-21T20:36:06.961Z | user\n\nself-improving-agent 1.0.8\n\n- Clarified that referencing agent files (AGENTS.md, CLAUDE.md, or .github/copilot-instructions.md) is an alternative to hook-based reminders in the generic setup section.\n- No code or file changes; documentation only.\n\nv1.0.7 | 2026-02-21T18:12:28.113Z | user\n\nVersion 1.0.7\n\n- Added setup guidance: Now includes instructions to reference agent files (AGENTS.md, CLAUDE.md, or .github/copilot-instructions.md) to remind logging of learnings.\n- Introduced a new \"Self-Improvement Workflow\" section for logging and promoting learnings.\n- Clarified promotion steps for broadly applicable learnings, especially for non-OpenClaw environments.\n- No code or file changes; documentation only update.\n\nv1.0.6 | 2026-02-21T17:22:45.619Z | user\n\nself-improving-agent 1.0.6 changelog:\n\n- Added support for recurring pattern tracking: now supports logging and updating learnings with a stable `Pattern-Key` and new metadata fields like `Recurrence-Count`, `First-Seen`, and `Last-Seen`.\n- Introduced a \"simplify-and-harden\" source for learnings, enabling simplified/hardened patterns to be tracked and improved over time.\n- Updated Quick Reference and Learning Entry format to reflect new pattern tracking options.\n- No code or file structure changes; documentation-only update.\n\nv1.0.5 | 2026-02-03T07:20:44.219Z | user\n\n- fixed hook sub-agent bug by removing hook for sub-agent processes\n\nv1.0.4 | 2026-01-31T12:39:00.016Z | user\n\n- Added detailed OpenClaw integration instructions, including workspace structure, installation methods, and inter-session communication tools.\n- Introduced dedicated section for OpenClaw setup and workflow, separating generic and OpenClaw-specific usage.\n- Included instructions for enabling automatic prompts via OpenClaw session hooks.\n- Removed Clawdhub metadata file (.clawdhub/origin.json) from the repository.\n- Clarified file organization and promotion targets for learnings within the OpenClaw workspace.\n\nv1.0.3 | 2026-01-31T11:04:05.160Z | auto\n\n- Initial OpenClaw integration: added OpenClaw hooks and documentation files.\n- Rebranded workspace references from \"clawdbot\" to \"OpenClaw\" throughout documentation.\n- Introduced new learnings directory structure and logging templates for errors, feature requests, and learnings.\n- Updated and extended instructions in SKILL.md regarding entry promotion, review, and recurring pattern detection.\n- Removed legacy reference to clawdbot integration.\n\nv1.0.2 | 2026-01-26T09:42:32.012Z | auto\n\n- Added guidelines for promoting workflow improvements, tool gotchas, and behavioral patterns to new clawdbot workspace files (`AGENTS.md`, `TOOLS.md`, `SOUL.md`).\n- Updated promotion targets and instructions to include `SOUL.md` and `TOOLS.md` for better organization of learning types.\n- Included references to clawdbot integration throughout documentation.\n- No changes to entry format or basic logging workflow.\n\nv1.0.1 | 2026-01-19T21:56:47.396Z | auto\n\nself-improving-agent v1.0.1\n\n- Added 7 new files, including structured templates (assets/SKILL-TEMPLATE.md, assets/LEARNINGS.md), documentation for examples and hooks, and scripts for error detection and skill extraction.\n- Removed unscoped/old files (LEARNINGS.md, examples.md) in favor of new asset and reference structure.\n- SKILL.md updated: clarified promotion targets to include `.github/copilot-instructions.md` alongside CLAUDE.md and AGENTS.md, improved instructions for file promotion and creation.\n- Improved modularity and usability by providing templates and scripts to assist logging and review workflows.\n\nv1.0.0 | 2026-01-05T17:03:18.365Z\n\nArchive index:\n\nArchive v1.0.11: 16 files, 24314 bytes\n\nFiles: .learnings/ERRORS.md (75b), .learnings/FEATURE_REQUESTS.md (84b), .learnings/LEARNINGS.md (99b), assets/LEARNINGS.md (1152b), assets/SKILL-TEMPLATE.md (3407b), hooks/openclaw/handler.js (1620b), hooks/openclaw/handler.ts (1872b), hooks/openclaw/HOOK.md (589b), references/examples.md (8291b), references/hooks-setup.md (4867b), references/openclaw-integration.md (5638b), scripts/activator.sh (680b), scripts/error-detector.sh (1317b), scripts/extract-skill.sh (5293b), SKILL.md (19704b), _meta.json (140b)\n\nFile v1.0.11:SKILL.md\n\n---\nname: self-improvement\ndescription: \"Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Claude ('No, that's wrong...', 'Actually...'), (3) User requests a capability that doesn't exist, (4) An external API or tool fails, (5) Claude realizes its knowledge is outdated or incorrect, (6) A better approach is discovered for a recurring task. Also review learnings before major tasks.\"\nmetadata:\n---\n\n# Self-Improvement Skill\n\nLog learnings and errors to markdown files for continuous improvement. Coding agents can later process these into fixes, and important learnings get promoted to project memory.\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| Command/operation fails | Log to `.learnings/ERRORS.md` |\n| User corrects you | Log to `.learnings/LEARNINGS.md` with category `correction` |\n| User wants missing feature | Log to `.learnings/FEATURE_REQUESTS.md` |\n| API/external tool fails | Log to `.learnings/ERRORS.md` with integration details |\n| Knowledge was outdated | Log to `.learnings/LEARNINGS.md` with category `knowledge_gap` |\n| Found better approach | Log to `.learnings/LEARNINGS.md` with category `best_practice` |\n| Simplify/Harden recurring patterns | Log/update `.learnings/LEARNINGS.md` with `Source: simplify-and-harden` and a stable `Pattern-Key` |\n| Similar to existing entry | Link with `**See Also**`, consider priority bump |\n| Broadly applicable learning | Promote to `CLAUDE.md`, `AGENTS.md`, and/or `.github/copilot-instructions.md` |\n| Workflow improvements | Promote to `AGENTS.md` (OpenClaw workspace) |\n| Tool gotchas | Promote to `TOOLS.md` (OpenClaw workspace) |\n| Behavioral patterns | Promote to `SOUL.md` (OpenClaw workspace) |\n\n## OpenClaw Setup (Recommended)\n\nOpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automatic skill loading.\n\n### Installation\n\n**Via ClawdHub (recommended):**\n```bash\nclawdhub install self-improving-agent\n```\n\n**Manual:**\n```bash\ngit clone https://github.com/peterskoett/self-improving-agent.git ~/.openclaw/skills/self-improving-agent\n```\n\nRemade for openclaw from original repo : https://github.com/pskoett/pskoett-ai-skills - https://github.com/pskoett/pskoett-ai-skills/tree/main/skills/self-improvement\n\n### Workspace Structure\n\nOpenClaw injects these files into every session:\n\n```\n~/.openclaw/workspace/\n├── AGENTS.md          # Multi-agent workflows, delegation patterns\n├── SOUL.md            # Behavioral guidelines, personality, principles\n├── TOOLS.md           # Tool capabilities, integration gotchas\n├── MEMORY.md          # Long-term memory (main session only)\n├── memory/            # Daily memory files\n│   └── YYYY-MM-DD.md\n└── .learnings/        # This skill's log files\n    ├── LEARNINGS.md\n    ├── ERRORS.md\n    └── FEATURE_REQUESTS.md\n```\n\n### Create Learning Files\n\n```bash\nmkdir -p ~/.openclaw/workspace/.learnings\n```\n\nThen create the log files (or copy from `assets/`):\n- `LEARNINGS.md` — corrections, knowledge gaps, best practices\n- `ERRORS.md` — command failures, exceptions\n- `FEATURE_REQUESTS.md` — user-requested capabilities\n\n### Promotion Targets\n\nWhen learnings prove broadly applicable, promote them to workspace files:\n\n| Learning Type | Promote To | Example |\n|---------------|------------|---------|\n| Behavioral patterns | `SOUL.md` | \"Be concise, avoid disclaimers\" |\n| Workflow improvements | `AGENTS.md` | \"Spawn sub-agents for long tasks\" |\n| Tool gotchas | `TOOLS.md` | \"Git push needs auth configured first\" |\n\n### Inter-Session Communication\n\nOpenClaw provides tools to share learnings across sessions:\n\n- **sessions_list** — View active/recent sessions\n- **sessions_history** — Read another session's transcript  \n- **sessions_send** — Send a learning to another session\n- **sessions_spawn** — Spawn a sub-agent for background work\n\n### Optional: Enable Hook\n\nFor automatic reminders at session start:\n\n```bash\n# Copy hook to OpenClaw hooks directory\ncp -r hooks/openclaw ~/.openclaw/hooks/self-improvement\n\n# Enable it\nopenclaw hooks enable self-improvement\n```\n\nSee `references/openclaw-integration.md` for complete details.\n\n---\n\n## Generic Setup (Other Agents)\n\nFor Claude Code, Codex, Copilot, or other agents, create `.learnings/` in your project:\n\n```bash\nmkdir -p .learnings\n```\n\nCopy templates from `assets/` or create files with headers.\n\n### Add reference to agent files AGENTS.md, CLAUDE.md, or .github/copilot-instructions.md to remind yourself to log learnings. (this is an alternative to hook-based reminders)\n\n#### Self-Improvement Workflow\n\nWhen errors or corrections occur:\n1. Log to `.learnings/ERRORS.md`, `LEARNINGS.md`, or `FEATURE_REQUESTS.md`\n2. Review and promote broadly applicable learnings to:\n   - `CLAUDE.md` - project facts and conventions\n   - `AGENTS.md` - workflows and automation\n   - `.github/copilot-instructions.md` - Copilot context\n\n## Logging Format\n\n### Learning Entry\n\nAppend to `.learnings/LEARNINGS.md`:\n\n```markdown\n## [LRN-YYYYMMDD-XXX] category\n\n**Logged**: ISO-8601 timestamp\n**Priority**: low | medium | high | critical\n**Status**: pending\n**Area**: frontend | backend | infra | tests | docs | config\n\n### Summary\nOne-line description of what was learned\n\n### Details\nFull context: what happened, what was wrong, what's correct\n\n### Suggested Action\nSpecific fix or improvement to make\n\n### Metadata\n- Source: conversation | error | user_feedback\n- Related Files: path/to/file.ext\n- Tags: tag1, tag2\n- See Also: LRN-20250110-001 (if related to existing entry)\n- Pattern-Key: simplify.dead_code | harden.input_validation (optional, for recurring-pattern tracking)\n- Recurrence-Count: 1 (optional)\n- First-Seen: 2025-01-15 (optional)\n- Last-Seen: 2025-01-15 (optional)\n\n---\n```\n\n### Error Entry\n\nAppend to `.learnings/ERRORS.md`:\n\n```markdown\n## [ERR-YYYYMMDD-XXX] skill_or_command_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: high\n**Status**: pending\n**Area**: frontend | backend | infra | tests | docs | config\n\n### Summary\nBrief description of what failed\n\n### Error\n```\nActual error message or output\n```\n\n### Context\n- Command/operation attempted\n- Input or parameters used\n- Environment details if relevant\n\n### Suggested Fix\nIf identifiable, what might resolve this\n\n### Metadata\n- Reproducible: yes | no | unknown\n- Related Files: path/to/file.ext\n- See Also: ERR-20250110-001 (if recurring)\n\n---\n```\n\n### Feature Request Entry\n\nAppend to `.learnings/FEATURE_REQUESTS.md`:\n\n```markdown\n## [FEAT-YYYYMMDD-XXX] capability_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: medium\n**Status**: pending\n**Area**: frontend | backend | infra | tests | docs | config\n\n### Requested Capability\nWhat the user wanted to do\n\n### User Context\nWhy they needed it, what problem they're solving\n\n### Complexity Estimate\nsimple | medium | complex\n\n### Suggested Implementation\nHow this could be built, what it might extend\n\n### Metadata\n- Frequency: first_time | recurring\n- Related Features: existing_feature_name\n\n---\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\nExamples: `LRN-20250115-001`, `ERR-20250115-A3F`, `FEAT-20250115-002`\n\n## Resolving Entries\n\nWhen an issue is fixed, update the entry:\n\n1. Change `**Status**: pending` → `**Status**: resolved`\n2. Add resolution block after Metadata:\n\n```markdown\n### Resolution\n- **Resolved**: 2025-01-16T09:00:00Z\n- **Commit/PR**: abc123 or #42\n- **Notes**: Brief description of what was done\n```\n\nOther status values:\n- `in_progress` - Actively being worked on\n- `wont_fix` - Decided not to address (add reason in Resolution notes)\n- `promoted` - Elevated to CLAUDE.md, AGENTS.md, or .github/copilot-instructions.md\n\n## Promoting to Project Memory\n\nWhen a learning is broadly applicable (not a one-off fix), promote it to permanent project memory.\n\n### When to Promote\n\n- Learning applies across multiple files/features\n- Knowledge any contributor (human or AI) should know\n- Prevents recurring mistakes\n- Documents project-specific conventions\n\n### Promotion Targets\n\n| Target | What Belongs There |\n|--------|-------------------|\n| `CLAUDE.md` | Project facts, conventions, gotchas for all Claude interactions |\n| `AGENTS.md` | Agent-specific workflows, tool usage patterns, automation rules |\n| `.github/copilot-instructions.md` | Project context and conventions for GitHub Copilot |\n| `SOUL.md` | Behavioral guidelines, communication style, principles (OpenClaw workspace) |\n| `TOOLS.md` | Tool capabilities, usage patterns, integration gotchas (OpenClaw workspace) |\n\n### How to Promote\n\n1. **Distill** the learning into a concise rule or fact\n2. **Add** to appropriate section in target file (create file if needed)\n3. **Update** original entry:\n   - Change `**Status**: pending` → `**Status**: promoted`\n   - Add `**Promoted**: CLAUDE.md`, `AGENTS.md`, or `.github/copilot-instructions.md`\n\n### Promotion Examples\n\n**Learning** (verbose):\n> Project uses pnpm workspaces. Attempted `npm install` but failed. \n> Lock file is `pnpm-lock.yaml`. Must use `pnpm install`.\n\n**In CLAUDE.md** (concise):\n```markdown\n## Build & Dependencies\n- Package manager: pnpm (not npm) - use `pnpm install`\n```\n\n**Learning** (verbose):\n> When modifying API endpoints, must regenerate TypeScript client.\n> Forgetting this causes type mismatches at runtime.\n\n**In AGENTS.md** (actionable):\n```markdown\n## After API Changes\n1. Regenerate client: `pnpm run generate:api`\n2. Check for type errors: `pnpm tsc --noEmit`\n```\n\n## Recurring Pattern Detection\n\nIf logging something similar to an existing entry:\n\n1. **Search first**: `grep -r \"keyword\" .learnings/`\n2. **Link entries**: Add `**See Also**: ERR-20250110-001` in Metadata\n3. **Bump priority** if issue keeps recurring\n4. **Consider systemic fix**: Recurring issues often indicate:\n   - Missing documentation (→ promote to CLAUDE.md or .github/copilot-instructions.md)\n   - Missing automation (→ add to AGENTS.md)\n   - Architectural problem (→ create tech debt ticket)\n\n## Simplify & Harden Feed\n\nUse this workflow to ingest recurring patterns from the `simplify-and-harden`\nskill and turn them into durable prompt guidance.\n\n### Ingestion Workflow\n\n1. Read `simplify_and_harden.learning_loop.candidates` from the task summary.\n2. For each candidate, use `pattern_key` as the stable dedupe key.\n3. Search `.learnings/LEARNINGS.md` for an existing entry with that key:\n   - `grep -n \"Pattern-Key: <pattern_key>\" .learnings/LEARNINGS.md`\n4. If found:\n   - Increment `Recurrence-Count`\n   - Update `Last-Seen`\n   - Add `See Also` links to related entries/tasks\n5. If not found:\n   - Create a new `LRN-...` entry\n   - Set `Source: simplify-and-harden`\n   - Set `Pattern-Key`, `Recurrence-Count: 1`, and `First-Seen`/`Last-Seen`\n\n### Promotion Rule (System Prompt Feedback)\n\nPromote recurring patterns into agent context/system prompt files when all are true:\n\n- `Recurrence-Count >= 3`\n- Seen across at least 2 distinct tasks\n- Occurred within a 30-day window\n\nPromotion targets:\n- `CLAUDE.md`\n- `AGENTS.md`\n- `.github/copilot-instructions.md`\n- `SOUL.md` / `TOOLS.md` for OpenClaw workspace-level guidance when applicable\n\nWrite promoted rules as short prevention rules (what to do before/while coding),\nnot long incident write-ups.\n\n## Periodic Review\n\nReview `.learnings/` at natural breakpoints:\n\n### When to Review\n- Before starting a new major task\n- After completing a feature\n- When working in an area with past learnings\n- Weekly during active development\n\n### Quick Status Check\n```bash\n# Count pending items\ngrep -h \"Status\\*\\*: pending\" .learnings/*.md | wc -l\n\n# List pending high-priority items\ngrep -B5 \"Priority\\*\\*: high\" .learnings/*.md | grep \"^## \\[\"\n\n# Find learnings for a specific area\ngrep -l \"Area\\*\\*: backend\" .learnings/*.md\n```\n\n### Review Actions\n- Resolve fixed items\n- Promote applicable learnings\n- Link related entries\n- Escalate recurring issues\n\n## Detection Triggers\n\nAutomatically log when you notice:\n\n**Corrections** (→ learning with `correction` category):\n- \"No, that's not right...\"\n- \"Actually, it should be...\"\n- \"You're wrong about...\"\n- \"That's outdated...\"\n\n**Feature Requests** (→ feature request):\n- \"Can you also...\"\n- \"I wish you could...\"\n- \"Is there a way to...\"\n- \"Why can't you...\"\n\n**Knowledge Gaps** (→ learning with `knowledge_gap` category):\n- User provides information you didn't know\n- Documentation you referenced is outdated\n- API behavior differs from your understanding\n\n**Errors** (→ error entry):\n- Command returns non-zero exit code\n- Exception or stack trace\n- Unexpected output or behavior\n- Timeout or connection failure\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, edge case, nice-to-have |\n\n## Area Tags\n\nUse to filter learnings by codebase region:\n\n| Area | Scope |\n|------|-------|\n| `frontend` | UI, components, client-side code |\n| `backend` | API, services, server-side code |\n| `infra` | CI/CD, deployment, Docker, cloud |\n| `tests` | Test files, testing utilities, coverage |\n| `docs` | Documentation, comments, READMEs |\n| `config` | Configuration files, environment, settings |\n\n## Best Practices\n\n1. **Log immediately** - context is freshest right after the issue\n2. **Be specific** - future agents need to understand quickly\n3. **Include reproduction steps** - especially for errors\n4. **Link related files** - makes fixes easier\n5. **Suggest concrete fixes** - not just \"investigate\"\n6. **Use consistent categories** - enables filtering\n7. **Promote aggressively** - if in doubt, add to CLAUDE.md or .github/copilot-instructions.md\n8. **Review regularly** - stale learnings lose value\n\n## Gitignore Options\n\n**Keep learnings local** (per-developer):\n```gitignore\n.learnings/\n```\n\n**Track learnings in repo** (team-wide):\nDon't add to .gitignore - learnings become shared knowledge.\n\n**Hybrid** (track templates, ignore entries):\n```gitignore\n.learnings/*.md\n!.learnings/.gitkeep\n```\n\n## Hook Integration\n\nEnable automatic reminders through agent hooks. This is **opt-in** - you must explicitly configure hooks.\n\n### Quick Setup (Claude Code / Codex)\n\nCreate `.claude/settings.json` in your project:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [{\n      \"matcher\": \"\",\n      \"hooks\": [{\n        \"type\": \"command\",\n        \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n      }]\n    }]\n  }\n}\n```\n\nThis injects a learning evaluation reminder after each prompt (~50-100 tokens overhead).\n\n### Full Setup (With Error Detection)\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [{\n      \"matcher\": \"\",\n      \"hooks\": [{\n        \"type\": \"command\",\n        \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n      }]\n    }],\n    \"PostToolUse\": [{\n      \"matcher\": \"Bash\",\n      \"hooks\": [{\n        \"type\": \"command\",\n        \"command\": \"./skills/self-improvement/scripts/error-detector.sh\"\n      }]\n    }]\n  }\n}\n```\n\n### Available Hook Scripts\n\n| Script | Hook Type | Purpose |\n|--------|-----------|---------|\n| `scripts/activator.sh` | UserPromptSubmit | Reminds to evaluate learnings after tasks |\n| `scripts/error-detector.sh` | PostToolUse (Bash) | Triggers on command errors |\n\nSee `references/hooks-setup.md` for detailed configuration and troubleshooting.\n\n## Automatic Skill Extraction\n\nWhen a learning is valuable enough to become a reusable skill, extract it using the provided helper.\n\n### Skill Extraction Criteria\n\nA learning qualifies for skill extraction when ANY of these apply:\n\n| Criterion | Description |\n|-----------|-------------|\n| **Recurring** | Has `See Also` links to 2+ similar issues |\n| **Verified** | Status is `resolved` with working fix |\n| **Non-obvious** | Required actual debugging/investigation to discover |\n| **Broadly applicable** | Not project-specific; useful across codebases |\n| **User-flagged** | User says \"save this as a skill\" or similar |\n\n### Extraction Workflow\n\n1. **Identify candidate**: Learning meets extraction criteria\n2. **Run helper** (or create manually):\n   ```bash\n   ./skills/self-improvement/scripts/extract-skill.sh skill-name --dry-run\n   ./skills/self-improvement/scripts/extract-skill.sh skill-name\n   ```\n3. **Customize SKILL.md**: Fill in template with learning content\n4. **Update learning**: Set status to `promoted_to_skill`, add `Skill-Path`\n5. **Verify**: Read skill in fresh session to ensure it's self-contained\n\n### Manual Extraction\n\nIf you prefer manual creation:\n\n1. Create `skills/<skill-name>/SKILL.md`\n2. Use template from `assets/SKILL-TEMPLATE.md`\n3. Follow [Agent Skills spec](https://agentskills.io/specification):\n   - YAML frontmatter with `name` and `description`\n   - Name must match folder name\n   - No README.md inside skill folder\n\n### Extraction Detection Triggers\n\nWatch for these signals that a learning should become a skill:\n\n**In conversation:**\n- \"Save this as a skill\"\n- \"I keep running into this\"\n- \"This would be useful for other projects\"\n- \"Remember this pattern\"\n\n**In learning entries:**\n- Multiple `See Also` links (recurring issue)\n- High priority + resolved status\n- Category: `best_practice` with broad applicability\n- User feedback praising the solution\n\n### Skill Quality Gates\n\nBefore extraction, verify:\n\n- [ ] Solution is tested and working\n- [ ] Description is clear without original context\n- [ ] Code examples are self-contained\n- [ ] No project-specific hardcoded values\n- [ ] Follows skill naming conventions (lowercase, hyphens)\n\n## Multi-Agent Support\n\nThis skill works across different AI coding agents with agent-specific activation.\n\n### Claude Code\n\n**Activation**: Hooks (UserPromptSubmit, PostToolUse)\n**Setup**: `.claude/settings.json` with hook configuration\n**Detection**: Automatic via hook scripts\n\n### Codex CLI\n\n**Activation**: Hooks (same pattern as Claude Code)\n**Setup**: `.codex/settings.json` with hook configuration\n**Detection**: Automatic via hook scripts\n\n### GitHub Copilot\n\n**Activation**: Manual (no hook support)\n**Setup**: Add to `.github/copilot-instructions.md`:\n\n```markdown\n## Self-Improvement\n\nAfter solving non-obvious issues, consider logging to `.learnings/`:\n1. Use format from self-improvement skill\n2. Link related entries with See Also\n3. Promote high-value learnings to skills\n\nAsk in chat: \"Should I log this as a learning?\"\n```\n\n**Detection**: Manual review at session end\n\n### OpenClaw\n\n**Activation**: Workspace injection + inter-agent messaging\n**Setup**: See \"OpenClaw Setup\" section above\n**Detection**: Via session tools and workspace files\n\n### Agent-Agnostic Guidance\n\nRegardless of agent, apply self-improvement when you:\n\n1. **Discover something non-obvious** - solution wasn't immediate\n2. **Correct yourself** - initial approach was wrong\n3. **Learn project conventions** - discovered undocumented patterns\n4. **Hit unexpected errors** - especially if diagnosis was difficult\n5. **Find better approaches** - improved on your original solution\n\n### Copilot Chat Integration\n\nFor Copilot users, add this to your prompts when relevant:\n\n> After completing this task, evaluate if any learnings should be logged to `.learnings/` using the self-improvement skill format.\n\nOr use quick prompts:\n- \"Log this to learnings\"\n- \"Create a skill from this solution\"\n- \"Check .learnings/ for related issues\"\n\nFile v1.0.11:_meta.json\n\n{\n  \"ownerId\": \"kn70cjr952qdec1nx70zs6wefn7ynq2t\",\n  \"slug\": \"self-improving-agent\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1771777713337\n}\n\nFile v1.0.11:references/examples.md\n\n# Entry Examples\n\nConcrete examples of well-formatted entries with all fields.\n\n## Learning: Correction\n\n```markdown\n## [LRN-20250115-001] correction\n\n**Logged**: 2025-01-15T10:30:00Z\n**Priority**: high\n**Status**: pending\n**Area**: tests\n\n### Summary\nIncorrectly assumed pytest fixtures are scoped to function by default\n\n### Details\nWhen writing test fixtures, I assumed all fixtures were function-scoped. \nUser corrected that while function scope is the default, the codebase \nconvention uses module-scoped fixtures for database connections to \nimprove test performance.\n\n### Suggested Action\nWhen creating fixtures that involve expensive setup (DB, network), \ncheck existing fixtures for scope patterns before defaulting to function scope.\n\n### Metadata\n- Source: user_feedback\n- Related Files: tests/conftest.py\n- Tags: pytest, testing, fixtures\n\n---\n```\n\n## Learning: Knowledge Gap (Resolved)\n\n```markdown\n## [LRN-20250115-002] knowledge_gap\n\n**Logged**: 2025-01-15T14:22:00Z\n**Priority**: medium\n**Status**: resolved\n**Area**: config\n\n### Summary\nProject uses pnpm not npm for package management\n\n### Details\nAttempted to run `npm install` but project uses pnpm workspaces.\nLock file is `pnpm-lock.yaml`, not `package-lock.json`.\n\n### Suggested Action\nCheck for `pnpm-lock.yaml` or `pnpm-workspace.yaml` before assuming npm.\nUse `pnpm install` for this project.\n\n### Metadata\n- Source: error\n- Related Files: pnpm-lock.yaml, pnpm-workspace.yaml\n- Tags: package-manager, pnpm, setup\n\n### Resolution\n- **Resolved**: 2025-01-15T14:30:00Z\n- **Commit/PR**: N/A - knowledge update\n- **Notes**: Added to CLAUDE.md for future reference\n\n---\n```\n\n## Learning: Promoted to CLAUDE.md\n\n```markdown\n## [LRN-20250115-003] best_practice\n\n**Logged**: 2025-01-15T16:00:00Z\n**Priority**: high\n**Status**: promoted\n**Promoted**: CLAUDE.md\n**Area**: backend\n\n### Summary\nAPI responses must include correlation ID from request headers\n\n### Details\nAll API responses should echo back the X-Correlation-ID header from \nthe request. This is required for distributed tracing. Responses \nwithout this header break the observability pipeline.\n\n### Suggested Action\nAlways include correlation ID passthrough in API handlers.\n\n### Metadata\n- Source: user_feedback\n- Related Files: src/middleware/correlation.ts\n- Tags: api, observability, tracing\n\n---\n```\n\n## Learning: Promoted to AGENTS.md\n\n```markdown\n## [LRN-20250116-001] best_practice\n\n**Logged**: 2025-01-16T09:00:00Z\n**Priority**: high\n**Status**: promoted\n**Promoted**: AGENTS.md\n**Area**: backend\n\n### Summary\nMust regenerate API client after OpenAPI spec changes\n\n### Details\nWhen modifying API endpoints, the TypeScript client must be regenerated.\nForgetting this causes type mismatches that only appear at runtime.\nThe generate script also runs validation.\n\n### Suggested Action\nAdd to agent workflow: after any API changes, run `pnpm run generate:api`.\n\n### Metadata\n- Source: error\n- Related Files: openapi.yaml, src/client/api.ts\n- Tags: api, codegen, typescript\n\n---\n```\n\n## Error Entry\n\n```markdown\n## [ERR-20250115-A3F] docker_build\n\n**Logged**: 2025-01-15T09:15:00Z\n**Priority**: high\n**Status**: pending\n**Area**: infra\n\n### Summary\nDocker build fails on M1 Mac due to platform mismatch\n\n### Error\n```\nerror: failed to solve: python:3.11-slim: no match for platform linux/arm64\n```\n\n### Context\n- Command: `docker build -t myapp .`\n- Dockerfile uses `FROM python:3.11-slim`\n- Running on Apple Silicon (M1/M2)\n\n### Suggested Fix\nAdd platform flag: `docker build --platform linux/amd64 -t myapp .`\nOr update Dockerfile: `FROM --platform=linux/amd64 python:3.11-slim`\n\n### Metadata\n- Reproducible: yes\n- Related Files: Dockerfile\n\n---\n```\n\n## Error Entry: Recurring Issue\n\n```markdown\n## [ERR-20250120-B2C] api_timeout\n\n**Logged**: 2025-01-20T11:30:00Z\n**Priority**: critical\n**Status**: pending\n**Area**: backend\n\n### Summary\nThird-party payment API timeout during checkout\n\n### Error\n```\nTimeoutError: Request to payments.example.com timed out after 30000ms\n```\n\n### Context\n- Command: POST /api/checkout\n- Timeout set to 30s\n- Occurs during peak hours (lunch, evening)\n\n### Suggested Fix\nImplement retry with exponential backoff. Consider circuit breaker pattern.\n\n### Metadata\n- Reproducible: yes (during peak hours)\n- Related Files: src/services/payment.ts\n- See Also: ERR-20250115-X1Y, ERR-20250118-Z3W\n\n---\n```\n\n## Feature Request\n\n```markdown\n## [FEAT-20250115-001] export_to_csv\n\n**Logged**: 2025-01-15T16:45:00Z\n**Priority**: medium\n**Status**: pending\n**Area**: backend\n\n### Requested Capability\nExport analysis results to CSV format\n\n### User Context\nUser runs weekly reports and needs to share results with non-technical \nstakeholders in Excel. Currently copies output manually.\n\n### Complexity Estimate\nsimple\n\n### Suggested Implementation\nAdd `--output csv` flag to the analyze command. Use standard csv module.\nCould extend existing `--output json` pattern.\n\n### Metadata\n- Frequency: recurring\n- Related Features: analyze command, json output\n\n---\n```\n\n## Feature Request: Resolved\n\n```markdown\n## [FEAT-20250110-002] dark_mode\n\n**Logged**: 2025-01-10T14:00:00Z\n**Priority**: low\n**Status**: resolved\n**Area**: frontend\n\n### Requested Capability\nDark mode support for the dashboard\n\n### User Context\nUser works late hours and finds the bright interface straining.\nSeveral other users have mentioned this informally.\n\n### Complexity Estimate\nmedium\n\n### Suggested Implementation\nUse CSS variables for colors. Add toggle in user settings.\nConsider system preference detection.\n\n### Metadata\n- Frequency: recurring\n- Related Features: user settings, theme system\n\n### Resolution\n- **Resolved**: 2025-01-18T16:00:00Z\n- **Commit/PR**: #142\n- **Notes**: Implemented with system preference detection and manual toggle\n\n---\n```\n\n## Learning: Promoted to Skill\n\n```markdown\n## [LRN-20250118-001] best_practice\n\n**Logged**: 2025-01-18T11:00:00Z\n**Priority**: high\n**Status**: promoted_to_skill\n**Skill-Path**: skills/docker-m1-fixes\n**Area**: infra\n\n### Summary\nDocker build fails on Apple Silicon due to platform mismatch\n\n### Details\nWhen building Docker images on M1/M2 Macs, the build fails because\nthe base image doesn't have an ARM64 variant. This is a common issue\nthat affects many developers.\n\n### Suggested Action\nAdd `--platform linux/amd64` to docker build command, or use\n`FROM --platform=linux/amd64` in Dockerfile.\n\n### Metadata\n- Source: error\n- Related Files: Dockerfile\n- Tags: docker, arm64, m1, apple-silicon\n- See Also: ERR-20250115-A3F, ERR-20250117-B2D\n\n---\n```\n\n## Extracted Skill Example\n\nWhen the above learning is extracted as a skill, it becomes:\n\n**File**: `skills/docker-m1-fixes/SKILL.md`\n\n```markdown\n---\nname: docker-m1-fixes\ndescription: \"Fixes Docker build failures on Apple Silicon (M1/M2). Use when docker build fails with platform mismatch errors.\"\n---\n\n# Docker M1 Fixes\n\nSolutions for Docker build issues on Apple Silicon Macs.\n\n## Quick Reference\n\n| Error | Fix |\n|-------|-----|\n| `no match for platform linux/arm64` | Add `--platform linux/amd64` to build |\n| Image runs but crashes | Use emulation or find ARM-compatible base |\n\n## The Problem\n\nMany Docker base images don't have ARM64 variants. When building on\nApple Silicon (M1/M2/M3), Docker attempts to pull ARM64 images by\ndefault, causing platform mismatch errors.\n\n## Solutions\n\n### Option 1: Build Flag (Recommended)\n\nAdd platform flag to your build command:\n\n\\`\\`\\`bash\ndocker build --platform linux/amd64 -t myapp .\n\\`\\`\\`\n\n### Option 2: Dockerfile Modification\n\nSpecify platform in the FROM instruction:\n\n\\`\\`\\`dockerfile\nFROM --platform=linux/amd64 python:3.11-slim\n\\`\\`\\`\n\n### Option 3: Docker Compose\n\nAdd platform to your service:\n\n\\`\\`\\`yaml\nservices:\n  app:\n    platform: linux/amd64\n    build: .\n\\`\\`\\`\n\n## Trade-offs\n\n| Approach | Pros | Cons |\n|----------|------|------|\n| Build flag | No file changes | Must remember flag |\n| Dockerfile | Explicit, versioned | Affects all builds |\n| Compose | Convenient for dev | Requires compose |\n\n## Performance Note\n\nRunning AMD64 images on ARM64 uses Rosetta 2 emulation. This works\nfor development but may be slower. For production, find ARM-native\nalternatives when possible.\n\n## Source\n\n- Learning ID: LRN-20250118-001\n- Category: best_practice\n- Extraction Date: 2025-01-18\n```\n\nFile v1.0.11:references/hooks-setup.md\n\n# Hook Setup Guide\n\nConfigure automatic self-improvement triggers for AI coding agents.\n\n## Overview\n\nHooks enable proactive learning capture by injecting reminders at key moments:\n- **UserPromptSubmit**: Reminder after each prompt to evaluate learnings\n- **PostToolUse (Bash)**: Error detection when commands fail\n\n## Claude Code Setup\n\n### Option 1: Project-Level Configuration\n\nCreate `.claude/settings.json` in your project root:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ],\n    \"PostToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/error-detector.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n### Option 2: User-Level Configuration\n\nAdd to `~/.claude/settings.json` for global activation:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"~/.claude/skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n### Minimal Setup (Activator Only)\n\nFor lower overhead, use only the UserPromptSubmit hook:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n## Codex CLI Setup\n\nCodex uses the same hook system as Claude Code. Create `.codex/settings.json`:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n## GitHub Copilot Setup\n\nCopilot doesn't support hooks directly. Instead, add guidance to `.github/copilot-instructions.md`:\n\n```markdown\n## Self-Improvement\n\nAfter completing tasks that involved:\n- Debugging non-obvious issues\n- Discovering workarounds\n- Learning project-specific patterns\n- Resolving unexpected errors\n\nConsider logging the learning to `.learnings/` using the format from the self-improvement skill.\n\nFor high-value learnings that would benefit other sessions, consider skill extraction.\n```\n\n## Verification\n\n### Test Activator Hook\n\n1. Enable the hook configuration\n2. Start a new Claude Code session\n3. Send any prompt\n4. Verify you see `<self-improvement-reminder>` in the context\n\n### Test Error Detector Hook\n\n1. Enable PostToolUse hook for Bash\n2. Run a command that fails: `ls /nonexistent/path`\n3. Verify you see `<error-detected>` reminder\n\n### Dry Run Extract Script\n\n```bash\n./skills/self-improvement/scripts/extract-skill.sh test-skill --dry-run\n```\n\nExpected output shows the skill scaffold that would be created.\n\n## Troubleshooting\n\n### Hook Not Triggering\n\n1. **Check script permissions**: `chmod +x scripts/*.sh`\n2. **Verify path**: Use absolute paths or paths relative to project root\n3. **Check settings location**: Project vs user-level settings\n4. **Restart session**: Hooks are loaded at session start\n\n### Permission Denied\n\n```bash\nchmod +x ./skills/self-improvement/scripts/activator.sh\nchmod +x ./skills/self-improvement/scripts/error-detector.sh\nchmod +x ./skills/self-improvement/scripts/extract-skill.sh\n```\n\n### Script Not Found\n\nIf using relative paths, ensure you're in the correct directory or use absolute paths:\n\n```json\n{\n  \"command\": \"/absolute/path/to/skills/self-improvement/scripts/activator.sh\"\n}\n```\n\n### Too Much Overhead\n\nIf the activator feels intrusive:\n\n1. **Use minimal setup**: Only UserPromptSubmit, skip PostToolUse\n2. **Add matcher filter**: Only trigger for certain prompts:\n\n```json\n{\n  \"matcher\": \"fix|debug|error|issue\",\n  \"hooks\": [...]\n}\n```\n\n## Hook Output Budget\n\nThe activator is designed to be lightweight:\n- **Target**: ~50-100 tokens per activation\n- **Content**: Structured reminder, not verbose instructions\n- **Format**: XML tags for easy parsing\n\nIf you need to reduce overhead further, you can edit `activator.sh` to output less text.\n\n## Security Considerations\n\n- Hook scripts run with the same permissions as Claude Code\n- Scripts only output text; they don't modify files or run commands\n- Error detector reads `CLAUDE_TOOL_OUTPUT` environment variable\n- All scripts are opt-in (you must configure them explicitly)\n\n## Disabling Hooks\n\nTo temporarily disable without removing configuration:\n\n1. **Comment out in settings**:\n```json\n{\n  \"hooks\": {\n    // \"UserPromptSubmit\": [...]\n  }\n}\n```\n\n2. **Or delete the settings file**: Hooks won't run without configuration\n\nFile v1.0.11:references/openclaw-integration.md\n\n# OpenClaw Integration\n\nComplete setup and usage guide for integrating the self-improvement skill with OpenClaw.\n\n## Overview\n\nOpenClaw uses workspace-based prompt injection combined with event-driven hooks. Context is injected from workspace files at session start, and hooks can trigger on lifecycle events.\n\n## Workspace Structure\n\n```\n~/.openclaw/                      \n├── workspace/                   # Working directory\n│   ├── AGENTS.md               # Multi-agent coordination patterns\n│   ├── SOUL.md                 # Behavioral guidelines and personality\n│   ├── TOOLS.md                # Tool capabilities and gotchas\n│   ├── MEMORY.md               # Long-term memory (main session only)\n│   └── memory/                 # Daily memory files\n│       └── YYYY-MM-DD.md\n├── skills/                      # Installed skills\n│   └── <skill-name>/\n│       └── SKILL.md\n└── hooks/                       # Custom hooks\n    └── <hook-name>/\n        ├── HOOK.md\n        └── handler.ts\n```\n\n## Quick Setup\n\n### 1. Install the Skill\n\n```bash\nclawdhub install self-improving-agent\n```\n\nOr copy manually:\n\n```bash\ncp -r self-improving-agent ~/.openclaw/skills/\n```\n\n### 2. Install the Hook (Optional)\n\nCopy the hook to OpenClaw's hooks directory:\n\n```bash\ncp -r hooks/openclaw ~/.openclaw/hooks/self-improvement\n```\n\nEnable the hook:\n\n```bash\nopenclaw hooks enable self-improvement\n```\n\n### 3. Create Learning Files\n\nCreate the `.learnings/` directory in your workspace:\n\n```bash\nmkdir -p ~/.openclaw/workspace/.learnings\n```\n\nOr in the skill directory:\n\n```bash\nmkdir -p ~/.openclaw/skills/self-improving-agent/.learnings\n```\n\n## Injected Prompt Files\n\n### AGENTS.md\n\nPurpose: Multi-agent workflows and delegation patterns.\n\n```markdown\n# Agent Coordination\n\n## Delegation Rules\n- Use explore agent for open-ended codebase questions\n- Spawn sub-agents for long-running tasks\n- Use sessions_send for cross-session communication\n\n## Session Handoff\nWhen delegating to another session:\n1. Provide full context in the handoff message\n2. Include relevant file paths\n3. Specify expected output format\n```\n\n### SOUL.md\n\nPurpose: Behavioral guidelines and communication style.\n\n```markdown\n# Behavioral Guidelines\n\n## Communication Style\n- Be direct and concise\n- Avoid unnecessary caveats and disclaimers\n- Use technical language appropriate to context\n\n## Error Handling\n- Admit mistakes promptly\n- Provide corrected information immediately\n- Log significant errors to learnings\n```\n\n### TOOLS.md\n\nPurpose: Tool capabilities, integration gotchas, local configuration.\n\n```markdown\n# Tool Knowledge\n\n## Self-Improvement Skill\nLog learnings to `.learnings/` for continuous improvement.\n\n## Local Tools\n- Document tool-specific gotchas here\n- Note authentication requirements\n- Track integration quirks\n```\n\n## Learning Workflow\n\n### Capturing Learnings\n\n1. **In-session**: Log to `.learnings/` as usual\n2. **Cross-session**: Promote to workspace files\n\n### Promotion Decision Tree\n\n```\nIs the learning project-specific?\n├── Yes → Keep in .learnings/\n└── No → Is it behavioral/style-related?\n    ├── Yes → Promote to SOUL.md\n    └── No → Is it tool-related?\n        ├── Yes → Promote to TOOLS.md\n        └── No → Promote to AGENTS.md (workflow)\n```\n\n### Promotion Format Examples\n\n**From learning:**\n> Git push to GitHub fails without auth configured - triggers desktop prompt\n\n**To TOOLS.md:**\n```markdown\n## Git\n- Don't push without confirming auth is configured\n- Use `gh auth status` to check GitHub CLI auth\n```\n\n## Inter-Agent Communication\n\nOpenClaw provides tools for cross-session communication:\n\n### sessions_list\n\nView active and recent sessions:\n```\nsessions_list(activeMinutes=30, messageLimit=3)\n```\n\n### sessions_history\n\nRead transcript from another session:\n```\nsessions_history(sessionKey=\"session-id\", limit=50)\n```\n\n### sessions_send\n\nSend message to another session:\n```\nsessions_send(sessionKey=\"session-id\", message=\"Learning: API requires X-Custom-Header\")\n```\n\n### sessions_spawn\n\nSpawn a background sub-agent:\n```\nsessions_spawn(task=\"Research X and report back\", label=\"research\")\n```\n\n## Available Hook Events\n\n| Event | When It Fires |\n|-------|---------------|\n| `agent:bootstrap` | Before workspace files inject |\n| `command:new` | When `/new` command issued |\n| `command:reset` | When `/reset` command issued |\n| `command:stop` | When `/stop` command issued |\n| `gateway:startup` | When gateway starts |\n\n## Detection Triggers\n\n### Standard Triggers\n- User corrections (\"No, that's wrong...\")\n- Command failures (non-zero exit codes)\n- API errors\n- Knowledge gaps\n\n### OpenClaw-Specific Triggers\n\n| Trigger | Action |\n|---------|--------|\n| Tool call error | Log to TOOLS.md with tool name |\n| Session handoff confusion | Log to AGENTS.md with delegation pattern |\n| Model behavior surprise | Log to SOUL.md with expected vs actual |\n| Skill issue | Log to .learnings/ or report upstream |\n\n## Verification\n\nCheck hook is registered:\n\n```bash\nopenclaw hooks list\n```\n\nCheck skill is loaded:\n\n```bash\nopenclaw status\n```\n\n## Troubleshooting\n\n### Hook not firing\n\n1. Ensure hooks enabled in config\n2. Restart gateway after config changes\n3. Check gateway logs for errors\n\n### Learnings not persisting\n\n1. Verify `.learnings/` directory exists\n2. Check file permissions\n3. Ensure workspace path is configured correctly\n\n### Skill not loading\n\n1. Check skill is in skills directory\n2. Verify SKILL.md has correct frontmatter\n3. Run `openclaw status` to see loaded skills\n\nFile v1.0.11:.learnings/ERRORS.md\n\n# Errors Log\n\nCommand failures, exceptions, and unexpected behaviors.\n\n---\n\nFile v1.0.11:.learnings/FEATURE_REQUESTS.md\n\n# Feature Requests\n\nCapabilities requested by user that don't currently exist.\n\n---\n\nFile v1.0.11:.learnings/LEARNINGS.md\n\n# Learnings Log\n\nCaptured learnings, corrections, and discoveries. Review before major tasks.\n\n---\n\nFile v1.0.11:assets/LEARNINGS.md\n\n# Learnings\n\nCorrections, insights, and knowledge gaps captured during development.\n\n**Categories**: correction | insight | knowledge_gap | best_practice\n**Areas**: frontend | backend | infra | tests | docs | config\n**Statuses**: pending | in_progress | resolved | wont_fix | promoted | promoted_to_skill\n\n## Status Definitions\n\n| Status | Meaning |\n|--------|---------|\n| `pending` | Not yet addressed |\n| `in_progress` | Actively being worked on |\n| `resolved` | Issue fixed or knowledge integrated |\n| `wont_fix` | Decided not to address (reason in Resolution) |\n| `promoted` | Elevated to CLAUDE.md, AGENTS.md, or copilot-instructions.md |\n| `promoted_to_skill` | Extracted as a reusable skill |\n\n## Skill Extraction Fields\n\nWhen a learning is promoted to a skill, add these fields:\n\n```markdown\n**Status**: promoted_to_skill\n**Skill-Path**: skills/skill-name\n```\n\nExample:\n```markdown\n## [LRN-20250115-001] best_practice\n\n**Logged**: 2025-01-15T10:00:00Z\n**Priority**: high\n**Status**: promoted_to_skill\n**Skill-Path**: skills/docker-m1-fixes\n**Area**: infra\n\n### Summary\nDocker build fails on Apple Silicon due to platform mismatch\n...\n```\n\n---\n\nFile v1.0.11:assets/SKILL-TEMPLATE.md\n\n# Skill Template\n\nTemplate for creating skills extracted from learnings. Copy and customize.\n\n---\n\n## SKILL.md Template\n\n```markdown\n---\nname: skill-name-here\ndescription: \"Concise description of when and why to use this skill. Include trigger conditions.\"\n---\n\n# Skill Name\n\nBrief introduction explaining the problem this skill solves and its origin.\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| [Trigger 1] | [Action 1] |\n| [Trigger 2] | [Action 2] |\n\n## Background\n\nWhy this knowledge matters. What problems it prevents. Context from the original learning.\n\n## Solution\n\n### Step-by-Step\n\n1. First step with code or command\n2. Second step\n3. Verification step\n\n### Code Example\n\n\\`\\`\\`language\n// Example code demonstrating the solution\n\\`\\`\\`\n\n## Common Variations\n\n- **Variation A**: Description and how to handle\n- **Variation B**: Description and how to handle\n\n## Gotchas\n\n- Warning or common mistake #1\n- Warning or common mistake #2\n\n## Related\n\n- Link to related documentation\n- Link to related skill\n\n## Source\n\nExtracted from learning entry.\n- **Learning ID**: LRN-YYYYMMDD-XXX\n- **Original Category**: correction | insight | knowledge_gap | best_practice\n- **Extraction Date**: YYYY-MM-DD\n```\n\n---\n\n## Minimal Template\n\nFor simple skills that don't need all sections:\n\n```markdown\n---\nname: skill-name-here\ndescription: \"What this skill does and when to use it.\"\n---\n\n# Skill Name\n\n[Problem statement in one sentence]\n\n## Solution\n\n[Direct solution with code/commands]\n\n## Source\n\n- Learning ID: LRN-YYYYMMDD-XXX\n```\n\n---\n\n## Template with Scripts\n\nFor skills that include executable helpers:\n\n```markdown\n---\nname: skill-name-here\ndescription: \"What this skill does and when to use it.\"\n---\n\n# Skill Name\n\n[Introduction]\n\n## Quick Reference\n\n| Command | Purpose |\n|---------|---------|\n| `./scripts/helper.sh` | [What it does] |\n| `./scripts/validate.sh` | [What it does] |\n\n## Usage\n\n### Automated (Recommended)\n\n\\`\\`\\`bash\n./skills/skill-name/scripts/helper.sh [args]\n\\`\\`\\`\n\n### Manual Steps\n\n1. Step one\n2. Step two\n\n## Scripts\n\n| Script | Description |\n|--------|-------------|\n| `scripts/helper.sh` | Main utility |\n| `scripts/validate.sh` | Validation checker |\n\n## Source\n\n- Learning ID: LRN-YYYYMMDD-XXX\n```\n\n---\n\n## Naming Conventions\n\n- **Skill name**: lowercase, hyphens for spaces\n  - Good: `docker-m1-fixes`, `api-timeout-patterns`\n  - Bad: `Docker_M1_Fixes`, `APITimeoutPatterns`\n\n- **Description**: Start with action verb, mention trigger\n  - Good: \"Handles Docker build failures on Apple Silicon. Use when builds fail with platform mismatch.\"\n  - Bad: \"Docker stuff\"\n\n- **Files**:\n  - `SKILL.md` - Required, main documentation\n  - `scripts/` - Optional, executable code\n  - `references/` - Optional, detailed docs\n  - `assets/` - Optional, templates\n\n---\n\n## Extraction Checklist\n\nBefore creating a skill from a learning:\n\n- [ ] Learning is verified (status: resolved)\n- [ ] Solution is broadly applicable (not one-off)\n- [ ] Content is complete (has all needed context)\n- [ ] Name follows conventions\n- [ ] Description is concise but informative\n- [ ] Quick Reference table is actionable\n- [ ] Code examples are tested\n- [ ] Source learning ID is recorded\n\nAfter creating:\n\n- [ ] Update original learning with `promoted_to_skill` status\n- [ ] Add `Skill-Path: skills/skill-name` to learning metadata\n- [ ] Test skill by reading it in a fresh session\n\nFile v1.0.11:hooks/openclaw/HOOK.md\n\n---\nname: self-improvement\ndescription: \"Injects self-improvement reminder during agent bootstrap\"\nmetadata: {\"openclaw\":{\"emoji\":\"🧠\",\"events\":[\"agent:bootstrap\"]}}\n---\n\n# Self-Improvement Hook\n\nInjects a reminder to evaluate learnings during agent bootstrap.\n\n## What It Does\n\n- Fires on `agent:bootstrap` (before workspace files are injected)\n- Adds a reminder block to check `.learnings/` for relevant entries\n- Prompts the agent to log corrections, errors, and discoveries\n\n## Configuration\n\nNo configuration needed. Enable with:\n\n```bash\nopenclaw hooks enable self-improvement\n```\n\nArchive v1.0.10: 16 files, 24352 bytes\n\nFiles: .learnings/ERRORS.md (75b), .learnings/FEATURE_REQUESTS.md (84b), .learnings/LEARNINGS.md (99b), assets/LEARNINGS.md (1152b), assets/SKILL-TEMPLATE.md (3407b), hooks/openclaw/handler.js (1620b), hooks/openclaw/handler.ts (1872b), hooks/openclaw/HOOK.md (589b), references/examples.md (8291b), references/hooks-setup.md (4867b), references/openclaw-integration.md (5638b), scripts/activator.sh (680b), scripts/error-detector.sh (1317b), scripts/extract-skill.sh (5293b), SKILL.md (19770b), _meta.json (140b)\n\nFile v1.0.10:SKILL.md\n\n---\nname: self-improvement\ndescription: \"Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Claude ('No, that's wrong...', 'Actually...'), (3) User requests a capability that doesn't exist, (4) An external API or tool fails, (5) Claude realizes its knowledge is outdated or incorrect, (6) A better approach is discovered for a recurring task. Also review learnings before major tasks.\"\nmetadata:\n  openclaw:\n    requires:\n      env:\n        - CLAUDE_TOOL_OUTPUT\n---\n\n# Self-Improvement Skill\n\nLog learnings and errors to markdown files for continuous improvement. Coding agents can later process these into fixes, and important learnings get promoted to project memory.\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| Command/operation fails | Log to `.learnings/ERRORS.md` |\n| User corrects you | Log to `.learnings/LEARNINGS.md` with category `correction` |\n| User wants missing feature | Log to `.learnings/FEATURE_REQUESTS.md` |\n| API/external tool fails | Log to `.learnings/ERRORS.md` with integration details |\n| Knowledge was outdated | Log to `.learnings/LEARNINGS.md` with category `knowledge_gap` |\n| Found better approach | Log to `.learnings/LEARNINGS.md` with category `best_practice` |\n| Simplify/Harden recurring patterns | Log/update `.learnings/LEARNINGS.md` with `Source: simplify-and-harden` and a stable `Pattern-Key` |\n| Similar to existing entry | Link with `**See Also**`, consider priority bump |\n| Broadly applicable learning | Promote to `CLAUDE.md`, `AGENTS.md`, and/or `.github/copilot-instructions.md` |\n| Workflow improvements | Promote to `AGENTS.md` (OpenClaw workspace) |\n| Tool gotchas | Promote to `TOOLS.md` (OpenClaw workspace) |\n| Behavioral patterns | Promote to `SOUL.md` (OpenClaw workspace) |\n\n## OpenClaw Setup (Recommended)\n\nOpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automatic skill loading.\n\n### Installation\n\n**Via ClawdHub (recommended):**\n```bash\nclawdhub install self-improving-agent\n```\n\n**Manual:**\n```bash\ngit clone https://github.com/peterskoett/self-improving-agent.git ~/.openclaw/skills/self-improving-agent\n```\n\nRemade for openclaw from original repo : https://github.com/pskoett/pskoett-ai-skills - https://github.com/pskoett/pskoett-ai-skills/tree/main/skills/self-improvement\n\n### Workspace Structure\n\nOpenClaw injects these files into every session:\n\n```\n~/.openclaw/workspace/\n├── AGENTS.md          # Multi-agent workflows, delegation patterns\n├── SOUL.md            # Behavioral guidelines, personality, principles\n├── TOOLS.md           # Tool capabilities, integration gotchas\n├── MEMORY.md          # Long-term memory (main session only)\n├── memory/            # Daily memory files\n│   └── YYYY-MM-DD.md\n└── .learnings/        # This skill's log files\n    ├── LEARNINGS.md\n    ├── ERRORS.md\n    └── FEATURE_REQUESTS.md\n```\n\n### Create Learning Files\n\n```bash\nmkdir -p ~/.openclaw/workspace/.learnings\n```\n\nThen create the log files (or copy from `assets/`):\n- `LEARNINGS.md` — corrections, knowledge gaps, best practices\n- `ERRORS.md` — command failures, exceptions\n- `FEATURE_REQUESTS.md` — user-requested capabilities\n\n### Promotion Targets\n\nWhen learnings prove broadly applicable, promote them to workspace files:\n\n| Learning Type | Promote To | Example |\n|---------------|------------|---------|\n| Behavioral patterns | `SOUL.md` | \"Be concise, avoid disclaimers\" |\n| Workflow improvements | `AGENTS.md` | \"Spawn sub-agents for long tasks\" |\n| Tool gotchas | `TOOLS.md` | \"Git push needs auth configured first\" |\n\n### Inter-Session Communication\n\nOpenClaw provides tools to share learnings across sessions:\n\n- **sessions_list** — View active/recent sessions\n- **sessions_history** — Read another session's transcript  \n- **sessions_send** — Send a learning to another session\n- **sessions_spawn** — Spawn a sub-agent for background work\n\n### Optional: Enable Hook\n\nFor automatic reminders at session start:\n\n```bash\n# Copy hook to OpenClaw hooks directory\ncp -r hooks/openclaw ~/.openclaw/hooks/self-improvement\n\n# Enable it\nopenclaw hooks enable self-improvement\n```\n\nSee `references/openclaw-integration.md` for complete details.\n\n---\n\n## Generic Setup (Other Agents)\n\nFor Claude Code, Codex, Copilot, or other agents, create `.learnings/` in your project:\n\n```bash\nmkdir -p .learnings\n```\n\nCopy templates from `assets/` or create files with headers.\n\n### Add reference to agent files AGENTS.md, CLAUDE.md, or .github/copilot-instructions.md to remind yourself to log learnings. (this is an alternative to hook-based reminders)\n\n#### Self-Improvement Workflow\n\nWhen errors or corrections occur:\n1. Log to `.learnings/ERRORS.md`, `LEARNINGS.md`, or `FEATURE_REQUESTS.md`\n2. Review and promote broadly applicable learnings to:\n   - `CLAUDE.md` - project facts and conventions\n   - `AGENTS.md` - workflows and automation\n   - `.github/copilot-instructions.md` - Copilot context\n\n## Logging Format\n\n### Learning Entry\n\nAppend to `.learnings/LEARNINGS.md`:\n\n```markdown\n## [LRN-YYYYMMDD-XXX] category\n\n**Logged**: ISO-8601 timestamp\n**Priority**: low | medium | high | critical\n**Status**: pending\n**Area**: frontend | backend | infra | tests | docs | config\n\n### Summary\nOne-line description of what was learned\n\n### Details\nFull context: what happened, what was wrong, what's correct\n\n### Suggested Action\nSpecific fix or improvement to make\n\n### Metadata\n- Source: conversation | error | user_feedback\n- Related Files: path/to/file.ext\n- Tags: tag1, tag2\n- See Also: LRN-20250110-001 (if related to existing entry)\n- Pattern-Key: simplify.dead_code | harden.input_validation (optional, for recurring-pattern tracking)\n- Recurrence-Count: 1 (optional)\n- First-Seen: 2025-01-15 (optional)\n- Last-Seen: 2025-01-15 (optional)\n\n---\n```\n\n### Error Entry\n\nAppend to `.learnings/ERRORS.md`:\n\n```markdown\n## [ERR-YYYYMMDD-XXX] skill_or_command_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: high\n**Status**: pending\n**Area**: frontend | backend | infra | tests | docs | config\n\n### Summary\nBrief description of what failed\n\n### Error\n```\nActual error message or output\n```\n\n### Context\n- Command/operation attempted\n- Input or parameters used\n- Environment details if relevant\n\n### Suggested Fix\nIf identifiable, what might resolve this\n\n### Metadata\n- Reproducible: yes | no | unknown\n- Related Files: path/to/file.ext\n- See Also: ERR-20250110-001 (if recurring)\n\n---\n```\n\n### Feature Request Entry\n\nAppend to `.learnings/FEATURE_REQUESTS.md`:\n\n```markdown\n## [FEAT-YYYYMMDD-XXX] capability_name\n\n**Logged**: ISO-8601 timestamp\n**Priority**: medium\n**Status**: pending\n**Area**: frontend | backend | infra | tests | docs | config\n\n### Requested Capability\nWhat the user wanted to do\n\n### User Context\nWhy they needed it, what problem they're solving\n\n### Complexity Estimate\nsimple | medium | complex\n\n### Suggested Implementation\nHow this could be built, what it might extend\n\n### Metadata\n- Frequency: first_time | recurring\n- Related Features: existing_feature_name\n\n---\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\nExamples: `LRN-20250115-001`, `ERR-20250115-A3F`, `FEAT-20250115-002`\n\n## Resolving Entries\n\nWhen an issue is fixed, update the entry:\n\n1. Change `**Status**: pending` → `**Status**: resolved`\n2. Add resolution block after Metadata:\n\n```markdown\n### Resolution\n- **Resolved**: 2025-01-16T09:00:00Z\n- **Commit/PR**: abc123 or #42\n- **Notes**: Brief description of what was done\n```\n\nOther status values:\n- `in_progress` - Actively being worked on\n- `wont_fix` - Decided not to address (add reason in Resolution notes)\n- `promoted` - Elevated to CLAUDE.md, AGENTS.md, or .github/copilot-instructions.md\n\n## Promoting to Project Memory\n\nWhen a learning is broadly applicable (not a one-off fix), promote it to permanent project memory.\n\n### When to Promote\n\n- Learning applies across multiple files/features\n- Knowledge any contributor (human or AI) should know\n- Prevents recurring mistakes\n- Documents project-specific conventions\n\n### Promotion Targets\n\n| Target | What Belongs There |\n|--------|-------------------|\n| `CLAUDE.md` | Project facts, conventions, gotchas for all Claude interactions |\n| `AGENTS.md` | Agent-specific workflows, tool usage patterns, automation rules |\n| `.github/copilot-instructions.md` | Project context and conventions for GitHub Copilot |\n| `SOUL.md` | Behavioral guidelines, communication style, principles (OpenClaw workspace) |\n| `TOOLS.md` | Tool capabilities, usage patterns, integration gotchas (OpenClaw workspace) |\n\n### How to Promote\n\n1. **Distill** the learning into a concise rule or fact\n2. **Add** to appropriate section in target file (create file if needed)\n3. **Update** original entry:\n   - Change `**Status**: pending` → `**Status**: promoted`\n   - Add `**Promoted**: CLAUDE.md`, `AGENTS.md`, or `.github/copilot-instructions.md`\n\n### Promotion Examples\n\n**Learning** (verbose):\n> Project uses pnpm workspaces. Attempted `npm install` but failed. \n> Lock file is `pnpm-lock.yaml`. Must use `pnpm install`.\n\n**In CLAUDE.md** (concise):\n```markdown\n## Build & Dependencies\n- Package manager: pnpm (not npm) - use `pnpm install`\n```\n\n**Learning** (verbose):\n> When modifying API endpoints, must regenerate TypeScript client.\n> Forgetting this causes type mismatches at runtime.\n\n**In AGENTS.md** (actionable):\n```markdown\n## After API Changes\n1. Regenerate client: `pnpm run generate:api`\n2. Check for type errors: `pnpm tsc --noEmit`\n```\n\n## Recurring Pattern Detection\n\nIf logging something similar to an existing entry:\n\n1. **Search first**: `grep -r \"keyword\" .learnings/`\n2. **Link entries**: Add `**See Also**: ERR-20250110-001` in Metadata\n3. **Bump priority** if issue keeps recurring\n4. **Consider systemic fix**: Recurring issues often indicate:\n   - Missing documentation (→ promote to CLAUDE.md or .github/copilot-instructions.md)\n   - Missing automation (→ add to AGENTS.md)\n   - Architectural problem (→ create tech debt ticket)\n\n## Simplify & Harden Feed\n\nUse this workflow to ingest recurring patterns from the `simplify-and-harden`\nskill and turn them into durable prompt guidance.\n\n### Ingestion Workflow\n\n1. Read `simplify_and_harden.learning_loop.candidates` from the task summary.\n2. For each candidate, use `pattern_key` as the stable dedupe key.\n3. Search `.learnings/LEARNINGS.md` for an existing entry with that key:\n   - `grep -n \"Pattern-Key: <pattern_key>\" .learnings/LEARNINGS.md`\n4. If found:\n   - Increment `Recurrence-Count`\n   - Update `Last-Seen`\n   - Add `See Also` links to related entries/tasks\n5. If not found:\n   - Create a new `LRN-...` entry\n   - Set `Source: simplify-and-harden`\n   - Set `Pattern-Key`, `Recurrence-Count: 1`, and `First-Seen`/`Last-Seen`\n\n### Promotion Rule (System Prompt Feedback)\n\nPromote recurring patterns into agent context/system prompt files when all are true:\n\n- `Recurrence-Count >= 3`\n- Seen across at least 2 distinct tasks\n- Occurred within a 30-day window\n\nPromotion targets:\n- `CLAUDE.md`\n- `AGENTS.md`\n- `.github/copilot-instructions.md`\n- `SOUL.md` / `TOOLS.md` for OpenClaw workspace-level guidance when applicable\n\nWrite promoted rules as short prevention rules (what to do before/while coding),\nnot long incident write-ups.\n\n## Periodic Review\n\nReview `.learnings/` at natural breakpoints:\n\n### When to Review\n- Before starting a new major task\n- After completing a feature\n- When working in an area with past learnings\n- Weekly during active development\n\n### Quick Status Check\n```bash\n# Count pending items\ngrep -h \"Status\\*\\*: pending\" .learnings/*.md | wc -l\n\n# List pending high-priority items\ngrep -B5 \"Priority\\*\\*: high\" .learnings/*.md | grep \"^## \\[\"\n\n# Find learnings for a specific area\ngrep -l \"Area\\*\\*: backend\" .learnings/*.md\n```\n\n### Review Actions\n- Resolve fixed items\n- Promote applicable learnings\n- Link related entries\n- Escalate recurring issues\n\n## Detection Triggers\n\nAutomatically log when you notice:\n\n**Corrections** (→ learning with `correction` category):\n- \"No, that's not right...\"\n- \"Actually, it should be...\"\n- \"You're wrong about...\"\n- \"That's outdated...\"\n\n**Feature Requests** (→ feature request):\n- \"Can you also...\"\n- \"I wish you could...\"\n- \"Is there a way to...\"\n- \"Why can't you...\"\n\n**Knowledge Gaps** (→ learning with `knowledge_gap` category):\n- User provides information you didn't know\n- Documentation you referenced is outdated\n- API behavior differs from your understanding\n\n**Errors** (→ error entry):\n- Command returns non-zero exit code\n- Exception or stack trace\n- Unexpected output or behavior\n- Timeout or connection failure\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, edge case, nice-to-have |\n\n## Area Tags\n\nUse to filter learnings by codebase region:\n\n| Area | Scope |\n|------|-------|\n| `frontend` | UI, components, client-side code |\n| `backend` | API, services, server-side code |\n| `infra` | CI/CD, deployment, Docker, cloud |\n| `tests` | Test files, testing utilities, coverage |\n| `docs` | Documentation, comments, READMEs |\n| `config` | Configuration files, environment, settings |\n\n## Best Practices\n\n1. **Log immediately** - context is freshest right after the issue\n2. **Be specific** - future agents need to understand quickly\n3. **Include reproduction steps** - especially for errors\n4. **Link related files** - makes fixes easier\n5. **Suggest concrete fixes** - not just \"investigate\"\n6. **Use consistent categories** - enables filtering\n7. **Promote aggressively** - if in doubt, add to CLAUDE.md or .github/copilot-instructions.md\n8. **Review regularly** - stale learnings lose value\n\n## Gitignore Options\n\n**Keep learnings local** (per-developer):\n```gitignore\n.learnings/\n```\n\n**Track learnings in repo** (team-wide):\nDon't add to .gitignore - learnings become shared knowledge.\n\n**Hybrid** (track templates, ignore entries):\n```gitignore\n.learnings/*.md\n!.learnings/.gitkeep\n```\n\n## Hook Integration\n\nEnable automatic reminders through agent hooks. This is **opt-in** - you must explicitly configure hooks.\n\n### Quick Setup (Claude Code / Codex)\n\nCreate `.claude/settings.json` in your project:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [{\n      \"matcher\": \"\",\n      \"hooks\": [{\n        \"type\": \"command\",\n        \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n      }]\n    }]\n  }\n}\n```\n\nThis injects a learning evaluation reminder after each prompt (~50-100 tokens overhead).\n\n### Full Setup (With Error Detection)\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [{\n      \"matcher\": \"\",\n      \"hooks\": [{\n        \"type\": \"command\",\n        \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n      }]\n    }],\n    \"PostToolUse\": [{\n      \"matcher\": \"Bash\",\n      \"hooks\": [{\n        \"type\": \"command\",\n        \"command\": \"./skills/self-improvement/scripts/error-detector.sh\"\n      }]\n    }]\n  }\n}\n```\n\n### Available Hook Scripts\n\n| Script | Hook Type | Purpose |\n|--------|-----------|---------|\n| `scripts/activator.sh` | UserPromptSubmit | Reminds to evaluate learnings after tasks |\n| `scripts/error-detector.sh` | PostToolUse (Bash) | Triggers on command errors |\n\nSee `references/hooks-setup.md` for detailed configuration and troubleshooting.\n\n## Automatic Skill Extraction\n\nWhen a learning is valuable enough to become a reusable skill, extract it using the provided helper.\n\n### Skill Extraction Criteria\n\nA learning qualifies for skill extraction when ANY of these apply:\n\n| Criterion | Description |\n|-----------|-------------|\n| **Recurring** | Has `See Also` links to 2+ similar issues |\n| **Verified** | Status is `resolved` with working fix |\n| **Non-obvious** | Required actual debugging/investigation to discover |\n| **Broadly applicable** | Not project-specific; useful across codebases |\n| **User-flagged** | User says \"save this as a skill\" or similar |\n\n### Extraction Workflow\n\n1. **Identify candidate**: Learning meets extraction criteria\n2. **Run helper** (or create manually):\n   ```bash\n   ./skills/self-improvement/scripts/extract-skill.sh skill-name --dry-run\n   ./skills/self-improvement/scripts/extract-skill.sh skill-name\n   ```\n3. **Customize SKILL.md**: Fill in template with learning content\n4. **Update learning**: Set status to `promoted_to_skill`, add `Skill-Path`\n5. **Verify**: Read skill in fresh session to ensure it's self-contained\n\n### Manual Extraction\n\nIf you prefer manual creation:\n\n1. Create `skills/<skill-name>/SKILL.md`\n2. Use template from `assets/SKILL-TEMPLATE.md`\n3. Follow [Agent Skills spec](https://agentskills.io/specification):\n   - YAML frontmatter with `name` and `description`\n   - Name must match folder name\n   - No README.md inside skill folder\n\n### Extraction Detection Triggers\n\nWatch for these signals that a learning should become a skill:\n\n**In conversation:**\n- \"Save this as a skill\"\n- \"I keep running into this\"\n- \"This would be useful for other projects\"\n- \"Remember this pattern\"\n\n**In learning entries:**\n- Multiple `See Also` links (recurring issue)\n- High priority + resolved status\n- Category: `best_practice` with broad applicability\n- User feedback praising the solution\n\n### Skill Quality Gates\n\nBefore extraction, verify:\n\n- [ ] Solution is tested and working\n- [ ] Description is clear without original context\n- [ ] Code examples are self-contained\n- [ ] No project-specific hardcoded values\n- [ ] Follows skill naming conventions (lowercase, hyphens)\n\n## Multi-Agent Support\n\nThis skill works across different AI coding agents with agent-specific activation.\n\n### Claude Code\n\n**Activation**: Hooks (UserPromptSubmit, PostToolUse)\n**Setup**: `.claude/settings.json` with hook configuration\n**Detection**: Automatic via hook scripts\n\n### Codex CLI\n\n**Activation**: Hooks (same pattern as Claude Code)\n**Setup**: `.codex/settings.json` with hook configuration\n**Detection**: Automatic via hook scripts\n\n### GitHub Copilot\n\n**Activation**: Manual (no hook support)\n**Setup**: Add to `.github/copilot-instructions.md`:\n\n```markdown\n## Self-Improvement\n\nAfter solving non-obvious issues, consider logging to `.learnings/`:\n1. Use format from self-improvement skill\n2. Link related entries with See Also\n3. Promote high-value learnings to skills\n\nAsk in chat: \"Should I log this as a learning?\"\n```\n\n**Detection**: Manual review at session end\n\n### OpenClaw\n\n**Activation**: Workspace injection + inter-agent messaging\n**Setup**: See \"OpenClaw Setup\" section above\n**Detection**: Via session tools and workspace files\n\n### Agent-Agnostic Guidance\n\nRegardless of agent, apply self-improvement when you:\n\n1. **Discover something non-obvious** - solution wasn't immediate\n2. **Correct yourself** - initial approach was wrong\n3. **Learn project conventions** - discovered undocumented patterns\n4. **Hit unexpected errors** - especially if diagnosis was difficult\n5. **Find better approaches** - improved on your original solution\n\n### Copilot Chat Integration\n\nFor Copilot users, add this to your prompts when relevant:\n\n> After completing this task, evaluate if any learnings should be logged to `.learnings/` using the self-improvement skill format.\n\nOr use quick prompts:\n- \"Log this to learnings\"\n- \"Create a skill from this solution\"\n- \"Check .learnings/ for related issues\"\n\nFile v1.0.10:_meta.json\n\n{\n  \"ownerId\": \"kn70cjr952qdec1nx70zs6wefn7ynq2t\",\n  \"slug\": \"self-improving-agent\",\n  \"version\": \"1.0.10\",\n  \"publishedAt\": 1771709665365\n}\n\nFile v1.0.10:references/examples.md\n\n# Entry Examples\n\nConcrete examples of well-formatted entries with all fields.\n\n## Learning: Correction\n\n```markdown\n## [LRN-20250115-001] correction\n\n**Logged**: 2025-01-15T10:30:00Z\n**Priority**: high\n**Status**: pending\n**Area**: tests\n\n### Summary\nIncorrectly assumed pytest fixtures are scoped to function by default\n\n### Details\nWhen writing test fixtures, I assumed all fixtures were function-scoped. \nUser corrected that while function scope is the default, the codebase \nconvention uses module-scoped fixtures for database connections to \nimprove test performance.\n\n### Suggested Action\nWhen creating fixtures that involve expensive setup (DB, network), \ncheck existing fixtures for scope patterns before defaulting to function scope.\n\n### Metadata\n- Source: user_feedback\n- Related Files: tests/conftest.py\n- Tags: pytest, testing, fixtures\n\n---\n```\n\n## Learning: Knowledge Gap (Resolved)\n\n```markdown\n## [LRN-20250115-002] knowledge_gap\n\n**Logged**: 2025-01-15T14:22:00Z\n**Priority**: medium\n**Status**: resolved\n**Area**: config\n\n### Summary\nProject uses pnpm not npm for package management\n\n### Details\nAttempted to run `npm install` but project uses pnpm workspaces.\nLock file is `pnpm-lock.yaml`, not `package-lock.json`.\n\n### Suggested Action\nCheck for `pnpm-lock.yaml` or `pnpm-workspace.yaml` before assuming npm.\nUse `pnpm install` for this project.\n\n### Metadata\n- Source: error\n- Related Files: pnpm-lock.yaml, pnpm-workspace.yaml\n- Tags: package-manager, pnpm, setup\n\n### Resolution\n- **Resolved**: 2025-01-15T14:30:00Z\n- **Commit/PR**: N/A - knowledge update\n- **Notes**: Added to CLAUDE.md for future reference\n\n---\n```\n\n## Learning: Promoted to CLAUDE.md\n\n```markdown\n## [LRN-20250115-003] best_practice\n\n**Logged**: 2025-01-15T16:00:00Z\n**Priority**: high\n**Status**: promoted\n**Promoted**: CLAUDE.md\n**Area**: backend\n\n### Summary\nAPI responses must include correlation ID from request headers\n\n### Details\nAll API responses should echo back the X-Correlation-ID header from \nthe request. This is required for distributed tracing. Responses \nwithout this header break the observability pipeline.\n\n### Suggested Action\nAlways include correlation ID passthrough in API handlers.\n\n### Metadata\n- Source: user_feedback\n- Related Files: src/middleware/correlation.ts\n- Tags: api, observability, tracing\n\n---\n```\n\n## Learning: Promoted to AGENTS.md\n\n```markdown\n## [LRN-20250116-001] best_practice\n\n**Logged**: 2025-01-16T09:00:00Z\n**Priority**: high\n**Status**: promoted\n**Promoted**: AGENTS.md\n**Area**: backend\n\n### Summary\nMust regenerate API client after OpenAPI spec changes\n\n### Details\nWhen modifying API endpoints, the TypeScript client must be regenerated.\nForgetting this causes type mismatches that only appear at runtime.\nThe generate script also runs validation.\n\n### Suggested Action\nAdd to agent workflow: after any API changes, run `pnpm run generate:api`.\n\n### Metadata\n- Source: error\n- Related Files: openapi.yaml, src/client/api.ts\n- Tags: api, codegen, typescript\n\n---\n```\n\n## Error Entry\n\n```markdown\n## [ERR-20250115-A3F] docker_build\n\n**Logged**: 2025-01-15T09:15:00Z\n**Priority**: high\n**Status**: pending\n**Area**: infra\n\n### Summary\nDocker build fails on M1 Mac due to platform mismatch\n\n### Error\n```\nerror: failed to solve: python:3.11-slim: no match for platform linux/arm64\n```\n\n### Context\n- Command: `docker build -t myapp .`\n- Dockerfile uses `FROM python:3.11-slim`\n- Running on Apple Silicon (M1/M2)\n\n### Suggested Fix\nAdd platform flag: `docker build --platform linux/amd64 -t myapp .`\nOr update Dockerfile: `FROM --platform=linux/amd64 python:3.11-slim`\n\n### Metadata\n- Reproducible: yes\n- Related Files: Dockerfile\n\n---\n```\n\n## Error Entry: Recurring Issue\n\n```markdown\n## [ERR-20250120-B2C] api_timeout\n\n**Logged**: 2025-01-20T11:30:00Z\n**Priority**: critical\n**Status**: pending\n**Area**: backend\n\n### Summary\nThird-party payment API timeout during checkout\n\n### Error\n```\nTimeoutError: Request to payments.example.com timed out after 30000ms\n```\n\n### Context\n- Command: POST /api/checkout\n- Timeout set to 30s\n- Occurs during peak hours (lunch, evening)\n\n### Suggested Fix\nImplement retry with exponential backoff. Consider circuit breaker pattern.\n\n### Metadata\n- Reproducible: yes (during peak hours)\n- Related Files: src/services/payment.ts\n- See Also: ERR-20250115-X1Y, ERR-20250118-Z3W\n\n---\n```\n\n## Feature Request\n\n```markdown\n## [FEAT-20250115-001] export_to_csv\n\n**Logged**: 2025-01-15T16:45:00Z\n**Priority**: medium\n**Status**: pending\n**Area**: backend\n\n### Requested Capability\nExport analysis results to CSV format\n\n### User Context\nUser runs weekly reports and needs to share results with non-technical \nstakeholders in Excel. Currently copies output manually.\n\n### Complexity Estimate\nsimple\n\n### Suggested Implementation\nAdd `--output csv` flag to the analyze command. Use standard csv module.\nCould extend existing `--output json` pattern.\n\n### Metadata\n- Frequency: recurring\n- Related Features: analyze command, json output\n\n---\n```\n\n## Feature Request: Resolved\n\n```markdown\n## [FEAT-20250110-002] dark_mode\n\n**Logged**: 2025-01-10T14:00:00Z\n**Priority**: low\n**Status**: resolved\n**Area**: frontend\n\n### Requested Capability\nDark mode support for the dashboard\n\n### User Context\nUser works late hours and finds the bright interface straining.\nSeveral other users have mentioned this informally.\n\n### Complexity Estimate\nmedium\n\n### Suggested Implementation\nUse CSS variables for colors. Add toggle in user settings.\nConsider system preference detection.\n\n### Metadata\n- Frequency: recurring\n- Related Features: user settings, theme system\n\n### Resolution\n- **Resolved**: 2025-01-18T16:00:00Z\n- **Commit/PR**: #142\n- **Notes**: Implemented with system preference detection and manual toggle\n\n---\n```\n\n## Learning: Promoted to Skill\n\n```markdown\n## [LRN-20250118-001] best_practice\n\n**Logged**: 2025-01-18T11:00:00Z\n**Priority**: high\n**Status**: promoted_to_skill\n**Skill-Path**: skills/docker-m1-fixes\n**Area**: infra\n\n### Summary\nDocker build fails on Apple Silicon due to platform mismatch\n\n### Details\nWhen building Docker images on M1/M2 Macs, the build fails because\nthe base image doesn't have an ARM64 variant. This is a common issue\nthat affects many developers.\n\n### Suggested Action\nAdd `--platform linux/amd64` to docker build command, or use\n`FROM --platform=linux/amd64` in Dockerfile.\n\n### Metadata\n- Source: error\n- Related Files: Dockerfile\n- Tags: docker, arm64, m1, apple-silicon\n- See Also: ERR-20250115-A3F, ERR-20250117-B2D\n\n---\n```\n\n## Extracted Skill Example\n\nWhen the above learning is extracted as a skill, it becomes:\n\n**File**: `skills/docker-m1-fixes/SKILL.md`\n\n```markdown\n---\nname: docker-m1-fixes\ndescription: \"Fixes Docker build failures on Apple Silicon (M1/M2). Use when docker build fails with platform mismatch errors.\"\n---\n\n# Docker M1 Fixes\n\nSolutions for Docker build issues on Apple Silicon Macs.\n\n## Quick Reference\n\n| Error | Fix |\n|-------|-----|\n| `no match for platform linux/arm64` | Add `--platform linux/amd64` to build |\n| Image runs but crashes | Use emulation or find ARM-compatible base |\n\n## The Problem\n\nMany Docker base images don't have ARM64 variants. When building on\nApple Silicon (M1/M2/M3), Docker attempts to pull ARM64 images by\ndefault, causing platform mismatch errors.\n\n## Solutions\n\n### Option 1: Build Flag (Recommended)\n\nAdd platform flag to your build command:\n\n\\`\\`\\`bash\ndocker build --platform linux/amd64 -t myapp .\n\\`\\`\\`\n\n### Option 2: Dockerfile Modification\n\nSpecify platform in the FROM instruction:\n\n\\`\\`\\`dockerfile\nFROM --platform=linux/amd64 python:3.11-slim\n\\`\\`\\`\n\n### Option 3: Docker Compose\n\nAdd platform to your service:\n\n\\`\\`\\`yaml\nservices:\n  app:\n    platform: linux/amd64\n    build: .\n\\`\\`\\`\n\n## Trade-offs\n\n| Approach | Pros | Cons |\n|----------|------|------|\n| Build flag | No file changes | Must remember flag |\n| Dockerfile | Explicit, versioned | Affects all builds |\n| Compose | Convenient for dev | Requires compose |\n\n## Performance Note\n\nRunning AMD64 images on ARM64 uses Rosetta 2 emulation. This works\nfor development but may be slower. For production, find ARM-native\nalternatives when possible.\n\n## Source\n\n- Learning ID: LRN-20250118-001\n- Category: best_practice\n- Extraction Date: 2025-01-18\n```\n\nFile v1.0.10:references/hooks-setup.md\n\n# Hook Setup Guide\n\nConfigure automatic self-improvement triggers for AI coding agents.\n\n## Overview\n\nHooks enable proactive learning capture by injecting reminders at key moments:\n- **UserPromptSubmit**: Reminder after each prompt to evaluate learnings\n- **PostToolUse (Bash)**: Error detection when commands fail\n\n## Claude Code Setup\n\n### Option 1: Project-Level Configuration\n\nCreate `.claude/settings.json` in your project root:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ],\n    \"PostToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/error-detector.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n### Option 2: User-Level Configuration\n\nAdd to `~/.claude/settings.json` for global activation:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"~/.claude/skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n### Minimal Setup (Activator Only)\n\nFor lower overhead, use only the UserPromptSubmit hook:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n## Codex CLI Setup\n\nCodex uses the same hook system as Claude Code. Create `.codex/settings.json`:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n## GitHub Copilot Setup\n\nCopilot doesn't support hooks directly. Instead, add guidance to `.github/copilot-instructions.md`:\n\n```markdown\n## Self-Improvement\n\nAfter completing tasks that involved:\n- Debugging non-obvious issues\n- Discovering workarounds\n- Learning project-specific patterns\n- Resolving unexpected errors\n\nConsider logging the learning to `.learnings/` using the format from the self-improvement skill.\n\nFor high-value learnings that would benefit other sessions, consider skill extraction.\n```\n\n## Verification\n\n### Test Activator Hook\n\n1. Enable the hook configuration\n2. Start a new Claude Code session\n3. Send any prompt\n4. Verify you see `<self-improvement-reminder>` in the context\n\n### Test Error Detector Hook\n\n1. Enable PostToolUse hook for Bash\n2. Run a command that fails: `ls /nonexistent/path`\n3. Verify you see `<error-detected>` reminder\n\n### Dry Run Extract Script\n\n```bash\n./skills/self-improvement/scripts/extract-skill.sh test-skill --dry-run\n```\n\nExpected output shows the skill scaffold that would be created.\n\n## Troubleshooting\n\n### Hook Not Triggering\n\n1. **Check script permissions**: `chmod +x scripts/*.sh`\n2. **Verify path**: Use absolute paths or paths relative to project root\n3. **Check settings location**: Project vs user-level settings\n4. **Restart session**: Hooks are loaded at session start\n\n### Permission Denied\n\n```bash\nchmod +x ./skills/self-improvement/scripts/activator.sh\nchmod +x ./skills/self-improvement/scripts/error-detector.sh\nchmod +x ./skills/self-improvement/scripts/extract-skill.sh\n```\n\n### Script Not Found\n\nIf using relative paths, ensure you're in the correct directory or use absolute paths:\n\n```json\n{\n  \"command\": \"/absolute/path/to/skills/self-improvement/scripts/activator.sh\"\n}\n```\n\n### Too Much Overhead\n\nIf the activator feels intrusive:\n\n1. **Use minimal setup**: Only UserPromptSubmit, skip PostToolUse\n2. **Add matcher filter**: Only trigger for certain prompts:\n\n```json\n{\n  \"matcher\": \"fix|debug|error|issue\",\n  \"hooks\": [...]\n}\n```\n\n## Hook Output Budget\n\nThe activator is designed to be lightweight:\n- **Target**: ~50-100 tokens per activation\n- **Content**: Structured reminder, not verbose instructions\n- **Format**: XML tags for easy parsing\n\nIf you need to reduce overhead further, you can edit `activator.sh` to output less text.\n\n## Security Considerations\n\n- Hook scripts run with the same permissions as Claude Code\n- Scripts only output text; they don't modify files or run commands\n- Error detector reads `CLAUDE_TOOL_OUTPUT` environment variable\n- All scripts are opt-in (you must configure them explicitly)\n\n## Disabling Hooks\n\nTo temporarily disable without removing configuration:\n\n1. **Comment out in settings**:\n```json\n{\n  \"hooks\": {\n    // \"UserPromptSubmit\": [...]\n  }\n}\n```\n\n2. **Or delete the settings file**: Hooks won't run without configuration\n\nFile v1.0.10:references/openclaw-integration.md\n\n# OpenClaw Integration\n\nComplete setup and usage guide for integrating the self-improvement skill with OpenClaw.\n\n## Overview\n\nOpenClaw uses workspace-based prompt injection combined with event-driven hooks. Context is injected from workspace files at session start, and hooks can trigger on lifecycle events.\n\n## Workspace Structure\n\n```\n~/.openclaw/                      \n├── workspace/                   # Working directory\n│   ├── AGENTS.md               # Multi-agent coordination patterns\n│   ├── SOUL.md                 # Behavioral guidelines and personality\n│   ├── TOOLS.md                # Tool capabilities and gotchas\n│   ├── MEMORY.md               # Long-term memory (main session only)\n│   └── memory/                 # Daily memory files\n│       └── YYYY-MM-DD.md\n├── skills/                      # Installed skills\n│   └── <skill-name>/\n│       └── SKILL.md\n└── hooks/                       # Custom hooks\n    └── <hook-name>/\n        ├── HOOK.md\n        └── handler.ts\n```\n\n## Quick Setup\n\n### 1. Install the Skill\n\n```bash\nclawdhub install self-improving-agent\n```\n\nOr copy manually:\n\n```bash\ncp -r self-improving-agent ~/.openclaw/skills/\n```\n\n### 2. Install the Hook (Optional)\n\nCopy the hook to OpenClaw's hooks directory:\n\n```bash\ncp -r hooks/openclaw ~/.openclaw/hooks/self-improvement\n```\n\nEnable the hook:\n\n```bash\nopenclaw hooks enable self-improvement\n```\n\n### 3. Create Learning Files\n\nCreate the `.learnings/` directory in your workspace:\n\n```bash\nmkdir -p ~/.openclaw/workspace/.learnings\n```\n\nOr in the skill directory:\n\n```bash\nmkdir -p ~/.openclaw/skills/self-improving-agent/.learnings\n```\n\n## Injected Prompt Files\n\n### AGENTS.md\n\nPurpose: Multi-agent workflows and delegation patterns.\n\n```markdown\n# Agent Coordination\n\n## Delegation Rules\n- Use explore agent for open-ended codebase questions\n- Spawn sub-agents for long-running tasks\n- Use sessions_send for cross-session communication\n\n## Session Handoff\nWhen delegating to another session:\n1. Provide full context in the handoff message\n2. Include relevant file paths\n3. Specify expected output format\n```\n\n### SOUL.md\n\nPurpose: Behavioral guidelines and communication style.\n\n```markdown\n# Behavioral Guidelines\n\n## Communication Style\n- Be direct and concise\n- Avoid unnecessary caveats and disclaimers\n- Use technical language appropriate to context\n\n## Error Handling\n- Admit mistakes promptly\n- Provide corrected information immediately\n- Log significant errors to learnings\n```\n\n### TOOLS.md\n\nPurpose: Tool capabilities, integration gotchas, local configuration.\n\n```markdown\n# Tool Knowledge\n\n## Self-Improvement Skill\nLog learnings to `.learnings/` for continuous improvement.\n\n## Local Tools\n- Document tool-specific gotchas here\n- Note authentication requirements\n- Track integration quirks\n```\n\n## Learning Workflow\n\n### Capturing Learnings\n\n1. **In-session**: Log to `.learnings/` as usual\n2. **Cross-session**: Promote to workspace files\n\n### Promotion Decision Tree\n\n```\nIs the learning project-specific?\n├── Yes → Keep in .learnings/\n└── No → Is it behavioral/style-related?\n    ├── Yes → Promote to SOUL.md\n    └── No → Is it tool-related?\n        ├── Yes → Promote to TOOLS.md\n        └── No → Promote to AGENTS.md (workflow)\n```\n\n### Promotion Format Examples\n\n**From learning:**\n> Git push to GitHub fails without auth configured - triggers desktop prompt\n\n**To TOOLS.md:**\n```markdown\n## Git\n- Don't push without confirming auth is configured\n- Use `gh auth status` to check GitHub CLI auth\n```\n\n## Inter-Agent Communication\n\nOpenClaw provides tools for cross-session communication:\n\n### sessions_list\n\nView active and recent sessions:\n```\nsessions_list(activeMinutes=30, messageLimit=3)\n```\n\n### sessions_history\n\nRead transcript from another session:\n```\nsessions_history(sessionKey=\"session-id\", limit=50)\n```\n\n### sessions_send\n\nSend message to another session:\n```\nsessions_send(sessionKey=\"session-id\", message=\"Learning: API requires X-Custom-Header\")\n```\n\n### sessions_spawn\n\nSpawn a background sub-agent:\n```\nsessions_spawn(task=\"Research X and report back\", label=\"research\")\n```\n\n## Available Hook Events\n\n| Event | When It Fires |\n|-------|---------------|\n| `agent:bootstrap` | Before workspace files inject |\n| `command:new` | When `/new` command issued |\n| `command:reset` | When `/reset` command issued |\n| `command:stop` | When `/stop` command issued |\n| `gateway:startup` | When gateway starts |\n\n## Detection Triggers\n\n### Standard Triggers\n- User corrections (\"No, that's wrong...\")\n- Command failures (non-zero exit codes)\n- API errors\n- Knowledge gaps\n\n### OpenClaw-Specific Triggers\n\n| Trigger | Action |\n|---------|--------|\n| Tool call error | Log to TOOLS.md with tool name |\n| Session handoff confusion | Log to AGENTS.md with delegation pattern |\n| Model behavior surprise | Log to SOUL.md with expected vs actual |\n| Skill issue | Log to .learnings/ or report upstream |\n\n## Verification\n\nCheck hook is registered:\n\n```bash\nopenclaw hooks list\n```\n\nCheck skill is loaded:\n\n```bash\nopenclaw status\n```\n\n## Troubleshooting\n\n### Hook not firing\n\n1. Ensure hooks enabled in config\n2. Restart gateway after config changes\n3. Check gateway logs for errors\n\n### Learnings not persisting\n\n1. Verify `.learnings/` directory exists\n2. Check file permissions\n3. Ensure workspace path is configured correctly\n\n### Skill not loading\n\n1. Check skill is in skills directory\n2. Verify SKILL.md has correct frontmatter\n3. Run `openclaw status` to see loaded skills\n\nFile v1.0.10:.learnings/ERRORS.md\n\n# Errors Log\n\nCommand failures, exceptions, and unexpected behaviors.\n\n---\n\nFile v1.0.10:.learnings/FEATURE_REQUESTS.md\n\n# Feature Requests\n\nCapabilities requested by user that don't currently exist.\n\n---\n\nFile v1.0.10:.learnings/LEARNINGS.md\n\n# Learnings Log\n\nCaptured learnings, corrections, and discoveries. Review before major tasks.\n\n---\n\nFile v1.0.10:assets/LEARNINGS.md\n\n# Learnings\n\nCorrections, insights, and knowledge gaps captured during development.\n\n**Categories**: correction | insight | knowledge_gap | best_practice\n**Areas**: frontend | backend | infra | tests | docs | config\n**Statuses**: pending | in_progress | resolved | wont_fix | promoted | promoted_to_skill\n\n## Status Definitions\n\n| Status | Meaning |\n|--------|---------|\n| `pending` | Not yet addressed |\n| `in_progress` | Actively being worked on |\n| `resolved` | Issue fixed or knowledge integrated |\n| `wont_fix` | Decided not to address (reason in Resolution) |\n| `promoted` | Elevated to CLAUDE.md, AGENTS.md, or copilot-instructions.md |\n| `promoted_to_skill` | Extracted as a reusable skill |\n\n## Skill Extraction Fields\n\nWhen a learning is promoted to a skill, add these fields:\n\n```markdown\n**Status**: promoted_to_skill\n**Skill-Path**: skills/skill-name\n```\n\nExample:\n```markdown\n## [LRN-20250115-001] best_practice\n\n**Logged**: 2025-01-15T10:00:00Z\n**Priority**: high\n**Status**: promoted_to_skill\n**Skill-Path**: skills/docker-m1-fixes\n**Area**: infra\n\n### Summary\nDocker build fails on Apple Silicon due to platform mismatch\n...\n```\n\n---\n\nFile v1.0.10:assets/SKILL-TEMPLATE.md\n\n# Skill Template\n\nTemplate for creating skills extracted from learnings. Copy and customize.\n\n---\n\n## SKILL.md Template\n\n```markdown\n---\nname: skill-name-here\ndescription: \"Concise description of when and why to use this skill. Include trigger conditions.\"\n---\n\n# Skill Name\n\nBrief introduction explaining the problem this skill solves and its origin.\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| [Trigger 1] | [Action 1] |\n| [Trigger 2] | [Action 2] |\n\n## Background\n\nWhy this knowledge matters. What problems it prevents. Context from the original learning.\n\n## Solution\n\n### Step-by-Step\n\n1. First step with code or command\n2. Second step\n3. Verification step\n\n### Code Example\n\n\\`\\`\\`language\n// Example code demonstrating the solution\n\\`\\`\\`\n\n## Common Variations\n\n- **Variation A**: Description and how to handle\n- **Variation B**: Description and how to handle\n\n## Gotchas\n\n- Warning or common mistake #1\n- Warning or common mistake #2\n\n## Related\n\n- Link to related documentation\n- Link to related skill\n\n## Source\n\nExtracted from learning entry.\n- **Learning ID**: LRN-YYYYMMDD-XXX\n- **Original Category**: correction | insight | knowledge_gap | best_practice\n- **Extraction Date**: YYYY-MM-DD\n```\n\n---\n\n## Minimal Template\n\nFor simple skills that don't need all sections:\n\n```markdown\n---\nname: skill-name-here\ndescription: \"What this skill does and when to use it.\"\n---\n\n# Skill Name\n\n[Problem statement in one sentence]\n\n## Solution\n\n[Direct solution with code/commands]\n\n## Source\n\n- Learning ID: LRN-YYYYMMDD-XXX\n```\n\n---\n\n## Template with Scripts\n\nFor skills that include executable helpers:\n\n```markdown\n---\nname: skill-name-here\ndescription: \"What this skill does and when to use it.\"\n---\n\n# Skill Name\n\n[Introduction]\n\n## Quick Reference\n\n| Command | Purpose |\n|---------|---------|\n| `./scripts/helper.sh` | [What it does] |\n| `./scripts/validate.sh` | [What it does] |\n\n## Usage\n\n### Automated (Recommended)\n\n\\`\\`\\`bash\n./skills/skill-name/scripts/helper.sh [args]\n\\`\\`\\`\n\n### Manual Steps\n\n1. Step one\n2. Step two\n\n## Scripts\n\n| Script | Description |\n|--------|-------------|\n| `scripts/helper.sh` | Main utility |\n| `scripts/validate.sh` | Validation checker |\n\n## Source\n\n- Learning ID: LRN-YYYYMMDD-XXX\n```\n\n---\n\n## Naming Conventions\n\n- **Skill name**: lowercase, hyphens for spaces\n  - Good: `docker-m1-fixes`, `api-timeout-patterns`\n  - Bad: `Docker_M1_Fixes`, `APITimeoutPatterns`\n\n- **Description**: Start with action verb, mention trigger\n  - Good: \"Handles Docker build failures on Apple Silicon. Use when builds fail with platform mismatch.\"\n  - Bad: \"Docker stuff\"\n\n- **Files**:\n  - `SKILL.md` - Required, main documentation\n  - `scripts/` - Optional, executable code\n  - `references/` - Optional, detailed docs\n  - `assets/` - Optional, templates\n\n---\n\n## Extraction Checklist\n\nBefore creating a skill from a learning:\n\n- [ ] Learning is verified (status: resolved)\n- [ ] Solution is broadly applicable (not one-off)\n- [ ] Content is complete (has all needed context)\n- [ ] Name follows conventions\n- [ ] Description is concise but informative\n- [ ] Quick Reference table is actionable\n- [ ] Code examples are tested\n- [ ] Source learning ID is recorded\n\nAfter creating:\n\n- [ ] Update original learning with `promoted_to_skill` status\n- [ ] Add `Skill-Path: skills/skill-name` to learning metadata\n- [ ] Test skill by reading it in a fresh session\n\nFile v1.0.10:hooks/openclaw/HOOK.md\n\n---\nname: self-improvement\ndescription: \"Injects self-improvement reminder during agent bootstrap\"\nmetadata: {\"openclaw\":{\"emoji\":\"🧠\",\"events\":[\"agent:bootstrap\"]}}\n---\n\n# Self-Improvement Hook\n\nInjects a reminder to evaluate learnings during agent bootstrap.\n\n## What It Does\n\n- Fires on `agent:bootstrap` (before workspace files are injected)\n- Adds a reminder block to check `.learnings/` for relevant entries\n- Prompts the agent to log corrections, errors, and discoveries\n\n## Configuration\n\nNo configuration needed. Enable with:\n\n```bash\nopenclaw hooks enable self-improvement\n```","readmeExcerpt":"Skill: self-improving-agent Owner: pskoett Summary: Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau... Tags: latest:1.0.11 Version history: v1.0.11 | 2026-02-22T16:28:33.337Z | user No functional or content changes; OpenClaw-specific environment metadata was removed. - Removed the OpenClaw requires.env metada","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"clawdhub install self-improving-agent"},{"language":"bash","snippet":"git clone https://github.com/peterskoett/self-improving-agent.git ~/.openclaw/skills/self-improving-agent"},{"language":"text","snippet":"~/.openclaw/workspace/\n├── AGENTS.md          # Multi-agent workflows, delegation patterns\n├── SOUL.md            # Behavioral guidelines, personality, principles\n├── TOOLS.md           # Tool capabilities, integration gotchas\n├── MEMORY.md          # Long-term memory (main session only)\n├── memory/            # Daily memory files\n│   └── YYYY-MM-DD.md\n└── .learnings/        # This skill's log files\n    ├── LEARNINGS.md\n    ├── ERRORS.md\n    └── FEATURE_REQUESTS.md"},{"language":"bash","snippet":"mkdir -p ~/.openclaw/workspace/.learnings"},{"language":"bash","snippet":"# Copy hook to OpenClaw hooks directory\ncp -r hooks/openclaw ~/.openclaw/hooks/self-improvement\n\n# Enable it\nopenclaw hooks enable self-improvement"},{"language":"bash","snippet":"mkdir -p .learnings"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: self-improvement\ndescription: \"Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Claude ('No, that's wrong...', 'Actually...'), (3) User requests a capability that doesn't exist, (4) An external API or tool fails, (5) Claude realizes its knowledge is outdated or incorrect, (6) A better approach is discovered for a recurring task. Also review learnings before major tasks.\"\nmetadata:\n---\n\n# Self-Improvement Skill\n\nLog learnings and errors to markdown files for continuous improvement. Coding agents can later process these into fixes, and important learnings get promoted to project memory.\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| Command/operation fails | Log to `.learnings/ERRORS.md` |\n| User corrects you | Log to `.learnings/LEARNINGS.md` with category `correction` |\n| User wants missing feature | Log to `.learnings/FEATURE_REQUESTS.md` |\n| API/external tool fails | Log to `.learnings/ERRORS.md` with integration details |\n| Knowledge was outdated | Log to `.learnings/LEARNINGS.md` with category `knowledge_gap` |\n| Found better approach | Log to `.learnings/LEARNINGS.md` with category `best_practice` |\n| Simplify/Harden recurring patterns | Log/update `.learnings/LEARNINGS.md` with `Source: simplify-and-harden` and a stable `Pattern-Key` |\n| Similar to existing entry | Link with `**See Also**`, consider priority bump |\n| Broadly applicable learning | Promote to `CLAUDE.md`, `AGENTS.md`, and/or `.github/copilot-instructions.md` |\n| Workflow improvements | Promote to `AGENTS.md` (OpenClaw workspace) |\n| Tool gotchas | Promote to `TOOLS.md` (OpenClaw workspace) |\n| Behavioral patterns | Promote to `SOUL.md` (OpenClaw workspace) |\n\n## OpenClaw Setup (Recommended)\n\nOpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automatic skill loading.\n\n### Installation\n\n**Via ClawdHub (recommended):**\n```bash\nclawdhub install self-improving-agent\n```\n\n**Manual:**\n```bash\ngit clone https://github.com/peterskoett/self-improving-agent.git ~/.openclaw/skills/self-improving-agent\n```\n\nRemade for openclaw from original repo : https://github.com/pskoett/pskoett-ai-skills - https://github.com/pskoett/pskoett-ai-skills/tree/main/skills/self-improvement\n\n### Workspace Structure\n\nOpenClaw injects these files into every session:\n\n```\n~/.openclaw/workspace/\n├── AGENTS.md          # Multi-agent workflows, delegation patterns\n├── SOUL.md            # Behavioral guidelines, personality, principles\n├── TOOLS.md           # Tool capabilities, integration gotchas\n├── MEMORY.md          # Long-term memory (main session only)\n├── memory/            # Daily memory files\n│   └── YYYY-MM-DD.md\n└── .learnings/        # This skill's log files\n    ├── LEARNINGS.md\n    ├── ERRORS.md\n    └── FEATURE_REQUESTS.md\n```\n\n### Create Learning Files\n\n```bash\nmkdir -p ~/.openclaw/workspace/.learnings\n```\n\nThen create the "},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn70cjr952qdec1nx70zs6wefn7ynq2t\",\n  \"slug\": \"self-improving-agent\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1771777713337\n}"},{"path":"references/examples.md","content":"# Entry Examples\n\nConcrete examples of well-formatted entries with all fields.\n\n## Learning: Correction\n\n```markdown\n## [LRN-20250115-001] correction\n\n**Logged**: 2025-01-15T10:30:00Z\n**Priority**: high\n**Status**: pending\n**Area**: tests\n\n### Summary\nIncorrectly assumed pytest fixtures are scoped to function by default\n\n### Details\nWhen writing test fixtures, I assumed all fixtures were function-scoped. \nUser corrected that while function scope is the default, the codebase \nconvention uses module-scoped fixtures for database connections to \nimprove test performance.\n\n### Suggested Action\nWhen creating fixtures that involve expensive setup (DB, network), \ncheck existing fixtures for scope patterns before defaulting to function scope.\n\n### Metadata\n- Source: user_feedback\n- Related Files: tests/conftest.py\n- Tags: pytest, testing, fixtures\n\n---\n```\n\n## Learning: Knowledge Gap (Resolved)\n\n```markdown\n## [LRN-20250115-002] knowledge_gap\n\n**Logged**: 2025-01-15T14:22:00Z\n**Priority**: medium\n**Status**: resolved\n**Area**: config\n\n### Summary\nProject uses pnpm not npm for package management\n\n### Details\nAttempted to run `npm install` but project uses pnpm workspaces.\nLock file is `pnpm-lock.yaml`, not `package-lock.json`.\n\n### Suggested Action\nCheck for `pnpm-lock.yaml` or `pnpm-workspace.yaml` before assuming npm.\nUse `pnpm install` for this project.\n\n### Metadata\n- Source: error\n- Related Files: pnpm-lock.yaml, pnpm-workspace.yaml\n- Tags: package-manager, pnpm, setup\n\n### Resolution\n- **Resolved**: 2025-01-15T14:30:00Z\n- **Commit/PR**: N/A - knowledge update\n- **Notes**: Added to CLAUDE.md for future reference\n\n---\n```\n\n## Learning: Promoted to CLAUDE.md\n\n```markdown\n## [LRN-20250115-003] best_practice\n\n**Logged**: 2025-01-15T16:00:00Z\n**Priority**: high\n**Status**: promoted\n**Promoted**: CLAUDE.md\n**Area**: backend\n\n### Summary\nAPI responses must include correlation ID from request headers\n\n### Details\nAll API responses should echo back the X-Correlation-ID header from \nthe request. This is required for distributed tracing. Responses \nwithout this header break the observability pipeline.\n\n### Suggested Action\nAlways include correlation ID passthrough in API handlers.\n\n### Metadata\n- Source: user_feedback\n- Related Files: src/middleware/correlation.ts\n- Tags: api, observability, tracing\n\n---\n```\n\n## Learning: Promoted to AGENTS.md\n\n```markdown\n## [LRN-20250116-001] best_practice\n\n**Logged**: 2025-01-16T09:00:00Z\n**Priority**: high\n**Status**: promoted\n**Promoted**: AGENTS.md\n**Area**: backend\n\n### Summary\nMust regenerate API client after OpenAPI spec changes\n\n### Details\nWhen modifying API endpoints, the TypeScript client must be regenerated.\nForgetting this causes type mismatches that only appear at runtime.\nThe generate script also runs validation.\n\n### Suggested Action\nAdd to agent workflow: after any API changes, run `pnpm run generate:api`.\n\n### Metadata\n- Source: error\n- Related Files: openapi.yaml, src/client/api.ts\n- Tags: api, codegen, type"},{"path":"references/hooks-setup.md","content":"# Hook Setup Guide\n\nConfigure automatic self-improvement triggers for AI coding agents.\n\n## Overview\n\nHooks enable proactive learning capture by injecting reminders at key moments:\n- **UserPromptSubmit**: Reminder after each prompt to evaluate learnings\n- **PostToolUse (Bash)**: Error detection when commands fail\n\n## Claude Code Setup\n\n### Option 1: Project-Level Configuration\n\nCreate `.claude/settings.json` in your project root:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ],\n    \"PostToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/error-detector.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n### Option 2: User-Level Configuration\n\nAdd to `~/.claude/settings.json` for global activation:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"~/.claude/skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n### Minimal Setup (Activator Only)\n\nFor lower overhead, use only the UserPromptSubmit hook:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n## Codex CLI Setup\n\nCodex uses the same hook system as Claude Code. Create `.codex/settings.json`:\n\n```json\n{\n  \"hooks\": {\n    \"UserPromptSubmit\": [\n      {\n        \"matcher\": \"\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"./skills/self-improvement/scripts/activator.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n## GitHub Copilot Setup\n\nCopilot doesn't support hooks directly. Instead, add guidance to `.github/copilot-instructions.md`:\n\n```markdown\n## Self-Improvement\n\nAfter completing tasks that involved:\n- Debugging non-obvious issues\n- Discovering workarounds\n- Learning project-specific patterns\n- Resolving unexpected errors\n\nConsider logging the learning to `.learnings/` using the format from the self-improvement skill.\n\nFor high-value learnings that would benefit other sessions, consider skill extraction.\n```\n\n## Verification\n\n### Test Activator Hook\n\n1. Enable the hook configuration\n2. Start a new Claude Code session\n3. Send any prompt\n4. Verify you see `<self-improvement-reminder>` in the context\n\n### Test Error Detector Hook\n\n1. Enable PostToolUse hook for Bash\n2. Run a command that fails: `ls /nonexistent/path`\n3. Verify you see `<error-detected>` reminder\n\n### Dry Run Extract Script\n\n```bash\n./skills/self-improvement/scripts/extract-skill.sh test-skill --dry-run\n```\n\nExpected"},{"path":"references/openclaw-integration.md","content":"# OpenClaw Integration\n\nComplete setup and usage guide for integrating the self-improvement skill with OpenClaw.\n\n## Overview\n\nOpenClaw uses workspace-based prompt injection combined with event-driven hooks. Context is injected from workspace files at session start, and hooks can trigger on lifecycle events.\n\n## Workspace Structure\n\n```\n~/.openclaw/                      \n├── workspace/                   # Working directory\n│   ├── AGENTS.md               # Multi-agent coordination patterns\n│   ├── SOUL.md                 # Behavioral guidelines and personality\n│   ├── TOOLS.md                # Tool capabilities and gotchas\n│   ├── MEMORY.md               # Long-term memory (main session only)\n│   └── memory/                 # Daily memory files\n│       └── YYYY-MM-DD.md\n├── skills/                      # Installed skills\n│   └── <skill-name>/\n│       └── SKILL.md\n└── hooks/                       # Custom hooks\n    └── <hook-name>/\n        ├── HOOK.md\n        └── handler.ts\n```\n\n## Quick Setup\n\n### 1. Install the Skill\n\n```bash\nclawdhub install self-improving-agent\n```\n\nOr copy manually:\n\n```bash\ncp -r self-improving-agent ~/.openclaw/skills/\n```\n\n### 2. Install the Hook (Optional)\n\nCopy the hook to OpenClaw's hooks directory:\n\n```bash\ncp -r hooks/openclaw ~/.openclaw/hooks/self-improvement\n```\n\nEnable the hook:\n\n```bash\nopenclaw hooks enable self-improvement\n```\n\n### 3. Create Learning Files\n\nCreate the `.learnings/` directory in your workspace:\n\n```bash\nmkdir -p ~/.openclaw/workspace/.learnings\n```\n\nOr in the skill directory:\n\n```bash\nmkdir -p ~/.openclaw/skills/self-improving-agent/.learnings\n```\n\n## Injected Prompt Files\n\n### AGENTS.md\n\nPurpose: Multi-agent workflows and delegation patterns.\n\n```markdown\n# Agent Coordination\n\n## Delegation Rules\n- Use explore agent for open-ended codebase questions\n- Spawn sub-agents for long-running tasks\n- Use sessions_send for cross-session communication\n\n## Session Handoff\nWhen delegating to another session:\n1. Provide full context in the handoff message\n2. Include relevant file paths\n3. Specify expected output format\n```\n\n### SOUL.md\n\nPurpose: Behavioral guidelines and communication style.\n\n```markdown\n# Behavioral Guidelines\n\n## Communication Style\n- Be direct and concise\n- Avoid unnecessary caveats and disclaimers\n- Use technical language appropriate to context\n\n## Error Handling\n- Admit mistakes promptly\n- Provide corrected information immediately\n- Log significant errors to learnings\n```\n\n### TOOLS.md\n\nPurpose: Tool capabilities, integration gotchas, local configuration.\n\n```markdown\n# Tool Knowledge\n\n## Self-Improvement Skill\nLog learnings to `.learnings/` for continuous improvement.\n\n## Local Tools\n- Document tool-specific gotchas here\n- Note authentication requirements\n- Track integration quirks\n```\n\n## Learning Workflow\n\n### Capturing Learnings\n\n1. **In-session**: Log to `.learnings/` as usual\n2. **Cross-session**: Promote to workspace files\n\n### Promotion Decision Tree\n\n```\nIs the learning projec"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":1443,"uniquenessScore":43,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","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-04-15T00:45:39.800Z","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":"agent-directory","verified":false,"confidence":"low","updatedAt":"2026-10-09T00:59:10.303Z","emptyReason":"No close protocol neighbors were found."},"items":[],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[]}}}