memory-audit

A command that checks project memory files for outdated, unused, oversized, duplicated, or possibly completed information.

In plain words
What is it for?
Use it to find orphaned MEMORY.md files, oversized files, renamed project references, stale dates, and completion markers.
Why use it?
It helps keep persistent project notes accurate and prevents irrelevant memory from consuming the agent's context.

Command

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.

agentmods
npx agentmods add commands/tslateman/duet/memory-audit
Clone the repo
git clone --depth 1 https://github.com/tslateman/duet
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 595 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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 $0.00017 $0.00595
Opus 5 $0.00009 $0.00298
Sonnet 5 $0.00003 $0.00119
Haiku 4.5 $0.00002 $0.00060

Measured yesterday against content hash 0e49c6e621fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

memory-audit 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 yesterday.

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.

!`find ~/.claude/projects/*/memory -name MEMORY.md 2>/dev/null`

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

commands/memory-audit.md · 80 lines

How it starts

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

Audit all project memory files for health issues.

Step 1: Discover Memory Files

Find all MEMORY.md files: !find ~/.claude/projects/*/memory -name MEMORY.md 2>/dev/null

Step 2: Check Each File

For each MEMORY.md found, run these checks:

Orphan Detection

Extract the project path from the memory directory name (e.g., -Users-tslater-dev-council maps to /Users/tslater/dev/council). Check if the project directory exists. Report orphans -- memory files for projects that have been moved, renamed, or deleted.

Size Check

Count lines and estimate tokens (~1.5 tokens/word). Flag files over 50 lines or ~2,000 tokens. These load into every session for that project and consume context.

Ghost Names

Search each memory file for archived or renamed project names:

  • "Lineage" (renamed to Lore)
  • "Oracle" (absorbed into Lore)
  • "Ralph" (archived)
  • "Monarch" (renamed to Lore)
  • "Flow" (absorbed into Neo) -- exclude "Data Flow"

Report line numbers.

Stale Markers

Search for items that sound completed:

  • Lines containing "resolved", "fixed", "done", "completed" (case-insensitive)
  • Date references older than 30 days (pattern: 2026-01 or earlier)
  • Lines starting with ~~ (strikethrough, indicating resolved items)

CLAUDE.md Overlap

If the project has a CLAUDE.md, compare section headers. Flag memory sections whose headers also appear in CLAUDE.md (e.g., both files have "## Architecture"). This suggests content that belongs in CLAUDE.md, not MEMORY.md.

Step 3: Report

Output a summary table:

| Project | Lines | Issues |
|---------|-------|--------|
| council | 56    | clean  |
| lore    | 48    | 2 stale markers |

Then list specific issues grouped by type:

ORPHANS (memory for deleted/moved projects):
  (none)

SIZE (over 50 lines):
  lore: 140 lines (~4k tokens)

GHOST NAMES:
  geordi: "Lineage" on lines 7, 8

STALE MARKERS:
  lore: "Fixed" on line 49, "Resolved" on line 108

CLAUDE.MD OVERLAP:
  geordi: "Architecture" header in both files

Read the full file on GitHub · 80 lines

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. yesterday First seen · 80 lines · 17 tokens per session scan A 0e49c6e621fe

Subscribe to this mod's changes

memory-audit is a command published in the GitHub repository tslateman/duet (1 stars, last pushed 5d ago), licensed MIT. It adds 17 tokens to every session and 595 once invoked, about $0.0001 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.