create-claude-cabinet 0.31.1 → 0.33.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 (45) hide show
  1. package/lib/cli.js +41 -12
  2. package/package.json +2 -2
  3. package/templates/README.md +1 -1
  4. package/templates/cabinet/checkpoint-protocol.md +48 -0
  5. package/templates/cabinet/pib-db-access.md +26 -0
  6. package/templates/engagement/OVERVIEW.md +161 -0
  7. package/templates/engagement/__tests__/engagement.test.mjs +403 -0
  8. package/templates/engagement/__tests__/pibdb-adapter.test.mjs +95 -0
  9. package/templates/{handoff → engagement}/capture-and-encrypt.mjs +3 -3
  10. package/templates/{handoff → engagement}/decrypt-credential.mjs +19 -6
  11. package/templates/engagement/engagement-schema.md +410 -0
  12. package/templates/{handoff/handoff-transport.mjs → engagement/engagement-transport.mjs} +4 -4
  13. package/templates/engagement/engagement.mjs +603 -0
  14. package/templates/{handoff → engagement}/generate-keys.mjs +2 -2
  15. package/templates/engagement/pibdb-adapter.mjs +63 -0
  16. package/templates/{handoff → engagement}/schema.md +8 -0
  17. package/templates/{handoff → engagement}/secure-input.mjs +14 -2
  18. package/templates/hooks/action-completion-gate.sh +1 -1
  19. package/templates/scripts/pib-db-lib.mjs +16 -3
  20. package/templates/skills/cc-upgrade/SKILL.md +13 -0
  21. package/templates/skills/cc-upgrade/phases/execute-group-workflow-split-detect.md +74 -0
  22. package/templates/skills/cc-upgrade/phases/handoff-rename-detect.md +105 -0
  23. package/templates/skills/engagement/SKILL.md +206 -0
  24. package/templates/skills/engagement-add/SKILL.md +76 -0
  25. package/templates/skills/engagement-create/SKILL.md +183 -0
  26. package/templates/skills/engagement-edit/SKILL.md +110 -0
  27. package/templates/skills/engagement-help/SKILL.md +178 -0
  28. package/templates/skills/engagement-message/SKILL.md +73 -0
  29. package/templates/skills/engagement-progress/SKILL.md +55 -0
  30. package/templates/skills/engagement-status/SKILL.md +122 -0
  31. package/templates/skills/engagement-sync/SKILL.md +324 -0
  32. package/templates/skills/execute/SKILL.md +22 -22
  33. package/templates/skills/execute-group/SKILL.md +184 -97
  34. package/templates/workflows/execute-group-complete.js +303 -0
  35. package/templates/workflows/execute-group-implement.js +243 -0
  36. package/templates/skills/handoff/SKILL.md +0 -122
  37. package/templates/skills/handoff-add/SKILL.md +0 -44
  38. package/templates/skills/handoff-ask/SKILL.md +0 -45
  39. package/templates/skills/handoff-create/SKILL.md +0 -161
  40. package/templates/skills/handoff-progress/SKILL.md +0 -55
  41. package/templates/skills/handoff-status/SKILL.md +0 -86
  42. package/templates/workflows/execute-group.js +0 -506
  43. /package/templates/{handoff/handoff-checklist.mjs → engagement/engagement-checklist.mjs} +0 -0
  44. /package/templates/{handoff/handoff-crypto.mjs → engagement/engagement-crypto.mjs} +0 -0
  45. /package/templates/{handoff → engagement}/example-checklist.yaml +0 -0
package/lib/cli.js CHANGED
@@ -485,7 +485,7 @@ const MODULES = {
485
485
  mandatory: false,
486
486
  default: true,
487
487
  lean: true,
488
- templates: ['skills/plan', 'skills/execute', 'skills/generate-plan-groups', 'skills/execute-group', 'workflows/execute-group.js', 'skills/investigate', 'cabinet/checkpoint-protocol.md'],
488
+ templates: ['skills/plan', 'skills/execute', 'skills/generate-plan-groups', 'skills/execute-group', 'workflows/execute-group-implement.js', 'workflows/execute-group-complete.js', 'skills/investigate', 'cabinet/checkpoint-protocol.md'],
489
489
  },
490
490
  'compliance': {
491
491
  name: 'Compliance Stack (rules + enforcement)',
@@ -582,7 +582,7 @@ const MODULES = {
582
582
  },
583
583
  'site-audit': {
584
584
  name: 'Site Audit (deployed-site quality)',
585
- description: '15-check audit for deployed websites: performance, accessibility (3 engines), security, SEO, DNS, privacy, sustainability. Standalone HTML report + comparison mode.',
585
+ description: '14-check audit for deployed websites: performance, accessibility (3 engines), security, SEO, DNS, privacy, sustainability. Standalone HTML report + comparison mode.',
586
586
  mandatory: false,
587
587
  default: false,
588
588
  lean: false,
@@ -592,20 +592,24 @@ const MODULES = {
592
592
  ],
593
593
  postInstall: 'site-audit-setup',
594
594
  },
595
- handoff: {
596
- name: 'Handoff (secure credential collection)',
597
- description: 'Skill-based credential handoff for consulting engagements. Encrypted credential capture via OS dialog, pluggable transport (email/MCP/file), bidirectional messaging. Six skills across consultant and client sides.',
595
+ engagement: {
596
+ name: 'Engagement management (with secure credential handoff)',
597
+ description: 'Ongoing client-engagement management built on pib-db: per-recipient packets (rendered projections of the work backlog), role-gated billing, client feedback flowing back as events, and secure credential handoff (encrypted capture via OS dialog, pluggable email/MCP/file transport). Seven skills across consultant and client sides. Requires work-tracking (the pib-db adapter is the engine\'s data source).',
598
598
  mandatory: false,
599
599
  default: false,
600
600
  lean: false,
601
+ requires: ['work-tracking'],
601
602
  templates: [
602
- 'skills/handoff',
603
- 'skills/handoff-progress',
604
- 'skills/handoff-ask',
605
- 'skills/handoff-create',
606
- 'skills/handoff-add',
607
- 'skills/handoff-status',
608
- 'handoff',
603
+ 'skills/engagement',
604
+ 'skills/engagement-progress',
605
+ 'skills/engagement-help',
606
+ 'skills/engagement-message',
607
+ 'skills/engagement-create',
608
+ 'skills/engagement-edit',
609
+ 'skills/engagement-add',
610
+ 'skills/engagement-status',
611
+ 'skills/engagement-sync',
612
+ 'engagement',
609
613
  ],
610
614
  },
611
615
  };
@@ -1016,6 +1020,31 @@ async function run() {
1016
1020
  }
1017
1021
  }
1018
1022
 
1023
+ // --- Enforce module prerequisites (requires:[...]) ---
1024
+ // A selected module may declare hard prerequisites. Auto-include them (same
1025
+ // posture as mandatory modules) with a notice, rather than failing — a
1026
+ // missing prerequisite would surface as a confusing runtime error. e.g.
1027
+ // engagement's pib-db adapter cannot function without work-tracking.
1028
+ for (const key of [...selectedModules]) {
1029
+ for (const req of MODULES[key]?.requires || []) {
1030
+ if (!selectedModules.includes(req)) {
1031
+ selectedModules.push(req);
1032
+ delete skippedModules[req];
1033
+ console.log(` + Added '${req}' — required by '${key}'.`);
1034
+ // The required module's own DB needs initializing too, unless the
1035
+ // operator explicitly opted out with --no-db (respect that flag, but
1036
+ // warn that the dependent module won't function without it).
1037
+ if (req === 'work-tracking') {
1038
+ if (flags.noDb) {
1039
+ console.log(` ⚠ --no-db is set, so pib-db won't be initialized — '${key}' will not function until it is.`);
1040
+ } else {
1041
+ includeDb = true;
1042
+ }
1043
+ }
1044
+ }
1045
+ }
1046
+ }
1047
+
1019
1048
  console.log(' Assembling your cabinet...\n');
1020
1049
 
1021
1050
  // --- Copy template files ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-claude-cabinet",
3
- "version": "0.31.1",
3
+ "version": "0.33.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"
@@ -24,7 +24,7 @@
24
24
  "node": ">=18"
25
25
  },
26
26
  "scripts": {
27
- "test": "node --test test/**/*.test.js",
27
+ "test": "node --test test/**/*.test.js templates/**/__tests__/*.test.mjs",
28
28
  "prepublishOnly": "node -e \"if (!process.env.CC_ALLOW_PUBLISH) { console.error('\\n\\u2717 Use /cc-publish (which runs the mandatory consumer-walk), not raw npm publish.\\n Raw npm publish on v0.27.1 left every consumer stale on v0.26.\\n To publish manually anyway, set CC_ALLOW_PUBLISH=1.\\n'); process.exit(1); }\""
29
29
  },
30
30
  "dependencies": {
@@ -40,7 +40,7 @@ templates, see [EXTENSIONS.md](EXTENSIONS.md).
40
40
  | `skills/debrief-quick/` | Quick debrief variant — core phases only, skip presentation. |
41
41
  | `skills/execute/` | Execute a plan with cabinet member checkpoints. 3-checkpoint protocol (pre-implementation, per-file-group, pre-commit). 5 phase files. |
42
42
  | `skills/generate-plan-groups/` | Scheduler: find plans with surface-area declarations, build a conflict graph, persist conflict-free parallel groups as pib-db `grp:` tags. Does not execute — hands each group to /execute-group. |
43
- | `skills/execute-group/` | Runner: execute one generated group via the `execute-group.js` workflow — cabinet pre-review, parallel worktree implementation, sequential merge with per-plan review, integration, informed final review, completion report. |
43
+ | `skills/execute-group/` | Runner: execute one generated group as a 3-stage pipelineinteractive cabinet pre-review (CP1) the operator decides on, then the `execute-group-implement.js` workflow (parallel worktree implementation + sequential merge) and the `execute-group-complete.js` workflow (advisory review + integration + completion report), with operator checkpoints between stages. |
44
44
  | `skills/cc-extract/` | Analyze project artifacts and propose upstream extraction candidates for Claude Cabinet. |
45
45
  | `skills/investigate/` | Structured codebase exploration: frame, observe, hypothesize, test, conclude. |
46
46
  | `skills/cc-link/` | Set up local development linking for Claude Cabinet source repo work. |
@@ -27,6 +27,36 @@ set of conflict-free plans implemented concurrently in separate worktrees,
27
27
  then merged together. `/execute` never exercises that scope — it runs one
28
28
  plan at a time and uses only the first three.
29
29
 
30
+ ## Checkpoint modes — who acts on the verdict
31
+
32
+ The scope says *what* is reviewed. The **mode** says *what happens to the
33
+ verdict*. This distinction is load-bearing: an autonomous gate that reverts
34
+ or halts on a false-positive `stop` is fragile and expensive. The default for
35
+ high-stakes reviews is to put judgment in front of the operator.
36
+
37
+ | Mode | Where it runs | What a `stop`/`pause` does | Used by |
38
+ |------|---------------|----------------------------|---------|
39
+ | **Interactive CP** | Main session (skill level) | Surfaced to the operator, who decides (proceed / drop / override / abort). Never automatic. | `/execute-group` CP1 |
40
+ | **Advisory CP** | Workflow | Recorded in the Completion Report as a concern. Never halts or reverts. The only automatic gate alongside it is `/validate`. | `/execute-group` CP3 |
41
+ | **Full CP** | Main session or workflow | Halts on `stop`, escalates 3+ `pause` to a halt, requires explicit override. The classic gate. | `/execute` CP1/CP2/CP3 |
42
+
43
+ **Why Interactive and Advisory exist.** `/execute-group` once ran CP1 and CP3
44
+ as autonomous gates inside a single workflow: a cabinet `stop` halted the run
45
+ or reverted a merge with no human in the loop. False positives there cost real
46
+ money (a CP1 halted twice consecutively — 1.6M+ tokens — on concerns the plan
47
+ text already addressed). Moving CP1 to interactive (operator decides) and CP3
48
+ to advisory (concerns recorded, `/validate` is the only hard gate) keeps the
49
+ review signal while removing the destructive autonomous action.
50
+
51
+ ### Interactive CP adds a required `addressed_by_plan` field
52
+
53
+ At Interactive CP (`/execute-group` CP1, `pre-impl` scope), each agent's
54
+ verdict carries one extra **required** field, `addressed_by_plan` — the list
55
+ of risks the plan already handles. The agent must enumerate these *first*,
56
+ before raising any concern. This forces the plan-first discipline structurally:
57
+ a risk listed in `addressed_by_plan` cannot also be raised as a concern. It is
58
+ the direct fix for the false-positive halts.
59
+
30
60
  ## Step 1 — Select which members to spawn
31
61
 
32
62
  Spawn one Agent per cabinet member that matches **either**:
@@ -107,8 +137,26 @@ Each agent returns exactly this shape:
107
137
  }
108
138
  ```
109
139
 
140
+ At **Interactive CP** (`/execute-group` CP1), add the required
141
+ `addressed_by_plan` array described above:
142
+
143
+ ```json
144
+ {
145
+ "cabinet_member": "name",
146
+ "addressed_by_plan": ["risks the plan already handles"],
147
+ "verdict": "continue" | "pause" | "stop",
148
+ "concerns": [ ... ]
149
+ }
150
+ ```
151
+
110
152
  ## Step 4 — Apply escalation
111
153
 
154
+ The escalation below is **Full CP** behavior (used by `/execute`). For
155
+ **Interactive CP** the verdicts are surfaced to the operator severity-first
156
+ and the operator decides — no automatic halt. For **Advisory CP** the concerns
157
+ are recorded in the Completion Report and nothing halts or reverts; `/validate`
158
+ is the only automatic gate. See "Checkpoint modes" above.
159
+
112
160
  Collect every verdict, then:
113
161
 
114
162
  - **Any `stop`** → halt. Show the concern. Require an explicit override
@@ -36,6 +36,9 @@ Check: are pib_* MCP tools available?
36
36
  | pib_defer_with_trigger | defer-with-trigger fid --trigger "<text>" | Defer with a return condition |
37
37
  | pib_list_triggered | list-triggered [--include-done] | List items waiting on triggers |
38
38
  | pib_mark_trigger_checked | mark-trigger-checked fid --result <value> | Record a trigger evaluation |
39
+ | pib_add_engagement_event | add-event --engagement prj:X --kind K --author A --allowed-authors "..." | Append an engagement event |
40
+ | pib_list_engagement_events | list-events [--engagement prj:X] [--unaddressed-only] | List engagement events |
41
+ | pib_mark_event_addressed | mark-event-addressed id | Mark an engagement event addressed |
39
42
  | pib_ingest_findings | ingest-findings run-dir | Ingest audit findings |
40
43
  | pib_triage | triage finding-id status [notes] | Triage a finding |
41
44
  | pib_triage_history | triage-history | Get suppression list |
@@ -52,6 +55,29 @@ session and surfaces items whose conditions have become true. See
52
55
  result vocabulary, cascade semantics for projects, migration
53
56
  guarantees, and known limitations.
54
57
 
58
+ ## Engagement events
59
+
60
+ The `engagement_events` table (schema v5) is an append-only log for
61
+ consulting engagements managed by the **engagement** module. Each row
62
+ records one event — client feedback, an approval, a status push, a
63
+ delegation, a note, or a packet-sent marker — scoped to an engagement
64
+ (a pib-db project) and optionally to a specific action.
65
+
66
+ All writes route through `pib_add_engagement_event` (or the CLI
67
+ `add-event`); there is no raw-INSERT path. The caller must pass
68
+ `allowedAuthors` — the engagement's recipient ids plus `"consultant"`,
69
+ derived from `engagement.yaml`. The library itself never reads config;
70
+ the author allowlist is enforced **fail-closed** (an empty or omitted
71
+ allowlist rejects every author). `client_feedback` and `approval`
72
+ events must carry a meaningful verdict (`approve`/`object`/`comment`);
73
+ `none` and null are rejected for those kinds.
74
+
75
+ See [../engagement/engagement-schema.md](../engagement/engagement-schema.md)
76
+ for the full contract: event kinds, dedup semantics, action tag
77
+ conventions, the client-facing copy block, packet schema and lifecycle,
78
+ the consultant-side `_refmap`, the `item_feedback` envelope, and the
79
+ timelog/billing format.
80
+
55
81
  ## Surface Area Validation
56
82
 
57
83
  `pib_create_action` (and the CLI `create-action`) require that notes
@@ -0,0 +1,161 @@
1
+ # The Engagement System — How It Works
2
+
3
+ A plain-language guide to Claude Cabinet's engagement module for managing
4
+ ongoing client relationships.
5
+
6
+ **Don't know where to start?** Run **`/engagement-help`** — it detects
7
+ whether you're the consultant or the client, shows you exactly what you
8
+ can do right now, and offers to run the next step for you. No need to
9
+ memorize skill names.
10
+
11
+ ---
12
+
13
+ ## What is it?
14
+
15
+ The engagement system turns your pib-db work backlog into a communication
16
+ layer with your clients. Instead of emailing status updates manually or
17
+ hoping the client remembers what you discussed on a call, you run one
18
+ command (`/engagement-sync`) and each person on the engagement gets a
19
+ personalized update showing exactly what needs their attention, what's in
20
+ progress, and what's done — formatted for their role.
21
+
22
+ It grew out of the handoff module (which handled one-time credential
23
+ collection) into something broader: an ongoing engagement loop where work
24
+ flows out as updates, and client feedback flows back as events on a
25
+ timeline you can review at your own pace.
26
+
27
+ ---
28
+
29
+ ## Getting started
30
+
31
+ Run **`/engagement-help`**. It detects your role automatically — you
32
+ don't need to know which of the 9 skills to use. It reads the engagement
33
+ config, checks what state things are in (fresh? mid-flight? feedback
34
+ waiting?), and tells you exactly what's relevant right now. It also
35
+ offers to run the next step for you, so it works as a launchpad.
36
+
37
+ ---
38
+
39
+ ## How the pieces fit together
40
+
41
+ ### Who sees what
42
+
43
+ An engagement has **recipients** — the people you're working with. Each
44
+ has a **role**:
45
+
46
+ - A **principal** sees everything: all client-visible work items, the
47
+ billing running total, and all messages. They get the full picture.
48
+ - A **delegate** sees only the items specifically assigned to them. No
49
+ billing, no items outside their scope. They get a focused, relevant
50
+ view — usually as a plain email rather than the full interactive
51
+ experience.
52
+
53
+ You control what appears in anyone's view using **tags** on your pib-db
54
+ actions:
55
+
56
+ | Tag | What it does |
57
+ |-----|-------------|
58
+ | `client-visible` | Opt-in. Without this, the action is internal and invisible to everyone. |
59
+ | `audience:ed` | Only the named recipient(s) can see it — narrows even a principal. |
60
+ | `scope:marketing` | Only recipients whose scope includes this topic (or the wildcard "all"). |
61
+ | `assignee:sydney` | The sole basis for what a delegate sees. |
62
+ | `needs:decision` | This item requires the client to choose from options. |
63
+ | `needs:credential` | This item requires a secure credential capture. |
64
+
65
+ Each client-visible action also carries a **client-facing copy block** —
66
+ a title and explanation written for the client, separate from your
67
+ internal notes. The client never sees the raw action text or your working
68
+ notes.
69
+
70
+ ### The trust boundary
71
+
72
+ The client never sees your internal identifiers. Every item in a
73
+ client's update is referenced by an opaque code (a hash). The mapping
74
+ back to your real action IDs stays on your machine in a gitignored file
75
+ that's never transmitted. When a client responds, their feedback comes
76
+ back keyed by the opaque code — you resolve it locally.
77
+
78
+ The system enforces this structurally. The update your client receives is
79
+ built from scratch without internal IDs ever being added to it. A
80
+ separate invariant check runs on every update before it can leave your
81
+ machine — if anything leaked through, it throws and the update doesn't
82
+ send.
83
+
84
+ ### Previewing before sending
85
+
86
+ `/engagement-sync` shows you a summary of what each recipient is about
87
+ to receive **before** anything is dispatched:
88
+
89
+ ```
90
+ Ready to send:
91
+ Ed (principal, plugin) — 2 need response, 4 in progress, 7 done, $4,417.50 billed
92
+ Sydney (delegate, email) — 1 assigned item (marketing)
93
+
94
+ Blocked (not client-ready): 1 — "DNS cutover" (no client-facing copy)
95
+ ```
96
+
97
+ You can drill into any recipient's full packet to read exactly what
98
+ they'll see, then send, or cancel. Nothing goes out without your
99
+ explicit confirmation.
100
+
101
+ `/engagement-status` serves as a separate dry-run preview anytime — it
102
+ renders what each recipient *would* receive right now, without
103
+ dispatching anything.
104
+
105
+ ### The feedback loop
106
+
107
+ Client feedback flows back as events on the engagement timeline. When a
108
+ client approves a decision, you see it and are *offered* (never forced)
109
+ the option to update the action's status. When they object or ask a
110
+ question, it shows up in your inbox. Neutral acknowledgment receipts are
111
+ queued for your review before they reach the client.
112
+
113
+ ### Billing
114
+
115
+ If enabled, the engagement tracks billable hours from a markdown
116
+ timelog. The running total appears only in a principal's update — never
117
+ in a delegate's. Billing can be scoped by period: the full engagement
118
+ total, the current month, or only hours since the last sync.
119
+
120
+ ### Credential handoff
121
+
122
+ When a client needs to provide a secret (API key, token, password):
123
+
124
+ 1. A secure OS dialog appears on their screen (not in the conversation).
125
+ 2. They type it — it's encrypted immediately with the consultant's
126
+ public key.
127
+ 3. The encrypted envelope is sent back.
128
+ 4. The consultant decrypts it on their machine via `/engagement-status`,
129
+ which writes the plaintext to a private file they open in their own
130
+ terminal. The decrypted value never enters Claude's context.
131
+
132
+ ---
133
+
134
+ ## All 9 skills at a glance
135
+
136
+ | Skill | Who runs it | What it does |
137
+ |-------|------------|-------------|
138
+ | `/engagement-help` | Either | Detects your role and shows you what to do next |
139
+ | `/engagement-create` | Consultant | Set up a new engagement (recipients, roles, billing, credentials, deploy) |
140
+ | `/engagement-edit` | Consultant | Fix or update the config after creation |
141
+ | `/engagement-add` | Consultant | Add a client-visible work item with tags + client-facing copy |
142
+ | `/engagement-message` | Consultant | Send a free-text note to a recipient |
143
+ | `/engagement-sync` | Consultant | Push updates to recipients (with preview + confirm) + pull feedback |
144
+ | `/engagement-status` | Consultant | Dashboard: previews, feedback inbox, billing, tag warnings |
145
+ | `/engagement` | Client | Review the latest update and respond |
146
+ | `/engagement-progress` | Client | Quick glance — what's new, counts, read-only |
147
+
148
+ ---
149
+
150
+ ## Known limitations
151
+
152
+ - **Single machine.** The engagement store (pib.db + the
153
+ `engagement-packets/` archive) is local. Running sync from two
154
+ different machines without syncing those files can produce inconsistent
155
+ updates.
156
+ - **No terminal state.** An engagement never "completes" — a credential
157
+ checklist can finish without ending the engagement. Sync is
158
+ re-runnable indefinitely.
159
+ - **Credential decryption requires a desktop.** On Linux without
160
+ `zenity`, the secure dialog can't appear and the system refuses rather
161
+ than showing the secret on screen.