{"skill":{"slug":"self-improving-agent-3-0-0","displayName":"Self Improving Agent 3.0.0","summary":"Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...","description":"---\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","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":614,"installsAllTime":16,"installsCurrent":16,"stars":0,"versions":1},"createdAt":1773438068634,"updatedAt":1778491894093},"latestVersion":{"version":"1.0.0","createdAt":1773438068634,"changelog":"Initial release of the self-improvement skill for OpenClaw and other agent platforms.\n\n- Enables structured logging of learnings, errors, and feature requests to Markdown files for continuous improvement.\n- Provides workflow for promoting important learnings to project memory files (`CLAUDE.md`, `AGENTS.md`, etc.).\n- Includes detailed templates and quick reference guides for different types of entries (learnings, errors, feature requests).\n- Supports OpenClaw-specific integration, workspace structure, and optional automatic reminder hook.\n- Offers generic setup instructions for use in non-OpenClaw agent environments.","license":"MIT-0"},"metadata":null,"owner":{"handle":"991200448","userId":"s176de0tanw1vwmzpbftsqyxa1885s4z","displayName":"991200448","image":"https://avatars.githubusercontent.com/u/51320345?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089873568}}