---
name: memory-gc
description: Use to audit and prune persistent memory — "is this memory still valid", "clean up memory", "are these memories stale", "memory gc", periodic memory hygiene, or after large refactors/audits that likely invalidated recorded facts. Verifies each memory's claims against live repo/tool state, classifies CONFIRMED/SUSPECT/CONFLICTING/UNVERIFIABLE, updates or deletes with user sign-off on deletions.
---

# Memory-GC — Validity Audit of Persistent Memory

Audience: AI coding agents first.

Validity ≠ recency: no usage log exists, so age proves nothing. Rule: **a memory is judged ONLY by checking its claims against current ground truth (repo HEAD, live tool behavior, file existence).**

## Steps

1. **Enumerate**: read `MEMORY.md` index + every file in the memory dir. Flag index/file drift (orphan files, dead index lines) — fix immediately.
2. **Extract claims per memory**: named files/paths, flags/commands, model names, "X is blocked/default/broken" assertions, dates.
3. **Verify each claim** against ground truth — probe, don't recall: file exists? command/flag still valid (`--help`)? referenced skill/script still in tree? blocked thing still blocked? Batch checks via exec.
4. **Classify**:
   - **CONFIRMED** — all claims hold → keep, no edit.
   - **SUSPECT** — unverifiable core claim or partial drift → keep, append one-line `(gc YYYY-MM-DD: <what's unverified>)`.
   - **CONFLICTING** — claim contradicts ground truth → rewrite to current truth, or delete if fully obsolete.
   - **UNVERIFIABLE** — pure preference/feedback (no checkable claim) → keep; only the user can retire these.
5. **Apply**: updates directly; **deletions listed to user for sign-off BEFORE removing** — a wrongly deleted memory is unrecoverable. Sync `MEMORY.md` index after every change.
6. **Report table**: memory | class | evidence | action taken.

## Boundaries

- DO NOT delete `feedback`/`user` type memories on your own judgment — user guidance retires only by user say-so.
- DO NOT add new memories during gc — hygiene pass only.
