memory-audit
Skill2 starsChanged 6 days agoMITView on GitHub
Audit the project's memory tree for integrity drift + bloat — orphans, duplicates, broken relations, stale references, schema gaps, uncompressed bodies. Ten dimensions, propose-confirm-commit per finding, read-only by default. Use when the user types /memory-audit. Mode A only — never auto-fires.
14 other projects use a version of this.
Adopted by
Most recently taken up by
- nightscout/AndroidAPStheir own version, first seen Nov 1, 2026
- shakhruz/mila-coretheir own version, first seen Nov 1, 2026
- qwwiwi/agentos-skills-publictheir own version, first seen Nov 1, 2026
- adamlinscott/claude-skillstheir own version, first seen Oct 30, 2026
- AdityaRon/claude-code-harnesstheir own version, first seen Oct 29, 2026
- baberarjumand/agentic_markdown_memory_agent-skilltheir own version, first seen Oct 13, 2026
Other versions14 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 14
- FastLED/FastLED★ 7.5ksame name
- nightscout/AndroidAPS★ 1.2ksame name
- AdityaRon/claude-code-harness★ 14same name
- mfang0126/openclaw-skills★ 4same name
- qwwiwi/agentos-skills-public★ 4same name
- adamlinscott/claude-skills★ 3same name
- shakhruz/mila-core★ 3same name
- andreijirohdev-labs/gen-ai-labs★ 1same name
- brenbuilds1/skills★ 1same name
- kaiitunnz/claude-skills★ 1same name
4 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- autonomizeSkill
- blueprintSkill
- brainstormSkill
- captureSkill
- checkpointSkill
- close-outSkill
- coordinateSkill
- cycleSkill
- deliverSkill
- design-proposalSkill
- discoverSkill
- dispatchSkill
- draft-planSkill
- envisionSkill
- executeSkill
- extract-conventionsSkill
- glossarySkill
- humanizeSkill
- human-viewSkill
- improve-promptSkill
- new-agentSkill
- new-agents-mdSkill
- new-hookSkill
- new-mcpSkill
- orchestrateSkill
- pr-authorSkill
- prepSkill
- pre-pushSkill
- pr-triageSkill
- recapSkill
- retrospect-coreSkill
- reviewSkill
- rulesSkill
- shortcutsSkill
- specSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- update-changelogSkill
- update-codemapSkill
- using-git-worktreesSkill
- visualise-codemapSkill
- visualSkill
- work-stateSkill
- wrapSkill
- write-testsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 9 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Do not auto-fire on session start, post-capture, or any hook.
- Very specific: line 20
Default: ~/.claude/projects/<current-project-slug>/memory/.
- Very specific: line 32
Read <memory-root>/MEMORY.md — the index.
- Distinctive: line 41
If the inventory pass fails on any file (parse error, malformed frontmatter), surface that as the first finding under dimension 2 and …
- Distinctive: line 97
Not referenced from MEMORY.md (already flagged in dimension 1, but re-evaluate here in combination), AND
- Very specific: line 98
No incoming relations: link from any other file (per the reverse-relations map built in step 1), AND
- Very specific: line 99
Not under sessions/ (which are folder-discovered) →
- Distinctive: line 123
Read dimensions.md, *Dimension 9*, and run it.
- Distinctive: line 139
Use this shape (sections omitted when the dimension has zero findings):
- Distinctive: line 163
Wait for user choice (Apply / Skip / Edit / View detail).
- Distinctive: line 171
Never silent-fix. Never bulk-apply.
- Distinctive: line 173
After processing all findings (or the user signals "stop"), emit a summary:
- Distinctive: line 179
After the first successful audit on a given memory tree, offer a recurring schedule per the schedule-skill's proactive-offer pattern:
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
memory-audit
Sibling of review — same flow, but scoped to the memory tree (~/.claude/projects/<slug>/memory/) instead of code.
When to run
- User types
/memory-audit(explicit trigger). - User says "check my memory for drift," "audit my notes," "are there stale references."
- Scheduled run via
/schedule— weekly cadence is a natural fit (see "Schedule offer" below). - Do not auto-fire on session start, post-capture, or any hook. Mode A only.
Inputs
- Audit scope.
- Default:
~/.claude/projects/<current-project-slug>/memory/. Resolve the slug the same way discover does (Glob~/.claude/projects/*/memory/MEMORY.md, pick by project-root match). --project <slug>→ audit a specific other project's memory tree. Useful for cross-project hygiene.--check <dimension>→ run only one dimension (skip the others). Dimensions named below.
- Default:
- No content arguments — audit consumes the existing memory tree, not new content.
Procedure
1. Inventory the tree
Build the working set:
- Glob
<memory-root>/**/*.md— every memory file plus session-recaps. - Read
<memory-root>/MEMORY.md— the index. - For each memory file: parse frontmatter (
name,description,type,kind,scope,relevance,relations,superseded_by); capture the body's first paragraph for duplicate detection. Batch the Reads — independent files in one message, not one call per file. - For session-recap files (under
sessions/<date>-<slug>.md): parse filename and frontmatter only; bodies are not scanned for content checks.
Build maps:
path → frontmatterfor every file.MEMORY.md line → target pathfor every index entry.path → list of incoming relations(computed by reverse-walking every file'srelations:field — used for orphan detection in dimension 6).
If the inventory pass fails on any file (parse error, malformed frontmatter), surface that as the first finding under dimension 2 and continue with what parsed. Don't abort the whole audit because one file is broken.
2. Run each dimension
Ten dimensions, run in parallel where possible. Each dimension produces zero or more findings; each finding includes:
- Dimension label.
- File path (and line number where applicable).
- Description (one-line, specific).
- Suggested fix (concrete, not "consider X"). When no obvious fix exists, mark "user judgment required" rather than inventing one.
Dimension 1 — MEMORY.md index drift
- Files in the inventory not referenced from MEMORY.md → flag as "missing index entry" (suggest: add an index line). Exception:
sessions/files are folder-discovered and exempt. - MEMORY.md entries pointing to files that don't exist → flag "broken index link" (suggest: remove the entry, or confirm the file was renamed and update the path).
- MEMORY.md entries with paths that don't match the current file location (file was moved into a subfolder, link not updated) → flag "stale index path" (suggest: update the path to match the file's actual location).
Dimension 2 — Frontmatter validity
- Missing required fields per
claude-md/memory-capture.md(name,description,type,scope,relevance— all mandatory) → flag the gap. Exception:type: session-recapfiles are exempt fromrelevance— recaps are episodic records, not relevance-gated rules, and their frontmatter deliberately omits it. typenot in{user | feedback | project | reference | session-recap}→ flag.kind(when present) not in{architectural-rule | decision | lesson | preference | warning}→ flag.scopeempty AND body is clearly domain-specific (heuristic: body mentions a specific module, language, or domain in the first paragraph) → flag for user judgment, suggest a more specific scope. Don't auto-fix — scope is judgment-laden.relevancemissing or empty → flag.superseded_by: retiredwithout aretired_reason:→ flag "retired without reason" (suggest: add one line on why it was wrong).
Dimension 3 — Broken relations: links
Skip silently when no memory file in the inventory has relations: populated (legacy mode — typed relations not yet adopted in this tree).
For every relations: entry across all files:
- Target file does not exist → flag "broken relation link" (suggest: remove the relation, or confirm the target was moved and update the path).
relations.typenot in{supersedes | contradicts | supports | related_to}→ flag.supersedes: targetbut target doesn't havesuperseded_by: <this-file>(or vice versa) → flag "bidirectional integrity broken" (suggest: add the missing back-pointer).superseded_by: retiredhas no target by design; skip it here.
Dimension 4 — Duplicate detection
For every pair of memory files where:
scopesets overlap by ≥1 tag, AND- The body's first-paragraph tokens overlap by ≥80% (tokenize on whitespace + punctuation, drop stopwords, compare as sets) —
flag as "possible duplicate" with both file paths. Suggest: review and decide whether to merge, supersede one with the other, or accept as intentional siblings (e.g. one general rule, one specific instance).
This is a heuristic — high false-positive rate is acceptable since the user makes the merge call. Do not auto-merge.
Dimension 5 — Stale references
Scan each memory file's body for:
- Repo-relative paths that look like real file references (
contexture/skills/X/,another-repo/research/Y.md,~/.claude/something). For each, check existence on disk. Missing → flag "reference to missing file" (suggest: update the reference, or remove if no longer relevant). - Git commit hashes (7-40 hex chars in a context that looks like a hash reference — preceded by "commit", "in
", "(hash)"). For each, rungit rev-parse --verify<hash>` against the relevant repo (memory body usually names the repo). If unresolvable, flag "stale commit reference." - Design-doc / slot numbers a memory cites by id — cross-reference against the project's planning docs; if renumbered or materially changed, flag "outdated reference."
The git and design-doc checks require knowing which repo / project to query; use the memory's scope tags as hints. Skip checks where the repo can't be located rather than asserting failures. Note in the report: "git checks skipped — repo not located."
Dimension 6 — Orphan files
For each file in the inventory:
- Not referenced from MEMORY.md (already flagged in dimension 1, but re-evaluate here in combination), AND
- No incoming
relations:link from any other file (per the reverse-relations map built in step 1), AND - Not under
sessions/(which are folder-discovered) →
flag as "orphan candidate." Suggest: add to MEMORY.md, link from a related memory, or archive/remove if no longer relevant.
A file orphaned in MEMORY.md but reachable via a relation is not an orphan — it's findable through the relations graph. The dual-isolation criterion is what makes this a real orphan.
Dimension 7 — Superseded memories still surfacing
For each MEMORY.md entry whose target file has superseded_by: set in its frontmatter →
- Flag "superseded entry in index" (suggest: remove the index line; the entry remains readable in the file but should not be in the active index).
This catches the case where supersession was recorded in frontmatter but MEMORY.md wasn't updated in the same step. Discovery already excludes superseded entries from the normal pool, but the index drift confuses readers and inflates the index.
Dimension 8 — Session-recap schema
For every file under <memory-root>/sessions/:
- Filename matches
YYYY-MM-DD-<slug>.md(regex:^\d{4}-\d{2}-\d{2}-[a-z0-9][a-z0-9-]*\.md$). Misshaped → flag. - Frontmatter present and parseable → flag if not.
type: session-recapset → flag if missing or different.
These are the only checks against session-recap files. Their bodies are episodic and don't get the duplicate / stale-reference checks (recaps are stale by nature; that's their job).
Dimension 9 — Possible secrets in existing memory bodies
Read dimensions.md, Dimension 9, and run it.
Dimension 10 — Bloat: staleness/value + uncompressed bodies
Read dimensions.md, Dimension 10, and run it.
3. Aggregate and prioritize
Group findings by dimension. Within each dimension, sort by:
- Files-touched first (findings about widely-referenced files surface ahead of isolated ones).
- Severity heuristic: broken links > validity > duplicates > orphans > stale > schema. (No formal severity tags; the dimension order in the report is the implicit ranking.)
Cap at top 50 findings per dimension to keep output digestible. If a dimension has more than 50, show the first 50 and note "(M more not shown — narrow with --check <dimension>)."
4. Report
Use this shape (sections omitted when the dimension has zero findings):
Memory audit: ~/.claude/projects/<slug>/memory/
Files scanned: N memory files + R session-recaps + MEMORY.md
Findings: T total
## MEMORY.md index drift (X)
- MEMORY.md:14 — link target `feedback/old_thing.md` doesn't exist. Suggest: remove the entry.
## Broken relations (X)
- feedback/baz.md ↔ lessons/qux.md — supersedes declared on baz.md but qux.md has no superseded_by back-pointer. Suggest: add back-pointer to qux.md.
## All other dimensions: Nothing material.
----
Apply proposed fixes? Choose per finding:
1. Apply 2. Skip 3. Edit 4. View detail5. Propose-confirm-commit per finding
For each finding with a concrete suggested fix:
- Show the finding + suggested action.
- Wait for user choice (Apply / Skip / Edit / View detail).
- On Apply → execute the fix (Edit / Write / nothing-and-record). Confirm what changed.
- On Skip → record "skipped, no action."
- On Edit → present the proposed action for the user to modify, then re-prompt.
- On View detail → show the relevant file content / context, then re-prompt the original question.
For findings flagged "user judgment required" (no concrete fix), show the finding and ask: "Action? (skip, manual fix, capture as TODO)."
Never silent-fix. Never bulk-apply. Each finding is its own decision.
After processing all findings (or the user signals "stop"), emit a summary:
Audit complete.
<Applied>applied,<Skipped>skipped,<Pending>deferred. Memory tree:<T-Applied-Skipped>findings remain.
6. Schedule offer (after first successful run)
After the first successful audit on a given memory tree, offer a recurring schedule per the schedule-skill's proactive-offer pattern:
Want me to /schedule a weekly memory-audit so this stays clean? Cadence: weekly, Sunday 9am, summary report only — fixes still propose-confirm-commit when you next open the session.
User declines → record "weekly schedule offered, declined" so the offer doesn't fire on every audit. User accepts → invoke /schedule with the appropriate cadence.
More in reference.md: What memory-audit does NOT do, failure modes, limits (v1).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

