Log learnings and errors to markdown files. Important patterns get promoted to project memory files.
SituationActionCommand/operation failsLog to .learnings/ERRORS.mdUser corrects youLog to .learnings/LEARNINGS.md (category: correction)User wants missing featureLog to .learnings/FEATURE_REQUESTS.mdAPI/external tool failsLog to .learnings/ERRORS.mdKnowledge was outdatedLog to .learnings/LEARNINGS.md (category: knowledge_gap)Found better approachLog to .learnings/LEARNINGS.md (category: best_practice)Similar to existing entryLink with **See Also**, bump priorityBroadly applicable learningPromote to workspace files (see below)
When a learning proves broadly applicable, elevate it:
Learning TypePromote ToBehavioral patternsSOUL.mdWorkflow patternsAGENTS.mdTool gotchasTOOLS.mdProject factsCLAUDE.md or workspace prompt files
markdown
## [LRN-YYYYMMDD-XXX] category
**Logged**: ISO-8601 timestamp
**Priority**: low | medium | high | critical
**Status**: pending | resolved | promoted | in_progress
### Summary
One-line description of what was learned
### Details
Full context: what happened, what was wrong, what's correct
### Suggested Action
Concrete fix or improvement
### Metadata
- Source: conversation | error | user_feedback
- Related Files: path/to/file.ext
- Tags: tag1, tag2
- See Also: LRN-YYYYMMDD-XXX (if related)
markdown
## [ERR-YYYYMMDD-XXX] command_or_tool
**Logged**: ISO-8601 timestamp
**Priority**: high
**Status**: pending
### Summary
Brief description of what failed
### Error
Paste actual error output here
text
### Context
- Command/operation attempted
- Input or parameters used
- Environment details
### Suggested Fix
If identifiable, how to resolve it
### Metadata
- Reproducible: yes | no | unknown
- Related Files: path/to/file.ext
markdown
## [FEAT-YYYYMMDD-XXX] capability_name
**Logged**: ISO-8601 timestamp
**Priority**: medium
**Status**: pending
### Requested Capability
What the user wanted to do
### User Context
Why they needed it
### Complexity Estimate
simple | medium | complex
TYPE-YYYYMMDD-XXX — e.g. LRN-20250322-001, ERR-20250322-A3F
When fixed:
resolved or promotedmarkdown
### Resolution
- **Resolved**: 2025-01-16T09:00:00Z
- **Commit/PR**: abc123 or #42
- **Notes**: What was done
When: Learning applies across files, prevents recurring mistakes, or any contributor should know it.
How: Distill into a concise rule. Add to target file. Set original entry to promoted.
Example learning:
Project uses pnpm workspaces.
npm installfails because lock file ispnpm-lock.yaml.
Promote to CLAUDE.md:
markdown
## Build & Dependencies
- Package manager: **pnpm** (not npm) — always use `pnpm install`
Before logging, search for related entries:
bash
grep -r "keyword" .learnings/
If similar entry exists:
**See Also**: LRN-...Recurrence-CountPromote to permanent prompt guidance when a pattern:
Share learnings across sessions:
ToolUsesessions_listView active/recent sessionssessions_history(sessionKey, limit)Read another session's transcriptsessions_send(sessionKey, message)Send a learning to another sessionsessions_spawn(task, label, mode)Spawn a background sub-agent
Example: After a session ends, promote its key learnings to workspace files.
Use sessions_history to review what another session discovered.
Check .learnings/ at natural breakpoints:
Quick status:
bash
grep -h "Status.*pending" .learnings/*.md | wc -l # count pending
grep -B3 "Priority.*high" .learnings/*.md | grep "^##" # high priority items
Log immediately when you notice:
Signal→ EntryNon-zero exit code, exception, timeoutERRORS.mdUser says "No, that's wrong...", "Actually..."LEARNINGS.md (correction)User provides info you didn't knowLEARNINGS.md (knowledge_gap)"Can you also...", "I wish you could..."FEATURE_REQUESTS.mdFound a better approach mid-taskLEARNINGS.md (best_practice)Repeated mistake (2+ times)Promote to workspace file
.learnings/See Also linkingbash
clawhub install self-improving-agent
Manual:
bash
git clone https://github.com/pskoett/self-improving-agent.git ~/.openclaw/skills/self-improving-agent
Create log directory:
bash
mkdir -p ~/.openclaw/workspace/.learnings
For complete documentation, see:
references/openclaw-integration.mdreferences/hooks-setup.mdreferences/examples.mdreferences/skill-extraction.mdreferences/other-agents.md