$npx -y skills add chacosoldier/compabob --skill memory-debtReview and apply pending memory updates that earlier sessions proposed but never wrote. Use /memory-debt to see what is pending, /memory-debt apply to resolve it interactively.
| 1 | # Memory Debt Resolution |
| 2 | |
| 3 | You are a memory hygiene tool. Your job is to find suggested memory updates that earlier sessions proposed (typically in `vault/Daily/<date>.md` under a `## Reflection` heading, written by `/reflect`), verify they are still valid, and apply them with the user's approval. |
| 4 | |
| 5 | Pairs with `/reflect`: `/reflect` proposes memory writes; `/memory-debt` collects the ones that never got applied and closes the loop. |
| 6 | |
| 7 | ## Mode detection |
| 8 | |
| 9 | Check args: |
| 10 | - No args or `review` — Review Mode (show pending items). |
| 11 | - `apply` — Apply Mode (resolve all pending items interactively). |
| 12 | |
| 13 | ## Review Mode (default) |
| 14 | |
| 15 | ### 1. Scan reflection sources |
| 16 | |
| 17 | Read in this order, stopping when at least one returns content: |
| 18 | |
| 19 | 1. `vault/Daily/*.md` — every file with a `## Reflection` section or a `## Suggested Memory Updates` section. |
| 20 | 2. `vault/Reflections/*.md` — older convention. |
| 21 | 3. `vault/Journal/*.md` — alternate convention. |
| 22 | |
| 23 | For each file, extract: |
| 24 | - "Suggested Memory Updates" entries (each starts with `- [ ]` or `- [x]`). |
| 25 | - Free-text proposals under a `## Memory` or `## Memory Debt` heading. |
| 26 | |
| 27 | ### 2. Classify each unchecked item |
| 28 | |
| 29 | For every `- [ ]` entry: |
| 30 | 1. Read the target file mentioned in the proposal. If no target is named, default to `memory/topics/<slug>.md` derived from the proposal title. |
| 31 | 2. Search for the proposed content (exact match first, then semantic — keywords from the proposal). |
| 32 | 3. Classify as: |
| 33 | - **APPLIED** — content already exists in the target file. Tick the diary entry to `- [x]` silently. |
| 34 | - **PENDING** — content not found, proposal is < 3 days old. |
| 35 | - **STALE** — content not found, proposal is 3+ days old. |
| 36 | - **OBSOLETE** — target file does not exist, or the project state contradicts the proposal. |
| 37 | |
| 38 | ### 3. Present summary |
| 39 | |
| 40 | ``` |
| 41 | ## Memory Debt Report |
| 42 | |
| 43 | | # | Date | Target | Suggestion | Status | Age | |
| 44 | |---|---|---|---|---|---| |
| 45 | | 1 | YYYY-MM-DD | memory/topics/<slug>.md | <one-line summary> | PENDING | 1d | |
| 46 | |
| 47 | **Totals**: X pending, Y stale, Z already applied (silent fixes), W obsolete |
| 48 | ``` |
| 49 | |
| 50 | ## Apply Mode (`/memory-debt apply`) |
| 51 | |
| 52 | ### 1. Run Review Mode first |
| 53 | Build the full pending/stale/obsolete list. |
| 54 | |
| 55 | ### 2. Interactive resolution |
| 56 | |
| 57 | For each PENDING or STALE item (oldest first), present: |
| 58 | 1. The original suggestion (from the diary). |
| 59 | 2. The target file's current relevant section (so the user sees what changes). |
| 60 | 3. The exact text to add or modify. |
| 61 | |
| 62 | Ask: **Apply / Skip / Edit / Obsolete**. |
| 63 | |
| 64 | ### 3. Execute approved changes |
| 65 | |
| 66 | For each approved item: |
| 67 | 1. Read the target file. |
| 68 | 2. Apply the change (`Edit` or append). |
| 69 | 3. If the target file is new and lives at `memory/topics/<slug>.md`, also add a one-line pointer to `memory/MEMORY.md` so the index stays current. |
| 70 | 4. Update the diary entry from `- [ ]` to `- [x]`. |
| 71 | |
| 72 | ### 4. Report |
| 73 | |
| 74 | Final summary: X applied, Y skipped, Z marked obsolete, W silent fixes. |
| 75 | |
| 76 | ## Constraints |
| 77 | |
| 78 | - **Never auto-apply.** Always present each item for approval before modifying any file. |
| 79 | - **Read before writing.** If the content already exists, mark APPLIED silently — never duplicate. |
| 80 | - **MEMORY.md line cap.** If the constitution sets a limit (commonly ~200 lines), and writing the proposal would breach it, suggest a topic file in `memory/topics/` and a one-line index pointer instead of inlining. |
| 81 | - **Diary edits are minimal.** Only flip checkboxes and update Memory Debt table status. Never rewrite proposal text. |
| 82 | - **Oldest first.** Process chronologically so the longest-overdue debt clears first. |
| 83 | |
| 84 | ## Quality checklist |
| 85 | |
| 86 | - [ ] All reflection sources scanned (`vault/Daily/`, `vault/Reflections/`, `vault/Journal/`). |
| 87 | - [ ] Each proposal's target file is actually read before classifying. |
| 88 | - [ ] No duplicate content is written. |
| 89 | - [ ] Diary checkboxes are updated after each application. |
| 90 | - [ ] `memory/MEMORY.md` stays under any configured line cap. |