Automatically learn from corrections, errors, and reflections. Triggers when you're corrected, make mistakes, discover better approaches, or complete important tasks. Uses semantic detection — not keyword matching.
Learn from corrections, errors, and self-reflection. Record lessons in a structured format and persist them so every correction becomes permanent capability.
Core principle: semantic detection, not keyword matching. Users correct you in countless ways — "that's wrong", "actually it should be...", or simply giving the right answer calmly. If you detect a correction in any form, trigger the self-improving flow.
| Scenario | Detection | Action |
|---|---|---|
| Corrected by user | User points out your understanding/approach/conclusion is wrong (no matter how gently) | Record correction + review |
| Operation failed |
| Command error, API failure, tool exception |
| Record error |
| Outdated knowledge | Information you cited is no longer valid, API behavior differs from your understanding | Record knowledge gap |
| Better approach found | Discovered a more efficient method after using another | Record best practice |
| Important task completed | Finished a complex task (≥5 steps) | Self-reflection |
All learning records go in .learnings/ in the workspace:
~/.openclaw/workspace/.learnings/
├── corrections.md # Correction records (core file)
├── errors.md # Operation/command errors
├── reflections.md # Self-reflections
└── best-practices.md # Discovered best practices
Auto-create on first trigger:
mkdir -p ~/.openclaw/workspace/.learnings
## YYYY-MM-DD HH:MM — Category
- **Correction**: What the user said / what the right approach is
- **My mistake**: What I did wrong / what I misunderstood
- **Root cause**: Why I made this error (knowledge gap / wrong assumption / tool misuse)
- **Lesson**: What to do next time (one sentence, actionable)
- **Status**: ⏳pending | ✅verified | 📤promoted
Example:
## 2026-03-09 03:54 — Code Analysis Method
- **Correction**: Large codebase analysis must use Claude Code (CC), don't analyze directly
- **My mistake**: Analyzed an entire code repository in-session, reached wrong conclusions
- **Root cause**: Didn't understand CC's use case, assumed I could handle large codebases
- **Lesson**: For repository-level code analysis, always use CC — never analyze directly
- **Status**: ✅verified
## YYYY-MM-DD HH:MM — Brief description
- **Action**: What command/tool was executed
- **Error**: Specific error message
- **Context**: Relevant details (path, params, version)
- **Fix**: How it was resolved
- **Prevention**: How to avoid next time
After completing important tasks, pause and self-assess:
## YYYY-MM-DD — Task Description
- **What I did**: Task overview
- **Result**: Success / partial / failure
- **What could be better**: Specific improvement points
- **Lesson**: What to do next time (one sentence)
- **Status**: ⏳candidate | ✅promoted
Lessons shouldn't just sit in .learnings/ — important ones get promoted to permanent memory:
| Condition | Promote to | Example |
|---|---|---|
| Lesson affects daily workflow | MEMORY.md | "Always use CC for code analysis" |
| Lesson involves tool usage | TOOLS.md | "MySQL queries need LIMIT" |
| Lesson involves behavior patterns | AGENTS.md or SOUL.md | "Confirm understanding before acting" |
| Same lesson appears ≥3 times | Promote immediately, don't wait for verification | — |
After promotion: Change original entry status to 📤promoted, note which file it was promoted to.
| File | Limit | Overflow handling |
|---|---|---|
| corrections.md | 50 entries | Archive old entries to memory/archive/ |
| errors.md | 30 entries | Clean up resolved errors |
| reflections.md | 30 entries | Clean up promoted entries |
| best-practices.md | No hard limit | Periodically merge similar entries |
When you detect you've been corrected, immediately execute these steps:
.learnings/corrections.mdDon't:
During heartbeat or first conversation each day:
.learnings/corrections.md⏳pending can be marked ✅verified| System | Purpose | Relationship |
|---|---|---|
.learnings/ | Structured lessons/errors/reflections | New — focused on "learning from mistakes" |
MEMORY.md | Long-term memory (decisions, preferences, facts) | Promotion target for lessons |
memory/YYYY-MM-DD.md | Daily conversation logs | Raw material, unstructured |
AGENTS.md | Behavioral rules | Promotion target for behavior lessons |
Principle: .learnings/ is the "inbox" for lessons. MEMORY.md and AGENTS.md are "long-term storage". The inbox gets cleaned regularly; long-term storage only grows (unless outdated).