[Adam''s Skills] Cleans up the memories Claude keeps about this project. Finds the ones that have gone stale, repeat each other, repeat what the repo already says, or belong somewhere else, and lists only those, in plain English, with a call and a reason for each; healthy memories are a single count. Asks only where the answer depends on the user, proposes the whole clean-up as one batch, and applies it after one approval, backing up the memory folder first. Works from worktrees too. Technica...
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 Memory Audit?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adamlinscott-memory-audit)
---
name: memory-audit
description: '[Adam''s Skills] Cleans up the memories Claude keeps about this project. Finds the ones that have gone stale, repeat each other, repeat what the repo already says, or belong somewhere else, and lists only those, in plain English, with a call and a reason for each; healthy memories are a single count. Asks only where the answer depends on the user, proposes the whole clean-up as one batch, and applies it after one approval, backing up the memory folder first. Works from worktrees too. Technical detail on request. Usage: /memory-audit'
allowed-tools: Read, Grep, Glob, Bash, Edit, Write, AskUserQuestion, Agent
---
# memory-audit
Memories pile up faster than anyone retires them. Each one is loaded into every session in this
project, so a stale memory keeps steering Claude long after it stopped being true: a renamed file,
a rule that now lives in the code, a one-off incident written down as if it were a standing rule.
Most people never look at what was saved. The slow part of fixing that is ruling on every memory
by hand, so this skill makes the calls itself and brings the user only the ones that need them.
Good looks like a short set where each memory holds a lasting rule or fact the repo can't show,
says why, uses real dates, names things that still exist, and has its line in `MEMORY.md`.
The user decides what only they can know: whether a preference still holds, which of two
conflicting memories wins, the why behind a rule that has none, and the one approval for the batch.
## Finding the memories
Memory belongs to the main checkout, not the folder Claude was started in. From a worktree the
current folder's project entry has no memory, and reporting "nothing recorded" there is wrong.
Find the main checkout with `git rev-parse --path-format=absolute --git-common-dir` and take its
parent folder (outside git, use the current folder). The memory folder is
`~/.claude/projects/<name>/memory/`, where `<name>` is that path with every character other than a
letter, digit or `-` turned into `-` (`C:\Users\me\Projects\app` becomes
`C--Users-me-Projects-app`). Match `<name>` against the folders in `~/.claude/projects/`
case-insensitively on Windows, where the drive letter's case varies. If more than one matches, use
the one with a `memory/` folder.
Only when that lookup finds no `memory/` folder, say no memory has been recorded for this project
yet, mark the run (below), and stop.
## Making the calls
Read `MEMORY.md` and every file in the folder, indexed or not; never judge a memory unread. Hand
every file path, function, class and folder the memories name to the `scout` agent in one call,
with the memory each came from (`general-purpose` if `scout` isn't installed, and say so in a
line). It reports which still exist, with `path:line`. What a missing one means is your call.
Names that exist aren't enough: check each claim a memory makes (an order, a count, a version)
against the repo yourself, since a memory goes false while every name in it still resolves.
Each memory gets one call:
- **Keep**: a lasting rule or fact the repo doesn't record.
- **Drop**: the repo already records it (code structure, git history, CLAUDE.md, a skill's own
text); it mattered to one conversation only; or it is a one-off incident with no rule in it.
- **Refresh**: a name, path or example no longer exists, or a relative date ("last week") needs
turning into a real one. Fix the text; drop the part that is now false.
- **Merge**: it overlaps another memory. Combine them into one.
- **Move**: a real rule, but not one every session here needs. It goes to the project's
CLAUDE.md, to `~/.claude/CLAUDE.md` when it applies to every project, to a skill, or to an
agent prompt. Never to `docs/`. A skill or agent outside this repo is often a link into another
clone: resolve its real path first, and if that lies inside a git work tree, don't edit it. List
the move as a change for that repo, naming the repo and the file, to be raised there (for
example with `/raise-issue`), never edited in place.
- **Ask**: a feedback memory with no why, a preference that may have changed, or two memories that
disagree.
The same read also covers what the old technical audit checked, and feeds these calls rather than
its own section. Files missing from `MEMORY.md` get indexed or dropped, and index lines pointing
at missing files are removed. `[[links]]` to memories that don't exist are fixed or cut, and one
memory copied from another project's folder belongs in `~/.claude/CLAUDE.md` or that project. A
memory whose content doesn't match its type gets split or refiled: a `project` memory using
relative dates, a `feedback` memory missing its why or how to apply, a `reference` that no longer
resolves. Several memories about one narrow job become one memory or a skill. When most of the set
is "don't" rules, a corrections log rather than guidance, say so in one line. Conflicts between
memory and CLAUDE.md, and rules subagents never see, belong to `/context-audit`.
## The batch
No opening question. One plain-English list, using each memory's real name, of only the memories
whose call isn't Keep: one line each with what it says, the call, and why. The rest are one line:
"8 memories look fine". Every line here must read well for someone who doesn't read code; paths,
`path:line`, types and ratios stay out unless the user asks for the technical detail.
Ask only where the call depends on the user, through AskUserQuestion, at most 4 questions per call.
Then take one approval for the whole batch: apply all, apply with changes, or not now.
## Applying it
Follow this order exactly; each step keeps the one before it recoverable.
1. **Nothing changes before the approval.** "Not now" changes nothing.
2. **Back up first.** After the approval and before the first edit, copy the whole memory folder to
`<CLAUDE_SKILLS_HOME or ~/.claude>/backups/memory-audit/<name>/<timestamp>/`, outside the memory folder, with a
`changes.txt` there listing each change in the batch. Copy `~/.claude/CLAUDE.md` there too if
the batch moves anything into it. Git can restore neither.
3. **Edit each memory and its `MEMORY.md` line together**, so the index never points at a file
that is gone or misses one that exists. Fix any `[[link]]` to a removed or merged memory in the
same pass. Delete a removed memory with a removal command of its own, never chained with other
work. A move into a repo file is left uncommitted for the user.
4. **Close** with "N memories down to M", one line saying where the backup is, and nothing more.
## Mark the run
When the run finishes, batch applied or declined or no memory found, run
`node <tools>/audit-runs/check.mjs mark memory <repo>`, so the weekly clock restarts. `<repo>` is
the current work tree. `<tools>` is resolved from **this file's real path**:
`~/.claude/skills/memory-audit` is a link, and its target's `../../tools/` holds the script.
Outside git, skip the mark and say it was skipped because the run clock is keyed by a git checkout.