memory-hygiene

memory-hygiene is a skill for Claude Code from HsuanYuLee/polaris. It costs 164 tokens per session (1,658 once invoked), scanned A, original, MIT.

A manual tool for sorting saved session memories into Hot, Warm, and Cold groups, and finding memories that may be moved or retired.

In plain words
What is it for?
Scanning memory, preparing a dry-run report, moving old memories after confirmation, and retiring notes for completed work.
Why use it?
It keeps stored project notes manageable while requiring review before files are moved or changed.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths.

Good fit Scanning memory, preparing a dry-run report, moving old memories after confirmation, and retiring notes for completed work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hsuanyulee/polaris/memory-hygiene
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add HsuanYuLee/polaris --skill memory-hygiene
Clone the repo
git clone --depth 1 https://github.com/HsuanYuLee/polaris

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for memory-hygiene

README.md
[![agentmods](https://agentmods.dev/badge/skills/hsuanyulee/polaris/memory-hygiene/github.svg)](https://agentmods.dev/skills/hsuanyulee/polaris/memory-hygiene)
Your own site
<a href="https://agentmods.dev/skills/hsuanyulee/polaris/memory-hygiene"><img src="https://agentmods.dev/badge/skills/hsuanyulee/polaris/memory-hygiene/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for memory-hygiene

Your own site · 80×15
<a href="https://agentmods.dev/skills/hsuanyulee/polaris/memory-hygiene"><img src="https://agentmods.dev/badge/skills/hsuanyulee/polaris/memory-hygiene.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 164 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,658 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00164 $0.01658
Opus 5 $0.00082 $0.00829
Sonnet 5 $0.00033 $0.00332
Haiku 4.5 $0.00016 $0.00166

Measured 9d ago against content hash 24a36fd11684, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

memory-hygiene scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

The scan reads SKILL.md. This mod also ships 4 executable files (scripts/lib/validate_memory_hygiene_plan_1.py, scripts/memory-hygiene-tiering.py, scripts/skill-sanitizer.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/memory-hygiene/SKILL.md · 111 lines

How it starts

The opening of the file, as written. The whole thing — 111 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.jsonstatus),不是誰記得 要來清——這一層已經有兩個手動退休到一半就停下來的資料夾。單號從 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.

Read the full file on GitHub · 111 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 111 lines · 164 tokens per session scan A 24a36fd11684

Subscribe to this mod's changes

memory-hygiene is a skill published in the GitHub repository HsuanYuLee/polaris (5 stars, last pushed yesterday), licensed MIT. It adds 164 tokens to every session and 1,658 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

self-improve

Extract lessons from the current session, or sweep the project's past sessions when asked, and route them to the appropriate knowledge layer (project AGENTS.md, auto memory, existing skills, or new skills). Use when the user asks to "self-improve", "distill this session", "distill past sessions", "sweep past…

tobihagemann/turbo · 125 tokens

recall-reasoning

Recall the reasoning behind a past change by locating the Claude Code transcript that produced it. Use when the user asks to "recall reasoning", "find reasoning", "look up reasoning", "recall implementation reasoning", "find the rationale", "why did I do X", "recall from transcripts", or "find the transcript for this…

tobihagemann/turbo · 76 tokens

project-context-steward

A project-documentation skill that scans a new project or several related code repositories and records their shared context in a PROJECT_CONTEXT.md file. It captures the product, users, workflows, architecture, repository boundaries, terminology, entry points, and known pitfalls.

PANGKAIFENG/ai-product-manager-skills · 115 tokens

session-manager

A fallback skill for recording development sessions and restoring project context from an Obsidian vault, a folder of linked notes. It handles explicit resume, handoff, status, and end-of-session requests when automatic capture is unavailable.

Enakoneschniy/claude-dev-stack · 108 tokens

remember

Save what matters at the end of a session so the next session picks up exactly where you left off. Or restore context at the start of a new session so nothing is lost between them — and never trust this conversation's own memory over what's actually on disk.

partikularwaters/Banka · 54 tokens

moor

After building any UI component or resolving a notable engineering outcome, extract what matters and save it to the correct project file — the UI registry for UI patterns, the session-state file for everything else. So every future session builds on what's already established instead of drifting from it.

partikularwaters/Banka · 56 tokens