create-claude-cabinet 0.46.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/README.md +3 -6
  2. package/lib/CLAUDE.md +218 -0
  3. package/lib/cli.js +397 -382
  4. package/lib/copy.js +182 -6
  5. package/lib/db-setup.js +122 -17
  6. package/lib/engagement-server-setup.js +1 -17
  7. package/lib/engagement-setup.js +1 -1
  8. package/lib/installer-gate.js +135 -0
  9. package/lib/metadata.js +51 -2
  10. package/lib/modules.js +292 -0
  11. package/lib/mux-setup.js +1 -17
  12. package/lib/project-context.js +16 -96
  13. package/lib/settings-merge.js +194 -13
  14. package/lib/site-audit-setup.js +23 -7
  15. package/lib/verify-setup.js +20 -9
  16. package/lib/watchtower-setup.js +23 -7
  17. package/package.json +1 -1
  18. package/templates/CLAUDE.md +959 -0
  19. package/templates/briefing/_briefing-template.md +6 -11
  20. package/templates/cabinet/advisories-state-schema.md +1 -1
  21. package/templates/cabinet/checklist-stats-schema.md +15 -1
  22. package/templates/cabinet/eval-protocol.md +27 -10
  23. package/templates/cabinet/memory-lifecycle-contract.md +135 -0
  24. package/templates/cabinet/pib-db-access.md +13 -0
  25. package/templates/cabinet/watchtower-contracts.md +453 -0
  26. package/templates/cabinet/worktree-invocation-contract.md +111 -0
  27. package/templates/engagement/OVERVIEW.md +12 -0
  28. package/templates/engagement/__tests__/checklist-visibility.test.mjs +76 -0
  29. package/templates/engagement/__tests__/engagement.test.mjs +177 -2
  30. package/templates/engagement/__tests__/invoice-doc.test.mjs +195 -0
  31. package/templates/engagement/engagement-checklist.mjs +26 -2
  32. package/templates/engagement/engagement-preview.mjs +100 -0
  33. package/templates/engagement/engagement-schema.md +248 -6
  34. package/templates/engagement/engagement.mjs +391 -11
  35. package/templates/engagement/pib-db-patches/pib-db-lib.mjs +49 -9
  36. package/templates/engagement/pib-db-patches/pib-db-mcp-server.mjs +5 -44
  37. package/templates/engagement/pib-db-patches/pib-db-schema.sql +1 -1
  38. package/templates/engagement/pib-db-patches/pib-db.mjs +9 -3
  39. package/templates/engagement/sql-constants.mjs +9 -1
  40. package/templates/engagement-server/__tests__/cross-tenant-auth.test.mjs +87 -0
  41. package/templates/engagement-server/server.mjs +65 -40
  42. package/templates/hooks/action-completion-gate.sh +19 -3
  43. package/templates/hooks/action-quality-gate.sh +10 -0
  44. package/templates/hooks/memory-index-guard.sh +17 -11
  45. package/templates/hooks/skill-telemetry.sh +10 -5
  46. package/templates/hooks/skill-tool-telemetry.sh +11 -5
  47. package/templates/hooks/watchtower-session-start.sh +24 -2
  48. package/templates/mcp/pib-db.json +1 -4
  49. package/templates/mux/bin/mux +8 -1
  50. package/templates/mux/config/help.txt +1 -0
  51. package/templates/rules/acknowledge-when-corrected.md +33 -0
  52. package/templates/rules/enforcement-pipeline.md +0 -12
  53. package/templates/rules/maintainability.md +11 -0
  54. package/templates/rules/memory-capture.md +26 -4
  55. package/templates/rules/plan-before-bulk-or-irreversible-actions.md +48 -0
  56. package/templates/rules/verify-before-asserting.md +79 -0
  57. package/templates/scripts/__tests__/ahead-check-origin.test.mjs +355 -0
  58. package/templates/scripts/__tests__/api-usage-idle-gate.test.mjs +81 -0
  59. package/templates/scripts/__tests__/batch-disposition.test.mjs +98 -0
  60. package/templates/scripts/__tests__/bsql-loader-verify.test.mjs +47 -0
  61. package/templates/scripts/__tests__/claude-churn-authored.test.mjs +90 -0
  62. package/templates/scripts/__tests__/cross-ring-reader.test.mjs +505 -0
  63. package/templates/scripts/__tests__/dx-captures-briefing.test.mjs +169 -0
  64. package/templates/scripts/__tests__/hook-runner.test.mjs +247 -0
  65. package/templates/scripts/__tests__/inbox-assessment.test.mjs +341 -0
  66. package/templates/scripts/__tests__/memory-reachability.test.mjs +150 -0
  67. package/templates/scripts/__tests__/narrative-corpus.test.mjs +247 -0
  68. package/templates/scripts/__tests__/phase-shim.test.mjs +112 -0
  69. package/templates/scripts/__tests__/qa-handoff-merge-state.test.mjs +162 -0
  70. package/templates/scripts/__tests__/resolve-cli.test.mjs +314 -0
  71. package/templates/scripts/__tests__/ring-state-ownership.test.mjs +120 -0
  72. package/templates/scripts/__tests__/ring1-content-detector.test.mjs +168 -0
  73. package/templates/scripts/__tests__/ring1-flagged-actions.test.mjs +135 -0
  74. package/templates/scripts/__tests__/ring1-pib-error-surfacing.test.mjs +69 -0
  75. package/templates/scripts/__tests__/ring1-script-drift.test.mjs +126 -0
  76. package/templates/scripts/__tests__/ring1-stale-open-counts.test.mjs +143 -0
  77. package/templates/scripts/__tests__/ring2-queue-reader.test.mjs +80 -0
  78. package/templates/scripts/__tests__/ring2-recall-canary.test.mjs +150 -0
  79. package/templates/scripts/__tests__/ring2-roster-review.test.mjs +311 -0
  80. package/templates/scripts/__tests__/ring3-chunk-merge.test.mjs +122 -0
  81. package/templates/scripts/__tests__/ring3-close-lenses.test.mjs +359 -0
  82. package/templates/scripts/__tests__/ring3-dedup.test.mjs +92 -12
  83. package/templates/scripts/__tests__/ring3-memory-titles.test.mjs +187 -0
  84. package/templates/scripts/__tests__/ring3-novelty-rescue.test.mjs +148 -0
  85. package/templates/scripts/__tests__/ring3-recent-slice.test.mjs +101 -0
  86. package/templates/scripts/__tests__/ring3-thread-capture.test.mjs +213 -0
  87. package/templates/scripts/__tests__/ring4-reconcile.test.mjs +393 -0
  88. package/templates/scripts/__tests__/shared-thread-reader.test.mjs +187 -0
  89. package/templates/scripts/__tests__/suppression-ledger.test.mjs +148 -0
  90. package/templates/scripts/__tests__/verify-backfill.test.mjs +103 -0
  91. package/templates/scripts/__tests__/verify-coverage.test.mjs +80 -0
  92. package/templates/scripts/__tests__/watchtower-snapshot.test.mjs +261 -0
  93. package/templates/scripts/__tests__/watchtower-status-ring4.test.mjs +89 -0
  94. package/templates/scripts/__tests__/watchtower-sync.test.mjs +311 -0
  95. package/templates/scripts/audit-coherence-check.mjs +123 -0
  96. package/templates/scripts/audit-synth.mjs +117 -0
  97. package/templates/scripts/load-triage-history.js +5 -2
  98. package/templates/scripts/merge-findings.js +4 -1
  99. package/templates/scripts/patterns-scope-check.mjs +122 -0
  100. package/templates/scripts/pib-db-lib.mjs +61 -11
  101. package/templates/scripts/pib-db-mcp-server.mjs +7 -45
  102. package/templates/scripts/pib-db-path.mjs +61 -0
  103. package/templates/scripts/pib-db.mjs +7 -3
  104. package/templates/scripts/review-server.mjs +7 -12
  105. package/templates/scripts/triage-server.mjs +7 -8
  106. package/templates/scripts/validate-memory.mjs +214 -16
  107. package/templates/scripts/watchtower-advisories.mjs +7 -3
  108. package/templates/scripts/watchtower-build-context.mjs +192 -8
  109. package/templates/scripts/watchtower-cross-ring-reader.mjs +714 -0
  110. package/templates/scripts/watchtower-hook-runner.mjs +422 -0
  111. package/templates/scripts/watchtower-inbox-assessment.mjs +706 -0
  112. package/templates/scripts/watchtower-lib.mjs +555 -8
  113. package/templates/scripts/watchtower-narrative-corpus.mjs +385 -0
  114. package/templates/scripts/watchtower-phase-shim.mjs +171 -0
  115. package/templates/scripts/watchtower-queue.mjs +341 -3
  116. package/templates/scripts/watchtower-ring1.mjs +481 -81
  117. package/templates/scripts/watchtower-ring2.mjs +748 -80
  118. package/templates/scripts/watchtower-ring3-close.mjs +1147 -167
  119. package/templates/scripts/watchtower-ring4-runner.sh +85 -0
  120. package/templates/scripts/watchtower-ring4.mjs +753 -0
  121. package/templates/scripts/watchtower-routines.mjs +1 -1
  122. package/templates/scripts/watchtower-snapshot.mjs +452 -0
  123. package/templates/scripts/watchtower-status.sh +17 -0
  124. package/templates/scripts/watchtower-sync.mjs +393 -0
  125. package/templates/scripts/work-tracker-server.mjs +26 -22
  126. package/templates/skills/audit/SKILL.md +18 -5
  127. package/templates/skills/audit/phases/structural-checks.md +22 -0
  128. package/templates/skills/briefing/SKILL.md +289 -41
  129. package/templates/skills/cabinet-accessibility/SKILL.md +1 -1
  130. package/templates/skills/cabinet-process-therapist/SKILL.md +28 -0
  131. package/templates/skills/cabinet-security/SKILL.md +11 -0
  132. package/templates/skills/catch-up/SKILL.md +113 -0
  133. package/templates/skills/cc-publish/SKILL.md +89 -18
  134. package/templates/skills/cc-remember/SKILL.md +45 -0
  135. package/templates/skills/close/SKILL.md +107 -0
  136. package/templates/skills/collab-client/SKILL.md +22 -5
  137. package/templates/skills/collab-consultant/SKILL.md +110 -2
  138. package/templates/skills/debrief/SKILL.md +21 -4
  139. package/templates/skills/debrief/phases/audit-pattern-capture.md +13 -0
  140. package/templates/skills/debrief-classic/SKILL.md +696 -0
  141. package/templates/skills/debrief-classic/calibration.md +44 -0
  142. package/templates/skills/debrief-classic/phases/audit-pattern-capture.md +78 -0
  143. package/templates/skills/debrief-classic/phases/auto-maintenance.md +48 -0
  144. package/templates/skills/debrief-classic/phases/checklist-feedback.md +123 -0
  145. package/templates/skills/debrief-classic/phases/close-work.md +163 -0
  146. package/templates/skills/debrief-classic/phases/health-checks.md +54 -0
  147. package/templates/skills/debrief-classic/phases/inventory.md +40 -0
  148. package/templates/skills/debrief-classic/phases/loose-ends.md +52 -0
  149. package/templates/skills/debrief-classic/phases/methodology-capture.md +223 -0
  150. package/templates/skills/debrief-classic/phases/qa-handoff-sweep.md +78 -0
  151. package/templates/skills/debrief-classic/phases/record-lessons.md +177 -0
  152. package/templates/skills/debrief-classic/phases/report.md +59 -0
  153. package/templates/skills/debrief-classic/phases/update-state.md +48 -0
  154. package/templates/skills/debrief-classic/phases/upstream-feedback.md +185 -0
  155. package/templates/skills/debrief-classic/phases/verify-coverage.md +101 -0
  156. package/templates/skills/execute/SKILL.md +71 -6
  157. package/templates/skills/execute/phases/commit-and-deploy.md +8 -0
  158. package/templates/skills/execute-group/SKILL.md +23 -26
  159. package/templates/skills/generate-plan-groups/SKILL.md +20 -0
  160. package/templates/skills/inbox/SKILL.md +177 -31
  161. package/templates/skills/memory/SKILL.md +22 -6
  162. package/templates/skills/orient/SKILL.md +75 -5
  163. package/templates/skills/orient-classic/SKILL.md +770 -0
  164. package/templates/skills/orient-classic/phases/auto-maintenance.md +52 -0
  165. package/templates/skills/orient-classic/phases/briefing.md +53 -0
  166. package/templates/skills/orient-classic/phases/cabinet.md +46 -0
  167. package/templates/skills/orient-classic/phases/checklist-status.md +54 -0
  168. package/templates/skills/orient-classic/phases/context.md +88 -0
  169. package/templates/skills/orient-classic/phases/data-sync.md +35 -0
  170. package/templates/skills/orient-classic/phases/deferred-check.md +55 -0
  171. package/templates/skills/orient-classic/phases/dx-captures.md +53 -0
  172. package/templates/skills/orient-classic/phases/health-checks.md +50 -0
  173. package/templates/skills/orient-classic/phases/verify-backfill.md +109 -0
  174. package/templates/skills/orient-classic/phases/work-scan.md +69 -0
  175. package/templates/skills/pulse/SKILL.md +10 -8
  176. package/templates/skills/qa-drain/SKILL.md +38 -0
  177. package/templates/skills/qa-handoff/SKILL.md +287 -46
  178. package/templates/skills/setup-accounts/SKILL.md +38 -16
  179. package/templates/skills/spring-clean/SKILL.md +1 -1
  180. package/templates/skills/spring-clean/phases/execute-decisions.md +1 -1
  181. package/templates/skills/threads/SKILL.md +4 -0
  182. package/templates/skills/validate/phases/validators.md +127 -0
  183. package/templates/skills/watchtower/SKILL.md +174 -30
  184. package/templates/verify-runtime/CONVENTIONS.md +9 -0
  185. package/templates/verify-runtime/README.md +37 -0
  186. package/templates/watchtower/config.json.template +8 -2
  187. package/templates/workflows/deliberative-audit.js +258 -87
  188. package/templates/workflows/execute-group-complete.js +26 -3
  189. package/templates/workflows/execute-group-implement.js +16 -2
@@ -142,14 +142,9 @@ or if no `briefing` field is present, the system falls back to reading
142
142
 
143
143
  ## Finding Format
144
144
 
145
- When producing audit findings, use this structure:
146
-
147
- ```yaml
148
- finding:
149
- cabinet-member: member-name
150
- severity: critical | significant | minor | informational
151
- category: what domain this falls under
152
- description: what was found
153
- evidence: specific file:line or observation
154
- recommendation: what to do about it
155
- ```
145
+ Do not define a finding format here — the audit system supplies the finding
146
+ contract at audit time. The single source of truth for finding structure and
147
+ the severity vocabulary (`critical` / `warn` / `info` / `idea`) is the audit
148
+ output contract (`output-contract.md`) together with the machine schema
149
+ (`finding-schema.json`), both shipped by the audit module. Point cabinet
150
+ members at those, not at a hand-maintained block in this briefing.
@@ -89,7 +89,7 @@ Document any new advisory's signal source here when you add it, and call out exp
89
89
  | `lsp:ruby` | `Gemfile` or `*.rb` | `/plugin install ruby-lsp@claude-plugins-official` (also needs `gem install ruby-lsp` AND `ENABLE_LSP_TOOL=1`) |
90
90
  | `mcp:railway` | `railway.toml` and no railway key in `~/.claude.json` (no-probe) | local: `railway setup agent -y` · remote: register `mcp.railway.com` (OAuth) |
91
91
  | `plugin:hookify` | `.claude/rules/enforcement-pipeline.md` exists and hookify not in `claude plugin list` (signal is **static**; probe-gated) | `/plugin install hookify` |
92
- | `briefing-file` | `.claude/briefing/_briefing.md` is **absent** (signal `missing`, **static**; no-probe) | run `/onboard` to create one |
92
+ | `briefing-file` | `.claude/cabinet/_briefing.md` is **absent** (canonical location — where cabinet members read; `.claude/briefing/` holds only installer-seeded templates) (signal `missing`, **static**; no-probe) | run `/onboard` to create one |
93
93
  | `registry-orphan` | `~/.claude/cc-registry.json` lists project path(s) that no longer exist (signal = sorted orphan-name set, so it re-arms when the registry changes; no-probe) | remove the dead entr(y/ies) from `~/.claude/cc-registry.json` |
94
94
 
95
95
  > Note: `mcp:railway` keys on `railway.toml`, which Ring 1 also marker-checks for deploy detection — these are independent reads of the same file for different purposes; do not consolidate them (the advisory adds the `~/.claude.json` registration predicate Ring 1 lacks).
@@ -19,9 +19,23 @@ state.
19
19
  | Writer | When | What |
20
20
  |--------|------|------|
21
21
  | `/execute` `post-impl-checklist` phase | every run past its no-op guard | increments `runs`; per triggered dimension increments `fires`, sets `last_fired` |
22
- | `/debrief` `checklist-feedback` phase | when a session bug WAS caught via a surfaced check | appends to that dimension's `catches` |
22
+ | Ring 3 close `checklist-catch` lens (Phase 2p) | session close, when the transcript shows a surfaced check that caught a real bug | appends to that dimension's `catches` |
23
+ | `/debrief` `checklist-feedback` phase (pre-watchtower; retiring) | when a session bug WAS caught via a surfaced check | appends to that dimension's `catches` |
23
24
  | `/audit` `checklist-pruning` phase | every pruning verdict (including "keep") | appends to `pruning_reviews` |
24
25
 
26
+ The **catch side is recorded automatically at session close** by the
27
+ Ring 3 `checklist-catch` lens (`watchtower-ring3-close.mjs`, Phase 2p)
28
+ for watchtower-installed projects — it reads the transcript, attributes
29
+ catches to a named dimension, and writes them via the protocol below.
30
+ `/debrief`'s `checklist-feedback` phase did this interactively and is
31
+ retired by the watchtower burn-in (its sharpening side — proposing new
32
+ checks for bugs that *slipped through* — needs operator approval and
33
+ cannot move to a background ring; only the catch tally moved). The two
34
+ writers are mutually exclusive in practice: a watchtower project closes
35
+ through Ring 3, a non-watchtower project through debrief, and both
36
+ follow the same atomic, fail-open write protocol — so the catches a
37
+ later audit prunes against are recorded the same way regardless.
38
+
25
39
  ## Schema (`schema_version: 1`)
26
40
 
27
41
  ```json
@@ -5,18 +5,35 @@ their job. Adapted from Anthropic's skill-creator eval framework for manual
5
5
  assessment. This is not an automated test suite — it's a structured way to
6
6
  ask "is this skill working?" and get an evidence-based answer.
7
7
 
8
- ## When This Runs
9
-
10
- Two trigger mechanisms ensure this protocol doesn't just sit as a document:
8
+ > **STATUS pull-only reference (auto-assessment retired, act:62608a5d).**
9
+ > The full manual assertion-scoring framework below has never run on a
10
+ > recurring boundary (0 Assessment Log entries across the tree; /pulse has 0
11
+ > lifetime standalone invocations). Rather than claim a discipline that
12
+ > doesn't run, it is now explicitly **on-demand only** — invoke it when
13
+ > refining a specific skill (the Pull trigger). The one part that DOES run on
14
+ > a schedule is the mechanical dead/stale-skill signal (`skill-usage.mjs`),
15
+ > now wired into the `/audit` structural-checks phase (workflow-cop-0006). The
16
+ > heavyweight per-skill assertion scoring is not automated and is not claimed
17
+ > to be.
11
18
 
12
- 1. **Pull (via prompt refinement):** When reviewing a skill's definition,
13
- run the assessment before proposing changes. The assessment grounds the
14
- refinement in evidence rather than intuition.
19
+ ## When This Runs
15
20
 
16
- 2. **Push (via process-therapist):** During audits, process-therapist checks whether
17
- any skill's last assessment is older than 30 days. If so, it surfaces
18
- an "eval overdue" finding, which enters the normal triage flow. The
19
- user decides whether to act on it.
21
+ 1. **Pull (via prompt refinement) the live path:** When reviewing a
22
+ skill's definition, run the assessment before proposing changes. The
23
+ assessment grounds the refinement in evidence rather than intuition. This
24
+ is on-demand; nothing schedules it.
25
+
26
+ 2. **Mechanical signal (via /audit) — the automated half:** The
27
+ dead/stale-skill reader (`skill-usage.mjs`) runs in the audit
28
+ structural-checks phase and surfaces never-invoked/stale skills on audit
29
+ cadence (workflow-cop-0006). That is the running boundary; the full
30
+ assertion-scoring assessment above is not auto-triggered.
31
+
32
+ > Retired: an earlier "Push (via process-therapist): during audits,
33
+ > check whether any skill's last assessment is >30 days and surface an
34
+ > 'eval overdue' finding" mechanism was documented here but never fired —
35
+ > process-therapist does not run per-skill assessments. The honest
36
+ > replacement is the mechanical signal above.
20
37
 
21
38
  ## The Assessment Framework
22
39
 
@@ -0,0 +1,135 @@
1
+ # Memory Lifecycle Contract
2
+
3
+ The shared contract for how built-in memory stays bounded as it grows.
4
+ Every component that reads or writes the memory dir follows this:
5
+ `validate-memory.mjs`, `write-memory-file.mjs`, the `/cc-remember` and
6
+ `/memory` skills, the `memory-index-guard` hook, and (Stage 2) the
7
+ lifecycle verbs. Full design + cabinet critique: see
8
+ `.claude/plans/cross-store-memory-redesign.md` (act:02d15a70 = Stage 1,
9
+ this contract; act:45fb9169 = Stage 2, gated).
10
+
11
+ ## The core principle
12
+
13
+ `MEMORY.md` is loaded **in full at every session start** — it competes
14
+ for the model's context window, so it has a hard budget (≤200 lines /
15
+ ≤25KB). The disease this contract cures: the old rule required the
16
+ eagerly-loaded index to enumerate EVERY memory file (one line each), so
17
+ its size tracked total memory count and it overflowed forever — the
18
+ prune→overflow→prune treadmill.
19
+
20
+ The fix decouples the eager index from total volume: `MEMORY.md` is a
21
+ bounded **working set**, not a complete catalogue. Total memory can grow
22
+ without bound (disk and search both scale for decades); only what loads
23
+ eagerly is bounded. This is the same shape watchtower threads already
24
+ use — surface the current cursor, leave the history on disk.
25
+
26
+ ## The three blocks of MEMORY.md
27
+
28
+ A well-formed `MEMORY.md` working set has three kinds of content:
29
+
30
+ 1. **Pinned tier (decay-exempt).** Load-bearing knowledge a fresh
31
+ session needs surfaced *unbidden* — hard constraints, identity, hard
32
+ preferences, active-project pointers. These are valuable precisely
33
+ because they are stable and often OLD; they must never decay out on
34
+ recency. The defining test: *would a session that has never seen this
35
+ fail without it, and would it not know to go looking?* (e.g. "CC
36
+ hooks read tool input from stdin, not `$CLAUDE_TOOL_INPUT`".) Mark a
37
+ pinned entry with `pinned: true` in its file frontmatter (the Stage-1
38
+ default authority; revisit in Stage 2).
39
+
40
+ 2. **Recency block.** The recent window of curated entries, newest
41
+ first, filling the remaining budget to roughly 80% of the cap.
42
+ Recency is a fine proxy for "likely relevant next session" for
43
+ episodic material — and a BAD proxy for load-bearing constraints,
44
+ which is exactly why they go in the pinned tier instead.
45
+
46
+ 3. **Region pointers.** The cue-based-retrieval tier (see below) that
47
+ lets everything outside the working set stay reachable without a line
48
+ each.
49
+
50
+ ## Reachability replaces enumeration
51
+
52
+ The validator invariant is no longer "every file has its own index
53
+ line." It is: **every on-disk memory file is reachable from
54
+ `MEMORY.md`** — by one of:
55
+
56
+ - a direct working-set or `MEMORY-archive.md` index line, OR
57
+ - a **region pointer** whose glob matches the file.
58
+
59
+ A file that is none of these is an orphan and fails validation.
60
+ "Present on disk" alone is **not** reachable — that test would be
61
+ vacuous (every file is grep-able), which would silently delete the
62
+ guarantee rather than relax it. The point of relaxing enumeration is to
63
+ allow *bounded* indexing (a region covers N files with one line), not to
64
+ allow invisible files.
65
+
66
+ ## Region pointers
67
+
68
+ A region pointer declares that a whole class of files is reachable
69
+ without enumerating them. Format — the **backtick-quoted glob is the
70
+ only part the validator reads**; the rest is free-text guidance:
71
+
72
+ ```
73
+ - region `lesson_*.md` → older lessons; grep the memory dir
74
+ - region `session_summary_*.md` → past session records; grep by date
75
+ ```
76
+
77
+ Rules:
78
+
79
+ - **Globs use `*` and `?` only**, matched against the bare filename.
80
+ - **Region pointers are DERIVED, never authoritative.** They are
81
+ regenerated from what's actually on disk (by hand in Stage 1, by the
82
+ consolidation pass in Stage 2). A pointer whose glob matches **zero**
83
+ files on disk is a stale, confidently-wrong retrieval cue — *worse
84
+ than no map* — and **fails validation**. Fix the glob or remove it;
85
+ never hand-edit a pointer to claim a region that isn't there.
86
+ - **Region pointers are for recoverable history you'd think to search**
87
+ (old session narratives, cooled lesson archives). They are the WRONG
88
+ home for latent constraints — those stay in the pinned tier, eagerly
89
+ present, because their value is that you retrieve them *without*
90
+ knowing to look.
91
+
92
+ ## Spill-rate instrumentation (the Stage-2 gate)
93
+
94
+ `validate-memory.mjs` appends a working-set pressure sample to
95
+ `<memoryDir>/.memory-pressure.jsonl` (a dotfile — invisible to the
96
+ orphan scan) at most once per day, only when utilization is ≥90% of the
97
+ budget. This measures how often the working set actually runs near its
98
+ limit, so Stage 2 (the lifecycle verbs + a background forcing function)
99
+ is built only if the data shows recurring pressure on authored files —
100
+ not on a felt "it keeps overflowing" metaphor. Stage 1 alone stops the
101
+ acute treadmill; the sampler decides whether Stage 2 is warranted.
102
+
103
+ ## Stage 2 (designed, gated — NOT yet built)
104
+
105
+ The lifecycle verbs and their forcing function are specified in the plan
106
+ but gated on the spill-rate data. When built they will carry these
107
+ already-decided constraints (recorded here so Stage 1 doesn't paint them
108
+ into a corner):
109
+
110
+ - **decay** — drop an entry from the working set; the file stays
111
+ reachable (via a region pointer or the archive). Reversible.
112
+ - **consolidate** — merge a cluster into one gist that ALWAYS keeps a
113
+ lossless `consolidated_from:` provenance pointer (lossy = dropped from
114
+ the working set, never erased from disk). A cluster containing a
115
+ pinned/load-bearing entry files to the inbox; it never auto-applies,
116
+ because the *gist* becomes the retrieved truth and a wrong gist erases
117
+ a load-bearing detail.
118
+ - **supersede** — mark an entry false/obsolete so retrieval stops
119
+ surfacing it as live truth (kept on disk for audit, with a reverse
120
+ breadcrumb in its successor). Deferred until the frontmatter-parsing
121
+ question is resolved (line-scan vs. a deliberately-added dependency —
122
+ the repo currently refuses a YAML parser; see
123
+ `lesson_parsefrontmatter_flow_sequences`). supersede is a reference
124
+ graph: dangling targets, cycles, and re-pointing working-set/region
125
+ references to the superseded slug must all be validated.
126
+ - **Cross-store fold** — for session-summaries carrying design
127
+ reasoning, the durable target is a committed `.claude/methodology/`
128
+ gist, NEVER the thread cursor (which holds understanding, not
129
+ narration) and NEVER a delete-in-the-same-pass (the memory dir and
130
+ threads are both local-only/ungit'd; append-verify-then-mark
131
+ `folded_into:`, reclaim in a separate idempotent sweep).
132
+ - **Forcing function** — memory hygiene (decay/consolidate) extends
133
+ Ring 2-slow's existing `runMemoryHygiene`; only drift-supersede is the
134
+ Ring 4 memory pass. No new ring for hygiene. First passes run
135
+ dry-run-with-report.
@@ -23,6 +23,19 @@ Check: are pib_* MCP tools available?
23
23
  NO → use node scripts/pib-db.mjs list-projects, etc.
24
24
  ```
25
25
 
26
+ ### MCP invocation specifics (read before first use, not after a failure)
27
+
28
+ Two details that otherwise cost a failed call + a `ToolSearch` round-trip
29
+ every session:
30
+
31
+ - **Full tool names are prefixed `mcp__pib-db__`** (e.g.
32
+ `mcp__pib-db__pib_query`). When loading deferred tools via `ToolSearch`,
33
+ query `select:mcp__pib-db__pib_query,mcp__pib-db__pib_list_actions` —
34
+ the bare `pib_*` names will not match.
35
+ - **`pib_query`'s parameter is `sql`, not `query`.** Calling it with a
36
+ `query` argument fails (and can fail quietly). The CLI form is
37
+ `query "SQL"`; the MCP form is `{ "sql": "SELECT ..." }`.
38
+
26
39
  ## Available Operations
27
40
 
28
41
  | MCP Tool | CLI Equivalent | Description |