memory-hygiene
Skill5 starsChanged 5 days agoMITView on GitHub
Manual memory tiering — classify Hot/Warm/Cold, review candidates, and migrate MEMORY.md index + memory files. Use when the session-start advisory fires, MEMORY.md Hot grows past 15 entries, or you want a periodic cleanup. Trigger "memory-hygiene", "整理記憶", "memory 降級", "/memory-hygiene", "decay scan", "tier memory".
11 other projects use a version of this.
Adopted by
Most recently taken up by
- BSSE23047/nauraiz-devtheir own version, first seen Nov 8, 2026
- mahsumaktas/agent-evolution-kittheir own version, first seen Nov 8, 2026
- Kein-chronicle/claude-code-memory-linttheir own version, first seen Nov 1, 2026
- GH-Mason/agent-memory-disciplinetheir own version, first seen Sep 24, 2026
- NecturaLabs/AgentSkillstheir own version, first seen Sep 24, 2026
- ritmillio/skillstheir own version, first seen Aug 23, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- huytieu/COG-second-brain★ 1.3ksame name
- NUX-Design/claude-skills-fable-opus★ 24same name
- megandmartin/agent-skills-repo★ 4same name
- BSSE23047/nauraiz-dev★ 2same name
- mahsumaktas/agent-evolution-kit★ 2same name
- NecturaLabs/AgentSkills★ 1same name
- NITISH-R-G/agent-memory-protocol★ 1same name
- chanjalme/claude-skills★ 0same name
- GH-Mason/agent-memory-discipline★ 0same name
- Kein-chronicle/claude-code-memory-lint★ 0same name
1 more not listed
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 repository19 other files it gives its agents.
- .codex/AGENTS.mdAGENTS.md
- .claude/instructions/runtime/claude.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- check-your-own-workSkill
- command-postSkill
- driving-work-to-doneSkill
- engineeringSkill
- framework-self-devSkill
- learningSkill
- pr-pickupSkill
- refinementSkill
- request-pr-reviewSkill
- review-inboxSkill
- review-prSkill
- standupSkill
- swe-knowledgeSkill
- verify-acSkill
- visual-regressionSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 94
Do not hard-code user-specific memory paths.
- Distinctive: line 95
Do not auto-move pinned memories.
- Distinctive: line 98
If apply finds anomalies, record at most one framework-experience memory.
“Common” is measured: kept by at least 6 in 10 of the 10 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
memory-hygiene 是 manual memory tiering:檢查 Hot / Warm / Cold,產生 demotion
candidate,並在使用者確認後搬移 memory files 與更新 index。
Contract
這是 memory maintenance skill,不是一般 task planning。Scan / dry-run 只讀;apply 會寫 workspace memory,因此必須先有本 session 的 dry-run 結果與使用者明確確認。
Mode Routing
| User says | Mode | Reference |
/memory-hygiene, memory-hygiene, default | scan | memory-hygiene-scan-flow.md |
dry-run, full report, 看看所有分類 | dry-run | memory-hygiene-scan-flow.md |
apply, 搬檔, 執行, migrate | apply | memory-hygiene-apply-flow.md |
retire, 退休, 清掉做完的, 過期的 memory | retire | 見〈退休〉 |
退休:記進度的 memory,在它記的工作收斂之後就走
python3 .claude/skills/memory-hygiene/scripts/memory-hygiene-tiering.py retire \
--memory-dir {memory_dir} # 預覽,什麼都不動
python3 .claude/skills/memory-hygiene/scripts/memory-hygiene-tiering.py retire \
--memory-dir {memory_dir} --execute # 真的搬分層不是退休。 Hot → Warm 只是換一個資料夾躺著,索引還是指得到它。退休問的是另一
個問題:這份東西記的工作還活著嗎。type: project 記的是「現在做到哪」,那件工作收斂之後
它就不再是任何人的下一步了。
判定的依據是那張單自己的狀態({單}/.spine/loop-state.json 的 status),不是誰記得
要來清——這一層已經有兩個手動退休到一半就停下來的資料夾。單號從 snapshot_of 或檔名取,
不掃內文:一份 handoff 會順帶提到十幾張單,拿內文去判會把還在用的錨點記錄,判成某張
早就收斂的單的殘骸。
四件事不退休,而且每一種都會被數出來印在報告上:type 不是 project 的、pinned: true
的(那是人的判斷,機械規則不得蓋過它)、單還在進行的、以及找不到那張單容器的。最後
那一種特別重要:把查不到當成做完了,退休掉的就是還在用的東西。
退休 = 搬進 archive/ 並從索引上拿掉,不刪檔。搬的時候會一併把指向它的連結、以及
它自己的相對連結重新算過——換了目錄,相對路徑的起點就換了,兩邊都會變成死指標。
Reference Loading
| Situation | Load |
| Any run | polaris-project-dir.md, feedback-memory-procedures.md |
| Scan / dry-run | memory-hygiene-scan-flow.md |
| Apply | memory-hygiene-apply-flow.md |
| 要寫一份 memory(不是維護它) | memory-write-contract.md |
memory-write-contract.md 講的是寫入端:檔案放哪個資料夾、指標寫進哪一份索引、Hot 的
軟上限、以及 pinned / topic 兩個分層欄位。它以前住在使用者機器上的常駐指示檔裡,那個
位置沒有任何關卡看得見——規矩要跟著執行它的東西走,而消費那兩個欄位的腳本就在這支 skill 的
scripts/ 底下。
Classification rules live in .claude/skills/memory-hygiene/scripts/memory-hygiene-tiering.py and
_template/rule-examples/feedback-and-memory.md Memory Tiering.
Plan artifact authority lives in bash .claude/skills/memory-hygiene/scripts/validate-memory-hygiene-plan.sh。
apply 不應直接吃任意 JSON;必須先通過 plan validator。
Hard Rules
- Apply requires prior dry-run in the same session.
- Do not hard-code user-specific memory paths; resolve active workspace memory dir.
- Do not auto-move pinned memories.
- 不刪除 Cold memories;archive 是 historical context。
- Routine migrations 不建立 feedback memory。
- If apply finds anomalies, record at most one framework-experience memory.
- Canonical apply chain is
dry-run --json | validate-memory-hygiene-plan.sh | apply;不要手動改 plan JSON 後直接餵 apply。 - apply 一定把 Hot 收斂到 ≤ 15,
MEMORY_HOT_CAPACITYenv 可覆寫這個數字;超量的依確定性 ranking 自動降 Warm。 - pinned 與帶 graduated_to 的 memory 永遠不被擠出 Hot。
- 被擠出的檔名列在 migration log,標
overflowed-hot-capacity。 - plan 含 nested_frontmatter 時 chain 照樣跑得通:validator 只把它列進 warnings,由 apply 內部
normalize,不需要
POLARIS_MEMORY_HYGIENE_APPLY=1bypass。
Completion
Return mode, memory dir, Hot/Warm/Cold counts when available, candidate summary, apply status, files moved, migration log path, and any anomalies.
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.

