memory-hygiene

memory-hygiene is a skill for Claude Code from alexmond/alexmskills. It costs 103 tokens per session (1,515 once invoked), scanned A, original, MIT.

A skill for checking agent-written memory files against the current project files and removing or flagging facts that are no longer true. It also checks the memory index and required format.

In plain words
What is it for?
Use it to audit project or personal agent memory, find vanished files and stale facts, and identify memory entries that need correction or invalidation.
Why use it?
Stored notes can become outdated when files, paths, versions, or project behavior change, causing the agent to rely on false information.

Skill for Claude Code

Written for Claude Code: SessionStart hook event. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Codex.

Part of the memory-hygiene plugin — 1 skill shipped together

Good fit Use it to audit project or personal agent memory, find vanished files and stale facts, and identify memory entries that need correction or invalidation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alexmond/alexmskills/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 alexmond/alexmskills --skill memory-hygiene
Clone the repo
git clone --depth 1 https://github.com/alexmond/alexmskills

Made for: Claude Code.

Or install memory-hygiene, the plugin that ships this one along with the rest of its 1 skill.

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/alexmond/alexmskills/memory-hygiene/github.svg)](https://agentmods.dev/skills/alexmond/alexmskills/memory-hygiene)
Your own site
<a href="https://agentmods.dev/skills/alexmond/alexmskills/memory-hygiene"><img src="https://agentmods.dev/badge/skills/alexmond/alexmskills/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/alexmond/alexmskills/memory-hygiene"><img src="https://agentmods.dev/badge/skills/alexmond/alexmskills/memory-hygiene.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,515 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Rogue Agent · line 81
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
  • medium Rogue Agent · line 81
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
How audits are shown
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.00103 $0.01515
Opus 5.5 $0.00041 $0.00606
Sonnet 5.5 $0.00021 $0.00303
Haiku 4.5 $0.00010 $0.00152

Measured 1mo ago against content hash fcd28fca4dac, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo ago.

The scan reads SKILL.md. This mod also ships 4 executable files (audit-memory.py, freshness.py, lint-memory-write.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.

plugins/memory-hygiene/skills/memory-hygiene/SKILL.md · 123 lines

How it starts

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

Codex: Read the client path before applying this workflow.

memory-hygiene

CLAUDE.md has evolving-claude-md; this governs the other half of the context loaded every session — the per-project memory directory the agent writes largely unsupervised. The failure modes differ, and that difference is the whole design: bloat makes an agent ignore instructions; rot makes it confidently recall something false. So where the sibling prunes down, this one re-verifies and invalidates.

evolving-claude-md memory-hygiene
Governs CLAUDE.md + companions (repo-scoped, committed) ~/.claude/projects/<slug>/memory/ (user-global, personal)
Author human, agent proposes agent, mostly unsupervised
Failure mode bloat → ignored rot → confident wrong recall
Pressure prune down re-verify / invalidate

Both vendor the same freshness.py core, so "is this fact still true on disk?" has exactly one implementation.

What the sweep checks (all grounded, nothing pattern-only)

The SessionStart hook runs audit-memory.py against the current repo's memory dir. Silent when healthy; otherwise a 📇 banner lists rot candidates:

  • Vanished artifact — a backticked path/class/flag git grep can no longer find, and that isn't a path on disk. Memory-specific filters first: --flags, <placeholders>, ...-abbreviated paths, and paths rooted outside this tree (infra/secrets.md cited from another repo is a pointer, not rot here) are never checked. Flagged at ≥2 missing tokens per file (min_missing_artifacts).
  • Stale version pin — memory states jhelm 1.3.1, the build file (Maven, Gradle, npm, Go, Cargo, Python, .NET, Bundler, Composer, or a toolchain pin file such as .nvmrc) now says 1.5.0. Fires only when every parseable build-file spec contradicts the claim; release lines (4.1.x), examples, and struck-through lines stay silent.
  • Stale sequence fact — "latest is V27" once V28__*.sql exists.
  • Index drift, both directions — MEMORY.md lines pointing at files that no longer exist, and memory files with no index line (invisible to recall).

Read the full file on GitHub · 123 lines

Files

What ships with it

5 files 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.

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. 1mo ago Changed · +2 lines fcd28fca4dac
  2. 2mo ago Changed · +3 lines aacf98f6cab4
  3. 3mo ago First seen · 118 lines · 103 tokens per session scan A 6a1a60476743

Subscribe to this mod's changes

memory-hygiene is a skill published in the GitHub repository alexmond/alexmskills (11 stars, last pushed 1mo ago), licensed MIT. It adds 103 tokens to every session and 1,515 once invoked, about $0.0004 per session on Opus 5.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

memory-hygiene compared with skills from other repositories

memory-hygiene next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
memory-hygienealexmond/alexmskillsSkill111mo agoMITA103Claude Code
weekly-digeststhedotmack/claude-memSkill122ktodayApache-2.0A93Claude Code
cloud-syncthedotmack/claude-memSkill122ktodayApache-2.0A64Claude Code
screenpipethedotmack/claude-memSkill122ktodayApache-2.0A46Claude Code
emerging-techniques-long-contextdavila7/claude-code-templatesSkill35ktodayMITA78Claude Code, Codex
forgetasgeirtj/system_prompts_leaksSkill74ktodayCC0-1.0A0Claude Code, Codex
hive.note-takingaden-hive/hiveSkill11k4d agoApache-2.0A30Claude Code, Codex