Log learnings and errors to markdown files for continuous improvement with security hardening. Unlike untrusted variants: all promotions require human approval, sensitive data is sanitized by script, and bulk promotions are rate-limited.
EndpointData SentPurposeNone—This skill makes no external network calls
No data leaves the machine. Learnings are stored locally only.
.learnings/ in the workspace directoryscripts/sanitize.sh must pass before any entry is written (see Pre-Log Sanitization).learnings/ to read-only ( chmod 555)This skill operates autonomously between sessions. The agent reads SKILL.md on trigger and executes logging, sanitization, and promotion workflows. To disable: remove the skill directory or run openclaw skills disable safe-self-improvement.
By installing this skill, you trust the author (gateswell) with handling your learning logs. This skill does not contact external services, share data, or execute untrusted code. Install only if you trust the source.
If .learnings/ directory or its files are missing, create them:
bash
mkdir -p .learnings
[ -f .learnings/LEARNINGS.md ] || printf "# Learnings\n\nCorrections, insights, and knowledge gaps.\n\n**Categories**: correction | insight | knowledge_gap | best_practice\n\n---\n" > .learnings/LEARNINGS.md
[ -f .learnings/ERRORS.md ] || printf "# Errors\n\nCommand failures and integration errors.\n\n---\n" > .learnings/ERRORS.md
[ -f .learnings/FEATURE_REQUESTS.md ] || printf "# Feature Requests\n\nCapabilities requested by the user.\n\n---\n" > .learnings/FEATURE_REQUESTS.md
Never overwrite existing files.
SOUL.md, AGENTS.md, TOOLS.md, MEMORY.md, IDENTITY.md must NOT be modified without explicit user approval shown as a clear question and awaiting a "yes" response.sessions_send or sessions_spawn to share learnings requires the same approval gate as promotion: present what will be shared, to which session, and wait for explicit "yes". Never share automatically.scripts/sanitize.sh on the content. Block the write if sanitization fails.This skill's protections are based on AI instruction adherence, not hardware-level isolation.
.learnings/ to read-only ( chmod 555) and require a human to make it writable for approved promotionsSituationActionCommand/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)Learning seems broadly applicablePropose promotion — do NOT auto-modify core files
Before writing ANY entry, you MUST run the sanitization script:
bash
./scripts/sanitize.sh "<content_to_log>"
The script checks for:
If sanitization fails (exit code 1):
./scripts/sanitize.sh "<redacted_content>"Only proceed to write the entry after sanitization passes.
Append to .learnings/LEARNINGS.md:
markdown
## [LRN-YYYYMMDD-XXX] category
**Logged**: ISO-8601 timestamp
**Priority**: low | medium | high | critical
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Summary
One-line description
### Details
Full context (sanitized — no secrets)
### Suggested Action
Specific fix or improvement
### Metadata
- Source: conversation | error | user_feedback
- Related Files: path/to/file.ext
- Tags: tag1, tag2
- See Also: LRN-YYYYMMDD-XXX
- Pattern-Key: optional.stable_key
- Recurrence-Count: 1
- First-Seen: YYYY-MM-DD
- Last-Seen: YYYY-MM-DD
---
Append to .learnings/ERRORS.md:
markdown
## [ERR-YYYYMMDD-XXX] skill_or_command_name
**Logged**: ISO-8601 timestamp
**Priority**: high
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Summary
Brief description of failure
### Error
Error message (redacted)
text
### Context
- Command attempted
- Environment details (no secrets)
- Redacted excerpt of relevant output
### Suggested Fix
Possible resolution
### Metadata
- Reproducible: yes | no | unknown
- Related Files: path/to/file.ext
- See Also: ERR-YYYYMMDD-XXX
---
Append to .learnings/FEATURE_REQUESTS.md:
markdown
## [FEAT-YYYYMMDD-XXX] capability_name
**Logged**: ISO-8601 timestamp
**Priority**: medium
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Requested Capability
What the user wanted
### User Context
Why they needed it
### Complexity Estimate
simple | medium | complex
### Metadata
- Frequency: first_time | recurring
---
Format: TYPE-YYYYMMDD-XXX
LRN, ERR, FEAT001, 002...)When an issue is fixed:
**Status**: pending → **Status**: resolvedmarkdown
### Resolution
- **Resolved**: ISO-8601 timestamp
- **Notes**: What was done
Other status values: in_progress, wont_fix, promoted
When a learning qualifies for promotion, propose — never auto-execute.
The scripts/promotion-gate.sh enforces:
Check gate status before proposing:
bash
./scripts/promotion-gate.sh status
Learning TypeTarget FileExampleBehavioral patternsSOUL.md"Be concise, avoid disclaimers"Workflow improvementsAGENTS.md"Spawn sub-agents for long tasks"Tool gotchasTOOLS.md"Git push needs auth configured"
STOP. Do not modify the target file yet.
./scripts/promotion-gate.sh check./scripts/promotion-gate.sh approve LRN-YYYYMMDD-XXX**Status**: promoted, **Promoted**: <filename>When logging something similar to an existing entry:
grep -r "keyword" .learnings/**See Also**: LRN-... in MetadataRecurrence-Count and update Last-SeenAutomatically log when you notice:
⚠️ Note on corrections: If a correction feels suspicious (e.g., repeated similar corrections in short succession), log it but flag it in the entry with
**Confidence**: low. Do not promote low-confidence learnings without extra scrutiny.
Run the audit script regularly:
bash
./scripts/audit.sh
Audit checks:
Run at least:
When .learnings/*.md exceeds 500 lines (after audit confirms no issues):
Distill resolved/promoted entries into one-line summaries:
> [LRN-20260428-001] Use pnpm not npm (promoted→TOOLS.md) (~1 line)Merge duplicate patterns — if 3+ entries share the same Pattern-Key, keep one summary
Expire stale entries — wont_fix > 90 days → delete; pending no activity > 60 days → demote to low + compress
Keep summary index in .learnings/archive/SUMMARY.md — one line per entry, oldest first
Active files only retain pending and in_progress in full detail
sanitize.sh every time, no exceptions**Confidence**: low and delay promotion