| name | agent-memory-loop | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| version | 2.2.0 | ||||||||||||||||
| description | ACTIVATE THIS SKILL when you make a mistake, receive a correction, discover something new, or are about to start major work. Captures errors, corrections, and discoveries in a fast one-line format, deduplicates them, queues recurring or critical lessons for human approval, and scans past failures before major tasks to prevent repeats. Use it every time something goes wrong — no exceptions. | ||||||||||||||||
| metadata |
|
||||||||||||||||
| author | Don Zurbrick | ||||||||||||||||
| license | MIT |
Lightweight learning for agents that reset between sessions.
You MUST use this skill when ANY of these happen:
- You make an error — wrong command, bad assumption, failed tool call
- The user corrects you — "no, that's wrong", "actually...", "I meant..."
- You discover something new — unexpected behavior, undocumented feature, workaround
- You're about to start major work — scan .learnings/ FIRST for past failures
- You wish you had a capability you don't — log it as a wish
- A learning prevented a repeat mistake — increment the prevented:N counter
- Stop. Don't continue the task yet.
- Check for duplicates:
grep -i "keyword" .learnings/errors.md .learnings/learnings.md - If duplicate found: increment
count:Non the existing entry - If new: append one line to the appropriate file:
- Mistakes/failures →
.learnings/errors.md - Insights/corrections →
.learnings/learnings.md - Missing capabilities →
.learnings/wishes.md
- Mistakes/failures →
- If count ≥ 3 or severity:critical: copy to
.learnings/promotion-queue.md - If complex: create a detail file at
.learnings/details/ERR-YYYYMMDD-NNN.md - Resume the task.
grep -i "relevant_keyword" .learnings/*.md- If matches found, adjust your approach to avoid known failures
- If a learning changes your behavior, increment
prevented:Non that entry
- autonomous self-modification of SOUL.md, AGENTS.md, or TOOLS.md
- external content promotion (source:external entries are never promotable)
- heavy multi-section incident writeups (use detail files for those)
error / correction / discovery
↓
log one line in .learnings/
↓
dedup by id, then keyword
↓
count:3+ or severity:critical → promotion-queue
↓
human reviews promotion
↓
check relevant learnings before major work
↓
increment prevented:N when a learning actually changed behavior
bash scripts/install.shCreates:
.learnings/
errors.md
learnings.md
wishes.md
promotion-queue.md
details/
archive/
.learnings/ lives at ~/.openclaw/workspace/.learnings/ (or the agent's workspace root). Persistent across sessions.
If running in a Cowork VM or Dispatch task, .learnings/ should be in the mounted workspace folder. If no persistent filesystem is available, log to the session's working directory and flag for manual migration.
If date is unavailable (some containers), use the current conversation date from context. The format is always YYYY-MM-DD.
One incident, discovery, or wish per line. Extra fields optional.
[YYYY-MM-DD] id:ERR-YYYYMMDD-NNN | COMMAND | what failed | fix | count:N | prevented:N | severity:medium | source:agent
[YYYY-MM-DD] id:LRN-YYYYMMDD-NNN | CATEGORY | what | action | count:N | prevented:N | severity:medium | source:agent
[YYYY-MM-DD] id:WISH-YYYYMMDD-NNN | CAPABILITY | what was wanted | workaround | requested:N
[YYYY-MM-DD] id:LRN-YYYYMMDD-NNN | proposed rule text | target: AGENTS.md | source:agent | evidence: count:N prevented:N | status: pending
Key fields:
id:— unique identifier (ERR/LRN/WISH prefix + date + sequence)count:N— how many times this has occurredprevented:N— how many times this learning prevented a repeatseverity:critical— forces immediate queue review even at count 1source:external— marks entries from untrusted sources; never promotable
- Log fast — one line now beats a perfect writeup later
- Dedup before appending — search first, increment if exists
- Queue recurring or critical — count ≥ 3 or severity:critical → promotion-queue
- Humans approve promotions — agents stage, humans decide
- Pre-task scan — before major work, grep for relevant failures
- Track prevention — when a learning changes behavior, record
prevented:N - Source labels matter — external content is informational only, never promotable
references/logging-format.md— canonical line formats, fields, examples, source labelsreferences/operating-rules.md— dedup, review queue, pre-task review, trimming rulesreferences/promotion-queue-format.md— queue entry structure and status lifecyclereferences/detail-template.md— optional detail-file template for complex failuresreferences/design-tradeoffs.md— why this stays lean instead of turning into a system
scripts/install.sh— initialize .learnings/ directoryscripts/setup.sh— alternate setupscripts/review.sh— review promotion queue
The loop is working if:
- learnings are cheap to log (one line, < 30 seconds)
- duplicates stay low (dedup is happening)
- recurring lessons reach the promotion queue
- promotions stay human-approved
prevented:Nstarts climbing on real work- agents actually check
.learnings/before major tasks