Clean, 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共 1 个版本