Install
openclaw skills install memory-defragDefragment and reorganize agent memory files: split bloated files, merge duplicates, remove stale information, and restructure the memory hierarchy. Use when...
openclaw skills install memory-defragReorganize memory files for clarity, efficiency, and relevance. Like filesystem defragmentation but for knowledge.
Inventory all memory files:
MEMORY.md — long-term memory
memory/ — daily notes, tasks, topical files
memory/tasks/ — active and completed tasks
For each file, note: line count, last modified, topic coverage, staleness.
Look for these common issues:
| Problem | Signal | Fix |
|---|---|---|
| Bloated file | >300 lines, covers many topics | Split into focused files |
| Duplicate info | Same fact in multiple places | Consolidate to one location |
| Stale entries | References to completed work, old dates, resolved issues | Remove or archive |
| Orphan files | Files in memory/ never referenced or updated | Review, merge, or remove |
| Inconsistencies | Contradictory information across files | Resolve to ground truth |
| Poor organization | Related info scattered across files | Restructure by topic |
| Recursive nesting | memory/memory/memory/... directories | Delete nested dirs (indexer bug artifact) |
Before making edits, write a brief plan:
## Defrag Plan
- [ ] Split MEMORY.md "Key People" section → memory/people.md
- [ ] Remove completed tasks older than 30 days from memory/tasks/
- [ ] Merge memory/bm-marketing-ideas.md into memory/competitive/
- [ ] Update stale project status entries in MEMORY.md
Apply changes one at a time:
After changes:
## Memory Defrag (HH:MM)
- Files reviewed: N
- Split: [list]
- Merged: [list]
- Pruned: [list]
- Net result: X files, Y total lines (was Z lines)
memory/YYYY-MM-DD.md files — they're the audit trail.people.md, project-status.md, competitive-landscape.md — not notes-2.md.memory/tasks/ and memory/competitive/ are fine; memory/work/projects/active/basic-memory/notes/ is not.status: done older than 14 days can be removed. Their insights should already be in MEMORY.md via reflection.(review needed) tag rather than deleting.