Install
openclaw skills install memory-defragmenterDefragment and optimize agent memory files by cleaning duplicates, merging similar entries, archiving stale content, and ensuring proper tiering. Use when: (1) memory files feel cluttered or bloated; (2) before or after context optimization; (3) weekly memory maintenance; (4) when explicitly asked to clean, defragment, or optimize memory.
openclaw skills install memory-defragmenterClean, merge, and optimize memory files to keep them lean and effective.
Memory files grow over time and become:
This skill defragments them.
| Trigger | Action |
|---|---|
| Weekly maintenance | Full defragment |
| Before context optimization | Clean first |
| After many sessions | Remove stale entries |
| Explicit request | Clean specified files |
python3 scripts/analyze_memory.py
Reports:
python3 scripts/defragment.py --plan
Creates defragment-plan.md with:
Read the plan and approve/modify before execution.
python3 scripts/defragment.py --execute
Backs up original files first, then:
archive/python3 scripts/verify_memory.py
Checks:
| Tier | Location | Max Size | Age Policy |
|---|---|---|---|
| HOT | memory.md, ~/self-improving/memory.md | ≤100 lines each | Review monthly |
| WARM | memory/*.md, ~/self-improving/domains/ | ≤200 lines each | Review quarterly |
| COLD | archive/ | Unlimited | Archive at 90 days |
scripts/analyze_memory.py — Analyze memory statescripts/defragment.py — Plan and execute cleanupscripts/verify_memory.py — Verify integrityreferences/rules.md — Defragmentation rules and patterns