---
name: memory-curator
description: Audits MEMORY.md and the memory/ directory against current code. Flags stale references (file/symbol/flag no longer present), duplicates, fully-superseded pearls, project-state files where the project is now merged. Proposes deletes and merges; never auto-deletes. Use monthly or when pearls feel out of date.
---

# Foxhunt Memory Curator

Read-and-propose audit of the memory/ corpus. One of two authorized writers into memory/ (the other is `pearl-distiller`); this one only deletes/archives, with explicit user confirmation.

## When to invoke

- "Audit memory" (explicit).
- SessionStart hint when `memory/MEMORY.md` `mtime` > 30 days (advisory only — never auto-runs).

## What this skill does

1. **Enumerate** all memory files:
   ```bash
   ls ~/.claude/projects/-home-jgrusewski-Work-foxhunt/memory/*.md
   ```

2. **For each file**, run staleness checks:

   | Check | How |
   |---|---|
   | File reference still exists | Path mentioned in the pearl → does it still exist in the repo? |
   | Symbol reference still exists | Function/struct name mentioned → grep the repo |
   | Commit SHA still in history | `git cat-file -e <sha>` |
   | Flag/feature still wired | grep for the flag name |
   | Project status fresh | For `project_*.md`, is the project-of-interest still the current focus? |

3. **Group findings**:
   - **Stale** — referenced thing is gone; pearl needs an update or archival.
   - **Duplicate** — two pearls cover the same pattern; propose merge.
   - **Superseded** — a newer pearl replaces this one (frontmatter says DEPRECATED or another pearl says "supersedes <this>").
   - **Orphan** — pearl in `memory/` but missing from `MEMORY.md` index.
   - **Index-orphan** — line in `MEMORY.md` index referencing a missing file.

4. **Produce a curation report**:

   ```
   [memory-curator] audited <N> files in memory/

   Stale: <list with reasons>
   Duplicates: <list with proposed merges>
   Superseded: <list with replacement pearl>
   Orphans: <list>
   Index-orphans: <list>

   Proposed actions:
   1. <ARCHIVE | MERGE | UPDATE | INDEX-ADD | INDEX-REMOVE> <file> — <rationale>
   2. ...
   ```

## Discipline

- **Never auto-delete or auto-archive.** The user confirms each action one at a time.
- **Archive ≠ delete.** Archived pearls move to `memory/archive/` with a frontmatter note `archived: <YYYY-MM-DD>` and `archived_reason: <reason>`. They remain searchable.
- **Index integrity.** After any add/remove, verify `MEMORY.md` index lines stay ≤150 characters and live under the right section.
- **No new section without user approval.** Existing `MEMORY.md` sections (per the spec §3.3) are canonical.

## After curation

If any deprecated pearls were superseded by newer ones, the newer pearl frontmatter should explicitly say `supersedes: pearl_<old>.md`. Suggest invoking `pearl-distiller` if a new pearl is needed to replace an archived one.
