Use 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/.SituationActionCommand, tool, or integration fails unexpectedlyAppend an entry to .learnings/ERRORS.mdUser corrects the agent or provides missing factsAppend an entry to .learnings/LEARNINGS.mdA better repeatable approach is discoveredAppend an entry to .learnings/LEARNINGS.mdUser asks for a missing capabilityAppend an entry to .learnings/FEATURE_REQUESTS.mdSame issue keeps reappearingLink entries, bump priority, and consider promotionPattern is stable across tasksPromote to AGENTS.md, CLAUDE.md, TOOLS.md, SOUL.md, or .github/copilot-instructions.mdPattern is reusable beyond one repoExtract 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.
text
.learnings/
├── LEARNINGS.md
├── ERRORS.md
└── FEATURE_REQUESTS.md
LEARNINGS.md#Use for:
Template:
markdown
## [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.md#Use for:
Template:
markdown
## [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.md#Use for:
Template:
markdown
## [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.
TargetPromote WhenCLAUDE.mdProject facts, conventions, or recurring gotchasAGENTS.mdWorkflow rules, delegation patterns, automation steps.github/copilot-instructions.mdRepo guidance that should reach CopilotTOOLS.mdTool quirks, auth requirements, environment gotchasSOUL.mdBehavioral 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:
bash
./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:
bash
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.
bash
clawdhub install self-optimization
Manual install:
bash
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:
bash
cp -r hooks/openclaw ~/.openclaw/hooks/self-optimization
openclaw hooks enable self-optimization
text
~/.openclaw/workspace/
├── AGENTS.md
├── SOUL.md
├── TOOLS.md
├── MEMORY.md
├── memory/
└── .learnings/
├── LEARNINGS.md
├── ERRORS.md
└── FEATURE_REQUESTS.md
Use hook scripts in settings:
json
{
"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:
markdown
## 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