Use when user wants to audit long-term memory for stale, incorrect, outdated, or duplicate entries, or correct memory entries based on new information
Fact-check long-term memory entries against the current codebase. Detect outdated references, incorrect claims, superseded fixes, duplicates, and contradictions. Present findings for user approval before making any changes.
/audit or /audit --all): Check all entries in global LTM + current project LTM (or all project LTMs with --all)/audit <context>): Check only entries topically related to the provided context, suggest corrections~/.claude/memory/global-long-term-memory.md~/.claude/memory/project-memory/ matching *-long-term-memory.md. Find the file whose name prefix (before -long-term-memory.md) matches the current repository directory name (case-insensitive, normalized to kebab-case — spaces and underscores become hyphens). If no match, skip project LTM.--all flag: Read ALL *-long-term-memory.md files in ~/.claude/memory/project-memory/ instead of just the current project.Parse each file into sections using ## headers. Track which section each entry belongs to, noting whether the section is pinned. A section is pinned if its header matches one of: "About Me", "Current Projects", "Technical Environment", "Patterns & Preferences", "Pinned". These are the authoritative pinned section names (matching the decay system's protected set).
For each entry (lines starting with - ( in LTM files), determine if it contains identifiable code references: file paths with extensions, function/class names (snake_case or PascalCase), CLI commands, or config keys. Skip entries with no verifiable references for the outdated, incorrect, and superseded categories (but still check them for duplicate and contradicted).
Entry references files, functions, configs, or systems that no longer exist.
Glob to check existence. For function/class names: use Grep to search the codebase. For config keys: Read the relevant config file.Entry states something demonstrably wrong about current code or behavior.
Read relevant code and compare the claim vs reality. For config/default claims (e.g., "default is X"): search for the config key in project configuration files and scripts (e.g., settings.json, constants in source files, .env).A bug fix, workaround, or gotcha that has been properly resolved.
Same fact or pattern recorded in both global and project LTM, or within the same file.
Two entries say opposite things, or an entry contradicts current code.
/audit or /audit --all)Glob to check existence
c. For function/class names: Grep across the codebase to find definitions and usages
d. For config keys/values: Read the relevant config file and compare
e. If reference not found or value doesn't match: record as findingIf no findings are discovered, report: "No findings -- N entries checked across M files."
/audit <context>)If no related entries are found, report: "No entries found related to: <context>" If related entries all verify clean, report: "N entries checked related to <context> -- all verified correct."
Present findings as a Markdown table grouped by file:
### global-long-term-memory.md (3 findings)
| # | Section | Entry | Category | Reasoning |
|---|---------|-------|----------|-----------|
| 1 | Pinned | (2026-02-10) [pattern] Use set_memory_dir()... | outdated | set_memory_dir() not found in codebase |
| 2 | Key Learnings | (2026-01-15) [gotcha] SQLite WAL mode... | superseded | No SQLite usage in current architecture |
| 3 | Key Actions | (2026-02-20) [tip] Run vector_sync... | incorrect | vector_sync removed; no vector DB |
... to keep the table readableAfter the table, ask the user which findings to act on. List findings by number and ask the user to reply with the numbers they want to apply (e.g., "Apply 1, 3" or "Apply all" or "Dismiss all").
If there are more than 10 findings, batch them into groups of 10 and present each group separately, waiting for user response before showing the next group.
~/.claude/memory/.audit-archive.md under an ## Audited YYYY-MM-DD header (use today's date). If an ## Audited header for today already exists, append under it instead of creating a duplicate.[audit:category - reasoning] tag to the archived entry- *Source: filename.md* (filename only, not full path).audit-archive.md does not exist, create it with a # Audit Archive header before appendingArchive format example:
## Audited 2026-03-31
- (2026-02-10) [pattern] Use set_memory_dir() for path resolution [audit:outdated - function removed in v1 migration]
- *Source: global-long-term-memory.md*
- (2026-01-15) [gotcha] SQLite WAL mode causes locking [audit:superseded - migrated to markdown, no SQLite]
- *Source: claude-memory-system-long-term-memory.md*
Important: Audit archives are stored in .audit-archive.md (separate from .decay-archive.md) to ensure they are not subject to the decay system's purge cycle.
(YYYY-MM-DD) to reflect the correction. If the user prefers to preserve the original date, keep it unchanged..audit-archive.md (not .decay-archive.md) using ## Audited headers to keep audit and decay archives separateglobal-long-term-memory.md), not full paths