$npx -y skills add tranhieutt/software_development_department --skill dreamConsolidates and prunes the memory directory through a 4-phase reflective pass: Orient, Gather, Consolidate, Prune. Run after intensive sessions, when memories feel duplicated, or when MEMORY.md approaches the 200-line limit.
| 1 | # Dream: Memory Consolidation |
| 2 | |
| 3 | You are performing a dream — a reflective pass over your memory files. Synthesize what you've learned recently into durable, well-organized memories so that future sessions orient quickly. |
| 4 | |
| 5 | **Memory directory:** find the path from your system prompt — look for the "auto memory" section which says "You have a persistent, file-based memory system at `<path>`". That is your memory directory. If no such section exists, default to `~/.claude/projects/<sanitized-cwd>/memory/` where `<sanitized-cwd>` is the current working directory with `/` replaced by `-`. |
| 6 | |
| 7 | **Session transcripts:** look for `*.jsonl` files in the project directory inside `~/.claude/projects/` that corresponds to the current working directory. These are signal sources — grep narrowly, do NOT read whole files. |
| 8 | |
| 9 | **If the user passed a topic argument** (e.g., `/dream feedback`), focus Phase 2–3 on that topic only. Still run Phase 1 and Phase 4 in full. |
| 10 | |
| 11 | --- |
| 12 | |
| 13 | ## Phase 1 — Orient |
| 14 | |
| 15 | 1. `mkdir -p` the memory directory if it doesn't exist yet. |
| 16 | 2. `ls` the memory directory — note all existing topic files. |
| 17 | 3. Read `MEMORY.md` (if it exists) to understand the current index. If it doesn't exist, this is a fresh start — you'll create it in Phase 4. |
| 18 | 4. Skim existing topic files to build a picture of what's already recorded — so you improve rather than duplicate. |
| 19 | 5. If `logs/` or `sessions/` subdirectories exist, note their presence for Phase 2. |
| 20 | 6. Check for topic files missing mandatory YAML frontmatter (name, description, type) — flag these for repair in Phase 3. |
| 21 | |
| 22 | Report: memory directory path, file count, MEMORY.md line count (or "new"), any frontmatter issues found. |
| 23 | |
| 24 | --- |
| 25 | |
| 26 | ## Phase 2 — Gather recent signal |
| 27 | |
| 28 | Look for new information worth persisting. **Do NOT exhaustively read transcripts.** Look only for things you already suspect matter. |
| 29 | |
| 30 | Sources in priority order: |
| 31 | |
| 32 | 1. **Daily logs** (`logs/YYYY/MM/YYYY-MM-DD.md`) if present — append-only stream, check recent entries first. |
| 33 | 2. **Drifted facts** — scan existing memories for claims that may contradict the current codebase (file paths, function names, flags). Verify with Glob/Grep before marking as stale. |
| 34 | 3. **Transcript search** — grep JSONL files narrowly for specific context: |
| 35 | ```bash |
| 36 | grep -rn "<narrow term>" ~/.claude/projects/ --include="*.jsonl" | tail -50 |
| 37 | ``` |
| 38 | Useful search terms: user corrections ("don't", "no not", "stop"), confirmations ("exactly", "perfect"), role signals ("I'm a", "I own"), decisions ("we're going with", "we decided"), deadlines, external system URLs. |
| 39 | |
| 40 | **Signal categories to look for:** |
| 41 | |
| 42 | | Category | Type | Trigger phrases | |
| 43 | |---|---|---| |
| 44 | | User corrections | feedback | "no", "don't", "stop doing", "not like that", "actually..." | |
| 45 | | Confirmed approaches | feedback | "yes exactly", "perfect", silent acceptance of unusual choice | |
| 46 | | Role / expertise | user | "I'm a ...", "I've been writing X for Y years", "I own the ..." | |
| 47 | | Project decisions | project | "we're going with", "we decided", deadlines, incidents | |
| 48 | | External pointers | reference | Dashboard URLs, issue trackers, Slack channels, doc links | |
| 49 | |
| 50 | **What NOT to gather** (strict exclusions): |
| 51 | - Code patterns, architecture, file paths, project structure — derivable from reading code. |
| 52 | - Git history or who-changed-what — `git log` / `git blame` are authoritative. |
| 53 | - Debugging solutions — the fix is in the code; context is in the commit message. |
| 54 | - Anything already in CLAUDE.md files. |
| 55 | - Ephemeral task state or current conversation context. |
| 56 | - PR lists / activity summaries — save only what was *surprising* or *non-obvious*. |
| 57 | |
| 58 | --- |
| 59 | |
| 60 | ## Phase 3 — Consolidate |
| 61 | |
| 62 | **Before making any file modifications, show the user a plan:** |
| 63 | - List files to be created, updated, merged, or deleted. |
| 64 | - Wait for user approval before proceeding. |
| 65 | |
| 66 | After approval, execute: |
| 67 | |
| 68 | ### 3a. Repair missing frontmatter |
| 69 | For any topic file flagged in Phase 1, add the required YAML frontmatter: |
| 70 | ```markdown |
| 71 | --- |
| 72 | name: {{memory name}} |
| 73 | description: "Consolidates and prunes the memory directory through a 4-phase reflective pass: Orient, Gather, Consolidate, Prune. Run after intensive sessions, when memories feel duplicated, or when MEMORY.md approaches the 200-line limit." |
| 74 | type: {{user | feedback | project | reference}} |
| 75 | --- |
| 76 | ``` |
| 77 | |
| 78 | ### 3b. Merge duplicates and near-duplicates |
| 79 | If two or more files cover the same topic (e.g., `feed |