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
@@ -0,0 +1,185 @@
1
+ # Upstream Feedback — Surface CC Friction to the Source
2
+
3
+ **Position:** Runs after record-lessons (step 9), before skill discovery
4
+ (step 11). Lessons are fresh; friction is top of mind.
5
+
6
+ **This is an instruction phase** — it tells Claude what to do, not a
7
+ customization point for the project. It ships with CC and should not
8
+ be deleted or replaced with `skip: true`.
9
+
10
+ ## What This Phase Does
11
+
12
+ During debrief, Claude already has full session context: what was built,
13
+ what went wrong, what was learned. This phase asks Claude to reflect on
14
+ one narrow question: **was there friction with anything CC provided?**
15
+
16
+ - A skill whose flow didn't match how the project actually works
17
+ - A phase file whose default behavior was wrong or confusing
18
+ - A convention that fought the project's grain
19
+ - A missing capability that required a workaround
20
+ - An unclear SKILL.md that led to wasted time
21
+
22
+ This is NOT the same as `/cc-extract` (which looks for generalizable
23
+ artifacts to upstream). This is field feedback — "this thing you shipped
24
+ hurt when I used it."
25
+
26
+ This phase also handles **pattern promotion** — surfacing project-level
27
+ cabinet patterns that look universal enough to promote upstream.
28
+
29
+ ## Workflow
30
+
31
+ ### 1. Claude Reflects (silent)
32
+
33
+ Review the session for CC-specific friction. Consider:
34
+
35
+ - Did any CC skill need to be worked around or used in an unintended way?
36
+ - Did a phase file's default behavior cause confusion or extra work?
37
+ - Was a SKILL.md unclear, leading to misinterpretation?
38
+ - Did the skeleton/phase separation feel wrong for something?
39
+ - Was something missing that would have helped?
40
+ - Did orient or debrief surface irrelevant information or miss something important?
41
+
42
+ If nothing comes to mind — **stop here silently**. Most sessions have
43
+ no CC friction. Do not prompt the user with "any CC feedback?" every
44
+ time. The phase produces nothing and costs nothing unless there's
45
+ something real.
46
+
47
+ ### 2. Draft Feedback (if friction found)
48
+
49
+ For each friction point, draft a short feedback item:
50
+
51
+ ```
52
+ ## [Short title]
53
+
54
+ **Skill/phase:** [which CC component]
55
+ **Friction:** [what happened — 2-3 sentences max]
56
+ **Suggestion:** [what might be better — optional, can be "not sure"]
57
+ **Session context:** [one line about what the project was doing when this came up]
58
+ ```
59
+
60
+ Keep it concrete. "The plan skill was confusing" is not useful.
61
+ "The plan skill's critique phase activated 4 cabinet members when only 1
62
+ was relevant, adding 3 minutes of noise to every plan" is useful.
63
+
64
+ ### 3. Surface for Confirmation
65
+
66
+ Include the draft in the debrief report under a distinct heading:
67
+
68
+ > **Upstream feedback for CC:**
69
+ > I noticed friction with [component]. Here's what I'd send:
70
+ > [draft]
71
+ >
72
+ > Send this upstream? (yes / edit / skip)
73
+
74
+ The user confirms, edits, or dismisses. One quick decision per item.
75
+ Do not ask open-ended questions. Do not batch — if there are multiple
76
+ friction points (rare), present each separately.
77
+
78
+ ### 4. Deliver
79
+
80
+ If the user confirms, deliver the feedback. Detection and delivery
81
+ follow the same pattern as `/cc-extract`:
82
+
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'))"`
93
+ points to a local path rather than a `node_modules` path):
94
+
95
+ - Write the feedback as a markdown file in the CC repo's `feedback/`
96
+ directory (create it if needed)
97
+ - Filename: `[source-project]-[date]-[short-title].md`
98
+ (e.g., `flow-2026-04-04-plan-critique-noise.md`)
99
+ - Add frontmatter: `type: field-feedback`, `source: [project]`,
100
+ `date: [ISO date]`, `component: [skill/phase name]`
101
+
102
+ **If not linked**, check whether `gh` is available and authenticated
103
+ (`gh auth status` exits 0). Then present the user with their options:
104
+
105
+ - **If `gh` works**, offer two choices:
106
+ > "I can send this as a GitHub issue so the developer sees it
107
+ > directly, or save it locally. Which do you prefer?"
108
+ >
109
+ > 1. Send as GitHub issue
110
+ > 2. Save locally (I'll send it later or pass it along myself)
111
+
112
+ If they choose GitHub:
113
+ - Open a GitHub issue on `orenmagid/claude-cabinet`
114
+ - Title: `Field feedback: [short title]`
115
+ - Label: `field-feedback` (create if needed)
116
+ - Body: the feedback markdown
117
+
118
+ - **If `gh` is not available** (most common for non-developers):
119
+ > "I'll save this feedback locally for now. If you want, you can
120
+ > pass it along to the developer yourself, or set up a free GitHub
121
+ > account so future feedback goes directly to them. Here's a guide
122
+ > if you're interested:
123
+ > https://github.com/orenmagid/claude-cabinet/blob/main/GITHUB-SETUP.md
124
+ > — totally optional. Your feedback is saved either way."
125
+
126
+ **For either local save path:**
127
+
128
+ - Append the feedback to `~/.claude/cc-feedback-outbox.json` as a
129
+ JSON array entry with fields: `source` (project name), `date`,
130
+ `component`, `title`, `body`, `status: "pending"`
131
+ - Create the file if it doesn't exist (initialize with `[]`)
132
+
133
+ **Flushing the outbox:** If a user later sets up `gh` and asks to
134
+ send saved feedback, read the outbox, post each `pending` entry as
135
+ a GitHub issue, and update its status to `"sent"` with the issue URL.
136
+
137
+ ### 5. Check for Pattern Promotion Candidates
138
+
139
+ After handling CC friction feedback, check for cabinet member patterns
140
+ that should be promoted upstream.
141
+
142
+ **Scan `patterns-project.md` files:**
143
+
144
+ ```bash
145
+ # Find all project-level pattern files
146
+ find .claude/skills/cabinet-*/patterns-project.md 2>/dev/null
147
+ ```
148
+
149
+ For each file that exists, read it. For each pattern entry, evaluate:
150
+
151
+ - **Is it universal?** Would this pattern apply to any project using
152
+ the same technology, or is it specific to this project's domain/codebase?
153
+ - **Is it mature?** Has it been observed 3+ times, or is it still early?
154
+ - **Is it already upstream?** Check the member's SKILL.md `## Historically
155
+ Problematic Patterns` section — if it's already there, skip it.
156
+
157
+ **If a promotion candidate is found**, draft a feedback item:
158
+
159
+ ```markdown
160
+ ---
161
+ type: pattern-promotion
162
+ source: [project name]
163
+ date: [ISO date]
164
+ component: cabinet-[member-name]
165
+ ---
166
+
167
+ ## Pattern promotion: [pattern name]
168
+
169
+ **Cabinet member:** cabinet-[member-name]
170
+ **Pattern:** [description from patterns-project.md]
171
+ **Occurrences:** [count] across [count] audits
172
+ **Why it's universal:** [1 sentence — why this isn't project-specific]
173
+ ```
174
+
175
+ Deliver via the same mechanism as friction feedback (step 4 above —
176
+ linked → write to CC `feedback/`, not linked → GitHub issue or outbox).
177
+
178
+ **Most sessions produce no promotion candidates.** Pattern promotion
179
+ is rare — it requires both a mature project-level pattern AND evidence
180
+ that the pattern is universal. Don't force it.
181
+
182
+ ### 6. Done
183
+
184
+ Note in the debrief report what was sent and where. Move on to the
185
+ next phase.
@@ -0,0 +1,101 @@
1
+ # /debrief integration with cabinet-verify — verify-coverage phase
2
+
3
+ **Contract: v0.x soft — may change before v1.0.** This phase enables
4
+ the `/verify` integration with `/debrief`. It is a customization phase
5
+ (opt-in), copied into your project only when the `verify` module is
6
+ selected during `npx create-claude-cabinet`.
7
+
8
+ ## What this phase does
9
+
10
+ At session close, scan the acts shipped during the session window.
11
+ For each act that touched UI code, check whether a feature-file edit
12
+ landed in the same git commit window. If not, warn — drift risk:
13
+ the product changed but the scenarios didn't.
14
+
15
+ This is the safety net for the `/plan` + `/execute` integration. The
16
+ upstream phases TRY to keep features in sync during the session;
17
+ this phase catches the cases where they failed or weren't invoked.
18
+
19
+ ## No-op guard
20
+
21
+ The phase should exit silently if the project has no `e2e/features/`
22
+ directory.
23
+
24
+ ```bash
25
+ test -d e2e/features
26
+ ```
27
+
28
+ Without the runtime installed, there's nothing to be out of sync with.
29
+
30
+ ## When this phase runs
31
+
32
+ Position: during `/debrief`'s inventory phase, after acts have been
33
+ enumerated, before the briefing is presented to the user. The warning
34
+ appears in the **Attention Items** section of the debrief output.
35
+
36
+ ## Detection algorithm
37
+
38
+ 1. **Establish the session window.** The session-start git sha is
39
+ captured at orient (or, lacking that, the most recent commit
40
+ before the first session action). HEAD is the end of the window.
41
+ 2. **List feature-file edits in the window.**
42
+ ```bash
43
+ git diff --name-only <session-start-sha>..HEAD | grep '\.feature$'
44
+ ```
45
+ 3. **List shipped acts.** Query pib-db for actions completed during
46
+ the session:
47
+ ```bash
48
+ node scripts/pib-db.mjs query "SELECT fid, text, notes FROM actions WHERE completed = 1 AND completed_at >= '<session-start-iso>'"
49
+ ```
50
+ 4. **For each shipped act, decide whether it was UI-touching.** Look
51
+ at the act's notes' Surface Area section. If the surface includes
52
+ any of:
53
+ - `webapp/frontend/`, `app/`, `pages/`, `components/`
54
+ - paths matching project-specific UI conventions (read
55
+ `phases/ui-paths.md` if defined; otherwise use the default
56
+ heuristic above)
57
+
58
+ then it's UI-touching.
59
+ 5. **For each UI-touching act, check if any feature file in the
60
+ diff overlaps with the act's surface area or description.** If
61
+ not, the act is "uncovered."
62
+
63
+ ## Warning format
64
+
65
+ For each uncovered UI act, emit one Attention Items entry:
66
+
67
+ > **Act <fid> shipped without a feature-file update — drift risk.**
68
+ > The act touched [paths] but no `.feature` file changed in the same
69
+ > session window. Consider:
70
+ > - `/verify update <fid>` to propose the matching scenario edits
71
+ > - Or accept the drift if the change isn't user-visible enough to
72
+ > warrant a scenario update.
73
+
74
+ Advisory only — debrief still completes. The user decides whether to
75
+ run `/verify update` immediately or defer.
76
+
77
+ ## Tuning to reduce false positives
78
+
79
+ The default heuristic over-warns. Two common refinements:
80
+
81
+ 1. **Path filter.** Project-specific UI paths in `phases/ui-paths.md`
82
+ (if defined) override the default heuristic. For example, a project
83
+ where `app/` is the framework's app dir (server-side rendering)
84
+ but `webapp/frontend/` is the SPA might only count the latter.
85
+ 2. **Per-act opt-out.** An act can declare in its notes that it's a
86
+ "no-feature-edit-needed" act:
87
+ ```
88
+ ## Verify Coverage
89
+ Skip: this change is internal — no UI behavior changed.
90
+ ```
91
+ The phase reads this and skips the act.
92
+
93
+ ## What this phase does NOT do
94
+
95
+ - It does not file an action for the uncovered act. The user runs
96
+ `/verify update` (or chooses to ignore) at their discretion.
97
+ - It does not block debrief. Even with 10 uncovered acts, debrief
98
+ completes — the warnings just accumulate in the Attention Items
99
+ section.
100
+ - It does not run the verification suite (`npm run verify`). That's
101
+ the user's call after they decide whether to update scenarios.
@@ -90,6 +90,25 @@ Each checkpoint is a chance to stop before the cost of fixing goes up.
90
90
 
91
91
  ## Workflow
92
92
 
93
+ ### 0. Worktree-Invocation Contract (core — runs before plan load)
94
+
95
+ Running `/execute` from a mux/linked git worktree is the **normal case**,
96
+ not an error. **Read `.claude/cabinet/worktree-invocation-contract.md` and
97
+ follow it** — detect a linked worktree, sync main *into* it before reading
98
+ plan/code state, and resolve every completion artifact to the MAIN checkout.
99
+ Two points specific to `/execute`:
100
+
101
+ - **`/execute` does NOT merge.** The worktree→main bridge is `/qa-handoff`:
102
+ Step 8's close-out files the handoff and the QA station merges + verifies.
103
+ Step 0 only syncs main *into* the worktree (so the staleness guard and the
104
+ checkpoints read current state); it never merges the worktree branch out.
105
+ - **Sync conflict → HALT the whole skill** per the contract (don't
106
+ auto-resolve, don't implement on a half-synced tree); surface the
107
+ conflicted-worktree recovery and stop.
108
+
109
+ On the main checkout the detection no-ops: artifacts resolve to cwd (which
110
+ IS main) and no qa-handoff is filed — `/execute` behaves exactly as before.
111
+
93
112
  ### 1. Load the Plan
94
113
 
95
114
  Read `phases/load-plan.md` for where your project stores plans and how
@@ -117,8 +136,13 @@ After identifying the action to execute:
117
136
  3. Create the verification breadcrumb:
118
137
 
119
138
  ```bash
120
- mkdir -p .claude/verification
121
- cat > .claude/verification/<fid>.json << 'BREADCRUMB'
139
+ # Resolve the MAIN checkout (worktree-invocation contract, Step 0): a
140
+ # worktree's .claude/verification/ is gitignored and lost on cleanup, and the
141
+ # completion-gate hook READS breadcrumbs from MAIN. On the main checkout $MAIN
142
+ # is the cwd, so this line is correct in both places.
143
+ MAIN="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")"
144
+ mkdir -p "$MAIN/.claude/verification"
145
+ cat > "$MAIN/.claude/verification/<fid>.json" << 'BREADCRUMB'
122
146
  {
123
147
  "fid": "<fid>",
124
148
  "spec_read": true,
@@ -272,7 +296,9 @@ Do not mark the work item complete with failing AC.
272
296
  After verifying all ACs, update the breadcrumb:
273
297
 
274
298
  ```bash
275
- cat > .claude/verification/<fid>.json << 'BREADCRUMB'
299
+ # Same MAIN checkout as Step 1 (worktree-invocation contract).
300
+ MAIN="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")"
301
+ cat > "$MAIN/.claude/verification/<fid>.json" << 'BREADCRUMB'
276
302
  {
277
303
  "fid": "<fid>",
278
304
  "spec_read": true,
@@ -310,9 +336,48 @@ deployment strategy is project-specific.
310
336
 
311
337
  ### 8. Close the Loop
312
338
 
313
- Mark the work item as complete (if your project has a work tracker).
314
- Run debrief if this was a full session. At minimum, ensure the work
315
- is committed, validated, and verified before considering it done.
339
+ Mark the work item as complete (if your project has a work tracker)
340
+ "done" = implemented + committed + breadcrumb-on-main, the same milestone
341
+ `/execute-group` uses. **In a worktree, mark done at commit too** (not
342
+ in-progress): the filed qa-handoff below carries the merge + QA debt, and
343
+ a `qa_verdict` resolves that inbox item, never the work action — leaving
344
+ the action open would orphan it forever. Run debrief if this was a full
345
+ session. At minimum, ensure the work is committed, validated, and verified
346
+ before considering it done.
347
+
348
+ #### Worktree close-out: file the qa-handoff (worktree only)
349
+
350
+ When Step 0 detected a linked worktree, `/execute` has committed to the
351
+ worktree branch but has NOT merged — the worktree→main bridge is
352
+ `/qa-handoff`. File the producer half of that handoff directly, so the
353
+ merge + QA debt is surfaced and ageable instead of a pointer the operator
354
+ must remember:
355
+
356
+ 1. Build the handoff payload per `/qa-handoff` Step 4 (what merged, what
357
+ the worktree could not runtime-verify, what hangs on the next step).
358
+ 2. **Classify `merge_state` by the same ancestry check `/qa-handoff`
359
+ uses:** `git merge-base --is-ancestor <branch> origin/<main>`. A
360
+ worktree close-out files BEFORE any merge, so the branch is not yet an
361
+ ancestor → `merge_state: "merge-pending"`, `merged_commit: null`,
362
+ `pending_branch_head: <branch tip>`; the pickup prompt says "merge then
363
+ QA." Dispatch is deferred (the QA station merges first).
364
+ 3. File it per `/qa-handoff` Step 5 (the `createItem` queue API), then
365
+ print the id: "Filed qa-handoff dec-XXXX — the QA station merges +
366
+ verifies."
367
+
368
+ **If watchtower is not installed** (no `~/.claude-cabinet/watchtower/
369
+ scripts/watchtower-queue.mjs` — `/execute` ships in the planning module;
370
+ the inbox queue is the opt-in watchtower module), the queue does not
371
+ exist. Do NOT fail the close-out and do NOT skip silently — surface a
372
+ loud, plain-English note:
373
+
374
+ > Worktree branch `<branch>` is committed and the action is marked done,
375
+ > but watchtower isn't installed, so I couldn't file a tracked qa-handoff.
376
+ > Merge it to main and QA manually (or install watchtower for the tracked
377
+ > handoff). See `/qa-handoff`.
378
+
379
+ On the **main checkout** this subsection is skipped — no worktree boundary
380
+ means no handoff; do the merge/QA tail inline.
316
381
 
317
382
  #### Check downstream impact
318
383
 
@@ -9,6 +9,14 @@ a clear message describing the implementation. Don't push or deploy —
9
9
  deployment strategy is project-specific. To explicitly skip commit
10
10
  (e.g., changes are committed manually), write only `skip: true`.
11
11
 
12
+ **Worktree close-out is the skeleton's job, not this phase's.** When
13
+ `/execute` runs from a linked worktree, its SKILL.md (Step 0 + Step 8, per
14
+ `.claude/cabinet/worktree-invocation-contract.md`) already resolves
15
+ completion artifacts to the MAIN checkout and files a `/qa-handoff` item
16
+ for the post-merge merge + QA. This phase defines only *how to commit and
17
+ deploy on main*; do NOT re-implement the worktree artifact-resolution or
18
+ the handoff here — that would fork the single-sourced contract.
19
+
12
20
  ## What to Include
13
21
 
14
22
  - **Commit strategy** — message format, what to stage, branch conventions
@@ -92,32 +92,29 @@ first-class parallel participants.
92
92
  ### Step 0 — Environment precondition: the worktree-invocation contract
93
93
 
94
94
  Running this skill from a mux/linked git worktree is the **normal case**,
95
- not an error — do not refuse. Establish the environment facts first:
96
-
97
- 1. **Detect where you are.**
98
- `git rev-parse --path-format=absolute --git-common-dir` names the MAIN
99
- checkout's `.git`; if its parent differs from
100
- `git rev-parse --show-toplevel`, you are in a linked worktree.
101
- 2. **If in a worktree, sync with main before anything else:** run
102
- `git merge main --no-edit` if the branch is behind. Worktrees start
103
- behind; the staleness guard (Step 1) and CP1 read plan and code state
104
- that may have changed on main since the worktree was created.
105
- 3. **The workflows ignore your cwd by design.** Stage 2's
106
- `isolation: worktree` implementation agents branch from MAIN and merge
107
- into MAIN regardless of the invoking checkout — the invoking worktree is
108
- never the merge target and never receives the group's commits directly
109
- (it picks them up on its next `git merge main`).
110
- 4. **All completion artifacts land in the MAIN checkout.** Per-plan
111
- breadcrumbs are persisted to `<main>/.claude/verification/` as each merge
112
- lands (before any worktree cleanup), and the Completion Report is written
113
- there before completion. Nothing verification-critical is written to the
114
- invoking worktree its `.claude/verification/` is gitignored and
115
- disposable.
116
- 5. **Escape hatch inline build.** For a small, conflict-free group you may
117
- skip the worktree machinery and implement the plans inline in the
118
- invoking checkout, then merge once. Use it when worktree overhead exceeds
119
- the parallelism gain; the staleness guard, CP1, and the completion-report
120
- contract still apply.
95
+ not an error — do not refuse. **Read
96
+ `.claude/cabinet/worktree-invocation-contract.md` and follow it** — it
97
+ establishes the universal facts: detect a linked worktree, sync main into
98
+ it before any review or workflow, and resolve every completion artifact to
99
+ the MAIN checkout. Per-plan breadcrumbs and the Completion Report land
100
+ under `<main>/.claude/verification/` (each breadcrumb before any worktree
101
+ cleanup, the report before completion); nothing verification-critical is
102
+ written to the disposable worktree.
103
+
104
+ Two facts are specific to `/execute-group` and stay inline here — they
105
+ describe this skill's **merge model** and deliberately do NOT go in the
106
+ shared contract (they would contradict `/execute`'s no-merge model):
107
+
108
+ - **The workflows ignore your cwd by design.** Stage 2's
109
+ `isolation: worktree` implementation agents branch from MAIN and merge
110
+ into MAIN regardless of the invoking checkout — the invoking worktree is
111
+ never the merge target and never receives the group's commits directly
112
+ (it picks them up on its next `git merge main`).
113
+ - **Escape hatch inline build.** For a small, conflict-free group you may
114
+ skip the worktree machinery and implement the plans inline in the
115
+ invoking checkout, then merge once. Use it when worktree overhead exceeds
116
+ the parallelism gain; the staleness guard, CP1, and the completion-report
117
+ contract still apply.
121
118
 
122
119
  ### Step 1 — Staleness guard (BEFORE any review or workflow)
123
120
 
@@ -62,6 +62,26 @@ Phase files have three states:
62
62
 
63
63
  Read `phases/fetch-plans.md` for where plans come from.
64
64
 
65
+ **Scoped invocation (operator-named subset) — prefer this when `$ARGUMENTS`
66
+ is non-empty.** The default below grabs EVERY open action whose notes
67
+ contain a `## Surface Area` block — often dozens of unrelated plans. When
68
+ the operator names what to group, scope to exactly those instead:
69
+
70
+ - `$ARGUMENTS` is a space-separated list of `act:` fids → group ONLY those
71
+ (`pib_query` with `WHERE a.fid IN (...)`).
72
+ - `$ARGUMENTS` is `tag:<name>` → group only open actions carrying that tag.
73
+
74
+ Then proceed to Phase 2 with just that subset. This is a first-class mode,
75
+ not a deviation — `grp:2026-06-11-wt` had to be scoped by hand because it
76
+ didn't exist (documented deviation, 2026-06-12).
77
+
78
+ **Carrier-action convention (multi-action lanes).** When one plan absorbs
79
+ others into a single lane, rename the absorbed actions' surface-area
80
+ headers (e.g. `## Surface Area (absorbed into act:X)`) so the default
81
+ fetch can't schedule them independently — only the carrier action keeps a
82
+ live `## Surface Area`. (Used twice in `grp:2026-06-11-wt`: Plan A
83
+ absorbed 2, Plan D absorbed 1.)
84
+
65
85
  **Default (absent/empty):** Query pib-db for open actions that have
66
86
  surface area declarations.
67
87