| name | wikibrain-compact |
| description | Compact the WikiBrain memory vault back within its context budgets — merge, rewrite, and archive memories, applying only user-confirmed actions. Use when the user says "compact memory" or "clean up memory", or when more than a week has passed since the last `memory: compact` commit. |
wikibrain-compact
Compaction is lossless: a memory moves down the recall ladder — active (memory/) → archived (archive/<slug>/YYYY-MM_<name>.md) → git history — never off it. Budgets and format rules live in GUIDELINES.md; read it before classifying.
VAULT = the repo this skill lives in (resolve the ~/.claude/skills/wikibrain-compact symlink; default ~/personal/WikiBrain).
-
Gap. git -C "$VAULT" log --grep '^memory: compact' -1 --format=%cs — report days since (cadence: weekly).
-
Inventory. Table of every memory/<slug>/: MEMORY.md lines, file count, total lines, verdict. Done when every project carries a verdict — over-budget projects flagged, within-budget ones with no duplicates marked "skip".
-
Classify. Read every file of each flagged project and tag it merge / rewrite / archive / delete (wrong facts only — git history still recovers them) / keep. Done when every file carries a tag with a one-line reason.
-
Confirm. Present the plan per project, then AskUserQuestion (multiSelect, one question per affected project). The confirmed subset is the entire work order.
-
Apply the work order; regenerate each touched MEMORY.md (one line per active memory); repoint [[links]] that named merged or archived files. Done when a fresh inventory shows every touched project within budget.
-
Report before → after lines per project and where each archived memory now lives, then hand off to wikibrain-sync with commit message memory: compact YYYY-MM-DD.