oprava skillu

This commit is contained in:
lachtan
2026-06-24 18:19:06 +02:00
parent 0d60589eb4
commit 428c555419

View File

@@ -1,59 +1,65 @@
--- ---
name: memory-compact 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. description: >
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.
--- ---
# memory-compact # 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`. 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 ## When to use
- User says "compact memory", "clean up MEMORY.md", "memory audit", or similar. - User says "compact memory", "clean up MEMORY.md", "memory audit", or similar.
- `MEMORY.md` exceeds ~200 top-level bullet entries. - `MEMORY.md` exceeds ~250 lines.
- There are obvious duplicates between `MEMORY.md` and other memory files. - There are obvious duplicates between `MEMORY.md` and other memory files.
- Old project notes, ephemeral debugging details, or superseded facts accumulate. - 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 ## Modes
### Interactive mode (default) ### Interactive mode (default)
1. Read `memory/MEMORY.md`. 1. Read `memory/MEMORY.md`, and — for duplicate detection — also `USER.md`, `SOUL.md`, and `keep.md` (all three in the workspace root).
2. Count top-level bullets. If ≤ 200 and no obvious staleness, report "no action needed" and stop. 2. 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.
3. Identify candidates: 3. Identify candidates:
- **superseded** — replaced by newer facts or no longer relevant. - **superseded** — replaced by newer facts or no longer relevant.
- **detail** — concrete commands, flags, paths, or measurements that belong in a skill or `results/` file. - **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`. - **duplicate** — same fact already present in `USER.md`, `SOUL.md`, or `keep.md`.
- **ephemeral** — one-off debugging, temporary state, or resolved incident details. - **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. 4. Identify merge candidates within the same `###` subsection — related bullets that can be combined into one concise bullet.
5. Present a numbered proposal in chat: 5. Present a numbered proposal in chat:
- list each delete with reason and original text; - list each delete with reason and original text;
- list each merge with merged text; - list each merge with merged text.
- list kept items implicitly. - Kept items are not listed.
6. Wait for user approval. Accept commands like: 6. Wait for user approval. Accept commands like:
- `proveď` / `ok` / `yes` — apply all proposed changes. - `apply` / `ok` / `yes` — apply all proposed changes.
- `ponech 3, 7, 12` — keep listed items, apply the rest. - `keep 3, 7, 12` — keep listed items, apply the rest.
- `smaz 2, 5` — delete only listed items. - `delete 2, 5` — delete only listed items.
- `zruš` / `cancel` — abort. - `cancel` — abort.
7. Apply approved changes to `MEMORY.md`. 7. Apply approved changes to `memory/MEMORY.md`.
8. Append deleted items to `log/memory-clean.log` with timestamp `YYYY-MM-DD HH:MM`. 8. Append deleted items to `log/memory-clean.log` with timestamp `YYYY-MM-DD HH:MM` (create the file if it does not exist).
9. Report summary. 9. Report summary.
### Auto mode ### Auto mode
Triggered by user saying "memory-compact auto" or equivalent with explicit auto intent. Triggered by the user saying "memory-compact auto" or an equivalent with explicit auto intent.
1. Perform the same audit as interactive mode. 1. Perform the same audit as interactive mode.
2. Apply changes immediately without waiting for approval. 2. Before deleting anything, write a full snapshot of `MEMORY.md` to `backup/<YYYY-MM-DD_HHMM>_memory.backup.md`.
3. Print a detailed list of changes. 3. Apply changes immediately without waiting for approval.
4. Append deleted items to `log/memory-clean.log`. 4. Print a detailed list of changes.
5. Append deleted items to `log/memory-clean.log` (create the file if it does not exist).
## Rules ## Rules
- Only edit `memory/MEMORY.md`. - Only edit `memory/MEMORY.md`.
- Do not touch `SOUL.md`, `USER.md`, or `keep.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. - In interactive mode do not create backups of `MEMORY.md`; rely on `log/memory-clean.log` for traceability. Auto mode always writes a full snapshot to `backup/` before deleting.
- Merge only within the same section. - Merge only within the same `###` subsection (never across `##` sections or across different `###` subsections).
- Preserve active project context, user preferences, and infrastructure facts. - Preserve active project context, user preferences, and infrastructure facts.
- When in doubt, keep it and mention the uncertainty in the report. - When in doubt, keep it and mention the uncertainty in the report.
@@ -62,29 +68,29 @@ Triggered by user saying "memory-compact auto" or equivalent with explicit auto
Interactive proposal: Interactive proposal:
``` ```
Nalezeno X kandidátů na úpravu v MEMORY.md: Found X candidates to change in MEMORY.md:
Smazat: Delete:
1. [superseded] <text> 1. [superseded] <text>
2. [detail] <text> 2. [detail] <text>
... ...
Sloučit: Merge:
5 + 6: <merged text> 5 + 6: <merged text>
... ...
Příkazy: proveď | ponech <čísla> | smaz <čísla> | zruš Commands: apply | keep <numbers> | delete <numbers> | cancel
``` ```
Auto mode report: Auto mode report:
``` ```
Memory compact (auto): Memory compact (auto):
- smazáno: X - deleted: X
- sloučeno: Y - merged: Y
- beze změny: Z - unchanged: Z
Detaily: Details:
... ...
``` ```
@@ -92,4 +98,4 @@ Detaily:
User: `compact memory` User: `compact memory`
Agent: reads files, counts bullets, proposes changes, waits for `proveď`. Agent: reads files, counts lines, proposes changes, waits for `apply`.