| name | audit-memory |
| description | Audit an existing agent memory store read-only for schema or index drift, broken or one-way local relationships, review-due content, source freshness, duplicate or conflicting facts, and advisory capacity limits. Use only for memory-health verification; do not create, import, refresh, or edit memory, and route ordinary repository documentation audits to audit-docs. |
Audit Memory
Audit memory without changing files, sources, indexes, or external state.
Load the Contract and Resolve Scope
- Read references/memory-contract.md completely before auditing. Apply its schema, index grammar, relationship, provenance, date, authorization, and limit rules.
- Use the user-supplied memory root, project root, or file list first. If none is supplied, inspect only plausible roots inside the current project.
- Ask for explicit consent before reading a global store, sibling project, unrelated repository, or any root outside the user's selected project. Never silently combine stores.
- When several roots remain plausible, report the candidates and ask the user to select one.
- Record inaccessible paths, unsupported host schemas, missing repositories, and unavailable source checks as limitations.
Normalize Audit Settings
Apply user-supplied thresholds instead of hardcoded values. Forward supported values to the validator:
--stale-days <N> for content review age
--source-stale-days <N> for source retrieval review age
--file-limit <N> for advisory file capacity
--index-line-limit <N> for advisory index size
--warning-ratio <R> and --critical-ratio <R> for capacity thresholds
--enforce-limits only when local policy makes capacity limits hard
Use the contract defaults only when neither the user nor local policy supplies a value. State every assumed value. Treat capacity thresholds as advisory unless the host documents a hard limit.
Run Deterministic Validation
Run the bundled validator against each authorized root:
python scripts/validate_memory.py <memory-root> [threshold options]
Use --format json when structured output helps. Verify validator findings against the files before reporting them. Do not repair failures during an audit.
Review Meaning and Freshness
- Treat age alone as
review due, not proof that content is stale. Do not infer staleness from unrelated repository activity.
- Call a memory stale only when current repository or source evidence contradicts it, supersedes it, or proves that a load-bearing claim is obsolete. Cite both the memory and contradicting evidence.
- Treat an old matching
provenance[].retrieved_at value as source review due. Do not claim source drift unless the current authorized source was compared successfully.
- Compare filenames, names, descriptions, source identities, and distinctive claims for duplicates. Report conflicting durable claims separately; do not silently choose a winner.
- Treat one-way local
related links as contract drift because family relationships are symmetric. Treat external references through provenance or body links as evidence, not local relationships.
Report
Group verified findings as:
critical: broken required index targets, missing local related files, invalid required schema that prevents reliable retrieval, or proven dangerous stale guidance.
warning: contract drift, duplicate or conflicting canonical facts, proven stale content, or documented hard-limit pressure.
info: review-due content or sources, advisory capacity pressure, and other human-review signals.
Include scanned roots and files, effective settings, findings with file:line evidence, skipped checks, parse failures, inaccessible sources, and other limitations. If no finding remains, say only that no issues were detected in the checks completed.
Do not edit memory, refresh sources, rewrite indexes, or stage repository changes.