3.9 KiB
3.9 KiB
name, description
| name | description |
|---|---|
| compact-memory | Audit and compact memory/MEMORY.md by removing superseded, duplicated, overly detailed, or ephemeral entries, and merging related items within a subsection. Runs interactively by default; use auto mode for unattended execution. |
compact-memory
Compact memory/MEMORY.md when it grows too large or stale. The skill reads memory/MEMORY.md plus USER.md, SOUL.md, and keep.md (all three in the workspace root) to detect duplicates and outdated context, but only edits memory/MEMORY.md.
When to use
- User says "compact memory", "clean up MEMORY.md", "memory audit", or similar.
MEMORY.mdexceeds ~250 lines.- There are obvious duplicates between
MEMORY.mdand other memory files. - Old project notes, ephemeral debugging details, or superseded facts accumulate.
The line threshold is only a proactive trigger. When the user invokes the skill explicitly, run the full audit regardless of line count.
Modes
Interactive mode (default)
- Read
memory/MEMORY.md, and — for duplicate detection — alsoUSER.md,SOUL.md, andkeep.md(all three in the workspace root). - Count total lines (
wc -l memory/MEMORY.md). If the skill was not invoked explicitly by the user, the file is ≤ 250 lines, and there is no obvious staleness, report "nothing to clean up" and stop. When invoked explicitly, always continue to the audit. - 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, orkeep.md. - ephemeral — one-off debugging, temporary state, or resolved incident details.
- Identify merge candidates within the same
###subsection — related bullets that can be combined into one concise bullet. - Present a numbered proposal in chat:
- list each delete with reason and original text;
- list each merge with merged text.
- Kept items are not listed.
- Wait for user approval. Accept commands like:
apply/ok/yes— apply all proposed changes.keep 3, 7, 12— keep listed items, apply the rest.delete 2, 5— delete only listed items.cancel— abort.
- Apply approved changes to
memory/MEMORY.md. - Append deleted items to
log/memory-clean.logwith timestampYYYY-MM-DD HH:MM(create the file if it does not exist). - Report summary.
Auto mode
Triggered by the user saying "memory-compact auto" or an equivalent with explicit auto intent.
- Perform the same audit as interactive mode.
- Before deleting anything, write a full snapshot of
MEMORY.mdtobackup/<YYYY-MM-DD_HHMM>_memory.backup.md. - Apply changes immediately without waiting for approval.
- Print a detailed list of changes.
- Append deleted items to
log/memory-clean.log(create the file if it does not exist).
Rules
- Only edit
memory/MEMORY.md. - Do not touch
SOUL.md,USER.md, orkeep.md. - In interactive mode do not create backups of
MEMORY.md; rely onlog/memory-clean.logfor traceability. Auto mode always writes a full snapshot tobackup/before deleting. - Merge only within the same
###subsection (never across##sections or across different###subsections). - 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:
Found X candidates to change in MEMORY.md:
Delete:
1. [superseded] <text>
2. [detail] <text>
...
Merge:
5 + 6: <merged text>
...
Commands: apply | keep <numbers> | delete <numbers> | cancel
Auto mode report:
Memory compact (auto):
- deleted: X
- merged: Y
- unchanged: Z
Details:
...
Example
User: compact memory
Agent: reads files, counts lines, proposes changes, waits for apply.