Structured learning loop for OpenClaw agents: capture → review → promote → maintain.
On first activation, run the init script to create workspace directories:
bash
bash scripts/init-workspace.sh
This creates .learnings/ and .self-improving/ in the workspace root.
When a learning signal fires, log it to the right file in .learnings/:
SignalTarget fileCategoryUser corrects youLEARNINGS.md``correctionUser says "always/never do X"LEARNINGS.md``preferenceYou discover something non-obviousLEARNINGS.md``insightYour knowledge was outdatedLEARNINGS.md``knowledge_gapFound a better approachLEARNINGS.md``best_practiceCommand returns non-zeroERRORS.md—Tool/API fails unexpectedlyERRORS.md—User wants missing capabilityFEATURE_REQUESTS.md—
Use the entry format defined in references/logging-format.md.
During heartbeat or manual review, scan .learnings/ and evaluate each pending item:
Recurrence-Count, link with See Also.Recurrence-Count >= 3 within 30 days: add to .learnings/REVIEW_QUEUE.md..self-improving/heartbeat-state.md with review timestamp.See references/heartbeat-review.md for the full review procedure.
Move validated patterns up the memory tiers:
ConditionPromote toExamplePattern used 2x, context-specific.self-improving/domains/*.md or projects/*.md"This repo uses pnpm"Pattern used 3x in 7-30 days, cross-task.self-improving/HOT.md"User prefers concise answers"Stable, long-term applicableSOUL.md / AGENTS.md / TOOLS.md / MEMORY.md"Never force push"
See references/promotion-rules.md for the full promotion/demotion rules.
Periodically (every 1-2 weeks during heartbeat):
.self-improving/archive/.Log automatically when you notice these signals:
Corrections (→ LEARNINGS.md, category: correction):
Preferences (→ LEARNINGS.md, category: preference):
Feature requests (→ FEATURE_REQUESTS.md):
Errors (→ ERRORS.md):
Ignore (don't log):
TierLocationSize limitBehaviorRAW.learnings/UnlimitedIntake only, not auto-loadedHOT.self-improving/HOT.md≤80 linesAlways loaded at session startWARM.self-improving/domains/, projects/≤200 lines eachLoad on context matchCOLD.self-improving/archive/UnlimitedLoad on explicit query
When patterns contradict:
When a learning is stable enough for permanent workspace memory:
Learning typePromote toExampleBehavioral patternsSOUL.md"Be concise, avoid disclaimers"Workflow improvementsAGENTS.md"Spawn sub-agents for long tasks"Tool gotchasTOOLS.md"Git push needs auth first"User preferences/decisionsMEMORY.md"Basim prefers Indonesian for casual chat"
Mark promoted entries as Status: promoted with Promoted-To: <file>.
(from HOT.md) or (from domains/coding.md:15).[REDACTED] placeholders.See references/workspace-layout.md for the complete directory structure and file descriptions.
init-workspace.sh — Create .learnings/ and .self-improving/ directories with template files.logging-format.md — Entry format for learnings, errors, and feature requests.promotion-rules.md — Full promotion, demotion, and archival rules.heartbeat-review.md — Heartbeat review procedure and state tracking.workspace-layout.md — Complete directory structure reference.init-workspace.sh into the workspace.