Getting it into your agent
This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.
/plugin marketplace add wan-huiyan/claude-ecosystem-hygiene/plugin install memory-hygieneWrote 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.
[](https://agentmods.dev/skills/wan-huiyan/claude-ecosystem-hygiene/memory-hygiene)<a href="https://agentmods.dev/skills/wan-huiyan/claude-ecosystem-hygiene/memory-hygiene"><img src="https://agentmods.dev/badge/skills/wan-huiyan/claude-ecosystem-hygiene/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.
<a href="https://agentmods.dev/skills/wan-huiyan/claude-ecosystem-hygiene/memory-hygiene"><img src="https://agentmods.dev/badge/skills/wan-huiyan/claude-ecosystem-hygiene/memory-hygiene.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00166 | $0.09996 |
| Opus 5 | $0.00083 | $0.04998 |
| Sonnet 5 | $0.00033 | $0.01999 |
| Haiku 4.5 | $0.00017 | $0.01000 |
Grade A, and why
memory-hygiene scanned grade A with 1 finding 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 11d ago.
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.
Reads agent configuration directorieslowAgent snooping
.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.
[ -f "$S" ] || S="$(find -L "$HOME/.claude/plugins/cache" -mindepth 5 -maxdepth 5 \ Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.
How it starts
The opening of the file, as written. The whole thing — 577 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Memory Hygiene v3.5 — Audit & Cleanup
This skill audits Claude Code's persistent knowledge stores (axioms, MEMORY.md — both auto-memory and in-repo, memory topic files, lessons, phase templates, ADRs, and the project docs/ taxonomy) for structural problems that degrade future session quality. It produces a structured report, gets user approval, then executes fixes.
v3.5 adds mechanism-claim integrity (§1k). §1i catches a fabricated label; §1k catches a fabricated cause. On 2026-08-07 a memory recorded a PR that deleted 5,081 lines of four sessions' merged work and blamed "a branch cut before those merges and never rebased" — measured afterwards, the branch's parent WAS the newest commit on main and a rebase would have been a no-op. The memory was internally coherent, well written, about a real incident, and routed every reader to a check that PASSES. §1k flags incident memories that assert a cause with no way to re-derive it, catches the mechanism restated in description: and the MEMORY.md line (what recall matches on), and reports groups of memories about the same incident whose causes conflict.
v3.4 fixes the cross-plugin script lookup in §1i. The label_audit.py call reached for ~/.claude/skills/session-handoff/scripts/ only. On a plugin install that path does not exist — the script lives under ~/.claude/plugins/cache/<marketplace>/session-handoff/<version>/scripts/ — so the sub-check resolved to nothing, logged "not installed", and the audit still reported clean. §1i now resolves the script across all three install roots and reports a miss as a skipped check.
v3.3 adds label-table integrity audit (§1i) and project docs/ taxonomy audit (§1j). The 7-bucket taxonomy that session-handoff dispatches to is now defined here as source-of-truth — previously session-handoff referenced "memory-hygiene v3.1" for this but the definition lived nowhere. §1i catches fabricated code→label tables in lessons.md / feedback_*.md / reference_*.md that bypass the author-side gate session-handoff runs in its Phase 0.
v3.2 adds in-repo MEMORY.md detection (§1a2) — the A/B counterfactual harness (n=3, 2026-04-21) showed that in-repo MEMORY.md files (e.g., project-root MEMORY.md or docs/MEMORY.md) survive a CLAUDE_CONFIG_DIR clean env and drive measurable success on tasks that the ~/.claude/projects/*/memory/MEMORY.md auto-memory file cannot. v3.1's §1a scanned only the auto-memory MEMORY.md, making the in-repo counterpart invisible to memory hygiene. v3.2 scans both and reports them as separate tiers in the audit output (T1 auto-memory and T1-repo).
v3.1 added feedback lifecycle detection (§1c2) — classifying each feedback_*.md file as Incorporated / Pending / Dormant / Superseded based on whether its rule has been promoted to axioms/lessons/templates — and emits a feedback_incorporation_rate metric for downstream consumers like ecosystem-audit.
v3.0 added phase template management, three-category axiom classification (Universal/Role/Phase), capacity ceiling enforcement, agency-aware staleness detection, and path-scoped rule auditing. Backed by research from cognitive science (Cowan 2001), LLM research (Liu et al. 2024 TACL, EMNLP 2025, Chroma Context Rot 2025), KM theory (Markus 2001), and SRE practice (Google SRE post-mortem framework). Full sources in ~/Documents/memory_hygiene_guide.md.
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 11d ago First seen · 577 lines · 166 tokens per session scan A 5836fdd7e4dd
memory-hygiene is a skill published in the GitHub repository wan-huiyan/claude-ecosystem-hygiene (1 stars, last pushed 25d ago), licensed MIT. It adds 166 tokens to every session and 9,996 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
session-handoff
End-of-session handoff that captures session knowledge, dispatches output across the canonical 7-bucket docs/ taxonomy (decisions/runbooks/analysis/references/reviews/handoffs/deliverables — aligned with memory-hygiene v3.3), triggers a doc-freshness reverse-lint + skill-freshness audit to catch stale normative…
llm-wiki
Build and maintain an LLM-curated personal knowledge base — the "LLM Wiki" pattern from Andrej Karpathy's April 2026 gist. Use this skill whenever the user wants to ingest a source (paper, article, transcript, PDF, notes) into a persistent compounding knowledge base, ask a question against accumulated notes, lint or…
reflect
Per-project self-improvement - reads the .harness ledger and feedback memories, then proposes gated rule/threshold/ADR changes so the project stops repeating mistakes. Run periodically.
remember
Review auto-memory entries and propose promotions to CLAUDE.md, CLAUDE.local.md, or shared memory. Also detects outdated, conflicting, and duplicate entries across memory layers.
ucai-patterns
Use when the user asks about Claude Code best practices, how to write agents, how to use hooks, how to manage context, or how to work effectively with Claude Code's native systems.
dream
Memory consolidation - review, merge, prune, and index memory files. Run periodically to keep memories organized and up-to-date.