session-memory-audit
Skill2 starsChanged 26 days agoMITView on GitHub
Health-checks Claude Code memories for staleness, broken links, orphaned files, expired dates, missing frontmatter, and duplicates. Offers two-tier fixes: deterministic auto-fixes and AI-assisted corrections. Use when the user asks to clean up memories, check memory health, find stale memories, or audit their stored knowledge. Also triggered by: "memory health", "stale memories", "clean up memories", "memory audit".
In this repository14 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- session-cleanupSkill
- session-deleteSkill
- session-detailSkill
- session-diffSkill
- session-exportSkill
- session-listSkill
- session-memory-searchSkill
- session-memorySkill
- session-resumeSkill
- session-searchSkill
- session-statsSkill
- session-tasksSkill
- session-timelineSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 15 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 45
After the table, ask: "Apply all N auto-fixes?
- Distinctive: line 61
If no — show summary and stop.
- Distinctive: line 63
If yes — walk through ONE AT A TIME:
- Distinctive: line 68
Read the file content
- Distinctive: line 72
If approved, prepend it to the file
- Distinctive: line 76
If found at a new location, suggest updating the path in the memory file
- Distinctive: line 77
If not found, suggest removing the reference or marking the memory for deletion
- Distinctive: line 80
Read both memory files fully
- Distinctive: line 82
If duplicates: propose a merged version, ask user which project should keep it
- Distinctive: line 83
If different: suggest renaming one to differentiate (e.g., "User profile — backend" vs "User profile — frontend")
- Distinctive: line 87
Check if it references specific facts that may have changed (versions, counts, dates, URLs)
- Distinctive: line 89
If user says outdated: help update the content
- Very specific: line 90
If user says still valid: suggest updating the file's modification date with touch
- Distinctive: line 94
NEVER delete a file without explicit user confirmation
- Distinctive: line 95
NEVER modify MEMORY.md without showing what will change
- Distinctive: line 98
If the user says "no" to reviewing AI-assisted findings, stop immediately — do not summarize them, do not suggest reviewing them later
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Step 1: Run the audit
bun run ${CLAUDE_PLUGIN_ROOT}/lib/memory-scanner.ts auditOptional: --age-threshold N (default 60 days for staleness check)
Step 2: Present the summary
Show the health summary first:
Memory Health Report N memories across M projects N critical · N warnings · N info
Step 3: Present findings in two sections
IMPORTANT: Always separate findings into two clearly labeled groups.
Section A: Auto-fixable (deterministic, no AI)
These are safe, mechanical fixes. Present as a numbered table:
| # | Action | File | Project | Issue |
Where Action is one of:
- DELETE — for
expiredfindings (delete file + remove MEMORY.md entry) - REMOVE — for
broken_linkfindings (remove dead entry from MEMORY.md) - INDEX — for
orphanfindings with frontmatter (add entry to MEMORY.md) - SYNC — for
index_mismatchfindings (update MEMORY.md description)
After the table, ask: "Apply all N auto-fixes? (yes/no)"
If yes:
- For DELETE: Remove the file with
rm, then edit MEMORY.md to remove the line referencing it - For REMOVE: Edit MEMORY.md to remove the broken link line
- For INDEX: Read the file's frontmatter, append a new entry to MEMORY.md:
- [name](filename.md) — description - For SYNC: Update the MEMORY.md entry's description to match the file's frontmatter description
Report each fix as it completes.
Section B: AI-assisted (requires analysis)
Present these AFTER auto-fixes are complete (or skipped):
"There are also N findings that require analysis to fix. Would you like to review them? (yes/no)"
If no — show summary and stop. Do NOT proceed with AI-assisted fixes.
If yes — walk through ONE AT A TIME:
For each finding, the ai_action field tells you what to do:
missing_frontmatter:
- Read the file content
- Infer the memory type from content (user bio = user, behavioral rule = feedback, project state = project, external pointers = reference)
- Infer a concise name and description
- Show the proposed frontmatter to the user
- If approved, prepend it to the file
stale_path:
- For each missing path, search the filesystem by filename:
find "$HOME" -name "filename" -type f 2>/dev/null | head -5 - If found at a new location, suggest updating the path in the memory file
- If not found, suggest removing the reference or marking the memory for deletion
duplicate:
- Read both memory files fully
- Compare content — are they truly duplicates or do they serve different projects?
- If duplicates: propose a merged version, ask user which project should keep it
- If different: suggest renaming one to differentiate (e.g., "User profile — backend" vs "User profile — frontend")
stale (age-based):
- Read the file content
- Check if it references specific facts that may have changed (versions, counts, dates, URLs)
- Present a summary: "This memory is N days old. It claims X — is this still accurate?"
- If user says outdated: help update the content
- If user says still valid: suggest updating the file's modification date with
touch
Safety Rules
- NEVER delete a file without explicit user confirmation
- NEVER modify MEMORY.md without showing what will change
- Auto-fixes are batched but each destructive action (DELETE) should be confirmed individually within the batch
- AI-assisted fixes are always one-at-a-time with user approval
- If the user says "no" to reviewing AI-assisted findings, stop immediately — do not summarize them, do not suggest reviewing them later
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

