shapeup-sdlc 1.6.3 → 3.0.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 (118) hide show
  1. package/.claude/settings.local.example.json +5 -5
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/AGENTS.md +54 -107
  4. package/README.md +165 -151
  5. package/SECURITY.md +49 -27
  6. package/bin/init.mjs +93 -108
  7. package/bin/lib/grant.mjs +145 -0
  8. package/commands/build.md +20 -0
  9. package/commands/eval.md +5 -4
  10. package/commands/scopes.md +5 -4
  11. package/commands/shape.md +1 -1
  12. package/commands/ship.md +53 -7
  13. package/commands/wire.md +1 -1
  14. package/hooks/dispatch-receipt.mjs +195 -0
  15. package/hooks/gate-intake.mjs +16 -17
  16. package/hooks/gate-zerowork.mjs +107 -25
  17. package/hooks/hooks.json +9 -48
  18. package/hooks/lib/decision.mjs +38 -19
  19. package/hooks/safety-spine.mjs +4 -4
  20. package/hooks/sandbox-guard.mjs +130 -50
  21. package/{skills/tech-lead/scripts/compile-order.mjs → kernel/compile.mjs} +344 -55
  22. package/{skills/tech-lead/scripts/gate-answers.mjs → kernel/gate.mjs} +69 -26
  23. package/kernel/harness.mjs +134 -0
  24. package/{skills/tech-lead/scripts/fit-check.mjs → kernel/init/fit.mjs} +25 -22
  25. package/kernel/init/run.mjs +489 -0
  26. package/{skills/tech-lead/scripts → kernel}/lib/argv.mjs +52 -31
  27. package/{skills/tech-lead/scripts/lib/contract-md.mjs → kernel/lib/contract.mjs} +261 -17
  28. package/kernel/lib/paths.mjs +491 -0
  29. package/kernel/probe/concurrency.mjs +510 -0
  30. package/{skills/tech-lead/scripts/aegis-digest.mjs → kernel/probe/digest.mjs} +10 -11
  31. package/kernel/probe/eval.mjs +77 -0
  32. package/kernel/probe/leg.mjs +125 -0
  33. package/kernel/probe/resume.mjs +528 -0
  34. package/{skills/tech-lead/scripts → kernel/probe}/stats.mjs +102 -21
  35. package/kernel/probe/t0.mjs +66 -0
  36. package/{skills/ba-pitch-analyzer/scripts/board-derive.mjs → kernel/reduce/board.mjs} +104 -28
  37. package/kernel/reduce/graph.mjs +437 -0
  38. package/kernel/reduce/hill.mjs +152 -0
  39. package/kernel/reduce/ingest.mjs +633 -0
  40. package/{hooks/slop-cleaner.mjs → kernel/reduce/leftovers.mjs} +40 -57
  41. package/{skills/tech-lead/scripts/ship-report.mjs → kernel/reduce/ship.mjs} +93 -14
  42. package/{skills/tech-lead/scripts/run-snapshot.mjs → kernel/reduce/snapshot.mjs} +22 -21
  43. package/{skills/spec-evaluator/scripts/verdict-ledger.mjs → kernel/reduce/verdict.mjs} +14 -8
  44. package/kernel/report/export.mjs +325 -0
  45. package/kernel/report/facts.mjs +347 -0
  46. package/{skills/tech-lead/scripts/budget-check.mjs → kernel/verify/budget.mjs} +22 -25
  47. package/kernel/verify/dispatch.mjs +114 -0
  48. package/{skills/tech-lead/scripts/validate-envelope.mjs → kernel/verify/envelope.mjs} +20 -15
  49. package/{skills/tech-lead/scripts/lib → kernel/verify}/ratchet-tree.mjs +36 -14
  50. package/kernel/verify/skills.mjs +125 -0
  51. package/kernel/verify/spec.mjs +559 -0
  52. package/{skills/tech-lead/scripts/t0-verify.mjs → kernel/verify/t0.mjs} +138 -28
  53. package/{skills/tech-lead/scripts/trace-lint.mjs → kernel/verify/trace.mjs} +28 -13
  54. package/oracles/_shared.mjs +1 -1
  55. package/oracles/http-oracle.mjs +2 -2
  56. package/oracles/index.mjs +1 -1
  57. package/oracles/process-oracle.mjs +2 -2
  58. package/oracles/snapshot-oracle.mjs +2 -2
  59. package/oracles/test-oracle.mjs +2 -2
  60. package/package.json +11 -13
  61. package/skills/ba-pitch-analyzer/SKILL.md +24 -19
  62. package/skills/ba-pitch-analyzer/assets/templates/_index.tmpl.md +1 -1
  63. package/skills/ba-pitch-analyzer/assets/templates/api-feasibility.tmpl.md +12 -7
  64. package/skills/ba-pitch-analyzer/assets/templates/contracts/third-party-api.contract.tmpl.md +6 -3
  65. package/skills/ba-pitch-analyzer/assets/templates/cross-context/migration-plan.tmpl.md +5 -4
  66. package/skills/ba-pitch-analyzer/assets/templates/cross-context/team-handoff.tmpl.md +23 -13
  67. package/skills/ba-pitch-analyzer/assets/templates/scope-summary.tmpl.md +17 -12
  68. package/skills/ba-pitch-analyzer/assets/templates/synthesis.tmpl.md +17 -38
  69. package/skills/ba-pitch-analyzer/assets/templates/task.tmpl.md +3 -0
  70. package/skills/ba-pitch-analyzer/references/contract-patterns.md +8 -4
  71. package/skills/ba-pitch-analyzer/references/doc-schemas.md +3 -1
  72. package/skills/ba-pitch-analyzer/references/task-generation.md +8 -8
  73. package/skills/ba-pitch-analyzer/references/test-surface.md +1 -1
  74. package/skills/coach/SKILL.md +3 -3
  75. package/skills/orient/SKILL.md +2 -1
  76. package/skills/qa-edge-hunter/SKILL.md +15 -41
  77. package/skills/scope-architect/SKILL.md +57 -18
  78. package/skills/scope-hammer/SKILL.md +5 -5
  79. package/skills/shapeup/SKILL.md +3 -3
  80. package/skills/shapeup/resources/context-compaction.md +4 -3
  81. package/skills/solution-architect/SKILL.md +37 -15
  82. package/skills/spec-evaluator/SKILL.md +24 -7
  83. package/skills/spec-evaluator/references/dimensions/_registry.md +2 -2
  84. package/skills/spec-evaluator/references/dimensions/completeness.md +1 -1
  85. package/skills/spec-evaluator/references/dimensions/integration.md +98 -67
  86. package/skills/spec-evaluator/references/dimensions/spec-conformance.md +4 -4
  87. package/skills/spec-evaluator/references/dimensions/test-surface-conformance.md +1 -1
  88. package/skills/spec-evaluator/references/probing.md +42 -23
  89. package/skills/spec-evaluator/references/report-schema.md +2 -2
  90. package/skills/task-executor/SKILL.md +32 -18
  91. package/skills/tech-lead/SKILL.md +127 -438
  92. package/skills/tech-lead/references/gates.md +140 -49
  93. package/skills/tech-lead/references/protocol.md +832 -0
  94. package/skills/tech-lead/schemas/domain.schema.json +645 -198
  95. package/skills/tech-lead/schemas/gate-answers.schema.json +2 -2
  96. package/skills/tech-lead/schemas/work-order.schema.json +11 -2
  97. package/skills/tech-lead/schemas/work-result.schema.json +56 -18
  98. package/skills/tech-lead/workflows/shapeup-run.js +1474 -0
  99. package/skills/translator/SKILL.md +2 -2
  100. package/hooks/anti-rationalization.mjs +0 -244
  101. package/hooks/compact-snapshot.mjs +0 -47
  102. package/hooks/gate-deadline.mjs +0 -151
  103. package/hooks/gate-l2.mjs +0 -161
  104. package/hooks/session-rehydrate.mjs +0 -109
  105. package/skills/advisor-protocol/SKILL.md +0 -171
  106. package/skills/ba-pitch-analyzer/scripts/spec-lint.mjs +0 -239
  107. package/skills/spec-evaluator/README.md +0 -93
  108. package/skills/tech-lead/README.md +0 -71
  109. package/skills/tech-lead/references/delegation.md +0 -254
  110. package/skills/tech-lead/references/invocation.md +0 -45
  111. package/skills/tech-lead/references/ledger-schema.md +0 -214
  112. package/skills/tech-lead/references/round-protocol.md +0 -184
  113. package/skills/tech-lead/references/state-model.md +0 -66
  114. package/skills/tech-lead/scripts/ingest-result.mjs +0 -270
  115. package/skills/tech-lead/scripts/init-run.mjs +0 -326
  116. package/skills/tech-lead/scripts/lib/is-main.mjs +0 -82
  117. package/skills/tech-lead/scripts/lib/paths.mjs +0 -278
  118. package/skills/translator/README.md +0 -66
@@ -2,12 +2,26 @@
2
2
 
3
3
  The full collect-lists, gate-output blocks, and delegation scripts for every gate and delegation
4
4
  step, extracted from `SKILL.md` (progressive disclosure). **Read the relevant section when you
5
- reach that gate** — `SKILL.md` carries the workflow spine, the build/eval loop, and the hard
6
- rules; this file carries the step-by-step playbooks. The L2/L4 gates stay hook-enforced regardless
7
- of where the prose lives.
5
+ reach that gate** — `SKILL.md` carries the workflow spine and the hard rules; this file carries the
6
+ step-by-step playbooks. The L2/L4 gates stay hook-enforced regardless of where the prose lives.
8
7
 
9
- Order matches the run: GATE L0 ORIENT GATE L1a → WIRE/L1a.5 → MAP SCOPES → GATE L1b →
10
- (BUILD GATE L2 EVAL, in SKILL.md) GATE L3 SHIP GATE L4.
8
+ **Which lane these playbooks serve.** The gate blocks below are lane-independent: every
9
+ lane emits them verbatim, and on the scoped lane `shapeup-run.js` returns the `block` field for
10
+ `SKILL.md` to print unchanged. What differs is who runs the loop *between* the gates:
11
+
12
+ | lane | BUILD → GATE L2 → EVAL is | read |
13
+ |---|---|---|
14
+ | a spec with committed `scopes/*.md` (the common case) | **code** — `skills/tech-lead/workflows/shapeup-run.js`'s round loop | that script's comments |
15
+ | `--tiny`, or a spec with no scope contracts yet | **prose**, unchanged and non-regression | `references/protocol.md` (`:11-22` states the same split) |
16
+
17
+ Order matches the run: GATE L0 → ORIENT → GATE L1a → ANALYZE → WIRE/L1a.5 → MAP SCOPES →
18
+ GATE L1b → (BUILD → GATE L2 → EVAL — see the table above) → GATE L3 → SHIP → GATE L4.
19
+
20
+ ⟐ **ANALYZE runs before WIRE.** MAP SCOPES' two dispatches split around
21
+ L1a.5: `analyze` writes the spec tree, then `wire` reads its `usecases/` — one wiring-map entry per
22
+ use case — then `map-scopes` slices. Dispatching WIRE first hands `solution-architect` an empty
23
+ spec folder, which its own input contract excludes (`skills/solution-architect/SKILL.md:43-44`); it
24
+ escalates, writes nothing, and every relaunch re-dispatches it.
11
25
 
12
26
  ---
13
27
 
@@ -37,11 +51,16 @@ Collect (explicit — never inferred):
37
51
  - LOCAL .shapeup/<slug>/ — run-trace (hidden, gitignorable):
38
52
  harness-run.md (this ledger), digest, orient/, evaluation/, qa/,
39
53
  discovery/ledger.md, orders/ + results/ (the envelope port), tasks/ (the task
40
- board, v3.2 — regenerable via a generate-board order on any machine)
41
54
  spec_folder = shapeup/<slug>/spec/ (the deliverable arg passed to ba/eval/exec)
42
55
  L0.3 lens: lite | standard | cross-context (passed to planner at step 8)
43
56
  L0.4 stack hint (e.g. "pnpm, Next 16 web :3000") — aims orient's code-surface sweeps + run commands
44
- L0.5 eval dimensions: default [spec-conformance]; only add if user asks
57
+ L0.5 eval dimensions: default [spec-conformance]; only add if user asks. An added dimension
58
+ must reach `harness init run --dimensions <a,b>` — it is recorded in the ledger's
59
+ `eval_dimensions:` line and every EVAL order is compiled from there, so a set agreed
60
+ in conversation and not passed to the flag grades nothing. Shipped ids:
61
+ spec-conformance, tdd-surface, integration, completeness, test-surface-conformance
62
+ (security + performance ship disabled). Whatever is left out is reported at L4 as
63
+ `dims_not_evaluated` — "shipped" never silently means "verified for all".
45
64
  L0.6 max_rounds: default 3, appetite-informed (see L0.1b)
46
65
  L0.7 auto level:
47
66
  interactive (default) — pause at every L-gate; sub-skills keep their own gates
@@ -49,18 +68,18 @@ Collect (explicit — never inferred):
49
68
  at L1a/L1b (orient+plan), L3 (verdict), L4 (ship)
50
69
  --unattended — auto-confirm all L-gates too; stop only on PASS,
51
70
  max_rounds, or hard error (for headless / Agent SDK / CI)
52
- L0.8 Model & budget resolution (addendum Blueprint F, four layers, highest precedence
71
+ L0.8 Model & budget resolution (four layers, highest precedence
53
72
  first) — resolve ONCE here, record the resulting matrix in the ledger header:
54
73
  /ship flags → .claude/settings.local.json (per-member, Tier C) →
55
74
  .claude/settings.json (team defaults, committed) → skill-shipped defaults
56
75
  Env knobs read at this layer: SHAPEUP_ORCH_MODEL, SHAPEUP_EXEC_MODEL,
57
76
  SHAPEUP_EVAL_MODEL, SHAPEUP_QA_MODEL, SHAPEUP_ATTEMPT_BUDGET (default 5),
58
- SHAPEUP_DIGESTER_MODEL (default "script" — aegis-digest.mjs's regex pass; falls
77
+ SHAPEUP_DIGESTER_MODEL (default "script" — harness probe digest's regex pass; falls
59
78
  back to a Sonnet dispatch only when the digester reports unrecognized log formats).
60
79
  A requested model unavailable on the member's plan → degrade to the next tier down,
61
80
  record the degrade in the ledger (R2 — invariants are code paths, so adherence
62
81
  survives even when the model tier doesn't).
63
- L0.9 attempt_budget: the INNER circuit breaker (design spec DD-9), nested inside
82
+ L0.9 attempt_budget: the INNER circuit breaker, nested inside
64
83
  max_rounds (the OUTER breaker, unchanged, L0.6). Default 5 — the number of T0 verify
65
84
  attempts a single scope gets inside one round before its attempt loop trips and
66
85
  queues a hammer PROPOSAL for GATE H rather than blocking the round. Only meaningful
@@ -73,6 +92,27 @@ Collect (explicit — never inferred):
73
92
  attempts. Set per scope (`no_progress_k` on the contract) or per run in the payload.
74
93
  ```
75
94
 
95
+ **L0.9b — the launch record.** Every switch the operator typed becomes a `RunArgs` field, or it
96
+ does nothing at all: the workflow cannot read a config file and cannot ask a follow-up, so a flag
97
+ that stops at the skill boundary was accepted and ignored. That is not hypothetical — `--no-qa` was
98
+ documented in seven places across the shipped set and inert in all of them, because no line of this
99
+ protocol ever put `noQa` into the record.
100
+
101
+ | Flag | `RunArgs` field |
102
+ |---|---|
103
+ | `--no-eval` | `noEval: true` |
104
+ | `--no-qa` | `noQa: true` |
105
+ | `--parallel-scopes N` | `maxParallelScopes: N` — how many scopes build at once (default 4; `1` = sequential) |
106
+ | `--adversarial-verify` | `adversarialVerify: true` |
107
+ | `--rounds N` / `--attempts N` / `--wall-clock-budget S` | `budgets.{maxRounds,attemptBudget,wallClockS}` |
108
+ | `--gate-answers <set>` | `answers` |
109
+ | `--orch-model/--exec-model/--eval-model/--qa-model` | `models.{…}` (L0.8) |
110
+
111
+ The assembled object is written to `.shapeup/<slug>/run-args.json` before the launch, fresh on every
112
+ launch and relaunch. It is the only artifact that records what a run was configured with; the ship
113
+ report, a resumed session and any later measurement all read it, and none of them can recover a
114
+ value that only ever existed as an argument.
115
+
76
116
  **L0.0 — intake precondition (before any other L0 collection):**
77
117
  ```
78
118
  resolve intake from, in order:
@@ -84,8 +124,7 @@ none resolvable -> ABORT. Print the ✋ NO INTAKE block from SKILL.md and stop
84
124
  Do NOT describe the pipeline that "will" run.
85
125
  ```
86
126
  An orchestrator with no spec has nothing to orchestrate. Narrating the gate list in that state
87
- produces output that reads exactly like a successful run and contains no work measured at 29%
88
- acceptance, n=3, on the benchmark. Fail loudly instead.
127
+ produces output that reads exactly like a successful run and contains no work. Fail loudly instead.
89
128
 
90
129
  **GATE L0 Output:**
91
130
  ```
@@ -109,7 +148,7 @@ The Shape Up Building phase opens with **Orient, not planning**: the team reads
109
148
  and spikes the scary parts *before* any board exists, so the board comes out reality-born.
110
149
 
111
150
  ```
112
- Invoke via Agent (model: exec — see references/delegation.md "Invocation mechanism"):
151
+ Invoke via Agent (model: exec — see references/protocol.md "Invocation mechanism"):
113
152
  Skill(shapeup-sdlc-plugin:orient) --pitch <intake> --spec <path> --stack "<hint>" [--auto]
114
153
  Owns: its own GATE O-A/O-B; runs straight through under --auto.
115
154
  Writes: .shapeup/<slug>/orient/ → code-surface.md, spike-<area>.md, discovered-seed.md, hill-signal.md.
@@ -126,7 +165,7 @@ re-scanning the codebase. Pass `--auto` only when the run level is `--auto`/`--u
126
165
  committing to a scope map. This is the first Hill read (area-level — slices don't exist yet).
127
166
 
128
167
  ```
129
- Read .shapeup/<slug>/orient/. Render the 🗻 Hill from hill-signal.md (see ledger-schema.md "Hill report"):
168
+ Read .shapeup/<slug>/orient/. Render the 🗻 Hill from hill-signal.md (see protocol.md "Hill report"):
130
169
  - each suspected area → uphill (open unknowns) | crest (approach proven by the spike) | downhill
131
170
  Print: the code-surface headline (where it lands), the spiked area + result, the riskiest
132
171
  open unknowns going into mapping.
@@ -149,9 +188,14 @@ Do NOT enter MAP SCOPES until Orient is accepted.
149
188
  2. WIRE — compile-order --operation wire --slug <slug> (worker→solution-architect), payload
150
189
  {project_profile}. Sole writer of committed wiring-map.md (per-UC engine → seam → entry-point
151
190
  call site → affordance). ⏸ GATE L1a.5: confirm each UC has a declared seam before slicing.
152
- 3. COVERAGE (folds into MAP SCOPES) compile-order --operation coverage ba writes the SHARED
191
+ PRECONDITION: MAP SCOPES step 1 (ANALYZE) has already run and usecases/ is
192
+ populated. WIRE writes one entry per use case, so dispatching it against an empty spec folder
193
+ is an escalation, not a wiring map — and a phase that writes no artifact is re-dispatched on
194
+ every relaunch. Verify: node "${CLAUDE_PLUGIN_ROOT}/kernel/harness.mjs" probe resume
195
+ --slug <slug> --require analyze (exit 0 = the spec tree is there; exit 6 = do not dispatch WIRE).
196
+ Post-check the same way after the dispatch: --require wire.
153
197
  requirements.md registry (atomic REQ clauses, frozen ids).
154
- 4. trace-lint — node "${CLAUDE_PLUGIN_ROOT}/skills/tech-lead/scripts/trace-lint.mjs" --slug <slug>. ADVISORY at L1b:
198
+ 4. trace-lint — node "${CLAUDE_PLUGIN_ROOT}/kernel/harness.mjs" verify trace --slug <slug>. ADVISORY at L1b:
155
199
  covers-closure (every covered REQ named by ≥1 AC's covers:) + reachability (every UC engine
156
200
  reaches entry_point). Promote to --gate only once covers: is populated.
157
201
  ```
@@ -160,8 +204,13 @@ Do NOT enter MAP SCOPES until Orient is accepted.
160
204
 
161
205
  ## MAP SCOPES (step 8) — delegate to ba-pitch-analyzer (orient-informed)
162
206
 
207
+ ⟐ **Step 1 runs BEFORE the WIRE section above; step 2 runs after it.** The two
208
+ dispatches sit either side of L1a.5: ANALYZE writes the use cases WIRE reads, and MAP SCOPES slices
209
+ against the seams WIRE declared. Sequence: ORIENT → L1a → **ANALYZE** → **WIRE** → L1a.5 →
210
+ **MAP SCOPES** → L1b.
211
+
163
212
  ```
164
- Two orders, two workers, one step (both model: exec — see references/delegation.md):
213
+ Two orders, two workers, one step (both model: exec — see references/protocol.md):
165
214
  1. ANALYZE + BOARD — compile-order --operation analyze --slug <slug> --worker ba-pitch-analyzer
166
215
  --payload '{"pitch": "<path>", "lens": "<lens>", "orient_dir": ".shapeup/<slug>/orient/"}'
167
216
  dispatch: Skill(shapeup-sdlc-plugin:ba-pitch-analyzer) --order <path>. The order hands it
@@ -173,13 +222,13 @@ Two orders, two workers, one step (both model: exec — see references/delegatio
173
222
  2. MAP SCOPES — compile-order --operation map-scopes --slug <slug> --worker scope-architect
174
223
  dispatch: Skill(shapeup-sdlc-plugin:scope-architect) --order <path>. Sole writer of the
175
224
  committed scopes/<scope-id>.md contracts (import-graph slicing, substrate whitelists,
176
- affordance manifest, fixtures, PA1/PA2 — mechanically linted by spec-lint.mjs).
225
+ affordance manifest, fixtures, PA1/PA2 — mechanically linted by harness verify spec).
177
226
  Record in ledger: planner duration + task count + scope count.
178
227
  ```
179
228
  Faithful note: keep the planner ambitious on scope but high-level on tech — do not push it
180
229
  to over-specify implementation. Errors baked into the spec cascade into every build round.
181
230
  Honest deviation: `ba` is heavier than Shape Up's light "map scopes" bucketing — that extra
182
- upfront spec-traceability is a deliberate trade for an LLM builder (redesign doc D8), not
231
+ upfront spec-traceability is a deliberate trade for an LLM builder, not
183
232
  "pure Shape Up". State it; don't pretend otherwise.
184
233
 
185
234
  ---
@@ -203,7 +252,6 @@ v0.2.6 (non-regression).
203
252
  `.shapeup/<slug>/tasks/_index.md` missing AND `shapeup/<slug>/spec/usecases/`
204
253
  exists → a teammate (or a `--from build` resumed run) has the SHARED spec via git but no LOCAL
205
254
  task board on this machine — `.shapeup/` is gitignored and never travels with a branch.
206
- compile-order --operation generate-board --slug <slug> --worker ba-pitch-analyzer, then
207
255
  Agent (model: exec): Skill(shapeup-sdlc-plugin:ba-pitch-analyzer) --order <path> + ingest —
208
256
  regenerates the board from the committed usecases/domain-model/scopes. Record the bootstrap in
209
257
  the ledger. No-op on a fresh r=1 run (MAP SCOPES just wrote the board on this same machine) or
@@ -224,17 +272,27 @@ No scope contracts (pre-v0.3.0, unchanged from v0.2.6):
224
272
  - any SPIKE tasks (third-party feasibility) that block others
225
273
  - scope-summary "Done when" headline statements
226
274
 
227
- Substrate-disjointness assertion (design spec §5.1 Blueprint A, only when
275
+ Substrate-disjointness assertion (only when
228
276
  shapeup/<slug>/scopes/*.md exist — scope-architect's lint pass already ran;
229
277
  this is the orchestrator's own re-confirmation before committing to a build sequence):
230
- - Run `node "${CLAUDE_PLUGIN_ROOT}/skills/ba-pitch-analyzer/scripts/spec-lint.mjs" --slug <slug>`: DISJOINT (a file in two
278
+ - Run `node "${CLAUDE_PLUGIN_ROOT}/kernel/harness.mjs" verify spec --slug <slug>`: DISJOINT (a file in two
231
279
  scopes' `allowed_file_substrate` without BOTH declaring it `shared_substrate` — PA3
232
- waiting to happen), PA1 (directory-aligned scope), PA2 (size cap). Any red → HARD STOP,
233
- route a remap order to scope-architect before BUILD a human may have hand-approved
234
- past a 🔴 at the architect's own checkpoint.
280
+ waiting to happen), PA1 (directory-aligned scope), PA2 (size cap), SCOPE-ANCHOR (a scope
281
+ naming no committed use case, or one that does not resolve), TIER-DIRECTION (a committed
282
+ contract naming LOCAL task ids), SCOPE-DEPS (a build-order id naming a scope that is not
283
+ in this run). Any red → HARD STOP, past a 🔴 at the architect's own checkpoint.
235
284
  - Lock the build SEQUENCE riskiest-first: order scopes by open-unknowns count (from
236
285
  hill/<scope-id>.yml if present, else the orient hill signal), not by file count or
237
286
  alphabetical — Shape Up's "solve in the right sequence" (step 10).
287
+ DEPENDENCIES CONSTRAIN THAT ORDER, and each contract declares its own: scope A follows scope
288
+ B when A names B in `depends_on`. The order lives in the same committed tier as the contracts
289
+ it orders, so it survives a clone. Risk orders the scopes; the dependencies decide when each one is
290
+ RELEASED — a scope starts as soon as the scopes it consumes have settled, not when its whole
291
+ level has, so a scope may well start while a sibling is still building. A scope that consumes
292
+ the others' output (an entry point wiring up command modules) therefore cannot be scheduled
293
+ alongside them however low its unknowns count. It fails open: a contract declaring no
294
+ `depends_on`, or naming a scope that is not in this run, falls back to releasing a level at a
295
+ time, and then to no constraint at all (spec-lint SCOPE-DEPS reports the dangling id).
238
296
 
239
297
  Ask (max 2): scope cuts? lens correct? any SPIKE to resolve before build?
240
298
  Scope-hammer framing: reference the appetite from the pitch
@@ -247,27 +305,42 @@ Do NOT enter BUILD until the board is accepted.
247
305
 
248
306
  ---
249
307
 
308
+ ## GATE L2 — Board 100% Done (Pre-Eval)
309
+
310
+ **Purpose:** The single exit point from the BUILD loop into EVAL. It ensures every scope is green before invoking the evaluator.
311
+
312
+ **Output:**
313
+ ```
314
+ ⏸ GATE L2 — Board 100% ✅ + T0-green
315
+ Feature : [slug]
316
+ Round : [r]
317
+ Scopes : [N] green, [M] queued for hammer
318
+ ```
319
+
320
+ Under `--interactive` / `--auto`, the hook warns if the board is not truly green (advisory) and requires explicit PO approval to proceed. Under `--unattended`, it automatically aborts on a red board or proceeds on a green one.
321
+
322
+ ---
323
+
250
324
  ## GATE L3 — Verdict & Loop
251
325
 
252
326
  ```
253
327
  Render the 🗻 Hill report (slice-level) — NOT a task count. Scope contracts present → read
254
- committed hill/<scope-id>.yml shards (mechanical phases from GATE L2.4, DD-10). No contracts →
328
+ committed hill/<scope-id>.yml shards (mechanical phases from GATE L2, never authored). No contracts →
255
329
  fall back to the board + open-unknowns heuristic (uphill/crest/downhill/done). See
256
- references/ledger-schema.md "Hill report". Roadmap rule unchanged either way: progress is
330
+ references/protocol.md "Hill report". Roadmap rule unchanged either way: progress is
257
331
  reported by hill position, never by "N/M tasks done".
258
332
 
259
333
  Read EVAL-FEATURE-<slug>.md verdict.
260
334
 
261
335
  PASS:
262
336
  → first PASS of the run AND not --no-qa:
263
- delegate ▶ QA EDGE HUNT → Agent (model: qa — see references/delegation.md
337
+ delegate ▶ QA EDGE HUNT → Agent (model: qa — see references/protocol.md
264
338
  "Invocation mechanism"): Skill(shapeup-sdlc-plugin:qa-edge-hunter) (pure worker; see
265
339
  round-protocol "QA edge hunt"). Args: spec folder, EVAL report path, ledger path, app URL.
266
340
  Its GATE Q0/Q1 pauses surface here. Output: `~` findings → .shapeup/<slug>/discovery/ledger.md
267
341
  + .shapeup/<slug>/qa/hunt-report.md. No verdict — the run's verdict stays this EVAL's PASS.
268
342
  → then proceed to SHIP (triage of QA findings happens at SHIP S.0/GATE L4).
269
343
  → subsequent PASS (a promoted-findings fix round): Agent (model: qa):
270
- Skill(shapeup-sdlc-plugin:qa-edge-hunter) --recheck on the promoted items only, then SHIP.
271
344
  → --no-qa or skill absent: proceed straight to SHIP; ledger records `qa: skipped`.
272
345
 
273
346
  FAIL:
@@ -289,7 +362,7 @@ Decision : [SHIP | re-build bugs in round r+1 | escalate: max rounds hit]
289
362
  ```
290
363
  The Hill is the progress narrative; the board's `N/N ✅` is execution substrate (it gates
291
364
  EVAL at L2), never the headline. Slices come from `ba`'s board; if slice IDs aren't present
292
- yet (D3 deferred), report at task-group level and note the fallback in the ledger.
365
+ yet, report at task-group level and note the fallback in the ledger.
293
366
 
294
367
  ---
295
368
 
@@ -297,14 +370,14 @@ yet (D3 deferred), report at task-group level and note the fallback in the ledge
297
370
 
298
371
  ```
299
372
  S.0 GATE H — delegate to scope-hammer (this IS Shape Up's "Decide When to Stop", step 11):
300
- Invoke via Agent (model: exec — see references/delegation.md "Invocation mechanism"):
373
+ Invoke via Agent (model: exec — see references/protocol.md "Invocation mechanism"):
301
374
  Skill(shapeup-sdlc-plugin:scope-hammer) --slug <slug> --baseline <shaping/baseline.md if present>
302
375
  [--breaker outer] when round_budget hit 0 with scopes still open
303
376
  [--breaker inner --scope <id>] once per queued hammer proposal (attempt_budget
304
377
  exhausted scopes accumulated during BUILD)
305
378
  (no --breaker flag) normal stop — all scopes FINISHED, post-QA-hunt
306
379
  Feeds it: qa/hunt-report.md findings (when present), discovery/ledger.md open items,
307
- advisor-protocol budget-overflow flags, the hammer-proposal queue from BUILD.
380
+ the hammer-proposal queue from BUILD (attempt-budget exhaustions).
308
381
  Reads back: its GATE H0/H1/H2 output — census, baseline comparison, cut list + verdict.
309
382
  Authority: scope-hammer proposes; the tech lead records the PO's decision in
310
383
  round-ledger.md and performs the actual close (S.1 onward). It never ships on its own.
@@ -326,36 +399,54 @@ S.2 Print a feature summary: tasks shipped, rounds used, final verdict, dims ev
326
399
  (and explicitly: dims NOT evaluated, so "shipped" is never read as "verified for all").
327
400
  S.3 Point to the traceability: tasks/_index.md (all ✅) + EVAL-FEATURE-<slug>.md (PASS) +
328
401
  harness-run.md (the round ledger).
329
- S.4 task-executor's GATE E remains the formal per-task close; the tech lead confirms the
330
- feature-level close.
402
+ S.4 task-executor's own verification checklist remains the formal per-task close; the tech
403
+ lead confirms the feature-level close.
331
404
  S.5 Deploy truth — "done means deployed", honestly. Building stops at "built & verified";
332
405
  deployment is an outward-facing action gated to the PO. Either:
333
- - PO says yes → run the project deploy (docs/infra/DEPLOYMENT.md) and record "deployed".
406
+ - PO says yes → run the project's own deploy procedure and record "deployed".
334
407
  - otherwise → record "built & verified — deploy pending (PO)".
335
408
  NEVER auto-deploy; "shipped" must never silently mean "deployed".
336
- (Baseline-anchored scope-hammering at ship time is redesign-doc D5 — deferred; for now,
409
+ (Baseline-anchored scope-hammering at ship time is deliberately deferred; for now,
337
410
  `ba`'s Appetite Guard covers overflow and cuts go to synthesis "Hammered Out".)
338
- S.6 Harvest one signal row → append to `shapeup/metrics/<machine-id>.jsonl`
339
- (committed, SHARED root; sharded per machine so concurrent runs never merge-conflict on
340
- one file addendum Δ3; an aggregate view is `cat shapeup/metrics/*.jsonl`).
411
+ S.6 Harvest one signal row → append to `.shapeup/metrics/<machine-id>.jsonl`
412
+ (LOCAL root, gitignored since ADR-0001 a committed shard keyed on a hostname only
413
+ grows and publishes a machine name; sharded per machine so shards can be pooled
414
+ deliberately without colliding on one filename. The read plane is
415
+ `harness probe stats`, or `cat .shapeup/metrics/*.jsonl`).
341
416
  Copy fields that ALREADY exist as structured output (run-state, final EVAL report,
342
417
  discovery ledger, qa/hunt-report, breadboard B5). Two hard rules:
343
418
  1. Harvest only fields that already exist at ship time — never evaluate something new.
344
419
  2. Record facts, never compute a new verdict (no `run_quality_score` — that would be
345
420
  a second judge behind spec-evaluator). The eval suite interprets; harvest records.
346
421
  `final_audit_score` is COPIED from the EVAL report, never re-graded.
347
- ALSO copy the two v1.5 exit measurements, both produced by scripts at zero model tokens:
348
- node "${CLAUDE_PLUGIN_ROOT}/skills/tech-lead/scripts/stats.mjs" --ratchet --slug <slug>
422
+ ALSO copy two run-quality measurements, both produced by scripts at zero model tokens:
423
+ node "${CLAUDE_PLUGIN_ROOT}/kernel/harness.mjs" probe stats --ratchet --slug <slug>
349
424
  → `ratchet`: {trials, scopes_multi_trial, improvement_rate, monotone_rate,
350
425
  sawtooth_count, mean_trials_to_green}
351
- node "${CLAUDE_PLUGIN_ROOT}/skills/tech-lead/scripts/stats.mjs" --hooks
426
+ node "${CLAUDE_PLUGIN_ROOT}/kernel/harness.mjs" probe stats --hooks
352
427
  → `hooks`: {evaluations, denials, errors, per_hook}
353
- Harvest them HERE or lose them: both read LOCAL ledgers (t0/trials.jsonl,
354
- decisions.jsonl) under the gitignored `.shapeup/` root, so a number left there
355
- answers its question exactly once and is then wiped. The committed shard is the only
356
- record that accumulates across runs and across machines which is what both exit
357
- criteria require, since neither is meaningful from a single run.
358
- full field list + row template: references/ledger-schema.md "Harvest row".
428
+ Harvest them HERE or lose them: both read per-run working ledgers (t0/trials.jsonl,
429
+ decisions.jsonl) that the next run's bookkeeping supersedes, so a number left there
430
+ answers its question exactly once. The metrics shard is the one record that
431
+ accumulates across runs and neither measurement is meaningful from a single run.
432
+ ALSO copy `run_id` from `receipt.json`. It is the row's only link to the run trace
433
+ that produced it: every other field here is a count, and `feature_slug` groups runs
434
+ TOGETHER rather than apart. It is what joins this row to the S.7 export.
435
+ → full field list + row template: references/protocol.md "Harvest row".
436
+ S.7 Export the run's records → one keyed dataset, before the trace is superseded.
437
+ node "${CLAUDE_PLUGIN_ROOT}/kernel/harness.mjs" report export --slug <slug>
438
+ Same argument as S.6, applied to the records the harvest row does NOT carry: orders,
439
+ results, the agent-call journal, T0 verdicts, trial rows, criterion verdicts and this
440
+ run's hook decisions all live in the LOCAL tier, which is regenerable and gets wiped.
441
+ The export freezes them as fact tables under `.shapeup/exports/<run_id>/` (JSONL, one
442
+ object per line), keyed by run id so a second run of the same feature is a second
443
+ dataset rather than an overwrite. `--out <dir>` sends it somewhere durable instead.
444
+ It is READ-ONLY: it writes nothing into the trace, so it may be re-run at any time.
445
+ WHY IT IS NOT A HARVEST FIELD. Run economics — cost, wall clock, turns-to-first-write —
446
+ is DERIVED from this dataset (`harness probe stats --economics`), never copied into the metrics
447
+ shard, because that row's contract rejects clock fields on purpose (see
448
+ protocol.md "Rejected fields"). Preserving the trace keeps the figures available
449
+ without putting a velocity number in the signal feed.
359
450
  ```
360
451
 
361
452
  ---
@@ -372,7 +463,7 @@ Ledger : harness-run.md
372
463
  ```
373
464
  Question (max 1): "Anything to record before I close the run? (y/n) or provide feedback for the next sprint."
374
465
  On confirm:
375
- - If the PO provides substantive feedback (not just 'y' or empty) → automatically delegate via Agent (model: exec — see references/delegation.md "Invocation mechanism"): Skill(shapeup-sdlc-plugin:coach) with the provided feedback for RLHF. The coach runs its own GATE COACH-1 to have the PO categorize each rule, then files it under the responsible skill in `shapeup/knowledge-base/<skill>.md` (committed → team-shared). Coachable skills: `task-executor`, `ba-pitch-analyzer`, `qa-edge-hunter`; each reads its own file at the top of its next run. The tech lead does not categorize the feedback itself — that is the coach's gate, by design (no assumptions).
466
+ - If the PO provides substantive feedback (not just 'y' or empty) → automatically delegate via Agent (model: exec — see references/protocol.md "Invocation mechanism"): Skill(shapeup-sdlc-plugin:coach) with the provided feedback for RLHF. The coach runs its own GATE COACH-1 to have the PO categorize each rule, then files it under the responsible skill in `shapeup/knowledge-base/<skill>.md` (committed → team-shared). Coachable skills: `task-executor`, `ba-pitch-analyzer`, `qa-edge-hunter`; each reads its own file at the top of its next run. The tech lead does not categorize the feedback itself — that is the coach's gate, by design (no assumptions).
376
467
  - Then output → `✅ [slug] [shipped & deployed | built & verified, deploy pending] — [r] rounds, verdict PASS.`
377
468
 
378
469
  ---