Consolidate Memory
One command, no options. The project's memory lives in two physical locations but is one unlayered store; the AI decides what needs doing and does it.
- Private harness memory —
~/.claude/projects/<escaped-cwd>/memory(/→-; space handling is inconsistent, probe both/→-+→-and/→-+space-kept). Index:MEMORY.md. - Repo memory —
docs/memory/in the project's git root. Files<category>_<slug>.md, frontmattername/category/summary/source/created/updated, body## Fact/## Why/## How to apply/## Related. Indexed as a row indocs/README.md.
Both entry points — the manual /memory:consolidate and the Stop-hook background run — do the full pass over both locations.
Red lines
- Never
git add/commit/status/difffor committing. To commit repo memory changes, use the/git:commitskill. - Never write a credential (password, secret, token, api-key, …) into
docs/memory/— repo files must not carry secrets. Files whose name/body signals a secret stay as they are.
What to do
For each location in scope:
- Read every
*.md, including the index (MEMORY.md, or thedocs/memory/rows indocs/README.md). - Normalize — relative dates → absolute
YYYY-MM-DD(today:$(date +%F)); complete the frontmatter. - Deduplicate and merge — merge duplicates within and across locations; keep the most detailed. The AI decides where the merged fact belongs.
- Prune — keep active-project/infrastructure/preference facts and highly-
[[linked]]ones; prune dormant (6+ months, no durable lesson), expired time-bound notes (keep transferable insights), and operational snapshots older than 3 months (date-mark survivors). Never prune a secret-bearing file for dormancy. - Rebuild — if anything changed, rebuild the index: rewrite
MEMORY.md(one line per file, under 50 lines); for repo memory, update thedocs/README.mdrows (updated→ today, refreshsummary, drop removed files).
Report
State per location: files read, files changed (path + one-line reason), facts merged / pruned / skipped, index rebuilt yes/no. If nothing changed, say so.