create-claude-cabinet 0.15.0 → 0.16.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.
package/lib/cli.js CHANGED
@@ -356,7 +356,7 @@ const MODULES = {
356
356
  mandatory: false,
357
357
  default: true,
358
358
  lean: true,
359
- templates: ['hooks/git-guardrails.sh', 'hooks/cc-upstream-guard.sh', 'hooks/skill-telemetry.sh', 'hooks/skill-tool-telemetry.sh', 'hooks/compaction-save.md', 'hooks/compaction-recover.sh', 'scripts/cc-drift-check.cjs'],
359
+ templates: ['hooks/git-guardrails.sh', 'hooks/cc-upstream-guard.sh', 'hooks/skill-telemetry.sh', 'hooks/skill-tool-telemetry.sh', 'scripts/cc-drift-check.cjs'],
360
360
  },
361
361
  'work-tracking': {
362
362
  name: 'Work Tracking (pib-db or markdown)',
@@ -15,19 +15,6 @@ const MEMORY_HOOKS = {
15
15
  ],
16
16
  };
17
17
 
18
- // Prompt text for the PreCompact hook. Source of truth: templates/hooks/compaction-save.md
19
- const COMPACTION_SAVE_PROMPT = `Before compaction destroys your current context, you MUST save state so the next session can recover.
20
-
21
- REQUIRED — Always write .claude/compaction-state.md with these sections:
22
- - Current Task: what you were actively working on (file paths, function names, exact step)
23
- - Decisions Made: key decisions with reasoning
24
- - Next Steps: ordered list, most urgent first
25
- - References: files, URLs, error messages needed by next context
26
-
27
- CONDITIONAL — If mid-workflow with intermediate results, ALSO write .claude/<workflow-name>-partial.md (e.g. .claude/audit-partial.md for a mid-audit). Include completed items, partial results, progress tracking.
28
-
29
- Keep total output under 200 lines. Use concrete details, not vague summaries. Write the files now.`;
30
-
31
18
  const DEFAULT_HOOKS = {
32
19
  PreToolUse: [
33
20
  {
@@ -71,27 +58,6 @@ const DEFAULT_HOOKS = {
71
58
  ],
72
59
  },
73
60
  ],
74
- PreCompact: [
75
- {
76
- hooks: [
77
- {
78
- type: 'prompt',
79
- prompt: COMPACTION_SAVE_PROMPT,
80
- },
81
- ],
82
- },
83
- ],
84
- SessionStart: [
85
- {
86
- matcher: 'compact',
87
- hooks: [
88
- {
89
- type: 'command',
90
- command: '.claude/hooks/compaction-recover.sh',
91
- },
92
- ],
93
- },
94
- ],
95
61
  };
96
62
 
97
63
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-claude-cabinet",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Claude Cabinet — opinionated process scaffolding for Claude Code projects",
5
5
  "bin": {
6
6
  "create-claude-cabinet": "bin/create-claude-cabinet.js"
@@ -201,11 +201,17 @@ Read `phases/finding-output.md` for how to persist and report the
201
201
  audit results.
202
202
 
203
203
  **Default (absent/empty):**
204
+
205
+ **Access method:** Use `pib_*` MCP tools when available (see
206
+ `.claude/cabinet/pib-db-access.md`), fall back to `node scripts/pib-db.mjs`
207
+ CLI.
208
+
204
209
  1. Create a timestamped run directory: `reviews/YYYY-MM-DD/HH-MM-SS/`
205
210
  2. Write each cabinet member's JSON output to the run directory
206
211
  3. Run `scripts/merge-findings.js <run-dir>` to produce `run-summary.json`
207
- 4. Run `scripts/merge-findings.js <run-dir> --db` to also ingest into
208
- the reference data layer (if pib-db is initialized)
212
+ 4. Ingest into the reference data layer: use `pib_ingest_findings` with
213
+ the run directory (or `scripts/merge-findings.js <run-dir> --db`) if
214
+ pib-db is initialized
209
215
  5. Present findings summary: total count, breakdown by severity, by
210
216
  cabinet member, and highlight any critical findings
211
217
 
@@ -25,6 +25,11 @@ directives:
25
25
  seed: >
26
26
  Evaluate whether a proposed cabinet member or skill overlaps with built-in
27
27
  Claude Code functionality. If the platform already does it, say so.
28
+ verify: >
29
+ Before recommending adoption of any platform feature, confirm it works
30
+ for the project's use case — not just that it exists in the changelog.
31
+ Test it or cite authoritative documentation showing it works as needed.
32
+ "The changelog says X exists" is not verification.
28
33
  ---
29
34
 
30
35
  # Claude Ecosystem Cabinet Member
@@ -232,6 +237,26 @@ the project is using what the platform offers:
232
237
  - **Version awareness** — does the project track which Claude Code version
233
238
  it targets? Will it work with older/newer versions?
234
239
 
240
+ #### 8. Feature Verification
241
+
242
+ Before recommending adoption of any platform capability:
243
+
244
+ - **GA check** — Is the feature generally available, or experimental/beta?
245
+ Experimental features may change or be removed.
246
+ - **Hook type check** — Does the feature work for the specific hook type,
247
+ tool type, or invocation context being proposed? (e.g., prompt hooks
248
+ cannot take actions; command hooks can.)
249
+ - **Minimal test** — Can you demonstrate the behavior works with a quick
250
+ test? If you can't test it, cite authoritative documentation that
251
+ explicitly confirms the behavior for your use case.
252
+ - **Limitation inventory** — What are the known limitations? Are there
253
+ open issues or feature requests that indicate the feature doesn't do
254
+ what you'd expect?
255
+
256
+ **The standard:** "The changelog says X exists" is not verification.
257
+ "I tested X and it does Y" or "The hooks documentation explicitly states
258
+ prompt hooks can/cannot Z" is verification.
259
+
235
260
  ### Scan Scope
236
261
 
237
262
  - `.claude/settings*.json` — configuration and permissions
@@ -324,3 +349,12 @@ field-feedback. The CC maintainer adds it to this section. Project-specific
324
349
  patterns that don't generalize stay in `patterns-project.md`.
325
350
 
326
351
  <!-- Universal patterns below this line -->
352
+
353
+ - **Unverified platform recommendation (PreCompact hooks):** Recommended
354
+ adopting PreCompact/PostCompact hooks for compaction state management.
355
+ PreCompact prompt hooks are single-turn policy evaluations with no tool
356
+ access — they cannot write files, run commands, or take any action.
357
+ The hooks were designed, built, shipped in v0.15.0, and deployed to 3
358
+ consumers where they silently failed. GitHub issues #43733 and #36749
359
+ are open feature requests for agentic PreCompact support. Always verify
360
+ that the hook type supports the intended action before recommending.
@@ -224,9 +224,10 @@ drift between the two:
224
224
  - Work tracking specifically: the pib-db scripts ship with both the
225
225
  work-tracking and audit modules, so `.ccrc.json` alone doesn't tell
226
226
  you if work tracking is active. Check whether `pib.db` exists AND
227
- has projects/actions with real data (`node scripts/pib-db.mjs
228
- list-projects`). If it does but the briefing says "no work tracking,"
229
- that's a direct contradiction.
227
+ has projects/actions with real data — use `pib_list_projects` (or
228
+ `node scripts/pib-db.mjs list-projects` CLI fallback). If it does
229
+ but the briefing says "no work tracking," that's a direct
230
+ contradiction.
230
231
  - `.ccrc.json` version vs `package.json` version — they should match.
231
232
  - `package.json` dependencies vs what the briefing describes as the
232
233
  tech stack. New dependencies not mentioned? Removed ones still listed?
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: cabinet-organized-mind
3
3
  description: >
4
- Levitin's cognitive neuroscience applied to system design. Thinks about
4
+ Levitin's cognitive neuroscience applied to system design for human operators. Thinks about
5
5
  attention economics (the two brain modes, switching costs, the 120-bit
6
6
  bottleneck), memory architecture (associative, reconstructive, overconfident),
7
7
  categorization theory (functional vs. taxonomic, fuzzy boundaries, the
@@ -17,13 +17,33 @@ standing-mandate: audit, plan
17
17
  tools: []
18
18
  directives:
19
19
  plan: >
20
- Evaluate cognitive load. Will this plan's result be understandable
21
- and maintainable? Does it externalize complexity or pile it on the
22
- operator?
20
+ Evaluate cognitive load on human operators. Will this plan's result
21
+ be understandable and maintainable by humans? Does it externalize
22
+ complexity or pile it on the human operator?
23
23
  ---
24
24
 
25
25
  # The Organized Mind
26
26
 
27
+ ## Scope: Human Cognition, Not AI Cognition
28
+
29
+ Every principle in this member's toolkit — working memory limits, decision
30
+ fatigue, attention economics, the 120-bit bottleneck, metabolic switching
31
+ costs — comes from human neuroscience. These constraints apply to the
32
+ **human operators** who use, maintain, and make decisions with this system.
33
+
34
+ Claude does not share these constraints. Claude has no metabolic cost for
35
+ context switching, no working memory ceiling in the human sense, no
36
+ decision fatigue from accumulated choices, and no need for externalization
37
+ to prevent forgetting.
38
+
39
+ When this member evaluates whether a system imposes cognitive load, the
40
+ question is always: **"on the human."** A dashboard with 15 columns costs
41
+ a human attention and working memory. It costs Claude nothing. A workflow
42
+ requiring the operator to remember 6 implicit rules taxes human cognition.
43
+ Claude reads the rules file and moves on.
44
+
45
+ Design for the human. Claude adapts.
46
+
27
47
  ## Identity
28
48
 
29
49
  You think with the full conceptual apparatus of Daniel Levitin's *The
@@ -57,7 +57,15 @@ Present the draft to the user:
57
57
  If the user confirms, deliver using the standard upstream feedback
58
58
  mechanism:
59
59
 
60
- **If linked** (CC package resolves to a local directory check if
60
+ **If this IS the CC source repo** (check: `node -e "const p = require('./package.json'); process.exit(p.name === 'create-claude-cabinet' ? 0 : 1)"` exits 0):
61
+
62
+ - Write directly to the local `feedback/` directory (create if needed)
63
+ - Filename: `[source-project]-[date]-[short-title].md`
64
+ - This is the dogfood case — the project IS the upstream repo, so
65
+ feedback goes directly into the local `feedback/` directory.
66
+
67
+ **If linked** (not the source repo, but CC package resolves to a local
68
+ directory — check if
61
69
  `node -e "console.log(require.resolve('create-claude-cabinet'))"` points
62
70
  to a local path rather than `node_modules`):
63
71
 
@@ -88,7 +88,12 @@ each project that is NOT the CC source repo itself:
88
88
  2. If it's older than the just-published version, update it:
89
89
  - `cd <path> && npx create-claude-cabinet@latest --yes`
90
90
  - Verify the install succeeded (`.ccrc.json` version matches)
91
- 3. Report which consumers were updated and which were already current
91
+ 3. After a successful update, commit the CC-managed files in the consumer:
92
+ - `git -C <path> add .claude/ .mcp.json scripts/pib-db*.mjs scripts/pib-db-schema.sql scripts/*.cjs .ccrc.json`
93
+ - Commit with message: `chore: update claude-cabinet to v<version>`
94
+ - Only stage files that are actually modified (`git -C <path> diff --name-only` to check)
95
+ - Do NOT push — leave that to the user
96
+ 4. Report which consumers were updated, committed, and which were already current
92
97
 
93
98
  **Important:**
94
99
  - Never force-install or pass flags beyond `--yes` — the installer
@@ -96,3 +101,5 @@ each project that is NOT the CC source repo itself:
96
101
  - If a consumer's path doesn't exist, note it (stale registry entry)
97
102
  but don't error — mention it in the report
98
103
  - If an install fails, report the error but continue with other consumers
104
+ - The commit in step 3 should only include CC-managed files, not any
105
+ project-owned files that happen to be dirty in the working tree
@@ -22,10 +22,8 @@ this phase entirely.
22
22
  For each cabinet member that produced findings this session, check
23
23
  whether the same CLASS of finding has appeared before:
24
24
 
25
- - Check triage history if available:
26
- ```bash
27
- node scripts/pib-db.mjs triage-history 2>/dev/null
28
- ```
25
+ - Check triage history if available: use `pib_triage_history` (or
26
+ `node scripts/pib-db.mjs triage-history` CLI fallback).
29
27
  Look for approved findings from the same cabinet member with similar
30
28
  descriptions.
31
29
 
@@ -12,17 +12,21 @@ pib-db is not initialized, skip gracefully.
12
12
 
13
13
  ## Default Behavior (pib-db)
14
14
 
15
+ **Access method:** Use `pib_*` MCP tools when available (see
16
+ `.claude/cabinet/pib-db-access.md`), fall back to `node scripts/pib-db.mjs`
17
+ CLI.
18
+
15
19
  When no custom close-work is configured:
16
20
 
17
21
  1. **Get session work:** Review `git log --oneline` for this session's
18
22
  commits (since session start or last 2 hours)
19
- 2. **Get open actions:** `node scripts/pib-db.mjs list-actions`
23
+ 2. **Get open actions:** Use `pib_list_actions` (or `node scripts/pib-db.mjs list-actions`)
20
24
  3. **Match:** For each open action, check if this session's work
21
25
  addresses it (compare action text/notes against commit messages
22
26
  and changed files)
23
27
  4. **Propose:** Present matched actions and ask the user to confirm
24
28
  which to close
25
- 5. **Close confirmed:** `node scripts/pib-db.mjs complete-action <fid>`
29
+ 5. **Close confirmed:** Use `pib_complete_action` (or `node scripts/pib-db.mjs complete-action <fid>`)
26
30
 
27
31
  If pib-db doesn't exist, skip with a note.
28
32
 
@@ -122,23 +126,23 @@ leaving it active is stale state that erodes trust in the work tracker.
122
126
 
123
127
  When using pib-db (default):
124
128
 
125
- ```bash
126
- node scripts/pib-db.mjs query "
127
- SELECT p.fid, p.name,
128
- (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid) as total,
129
- (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid AND a.completed = 1) as done
130
- FROM projects p
131
- WHERE p.status = 'active'
132
- AND p.deleted_at IS NULL
133
- AND (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid) > 0
134
- AND (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid AND a.completed = 0 AND a.deleted_at IS NULL) = 0
135
- "
129
+ Use `pib_query` (or `node scripts/pib-db.mjs query`) with:
130
+ ```sql
131
+ SELECT p.fid, p.name,
132
+ (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid) as total,
133
+ (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid AND a.completed = 1) as done
134
+ FROM projects p
135
+ WHERE p.status = 'active'
136
+ AND p.deleted_at IS NULL
137
+ AND (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid) > 0
138
+ AND (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid AND a.completed = 0 AND a.deleted_at IS NULL) = 0
136
139
  ```
137
140
 
138
141
  For each result: all actions are complete. Propose completing the project:
139
142
  - Show the project name and action count (e.g., "prj:abc — My Project (5/5 actions done)")
140
143
  - Ask the user to confirm before closing
141
- - On confirmation: `node scripts/pib-db.mjs query "UPDATE projects SET status = 'done', completed_at = date('now') WHERE fid = '<fid>'"`
144
+ - On confirmation, use `pib_query` (or `node scripts/pib-db.mjs query`) with:
145
+ `UPDATE projects SET status = 'done', completed_at = date('now') WHERE fid = '<fid>'`
142
146
 
143
147
  **Design notes:**
144
148
  - Projects with zero total actions are excluded — they may be containers
@@ -80,8 +80,16 @@ friction points (rare), present each separately.
80
80
  If the user confirms, deliver the feedback. Detection and delivery
81
81
  follow the same pattern as `/cc-extract`:
82
82
 
83
- **If linked** (the CC package resolves to a local directory check
84
- if `node -e "console.log(require.resolve('create-claude-cabinet'))"`
83
+ **If this IS the CC source repo** (check: `node -e "const p = require('./package.json'); process.exit(p.name === 'create-claude-cabinet' ? 0 : 1)"` exits 0):
84
+
85
+ - Write directly to the local `feedback/` directory (create if needed)
86
+ - Filename: `[source-project]-[date]-[short-title].md`
87
+ - This is the dogfood case — the project IS the upstream repo, so
88
+ feedback goes directly into the local `feedback/` directory.
89
+
90
+ **If linked** (not the source repo, but CC package resolves to a local
91
+ directory — check if
92
+ `node -e "console.log(require.resolve('create-claude-cabinet'))"`
85
93
  points to a local path rather than a `node_modules` path):
86
94
 
87
95
  - Write the feedback as a markdown file in the CC repo's `feedback/`
@@ -54,16 +54,19 @@ Phase files have three states:
54
54
  Read `phases/fetch-plans.md` for where plans come from.
55
55
 
56
56
  **Default (absent/empty):** Query pib-db for open actions that have
57
- surface area declarations:
58
-
59
- ```bash
60
- node scripts/pib-db.mjs query "
61
- SELECT a.fid, a.text, a.notes
62
- FROM actions a
63
- WHERE a.completed = 0 AND a.deleted_at IS NULL
64
- AND a.notes LIKE '%## Surface Area%'
65
- ORDER BY a.sort_order
66
- "
57
+ surface area declarations.
58
+
59
+ **Access method:** Use `pib_*` MCP tools when available (see
60
+ `.claude/cabinet/pib-db-access.md`), fall back to `node scripts/pib-db.mjs`
61
+ CLI.
62
+
63
+ Use `pib_query` (or `node scripts/pib-db.mjs query`) with:
64
+ ```sql
65
+ SELECT a.fid, a.text, a.notes
66
+ FROM actions a
67
+ WHERE a.completed = 0 AND a.deleted_at IS NULL
68
+ AND a.notes LIKE '%## Surface Area%'
69
+ ORDER BY a.sort_order
67
70
  ```
68
71
 
69
72
  Projects using external APIs, different databases, or filtered project
@@ -198,7 +201,8 @@ and validated (and post-group actions complete, if defined).
198
201
 
199
202
  Read `phases/completion.md` for how to mark plans as done after execution.
200
203
 
201
- **Default (absent/empty):** Mark completed plans via pib-db:
204
+ **Default (absent/empty):** Mark completed plans via pib-db. Use
205
+ `pib_complete_action` (or CLI fallback):
202
206
  ```bash
203
207
  node scripts/pib-db.mjs complete-action <fid>
204
208
  ```
@@ -136,55 +136,55 @@ whatever the project uses to track work: a backlog, task list, inbox,
136
136
  queue, or issue tracker.
137
137
 
138
138
  **Default (absent/empty):** If `scripts/pib-db.mjs` exists, run the
139
- standard work scan:
139
+ standard work scan.
140
+
141
+ **Access method:** Use `pib_*` MCP tools when available (see
142
+ `.claude/cabinet/pib-db-access.md`), fall back to `node scripts/pib-db.mjs`
143
+ CLI.
140
144
 
141
145
  1. **Active projects and open actions:**
142
- ```bash
143
- node scripts/pib-db.mjs query "
144
- SELECT p.fid, p.name,
145
- (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid AND a.completed = 0 AND a.deleted_at IS NULL) as open_actions
146
- FROM projects p
147
- WHERE p.status = 'active' AND p.deleted_at IS NULL
148
- ORDER BY open_actions DESC
149
- "
146
+ Use `pib_query` (or `node scripts/pib-db.mjs query`) with:
147
+ ```sql
148
+ SELECT p.fid, p.name,
149
+ (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid AND a.completed = 0 AND a.deleted_at IS NULL) as open_actions
150
+ FROM projects p
151
+ WHERE p.status = 'active' AND p.deleted_at IS NULL
152
+ ORDER BY open_actions DESC
150
153
  ```
151
154
 
152
155
  2. **Flagged actions** (prioritized items needing attention):
153
- ```bash
154
- node scripts/pib-db.mjs query "
155
- SELECT a.fid, a.text, p.name as project
156
- FROM actions a
157
- LEFT JOIN projects p ON a.project_fid = p.fid
158
- WHERE a.flagged = 1 AND a.completed = 0 AND a.deleted_at IS NULL
159
- "
156
+ Use `pib_query` (or `node scripts/pib-db.mjs query`) with:
157
+ ```sql
158
+ SELECT a.fid, a.text, p.name as project
159
+ FROM actions a
160
+ LEFT JOIN projects p ON a.project_fid = p.fid
161
+ WHERE a.flagged = 1 AND a.completed = 0 AND a.deleted_at IS NULL
160
162
  ```
161
163
 
162
164
  3. **Staleness detection** — flag projects that need attention:
163
165
 
164
166
  **Completion candidates** — active projects where all actions are done:
165
- ```bash
166
- node scripts/pib-db.mjs query "
167
- SELECT p.fid, p.name
168
- FROM projects p
169
- WHERE p.status = 'active' AND p.deleted_at IS NULL
170
- AND (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid) > 0
171
- AND (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid AND a.completed = 0 AND a.deleted_at IS NULL) = 0
172
- "
167
+ Use `pib_query` (or `node scripts/pib-db.mjs query`) with:
168
+ ```sql
169
+ SELECT p.fid, p.name
170
+ FROM projects p
171
+ WHERE p.status = 'active' AND p.deleted_at IS NULL
172
+ AND (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid) > 0
173
+ AND (SELECT COUNT(*) FROM actions a WHERE a.project_fid = p.fid AND a.completed = 0 AND a.deleted_at IS NULL) = 0
173
174
  ```
174
175
 
175
176
  **Stale projects** — active projects with no action completed in 14+ days:
176
- ```bash
177
- node scripts/pib-db.mjs query "
178
- SELECT p.fid, p.name,
179
- MAX(a.completed_at) as last_completion
180
- FROM projects p
181
- LEFT JOIN actions a ON a.project_fid = p.fid AND a.completed = 1
182
- WHERE p.status = 'active' AND p.deleted_at IS NULL
183
- AND (SELECT COUNT(*) FROM actions a2 WHERE a2.project_fid = p.fid AND a2.completed = 0 AND a2.deleted_at IS NULL) > 0
184
- GROUP BY p.fid
185
- HAVING last_completion < date('now', '-14 days')
186
- OR last_completion IS NULL
187
- "
177
+ Use `pib_query` (or `node scripts/pib-db.mjs query`) with:
178
+ ```sql
179
+ SELECT p.fid, p.name,
180
+ MAX(a.completed_at) as last_completion
181
+ FROM projects p
182
+ LEFT JOIN actions a ON a.project_fid = p.fid AND a.completed = 1
183
+ WHERE p.status = 'active' AND p.deleted_at IS NULL
184
+ AND (SELECT COUNT(*) FROM actions a2 WHERE a2.project_fid = p.fid AND a2.completed = 0 AND a2.deleted_at IS NULL) > 0
185
+ GROUP BY p.fid
186
+ HAVING last_completion < date('now', '-14 days')
187
+ OR last_completion IS NULL
188
188
  ```
189
189
 
190
190
  Surface in briefing as actionable signals:
@@ -231,7 +231,14 @@ needs to wire it up later" — the plan is incomplete. Dead code is not
231
231
  a feature. A callback nobody calls is not a feature.
232
232
 
233
233
  **b. Surface area completeness.** Every file mentioned in Implementation
234
- appears in Surface Area. New files are marked `(new)`.
234
+ appears in Surface Area. New files are marked `(new)`. The Surface Area
235
+ section MUST use the exact format that pib-db validates:
236
+ - Section header: `## Surface Area` (not `### Files`, not `### Surface Area`)
237
+ - Each entry: `- files: path/to/file` or `- dirs: path/to/dir/`
238
+ Do NOT use `### Files` with Created/Modified sublists or any other format
239
+ variant. The database rejects non-conforming notes at the API layer
240
+ (`pib-db-lib.mjs` validates structurally). If the plan uses the wrong
241
+ format, rewrite it before filing.
235
242
 
236
243
  **c. Acceptance criteria are testable.** Every criterion is pass/fail
237
244
  with a category tag ([auto], [manual], [deferred]).
@@ -269,8 +276,13 @@ work item in your project's tracking system.
269
276
  **Default (absent/empty):** If `scripts/pib-db.mjs` exists, file the
270
277
  approved plan as a pib-db action. Use the plan title as the action text
271
278
  and the full plan (with surface area, acceptance criteria, etc.) as the
272
- notes. If the plan belongs to an existing project, associate it:
279
+ notes. If the plan belongs to an existing project, associate it.
273
280
 
281
+ **Access method:** Use `pib_*` MCP tools when available (see
282
+ `.claude/cabinet/pib-db-access.md`), fall back to `node scripts/pib-db.mjs`
283
+ CLI.
284
+
285
+ Use `pib_create_action` (or CLI fallback):
274
286
  ```bash
275
287
  node scripts/pib-db.mjs create-action --text "<plan title>" --project "<project fid>" --notes "<full plan>"
276
288
  ```
@@ -10,11 +10,15 @@ proposed work. If pib-db is not initialized, skip gracefully.
10
10
 
11
11
  ## Default Behavior (pib-db)
12
12
 
13
- When no custom overlap check is configured:
13
+ **Access method:** Use `pib_*` MCP tools when available (see
14
+ `.claude/cabinet/pib-db-access.md`), fall back to `node scripts/pib-db.mjs`
15
+ CLI.
14
16
 
15
- ```bash
16
- # Search open actions for keywords related to the proposed work
17
- node scripts/pib-db.mjs query "SELECT fid, text, substr(notes, 1, 200) as notes_preview FROM actions WHERE completed = 0 AND deleted_at IS NULL AND (text LIKE '%keyword%' OR notes LIKE '%keyword%')"
17
+ When no custom overlap check is configured, use `pib_query` (or
18
+ `node scripts/pib-db.mjs query`) with:
19
+
20
+ ```sql
21
+ SELECT fid, text, substr(notes, 1, 200) as notes_preview FROM actions WHERE completed = 0 AND deleted_at IS NULL AND (text LIKE '%keyword%' OR notes LIKE '%keyword%')
18
22
  ```
19
23
 
20
24
  Search with multiple keywords derived from the proposed plan's problem
@@ -10,10 +10,14 @@ via `node scripts/pib-db.mjs init`.
10
10
 
11
11
  ## Default Behavior (pib-db)
12
12
 
13
- When no custom work tracker is configured:
13
+ **Access method:** Use `pib_*` MCP tools when available (see
14
+ `.claude/cabinet/pib-db-access.md`), fall back to `node scripts/pib-db.mjs`
15
+ CLI.
16
+
17
+ When no custom work tracker is configured, use `pib_create_action` (or
18
+ CLI fallback):
14
19
 
15
20
  ```bash
16
- # Create an action for the approved plan
17
21
  node scripts/pib-db.mjs create-action "Short imperative plan title" \
18
22
  --area "<area>" \
19
23
  --notes "## Problem\n...\n\n## Implementation\n..."
@@ -105,10 +105,15 @@ for a cabinet member is signal that the cabinet member's calibration is off.
105
105
  Read `phases/load-findings.md` for where to get the findings to triage.
106
106
 
107
107
  **Default (absent/empty):** Query the reference data layer (pib-db) for
108
- findings with `triage_status = 'open'`. If pib-db is not initialized or
109
- has no findings, fall back to reading the most recent
108
+ findings with `triage_status = 'open'`. Use `pib_query` (or
109
+ `node scripts/pib-db.mjs query`) with the appropriate SQL. If pib-db is
110
+ not initialized or has no findings, fall back to reading the most recent
110
111
  `reviews/*/run-summary.json` file.
111
112
 
113
+ **Access method:** Use `pib_*` MCP tools when available (see
114
+ `.claude/cabinet/pib-db-access.md`), fall back to `node scripts/pib-db.mjs`
115
+ CLI.
116
+
112
117
  Present a summary before triage: how many findings, breakdown by
113
118
  severity and cabinet member, how many are new vs previously seen.
114
119
 
@@ -142,27 +147,32 @@ decisions.
142
147
  **Default (absent/empty):** For each verdict:
143
148
 
144
149
  **Fix verdicts:**
145
- 1. Update finding's triage_status to 'approved' in pib-db
150
+ 1. Update finding's triage_status to 'approved' via `pib_triage`
151
+ (or `node scripts/pib-db.mjs triage`)
146
152
  2. If the finding is marked `autoFixable: true`, attempt the fix
147
153
  immediately. Verify the fix works before marking it done.
148
- 3. If not auto-fixable, create an action in pib-db with:
154
+ 3. If not auto-fixable, create an action via `pib_create_action`
155
+ (or `node scripts/pib-db.mjs create-action`) with:
149
156
  - Text: the finding title
150
157
  - Notes: finding description, evidence, suggested fix
151
158
  - Area: derived from cabinet member or finding metadata
152
159
 
153
160
  **Defer verdicts:**
154
- 1. Update finding's triage_status to 'deferred' in pib-db
161
+ 1. Update finding's triage_status to 'deferred' via `pib_triage`
162
+ (or `node scripts/pib-db.mjs triage`)
155
163
  2. Record the user's reason in triage_notes
156
164
  3. The finding will be suppressed in future audit runs
157
165
 
158
166
  **Reject verdicts:**
159
- 1. Update finding's triage_status to 'rejected' in pib-db
167
+ 1. Update finding's triage_status to 'rejected' via `pib_triage`
168
+ (or `node scripts/pib-db.mjs triage`)
160
169
  2. Record the user's reason in triage_notes
161
170
  3. The finding will be permanently suppressed in future audit runs
162
171
 
163
172
  **Question verdicts:**
164
173
  1. Finding stays open (triage_status remains 'open')
165
- 2. Record the question in triage_notes
174
+ 2. Record the question in triage_notes via `pib_triage`
175
+ (or `node scripts/pib-db.mjs triage`)
166
176
  3. The finding will appear again in the next triage
167
177
 
168
178
  If pib-db is not initialized, write verdicts to
@@ -19,29 +19,38 @@ Define your verdict application strategy:
19
19
 
20
20
  ## Default Behavior
21
21
 
22
+ **Access method:** Use `pib_*` MCP tools when available (see
23
+ `.claude/cabinet/pib-db-access.md`), fall back to `node scripts/pib-db.mjs`
24
+ CLI.
25
+
22
26
  ### Fix Verdicts
23
- 1. Update `triage_status = 'approved'` in pib-db
27
+ 1. Update `triage_status = 'approved'` via `pib_triage` (or
28
+ `node scripts/pib-db.mjs triage`)
24
29
  2. If `autoFixable: true`:
25
30
  - Attempt the fix based on the finding's `suggestedFix`
26
31
  - Verify the fix (run relevant tests or checks)
27
32
  - If successful, update `triage_status = 'fixed'`
28
33
  - If failed, create an action instead
29
34
  3. If not auto-fixable:
30
- - Create an action via `node scripts/pib-db.mjs create-action`
35
+ - Create an action via `pib_create_action` (or
36
+ `node scripts/pib-db.mjs create-action`)
31
37
  - Include finding details in action notes
32
38
 
33
39
  ### Defer Verdicts
34
- 1. Update `triage_status = 'deferred'` in pib-db
40
+ 1. Update `triage_status = 'deferred'` via `pib_triage` (or
41
+ `node scripts/pib-db.mjs triage`)
35
42
  2. Record reason in `triage_notes`
36
43
  3. Finding suppressed in future audits via triage history
37
44
 
38
45
  ### Reject Verdicts
39
- 1. Update `triage_status = 'rejected'` in pib-db
46
+ 1. Update `triage_status = 'rejected'` via `pib_triage` (or
47
+ `node scripts/pib-db.mjs triage`)
40
48
  2. Record reason in `triage_notes`
41
49
  3. Finding permanently suppressed in future audits
42
50
 
43
51
  ### Question Verdicts
44
- 1. Finding stays `triage_status = 'open'`
52
+ 1. Finding stays `triage_status = 'open'` — record question via
53
+ `pib_triage` (or `node scripts/pib-db.mjs triage`)
45
54
  2. Record question in `triage_notes`
46
55
  3. Finding reappears in next triage
47
56
 
@@ -4,8 +4,10 @@ Define where the triage skill loads audit findings from. The /triage-audit
4
4
  skill reads this file before presenting findings.
5
5
 
6
6
  When this file is absent or empty, the default behavior is: query pib-db
7
- for findings with `triage_status = 'open'`, fall back to the most recent
8
- `reviews/*/run-summary.json`. To explicitly skip, write only `skip: true`.
7
+ for findings with `triage_status = 'open'` using `pib_query` MCP tool
8
+ (or `node scripts/pib-db.mjs query` CLI fallback), fall back to the most
9
+ recent `reviews/*/run-summary.json`. To explicitly skip, write only
10
+ `skip: true`.
9
11
 
10
12
  ## What to Include
11
13
 
@@ -27,9 +29,10 @@ curl -s https://your-api.example.com/api/audit/findings?status=open \
27
29
  Returns JSON array of findings in the same format as run-summary.json.
28
30
 
29
31
  ### Specific Run
30
- Load findings from a specific audit run instead of all open findings:
31
- ```bash
32
- node scripts/pib-db.mjs query "SELECT * FROM audit_findings WHERE run_id = 'run-2026-04-01'"
32
+ Load findings from a specific audit run instead of all open findings.
33
+ Use `pib_query` (or `node scripts/pib-db.mjs query` CLI fallback):
34
+ ```sql
35
+ SELECT * FROM audit_findings WHERE run_id = 'run-2026-04-01'
33
36
  ```
34
37
 
35
38
  ### Multiple Sources
@@ -1,46 +0,0 @@
1
- #!/bin/bash
2
- # Compaction Recovery — SessionStart command hook (compact matcher)
3
- #
4
- # Reads compaction state files written by the PreCompact prompt hook
5
- # and outputs them to stdout for injection as additionalContext.
6
- #
7
- # Files checked:
8
- # .claude/compaction-state.md — always (main state)
9
- # .claude/*-partial.md — any workflow partial state files
10
-
11
- PROJECT_DIR="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
12
- STATE_FILE="$PROJECT_DIR/.claude/compaction-state.md"
13
-
14
- # Collect all partial state files
15
- PARTIAL_FILES=()
16
- for f in "$PROJECT_DIR"/.claude/*-partial.md; do
17
- [ -f "$f" ] && PARTIAL_FILES+=("$f")
18
- done
19
-
20
- # If no state files exist, output fallback message
21
- if [ ! -f "$STATE_FILE" ] && [ ${#PARTIAL_FILES[@]} -eq 0 ]; then
22
- echo "No compaction state found. This session started fresh (no prior compaction state to recover)."
23
- exit 0
24
- fi
25
-
26
- echo "=== COMPACTION RECOVERY ==="
27
- echo ""
28
- echo "State was saved before compaction. Use this to resume where you left off."
29
- echo ""
30
-
31
- # Output main state file
32
- if [ -f "$STATE_FILE" ]; then
33
- echo "--- compaction-state.md ---"
34
- cat "$STATE_FILE"
35
- echo ""
36
- fi
37
-
38
- # Output any partial state files
39
- for f in "${PARTIAL_FILES[@]}"; do
40
- BASENAME=$(basename "$f")
41
- echo "--- $BASENAME ---"
42
- cat "$f"
43
- echo ""
44
- done
45
-
46
- echo "=== END COMPACTION RECOVERY ==="
@@ -1,46 +0,0 @@
1
- # Compaction State Save — PreCompact Prompt Hook
2
-
3
- Before compaction destroys your current context, you MUST save state so the
4
- next session can recover. This is not optional — compaction erases everything
5
- you're holding in working memory.
6
-
7
- ## Required: Always write .claude/compaction-state.md
8
-
9
- Write this file with these structured sections:
10
-
11
- ```
12
- # Compaction State
13
-
14
- ## Current Task
15
- What you were actively working on. Be specific — include file paths, function
16
- names, the exact step you were on.
17
-
18
- ## Decisions Made
19
- Key decisions from this session that a fresh context needs to know.
20
- Include the reasoning, not just the conclusion.
21
-
22
- ## Next Steps
23
- What should happen immediately after recovery. Ordered list, most urgent first.
24
-
25
- ## References
26
- Files, URLs, error messages, or other artifacts that the next context will need.
27
- ```
28
-
29
- ## Conditional: Write workflow-specific partial state
30
-
31
- If you are in the middle of a multi-step workflow with intermediate results,
32
- ALSO write a partial state file to `.claude/<workflow-name>-partial.md`.
33
-
34
- Use the workflow you're currently executing as the filename. Examples:
35
- - Mid-audit with findings collected so far → `.claude/audit-partial.md`
36
- - Mid-migration with some files moved → `.claude/migration-partial.md`
37
- - Mid-refactor tracking what's done → `.claude/refactor-partial.md`
38
-
39
- Include whatever intermediate work products would be lost to compaction:
40
- completed items, partial results, progress tracking, error logs.
41
-
42
- ## Constraints
43
-
44
- - Keep total output under 200 lines across all files written.
45
- - Use concrete details (file paths, line numbers, variable names), not vague summaries.
46
- - Write the files using the Edit/Write tools — do not just describe what you would write.