Memory pruner
Skill zawatton/memory-pruner
Audit and prune Claude Code auto-memory — detects orphans, duplicates, stale facts, and bloat.
npx -y skills add zawatton/memory-prunerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Audit, deduplicate, and prune Claude Code auto-memory files. Detects orphans, broken links, duplicates, staleness, and bloat across MEMORY.md and individual memory files. Triggers: memory audit, memory prune, clean memory, メモリ整理, メモリ監査, プルーニング, 記憶整理
SKILL.md
6.0 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it
memory-pruner
A periodic audit and pruning skill for Claude Code's auto-memory system.
Keeps your memory index healthy by detecting:
- Orphans — memory files not listed in
MEMORY.md - Broken links —
MEMORY.mdentries pointing to missing files - Duplicates — the same fact captured in multiple files
- Staleness — facts that contradict the current state of the project
- Bloat —
MEMORY.mdapproaching the 200-line front-load cap, or individual files drifting beyond focused scope
The skill reports first, acts only on approval. Memory deletion is never automatic.
Trigger keywords
English: memory audit, memory prune, clean memory, memory cleanup, audit memory, prune stale memory
日本語: メモリ整理, メモリ監査, プルーニング, 記憶整理, メモリ統合, 古い記憶を消して, メモリを整理して
Where memory lives
Claude Code writes auto-memory to a per-project directory:
~/.claude/projects/<encoded-project-path>/memory/
├── MEMORY.md ← index, reloaded every turn (truncated past line 200)
├── user_*.md ← role, preferences, knowledge
├── project_*.md ← ongoing work, initiatives, decisions
├── feedback_*.md ← guidance corrections and validated approaches
└── reference_*.md ← pointers to external systems
The exact encoding of <encoded-project-path> depends on your Claude Code version — ask Claude to locate it with ls ~/.claude/projects/ if unsure.
Audit workflow
Step 1 — Load everything
- Read
MEMORY.md. Globall*.mdfiles in the memory directory.- For each file, parse the YAML frontmatter (
name/description/type) and body. - Cross-check: every indexed entry maps to a real file, every real file appears in the index.
Step 2 — Detect issues
Classify findings into five buckets:
2a. Orphan files
Files present on disk but missing from MEMORY.md.
→ Add to index, or delete if obsolete.
2b. Broken links
MEMORY.md entries whose target file does not exist.
→ Remove from index.
2c. Duplicate content
The same fact appears in more than one file. → Merge into a single file, delete the rest.
2d. Stale content
Body contradicts the current state:
- project: dated statements older than ~3 months, unfinished plans whose target date has passed
- feedback: referenced files/skills/commands that have been deleted or significantly changed
- user: user's situation has evolved (role change, new responsibilities, finished project)
- reference: the external system's purpose or location has shifted
→ Update body, or remove entirely.
2e. Bloat
MEMORY.mdover 200 lines (front-load truncation risk)- Individual files over ~50 lines (focus has drifted, consider splitting)
→ Compress, split, or summarize.
Step 3 — Produce a report
Present findings in a structured report before touching any file:
## Memory audit report — <date>
### Stats
- Total files: N
- MEMORY.md lines: N / 200
- Issues detected: N
### Findings
#### Orphans (N)
- filename.md — short description
#### Stale (N)
- filename.md — "XXX" no longer matches YYY
→ suggest: update body to ZZZ
#### Duplicates (N)
- file_a.md ⇄ file_b.md — both cover "XXX"
→ suggest: merge into file_a.md
### Recommended actions
1. …
2. …
Step 4 — Wait for approval
Walk through each recommended action. The user approves or rejects per-item. No file is modified without explicit approval.
Step 5 — Apply approved changes
- Body edits →
Edittool - Deletions → shell
rm(approved items only) - Index updates →
EditonMEMORY.md - Merges → create the merged file, delete originals in a single confirmed step
Step 6 — Post-audit summary
Report back:
- Files updated / deleted / merged
- New
MEMORY.mdline count - Suggested next audit cadence
Staleness heuristics by memory type
project memories
- Phrases like "planned for next month", "will ship by" — check if the target date has passed
- Relative dates ("tomorrow", "this week") — memory type should have stored absolute dates; flag if not
- Strategy / direction statements — compare against current repo state before assuming they are still load-bearing
feedback memories
Grepfor the skill, file, or command referenced — if it no longer exists, the feedback is stranded- Workflow guidance where the underlying workflow has been restructured
user memories
- Cross-check against recent journal entries or user statements in the same session
- Role changes, new projects, finished projects
reference memories
- Skip external URL liveness checks (expensive)
- Check that the described purpose still matches nearby context in memory
Scheduling
Recommended triggers:
- Manual — user asks for a memory audit.
- Periodic — monthly cadence works well. Most users batch it with other housekeeping (calendar review, backups).
Automated execution must still produce a report first — do not let a scheduled prune delete files autonomously.
Guardrails
- Never auto-delete. Every destructive action waits for approval.
- Keep
MEMORY.mdat or under 200 lines; past that, front-load gets truncated. - Keep individual memory files focused — ~50 lines is a healthy ceiling.
- Flag content that should not be in memory at all: code snippets, git history summaries, ephemeral task state, anything derivable from reading the current project.
Credits
- The auto-memory system shape (MEMORY.md + typed files) follows Claude Code's built-in memory conventions.
- Inspired by the "AutoDream" concept (sub-agent periodic memory consolidation).
Gives 0 of the 12 instructions most memory context skills give in ~1.4k tokens
Counted across 674 of the 847 authors here whose files we hold, read 2026-08-06
- inform the user when setup is completein 21 of 674, across 6 files
- confirm the draft with the user before writingin 21 of 674, across 6 files
- update the agent skills block in place if it existsin 21 of 674, across 6 files
- present findings to the userin 20 of 674, across 5 files
- write the three docs files from seed templatesin 20 of 674, across 5 files
- ask the user about each decision one at a timein 19 of 674, across 4 files
- edit CLAUDE.md if it existsin 18 of 674, across 3 files
- explore current repo statein 18 of 674, across 3 files
- do not overwrite user edits to surrounding sectionsin 18 of 674, across 3 files
- back up the original file before overwritingin 16 of 674, across 8 files
- keep the memory index under 200 linesin 15 of 674
- Provide actionable steps and verificationin 13 of 674, across 2 files
Said here and by no other author read
- cross-check index entries against files
- detect broken links in index
- detect duplicate facts across files
- detect stale content contradicting state
- detect bloat over line limits
- report post-audit summary
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.