@chenmk/superflow 0.4.0 → 0.5.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 (241) hide show
  1. package/INSTALL.en.md +54 -12
  2. package/INSTALL.md +59 -33
  3. package/README.md +178 -54
  4. package/README.zh-CN.md +156 -51
  5. package/assets/brand/managed-review-loop.png +0 -0
  6. package/assets/manifest.json +10 -5
  7. package/assets/scripts/superflow-coding-ready.mjs +135 -0
  8. package/assets/scripts/superflow-dependency-update-hook.sh +81 -8
  9. package/assets/scripts/superflow-document-audit.mjs +240 -0
  10. package/assets/scripts/superflow-environment-preflight.mjs +398 -0
  11. package/assets/scripts/superflow-hook-guard.sh +40 -1
  12. package/assets/scripts/superflow-managed-command-guard.py +309 -0
  13. package/assets/scripts/superflow-managed-executor-preflight.mjs +421 -0
  14. package/assets/scripts/superflow-managed-owner-verification.sh +117 -0
  15. package/assets/scripts/superflow-managed-work-check.mjs +287 -26
  16. package/assets/scripts/superflow-managed-work-guard.sh +6 -92
  17. package/assets/skills/superflow-clarify/SKILL.md +14 -0
  18. package/assets/skills/superflow-design/SKILL.md +38 -13
  19. package/assets/skills/superflow-docs/SKILL.md +93 -2
  20. package/assets/skills/superflow-pipeline/SKILL.md +167 -10
  21. package/assets/skills/superflow-pipeline/references/batch-prompt-template.md +17 -9
  22. package/assets/skills/superflow-pipeline/references/document-readiness.md +157 -0
  23. package/assets/skills/superflow-pipeline/references/document-templates.md +9 -5
  24. package/assets/skills/superflow-pipeline/references/feature-gated-workflow.md +14 -0
  25. package/assets/skills/superflow-pipeline/references/implementation-prompt-template.md +20 -11
  26. package/assets/skills/superflow-pipeline/references/managed-work.md +123 -15
  27. package/assets/skills/superflow-pipeline/references/orchestration.md +2 -2
  28. package/assets/skills/superflow-pipeline/references/p0-baseline-template.md +3 -2
  29. package/assets/skills/superflow-pipeline/references/quality-gate.md +7 -5
  30. package/assets/skills/superflow-pipeline/references/reviewer-checklist.md +7 -0
  31. package/assets/skills/superflow-pipeline/scripts/superflow-guard.sh +205 -9
  32. package/assets/skills/superflow-pipeline/scripts/superflow-handoff.sh +7 -4
  33. package/assets/skills/superflow-requirement-review/SKILL.md +178 -0
  34. package/assets/skills/superflow-requirement-review/agents/openai.yaml +4 -0
  35. package/assets/skills-en/superflow-clarify/SKILL.md +17 -0
  36. package/assets/skills-en/superflow-design/SKILL.md +31 -12
  37. package/assets/skills-en/superflow-docs/SKILL.md +99 -0
  38. package/assets/skills-en/superflow-pipeline/SKILL.md +163 -9
  39. package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +4 -0
  40. package/assets/skills-en/superflow-pipeline/references/document-readiness.md +125 -0
  41. package/assets/skills-en/superflow-pipeline/references/document-templates.md +10 -0
  42. package/assets/skills-en/superflow-pipeline/references/feature-gated-workflow.md +7 -0
  43. package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +7 -0
  44. package/assets/skills-en/superflow-pipeline/references/managed-work.md +160 -10
  45. package/assets/skills-en/superflow-pipeline/references/quality-gate.md +12 -0
  46. package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +7 -0
  47. package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +205 -9
  48. package/assets/skills-en/superflow-pipeline/scripts/superflow-handoff.sh +7 -4
  49. package/assets/skills-en/superflow-requirement-review/SKILL.md +99 -0
  50. package/assets/skills-en/superflow-requirement-review/agents/openai.yaml +4 -0
  51. package/dist/app/cli.js +64 -9
  52. package/dist/app/cli.js.map +1 -1
  53. package/dist/app/commands/change-guard.js +19 -2
  54. package/dist/app/commands/change-guard.js.map +1 -1
  55. package/dist/app/commands/check.js +107 -45
  56. package/dist/app/commands/check.js.map +1 -1
  57. package/dist/app/commands/docs.js +7 -3
  58. package/dist/app/commands/docs.js.map +1 -1
  59. package/dist/app/commands/doctor.js +174 -198
  60. package/dist/app/commands/doctor.js.map +1 -1
  61. package/dist/app/commands/eval.js +64 -0
  62. package/dist/app/commands/eval.js.map +1 -0
  63. package/dist/app/commands/implement.js +7 -3
  64. package/dist/app/commands/implement.js.map +1 -1
  65. package/dist/app/commands/init.js +12 -24
  66. package/dist/app/commands/init.js.map +1 -1
  67. package/dist/app/commands/mcp.js +167 -0
  68. package/dist/app/commands/mcp.js.map +1 -0
  69. package/dist/app/commands/pipeline.js +652 -18
  70. package/dist/app/commands/pipeline.js.map +1 -1
  71. package/dist/app/commands/requirement-review.js +6 -0
  72. package/dist/app/commands/requirement-review.js.map +1 -0
  73. package/dist/app/commands/status.js +66 -3
  74. package/dist/app/commands/status.js.map +1 -1
  75. package/dist/app/commands/uninstall.js +3 -3
  76. package/dist/app/commands/uninstall.js.map +1 -1
  77. package/dist/app/commands/update.js +83 -9
  78. package/dist/app/commands/update.js.map +1 -1
  79. package/dist/domains/agent.js +3 -11
  80. package/dist/domains/agent.js.map +1 -1
  81. package/dist/domains/config/cli-help.js +54 -12
  82. package/dist/domains/config/cli-help.js.map +1 -1
  83. package/dist/domains/config/i18n.js +6 -8
  84. package/dist/domains/config/i18n.js.map +1 -1
  85. package/dist/domains/config/manifest.js +0 -3
  86. package/dist/domains/config/manifest.js.map +1 -1
  87. package/dist/domains/deps.js +68 -7
  88. package/dist/domains/deps.js.map +1 -1
  89. package/dist/domains/managed-work/completion-policy.js +174 -0
  90. package/dist/domains/managed-work/completion-policy.js.map +1 -0
  91. package/dist/domains/managed-work/context-manifest.js +208 -0
  92. package/dist/domains/managed-work/context-manifest.js.map +1 -0
  93. package/dist/domains/managed-work/contract.js +135 -4
  94. package/dist/domains/managed-work/contract.js.map +1 -1
  95. package/dist/domains/managed-work/control-signals.js +34 -0
  96. package/dist/domains/managed-work/control-signals.js.map +1 -0
  97. package/dist/domains/managed-work/control.js +628 -0
  98. package/dist/domains/managed-work/control.js.map +1 -0
  99. package/dist/domains/managed-work/evaluation.js +497 -0
  100. package/dist/domains/managed-work/evaluation.js.map +1 -0
  101. package/dist/domains/managed-work/evidence-path.js +14 -0
  102. package/dist/domains/managed-work/evidence-path.js.map +1 -0
  103. package/dist/domains/managed-work/execution-contract.js +167 -0
  104. package/dist/domains/managed-work/execution-contract.js.map +1 -0
  105. package/dist/domains/managed-work/executor-policy.js +65 -0
  106. package/dist/domains/managed-work/executor-policy.js.map +1 -0
  107. package/dist/domains/managed-work/failure.js +65 -0
  108. package/dist/domains/managed-work/failure.js.map +1 -0
  109. package/dist/domains/managed-work/host-review.js +77 -0
  110. package/dist/domains/managed-work/host-review.js.map +1 -0
  111. package/dist/domains/managed-work/human-messages.js +31 -0
  112. package/dist/domains/managed-work/human-messages.js.map +1 -0
  113. package/dist/domains/managed-work/input.js +29 -3
  114. package/dist/domains/managed-work/input.js.map +1 -1
  115. package/dist/domains/managed-work/journal.js +77 -3
  116. package/dist/domains/managed-work/journal.js.map +1 -1
  117. package/dist/domains/managed-work/lock.js +67 -1
  118. package/dist/domains/managed-work/lock.js.map +1 -1
  119. package/dist/domains/managed-work/notifications.js +0 -15
  120. package/dist/domains/managed-work/notifications.js.map +1 -1
  121. package/dist/domains/managed-work/pair-admission.js +108 -0
  122. package/dist/domains/managed-work/pair-admission.js.map +1 -0
  123. package/dist/domains/managed-work/prompts.js +257 -22
  124. package/dist/domains/managed-work/prompts.js.map +1 -1
  125. package/dist/domains/managed-work/redaction.js +90 -0
  126. package/dist/domains/managed-work/redaction.js.map +1 -0
  127. package/dist/domains/managed-work/review-convergence.js +41 -0
  128. package/dist/domains/managed-work/review-convergence.js.map +1 -0
  129. package/dist/domains/managed-work/review-facts.js +181 -0
  130. package/dist/domains/managed-work/review-facts.js.map +1 -0
  131. package/dist/domains/managed-work/rule-selection.js +84 -0
  132. package/dist/domains/managed-work/rule-selection.js.map +1 -0
  133. package/dist/domains/managed-work/runner.js +1967 -175
  134. package/dist/domains/managed-work/runner.js.map +1 -1
  135. package/dist/domains/managed-work/schemas.js +72 -2
  136. package/dist/domains/managed-work/schemas.js.map +1 -1
  137. package/dist/domains/managed-work/service.js +82 -13
  138. package/dist/domains/managed-work/service.js.map +1 -1
  139. package/dist/domains/managed-work/state.js +195 -5
  140. package/dist/domains/managed-work/state.js.map +1 -1
  141. package/dist/domains/managed-work/storage.js +66 -24
  142. package/dist/domains/managed-work/storage.js.map +1 -1
  143. package/dist/domains/managed-work/types.js +12 -9
  144. package/dist/domains/managed-work/types.js.map +1 -1
  145. package/dist/domains/managed-work/verification-categories.js +39 -0
  146. package/dist/domains/managed-work/verification-categories.js.map +1 -0
  147. package/dist/domains/managed-work/verification-policy.js +116 -0
  148. package/dist/domains/managed-work/verification-policy.js.map +1 -0
  149. package/dist/domains/managed-work/wait.js +21 -3
  150. package/dist/domains/managed-work/wait.js.map +1 -1
  151. package/dist/domains/managed-work/workspace-binding.js +133 -0
  152. package/dist/domains/managed-work/workspace-binding.js.map +1 -0
  153. package/dist/domains/sdd-readiness.js +44 -0
  154. package/dist/domains/sdd-readiness.js.map +1 -0
  155. package/dist/domains/skill/deploy.js +0 -6
  156. package/dist/domains/skill/deploy.js.map +1 -1
  157. package/dist/domains/skill/scripts.js +0 -8
  158. package/dist/domains/skill/scripts.js.map +1 -1
  159. package/dist/domains/state.js +1 -2
  160. package/dist/domains/state.js.map +1 -1
  161. package/dist/mcp/runtime-identity.js +21 -0
  162. package/dist/mcp/runtime-identity.js.map +1 -0
  163. package/dist/mcp/server.js +369 -0
  164. package/dist/mcp/server.js.map +1 -0
  165. package/dist/platform/agent-process.js +499 -38
  166. package/dist/platform/agent-process.js.map +1 -1
  167. package/dist/platform/executable.js +28 -0
  168. package/dist/platform/executable.js.map +1 -0
  169. package/dist/platform/paths.js +1 -17
  170. package/dist/platform/paths.js.map +1 -1
  171. package/dist/platform/process-tree.js +44 -0
  172. package/dist/platform/process-tree.js.map +1 -0
  173. package/dist/platform/process.js +1 -1
  174. package/dist/platform/process.js.map +1 -1
  175. package/package.json +16 -7
  176. package/scripts/check-design-principles.mjs +107 -0
  177. package/scripts/check-managed-work-design.mjs +507 -0
  178. package/scripts/clean-dist.js +9 -0
  179. package/scripts/ensure-bin-modes.js +11 -0
  180. package/dist/cli/index.js +0 -193
  181. package/dist/cli/index.js.map +0 -1
  182. package/dist/commands/archive.js +0 -6
  183. package/dist/commands/archive.js.map +0 -1
  184. package/dist/commands/clarify.js +0 -6
  185. package/dist/commands/clarify.js.map +0 -1
  186. package/dist/commands/design.js +0 -28
  187. package/dist/commands/design.js.map +0 -1
  188. package/dist/commands/docs.js +0 -6
  189. package/dist/commands/docs.js.map +0 -1
  190. package/dist/commands/doctor.js +0 -494
  191. package/dist/commands/doctor.js.map +0 -1
  192. package/dist/commands/implement.js +0 -6
  193. package/dist/commands/implement.js.map +0 -1
  194. package/dist/commands/init.js +0 -520
  195. package/dist/commands/init.js.map +0 -1
  196. package/dist/commands/pipeline.js +0 -6
  197. package/dist/commands/pipeline.js.map +0 -1
  198. package/dist/commands/scan.js +0 -63
  199. package/dist/commands/scan.js.map +0 -1
  200. package/dist/commands/status.js +0 -173
  201. package/dist/commands/status.js.map +0 -1
  202. package/dist/commands/uninstall.js +0 -214
  203. package/dist/commands/uninstall.js.map +0 -1
  204. package/dist/commands/update.js +0 -193
  205. package/dist/commands/update.js.map +0 -1
  206. package/dist/commands/verify.js +0 -6
  207. package/dist/commands/verify.js.map +0 -1
  208. package/dist/core/assets.js +0 -27
  209. package/dist/core/assets.js.map +0 -1
  210. package/dist/core/cli-help.js +0 -98
  211. package/dist/core/cli-help.js.map +0 -1
  212. package/dist/core/context.js +0 -123
  213. package/dist/core/context.js.map +0 -1
  214. package/dist/core/dependencies.js +0 -146
  215. package/dist/core/dependencies.js.map +0 -1
  216. package/dist/core/detect.js +0 -64
  217. package/dist/core/detect.js.map +0 -1
  218. package/dist/core/i18n.js +0 -105
  219. package/dist/core/i18n.js.map +0 -1
  220. package/dist/core/integrity.js +0 -46
  221. package/dist/core/integrity.js.map +0 -1
  222. package/dist/core/manifest.js +0 -21
  223. package/dist/core/manifest.js.map +0 -1
  224. package/dist/core/prompts.js +0 -20
  225. package/dist/core/prompts.js.map +0 -1
  226. package/dist/core/registry.js +0 -134
  227. package/dist/core/registry.js.map +0 -1
  228. package/dist/core/rules.js +0 -17
  229. package/dist/core/rules.js.map +0 -1
  230. package/dist/core/scripts.js +0 -48
  231. package/dist/core/scripts.js.map +0 -1
  232. package/dist/core/skill-check.js +0 -32
  233. package/dist/core/skill-check.js.map +0 -1
  234. package/dist/core/skills.js +0 -62
  235. package/dist/core/skills.js.map +0 -1
  236. package/dist/core/state.js +0 -54
  237. package/dist/core/state.js.map +0 -1
  238. package/dist/utils/path.js +0 -11
  239. package/dist/utils/path.js.map +0 -1
  240. package/dist/utils/shell.js +0 -29
  241. package/dist/utils/shell.js.map +0 -1
@@ -64,12 +64,29 @@ For complex requirements, verify these before writing docs:
64
64
  checks when source is insufficient. Graph output or chat explanation alone is
65
65
  not sufficient. If this evidence is missing and the relationship affects
66
66
  design, stop and return to `$superflow-clarify`.
67
+ - For full-workflow existing-system changes, `source-code-audit.md` must contain
68
+ the source fact freeze card, current/legacy/unmounted/data-model-only/
69
+ owner-confirmed/blocked classifications, all writers and real callers, DB
70
+ evidence or a skip reason, and the owner decision boundary. `List`,
71
+ `orderIds`, `batchInsert`, or one-to-many schema signals that conflict with a
72
+ single-item real entry require an explicit conflict audit. Missing evidence
73
+ blocks docs even when understand-anything contains a plausible summary.
67
74
  - For any database-backed design, the docs include table-to-code reverse impact
68
75
  evidence: every affected table/field, all writers/readers/filters, sibling
69
76
  repo or third-party consumers, real user-facing endpoints, reverse-state
70
77
  scenarios, and validation cases. If the docs only describe the write/sync
71
78
  path and do not prove consumers, stop and return to `$superflow-clarify`. Use
72
79
  `$superflow-table-impact-analysis` when available.
80
+ - For any schema, index, constraint, seed-data, or historical-data change,
81
+ docs MUST create `release-sql.md` before `$superflow-design` or implementation
82
+ prompts. It contains exactly one complete executable `sql` block and front
83
+ matter with `database_change: true`, an exact `target_sql_path`,
84
+ `copy_policy: verbatim`, and the normalized payload `sql_sha256`. Freeze all
85
+ prechecks, DDL/DML, post-verification, defaults, constraints, indexes, and
86
+ migration semantics here. `design.md`, `tasks.md`, and
87
+ `sdd-quality-gate.md` must reference it and prohibit implementation agents
88
+ from editing the SQL. Placeholder paths, missing hashes, SQL fragments, or
89
+ deferred SQL design block docs completion.
73
90
  - For any status, enum, sync, derived, default, or compatibility behavior, the
74
91
  docs include business semantic evidence:
75
92
  `Source field | Source enum | Target field | Target enum | Consumer meaning | Business basis | Unknowns`.
@@ -103,6 +120,13 @@ For complex requirements, verify these before writing docs:
103
120
  chain, no-fallback/no-guessing boundary, and pre-coding agent self-check. If
104
121
  any gate is missing from `design.md`, `tests.md`, or quality gate, stop and
105
122
  complete the docs first.
123
+ - Low-freedom means the Executor has no unresolved implementation or test-design
124
+ choice. `design.md` names reusable modules, exact change points, call/data flow,
125
+ transaction and concurrency boundaries, error behavior, and implementation
126
+ order. `tests.md` names environment, fixtures, startup command, steps,
127
+ automation command, response/DB/log assertions, cleanup, and evidence paths.
128
+ If two materially different implementations or acceptance paths remain valid,
129
+ return to clarification/design instead of delegating the choice to development.
106
130
  - For full workflow changes, `design.md` must include a `Minimal Design Review`
107
131
  before docs freeze. Inventory every proposed table, field, API,
108
132
  service/component, cache, async/MQ/event flow, scheduled job, compatibility
@@ -114,6 +138,34 @@ For complex requirements, verify these before writing docs:
114
138
  `BLOCKED`; only `PASS` may leave docs/design. Missing reuse evidence, parallel APIs/models, redundant persisted
115
139
  fields, speculative cache/async/compensation, or an unresolved simpler option
116
140
  blocks docs completion.
141
+ - After a reviewable full-workflow contract draft exists, run
142
+ `$superflow-requirement-review` before docs guard completion. It must create
143
+ `requirement-review.md`, repair canonical documents for every confirmed
144
+ `BLOCKER/IMPORTANT` finding, and re-review from source evidence. Record its
145
+ verdict and unresolved findings in `sdd-quality-gate.md` and `test-report.md`.
146
+ Source-resolvable unknowns must be investigated, owner decisions must return to
147
+ clarification, and implementation-affecting external contracts must be evidenced and frozen.
148
+ Merely documenting or assigning a blocker does not close it. A missing report, non-READY
149
+ implementation verdict, or nonzero blocker count prevents transition to design.
150
+ - Before developer handoff, a full workflow records three independent reviews
151
+ against the current handoff hash in `.sdd/reviews/document-review.json`:
152
+ `source-contract`, `architecture-minimality`, and `e2e-environment`.
153
+ Resolve discoverable gaps autonomously and ask owner-only blockers once at the end.
154
+ - Explore the declared local/dev/test configuration before handoff and record
155
+ fail-safe probes in `.sdd/readiness/environment.json`. Its v2
156
+ `executionContract` uniquely freezes the application location, dependency
157
+ policy, config sources, and allowed/forbidden overrides. Tests use verified
158
+ startup commands, ports, simulators, and dependencies; reachability alone is
159
+ not an environment contract and discovery is not deferred to the developer.
160
+ - Cross-repo, cross-service, device, MQ, callback, state-machine, or three-plus
161
+ module logic includes Mermaid `sequenceDiagram` and `flowchart`/`stateDiagram`.
162
+ - Run `superflow check <change> --level coding-ready` after prompts are complete.
163
+ A failed implement gate is fixed by the docs workflow, never delegated to the
164
+ developer Agent.
165
+ - When an upstream caller receives an explicit failure and owns refund/cancel
166
+ compensation, default to fail-fast, fail-closed, at-most-once, and
167
+ caller-owned compensation. Transparent retry/reroute/resend requires owner
168
+ approval in the cross-system failure ownership boundary.
117
169
  - `design.md` stays the OpenSpec/SDD design contract: requirement mapping,
118
170
  API/DB/field semantics, source facts, real-entry call chain, no-fallback
119
171
  boundary, risks, and acceptance hooks. It must not try to own all source-level
@@ -174,12 +226,20 @@ applicable:
174
226
  - `specs/<capability>/spec.md`
175
227
  - `design.md`
176
228
  - `tasks.md`
229
+ - Every `tasks.md` checkbox must carry exactly one machine category:
230
+ `[local_required]`, `[environment_required]`, or `[release_required]`.
231
+ Locally executable code, tests, startup, and browser checks are local_required;
232
+ free-form Blocker/owner prose cannot replace the category.
177
233
  - `tests.md`
178
234
  - `test-report.md` skeleton
179
235
  - `sdd-quality-gate.md`
180
236
  - `traceability-matrix.md` when tasks are split
181
237
  - `mock.md` when external dependencies exist
182
238
  - `review-checklist.md` when implementation will be split
239
+ - `requirement-review.md` for full-workflow changes before docs completion
240
+ - `source-code-audit.md` for full existing-system, DB, cross-repo, or real-entry changes
241
+ - `release-sql.md` for every database change; omit it only when the docs prove
242
+ that no schema/data migration is required
183
243
  - `.sdd/state.yaml`
184
244
  - `.sdd/handoff/sdd-context.md`
185
245
  - `.sdd/handoff/sdd-context.json`
@@ -298,6 +358,25 @@ Use references only as needed:
298
358
  `Case ID | Requirement/scenario | Level L1/L2/L3/L4 | Precondition data | Steps |
299
359
  Automation command | Response assertion | DB assertion | Log assertion | RED expected failure | GREEN expected pass |
300
360
  test-report evidence location`.
361
+ - For L3/L4 input validation, protocol rejection, and exceptional branches,
362
+ `tests.md` also freezes the real injected payload and evidence that it reaches
363
+ the intended parser or validation branch; matching the same HTTP status alone
364
+ is not coverage. Raw malformed JSON, wrong Content-Type, unauthorized identity,
365
+ and invalid fields must be sent on the real wire protocol and assert no side effect.
366
+ - When a task adds or copies an owner/cleanup primitive for local processes,
367
+ containers, or temporary resources, `design.md`, `tests.md`, and
368
+ `test-report.md` freeze resource identity fields, producer/consumer equality
369
+ relations, and refusal-to-clean tests for every mismatch (for example nonce,
370
+ PID, port, and process signature). When reusing an unchanged certified owner
371
+ helper, record only its integrity, task parameters, one failure cleanup, and
372
+ final zero residue; do not repeat framework certification.
373
+ - When a design uses a version field for optimistic locking, `design.md` freezes
374
+ the database-level atomic compare-and-set boundary, conflict response, and
375
+ zero-row distinction between missing data and stale version. A read-then-write
376
+ check alone is blocked. `tests.md` includes two concurrent requests holding
377
+ the same old version and asserts exactly one success, one conflict, and one
378
+ version increment. The implementation prompt only inherits these frozen case
379
+ IDs and commands; managed orchestration never invents the business design.
301
380
  - Each visible UI field, button action, list column, dropdown, and enum must map to API/DTO/DB/tests or be explicitly out of scope.
302
381
  - Every spec scenario must have at least one test case.
303
382
  - Every implementation batch must have at least one test that can fail before
@@ -331,6 +410,26 @@ Use references only as needed:
331
410
  `RED failure evidence`, `GREEN pass evidence`, `interface automation evidence`, `DB evidence`,
332
411
  `log evidence`, `manual/blocking cases`, and `Partially verified boundary`.
333
412
  Each section must reference concrete `tests.md` case IDs.
413
+ - `tests.md` freezes runtime-specific acceptance instead of leaving it to
414
+ managed orchestration:
415
+ - Spring Boot/backend services: verified startup command, dynamic or planned
416
+ isolated port, readiness condition, at least one real HTTP invocation, and
417
+ failure evidence when the environment blocks startup.
418
+ - `.vue/.tsx/.jsx`, frontend API registration, page permission, or visible UI
419
+ behavior: frontend startup plus real-browser Playwright/Cypress cases and
420
+ page assertions; build, static inspection, and mocks are supplementary only.
421
+ - Controller/API DTO plus frontend request changes: backend Controller contract,
422
+ frontend request contract, and dynamic API export/call-resolution snapshot
423
+ when applicable.
424
+ - Named runtime backends such as MySQL, Testcontainers, a real browser, or a
425
+ real service: exact backend and command; H2, mocks, stubs, in-memory stores,
426
+ and compatibility modes never close the named gate.
427
+ - Multi-repository/service changes: build/runtime checks for every affected
428
+ repository plus the real cross-repository path; one repository's evidence
429
+ never substitutes for another.
430
+ `design.md` records why each runtime and repository is in scope; `tasks.md`
431
+ classifies local, environment, and release work; the implementation prompt
432
+ inherits the exact case IDs, commands, assertions, and evidence paths.
334
433
  - For money-related changes, `test-report.md` must also include `Money Precision
335
434
  Boundary` evidence: original calculation inputs and precision, actual rounding
336
435
  boundary and mode, half-cent/residual/multi-detail cases, and reconciliation
@@ -5,6 +5,13 @@ description: Use when a user asks for the SuperBridge Flow, SDD, OpenSpec, requi
5
5
 
6
6
  # SuperBridge Flow Pipeline
7
7
 
8
+ When maintaining Superflow CLI itself, first read repository-root
9
+ `docs/superflow-cli-design-principles.en.md` and
10
+ `docs/superflow-cli-evaluation-framework.en.md`; managed-work changes also read
11
+ the managed constitution and protocol. Identify the owner layer before editing,
12
+ then record baseline, hypothesis, scenario, result, and rollback condition under
13
+ the unified evaluation framework.
14
+
8
15
  ## Role
9
16
 
10
17
  This is the main router and stateful workflow orchestrator for SuperBridge Flow.
@@ -21,35 +28,93 @@ other:
21
28
 
22
29
  ## Managed Work And Dual-Agent Closure
23
30
 
31
+ When the Superflow MCP is installed for the host Agent, prefer
32
+ `superflow_managed_start/status/wait/message/submit_review` instead of manually
33
+ spawning `superflow pipeline` from chat. MCP tasks are always `external_host`:
34
+ the current host keeps the user conversation and reviews directly, while the
35
+ background service starts only the peer executor. Never spawn a nested
36
+ supervisor CLI. Wait with `superflow_managed_wait` locally instead of spending
37
+ model turns on periodic status checks. Use the CLI equivalent below only when
38
+ MCP is unavailable.
39
+ Call `superflow_managed_runtime` before task creation. If its fingerprint is
40
+ stale, require a Host restart and never start a new validation task through the
41
+ pre-install MCP process.
42
+
24
43
  When the user says to use Superflow for managed delivery and provides an
25
44
  implementation prompt, change directory, or direct task, use built-in managed
26
45
  mode. Do not require the user to name `superflow-pipeline`, roles, or CLI flags:
27
46
 
47
+ Before start, perform one Host semantic routing step. Docs-only requests stop
48
+ after autonomous document review and Coding Ready without a managed Task. A
49
+ user-approved change/prompt is frozen from its original path. Only a bounded
50
+ verbal request enters minimal or standard directly. Direction-changing API,
51
+ data, concurrency, cross-repository, or owner choices return to
52
+ clarification/documents; Runner regexes and Executor improvisation do not decide them.
53
+
28
54
  ```bash
29
55
  superflow pipeline "<implementation prompt, change directory, or direct task>" --managed --project "<project root>" \
30
- --supervisor codex --executor claude --language en
56
+ --supervisor current --executor peer --language en
31
57
  ```
32
58
 
33
- Swap the roles when Claude is the current entry agent. The command always uses
34
- the independent background service while following the local task journal to a
35
- terminal state, then the current agent reads the report and summarizes in the
36
- same conversation. Losing the follower does not stop the task. Read
37
- `references/managed-work.md` before dispatch. Do not spawn the peer CLI by hand.
59
+ `current/peer` resolves the host automatically: a Codex host drives Claude and a
60
+ Claude host drives Codex. Ambiguous environments fail closed and require explicit
61
+ roles. The background service
62
+ invokes only the executor; the current host agent performs the read-only review
63
+ without spawning another copy of itself. After executor delivery, read
64
+ `host-review-N.md`, write the structured review JSON, then resume with
65
+ `--resume-task <task-id> --submit-host-review <json>`. Losing the follower does
66
+ not stop the task. Read `references/managed-work.md` before dispatch.
67
+
68
+ Managed delivery uses the lower-cost executor for implementation and validation;
69
+ the more expensive host only freezes the goal, supervises, and reviews delivery
70
+ quality. The host must not code, build, start, test, or manage executor processes.
71
+ When the task reaches `external_supervisor_review_required`, review, submit, and
72
+ resume automatically in the same turn; it must not stop and wait for manual user handoff.
73
+ Only an owner decision, unavailable external authority, or final Git approval may
74
+ interrupt the user.
38
75
 
39
76
  Hard gates:
40
77
 
41
- - Persist one supervisor session and one executor session per task; resume exact IDs.
78
+ - Use a fresh short session for every execution and repair call. Hand off through
79
+ the current workspace, frozen prompt, persisted result, and findings; keep old
80
+ session IDs only for audit and never resume a long session indefinitely.
81
+ - The first invocation must receive the frozen task prompt automatically. Every
82
+ later invocation must first receive and read a condensed handoff containing at
83
+ least the prompt path/hash, task progress, local pending work, external
84
+ prerequisites, all current findings, diff stat, and recent report. Old and new
85
+ sessions both treat the handoff and current workspace as authoritative.
86
+ - In `external_host` mode the current agent reviews; the service must not spawn a
87
+ nested Codex or Claude CLI for the supervisor role.
88
+ - Host conversation and review do not count as background Agent invocations;
89
+ only real executor calls consume the execution budget.
42
90
  - Task contract, event journal, review results, and evidence are authoritative.
43
91
  - Maximum 5 reviews, 7 executor calls, and 12 total agent calls.
44
92
  - Revalidate the frozen contract and hard limits on every start or resume. Engineering work cannot enter review with only one verification category.
45
93
  - Resolve a change directory through `.sdd/state.yaml` `implementation_prompt`, reject `tasks.md` as an execution entry, and freeze one prompt snapshot plus SHA-256 for both agents.
46
94
  - Supervisor is read-only; executor cannot edit `.superflow/tasks` or commit/push/publish.
47
- - A passing run stops at `awaiting_git_approval`; Git requires the user's approval.
48
- - Use `superflow status <project-root>` instead of model polling.
95
+ - Frozen requirements, designs, prompts, handoffs, rules, and task facts are
96
+ immutable protected inputs. Tasks and test reports are retained progress
97
+ evidence that may be updated but not deleted. Executor cleans runtime and
98
+ workspace-temporary resources and keeps delivery artifacts and protected
99
+ contracts for Host review.
100
+ - Never use pkill, killall, a bare kill, port/name-only cleanup, or rm -rf
101
+ without owner-helper verification. Native hooks block before mutation and
102
+ preflight/final gates verify every Host.
103
+ - A passing run enters `environment_validation_blocked`, `local_delivery_ready`, or `release_ready`; Git always requires user approval.
104
+ - Default MCP waits to a 240-second Host-compatible transport window. On window
105
+ expiry, immediately continue only from returned `latestSequence`; do not call
106
+ status, read full events, or restart Executor. Hosts with longer tool limits may
107
+ explicitly request up to twelve hours; semantic supervision runs only for attention.
108
+ - When the user names a task-prompt document, pass its original path to start and verify the frozen SHA-256; never replace it with a host summary.
109
+ - Page/permission changes require frontend startup and real-browser E2E; cross-stack API changes require both backend and frontend contract tests.
49
110
  - `superflow-managed-work-check.mjs` must pass before delivery-ready status.
50
111
  - Record the single delivery-ready event only after the integrity script passes.
51
112
  - After the managed command returns a terminal state, read the task report and summarize it to the user instead of returning only a task ID.
52
113
  - Freeze the selected language into the task contract. Executor and reviewer prompts, resumed rounds, journals, reports, notifications, and errors must inherit that language without switching mid-run.
114
+ - Claude Executor long sessions use early auto-compaction by default, while
115
+ explicit user environment values win. Reload the frozen prompt and handoff after
116
+ compaction. Final `result.usage` is authoritative; a large value alone does not
117
+ prove Runner double counting.
53
118
 
54
119
  ## Phase Order
55
120
 
@@ -59,6 +124,10 @@ hotfix:
59
124
  1. clarify: ingest requirements one feature at a time, freeze scope, and produce
60
125
  source-ingestion, feature gates, inventory, UI/API gaps, and freeze review.
61
126
  2. docs: generate OpenSpec/SDD contract artifacts and the first handoff package.
127
+ Before closing docs, run source-backed requirement review, repair blocking
128
+ findings, resolve all source investigations, owner decisions, and implementation-affecting
129
+ external contracts, then record `requirement-review.md`. Naming or assigning a blocker does
130
+ not close it.
62
131
  3. design: let Superpowers produce source-level technical design from the frozen
63
132
  contract and codebase evidence.
64
133
  4. implement: generate implementation prompts, execution plans, worktree/port
@@ -75,6 +144,8 @@ hotfix:
75
144
  use `superflow-clarify` in embedded deep-clarification mode. This is a mode
76
145
  inside the normal clarify phase, not a separate command the user must remember.
77
146
  - New or unclear requirement: use superflow-clarify.
147
+ - Requirement review, reverse review, omission search, design challenge,
148
+ testability review, or over-design review: use superflow-requirement-review.
78
149
  - Confirmed requirement needing full docs: use openspec-propose, then
79
150
  superflow-docs.
80
151
  - Contract docs exist and code-level HOW is needed: use superflow-design.
@@ -111,6 +182,23 @@ When the router selects embedded deep clarification, follow these rules inside
111
182
 
112
183
  ## Required Artifacts
113
184
 
185
+ ### Source Fact Freeze And Question Eligibility (Blocking)
186
+
187
+ - When a full workflow involves existing behavior, DB/table relationships,
188
+ cross-repository impact, or a real entry, docs must include
189
+ `source-code-audit.md` with: `Business conclusion | understand-anything
190
+ locator | Data model | All writers | Real user entry | Current callers |
191
+ Legacy conflict | DB check required | Conclusion level | owner decision`.
192
+ - understand-anything is a locator, not the final source of truth. Classify
193
+ evidence as `current`, `legacy`, `unmounted`, `data-model-only`,
194
+ `owner-confirmed`, or `blocked`.
195
+ - If `List`, `orderIds`, `batchInsert`, or a one-to-many model conflicts with a
196
+ single-item real entry, complete a Conflict Audit instead of inferring current
197
+ product behavior from the data structure.
198
+ - Before asking the user, search source, Mapper/SQL, frontend/mini-program/H5
199
+ callers, sibling repositories, and read-only DB data when needed. Do not turn
200
+ repository-verifiable facts into clarification questions.
201
+
114
202
  ### Canonical OpenSpec Change Directory (Blocking)
115
203
 
116
204
  - Superflow must use the OpenSpec CLI single-level layout:
@@ -139,6 +227,7 @@ For a full change, the docs phase must create or refresh:
139
227
  - review-checklist.md
140
228
  - sdd-quality-gate.md
141
229
  - test-report.md
230
+ - source-code-audit.md when the source fact gate is triggered
142
231
  - .sdd/state.yaml
143
232
  - .sdd/handoff/sdd-context.md
144
233
  - .sdd/handoff/sdd-context.json
@@ -172,6 +261,58 @@ Rules:
172
261
 
173
262
  ## Decision Points
174
263
 
264
+ ## Autonomous Document Delivery Closure
265
+
266
+ A full-workflow docs Agent must not equate a successful keyword/file guard with
267
+ 100% implementation readiness. Before developer handoff, record at least three
268
+ independent review lenses against the same current handoff hash in
269
+ `.sdd/reviews/document-review.json`:
270
+
271
+ 1. `source-contract`: source, cross-repo callers, contracts, and real entries;
272
+ 2. `architecture-minimality`: ownership, reuse, simplest design, failure owner,
273
+ and overdesign;
274
+ 3. `e2e-environment`: startup order, configured environment, simulators,
275
+ automation, DB/log assertions, and cleanup.
276
+
277
+ The Agent resolves every source/config/log/probe-discoverable gap itself. Only
278
+ business-owner decisions, unavailable credentials/authority, or external
279
+ resources may remain in `openOwnerDecisions`, and they are asked as one final
280
+ batch. Open findings mean `BLOCKED_FOR_OWNER_BATCH`, never 100%.
281
+
282
+ Explore the configured environment during docs and record
283
+ `.sdd/readiness/environment.json`. Only fail-safe `file`, `directory`,
284
+ `executable`, `tcp`, and `http` probes are allowed. Never print credentials or
285
+ write production data. Respect the declared local/dev/test scope instead of
286
+ requiring a remote environment by default. Use
287
+ `superflow.environment-readiness.v2` to freeze the application location,
288
+ `local-isolated/shared-dev/shared-test/mixed` dependency policy, config sources,
289
+ allowed/forbidden overrides, and a `contractRef` for every probe. Reachability
290
+ alone is not an environment execution contract.
291
+
292
+ Cross-service, cross-repo, device, MQ, callback, scheduler, state-machine,
293
+ compensation, or three-plus-module logic declares `complex_logic: true` or
294
+ `mermaid: required` in `.openspec.yaml` and includes both a Mermaid
295
+ `sequenceDiagram` and a `flowchart`/`stateDiagram` showing failure exits,
296
+ compensation owner, and forbidden fallback.
297
+
298
+ Run `superflow check <change> --level coding-ready` after all prompts are ready.
299
+ It validates YAML, OpenSpec, docs/design/implement, every prompt and exact link,
300
+ review receipts, environment probes, and Mermaid diagrams, then writes a receipt
301
+ bound to the current handoff hash. Never delegate a failed implement gate to the
302
+ developer Agent.
303
+
304
+ ## Cross-System Failure Ownership And Compensation Boundary
305
+
306
+ Record `Failure signal | Interpreter | Compensation owner | Retry allowed? |
307
+ Idempotency basis | Accepted race window | Extreme fallback | Owner approval`.
308
+ When the caller receives an explicit failure and owns refund/cancel/state
309
+ compensation, the downstream adapter defaults to `Fail-fast + Fail-closed +
310
+ At-most-once + Caller-owned compensation`: no transparent retry, reroute,
311
+ resend, or guessed success. Accept a bounded false-negative window when duplicate
312
+ side effects are more harmful. Additional fallback requires explicit owner
313
+ approval and a proven idempotency basis, collected with other owner-only
314
+ questions in one final batch.
315
+
175
316
  Record irreversible or ambiguous decisions in references/decision-point.md
176
317
  format. Do not store decisions only in chat memory.
177
318
 
@@ -187,6 +328,9 @@ Decision points include:
187
328
 
188
329
  ## Quality Gates
189
330
 
331
+ The machine-readable review, environment, Mermaid, and Coding Ready contracts
332
+ are defined in `references/document-readiness.md`.
333
+
190
334
  The workflow must preserve these gates:
191
335
 
192
336
  - API-first contract freeze before implementation.
@@ -208,6 +352,13 @@ The workflow must preserve these gates:
208
352
  - Architecture boundary and call-direction analysis for multi-repo, service,
209
353
  SDK, MQ, scheduler, callback, gateway, adapter, device, or third-party flows.
210
354
  - SQL risk review before implementation for DB changes.
355
+ - Frozen release SQL before source design for DB changes. `release-sql.md` must
356
+ declare `database_change: true`, an exact placeholder-free
357
+ `target_sql_path`, `copy_policy: verbatim`, and the normalized SQL payload
358
+ `sql_sha256`, with exactly one complete executable SQL block containing the
359
+ required prechecks, DDL/DML, migration, and post-verification. Implementation
360
+ agents may only copy the block verbatim and verify the hash; any SQL design
361
+ omission returns to docs and requires a refreshed handoff.
211
362
  - Real-entry acceptance for integration, device, callback, payment, client, or
212
363
  cross-system flows. Mock-only is never real integration.
213
364
  - Delivery completeness: runtime code changes must update the relevant task
@@ -226,6 +377,9 @@ Implementation prompts must require:
226
377
  - worktree and port plan for parallel work;
227
378
  - real-entry validation commands from tests.md;
228
379
  - DB SELECT or SHOW CREATE checks when persisted state is touched;
380
+ - `release-sql.md`, its exact target path, verbatim-copy rule, and SHA-256 when
381
+ the change touches schema or data migration; prompts must never ask an
382
+ implementation agent to author or append SQL;
229
383
  - log checks and error checks;
230
384
  - superflow-verify-integration and superflow-delivery-check before completion;
231
385
  - a report format that distinguishes Passed, Partially verified, and Blocked.
@@ -21,6 +21,10 @@ review-checklist.md, sdd-quality-gate.md, test-report.md, and technical design.
21
21
 
22
22
  - Follow OpenSpec/SDD for WHAT and contract.
23
23
  - Follow Superpowers technical design for source-level HOW.
24
+ - For database changes, read `release-sql.md`, copy its single SQL block
25
+ verbatim to the exact `target_sql_path`, and verify `sql_sha256`. Never
26
+ author, append, reorder, split, or optimize SQL during implementation. Return
27
+ omissions to docs and refresh the handoff.
24
28
  - Do not change forbidden files or root aggregate docs from a worker batch.
25
29
  - Use TDD: record RED failure before GREEN success.
26
30
  - Do not mark mock-only or unit-only evidence as real integration.
@@ -0,0 +1,125 @@
1
+ # Document Delivery Readiness Contract
2
+
3
+ ## Applicability
4
+
5
+ Declare applicability in `.openspec.yaml`. Keyword scans may suggest a risk but
6
+ must not override an explicit, source-backed decision.
7
+
8
+ ```yaml
9
+ schema: superflow/v1
10
+ applicability:
11
+ cross_repo: true
12
+ complex_logic: true
13
+ mermaid: required
14
+ environment: required
15
+ database: false
16
+ external_config: false
17
+ concurrency: false
18
+ money: false
19
+ ```
20
+
21
+ `money: false` means this change does not alter money calculation, rounding,
22
+ allocation, or financial display. It is not a bypass when source impact proves
23
+ that money behavior changes.
24
+
25
+ ## Three-Review Receipt
26
+
27
+ Path: `.sdd/reviews/document-review.json`
28
+
29
+ ```json
30
+ {
31
+ "schemaVersion": "superflow.document-review.v1",
32
+ "handoffHash": "<current 64-character handoff hash>",
33
+ "verdict": "PASS",
34
+ "openOwnerDecisions": [],
35
+ "rounds": [
36
+ { "round": 1, "lens": "source-contract", "inputHash": "<same hash>", "findings": [] },
37
+ { "round": 2, "lens": "architecture-minimality", "inputHash": "<same hash>", "findings": [] },
38
+ { "round": 3, "lens": "e2e-environment", "inputHash": "<same hash>", "findings": [] }
39
+ ]
40
+ }
41
+ ```
42
+
43
+ Do not delete findings. After repair, retain them with `"status": "closed"`,
44
+ evidence, and the closure location. Every round is rechecked against the current
45
+ hash; a PASS for an old hash is invalid.
46
+
47
+ ## Environment Preflight
48
+
49
+ Path: `.sdd/readiness/environment.json`
50
+
51
+ ```json
52
+ {
53
+ "schemaVersion": "superflow.environment-readiness.v2",
54
+ "handoffHash": "<current hash>",
55
+ "scope": "local-dev",
56
+ "overall": "READY",
57
+ "ownerHelpRequired": [],
58
+ "executionContract": {
59
+ "applicationLocation": "local",
60
+ "dependencyPolicy": "shared-dev",
61
+ "allowLocalProvisioning": false,
62
+ "allowRemoteDevDependencies": true,
63
+ "allowedOverrides": ["server.port"],
64
+ "forbiddenOverrides": ["spring.datasource.url"],
65
+ "services": [
66
+ {
67
+ "id": "service-a",
68
+ "configSource": { "type": "bundled-profile", "ref": "application-prod.yml" },
69
+ "startupCommandSource": "tests.md#startup"
70
+ }
71
+ ],
72
+ "dependencies": [
73
+ {
74
+ "id": "redis",
75
+ "kind": "redis",
76
+ "provisioning": "shared-dev",
77
+ "configSource": { "type": "bundled-profile", "ref": "application-prod.yml#spring.redis" }
78
+ }
79
+ ]
80
+ },
81
+ "checks": [
82
+ { "id": "service-config", "type": "file", "target": "../../../service-a/application-prod.yml", "contractRef": "service:service-a", "status": "READY" },
83
+ { "id": "redis", "type": "tcp", "host": "redis.dev.internal", "port": 6379, "contractRef": "dependency:redis", "status": "READY" }
84
+ ]
85
+ }
86
+ ```
87
+
88
+ Supported checks are `file`, `directory`, `executable`, `tcp`, and `http`.
89
+ Never embed credentials or tokens in URLs. Production writes and DB/Redis/MQ
90
+ mutations are not preflight operations.
91
+
92
+ `executionContract` is the single environment source of truth. Freeze the
93
+ application location, dependency policy, local-provisioning and shared-dev
94
+ permissions, allowed/forbidden overrides, and the config source for every
95
+ service and dependency. `configSource.type` is one of `bundled-profile`,
96
+ `external-file`, `environment`, `cli-override`, or `generated-fixture`.
97
+ Do not mix `local-isolated`, `shared-dev`, and `shared-test`; use `mixed` and
98
+ declare each dependency's `provisioning` when mixing is intentional. Every
99
+ service and dependency needs a matching `contractRef` probe. Legacy v1 reports
100
+ prove reachability only and cannot satisfy Coding Ready.
101
+
102
+ ## Complex Diagrams
103
+
104
+ When `cross_repo` or `complex_logic` is true, include a Mermaid
105
+ `sequenceDiagram` for the real call and a `flowchart` or `stateDiagram` for
106
+ branches, compensation owner, and forbidden fallback.
107
+
108
+ ## Coding Ready
109
+
110
+ ```bash
111
+ superflow check <change> --level docs
112
+ superflow check <change> --level coding-ready
113
+ ```
114
+
115
+ The second command writes `.sdd/readiness/coding-ready.json`. Any SDD document
116
+ or handoff-hash change invalidates the old receipt. A developer Agent may only
117
+ receive a change with a current receipt.
118
+
119
+ ## Cross-System Failure Ownership
120
+
121
+ Record `Failure signal | Interpreter | Compensation owner | Retry allowed? |
122
+ Idempotency basis | Accepted race window | Extreme fallback | Owner approval`.
123
+ Default to fail-fast, fail-closed, at-most-once, and caller-owned compensation.
124
+ Retry, reroute, resend, or distributed compensation requires explicit owner
125
+ approval and a proven idempotency basis.
@@ -32,6 +32,16 @@
32
32
  - No-fallback decisions
33
33
  - Superpowers technical design handoff
34
34
 
35
+ ## release-sql.md (required for database changes)
36
+
37
+ - Front matter: `database_change: true`, exact `target_sql_path`,
38
+ `copy_policy: verbatim`, and normalized payload `sql_sha256`
39
+ - Exactly one complete executable `sql` block with required prechecks,
40
+ DDL/DML, migration, and post-verification
41
+ - No placeholder path or deferred SQL design
42
+ - Implementation agents only copy the block verbatim and verify the hash;
43
+ omissions return to docs
44
+
35
45
  ## tests.md
36
46
 
37
47
  - Case ID
@@ -11,7 +11,14 @@ requests. Process one feature at a time.
11
11
  - ui-contract.md: screen field to API/DTO/DB/test mapping.
12
12
  - gap-analysis.md: unknowns, contradictions, and owner decisions.
13
13
  - spec-freeze-review.md: final frozen scope and excluded items.
14
+ - source-code-audit.md: source fact freeze card, evidence classifications,
15
+ conflict audit, and question eligibility gate.
14
16
 
15
17
  ## Gate
16
18
 
17
19
  Do not generate full OpenSpec docs until the target feature is frozen.
20
+ For existing-system work, understand-anything is locator evidence only. Confirm
21
+ current behavior from source, Mapper/SQL, real callers, and read-only DB data
22
+ when needed. Classify current versus legacy/unmounted/data-model-only paths and
23
+ audit any List/orderIds/batchInsert/one-to-many signal that conflicts with a
24
+ single-item real entry before asking an owner question.
@@ -17,6 +17,13 @@ the new hash before continuing.
17
17
  OpenSpec/SDD is canonical for requirements, API, DB, SQL, tests, and acceptance.
18
18
  Superpowers technical design is canonical for source-level HOW and execution.
19
19
 
20
+ For a database change, SQL is already frozen in
21
+ [release-sql.md](../release-sql.md). The implementation agent may only copy its
22
+ single SQL block verbatim to the exact `target_sql_path`, normalize line endings
23
+ to LF with one trailing newline, and verify `sql_sha256`. Do not add, remove,
24
+ reorder, split, or optimize SQL. Any omission returns to docs and requires a
25
+ refreshed handoff; never design SQL inside the implementation prompt.
26
+
20
27
  ## Required Preflight
21
28
 
22
29
  - Real entry located.