Audit the whole project auto-memory store for hygiene - classify every entry keep / rewrite / promote / delete against the memory write gate (the guard-memory-write hook), and flag stale doc citations, dead [[links]], malformed frontmatter, duplicates of an existing rule / hook / doc, and MEMORY.md index mismatches. Invoke when the user asks to audit, prune, clean, or re-baseline memory. Not for saving one new memory (the write hook gates that). Read-only until the user approves; executes del...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Audit Memory?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/davidleberknight-audit-memory)
---
name: audit-memory
disable-model-invocation: true
description: Audit the whole project auto-memory store for hygiene - classify every entry keep / rewrite / promote / delete against the memory write gate (the guard-memory-write hook), and flag stale doc citations, dead [[links]], malformed frontmatter, duplicates of an existing rule / hook / doc, and MEMORY.md index mismatches. Invoke when the user asks to audit, prune, clean, or re-baseline memory. Not for saving one new memory (the write hook gates that). Read-only until the user approves; executes deletes and promotions in review batches.
---
# Skill: Audit the auto-memory store (audit-memory)
Runs the memory write hook's checklist over the whole store, which the hook, gating one write at
a time, never reviews.
## Stop condition
Stop once the human has approved a batch and the executed changes are verified (index
matches files; no dead links or stale citations remain); do not keep sweeping.
## Authority
`.claude/hooks/guard-memory-write.sh` is the single source for what may live in memory: its
deny reason states the two allowed classes, the exclusions and the audit line. Read it and
apply it verbatim; this skill applies it at review scale and does not restate it.
## Method
**Phase 1 — Inventory.** Read `MEMORY.md` end to end and list every entry file in the memory
directory. Note any file with no `MEMORY.md` pointer and any pointer with no file (index drift).
**Phase 2 — Per-entry classification.** For each entry, apply the hook's exclusions and decide
exactly one verdict:
- DELETE — fails an exclusion in the hook's checklist.
- PROMOTE — a real, durable lesson with a repo home it is not yet in. Name the destination
(root `CLAUDE.md`, a specific rule, a skill, a doc, a hook, a CI check, the private operations
checkout, or the private tracker) and the exact text to add.
- REWRITE — the lesson is sound but the entry is stale: it cites a deleted doc, carries a dead
`[[link]]`, has malformed frontmatter, or states more than the machine-local nucleus. Trim to
the part with no repo home.
- KEEP — one of the two allowed classes, passing every exclusion.
To decide DELETE-vs-KEEP, grep the harness for the entry's keywords across root and nested
`CLAUDE.md`, every `.claude/rules/*`, every `.claude/hooks/*`, and every committed `docs/*`. A
match means the lesson has a home already — DELETE or PROMOTE, never keep a duplicate.
**Phase 3 — Structural checks (across the whole store).**
- Stale doc citations: for every `docs/…` (or other repo path) named in an entry body, confirm
the file still exists; a dead name is a REWRITE (state the concept in words, drop the name).
- Dead `[[links]]`: for every `[[name]]`, confirm a `name.md` entry exists; flag misses.
- Malformed frontmatter: every entry has non-empty `name`, `description`, and a valid
`metadata.type` (user | feedback | project | reference); flag violations.
- Index sync: every file has exactly one `MEMORY.md` pointer and vice versa.
- Reverse citations: grep the harness (root and nested `CLAUDE.md`, `.claude/**`) for `memory/`
path references. A harness file citing a memory entry means the fact needs a repo home —
promote it; a citation of a nonexistent entry is a defect to fix in the citing file.
**Phase 4 — Present the ledger, then pause.** Output the per-entry verdict table (below) plus
the structural-check findings. Make no change yet. Recommend an execution order and stop for
approval.
**Phase 5 — Execute in review batches.** On approval, execute in this order, pausing for the
human between batches: (1) DELETEs; (2)
REWRITEs; (3) PROMOTEs — each promotion is a committed-file edit, approved under the
documentation-edit rule in `.claude/rules/asking.md`, since it touches a rule/doc/CLAUDE.md. After each batch, rewrite the
`MEMORY.md` index to match the surviving files. Every Write/Edit to the memory directory still
carries the audit line the write hook requires, and the user-scope ask rule still prompts.
## Secret safety
Refer to an entry that points at a gitignored, secret-bearing file by name and verdict only,
never echoing its body; with a valid target it is a KEEP.
## Output format
A per-entry ledger, one row each:
`<entry-name> — <KEEP|REWRITE|PROMOTE|DELETE> — <one-line reason>[; destination for PROMOTE][; stale-citation/dead-link/frontmatter note]`
Followed by the structural-check summary and a recommended batch order.