memory-hygiene

memory-hygiene is a skill for Claude Code from alexmond/alexmskills. It costs 103 tokens per session (1,457 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.

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,457 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.01457
Opus 5 $0.00051 $0.00728
Sonnet 5 $0.00021 $0.00291
Haiku 4.5 $0.00010 $0.00146

Measured 9d ago against content hash 6a1a60476743, 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 (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 · 118 lines

How it starts

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

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, pom.xml 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 directionsMEMORY.md lines pointing at files that no longer exist, and memory files with no index line (invisible to recall).

Run it on demand for the full list:

Read the full file on GitHub · 118 lines

Files

What ships with it

4 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. 9d 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 (6 stars, last pushed yesterday), licensed MIT. It adds 103 tokens to every session and 1,457 once invoked, about $0.0005 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

continuous-learning-v2

Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.

sangrokjung/claude-forge · 33 tokens

context-engineering

Manage, optimize, and debug Claude Code context windows. Use this skill whenever the user mentions context limits, context window, autocompaction, compaction firing, context rot, losing context mid-session, session degradation, running out of tokens, /compact, CLAUDEAUTOCOMPACTPCTOVERRIDE, context compression…

arturseo-geo/claude-code-skills · 150 tokens

memory-persistence

Implement cross-session memory, persistent agent knowledge, and session continuity for Claude Code. Use this skill whenever the user wants Claude to remember things between sessions, asks how to avoid re-explaining context each day, wants to build a memory system for an agent, mentions CLAUDE.md memory, session files…

arturseo-geo/claude-code-skills · 140 tokens

hive.note-taking

Maintain a free-form scratchpad of decisions, extracted values, and open questions so context pruning doesn't lose anything you still need.

aden-hive/hive · 30 tokens

security-compliance

Guides security professionals in implementing defense-in-depth security architectures, achieving compliance with industry frameworks (SOC2, ISO27001, GDPR, HIPAA), conducting threat modeling and risk assessments, managing security operations and incident response, and embedding security throughout the SDLC.

sangrokjung/claude-forge · 56 tokens

stride-analysis-patterns

Apply STRIDE methodology to systematically identify threats. Use when analyzing system security, conducting threat modeling sessions, or creating security documentation.

sangrokjung/claude-forge · 30 tokens