Install
openclaw skills install @alethean-kaw/self-optimizationTurn mistakes, corrections, dead ends, and repeated fixes into durable improvements. Use when work reveals a non-obvious lesson, a recurring failure, a missing capability, or a rule that should be promoted into agent memory, workflow guidance, or a reusable skill.
openclaw skills install @alethean-kaw/self-optimizationUse this skill to close the loop after real work. The goal is not just to log what went wrong. The goal is to convert signal from mistakes, corrections, and repeated effort into stronger future behavior.
.learnings/.| Situation | Action |
|---|---|
| Command, tool, or integration fails unexpectedly | Append an entry to .learnings/ERRORS.md |
| User corrects the agent or provides missing facts | Append an entry to .learnings/LEARNINGS.md |
| A better repeatable approach is discovered | Append an entry to .learnings/LEARNINGS.md |
| User asks for a missing capability | Append an entry to .learnings/FEATURE_REQUESTS.md |
| Same issue keeps reappearing | Link entries, bump priority, and consider promotion |
| Pattern is stable across tasks | Promote to AGENTS.md, CLAUDE.md, TOOLS.md, SOUL.md, or .github/copilot-instructions.md |
| Pattern is reusable beyond one repo | Extract a new skill scaffold |
Capture a learning when any of these happen:
Skip noisy one-off trivia. Capture things that would realistically save a future session time, confusion, or rework.
Create a local .learnings/ directory in the workspace or in the OpenClaw workspace.
.learnings/
├── LEARNINGS.md
├── ERRORS.md
└── FEATURE_REQUESTS.md
LEARNINGS.mdUse for:
Template:
## [LRN-YYYYMMDD-XXX] category
**Logged**: 2026-04-01T10:00:00Z
**Priority**: low | medium | high | critical
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Summary
One-line statement of the lesson.
### Details
What was wrong, what changed, and what is now known to be correct.
### Suggested Action
What to do differently next time.
### Metadata
- Source: conversation | debugging | user_feedback | simplify-and-harden
- Related Files: path/to/file
- Tags: tag-a, tag-b
- See Also: LRN-20260401-001
- Pattern-Key: optional.stable.key
- Recurrence-Count: 1
- First-Seen: 2026-04-01
- Last-Seen: 2026-04-01
---
ERRORS.mdUse for:
Template:
## [ERR-YYYYMMDD-XXX] command_or_tool
**Logged**: 2026-04-01T10:00:00Z
**Priority**: medium
**Status**: pending
**Area**: backend | infra | tests | docs | config
### Summary
Short description of the failure.
### Error
```text
Actual error output goes here.
```
### Context
- Command or action attempted
- Relevant inputs
- Environment details if useful
### Suggested Fix
What should be tried next or documented.
### Metadata
- Reproducible: yes | no | unknown
- Related Files: path/to/file
- See Also: ERR-20260401-001
---
FEATURE_REQUESTS.mdUse for:
Template:
## [FEAT-YYYYMMDD-XXX] capability_name
**Logged**: 2026-04-01T10:00:00Z
**Priority**: low | medium | high
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Requested Capability
What the user wanted.
### User Context
Why they wanted it.
### Complexity Estimate
simple | medium | complex
### Suggested Implementation
How it might be built or extended.
### Metadata
- Frequency: first_time | recurring
- Related Features: existing_feature
---
Use TYPE-YYYYMMDD-XXX.
LRN for learningERR for errorFEAT for feature requestExamples:
LRN-20260401-001ERR-20260401-002FEAT-20260401-003Promote an entry when it becomes more valuable as guidance than as a historical note.
| Target | Promote When |
|---|---|
CLAUDE.md | Project facts, conventions, or recurring gotchas |
AGENTS.md | Workflow rules, delegation patterns, automation steps |
.github/copilot-instructions.md | Repo guidance that should reach Copilot |
TOOLS.md | Tool quirks, auth requirements, environment gotchas |
SOUL.md | Behavioral or communication rules for OpenClaw sessions |
Promotion checklist:
promoted.Before creating a new entry for a familiar issue:
.learnings/ for a related keyword or Pattern-Key.See Also.Recurrence-Count and refresh Last-Seen.Recurring issues often mean one of three things:
Extract a reusable skill when the pattern is:
Use the helper:
./skills/self-optimization/scripts/extract-skill.sh my-new-skill --dry-run
./skills/self-optimization/scripts/extract-skill.sh my-new-skill
Then customize the generated SKILL.md and update the original learning entry with:
Status: promoted_to_skillSkill-Path: skills/my-new-skillReview .learnings/ at these checkpoints:
Useful checks:
grep -h "Status\\*\\*: pending" .learnings/*.md | wc -l
grep -B5 "Priority\\*\\*: high" .learnings/*.md | grep "^## \\["
grep -l "Area\\*\\*: backend" .learnings/*.md
OpenClaw works especially well with this skill because workspace files and hooks let the improvement loop stay visible between sessions.
clawdhub install self-optimization
Manual install:
git clone <your-fork-or-source-repo> ~/.openclaw/skills/self-optimization
This package is an OpenClaw-oriented evolution of the earlier self-learning workflow.
Optional bootstrap reminder:
cp -r hooks/openclaw ~/.openclaw/hooks/self-optimization
openclaw hooks enable self-optimization
~/.openclaw/workspace/
├── AGENTS.md
├── SOUL.md
├── TOOLS.md
├── MEMORY.md
├── memory/
└── .learnings/
├── LEARNINGS.md
├── ERRORS.md
└── FEATURE_REQUESTS.md
Use hook scripts in settings:
{
"hooks": {
"UserPromptSubmit": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "./skills/self-optimization/scripts/activator.sh"
}]
}],
"PostToolUse": [{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "./skills/self-optimization/scripts/error-detector.sh"
}]
}]
}
}
Add a reminder to .github/copilot-instructions.md:
## Self-Optimization
After solving non-obvious issues, consider:
1. Logging the lesson to `.learnings/`
2. Linking related recurring entries
3. Promoting stable rules into repo guidance
4. Extracting reusable skills when the pattern is broad