--- name: memory-sync description: Consolidate project knowledge into docs/MEMORY.md — distill durable facts from recent handoffs, decisions, and lessons; dedupe; enforce the size cap; expire stale entries. Use at a phase change, before ending a long run, or when MEMORY.md or HANDOFF.md exceeds its cap. --- Keep `docs/MEMORY.md` small, current, and worth its token cost. This skill curates memory; it never invents facts. 1. Read `docs/MEMORY.md`, `docs/HANDOFF.md`, and only the entries in `docs/DECISIONS.md` / `docs/LESSONS_LEARNED.md` added since the last consolidation-log date. 2. **Promote:** move into `MEMORY.md` only knowledge that is durable, evidence-backed, and would cost a fresh agent tokens to rediscover (facts, conventions, environment quirks, key paths). Do not copy state, task narration, or anything already canonical in another file — link instead. 3. **Dedupe and merge:** collapse overlapping entries into the stronger one. Prefer editing an existing line over adding a new one. 4. **Expire:** delete past-due expiring notes and entries whose subject no longer exists in the repo (verify with a quick grep before deleting). 5. **Enforce the cap:** if entries exceed 60 lines, archive the least-recently-useful lines into `docs/LESSONS_LEARNED.md` → Archive (with a one-line reason) until under cap. 6. Append one row to the consolidation log. Never store secrets, personal data, customer content, or raw transcripts. Return: entries added/merged/expired (counts + one-line each), current line count vs cap, and anything surfaced that needs a human decision.