memory-hygiene
Skill0 starsChanged 8 months agoMITView on GitHub
Maintain persistent memory files (CLAUDE.md, MEMORY.md, rules indexes) so they actually load and stay useful. Use when adding, editing, or auditing memory entries — to prevent silent truncation, orphan files, and split sections.
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
- marcelopaniza/mempennytheir 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
- marcelopaniza/mempenny★ 2same name
- NITISH-R-G/agent-memory-protocol★ 1same name
- chanjalme/claude-skills★ 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 repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- anti-hallucinationSkill
- hostile-self-reviewSkill
- session-closerSkill
- simplicity-firstSkill
- surgical-editsSkill
- think-before-codingSkill
- verifiable-criteriaSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
4
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
- Very specific: line 31
If "Feedback" appears at line 50 and again at line 220, half is loaded and half is silently lost.
- Distinctive: line 44
Run this whenever you add a memory file.
- Distinctive: line 48
When you add a new memory entry, check the line number of the new entry vs.
- Distinctive: line 57
When the index approaches the load window, do NOT just keep appending.
- Distinctive: line 71
Run periodically (monthly, or whenever the file feels bloated):
“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
Persistent memory only works if it gets loaded. Most memory systems have a load window (line limit, token limit, or context budget). Entries past the window exist on disk but never reach the model. They become silent dead weight: the user thinks the rule is in effect, the agent never sees it.
This skill is for any project that uses Claude Code's MEMORY.md, CLAUDE.md, or a similar rules index.
The rules
1. Know your load window
Find the limit. For Claude Code's auto-memory: first 200 lines of MEMORY.md. Past that, truncated. Other tools have token limits or section limits — find yours and write it at the top of the file.
2. Keep index entries one line, ≤150 characters
Index files are indexes, not content. Each entry: title, link, one-line hook.
- [Topic title](path/to/topic.md) — one-line hookLong entries push later entries past the truncation line. Detail goes in the linked file, never in the index.
3. One section per topic, never split
If "Feedback" appears at line 50 and again at line 220, half is loaded and half is silently lost. Audit periodically: grep -n '^## ' MEMORY.md to see all section headers.
4. Detect orphans regularly
Files that exist on disk but are not referenced from the index are dead. They will never be loaded.
cd memory/
for f in feedback_*.md; do
grep -q "$f" MEMORY.md || echo "ORPHAN: $f"
doneRun this whenever you add a memory file. If anything prints, fix it (add to index or delete the file).
5. Verify load on add
When you add a new memory entry, check the line number of the new entry vs. the load window. If you put it at line 250 and the window is 200, it does not work. Move it up.
grep -n "feedback_new_thing.md" MEMORY.md
# If line number > load window, move it.6. Compress before adding
When the index approaches the load window, do NOT just keep appending. Audit:
- Are any entries duplicated across sections?
- Are any verbose entries that could become one-liners?
- Are any obsolete (project killed, decision reversed, lesson superseded)?
- Are any project-specific deep details that belong in their topic file, not the index?
Compress first. Add second.
7. Backup before restructure
Any large rewrite of a memory index: copy to MEMORY.md.backup-YYYY-MM-DD first. Restructures lose information surprisingly often. Backup is cheap insurance.
Audit checklist
Run periodically (monthly, or whenever the file feels bloated):
1. Total lines vs. load window? (target: ≤ window − 5 line safety margin)
2. Orphan files? (target: 0)
3. Sections appearing twice? (target: 0)
4. Entries >150 chars? (target: refactor each)
5. Entries past load window? (target: 0)
6. Backup exists from last restructure? (target: yes)Why this is in Karpathy Pro Max
Memory hygiene is invisible until it fails. The user adds a feedback rule, sees it on disk, assumes it works. Six months later they wonder why the agent keeps making the same mistake. The rule was real, the file existed, but it never loaded — buried past line 240 of a 360-line index.
Most rule systems die this way. This skill prevents it.
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.

