$npx -y skills add Borda/AI-Rig --skill sessionSession parking lot — automatically parks diverging ideas and unanswered questions to project-scoped memory; /session resume shows pending items, /session archive closes them, /session summary gives a session digest TRIGGER when: user asks "what was I working on", "any pending it
| 1 | <objective> |
| 2 | |
| 3 | Track open-loop ideas, deferred questions, diverging threads — no loss to context compaction or session end. Three on-demand commands (`resume`, `archive`, `summary`) plus behavioral parking rule writing `session-open-*.md` memory files as items arise. |
| 4 | |
| 5 | NOT for: general persistent notes or diary entries (use .notes/ directly); managing task lists (use TaskCreate/TaskUpdate tools). |
| 6 | |
| 7 | </objective> |
| 8 | |
| 9 | <inputs> |
| 10 | |
| 11 | - **$ARGUMENTS**: required. Three modes: |
| 12 | - `resume` (alias: `pending`) — list all open `session-open-*.md` memory files for this project, grouped by age; items ≥ 14 days get `⚠ stale` prefix; items ≥ 30 days deleted silently before listing |
| 13 | - `archive <partial-text>` — fuzzy-match parked item by name or content, delete memory file, append audit entry to `.notes/logs/session-archive.jsonl` |
| 14 | - `summary` — compact session digest: completed tasks, parked items, recent git commits since session start; follows output-routing rule (≤10 lines → terminal; longer → `.temp/output-session-summary-<date>.md`) |
| 15 | |
| 16 | </inputs> |
| 17 | |
| 18 | <constants> |
| 19 | |
| 20 | - Memory dir: resolved via `resolve_memory_dir.py` (canonical; see snippet below) |
| 21 | - Canonical MEMORY_DIR snippet (use in every bash block that needs the path): |
| 22 | ```bash |
| 23 | MEMORY_DIR=$(python "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}/bin/resolve_memory_dir.py" 2>/dev/null) |
| 24 | [ -n "$MEMORY_DIR" ] || { echo "! resolve_memory_dir.py returned empty — aborting; check Python availability and plugin installation"; exit 1; } |
| 25 | ``` |
| 26 | - File pattern: `session-open-*.md` |
| 27 | - Resolution log: `.notes/logs/session-archive.jsonl` (legacy `.claude/logs/session-archive.jsonl` read-only fallback for historical entries) |
| 28 | - Stale threshold: 14 days (add `⚠ stale` prefix when listing) |
| 29 | - Delete threshold: 30 days (silently remove before listing) |
| 30 | - Max open items: 10 (surface list and ask to archive before parking new ones) |
| 31 | |
| 32 | </constants> |
| 33 | |
| 34 | <workflow> |
| 35 | |
| 36 | **Task hygiene**: load and follow the protocol below. |
| 37 | ```bash |
| 38 | # audit-skip: resilience-replication |
| 39 | _FS=$(python "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}/bin/resolve_shared_path.py" foundry skills/_shared 2>/dev/null || echo "plugins/cc_foundry/skills/_shared") # timeout: 5000 |
| 40 | cat "$_FS/task-hygiene.md" |
| 41 | ``` |
| 42 | |
| 43 | ## Step 0: Validate and dispatch mode |
| 44 | |
| 45 | Extract first word of `$ARGUMENTS` as `MODE`. |
| 46 | |
| 47 | If `MODE` matches: |
| 48 | - `resume` or `pending` → **Mode: resume** |
| 49 | - `archive` → **Mode: archive** |
| 50 | - `summary` → **Mode: summary** |
| 51 | |
| 52 | **Unsupported flag check** — after extracting mode token, scan `$ARGUMENTS` for remaining `--<token>` patterns. If found: print `! Unknown flag(s): \`--<token>\`. Supported modes: resume, archive, summary.` then invoke `AskUserQuestion` — (a) **Abort** (stop, re-invoke correctly) · (b) **Continue ignoring** (skip unknown flags, proceed with recognized mode). |
| 53 | |
| 54 | Otherwise (empty, unrecognized, misspelled): use `AskUserQuestion`: |
| 55 | |
| 56 | > "Which session mode did you want?" |
| 57 | > Options: (a) `resume` — list all open parked items, (b) `archive <name>` — close a parked item by name, (c) `summary` — compact digest of this session's work |
| 58 | |
| 59 | ## Step 1 / Mode: resume (list pending items) |
| 60 | |
| 61 | ### Substep 1a: Resolve the memory directory |
| 62 | |
| 63 | Derive `MEMORY_DIR` using the canonical snippet defined in `<constants>` above. Run that snippet here; do not duplicate it. `echo "$MEMORY_DIR"` to surface the resolved path. |
| 64 | |
| 65 | ### Substep 1b: Age-out expired items (≥ 30 days) silently |
| 66 | |
| 67 | ```bash |
| 68 | # MEMORY_DIR — must re-derive here; shell state lost across Bash calls |
| 69 | MEMORY_DIR=$(python "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}/bin/resolve_memory_dir.py" 2>/dev/null) |
| 70 | [ -n "$MEMORY_DIR" ] || { echo "! resolve_memory_dir.py returned empty — aborting; check Python availability and plugin installation"; exit 1; } |
| 71 | # log before delete for audit trail |
| 72 | find "$MEMORY_DIR" -name "session-open-*.md" -mtime +30 2>/dev/null | while IFS= read -r f; do |
| 73 | echo "Removing aged file: $f" |
| 74 | rm "$f" |
| 75 | done # timeout: 5000 |
| 76 | echo "cleanup done" |
| 77 | ``` |
| 78 | |
| 79 | ### Substep 1c: Collect remaining items and compute age |
| 80 | |
| 81 | **Primary source (current)**: Read `.claude/state/session-context.md` if it exists. Extract all bullets under `## Parked items` section — each is a current parked item. Use item's `Raised:` date for age computation. |
| 82 | |
| 83 | **Legacy source (b |