Skip to content
Back to skills

Memory Hygiene

ASecurity

Clean up project memory: 'clean up my memory', 'prune the knowledge files', MEMORY.md too long. Finds stale or relative-dated entries, dead file references. Not for adding a lesson (capture-lesson).

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
ai-agentsgobashnextjsnodegit

Works with

  • claude code

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add BSSE23047/nauraiz-dev --skill memory-hygiene --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Memory Hygiene?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Memory Hygiene
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/bsse23047-memory-hygiene/badge)](https://www.skillsdirectory.com/skills/bsse23047-memory-hygiene)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: memory-hygiene
description: "Clean up project memory: 'clean up my memory', 'prune the knowledge files', MEMORY.md too long. Finds stale or relative-dated entries, dead file references. Not for adding a lesson (capture-lesson)."
allowed-tools: Read Edit Glob Grep Bash(node "${CLAUDE_PLUGIN_ROOT}/scripts/memory/scan.mjs" *)
---

# memory-hygiene

Memory rots: "yesterday" means nothing a week later, files get renamed, facts stop being
true. This finds the rot and proposes fixes; the owner approves each one.

"Stop" and "ask" mean: end your turn with the question and wait.

1. **Find the folders.** The project's `.claude/knowledge` and `.claude/rules` (those
   that exist), and the auto-memory folder: Glob `*/memory/MEMORY.md` in
   `<home>/.claude/projects` and take the folder named like the current directory with
   every non-alphanumeric character replaced by `-`, compared case-insensitively. No match:
   scan without it and say so.

   `local` mode (the session header shows `mode=local`, or `.claude/nauraiz-dev.local.json`
   exists and `.claude/nauraiz-dev.json` does not): edits go **only inside the auto-memory
   folder**. For `.claude/knowledge` and `.claude/rules` list the proposals but never apply
   them: those files are tracked.

2. **Scan.** Run `node "${CLAUDE_PLUGIN_ROOT}/scripts/memory/scan.mjs" <dir>...` with
   those folders (quote paths; add `--today <date>` only if asked). It prints JSON: per
   file `lines`, `bytes`, `relativeDates`, `staleSince`, `missingRefs`, `brokenLinks`,
   and `index` for `MEMORY.md` (`overLimit` above 200 lines or 25,000 bytes).

3. **Check what the script cannot.** Read the files it flagged, plus the index. Look for
   two entries that contradict each other, a fact the code now disproves (Grep to
   check), and entries that duplicate each other. Do not Read files nothing flagged.

4. **Propose, do not edit.** Show one diff-style list, grouped by file:
   - `relativeDates`: rewrite to the absolute date the entry was written (from the
     file's own dates or `git log`); if unknown, ask.
   - `staleSince`: confirm, update or delete. Say the date and the age.
   - `missingRefs` and `brokenLinks`: fix the path, drop the reference, or delete the
     entry if it was only about the missing file. A flag on an ordinary word such as
     `Next.js` is a false alarm: skip it.
   - Contradictions and duplicates: say which entry wins and why.
   - `index.overLimit`: name the entries to merge or drop to get under the limits.
   Then **stop** and ask which to apply.

5. **Apply only the approved ones** with Edit, and in `local` mode only inside the
   auto-memory folder. Edits stay within files: you cannot rename or delete one. When a
   file must go or be renamed, tell the owner which, to do by hand, and keep `MEMORY.md`
   and `knowledge/README.md` in step. Run the scan again and report the counts before and
   after.

6. If the `/doctor` command is available in this Claude Code version, mention it: it
   audits the prompt files this skill does not cover. Do not run it for the owner.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.