@thebassclef/lite 0.0.1 → 0.1.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 (182) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +85 -4
  3. package/dist/cli.cjs +1610 -0
  4. package/dist/cli.js +1587 -0
  5. package/dist/index.cjs +4 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +4 -0
  8. package/package.json +51 -3
  9. package/substrate/.bassclef/lite-manifest.json +1794 -0
  10. package/substrate/.claude/agents/architect.md +70 -0
  11. package/substrate/.claude/agents/builder.md +114 -0
  12. package/substrate/.claude/agents/designer.md +156 -0
  13. package/substrate/.claude/agents/reviewer.md +88 -0
  14. package/substrate/.claude/hooks/artifact-ingestion-gate.sh +357 -0
  15. package/substrate/.claude/hooks/assert-verify-steering.sh +77 -0
  16. package/substrate/.claude/hooks/bassclef-source-config-validate.sh +215 -0
  17. package/substrate/.claude/hooks/bassclef-sync.sh +634 -0
  18. package/substrate/.claude/hooks/compound-noun-scrub.sh +292 -0
  19. package/substrate/.claude/hooks/kiss-expansion-inject.sh +69 -0
  20. package/substrate/.claude/hooks/plain-english-steering.sh +156 -0
  21. package/substrate/.claude/hooks/post-skill-friction-check.sh +177 -0
  22. package/substrate/.claude/hooks/post-skill-telemetry.sh +62 -0
  23. package/substrate/.claude/hooks/pre-build-gate.sh +511 -0
  24. package/substrate/.claude/hooks/pre-commit-gate.sh +452 -0
  25. package/substrate/.claude/hooks/session-end.sh +433 -0
  26. package/substrate/.claude/hooks/session-reflection.sh +303 -0
  27. package/substrate/.claude/hooks/skill-body-grade-gate.sh +219 -0
  28. package/substrate/.claude/hooks/skill-body-intent-drift.sh +107 -0
  29. package/substrate/.claude/hooks/skill-step-list-check.sh +171 -0
  30. package/substrate/.claude/hooks/state-validate.sh +271 -0
  31. package/substrate/.claude/hooks/substrate-clarity-gate.sh +1110 -0
  32. package/substrate/.claude/hooks/temperance-gate.sh +147 -0
  33. package/substrate/.claude/hooks/testing-tier-enforce.sh +233 -0
  34. package/substrate/.claude/hooks/turn-prose-grade-measure.sh +219 -0
  35. package/substrate/.claude/hooks/turn-prose-kiss-check.sh +434 -0
  36. package/substrate/.claude/hooks/vocabulary-migration-check.sh +171 -0
  37. package/substrate/.claude/hooks/whereami-utc-gate.sh +142 -0
  38. package/substrate/.claude/luminaries/alan-cooper.md +170 -0
  39. package/substrate/.claude/luminaries/alistair-cockburn.md +140 -0
  40. package/substrate/.claude/luminaries/amazon-pr-faq.md +34 -0
  41. package/substrate/.claude/luminaries/ash-maurya.md +121 -0
  42. package/substrate/.claude/luminaries/bill-buxton.md +210 -0
  43. package/substrate/.claude/luminaries/charles-sanders-peirce.md +150 -0
  44. package/substrate/.claude/luminaries/david-ogilvy.md +192 -0
  45. package/substrate/.claude/luminaries/don-norman.md +173 -0
  46. package/substrate/.claude/luminaries/edward-tufte.md +179 -0
  47. package/substrate/.claude/luminaries/eric-evans.md +160 -0
  48. package/substrate/.claude/luminaries/frederick-brooks.md +50 -0
  49. package/substrate/.claude/luminaries/gang-of-four.md +157 -0
  50. package/substrate/.claude/luminaries/jason-fried-dhh.md +46 -0
  51. package/substrate/.claude/luminaries/jesse-james-garrett.md +154 -0
  52. package/substrate/.claude/luminaries/john-ousterhout.md +94 -0
  53. package/substrate/.claude/luminaries/karl-popper.md +132 -0
  54. package/substrate/.claude/luminaries/kent-beck.md +168 -0
  55. package/substrate/.claude/luminaries/linus-torvalds.md +218 -0
  56. package/substrate/.claude/luminaries/martin-fowler.md +164 -0
  57. package/substrate/.claude/luminaries/michael-feathers.md +125 -0
  58. package/substrate/.claude/luminaries/michael-nygard.md +118 -0
  59. package/substrate/.claude/luminaries/robert-c-martin.md +164 -0
  60. package/substrate/.claude/luminaries/saltzer-schroeder.md +194 -0
  61. package/substrate/.claude/luminaries/sophia-prater.md +193 -0
  62. package/substrate/.claude/luminaries/stephen-toulmin.md +131 -0
  63. package/substrate/.claude/rules/artifact-ingestion.md +179 -0
  64. package/substrate/.claude/rules/assert-only-after-verify.md +137 -0
  65. package/substrate/.claude/rules/blocked-items.md +146 -0
  66. package/substrate/.claude/rules/branching.md +28 -0
  67. package/substrate/.claude/rules/commit-conventions.md +22 -0
  68. package/substrate/.claude/rules/context-engineering.md +202 -0
  69. package/substrate/.claude/rules/context-management.md +85 -0
  70. package/substrate/.claude/rules/destructive-operations.md +69 -0
  71. package/substrate/.claude/rules/diagnosis.md +38 -0
  72. package/substrate/.claude/rules/guardrails.md +73 -0
  73. package/substrate/.claude/rules/identifier-leak-prevention.md +104 -0
  74. package/substrate/.claude/rules/lite-manifest-schema-change-discipline.md +98 -0
  75. package/substrate/.claude/rules/oo-ad-entry-point.md +117 -0
  76. package/substrate/.claude/rules/operator-facing-prose.md +196 -0
  77. package/substrate/.claude/rules/plain-english-discipline.md +154 -0
  78. package/substrate/.claude/rules/pr-body-shape.md +317 -0
  79. package/substrate/.claude/rules/pr-strategy.md +167 -0
  80. package/substrate/.claude/rules/sdlc-gates.md +149 -0
  81. package/substrate/.claude/rules/session-artifacts.md +236 -0
  82. package/substrate/.claude/rules/state-schema-validation.md +162 -0
  83. package/substrate/.claude/rules/whereami-load-bearing.md +202 -0
  84. package/substrate/.claude/rules/writing-craft-discipline.md +92 -0
  85. package/substrate/.claude/skills/build/SKILL.md +640 -0
  86. package/substrate/.claude/skills/decompose/SKILL.md +280 -0
  87. package/substrate/.claude/skills/diagnose/SKILL.md +297 -0
  88. package/substrate/.claude/skills/howdoi/SKILL.md +105 -0
  89. package/substrate/.claude/skills/ia-model/SKILL.md +108 -0
  90. package/substrate/.claude/skills/interaction-design/SKILL.md +112 -0
  91. package/substrate/.claude/skills/interpret-input/SKILL.md +180 -0
  92. package/substrate/.claude/skills/kiss/SKILL.md +449 -0
  93. package/substrate/.claude/skills/launch/SKILL.md +924 -0
  94. package/substrate/.claude/skills/lean-canvas/SKILL.md +332 -0
  95. package/substrate/.claude/skills/longrun/SKILL.md +426 -0
  96. package/substrate/.claude/skills/luminary/SKILL.md +481 -0
  97. package/substrate/.claude/skills/ogilvy-writing-audit/SKILL.md +177 -0
  98. package/substrate/.claude/skills/onboard-repo/SKILL.md +2190 -0
  99. package/substrate/.claude/skills/pattern-review/SKILL.md +99 -0
  100. package/substrate/.claude/skills/personas/SKILL.md +207 -0
  101. package/substrate/.claude/skills/promote/SKILL.md +283 -0
  102. package/substrate/.claude/skills/requirement/SKILL.md +98 -0
  103. package/substrate/.claude/skills/retro/SKILL.md +117 -0
  104. package/substrate/.claude/skills/riff/SKILL.md +114 -0
  105. package/substrate/.claude/skills/roadmap-reconcile/SKILL.md +163 -0
  106. package/substrate/.claude/skills/session-end/SKILL.md +309 -0
  107. package/substrate/.claude/skills/session-log/SKILL.md +299 -0
  108. package/substrate/.claude/skills/skills/SKILL.md +228 -0
  109. package/substrate/.claude/skills/spec/SKILL.md +105 -0
  110. package/substrate/.claude/skills/sprint/SKILL.md +392 -0
  111. package/substrate/.claude/skills/stage/SKILL.md +384 -0
  112. package/substrate/.claude/skills/state-a-problem/SKILL.md +185 -0
  113. package/substrate/.claude/skills/temperance/SKILL.md +108 -0
  114. package/substrate/.claude/skills/use-case/SKILL.md +417 -0
  115. package/substrate/.claude/skills/user-stories/SKILL.md +268 -0
  116. package/substrate/.claude/skills/value-prop/SKILL.md +251 -0
  117. package/substrate/.claude/skills/verify/SKILL.md +160 -0
  118. package/substrate/.claude/skills/whereami/SKILL.md +307 -0
  119. package/substrate/AGENTS.md +79 -0
  120. package/substrate/CLAUDE-lite.md +85 -0
  121. package/substrate/CODE_OF_CONDUCT.md +28 -0
  122. package/substrate/CONTRIBUTING.md +177 -0
  123. package/substrate/README.md +173 -0
  124. package/substrate/SECURITY.md +19 -0
  125. package/substrate/architecture/decisions/ADR-029-release-pipeline.md +79 -0
  126. package/substrate/architecture/decisions/ADR-031-non-breaking-changes-adopter-discipline.md +139 -0
  127. package/substrate/architecture/decisions/ADR-032-adopter-sync-dispatcher-architecture.md +192 -0
  128. package/substrate/architecture/decisions/ADR-039-release-tagging-scheme.md +145 -0
  129. package/substrate/architecture/decisions/ADR-040-planning-skill-vocabulary-and-lite-profile.md +155 -0
  130. package/substrate/architecture/decisions/ADR-044-unified-skill-body-template.md +162 -0
  131. package/substrate/lib/clean-artifacts-sweep.sh +112 -0
  132. package/substrate/lib/code-comment-discipline.sh +144 -0
  133. package/substrate/lib/composer-preflight.sh +459 -0
  134. package/substrate/lib/hook-inject.sh +255 -0
  135. package/substrate/lib/luminary-pick.sh +96 -0
  136. package/substrate/lib/output-discipline.sh +143 -0
  137. package/substrate/lib/rewrite-check.sh +214 -0
  138. package/substrate/lib/state.sh +1372 -0
  139. package/substrate/lib/telemetry.sh +205 -0
  140. package/substrate/lib/tier-check.sh +138 -0
  141. package/substrate/lib/tier-dependency-audit.sh +933 -0
  142. package/substrate/presence/install/bassclef-hook-connect.sh +178 -0
  143. package/substrate/presence/install/bassclef-sync.dispatcher.template.sh +841 -0
  144. package/substrate/presence/install/bassclef-sync.template.sh +2076 -0
  145. package/substrate/presence/install/schedule-auto-save.cron.sh +88 -0
  146. package/substrate/presence/install/schedule-auto-save.taskscheduler.md +122 -0
  147. package/substrate/scripts/aggregate-telemetry.sh +217 -0
  148. package/substrate/scripts/analyze-tier-dependencies.sh +239 -0
  149. package/substrate/scripts/generate-lite-manifest.sh +489 -0
  150. package/substrate/scripts/generate-tier-manifest.sh +28 -0
  151. package/substrate/scripts/intent-drift-check.sh +456 -0
  152. package/substrate/scripts/lite-manifest-drift-check.sh +146 -0
  153. package/substrate/scripts/render-lite-manifest-doc.sh +150 -0
  154. package/substrate/standards/bassclef-configs-schema.md +232 -0
  155. package/substrate/standards/bassclef-evolution.md +143 -0
  156. package/substrate/standards/bassclef-internal-jargon.md +244 -0
  157. package/substrate/standards/bassclef-managed-sentinel.md +96 -0
  158. package/substrate/standards/bassclef-source-config.md +228 -0
  159. package/substrate/standards/deferred-actions-schema.md +204 -0
  160. package/substrate/standards/docs-sync-allowlist.md +76 -0
  161. package/substrate/standards/graceful-exit.md +227 -0
  162. package/substrate/standards/hook-idempotency.md +102 -0
  163. package/substrate/standards/lite-manifest-schema-changes.md +75 -0
  164. package/substrate/standards/luminary-problem-patterns.md +481 -0
  165. package/substrate/standards/ogilvy-writing-rules.md +225 -0
  166. package/substrate/standards/opener-discipline.md +96 -0
  167. package/substrate/standards/operator-facing-prose-discipline.md +201 -0
  168. package/substrate/standards/project-directory-layout.md +276 -0
  169. package/substrate/standards/release-tagging.md +137 -0
  170. package/substrate/standards/sdlc-compliance.md +286 -0
  171. package/substrate/standards/secrets-lifecycle.md +210 -0
  172. package/substrate/standards/security-scanner-adapter.md +145 -0
  173. package/substrate/standards/skill-output-discipline.md +90 -0
  174. package/substrate/standards/state-spine.md +511 -0
  175. package/substrate/standards/tech-stack-config.md +109 -0
  176. package/substrate/standards/tier-dependency-analysis.md +167 -0
  177. package/substrate/standards/tier-runtime-deps/lite.md +57 -0
  178. package/substrate/standards/tier-tag-schema.md +155 -0
  179. package/substrate/standards/whereami-schema.md +301 -0
  180. package/substrate/standards/writing-guide.md +213 -0
  181. package/substrate/templates/deferred-action-template.md +45 -0
  182. package/substrate/templates/whereami-template.md +101 -0
@@ -0,0 +1,640 @@
1
+ ---
2
+ tier: lite
3
+ name: build
4
+ description: "Take a buildable plan and ship it. Reads the spec from /launch, dispatches a builder per user story, runs /verify, opens PRs, gates prod deploy on a reviewer. Hard floor: refuses auth, schema, security, tenant, or prod-infra changes. --explain flag narrates the plan first."
5
+ problem: "A buildable plan sits on disk. Nothing ships until someone writes code and PRs and gates prod."
6
+ value: "Reads the plan and ships it. Runs the whole cycle so you can watch instead of type."
7
+ inputs: [A goal slug pointing to a spec on disk]
8
+ outputs: [One PR per user story, Verify report, Reviewer sign-off, Prod deploy gated on a human]
9
+ user_invocable: true
10
+ disable_model_invocation: false
11
+ requires:
12
+ cli: [git, gh]
13
+ network: true
14
+ ---
15
+
16
+ # /build — Construction Execution Composer
17
+
18
+ Closes the substrate gap between `/launch` (which produces
19
+ Construction iteration-goal drafts) and a deployed working app.
20
+ Tonight: Phase 0-3 LIVE, Phase 4-7 STUB. Live execution ships in
21
+ follow-up goal AFTER operator-supervised first run.
22
+
23
+ ## ADR-consult — fire before scope confirmation (per bassclef-upstream#424)
24
+
25
+ Read every relevant ADR in `architecture/decisions/` before confirming scope. If your scope deviates from any ADR's decision or constraints, surface the deviation as the first agenda item — operator decides amend-ADR vs. revise-scope.
26
+
27
+ Per `.claude/rules/adr-discipline.md`. Mechanism: `adr-discipline-check.sh` fires on substantive architectural edits (wired in `.claude/settings.json` since bet 28a WU-1). The Tier 0 test for this step greps for the literal header `## ADR-consult — fire before scope confirmation` in each of `/build /launch /spec /decompose /shape /longrun`.
28
+
29
+ ## Usage
30
+
31
+ ```
32
+ /build <goal-slug> → run all phases. Phase 0-3 LIVE; Phase 4-7 STUB tonight (emit "TODO: live execution" strings).
33
+ /build <goal-slug> --explain → same + verbose narration at each phase. When live mode ships: pauses between Phase 3 and Phase 4 for operator confirmation.
34
+ ```
35
+
36
+ **No `--dry-run` mode** — Phase 0's mechanical hard-floor refusal is
37
+ the safety primitive. Phase 4-7 stubs make tonight's default behavior
38
+ equivalent to "preview only." When live mode ships, default runs
39
+ live; `--explain` becomes the operator preview-and-confirm path.
40
+
41
+ ## Tier boundary
42
+
43
+ `/build` ships `tier: lite`. Sam and Louis get the full plan-to-ship
44
+ chain from cold — `/launch` → `/build` → deployed app.
45
+
46
+ Two phases dispatch skills at `tier: standard`:
47
+
48
+ - **Phase 7** dispatches `/deploy-prod` (requires orchestrator-gated
49
+ mode + prod credentials). Lite adopters see the STUB message and
50
+ route prod deploy through their own path.
51
+ - **Phase 7.5** dispatches `/architect-review` (system-level review;
52
+ needs the standard-tier reviewer agent context). Same pattern:
53
+ lite adopters see the STUB message; standard+ adopters get live
54
+ dispatch.
55
+
56
+ This mirrors `/longrun`'s pattern — a lite skill can name standard
57
+ dispatches at specific phases without breaking the cold-adopter chain.
58
+ The stubs make the tier boundary visible in the operator surface.
59
+
60
+ ## Position in the /mock /frame /build triple
61
+
62
+ ```
63
+ operator paragraph
64
+
65
+ /mock (today: /stage) — Inception/Elaboration: clickable mock UI gallery
66
+
67
+ /frame (today: /launch) — Construction transition: + structural bones (spec + decomp + ux-migration + iteration-goal draft)
68
+
69
+ /build ← THIS SKILL — Construction execution: → deployed working app
70
+ ```
71
+
72
+ ## Hard ceiling — load-bearing forever
73
+
74
+ /build refuses at Phase 0 if input artifacts reference any of these
75
+ paths. Mechanical. No `SKIP_BLAST_RADIUS_FLOOR` env var. No override.
76
+ The floor is the floor.
77
+
78
+ - `src/lib/auth/**`, `src/middleware.ts` (auth code)
79
+ - `prisma/schema.prisma`, `prisma/migrations/**` (schema beyond state-spine)
80
+ - `src/lib/security/**` (security primitives)
81
+ - Tenant-isolation paths (any `tenant_*` query, tenant context resolution)
82
+ - `.github/workflows/deploy*.yml` (production CI/CD)
83
+ - Production env-var config files
84
+
85
+ If a /launch (formerly /preview-build) output references any floor path, the operator
86
+ must shape the work outside /build (manual /autonomous start with
87
+ explicit per-step operator approval). /build does not handle these.
88
+
89
+ Per `.claude/rules/manual-prod-approval.md`: /build STAGES the
90
+ prod-deploy via /deploy-prod. /build NEVER bypasses the GitHub
91
+ Environment + required-reviewer rail. The rail is the load-bearing
92
+ approval surface — operator approves prod via GitHub UI from phone.
93
+
94
+ ## Procedure
95
+
96
+ ### Step 0. Lead with `/value-prop flash` + `/kiss words` (bassclef#357)
97
+
98
+ Open every /build invocation with:
99
+
100
+ - **Flash line** (≤180 chars): one-sentence claim of what /build is
101
+ about to do. Plain language.
102
+ - **Kiss summary** (2-3 sentences, grade-10): what's the goal. what
103
+ will ship, what gates the operator at.
104
+
105
+ Walls of structured Phase 0-7 detail come AFTER this block.
106
+
107
+ ### Phase -1 — Composer pre-flight (per bassclef#408)
108
+
109
+ Before Phase 0 (which is /build's blast-radius floor refusal), source
110
+ the shared pre-flight helper to surface composer prerequisites:
111
+
112
+ ```bash
113
+ source "${BASSCLEF_DIR:-$REPO_ROOT}/lib/composer-preflight.sh"
114
+ PREFLIGHT_OUTPUT=$(composer_preflight_check "build" "${ESTIMATED_TURNS:-100}")
115
+ PREFLIGHT_RC=$?
116
+ echo "$PREFLIGHT_OUTPUT" | composer_preflight_render "build"
117
+
118
+ case $PREFLIGHT_RC in
119
+ 0) ;; # all checks pass — proceed to Phase 0
120
+ 1) # warnings — operator decides proceed/abort
121
+ echo ""
122
+ echo "Pre-flight surfaced warnings. Proceed with caution OR abort and remediate."
123
+ echo "Override (logged): SKIP_COMPOSER_PREFLIGHT=1"
124
+ ;;
125
+ 2) # failures — refuse dispatch
126
+ echo ""
127
+ echo "Pre-flight refused dispatch. Resolve fail-tier checks before re-running."
128
+ exit 1
129
+ ;;
130
+ esac
131
+ ```
132
+
133
+ Phase -1 is independent from Phase 0's blast-radius refusal (auth,
134
+ schema, security, tenant, prod-infra). Phase -1 catches missing
135
+ prerequisites; Phase 0 catches dangerous changes. Both fire.
136
+
137
+ Override Phase -1 only: `SKIP_COMPOSER_PREFLIGHT=1`. Phase 0 is
138
+ NEVER overridable.
139
+
140
+ See `standards/composer-prerequisites.md` for full discipline.
141
+
142
+ ### Phase 0 — Pre-flight + blast-radius floor refusal
143
+
144
+ Mechanical refusal before any other phase runs. Each check is a hard
145
+ exit; no override path.
146
+
147
+ ```bash
148
+ # Refuse if running from main
149
+ CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
150
+ if [ "$CURRENT_BRANCH" = "main" ]; then
151
+ echo "/build: refuse to run from main; create a feature branch first" >&2
152
+ exit 2
153
+ fi
154
+
155
+ # Parse args
156
+ EXPLAIN_MODE=false
157
+ if echo "$@" | grep -q -- '--explain'; then
158
+ EXPLAIN_MODE=true
159
+ fi
160
+
161
+ # Resolve goal via accessor
162
+ source lib/state.sh
163
+ BET_SLUG="$1"
164
+ BET_JSON=$(state_iteration_bet_get "$BET_SLUG" 2>/dev/null) || {
165
+ echo "/build: goal '$BET_SLUG' not found via state_iteration_bet_get" >&2
166
+ exit 1
167
+ }
168
+
169
+ # Check status active
170
+ STATUS=$(echo "$BET_JSON" | jq -r '.status // empty')
171
+ if [ "$STATUS" != "active" ]; then
172
+ echo "/build: goal status is '$STATUS', must be 'active'. Operator marks active before /build runs." >&2
173
+ exit 1
174
+ fi
175
+
176
+ # Resolve referenced artifacts (spec, decomp, ux-migration)
177
+ SPEC_PATH=$(echo "$BET_JSON" | jq -r '.references[]? | select(.type == "spec") | .id // empty')
178
+ DECOMP_PATH=$(echo "$BET_JSON" | jq -r '.references[]? | select(.type == "decomposition") | .id // empty')
179
+ UX_MIG_PATH=$(echo "$BET_JSON" | jq -r '.references[]? | select(.type == "ux-migration") | .id // empty')
180
+
181
+ # Validate references exist
182
+ for ref_type in spec decomposition; do
183
+ ref_id=$(echo "$BET_JSON" | jq -r --arg t "$ref_type" '.references[]? | select(.type == $t) | .id // empty')
184
+ if [ -n "$ref_id" ]; then
185
+ state_reference_check "$ref_type" "$ref_id" || {
186
+ echo "/build: reference dangling: $ref_type/$ref_id" >&2
187
+ exit 4
188
+ }
189
+ fi
190
+ done
191
+
192
+ # Blast-radius floor scan
193
+ FLOOR_PATTERN='src/lib/auth/|src/middleware\.ts|prisma/schema\.prisma|prisma/migrations/|src/lib/security/|tenant_|\.github/workflows/deploy.*\.yml|production env'
194
+
195
+ # Floor scan checks STRUCTURED content only — step acceptance criteria + file-path refs.
196
+ # NOT prose descriptions or code blocks (which legitimately mention floor paths in skill
197
+ # specs that DESCRIBE the floor). Per bassclef#366 — the crude grep had false positives
198
+ # on /build's own spec because the spec describes what /build refuses on.
199
+ ACCEPTANCE_CONTENT=$(awk '
200
+ /^```/{in_code = !in_code; next}
201
+ in_code{next}
202
+ /^### WU-/{in_wu=1; next}
203
+ /^## /{in_wu=0}
204
+ in_wu && /^- \[ \]/ {print}
205
+ ' "docs/specs/${SPEC_PATH}.md" "docs/decompositions/${DECOMP_PATH}.md" 2>/dev/null)
206
+
207
+ # File-path-shaped references (id starts with src/, prisma/, .github/, etc.)
208
+ REFS_CONTENT=$(echo "$BET_JSON" | jq -r '.references[]? | select(.id | type == "string") | .id' 2>/dev/null | grep -E '^(src/|prisma/|\.github/|production)' || true)
209
+
210
+ VIOLATIONS=$(printf "%s\n%s\n" "$ACCEPTANCE_CONTENT" "$REFS_CONTENT" | grep -E "$FLOOR_PATTERN" || true)
211
+ if [ -n "$VIOLATIONS" ]; then
212
+ echo "/build: BLAST-RADIUS FLOOR VIOLATION — refusing" >&2
213
+ echo "Floor pattern matches in step acceptance criteria or file-path references:" >&2
214
+ echo "$VIOLATIONS" >&2
215
+ exit 3
216
+ fi
217
+ ```
218
+
219
+ **Why this is precise (per bassclef#366):** the scan only looks at
220
+ step acceptance criteria (lines starting `- [ ]` under `### WU-N`
221
+ headings, outside code blocks) plus file-path-shaped references in
222
+ the goal's frontmatter. Prose paragraphs that DESCRIBE the floor (like
223
+ this section) don't trigger refusal. Code blocks that document the
224
+ floor don't trigger refusal. Only structured ACTIONS the agent would
225
+ take (acceptance criteria + references) are scanned.
226
+
227
+ If any check fails, /build exits with the documented exit code and
228
+ stderr message. Operator-readable; no silent failure.
229
+
230
+ ### Phase 0.5 — Amendment B1: OOAD predecessor chain check (per #1150 + #1167)
231
+
232
+ After the blast-radius floor scan clears, check the goal's OOAD predecessor chain per `.claude/bassclef-orientation.md` L100-108:
233
+
234
+ ```
235
+ Canvas → Spec → Personas → JTBD → Task-scenarios / Use-case → IA-model → Interaction-design → Decompose
236
+ ```
237
+
238
+ For each of the 9 chain steps, check the goal frontmatter `references` array for a matching artifact:
239
+
240
+ - Canvas — reference type `canvas` OR path under `docs/canvases/`
241
+ - Spec — reference type `spec` OR path under `docs/specs/`
242
+ - Personas — reference type `personas` OR path under `docs/personas/`
243
+ - JTBD — reference type `jtbd-tasks` OR path under `docs/jtbd/`
244
+ - Task-scenarios — reference type `task-scenarios` OR path under `docs/task-scenarios/`
245
+ - Use-case — reference type `use-case` OR path under `docs/use-cases/`
246
+ - IA-model — reference type `ia-model` OR path under `docs/ia-models/`
247
+ - Interaction-design — reference type `interaction-design` OR path under `docs/interaction-designs/`
248
+ - Decomposition — reference type `decomposition` OR path under `docs/decompositions/`
249
+
250
+ Emit one-line note per gap. Do not BLOCK. Operator picks proceed-or-shape per gap. B1 fires after `state_iteration_bet_get` resolves the goal (existing Phase 0 behavior preserved).
251
+
252
+ ```bash
253
+ # After Phase 0 blast-radius scan clears:
254
+ CHAIN_STEPS="canvas spec personas jtbd-tasks task-scenarios use-case ia-model interaction-design decomposition"
255
+ CHAIN_GAPS=""
256
+ for step in $CHAIN_STEPS; do
257
+ present=$(echo "$BET_JSON" | jq -r --arg t "$step" '.references[]? | select(.type == $t) | .id // empty' | head -1)
258
+ if [ -z "$present" ]; then
259
+ CHAIN_GAPS="$CHAIN_GAPS $step"
260
+ fi
261
+ done
262
+ if [ -n "$CHAIN_GAPS" ]; then
263
+ echo "/build: OOAD chain gap notes (advisory; operator picks proceed-or-shape):" >&2
264
+ for gap in $CHAIN_GAPS; do
265
+ echo " - missing: $gap" >&2
266
+ done
267
+ fi
268
+ ```
269
+
270
+ ### Phase 1 — InputParser
271
+
272
+ Parse the validated goal's structure:
273
+
274
+ ```bash
275
+ # Already have BET_JSON, SPEC_PATH, DECOMP_PATH, UX_MIG_PATH from Phase 0
276
+ # Read spec body for step enumeration. Per bassclef#367, spec MUST have
277
+ # the exact heading `## Steps enumerated` (pinned in /spec SKILL.md
278
+ # rules + templates/spec-template.md). /launch's Phase 9
279
+ # emits this heading by contract. Specs that lack the section → exit 4.
280
+ SPEC_FILE="docs/specs/${SPEC_PATH}.md"
281
+ WU_LIST=$(awk '/^## Steps enumerated/,/^## /' "$SPEC_FILE" | grep -E '^### WU-')
282
+
283
+ # Each WU should reference at least one story (US-NNN)
284
+ WU_COUNT=$(echo "$WU_LIST" | grep -c '^### WU-' || echo 0)
285
+ ```
286
+
287
+ Build structured object: `{ bet, spec_path, decomp_path, ux_migration_path, wus[] }`.
288
+
289
+ ### Phase 2 — Reference validation
290
+
291
+ Verify each step traces to at least one story. Refuse if any step lacks
292
+ story traceability.
293
+
294
+ ```bash
295
+ ORPHAN_WUS=$(echo "$WU_LIST" | grep -v 'US-' || true)
296
+ if [ -n "$ORPHAN_WUS" ]; then
297
+ echo "/build: step enumeration lacks story traceability (bassclef#358 violation)" >&2
298
+ echo "Orphan steps (no US-NNN ref):" >&2
299
+ echo "$ORPHAN_WUS" >&2
300
+ exit 4
301
+ fi
302
+ ```
303
+
304
+ ### Phase 2b — Adopter-mode framing (bassclef#943)
305
+
306
+ Two paths — adopter-mode and operator-mode. Default is adopter when the parent /launch used `--local` (cold-adopter context); operator-mode otherwise. Mode detection reads `docs/preview-state/<slug>.yml`: when `local_url` is present, /launch shipped via the adopter path, so /build follows.
307
+
308
+ #### Adopter-mode pre-dispatch surface
309
+
310
+ Before Phase 3's dry-run plan fires, emit a plain-English summary the cold adopter can act on. No "WU", no "GRASP", no "Phase". The agent reads concrete numbers from the spec (step count, estimated lines from the decomposition, file list from /interpret-input's structural_hints) and substitutes them in.
311
+
312
+ ```
313
+ Got it — variant <N> (<variant short name>). Here's what I'm about to do:
314
+
315
+ 1. Write the <stack name> app code for <CRUD verb 1>, <CRUD verb 2>,
316
+ <CRUD verb 3>, and <CRUD verb 4> — about <line-count-range> lines
317
+ across <file-count> files
318
+ 2. Set up a local <database> database for your <domain noun>
319
+ 3. Wire the <styling system> styling so it looks like the variant you picked
320
+ 4. Run the tests to make sure everything works
321
+ 5. Print a localhost URL when it's ready (about <time-estimate> minutes from now)
322
+
323
+ You don't need to do anything while this runs. I'll let you know when
324
+ your <app description> is up.
325
+
326
+ Want me to start? [Y/n]
327
+ ```
328
+
329
+ Variable substitutions:
330
+
331
+ | Placeholder | Source |
332
+ |---|---|
333
+ | `<N>` | `preview-state.yml`'s `selected_variant` |
334
+ | `<variant short name>` | Variant's luminary signature (e.g., "cozy shared notebook") from the gallery |
335
+ | `<stack name>` | Spec's chosen stack (e.g., "Next.js + SQLite + Tailwind") |
336
+ | `<CRUD verb 1-4>` | InputArtifact's `structural_hints.verb_goal_pairs` first 4 items (e.g., "add", "edit", "search", "tag") |
337
+ | `<line-count-range>` | Sum of decomposition step line estimates ± 25% range |
338
+ | `<file-count>` | Count of files in decomposition's expected output |
339
+ | `<database>` | Spec's chosen DB (e.g., "SQLite", "Postgres") |
340
+ | `<domain noun>` | InputArtifact's `structural_hints.entities_seen` first item (e.g., "recipes", "tasks") |
341
+ | `<styling system>` | Spec's chosen styling (e.g., "Tailwind") |
342
+ | `<time-estimate>` | Sum of step baseline turns × ~30sec per turn (e.g., 25 turns × 30s = ~12 min) |
343
+ | `<app description>` | InputArtifact's `intent` paragraph compressed to 5-7 words (e.g., "family recipe wiki") |
344
+
345
+ Adopter answers `Y` → proceeds to Phase 3 dry-run + Phase 4 dispatch. Adopter answers `n` → /build exits cleanly.
346
+
347
+ #### Adopter-mode during-dispatch progress messages
348
+
349
+ Progress messages emitted between Phase 4 (BuilderDispatcher) and Phase 5 (VerifyOrchestrator) use plain English. The agent substitutes per-step descriptive language read from the spec's user stories:
350
+
351
+ ```
352
+ Writing the <story 1 description, e.g., "add-recipe screen">...
353
+ Setting up the <story 2 description, e.g., "recipe database table">...
354
+ Adding the <story 3 description, e.g., "search feature">...
355
+ Running tests to make sure it all works...
356
+ ```
357
+
358
+ NOT: "Builder dispatching WU-3 of 6" / "GRASP responsibility matrix applied" / "Phase 12 deploy gate."
359
+
360
+ #### Adopter-mode post-dispatch success surface
361
+
362
+ After Phase 5 (VerifyOrchestrator) passes + Phase 6 (Merge orchestration) completes in --local context, emit:
363
+
364
+ ```
365
+ Done. Your <app description> is running at http://127.0.0.1:<port>
366
+
367
+ Try it out:
368
+ - <action 1 + interaction hint, e.g., "Click + to add a recipe">
369
+ - <action 2 + interaction hint, e.g., "Tap any recipe to edit it">
370
+ - <action 3 + interaction hint, e.g., "Search by ingredient with the bar at the top">
371
+ - <action 4 + interaction hint, e.g., "Tap the heart to tag favorites">
372
+
373
+ Want me to deploy it somewhere your family can use it? That's a few
374
+ more steps and you'll need a <deploy host> account.
375
+ ```
376
+
377
+ Variable substitutions:
378
+
379
+ | Placeholder | Source |
380
+ |---|---|
381
+ | `<app description>` | Same as pre-dispatch |
382
+ | `<port>` | Local server port (default 3000 for Next.js; from spec) |
383
+ | `<action N + interaction hint>` | Each verb-goal pair from InputArtifact's `structural_hints.verb_goal_pairs` + a sensible interaction verb ("Click", "Tap", "Type", "Drag") |
384
+ | `<deploy host>` | Spec's deploy target or "Vercel or Fly.io" if not yet chosen |
385
+
386
+ The deploy offer respects `.claude/rules/guardrails.md` — operator must confirm before any external account binding.
387
+
388
+ #### Operator-mode preserved verbatim
389
+
390
+ Today's Phase 3 dry-run + Phase 4 stub + structured output stays the default for operator workflows (no `--local` parent, no adopter context):
391
+
392
+ ```
393
+ **Flash:** /build dry-run for <goal-slug> — N steps planned, ~M turns, ~T hours wall, prod approval staged.
394
+
395
+ **Kiss:** I would ship N user stories from <goal-slug> as N atomic PRs.
396
+ [detailed phase-by-phase plan]
397
+ ```
398
+
399
+ Mode selection:
400
+
401
+ ```
402
+ if preview_state.local_url is present:
403
+ mode = "adopter"
404
+ else:
405
+ mode = "operator"
406
+ ```
407
+
408
+ Operator can force adopter-mode via `--adopter-mode` flag (V2). Operator can force operator-mode via `--operator-mode` flag (V2).
409
+
410
+ ### Phase 3 — DryRunPlanner
411
+
412
+ Walk step enumeration; for each, plan what would happen in live mode:
413
+
414
+ ```
415
+ For each step in spec:
416
+ - Branch name: feature/<goal-slug>-stack-<N>-<wu-slug>
417
+ - Story refs: US-NNN
418
+ - Acceptance criteria: inherited from story
419
+ - Builder dispatch context: spec section + decomp matrix entry
420
+ - /verify gate: matches change type (UI / unit / integration)
421
+ - PR open: stacked-atomic per pr-strategy.md
422
+ - Estimated turns: ~25 per step baseline (refine per spec complexity)
423
+ ```
424
+
425
+ Emit structured output per spec (see "Dry-run output structure"
426
+ in `docs/specs/2026-04-30b-build-skill.md`):
427
+
428
+ ```markdown
429
+ **Flash:** /build dry-run for <goal-slug> — N steps planned, ~M turns, ~T hours wall, prod approval staged.
430
+
431
+ **Kiss:** I would ship N user stories from <goal-slug> as N atomic
432
+ PRs. Each WU dispatches Builder, runs /verify, opens PR. Operator
433
+ merges inline. After all merge + CI green, /deploy-prod stages a
434
+ prod deploy you approve from phone via GitHub Environment.
435
+
436
+ ---
437
+
438
+ ## Phase 0 — Pre-flight ✅
439
+ - Goal slug, status, branch, blast-radius scan all PASSED.
440
+
441
+ ## Phase 1 — Input contract
442
+ - Spec, decomp, ux-migration paths
443
+ - Stories: N (US-001 .. US-NNN)
444
+
445
+ ## Phase 2 — Reference validation ✅
446
+ - All steps reference stories
447
+ - All acceptance criteria inherit from stories
448
+
449
+ ## Phase 3 — Planned steps (in order)
450
+ [per-step breakdown]
451
+
452
+ ## Phase 4-7 (LIVE — STUBBED tonight)
453
+ TODO: live execution — operator-supervised first run only.
454
+ [detailed would-happen description per phase]
455
+
456
+ ## Estimated totals
457
+ - Turns: <sum>
458
+ - Wall: <sum> hours
459
+ - PRs: N + 1 (deploy)
460
+ - Operator-tap moments: 1 (prod deploy approval via GitHub Environment)
461
+ ```
462
+
463
+ ### Phase 4 — BuilderDispatcher (LIVE — STUBBED)
464
+
465
+ **Amendment per #1171 — Builder inputs name OOAD artifacts.**
466
+
467
+ Tonight emits literal:
468
+
469
+ ```
470
+ TODO: live execution — operator-supervised first run only. Would:
471
+ dispatch Builder against step <slug> with context from spec section
472
+ <X> + decomp matrix entry <Y> + paired OOAD artifacts (decomposition
473
+ + interaction-design + use-case per goal doc references). Branch:
474
+ feature/<goal-slug>-stack-<N>.
475
+ ```
476
+
477
+ The string `TODO: live execution` is grep-able for audit. Live mode
478
+ (future PR) replaces stub with `/autonomous start --from-spec=<path>
479
+ --wu=<slug>` invocation. Builder receives paired OOAD artifacts named
480
+ in the goal doc `references` array — decomposition (grep for
481
+ `type: decomposition`), interaction-design (grep for
482
+ `type: interaction-design`), use-case (grep for `type: use-case`).
483
+ Per #1171 — every OOAD artifact consulted for any engineering change.
484
+
485
+ ### Phase 5 — VerifyOrchestrator (LIVE — STUBBED)
486
+
487
+ Tonight emits literal:
488
+
489
+ ```
490
+ TODO: live execution — would run /verify gate against branch <name>.
491
+ Match change type (UI smoke / unit / integration) and BLOCK on
492
+ failure with line-numbered output.
493
+ ```
494
+
495
+ ### Phase 5.5 — Amendment B2: /pattern-review trigger reads decomposition (per #1150 + #1167)
496
+
497
+ When the goal references a decomposition doc AND that doc contains `@pattern` references, dispatch `/pattern-review` with the decomposition path as input. Skip when the decomposition names no `@pattern`. Contract per `.claude/rules/pattern-annotation.md` L57-62.
498
+
499
+ Advisory in V1 per adr-deviation-challenge calibration pattern. Non-blocking; emits findings to operator surface for review at PR review time.
500
+
501
+ ```bash
502
+ # After Phase 5 /verify passes:
503
+ DECOMP_PATH=$(echo "$BET_JSON" | jq -r '.references[]? | select(.type == "decomposition") | .id // empty' | head -1)
504
+ if [ -n "$DECOMP_PATH" ] && [ -f "docs/decompositions/${DECOMP_PATH}.md" ]; then
505
+ if grep -qE '^\s*-?\s*@pattern' "docs/decompositions/${DECOMP_PATH}.md"; then
506
+ echo "/build: Phase 5.5 dispatching /pattern-review (decomposition names @pattern refs)" >&2
507
+ # TODO: live execution — /pattern-review dispatch when Phase 5.5 flips from advisory to live
508
+ echo "TODO: live execution — would dispatch /pattern-review $DECOMP_PATH" >&2
509
+ fi
510
+ fi
511
+ ```
512
+
513
+ ### Phase 6 — Merge orchestration (LIVE — STUBBED)
514
+
515
+ Tonight emits literal:
516
+
517
+ ```
518
+ TODO: live execution — would open PR (stacked-atomic per pr-strategy)
519
+ + retarget-before-merge per branch-stacking.md if dependent stack PR
520
+ already open. Operator merges inline.
521
+ ```
522
+
523
+ ### Phase 7 — ApprovalGateLink (LIVE — STUBBED)
524
+
525
+ Tonight emits literal:
526
+
527
+ ```
528
+ TODO: live execution — when all steps merged + CI green, would dispatch
529
+ /deploy-prod. /deploy-prod routes through GitHub Environment +
530
+ required-reviewer rail per manual-prod-approval.md. Operator approves
531
+ prod deploy via GitHub UI from phone. /build NEVER bypasses this rail.
532
+ ```
533
+
534
+ <!-- FKGL-EXEMPT: Phase 7.5 references paths + skip criteria per architect-review SKILL; technical dispatch stub matches sibling STUB pattern -->
535
+ ### Phase 7.5 — /architect-review auto-dispatch (LIVE — STUBBED, per #1437 Step 2 wiring)
536
+
537
+ After Phase 6 merges land + CI green + before Phase 7 approval-gate fires. Check skip criteria per `.claude/skills/architect-review/SKILL.md` § Skip criteria. When skip criteria hold (docs-only session, single-file quick-fix, under 10 commits since last review, operator explicit-defer), log the skip in the build summary and continue to Phase 7. Otherwise dispatch `/architect-review`; the review produces its own report at `docs/architecture/reviews/YYYY-MM-DD.md` + finding tickets; return summary line into the build's operator surface.
538
+
539
+ See `.claude/skills/architect-review/SKILL.md` § Distinct from Reviewer agent for boundary vs the per-PR CodeReviewer agent — /build's per-PR CodeReviewer dispatch (via Reviewer agent per Phase 6) is orthogonal to this Phase 7.5 architectural sweep.
540
+
541
+ Tonight emits literal:
542
+
543
+ ```
544
+ TODO: live execution — would evaluate skip criteria + either skip with log
545
+ line OR dispatch /architect-review + fold summary into build operator surface.
546
+ Skip criteria check + dispatch both stubbed pending #1437 Step 3 (Tier 0 test
547
+ for dispatch behavior).
548
+ ```
549
+ <!-- /FKGL-EXEMPT -->
550
+
551
+ ### Phase 8 — Operator surface (StatusSurface)
552
+
553
+ At every phase boundary, emit the bassclef#357 flash + kiss block.
554
+ The Phase 0-3 output IS the operator's preview surface. Full structure
555
+ in `docs/specs/2026-04-30b-build-skill.md` §"Dry-run output structure".
556
+
557
+ ## Hard constraints
558
+
559
+ - **MUST refuse from main branch** — feature branch required
560
+ - **MUST resolve goal via state_iteration_bet_get** — no ad-hoc parsing
561
+ - **MUST validate references exist** — state_reference_check; fail fast
562
+ - **MUST enforce blast-radius floor at Phase 0** — mechanical, no override
563
+ - **MUST cite bassclef#357 flash + kiss in operator output** — Step 0 of procedure
564
+ - **MUST emit literal "TODO: live execution" strings in Phase 4-7** — grep-able for audit
565
+ - **MUST NOT execute live Phase 4-7 work tonight** — stubs only until follow-up goal validates first supervised run
566
+
567
+ ## Reserved-names check
568
+
569
+ `build` not on `standards/reserved-skill-names.md` list (verified
570
+ 2026-04-30 during bassclef#359 filing).
571
+
572
+ ## Failure mode summary
573
+
574
+ | Exit code | Phase | Condition |
575
+ |---|---|---|
576
+ | 0 | All | Phase 0-3 output produced + Phase 4-7 stub trace; no errors |
577
+ | 1 | 0 | Goal not found OR not active |
578
+ | 2 | 0 | Running from main branch |
579
+ | 3 | 0 | Blast-radius floor violation |
580
+ | 4 | 1-2 | Reference dangling OR step orphan (no story traceability) |
581
+
582
+ ## Test fixtures (synthetic — see scripts/tests/build-skill.test.sh)
583
+
584
+ - `valid-bet` — well-shaped; Phase 0-3 PASS; produces expected output
585
+ - `floor-violation-bet` — references `src/lib/auth/login.ts`; Phase 0 exit 3
586
+ - `dangling-ref-bet` — frontmatter references nonexistent spec; Phase 1 exit 4
587
+ - `no-story-traceability-bet` — step enumeration without US-NNN; Phase 2 exit 4
588
+
589
+ ## Composes with
590
+
591
+ - `/launch` — UPSTREAM producer (Phase 14 iteration-goal draft)
592
+ - `/autonomous start` — DOWNSTREAM dispatch (live mode; STUBBED tonight)
593
+ - `/verify` — DOWNSTREAM gate (live mode; STUBBED tonight)
594
+ - `/deploy-prod` — DOWNSTREAM stage (live mode; STUBBED tonight)
595
+ - `/longrun` — composes for long goals (>50t); /build invocation can
596
+ trigger /longrun automatically (designed; not implemented tonight)
597
+ - `/value-prop` (flash mode) — Step 0 operator surface
598
+ - `/kiss` (words mode) — Step 0 operator surface
599
+
600
+ ## Distinct from
601
+
602
+ - `/auto-fix` — narrow defect lane (one fix, one PR). /build is full
603
+ Construction execution (multiple steps, multiple PRs, deploy).
604
+ - `/launch` — produces the input. /build consumes it.
605
+ - `/autonomous start` — primitive /build composes. /build is the
606
+ composer; /autonomous start is one of the things it dispatches.
607
+
608
+ ## Why this skill exists
609
+
610
+ Per bassclef#335 epic: "Missing: a composer skill that closes the
611
+ gap — takes a /launch (formerly /preview-build) output, dispatches Builder agent,
612
+ tracks step PRs, triggers /deploy-prod on completion. This is the
613
+ skill that turns 'talking-out-loud → functioning app in prod' into
614
+ a single dispatch."
615
+
616
+ Tonight ships the SHAPE + SCAFFOLD + DRY-RUN. Tomorrow's
617
+ operator-supervised first live run validates the input contract +
618
+ blast-radius enforcement + dry-run accuracy. Live execution paths
619
+ go from STUBBED to implemented in a follow-up goal AFTER first run
620
+ ships clean.
621
+
622
+ ## Open questions (for live-mode follow-up)
623
+
624
+ - When STUB Phase 4-7 become live: how does /build resume on
625
+ interruption? Likely composes /longrun recovery primitives.
626
+ - Should `/build <slug>` automatically compose `/longrun` if
627
+ estimated step count > 50t? Operator-friendly default.
628
+ - /stage (formerly /preview) /launch (formerly /preview-build) renames (bassclef#359) — operator
629
+ approves rename goal; /build's references update mechanically.
630
+
631
+ ## Closes (when this PR ships + first live run validates)
632
+
633
+ - bassclef#335 (the /build composer epic — partial; live mode in
634
+ follow-up)
635
+ - Locks /build name (bassclef#359 sequencing)
636
+ - Validates /launch (formerly /preview-build)'s post-bassclef#358 output contract
637
+
638
+ ## Output discipline
639
+
640
+ Dispatch `/kiss words --rewrite` on your skill output before you return it. See `standards/skill-output-discipline.md` for the contract.