--- name: memory-compact description: Audit and compact memory/MEMORY.md by removing superseded, duplicated, overly detailed, or ephemeral entries, and merging related items within a section. Runs interactively by default; use auto mode for unattended execution. --- # memory-compact Compact `memory/MEMORY.md` when it grows too large or stale. The skill reads `MEMORY.md`, `USER.md`, `SOUL.md`, and `keep.md` to detect duplicates and outdated context, but only edits `MEMORY.md`. ## When to use - User says "compact memory", "clean up MEMORY.md", "memory audit", or similar. - `MEMORY.md` exceeds ~200 top-level bullet entries. - There are obvious duplicates between `MEMORY.md` and other memory files. - Old project notes, ephemeral debugging details, or superseded facts accumulate. ## Modes ### Interactive mode (default) 1. Read `memory/MEMORY.md`. 2. Count top-level bullets. If ≤ 200 and no obvious staleness, report "no action needed" and stop. 3. Identify candidates: - **superseded** — replaced by newer facts or no longer relevant. - **detail** — concrete commands, flags, paths, or measurements that belong in a skill or `results/` file. - **duplicate** — same fact already present in `USER.md`, `SOUL.md`, or `keep.md`. - **ephemeral** — one-off debugging, temporary state, or resolved incident details. 4. Identify merge candidates within the same section — related bullets that can be combined into one concise bullet. 5. Present a numbered proposal in chat: - list each delete with reason and original text; - list each merge with merged text; - list kept items implicitly. 6. Wait for user approval. Accept commands like: - `proveď` / `ok` / `yes` — apply all proposed changes. - `ponech 3, 7, 12` — keep listed items, apply the rest. - `smaz 2, 5` — delete only listed items. - `zruš` / `cancel` — abort. 7. Apply approved changes to `MEMORY.md`. 8. Append deleted items to `log/memory-clean.log` with timestamp `YYYY-MM-DD HH:MM`. 9. Report summary. ### Auto mode Triggered by user saying "memory-compact auto" or equivalent with explicit auto intent. 1. Perform the same audit as interactive mode. 2. Apply changes immediately without waiting for approval. 3. Print a detailed list of changes. 4. Append deleted items to `log/memory-clean.log`. ## Rules - Only edit `memory/MEMORY.md`. - Do not touch `SOUL.md`, `USER.md`, or `keep.md`. - Do not create backups of `MEMORY.md`; rely on `log/memory-clean.log` for traceability. - Merge only within the same section. - Preserve active project context, user preferences, and infrastructure facts. - When in doubt, keep it and mention the uncertainty in the report. ## Output format Interactive proposal: ``` Nalezeno X kandidátů na úpravu v MEMORY.md: Smazat: 1. [superseded] 2. [detail] ... Sloučit: 5 + 6: ... Příkazy: proveď | ponech <čísla> | smaz <čísla> | zruš ``` Auto mode report: ``` Memory compact (auto): - smazáno: X - sloučeno: Y - beze změny: Z Detaily: ... ``` ## Example User: `compact memory` Agent: reads files, counts bullets, proposes changes, waits for `proveď`.