memory-hygiene
Skill2 starsChanged 5 months agoMITView on GitHub
Load this skill when the user asks how to write, prune, or manage their Claude Code auto-memory files. Covers the strategy hierarchy (delete > archive > distill > compress > keep), recognition heuristics for stale memories, the forward-looking-truth principle, and write-time discipline.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- HsuanYuLee/polaristheir own version, first seen Sep 29, 2026
- GH-Mason/agent-memory-disciplinetheir own version, first seen Sep 24, 2026
- fthsrbst/mnematheir own version, first seen Aug 22, 2026
- NITISH-R-G/agent-memory-protocoltheir own version, first seen Aug 1, 2026
- huytieu/COG-second-braintheir own version, first seen Jul 30, 2026
- NUX-Design/claude-skills-fable-opustheir own version, first seen Jul 7, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- huytieu/COG-second-brain★ 1.3ksame name
- NUX-Design/claude-skills-fable-opus★ 23same name
- HsuanYuLee/polaris★ 5same name
- fthsrbst/mnema★ 2same name
- NITISH-R-G/agent-memory-protocol★ 1same name
- chanjalme/claude-skills★ 0same name
- fbsmna-coder/karpathy-pro-max★ 0same name
- GH-Mason/agent-memory-discipline★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/mempenny.mdcCursor rule
- mempennySkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
1
Distinctive
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 30
When you're looking at a memory file and deciding its fate:
- Very specific: line 71
When in doubt, favor ARCHIVE over DELETE.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Memory Hygiene
Claude Code's auto-memory system is powerful but can rot. Files accumulate across sessions, and the cost of a bloated memory directory is paid on every new conversation. This skill covers how to write memories that don't rot, and how to prune the ones that already did.
The strategy hierarchy
Cheapest action to most expensive. Always pick the cheapest one that applies.
- DELETE — zero tokens, zero loss if the content is truly obsolete. Use when:
- The fix is now in the code (code is authoritative, memory can lie)
- One-shot resolved bug or incident with no future implication
- Explicitly marked "RESOLVED" / "do not re-fix" / "Historical only"
- Superseded by a newer file on the same topic
- ARCHIVE — move to
archive/subdir, remove fromMEMORY.mdindex. The file still exists for forensics if future debugging needs it, but it's out of the auto-load path. Use for completed-but-non-trivial incidents where the story matters, but not for daily lookup. - DISTILL — replace prose narrative with 1-3 sentences of forward-looking truth. The narrative gets dropped; only what future-Claude needs to know remains. This is the most common action on aging memory files.
- COMPRESS — out of scope for memory-hygiene. Compression shrinks prose that's already been through the triage above — it doesn't decide what should be there. Triage first, compress survivors separately (with whatever tool you prefer) if you want additional savings.
- KEEP — active state, architecture reference, recurring rule, or content where the prose is already tight. The default action when none of the above apply.
Recognition heuristics
When you're looking at a memory file and deciding its fate:
- Dated
YYYYMMDDfiles documenting a one-day incident → usually DISTILL or ARCHIVE. The date in the filename is a strong signal that it's a snapshot that's aging. - Files containing "RESOLVED", "verified clean", "fixed in", "do not re-fix" → likely DELETE or ARCHIVE. The file is telling you its own lifecycle is over.
- Architecture / service / protocol / reference docs → KEEP. These are the stable substrate.
- Single test-run results → DISTILL to "what's now true" after that test run.
- Files >5 KB with narrative prose → DISTILL aggressively. Narrative is almost never load-bearing for future-Claude.
- Small stable reference files (usually under 2 KB) → KEEP. Low cost, high density.
The forward-looking-truth principle
Memory captures what future-Claude needs to know, not what past-Claude experienced.
- Narrative "what happened" is git-log territory. Don't duplicate it in memory.
- Fixes that are now in the code are authoritative from the code. Memory that repeats them will eventually disagree and mislead.
- The load-bearing part of any postmortem is almost always 1-3 sentences. If you can't find it, the memory is probably all narrative.
Test: "If I read this file in three weeks with no other context, what's the one thing I need it to tell me?" That one thing is the memory. Everything else is bloat.
Write-time discipline
The best memories are born lean. Five rules:
- Search before writing — if a relevant memory already exists, update it instead of creating a new one. Duplicate memories are the biggest source of rot.
- Distill as you write — don't plan to "clean up later". Write the forward-looking sentence first, then stop. The narrative you'd be tempted to add is in git.
- Include the "why" in feedback memories — so future edge cases can be judged, not just blindly followed. A rule without a reason becomes brittle.
- Delete in the same session you learn something is obsolete — the moment you notice a memory is stale, kill it. Dead memories accumulate if you defer.
- Make
MEMORY.mddescriptions specific — vague descriptions ("various fixes") cause unnecessary loads. Specific descriptions ("retry policy: exponential backoff, max 5, gives up on 4xx") let future-Claude filter more accurately.
The overall principle
"Save tokens with common sense, without loss."
Lean memory isn't about being aggressive — it's about being honest about what's load-bearing. A 10 KB file with two load-bearing sentences should become a 2-sentence file. A 10 KB file where every line is load-bearing should stay exactly as it is.
The judgment call is always: does future-Claude need the narrative, or just the conclusion?
The conclusion is what matters 99% of the time. Narrative lives in git.
When in doubt
When in doubt, favor ARCHIVE over DELETE. ARCHIVE is reversible (move back out of archive/), DELETE is not (unless there's a backup). The goal is "without loss", not "maximum savings at any cost".
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.

