Install
openclaw skills install safe-self-improvementSecurity-hardened self-improvement skill for OpenClaw. Captures learnings, errors, and corrections with mandatory human-approval gate, automated sanitization, audit tooling, and promotion rate-limiting. Use when: (1) A command or operation fails unexpectedly, (2) User corrects the agent, (3) User requests a missing capability, (4) An external API or tool fails, (5) Agent realizes knowledge is outdated, (6) A better approach is discovered. Review learnings before major tasks.
openclaw skills install safe-self-improvementLog 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.
| Endpoint | Data Sent | Purpose |
|---|---|---|
| None | — | 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:
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 promotions| Situation | Action |
|---|---|
| Command/operation fails | Log to .learnings/ERRORS.md |
| User corrects you | Log to .learnings/LEARNINGS.md (category: correction) |
| User wants missing feature | Log to .learnings/FEATURE_REQUESTS.md |
| API/external tool fails | Log to .learnings/ERRORS.md |
| Knowledge was outdated | Log to .learnings/LEARNINGS.md (category: knowledge_gap) |
| Found better approach | Log to .learnings/LEARNINGS.md (category: best_practice) |
| Learning seems broadly applicable | Propose promotion — do NOT auto-modify core files |
Before writing ANY entry, you MUST run the sanitization script:
./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:
## [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:
## [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)
### 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:
## [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**: resolved### 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:
./scripts/promotion-gate.sh status
| Learning Type | Target File | Example |
|---|---|---|
| Behavioral patterns | SOUL.md | "Be concise, avoid disclaimers" |
| Workflow improvements | AGENTS.md | "Spawn sub-agents for long tasks" |
| Tool gotchas | TOOLS.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:
./scripts/audit.sh
Audit checks:
Run at least:
When .learnings/*.md exceeds 500 lines (after audit confirms no issues):
> [LRN-20260428-001] Use pnpm not npm (promoted→TOOLS.md) (~1 line)Pattern-Key, keep one summarywont_fix > 90 days → delete; pending no activity > 60 days → demote to low + compress.learnings/archive/SUMMARY.md — one line per entry, oldest firstpending and in_progress in full detailsanitize.sh every time, no exceptions**Confidence**: low and delay promotion