aw-spec-cli 0.1.7 → 0.1.9

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 (261) hide show
  1. package/assets/.appweaver/DESIGN-FORMAT.md +200 -0
  2. package/assets/.appweaver/ORCH-DIALECT.md +156 -0
  3. package/assets/.appweaver/RULE-PARTITION.md +175 -0
  4. package/assets/.appweaver/STACK-PROFILES.md +461 -0
  5. package/assets/.appweaver/ai-rules.md +180 -0
  6. package/assets/.appweaver/domain.json +1 -0
  7. package/assets/.appweaver/extensions/.registry +19 -0
  8. package/assets/.appweaver/extensions/agent-context/README.md +57 -0
  9. package/assets/.appweaver/extensions/agent-context/agent-context-config.yml +4 -0
  10. package/assets/.appweaver/extensions/agent-context/commands/aw-spec.agent-context.update.md +26 -0
  11. package/assets/.appweaver/extensions/agent-context/extension.yml +37 -0
  12. package/assets/.appweaver/extensions/agent-context/scripts/bash/update-agent-context.sh +201 -0
  13. package/assets/.appweaver/extensions/agent-context/scripts/powershell/update-agent-context.ps1 +237 -0
  14. package/assets/.appweaver/extensions.yml +16 -0
  15. package/assets/.appweaver/feature.json +3 -0
  16. package/assets/.appweaver/init-options.json +9 -0
  17. package/assets/.appweaver/integration.json +15 -0
  18. package/assets/.appweaver/integrations/aw-spec.manifest.json +9 -0
  19. package/assets/.appweaver/interpreter/run-skill.py +1176 -0
  20. package/assets/.appweaver/memory/constitution.md +50 -0
  21. package/assets/.appweaver/orchestrator/.smoke-out/smoke.md +6 -0
  22. package/assets/.appweaver/orchestrator/AGENT-PROFILE.md +94 -0
  23. package/assets/.appweaver/orchestrator/README.md +300 -0
  24. package/assets/.appweaver/orchestrator/adapters/claude_agent_sdk.py +74 -0
  25. package/assets/.appweaver/orchestrator/adapters/google_antigravity.py +74 -0
  26. package/assets/.appweaver/orchestrator/modules/delta-design.orch.yaml +105 -0
  27. package/assets/.appweaver/orchestrator/modules/delta-spec.orch.yaml +101 -0
  28. package/assets/.appweaver/orchestrator/modules/domain-select.orch.yaml +90 -0
  29. package/assets/.appweaver/orchestrator/modules/lane-gate.orch.yaml +126 -0
  30. package/assets/.appweaver/orchestrator/modules/tech-select.orch.yaml +123 -0
  31. package/assets/.appweaver/orchestrator/orchestrator.py +1721 -0
  32. package/assets/.appweaver/orchestrator/rev-templates/ai-rules.reference.md +40 -0
  33. package/assets/.appweaver/orchestrator/rev-templates/delta-design-template.skeleton.md +101 -0
  34. package/assets/.appweaver/orchestrator/rev-templates/design-template.skeleton.md +245 -0
  35. package/assets/.appweaver/orchestrator/rev-templates/domain-constitution.skeleton.md +63 -0
  36. package/assets/.appweaver/orchestrator/rev-templates/domain-requirements.skeleton.md +48 -0
  37. package/assets/.appweaver/orchestrator/rev-templates/domain-rule-bindings.skeleton.md +59 -0
  38. package/assets/.appweaver/orchestrator/rev-templates/domain-rule-file.skeleton.md +39 -0
  39. package/assets/.appweaver/orchestrator/rev-templates/frontend-rule-file.skeleton.md +63 -0
  40. package/assets/.appweaver/orchestrator/rev-templates/tech-rule-bindings.skeleton.md +116 -0
  41. package/assets/.appweaver/orchestrator/rev-templates/technical-constitution.skeleton.md +106 -0
  42. package/assets/.appweaver/orchestrator/rev-templates/technical-rule-file.skeleton.md +54 -0
  43. package/assets/.appweaver/orchestrator/rev-templates/ui-constitution.skeleton.md +125 -0
  44. package/assets/.appweaver/orchestrator/rev-templates/ui-delta-design-template.skeleton.md +123 -0
  45. package/assets/.appweaver/orchestrator/rev-templates/ui-design-template.skeleton.md +294 -0
  46. package/assets/.appweaver/orchestrator/workflows/_smoke.orch.yaml +160 -0
  47. package/assets/.appweaver/orchestrator/workflows/aw-spec-add-component.orch.yaml +270 -0
  48. package/assets/.appweaver/orchestrator/workflows/aw-spec-adopt.orch.yaml +934 -0
  49. package/assets/.appweaver/orchestrator/workflows/aw-spec-analyze-delta-design.orch.yaml +251 -0
  50. package/assets/.appweaver/orchestrator/workflows/aw-spec-analyze-design.orch.yaml +265 -0
  51. package/assets/.appweaver/orchestrator/workflows/aw-spec-analyze-slice.orch.yaml +437 -0
  52. package/assets/.appweaver/orchestrator/workflows/aw-spec-build.orch.yaml +197 -0
  53. package/assets/.appweaver/orchestrator/workflows/aw-spec-characterize.orch.yaml +475 -0
  54. package/assets/.appweaver/orchestrator/workflows/aw-spec-close-delta.orch.yaml +181 -0
  55. package/assets/.appweaver/orchestrator/workflows/aw-spec-constitution.orch.yaml +727 -0
  56. package/assets/.appweaver/orchestrator/workflows/aw-spec-demo.orch.yaml +100 -0
  57. package/assets/.appweaver/orchestrator/workflows/aw-spec-dependency-tree.orch.yaml +69 -0
  58. package/assets/.appweaver/orchestrator/workflows/aw-spec-deploy.orch.yaml +85 -0
  59. package/assets/.appweaver/orchestrator/workflows/aw-spec-design-ui.orch.yaml +386 -0
  60. package/assets/.appweaver/orchestrator/workflows/aw-spec-design.orch.yaml +382 -0
  61. package/assets/.appweaver/orchestrator/workflows/aw-spec-finalize-delta.orch.yaml +462 -0
  62. package/assets/.appweaver/orchestrator/workflows/aw-spec-foundation.orch.yaml +265 -0
  63. package/assets/.appweaver/orchestrator/workflows/aw-spec-implement-delta.orch.yaml +253 -0
  64. package/assets/.appweaver/orchestrator/workflows/aw-spec-implement-ui.orch.yaml +267 -0
  65. package/assets/.appweaver/orchestrator/workflows/aw-spec-implement.orch.yaml +287 -0
  66. package/assets/.appweaver/orchestrator/workflows/aw-spec-inventory.orch.yaml +238 -0
  67. package/assets/.appweaver/orchestrator/workflows/aw-spec-onboard.orch.yaml +1822 -0
  68. package/assets/.appweaver/orchestrator/workflows/aw-spec-parity.orch.yaml +293 -0
  69. package/assets/.appweaver/orchestrator/workflows/aw-spec-run.orch.yaml +194 -0
  70. package/assets/.appweaver/orchestrator/workflows/aw-spec-select-domain.orch.yaml +83 -0
  71. package/assets/.appweaver/orchestrator/workflows/aw-spec-select-feature.orch.yaml +128 -0
  72. package/assets/.appweaver/orchestrator/workflows/aw-spec-select-stack.orch.yaml +296 -0
  73. package/assets/.appweaver/orchestrator/workflows/aw-spec-specify.orch.yaml +439 -0
  74. package/assets/.appweaver/scripts/bash/aw-inventory.sh +17 -0
  75. package/assets/.appweaver/scripts/bash/aw-parity.sh +13 -0
  76. package/assets/.appweaver/scripts/bash/aw-rev-constitution.sh +13 -0
  77. package/assets/.appweaver/scripts/bash/aw-spec-actions.sh +2626 -0
  78. package/assets/.appweaver/scripts/bash/aw-xref.sh +15 -0
  79. package/assets/.appweaver/scripts/bash/common.sh +533 -0
  80. package/assets/.appweaver/scripts/powershell/aw-inventory.ps1 +17 -0
  81. package/assets/.appweaver/scripts/powershell/aw-parity.ps1 +13 -0
  82. package/assets/.appweaver/scripts/powershell/aw-rev-constitution.ps1 +13 -0
  83. package/assets/.appweaver/scripts/powershell/aw-spec-actions.ps1 +2232 -0
  84. package/assets/.appweaver/scripts/powershell/aw-xref.ps1 +15 -0
  85. package/assets/.appweaver/scripts/python/aw-component-catalog.py +121 -0
  86. package/assets/.appweaver/scripts/python/aw-inventory.py +1180 -0
  87. package/assets/.appweaver/scripts/python/aw-parity.py +380 -0
  88. package/assets/.appweaver/scripts/python/aw-rev-constitution.py +329 -0
  89. package/assets/.appweaver/scripts/python/aw-stack.py +1251 -0
  90. package/assets/.appweaver/scripts/python/aw-xref.py +1330 -0
  91. package/assets/.appweaver/scripts/python/validate_okf.py +352 -0
  92. package/assets/.appweaver/stack-profiles/angular.json +16 -0
  93. package/assets/.appweaver/stack-profiles/blazor-wasm.json +17 -0
  94. package/assets/.appweaver/stack-profiles/dotnet-webapi.json +15 -0
  95. package/assets/.appweaver/stack-profiles/go-chi.json +14 -0
  96. package/assets/.appweaver/stack-profiles/java-spring.json +16 -0
  97. package/assets/.appweaver/stack-profiles/nextjs.json +16 -0
  98. package/assets/.appweaver/stack-profiles/node-express.json +15 -0
  99. package/assets/.appweaver/stack-profiles/python-fastapi.json +16 -0
  100. package/assets/.appweaver/stack-profiles/react-vite.json +17 -0
  101. package/assets/.appweaver/stack-profiles/sveltekit.json +16 -0
  102. package/assets/.appweaver/stack-profiles/vue-vite.json +17 -0
  103. package/assets/.appweaver/stacks.json +3 -0
  104. package/assets/.appweaver/templates/constitution-domain-template.md +116 -0
  105. package/assets/.appweaver/templates/constitution-technical-template.md +108 -0
  106. package/assets/.appweaver/templates/constitution-ui-template.md +116 -0
  107. package/assets/.appweaver/templates/delta-design-template.md +69 -0
  108. package/assets/.appweaver/templates/delta-spec-template.md +63 -0
  109. package/assets/.appweaver/templates/design-template.md +383 -0
  110. package/assets/.appweaver/templates/okf-concept-template.md +114 -0
  111. package/assets/.appweaver/templates/parity-manifest-template.json +49 -0
  112. package/assets/.appweaver/templates/source-map-template.md +85 -0
  113. package/assets/.appweaver/templates/spec-template.md +309 -0
  114. package/assets/.appweaver/templates/ui-design-template.md +273 -0
  115. package/assets/foundations/dotnet/ModularMonolith/ModularMonolith.Reference.pack.txt +25248 -0
  116. package/assets/foundations/dotnet/ModularMonolith/ModularMonolith.pack.txt +5726 -0
  117. package/assets/foundations/dotnet/ModularMonolith/pack-foundation.ps1 +145 -0
  118. package/assets/foundations/dotnet/ModularMonolith/pack-foundation.sh +196 -0
  119. package/assets/foundations/dotnet/ModularMonolith/pack-reference-foundation.ps1 +157 -0
  120. package/assets/foundations/dotnet/ModularMonolith/pack-reference-foundation.sh +209 -0
  121. package/assets/foundations/dotnet/ModularMonolith/unpack-foundation.ps1 +126 -0
  122. package/assets/foundations/dotnet/ModularMonolith/unpack-foundation.sh +217 -0
  123. package/assets/foundations/dotnet/ModularMonolith/unpack-reference-foundation.ps1 +129 -0
  124. package/assets/foundations/dotnet/ModularMonolith/unpack-reference-foundation.sh +218 -0
  125. package/assets/foundations/dotnet/VerticalSlice/VerticalSlice.Reference.pack.txt +19318 -0
  126. package/assets/foundations/dotnet/VerticalSlice/VerticalSlice.pack.txt +2833 -0
  127. package/assets/foundations/dotnet/VerticalSlice/pack-foundation.ps1 +145 -0
  128. package/assets/foundations/dotnet/VerticalSlice/pack-foundation.sh +196 -0
  129. package/assets/foundations/dotnet/VerticalSlice/pack-reference-foundation.ps1 +157 -0
  130. package/assets/foundations/dotnet/VerticalSlice/pack-reference-foundation.sh +209 -0
  131. package/assets/foundations/dotnet/VerticalSlice/unpack-foundation.ps1 +126 -0
  132. package/assets/foundations/dotnet/VerticalSlice/unpack-foundation.sh +217 -0
  133. package/assets/foundations/dotnet/VerticalSlice/unpack-reference-foundation.ps1 +129 -0
  134. package/assets/foundations/dotnet/VerticalSlice/unpack-reference-foundation.sh +218 -0
  135. package/assets/foundations/dotnet/components/Email/README.md +119 -0
  136. package/assets/foundations/dotnet/components/Email/ReferenceEndpoints/SendEmailEndpoint.cs +84 -0
  137. package/assets/foundations/dotnet/components/Email/integration.md +300 -0
  138. package/assets/foundations/dotnet/components/Jobs/README.md +113 -0
  139. package/assets/foundations/dotnet/components/Jobs/integration.md +259 -0
  140. package/assets/foundations/dotnet/components/QrGenerator/README.md +85 -0
  141. package/assets/foundations/dotnet/components/QrGenerator/ReferenceEndpoints/GenerateQrEndpoint.cs +57 -0
  142. package/assets/foundations/dotnet/components/QrGenerator/integration.md +230 -0
  143. package/assets/foundations/dotnet/components/README.md +74 -0
  144. package/assets/guardrails/README.md +222 -0
  145. package/assets/guardrails/domain/healthcare/ai-rules.domain.md +34 -0
  146. package/assets/guardrails/domain/healthcare/api-versioning.domain.md +17 -0
  147. package/assets/guardrails/domain/healthcare/auditing.domain.md +97 -0
  148. package/assets/guardrails/domain/healthcare/authorization.domain.md +26 -0
  149. package/assets/guardrails/domain/healthcare/clinical-terms.md +20 -0
  150. package/assets/guardrails/domain/healthcare/coding-standards.domain.md +26 -0
  151. package/assets/guardrails/domain/healthcare/consent.md +19 -0
  152. package/assets/guardrails/domain/healthcare/cqrs.domain.md +12 -0
  153. package/assets/guardrails/domain/healthcare/data-classification.domain.md +28 -0
  154. package/assets/guardrails/domain/healthcare/dependency-policy.domain.md +11 -0
  155. package/assets/guardrails/domain/healthcare/dicom.md +15 -0
  156. package/assets/guardrails/domain/healthcare/domain-constitution.md +119 -0
  157. package/assets/guardrails/domain/healthcare/domain-driven-design.domain.md +28 -0
  158. package/assets/guardrails/domain/healthcare/eventing.domain.md +18 -0
  159. package/assets/guardrails/domain/healthcare/fhir.md +36 -0
  160. package/assets/guardrails/domain/healthcare/folder-structure.domain.md +25 -0
  161. package/assets/guardrails/domain/healthcare/hipaa.md +34 -0
  162. package/assets/guardrails/domain/healthcare/hl7.md +15 -0
  163. package/assets/guardrails/domain/healthcare/ihe-conformance.md +31 -0
  164. package/assets/guardrails/domain/healthcare/integration-terms.md +21 -0
  165. package/assets/guardrails/domain/healthcare/persistence.domain.md +20 -0
  166. package/assets/guardrails/domain/healthcare/terminology.md +30 -0
  167. package/assets/guardrails/domain/healthcare/testing.domain.md +15 -0
  168. package/assets/guardrails/domain/healthcare/ux/accessibility-standards.md +36 -0
  169. package/assets/guardrails/domain/healthcare/ux/content-design.md +32 -0
  170. package/assets/guardrails/domain/healthcare/ux/interaction-states.md +44 -0
  171. package/assets/guardrails/domain/healthcare/ux/journey-mapping.md +40 -0
  172. package/assets/guardrails/domain/healthcare/vertical-slices.domain.md +18 -0
  173. package/assets/guardrails/domain/healthcare/zero-trust.domain.md +12 -0
  174. package/assets/guardrails/domain/pharma/ai-rules.domain.md +32 -0
  175. package/assets/guardrails/domain/pharma/api-versioning.domain.md +20 -0
  176. package/assets/guardrails/domain/pharma/atc.md +22 -0
  177. package/assets/guardrails/domain/pharma/auditing.domain.md +90 -0
  178. package/assets/guardrails/domain/pharma/authorization.domain.md +25 -0
  179. package/assets/guardrails/domain/pharma/coding-standards.domain.md +28 -0
  180. package/assets/guardrails/domain/pharma/cqrs.domain.md +16 -0
  181. package/assets/guardrails/domain/pharma/data-classification.domain.md +24 -0
  182. package/assets/guardrails/domain/pharma/data-provenance.md +21 -0
  183. package/assets/guardrails/domain/pharma/dependency-policy.domain.md +11 -0
  184. package/assets/guardrails/domain/pharma/domain-constitution.md +113 -0
  185. package/assets/guardrails/domain/pharma/domain-driven-design.domain.md +36 -0
  186. package/assets/guardrails/domain/pharma/domain-requirements.sample.md +103 -0
  187. package/assets/guardrails/domain/pharma/eventing.domain.md +18 -0
  188. package/assets/guardrails/domain/pharma/fhir.md +31 -0
  189. package/assets/guardrails/domain/pharma/folder-structure.domain.md +26 -0
  190. package/assets/guardrails/domain/pharma/hl7.md +17 -0
  191. package/assets/guardrails/domain/pharma/idmp.md +26 -0
  192. package/assets/guardrails/domain/pharma/integration-terms.md +21 -0
  193. package/assets/guardrails/domain/pharma/ndc.md +28 -0
  194. package/assets/guardrails/domain/pharma/persistence.domain.md +23 -0
  195. package/assets/guardrails/domain/pharma/pharma-terms.md +27 -0
  196. package/assets/guardrails/domain/pharma/product-lifecycle.domain.md +30 -0
  197. package/assets/guardrails/domain/pharma/regulatory-compliance.md +19 -0
  198. package/assets/guardrails/domain/pharma/terminology.md +32 -0
  199. package/assets/guardrails/domain/pharma/testing.domain.md +19 -0
  200. package/assets/guardrails/domain/pharma/vertical-slices.domain.md +17 -0
  201. package/assets/guardrails/domain/pharma/zero-trust.domain.md +12 -0
  202. package/assets/guardrails/projects/dotnet-default-project/domain/domain-requirements.md +58 -0
  203. package/assets/guardrails/projects/dotnet-default-project/domain-rule-bindings.md +113 -0
  204. package/assets/guardrails/projects/dotnet-default-project/frontend/ui-requirements.md +43 -0
  205. package/assets/guardrails/projects/dotnet-default-project/service/technical-requirements.md +40 -0
  206. package/assets/guardrails/projects/dotnet-default-project/tech-rule-bindings.md +263 -0
  207. package/assets/guardrails/requirement-spec.txt +27 -0
  208. package/assets/guardrails/technology/dotnet-webapi/PACKAGING.md +184 -0
  209. package/assets/guardrails/technology/dotnet-webapi/api-versioning.md +44 -0
  210. package/assets/guardrails/technology/dotnet-webapi/auditing.md +96 -0
  211. package/assets/guardrails/technology/dotnet-webapi/authorization-matrix.md +14 -0
  212. package/assets/guardrails/technology/dotnet-webapi/authorization.md +39 -0
  213. package/assets/guardrails/technology/dotnet-webapi/clean-architecture.md +54 -0
  214. package/assets/guardrails/technology/dotnet-webapi/coding-standards.md +87 -0
  215. package/assets/guardrails/technology/dotnet-webapi/cqrs.md +63 -0
  216. package/assets/guardrails/technology/dotnet-webapi/data-classification.md +38 -0
  217. package/assets/guardrails/technology/dotnet-webapi/dependency-policy.md +40 -0
  218. package/assets/guardrails/technology/dotnet-webapi/domain-driven-design.md +91 -0
  219. package/assets/guardrails/technology/dotnet-webapi/eventing.md +57 -0
  220. package/assets/guardrails/technology/dotnet-webapi/examples/api-versioning.md +75 -0
  221. package/assets/guardrails/technology/dotnet-webapi/examples/auditing.md +84 -0
  222. package/assets/guardrails/technology/dotnet-webapi/examples/authorization.md +68 -0
  223. package/assets/guardrails/technology/dotnet-webapi/examples/clean-architecture.md +37 -0
  224. package/assets/guardrails/technology/dotnet-webapi/examples/cqrs.md +97 -0
  225. package/assets/guardrails/technology/dotnet-webapi/examples/domain-driven-design.md +141 -0
  226. package/assets/guardrails/technology/dotnet-webapi/examples/eventing.md +46 -0
  227. package/assets/guardrails/technology/dotnet-webapi/examples/persistence.md +207 -0
  228. package/assets/guardrails/technology/dotnet-webapi/examples/vertical-slices.md +151 -0
  229. package/assets/guardrails/technology/dotnet-webapi/examples/zero-trust.md +48 -0
  230. package/assets/guardrails/technology/dotnet-webapi/folder-structure.md +61 -0
  231. package/assets/guardrails/technology/dotnet-webapi/modular-monolith.md +47 -0
  232. package/assets/guardrails/technology/dotnet-webapi/persistence.md +82 -0
  233. package/assets/guardrails/technology/dotnet-webapi/technology-constitution.md +162 -0
  234. package/assets/guardrails/technology/dotnet-webapi/testing.md +55 -0
  235. package/assets/guardrails/technology/dotnet-webapi/vertical-slices.md +70 -0
  236. package/assets/guardrails/technology/dotnet-webapi/zero-trust.md +48 -0
  237. package/assets/guardrails/technology/java-spring/README.md +62 -0
  238. package/assets/guardrails/technology/nextjs/accessibility-implementation.md +56 -0
  239. package/assets/guardrails/technology/nextjs/api-client.md +56 -0
  240. package/assets/guardrails/technology/nextjs/api-integration.dotnet-webapi.md +174 -0
  241. package/assets/guardrails/technology/nextjs/api-integration.java-spring.md +203 -0
  242. package/assets/guardrails/technology/nextjs/auth-session.md +68 -0
  243. package/assets/guardrails/technology/nextjs/client-security.md +69 -0
  244. package/assets/guardrails/technology/nextjs/component-architecture.md +60 -0
  245. package/assets/guardrails/technology/nextjs/component-conventions.md +58 -0
  246. package/assets/guardrails/technology/nextjs/design-system.md +60 -0
  247. package/assets/guardrails/technology/nextjs/error-handling.md +72 -0
  248. package/assets/guardrails/technology/nextjs/forms-and-validation.md +75 -0
  249. package/assets/guardrails/technology/nextjs/frontend-testing.md +94 -0
  250. package/assets/guardrails/technology/nextjs/i18n.md +57 -0
  251. package/assets/guardrails/technology/nextjs/observability.md +67 -0
  252. package/assets/guardrails/technology/nextjs/performance-budgets.md +66 -0
  253. package/assets/guardrails/technology/nextjs/routing-navigation.md +52 -0
  254. package/assets/guardrails/technology/nextjs/state-management.md +70 -0
  255. package/assets/guardrails/technology/nextjs/ui-constitution.md +166 -0
  256. package/dist/commands/init.js +2 -2
  257. package/dist/commands/init.js.map +1 -1
  258. package/dist/utils/copy-assets.js +8 -8
  259. package/dist/utils/copy-assets.js.map +1 -1
  260. package/package.json +1 -1
  261. package/assets/docs/pharma-constitution.my-ref.md +0 -86
@@ -0,0 +1,934 @@
1
+ # =============================================================================
2
+ # aw-spec-adopt (orchestrator) — the JUST-IN-TIME per-feature step of Brownfield DEV
3
+ #
4
+ # Develop an EXISTING feature by first reverse-engineering ONE aggregate / vertical
5
+ # slice from its code into a living spec.md + aligned design.md (+ a source-map.md
6
+ # sidecar), THEN reconciling this feature's evidence into the project governance that
7
+ # /appweaver onboard established. Adopt is the inverse of implement: implement reads
8
+ # spec+design and generates code; adopt reads code and generates spec+design — equally
9
+ # a reasoning step, stamped `origin: reverse-engineered` with per-item confidence.
10
+ #
11
+ # onboard → ADOPT <Feature> (JIT, one feature at a time) → [ forward / CR delta loop ] ← you are here
12
+ #
13
+ # Adopt is JUST-IN-TIME and per-feature: reverse ONLY the feature you are about to
14
+ # develop, never the whole codebase (that scale is what onboard's shallow feature map
15
+ # avoids). A NEW feature (no existing code) is NOT adopted — it is authored straight
16
+ # through the forward pipeline (/appweaver specify → design → implement), which
17
+ # onboard already made brownfield-ready (the code-derived design template is the
18
+ # project default). So adopt = reverse an EXISTING feature; the forward pipeline = a
19
+ # new one. Both then evolve through the CR delta loop.
20
+ #
21
+ # The reverse output is a NORMAL feature: spec.md + design.md are the very documents
22
+ # the CR delta loop + forward pipeline consume unchanged. All brownfield provenance
23
+ # lives in `origin:` frontmatter + the source-map sidecar. Adopt inits
24
+ # active_version.json (v1.0) so the CR loop works immediately after.
25
+ #
26
+ # GOVERNANCE RECONCILE (the JIT contract, gap-fix #1) — ⏸ HELD, OFF BY DEFAULT.
27
+ # onboard established the PROJECT constitution + guardrails/projects/<project>/ rule set
28
+ # from the whole-repo SCAN, with per-feature specifics marked PROVISIONAL. The reconcile
29
+ # block below carries this feature's real evidence (BR-/CN-/DC-/IC- ids, code coordinates)
30
+ # INTO that scaffold — upgrading provisional → evidenced. It RECONCILES, never re-authors:
31
+ # it never rewrites the project's principle SET or another feature's evidence (that would
32
+ # re-introduce single-feature scoping bias), so the constitution stays PROJECT-scoped.
33
+ # Every step of it is gated on `reconcile_governance` (vars, default "false"), so an
34
+ # ordinary adopt run leaves the constitution halves and the rule set exactly as onboard
35
+ # wrote them. What adopt ALWAYS does is the per-feature reverse (spec + design +
36
+ # source-map) and the OKF concept completion; flip the var to "true" to add the
37
+ # governance reconcile back.
38
+ #
39
+ # Rule partition (same as the forward loop): the reversed SPEC is authored with DOMAIN
40
+ # authority (DDD); the reversed DESIGN is authored from the spec + TECHNICAL standards
41
+ # only, NO domain files — domain reaches design as spec ids.
42
+ #
43
+ # Adopt does NOT generate code and does NOT modify source — writes land under
44
+ # specs/<Feature>/, .appweaver/memory/constitution*.md, and guardrails/projects/<project>/.
45
+ # Fidelity checks spec/design ↔ CODE; the Adopt review is REPORTED for out-of-band
46
+ # closure — it blocks only on structural failures (unmapped code / fabricated spec/design).
47
+ # There is NO migration content here (characterize is an optional on-touch fence, not a
48
+ # phase; parity/cutover belong to the separate later modernization phase).
49
+ #
50
+ # Launch: /appweaver adopt [strategy] # adopt the ACTIVE feature (set by select-feature)
51
+ # /appweaver adopt [strategy] <Feature> # or name it directly (also selects it)
52
+ # e.g. /appweaver adopt MedicinalProduct
53
+ # Prereq: /appweaver onboard (the feature map names this feature + the governance
54
+ # scaffold adopt reconciles into), then /appweaver select-feature to pick
55
+ # the aggregate — adopt consumes it, so the no-arg form is the normal path.
56
+ # =============================================================================
57
+
58
+ name: aw-spec-adopt
59
+ description: The JIT per-feature step of brownfield development — reverse-engineer ONE existing feature into a living spec.md + design.md (+ design.ui.md where a frontend lane is declared and this slice owns part of its surface) + source-map.md (origin reverse-engineered, per-item confidence, code-derived design template), then COMPLETE its shallow OKF concept (deepen it to the reversed reality + link the deep artifacts) and record its cross-slice edges. Fidelity gate is spec/design vs code; the review is reported for out-of-band closure. The governance reconcile — carrying this feature's real evidence into the provisional rule files + constitution onboard wrote — is HELD (reconcile_governance=false), so an ordinary run does not touch the governance tier. A NEW feature is authored via the forward pipeline instead. Output is a normal feature for the CR + forward loop.
60
+ # 1.5.0 — user_input is now OPTIONAL: adopt CONSUMES the ACTIVE feature (select-feature's
61
+ # .appweaver/feature.json) when no arg is passed, so onboard→select-feature→adopt needs
62
+ # no re-typing; an explicit <Feature> still selects directly (and wins). One coalesced
63
+ # feature_name (set-feature-canonicalised) replaces USER_INPUT throughout.
64
+ # 1.4.0 — COMPLETE the shallow OKF aggregate concept from the trustworthy reversed docs
65
+ # (deepen detail + link spec/design/source-map + mark adopted) before xref_record.
66
+ # 1.3.0 — reverse design scaffolds from the DEFAULT `design-template` (onboard's code-derived
67
+ # override) instead of the never-shipped `brownfield-design-template`, unifying the
68
+ # whole brownfield pipeline on one code-derived template.
69
+ version: 1.5.0
70
+ agent_agnostic: true
71
+ dialect: aw-spec.orchestrator/v1
72
+
73
+ inputs:
74
+ user_input:
75
+ description: OPTIONAL existing feature to adopt (a candidate from the onboard feature map, e.g. MedicinalProduct). Omit it to adopt the ACTIVE feature already selected by /appweaver select-feature (.appweaver/feature.json) — the normal onboard→select-feature→adopt flow. A NEW feature (no existing code) is developed via the forward pipeline instead, not adopt.
76
+ required: false
77
+ bind: USER_INPUT
78
+
79
+ scripts:
80
+ inventory:
81
+ sh: .appweaver/scripts/bash/aw-inventory.sh
82
+ ps1: .appweaver/scripts/powershell/aw-inventory.ps1
83
+ actions:
84
+ sh: .appweaver/scripts/bash/aw-spec-actions.sh
85
+ ps1: .appweaver/scripts/powershell/aw-spec-actions.ps1
86
+ xref:
87
+ sh: .appweaver/scripts/bash/aw-xref.sh
88
+ ps1: .appweaver/scripts/powershell/aw-xref.ps1
89
+
90
+ # Sticky standards seed = the UNIVERSAL always-on rule only (ai-rules). The TECHNICAL/
91
+ # architecture set for the reversed DESIGN step (mirrors aw-spec-design) is no longer
92
+ # hardcoded here — it is now CONFIGURATION, loaded per-command from
93
+ # guardrails/projects/<project>/tech-rule-bindings.md under "## /aw-spec-adopt" by the
94
+ # tech-select module (see the tech_select step below). The reversed SPEC step runs
95
+ # include_standards:false and takes its domain frame from constitution.domain.md via
96
+ # build_context — so design never sees a domain rule file (rule partition preserved); the
97
+ # tech map lists only technical files. constitution.technical.md is referred to directly
98
+ # (context in reverse_design), never mapped. Missing files skipped at assembly time.
99
+ standards:
100
+ - { path: .appweaver/ai-rules.md } # kit-resident: the universal operating rules, every flow
101
+
102
+ vars:
103
+ bundle_dir: "knowledge" # where /appweaver onboard writes the OKF feature map (repo-root default)
104
+ feature_name: "" # the aggregate to adopt: USER_INPUT if passed, else the active feature (set-feature canonicalises)
105
+ concept_exists: "false"
106
+ fe_declared: "false" # lane_readback runs on_error:continue, so both its bindings need a declared default
107
+ fe_root: ""
108
+ ui_lane: "false" # THIS slice reverses a UI half: a frontend lane is declared AND the slice owns UI files
109
+ ui_count: "0" # how many UI files the concept attributes to this aggregate (aw-inventory ui_source_files)
110
+ ui_source_files: ""
111
+ ui_design_doc: ""
112
+ ui_tpl_source: ""
113
+ spec_exists: "false"
114
+ fidelity_ok: "false"
115
+ rulemap_exists: "false" # governance-present signal (onboard ran) — bound from resolve-domain
116
+ reconcile_governance: "false" # HELD 2026-07-29 — the governance (constitution + rule-set) reconcile block is PAUSED on adopt; flip to "true" to re-enable it
117
+ technical_ok: "false" # technical-half reconcile lint guard
118
+ domain_ok: "false" # domain-half reconcile lint guard
119
+ guard_sentinel: "" # deliberately empty — the conditioned "already-adopted" gate stops on it
120
+ pack_reconciled: "" # default while reconcile is HELD (no rule-set files reconciled)
121
+ composed_file: "" # default while reconcile is HELD (constitution view not recomposed)
122
+
123
+ workflow:
124
+
125
+ # 0. TECHNICAL rule files → sticky standards (configuration, not hardcoded). tech-select
126
+ # reads guardrails/projects/<project>/tech-rule-bindings.md under "## /aw-spec-adopt" and
127
+ # loads that reference set into the sticky standards. Loaded FIRST so it is present for
128
+ # reverse_design (include_standards:true) — the reversed SPEC step still turns it off
129
+ # (include_standards:false), keeping design domain-free (rule partition). No domain rule
130
+ # file here — the tech map lists only technical files. No blocking gate: an unconfigured
131
+ # project soft-continues (constitution.technical.md still carries the tech base).
132
+ - id: tech_select
133
+ action: include
134
+ module: .appweaver/orchestrator/modules/tech-select.orch.yaml
135
+ with: { command: aw-spec-adopt }
136
+
137
+ # 1. Resolve the aggregate to adopt. TWO ways in (arg wins over active):
138
+ # a) `/appweaver adopt <Feature>` — the explicit arg selects directly.
139
+ # b) `/appweaver adopt` (no arg) — CONSUME the feature select-feature already
140
+ # made active (.appweaver/feature.json), so the onboard→select-feature→adopt
141
+ # flow needs no re-typing. feature-paths returns the active aggregate name;
142
+ # on_error:continue leaves it empty when nothing is selected yet.
143
+ - id: active_feature
144
+ action: execute_script
145
+ on_error: continue
146
+ script: { ref: actions }
147
+ subcommand: feature-paths
148
+ outputs:
149
+ - { name: active_name, from: "$.feature" }
150
+
151
+ # Coalesce: default to the active feature, then let an explicit arg override it.
152
+ # (The engine has no compound conditions, so this is two ordered sets.)
153
+ - id: name_from_active
154
+ action: set
155
+ vars: { feature_name: "{{active_name}}" }
156
+ - id: name_from_arg
157
+ action: set
158
+ condition: "{{USER_INPUT}}"
159
+ vars: { feature_name: "{{USER_INPUT}}" }
160
+
161
+ - id: require_target
162
+ action: verify_context
163
+ require_non_empty: feature_name
164
+ on_empty: stop
165
+ on_empty_message: "No feature to adopt. Either run /appweaver select-feature first (pick the aggregate from the onboard feature map), then /appweaver adopt; or name it directly: /appweaver adopt <Feature>."
166
+
167
+ # Create-or-select the feature dir + persist it active (idempotent in the no-arg
168
+ # path where it is already active; creates it in the explicit-arg path). set-feature
169
+ # canonicalises to the PascalCase aggregate id → the single feature_name used below.
170
+ - id: set_feature
171
+ action: execute_script
172
+ script: { ref: actions }
173
+ subcommand: set-feature
174
+ args: ["--feature", "{{feature_name}}"]
175
+ outputs:
176
+ - { name: feature_name, from: "$.feature" }
177
+ - { name: feature_dir, from: "$.feature_dir" }
178
+ - { name: spec_file, from: "$.spec_file" }
179
+ - { name: spec_exists, from: "$.spec_exists" }
180
+
181
+ # 1a. One-time baseline: refuse to clobber an already-adopted / authored spec.
182
+ # After adoption, changes go through the CR delta loop, not adopt.
183
+ # set-feature returns spec_exists as a JSON boolean; the condition path
184
+ # normalises bools to "true"/"false" (json), so gate through it — a
185
+ # require_value/equals would compare str(False)="False" and mis-fire. The
186
+ # gate only runs when a spec already exists, and stops on the empty sentinel.
187
+ - id: guard_not_adopted
188
+ condition: "{{spec_exists}} == true"
189
+ action: verify_context
190
+ require_non_empty: guard_sentinel
191
+ on_empty: stop
192
+ on_empty_message: "specs/ already has a spec.md for {{feature_name}} — adopt is a one-time baseline. For a change to an adopted slice use the CR delta loop (/appweaver specify → design → analyze-delta-design → implement-delta → build → finalize-delta → analyze-slice → close-delta); to re-adopt from scratch, remove the feature dir first."
193
+
194
+ # 1b. Resolve this aggregate's OKF bundle concept → its source_files (the code
195
+ # that IS the slice) + module dir. The INDEX adopt reverse-engineers FROM;
196
+ # the code itself is the source of truth (read during authoring).
197
+ - id: concept
198
+ action: execute_script
199
+ script: { ref: inventory }
200
+ subcommand: concept
201
+ args: ["--bundle", "{{bundle_dir}}", "--aggregate", "{{feature_name}}"]
202
+ outputs:
203
+ - { name: concept_exists, from: "$.exists" }
204
+ - { name: concept_path, from: "$.concept_path" }
205
+ - { name: source_files, from: "$.source_files" }
206
+ - { name: source_count, from: "$.count" }
207
+ - { name: module_dir, from: "$.module_dir" }
208
+ # The slice's FRONTEND surface, listed apart from source_files so each lane's
209
+ # reverse step reads its own code. Empty on a backend-only slice.
210
+ - { name: ui_source_files, from: "$.ui_source_files" }
211
+ - { name: ui_count, from: "$.ui_count" }
212
+
213
+ # No feature-map concept for this name means one of two things, both handled by a
214
+ # redirect (adopt reverses EXISTING code only): either onboard has not run, or this
215
+ # is a NEW feature (no existing code) — which is developed via the forward pipeline,
216
+ # not adopt.
217
+ - id: require_concept
218
+ action: verify_context
219
+ require_true: concept_exists
220
+ on_false: stop
221
+ on_false_message: "No feature '{{feature_name}}' in the onboard feature map under {{bundle_dir}}. If you have not onboarded, run /appweaver onboard first, then use the exact feature name from {{bundle_dir}}/aggregates/index.md. If '{{feature_name}}' is a NEW feature (no existing code), do NOT adopt it — author it through the forward pipeline (/appweaver specify → design → implement), which onboard already made brownfield-ready."
222
+
223
+ # Governance prerequisite: the reverse steps below are authored AGAINST the project
224
+ # onboard established (the constitution halves + guardrails/projects/<project>/ rule set).
225
+ # Resolve the active domain now and require its rule map to exist — without it there is
226
+ # no code-derived rule set for tech_select to load, no domain frame for the reversed
227
+ # spec, and nothing for the reconcile block to upgrade when it is enabled. Reconciling
228
+ # into a project scaffold, never authoring from one feature, is what keeps the
229
+ # constitution PROJECT-scoped (gap-fix #1).
230
+ - id: resolve_active_domain
231
+ action: execute_script
232
+ script: { ref: actions }
233
+ subcommand: resolve-domain
234
+ outputs:
235
+ - { name: gov_domain, from: "$.domain" }
236
+ - { name: rulemap_exists, from: "$.rulemap_exists" }
237
+
238
+ - id: require_governance
239
+ action: verify_context
240
+ require_true: rulemap_exists
241
+ on_false: stop
242
+ on_false_message: "No active governance for adopt to work against — run /appweaver onboard first. onboard establishes the PROJECT constitution + guardrails/projects/<project>/ rule set (provisional-from-scan) and activates it. Reversing '{{feature_name}}' without that scaffold would author the spec and design against no code-derived rules at all, and leave them with no governance home."
243
+
244
+ # 2. Scaffold the living docs. The SPEC reuses the forward spec-template (it is
245
+ # tech-agnostic WHAT/WHY — no architectural bias). The DESIGN scaffolds from the
246
+ # DEFAULT `design-template` — which /appweaver onboard REPLACED with the repo's
247
+ # code-derived override (resolve_template Priority-1, reverse-engineered from the
248
+ # code), so the reversed design's structural sections follow the code's own
249
+ # architecture rather than a fixed greenfield layering, describing the system
250
+ # as-built. (Falls back to the greenfield base if onboard has not run.) Both are
251
+ # still normal forward docs (same identity + spine) that the CR delta loop consumes
252
+ # unchanged. Then init active_version.json (v1.0).
253
+ - id: scaffold_spec
254
+ action: execute_script
255
+ script: { ref: actions }
256
+ subcommand: scaffold
257
+ args: ["--feature-dir", "{{feature_dir}}", "--allow-existing"]
258
+
259
+ - id: scaffold_design
260
+ action: execute_script
261
+ script: { ref: actions }
262
+ subcommand: design-scaffold
263
+ args: ["--feature-dir", "{{feature_dir}}"] # default `design-template` = onboard's code-derived override (greenfield base if onboard has not run)
264
+ outputs:
265
+ - { name: design_doc, from: "$.design_doc" }
266
+
267
+ - id: version_init
268
+ action: execute_script
269
+ script: { ref: actions }
270
+ subcommand: version-init
271
+ args: ["--feature-dir", "{{feature_dir}}"]
272
+
273
+ # 2b. DOES THIS SLICE HAVE A UI HALF? Two conditions, and both are necessary.
274
+ # A frontend lane must be DECLARED (stacks.json — select-stack is its sole
275
+ # writer, and onboard authored the lane's governance off the same declaration),
276
+ # and THIS aggregate must actually own UI files (the concept's ui_source_files,
277
+ # attributed by the scan). A declared lane whose surface this slice does not
278
+ # touch reverses a service half only — a shared-kernel or job-only slice in a
279
+ # repo that has a UI is the ordinary case, not an omission.
280
+ # The engine has no compound conditions, so this is three ordered sets: off,
281
+ # on where the lane is declared, off again where this slice has no surface.
282
+ - id: lane_readback
283
+ action: execute_script
284
+ on_error: continue
285
+ script: { ref: actions }
286
+ subcommand: lane-resolve
287
+ outputs:
288
+ - { name: fe_declared, from: "$.frontend_declared" }
289
+ - { name: fe_root, from: "$.frontend_root" }
290
+ - id: ui_lane_off
291
+ action: set
292
+ vars: { ui_lane: "false" }
293
+ - id: ui_lane_on
294
+ action: set
295
+ condition: "{{fe_declared}}"
296
+ vars: { ui_lane: "true" }
297
+ - id: ui_lane_no_surface
298
+ action: set
299
+ condition: "{{ui_count}} == 0"
300
+ vars: { ui_lane: "false" }
301
+
302
+ # Scaffold the LANE's design doc from ITS template pair (--lane ui resolves
303
+ # ui-design-template -> design.ui.md), the twin of scaffold_design above. onboard
304
+ # GENERATED that override from this repo's own UI source, so the reversed UI design
305
+ # follows the code's real composition axes rather than a fixed screen taxonomy.
306
+ - id: scaffold_ui_design
307
+ condition: "{{ui_lane}} == true"
308
+ action: execute_script
309
+ script: { ref: actions }
310
+ subcommand: design-scaffold
311
+ args: ["--feature-dir", "{{feature_dir}}", "--lane", "ui"]
312
+ outputs:
313
+ - { name: ui_design_doc, from: "$.design_doc" }
314
+ - { name: ui_tpl_source, from: "$.template_source" }
315
+ - { name: ui_tpl_override, from: "$.override_active" }
316
+
317
+ # A reverse needs the CODE-DERIVED template, not any template. The kit ships a
318
+ # greenfield ui-design-template for the forward `design-ui` phase, so the template
319
+ # always resolves and its presence proves nothing — override_active is the signal
320
+ # that asks the real question: did onboard generate this repo's own UI structure?
321
+ # Without it the lane was declared after onboard ran, so the UI governance this
322
+ # reverse authors against does not exist yet, and the greenfield section list would
323
+ # impose a screen taxonomy on code that has its own. Stop instead, the same call
324
+ # onboard's own verify_ui_design_template makes.
325
+ - id: require_ui_template
326
+ condition: "{{ui_lane}} == true"
327
+ action: verify_context
328
+ require_true: ui_tpl_override
329
+ on_false: stop
330
+ on_false_message: "A frontend lane is declared ({{fe_root}}) and '{{feature_name}}' owns {{ui_count}} UI file(s), but no CODE-DERIVED UI design template is installed at .appweaver/templates/overrides/ui-design-template.md — only the kit's greenfield template, which would impose a section structure this app's UI did not choose. onboard GENERATES the override from the UI source — declare the lane with /appweaver select-stack and re-run /appweaver onboard, then adopt this feature again."
331
+
332
+ # 3. Pre-execution hooks.
333
+ - id: resolve_pre_hooks
334
+ action: execute_script
335
+ script: { ref: actions }
336
+ subcommand: resolve-hooks
337
+ args: ["--phase", "before_adopt"]
338
+ outputs:
339
+ - { name: before_hooks, from: "$.hooks" }
340
+ - id: dispatch_pre_hooks
341
+ action: dispatch_hooks
342
+ hooks_from_variable: before_hooks
343
+
344
+ # ══════════════ REVERSE SPEC — from CODE, in the template's vocabulary ══════
345
+ # The bundle concept is the INDEX (source_files, seam, open_questions); the
346
+ # CODE is the source of truth. The scaffolded template carries the modelling
347
+ # vocabulary itself — Aggregate Boundary, Key Entities, Business Rules — already
348
+ # technology-agnostic, so nothing further is needed to classify what the code
349
+ # shows. NO modelling rule file is loaded: a prescriptive one states what code
350
+ # OUGHT to be, and this step's oracle is what it IS. A legacy slice that is
351
+ # anemic, or models nothing at all, must reverse as exactly that. The two
352
+ # constitution halves it DOES load pass that same test: onboard reversed both
353
+ # out of THIS code, so they describe the repo rather than prescribe to it.
354
+ - id: ctx_reverse_spec
355
+ action: build_context
356
+ context:
357
+ - { path: "{{spec_file}}" } # the scaffolded template = section structure + the modelling vocabulary
358
+ - { path: "{{concept_path}}" } # the OKF concept: source_files, seam, open_questions
359
+ - { path: .appweaver/memory/constitution.domain.md, optional: true } # the domain frame
360
+ - { path: .appweaver/memory/constitution.ui.md, optional: true } # the frontend lane's UX-* base — absent on a backend-only repo, which onboard leaves unwritten by design
361
+ - id: reverse_spec
362
+ action: agent_author
363
+ include_standards: false # the technical/arch sticky set is for design, never the spec
364
+ output_target: { type: file, path: "{{spec_file}}" }
365
+ task: |
366
+ Reverse-engineer the MASTER specification (the target spec.md in context)
367
+ for the aggregate '{{feature_name}}' FROM ITS CODE. The bundle concept (in
368
+ context) is the INDEX — its `source_files` list the code that IS this slice;
369
+ READ those files (under {{module_dir}}, listed below) as the SOURCE OF TRUTH.
370
+ The concept is a summary; the CODE is authoritative — if they disagree, the
371
+ code wins (and note the drift). Fill the template; preserve its section order.
372
+
373
+ Capture what the code ACTUALLY DOES, as-built (bugs/quirks included), in the
374
+ template's vocabulary:
375
+ - The feature IS the aggregate; set the Aggregate field, keep US-1.
376
+ - Each command / endpoint / use-case the code exposes is a USER STORY (US-n),
377
+ never a separate feature. Derive its Given/When/Then from the code's paths.
378
+ - System Requirements in EARS (THE SYSTEM SHALL / WHEN / IF…THEN / WHILE /
379
+ WHERE), each atomic + testable, derived from observed behaviour.
380
+ - Always-true invariants the code enforces → Business Rules (BR-n).
381
+ - MODEL IN THE TEMPLATE'S OWN VOCABULARY: a ubiquitous language, the
382
+ aggregate + its root, entities vs value objects, aggregate-owned
383
+ invariants — as domain MODEL, never as the language's own types.
384
+ Classify from what the code EXHIBITS. A distinction the code does not
385
+ draw is not a gap to fill in: record the model as-built, however thin.
386
+ - DOMAIN LIFT — where the CODE enforces them, lift into the three sections
387
+ (cite the source file): Constraints & NFRs (CN-, e.g. retention /
388
+ immutability / append-only audit the code implements), Data Classification
389
+ (DC-, sensitive fields + where they may/mustn't appear), Integration
390
+ Contracts (IC-, external services/feeds the code calls). "None (as of v1.0)"
391
+ if the code shows none — never delete a section.
392
+ - EXPERIENCE LIFT — only where this slice HAS a UI. Fill Experience Scope from
393
+ the surface the code exposes (UI actors, channels, and the device / browser /
394
+ assistive-technology floors the UI source actually targets), and lift the
395
+ project-wide standards that UI already holds into Experience Standards (UX-n),
396
+ citing constitution.ui.md's UX-* principle (in context where a lane exists) and
397
+ the source file. A UX-n is checkable on ANY surface — accessibility, interaction
398
+ states, content, journey integrity, responsiveness-as-a-limit — never a screen,
399
+ page, layout or component; a per-story behaviour stays FR-, a bound the SERVICE
400
+ meets stays CN-. Lift only what the UI code EXHIBITS: an unevidenced UX- is a
401
+ fabricated spec id and the fidelity gate scores it as one. No UI in this slice
402
+ (or no constitution.ui.md): "None (as of v1.0)" in BOTH sections — never delete
403
+ either.
404
+ - Always include "## Success Criteria" with 2-4 measurable SC-nnn.
405
+
406
+ PROVENANCE + honesty (this is a REVERSED spec):
407
+ - Add `origin: reverse-engineered` to the spec's identity block (near Version).
408
+ - Mark CONFIDENCE: where you had to INFER intent the code does not state
409
+ outright, tag the item "(inferred)" and add a `[NEEDS CLARIFICATION: …]`
410
+ marker (at most 3, highest-impact) or an Assumption — NEVER fabricate a
411
+ rule the code does not exhibit. Behaviour that is clearly present is
412
+ "(certain)".
413
+ - Reference the source-map: note that legacy-artefact ↔ requirement links
414
+ live in `specs/{{feature_name}}/source-map.md` (authored next).
415
+ - This is v1.0: fill the Change History row; keep US-1's "Added: v1.0".
416
+ - Business-facing + testable; NO implementation mechanics (an external interop
417
+ OBLIGATION is an IC- requirement, never the adapter design).
418
+
419
+ Source files to read (the slice's code): {{source_files}}
420
+
421
+ # ═══════════ REVERSE DESIGN — from the reversed SPEC + CODE, AS-BUILT ═══════
422
+ # Anchored to the reversed spec's ids (§4 Traceability → forward-compatible),
423
+ # grounded in the code's ACTUAL structure, tech-agnostic. NO domain files (rule
424
+ # partition). The scaffolded design.md IS onboard's code-derived `design-template`
425
+ # override — its §2 component sections follow the code's own folders/modules, not a
426
+ # fixed layering.
427
+ - id: ctx_reverse_design
428
+ action: build_context
429
+ context:
430
+ - { path: "{{design_doc}}" } # the scaffolded code-derived template = structure + embedded guidance
431
+ - { path: "{{spec_file}}" } # the reversed spec = the ONLY domain input
432
+ - { path: "{{concept_path}}" } # source_files + seam (structure hints)
433
+ - { path: .appweaver/DESIGN-FORMAT.md } # the HLD contract (see its Brownfield variant note)
434
+ - { path: "{{bundle_dir}}/architecture/overview.md", optional: true } # the as-built architecture (inventory) — cite, don't re-derive
435
+ - { path: .appweaver/memory/constitution.technical.md, optional: true } # technology base ONLY — no domain
436
+ - id: reverse_design
437
+ action: agent_author
438
+ include_standards: true # the technical/architecture sticky set (reference only — the CODE wins)
439
+ output_target: { type: file, path: "{{design_doc}}" }
440
+ task: |
441
+ Reverse-engineer the MASTER high-level design (the target design.md in
442
+ context — it is the BROWNFIELD design template) — the tech-agnostic HLD that
443
+ MEDIATES the reversed spec ↔ the existing code. Ground every element in the
444
+ CODE (read the source files listed below) but ANCHOR each to a spec id from
445
+ the reversed spec (in context) so §4 Traceability is complete and the doc is
446
+ forward-compatible. Guidance: {{feature_name}}
447
+
448
+ THE CODE IS THE SOURCE OF TRUTH — describe the system AS-BUILT. Do NOT reshape
449
+ it toward any reference architecture; the technical standards in context are a
450
+ vocabulary to NAME what you find, never a target to bend the code toward.
451
+ Rules:
452
+ - THE SPEC IS THE ONLY DOMAIN INPUT. You have the reversed spec + the code's
453
+ actual STRUCTURE — and NO domain rule files. Realise the spec ids; introduce
454
+ no domain rule the spec omits. A concept the code exhibits but the spec lacks
455
+ → surface it (it belongs in the spec) and record a §5 DA-n; do not smuggle it in.
456
+ - STRUCTURE FOLLOWS THE CODE. Fill §1.1 As-Built Architecture from the code's
457
+ real shape (its folders / projects / modules — name the style, don't prescribe
458
+ one). Then create ONE §2 subsection per structural axis the slice's code
459
+ ACTUALLY has (its use-cases, endpoints/UI, persistence, external adapters,
460
+ jobs, host/composition) — titled after the CODE's own units, NOT a fixed
461
+ Domain/Application/API/Infrastructure layering. A component the code has that
462
+ fits no textbook layer (a UI tier, a worker, a shared library) gets its own
463
+ section; a layer the code lacks does NOT appear.
464
+ - KEEP THE NEUTRAL ANCHORS (the template pins these): §1.2 is the domain/data
465
+ MODEL and MUST match the spec's Key Entities / Business Rules (same names,
466
+ cite BR-/CN-) with cross-slice References-by-id kept here; one §2 subsection
467
+ is the EXTERNAL INTEGRATIONS table (heading contains "Integration") realising
468
+ the spec's IC-. Realise CN- (structural → §1.2 invariants/events; retention/
469
+ audit → §2 persistence / §3 cross-cutting), DC- (§3 + projection surface).
470
+ - AS-BUILT DEBT, not architecture drift. §6 records ONLY debt the CODE ITSELF
471
+ evidences — stubs/no-ops, dead or duplicate code, torn seams (shared table/
472
+ transaction), TODOs, hard-coded values. The code being organised differently
473
+ from any textbook layering is NOT debt — it is the as-built architecture (§1.1).
474
+ The concrete stack lives in the source-map, NOT here.
475
+ - TECHNOLOGY-AGNOSTIC: signatures + pre/post/invariant/raises pseudocode and
476
+ field-shape contracts — NEVER language code. Conceptual types only.
477
+ - Fill §4 Traceability completely (a row for EVERY FR/BR/CN/DC/IC/US/SC), and
478
+ the §5 Assumptions (DA-n) / §6 As-Built Deviations (WA-n) ledgers.
479
+ - Add `origin: reverse-engineered` near the Version field. This is v1.0.
480
+ - Omit a section only if the slice genuinely has nothing there (say why); no
481
+ complete code anywhere.
482
+
483
+ Source files to read (the slice's code): {{source_files}}
484
+
485
+ # ═══════ REVERSE UI DESIGN — the LANE's half, from the UI code, AS-BUILT ═══
486
+ # Runs only where this slice HAS a surface (ui_lane). The service design above is
487
+ # NOT its parent: design.md realises the spec's FR/BR/CN-, design.ui.md realises the
488
+ # spec's UX- and the user stories' interaction, and it CONSUMES design.md's contracts
489
+ # rather than restating them. Both are in context for exactly that reason.
490
+ - id: ctx_reverse_ui_design
491
+ condition: "{{ui_lane}} == true"
492
+ action: build_context
493
+ context:
494
+ - { path: "{{ui_design_doc}}" } # the scaffolded code-derived lane template = structure + embedded guidance
495
+ - { path: "{{spec_file}}" } # the reversed spec — UX- + the user stories this surface serves
496
+ - { path: "{{design_doc}}" } # the service design — the contracts the UI consumes, never re-specified here
497
+ - { path: .appweaver/memory/constitution.ui.md, optional: true } # the lane's UX-* base, reversed by onboard from this same UI
498
+ - { path: "{{bundle_dir}}/architecture/frontend.md", optional: true } # the as-built UI architecture + the SHARED surface no slice owns
499
+ - id: reverse_ui_design
500
+ condition: "{{ui_lane}} == true"
501
+ action: agent_author
502
+ include_standards: true # the lane's sticky technical set (reference only — the CODE wins)
503
+ output_target: { type: file, path: "{{ui_design_doc}}" }
504
+ task: |
505
+ Reverse-engineer the FRONTEND LANE's high-level design (the target design.ui.md
506
+ in context — it is this project's code-derived UI design template) for the
507
+ aggregate '{{feature_name}}', FROM ITS UI CODE. Fill the template; preserve its
508
+ section order.
509
+
510
+ THE UI CODE IS THE SOURCE OF TRUTH — describe the surface AS-BUILT, quirks
511
+ included. The standards in context are a vocabulary to NAME what you find, never
512
+ a target to bend it toward. An inconsistent app is recorded as inconsistent; a
513
+ surface with no loading states is recorded as having none, NEVER as needing them.
514
+ Rules:
515
+ - STAY IN THE LANE. Realise the spec's Experience Standards (UX-) and the
516
+ interaction its User Stories imply. The service design (in context) supplies
517
+ the CONTRACTS this surface consumes — cite them; do NOT restate, re-derive or
518
+ contradict them, and introduce no server-side behaviour here.
519
+ - STRUCTURE FOLLOWS THE UI CODE. Fill each section from the lane's real shape —
520
+ its actual routes and screens, its own composition axes (however it groups
521
+ components), where client state and server data-fetching really live, its
522
+ styling and any design-system in use. A section the slice genuinely has
523
+ nothing for says so and says why; do not invent a screen the code lacks.
524
+ - §7 TRACEABILITY IS THE SPINE: a row for every UX- this surface realises and
525
+ every US- it serves. A UX- in the spec with NO home here is a gap — record it
526
+ as a deviation (WA-n), never a fabricated screen. An element with no spec
527
+ basis is drift: surface it and log a DA-n.
528
+ - The SHARED surface (app shell, layout, design system, global styles) belongs to
529
+ no slice — it is recorded in the bundle's architecture/frontend.md (in context
530
+ where it exists). CITE it; do not copy it in and do not claim it here.
531
+ - Add `origin: reverse-engineered` near the Version field. This is v1.0.
532
+ - Conceptual only — component/state/route CONTRACTS and their shapes, NEVER
533
+ language code, and no complete component anywhere.
534
+
535
+ UI source files to read (this slice's surface): {{ui_source_files}}
536
+
537
+ # ═══════════════ SOURCE MAP — the source anchor sidecar ════════════════════
538
+ - id: ctx_source_map
539
+ action: build_context
540
+ context:
541
+ - { path: .appweaver/templates/source-map-template.md } # the sidecar structure
542
+ - { path: "{{spec_file}}" }
543
+ - { path: "{{design_doc}}" }
544
+ - { path: "{{ui_design_doc}}", optional: true } # the lane's design, where this slice has one
545
+ - { path: "{{concept_path}}" } # both file lists to map
546
+ - id: source_map
547
+ action: agent_author
548
+ include_standards: false
549
+ output_target: { type: file, path: "{{feature_dir}}/source-map.md" }
550
+ task: |
551
+ Author the source-map sidecar (the target in context) from the template,
552
+ for aggregate '{{feature_name}}'. It is the SOURCE ANCHOR of the traceability
553
+ spine — it keeps spec.md / design.md clean while recording provenance here.
554
+ - One row per legacy artefact in the bundle concept's `source_files` (read
555
+ them under {{module_dir}}): map each to the spec ids (FR/BR/US/CN/DC/IC)
556
+ and the design element (§/name) that now describe it, with CONFIDENCE
557
+ (certain | inferred). EVERY source file MUST appear — the Fidelity gate
558
+ checks full coverage both ways.
559
+ - Where this slice has a UI half, its files map the same way, to the UX-/US-
560
+ they realise and the design.ui.md section (§/name) that describes them —
561
+ one spine, both lanes. UI files to map: {{ui_source_files}}
562
+ - Also map DB tables, endpoints, and background jobs the slice owns.
563
+ - Fill the Seam section: the boundary this slice owns (endpoint / table
564
+ owner / queue / interface), and note whether it is self-contained or SHARES
565
+ a transaction/table with another slice — a coupling fact for CR blast-radius
566
+ analysis (not a migration item).
567
+ - Record as-built quirks captured verbatim (candidate deviations), and any
568
+ unmapped code / unanchored spec ids.
569
+ - Baseline commit = the inventory HEAD.
570
+ Source files to map: {{source_files}}
571
+
572
+ # ═══════════════ FIDELITY — does spec+design describe the CODE? ═════════════
573
+ # spec/design ↔ CODE (NOT spec ↔ design). The agent can READ the source files.
574
+ # BLOCKING gaps = unmapped code / fabricated spec-or-design (structural). The
575
+ # rest (inferred items, quirks, missing-invariant candidates) are REVIEW items
576
+ # → written to an Adopt Review report and closed OUT OF BAND (Brownfield B1·R).
577
+ - id: fidelity
578
+ action: agent_query
579
+ context:
580
+ - "{{spec_file}}"
581
+ - "{{design_doc}}"
582
+ - { path: "{{ui_design_doc}}", optional: true } # the lane's design, where this slice has one
583
+ - "{{feature_dir}}/source-map.md"
584
+ - "{{concept_path}}"
585
+ include_standards: false
586
+ schema: { ok: true, report_needed: false, blocking_gaps: [ { severity: "high", artefact: "<source file / spec id / design element>", kind: "unmapped-code | fabricated-spec | fabricated-design", detail: "<why>" } ], review_items: [ { kind: "inferred | as-built-quirk | missing-invariant | confidence", where: "<spec/design/source-map location>", note: "<what to confirm out of band>" } ] }
587
+ mock: { ok: true, report_needed: false, blocking_gaps: [], review_items: [] }
588
+ task: |
589
+ FIDELITY CHECK — do the reversed documents actually describe the CODE
590
+ (spec/design ↔ CODE, NOT spec ↔ design)? Use the source-map (in context) and
591
+ READ the slice's source files (the concept's `source_files`, under
592
+ {{module_dir}}). Where design.ui.md is in context, it is judged the same way
593
+ against the slice's UI files ({{ui_source_files}}) — a screen, state store or
594
+ route it describes that the UI code does not have is a fabricated-design, and a
595
+ UI file with no home in the source-map is unmapped-code. Classify findings:
596
+ - BLOCKING (structural — set ok=false if any):
597
+ (1) unmapped-code: a source file with NO spec/design home in the source-map;
598
+ (2) fabricated-spec / fabricated-design: a spec id or design element with NO
599
+ basis in the code (reverse-engineering must not invent behaviour).
600
+ - REVIEW (does NOT block ok — these are the Adopt review worklist, closed out
601
+ of band): items marked "(inferred)"; as-built quirks the code shows but the
602
+ spec under-states; invariants the code enforces that may be missing/weak;
603
+ confidence miscalibration (marked inferred but clearly certain, or vice versa).
604
+ Set ok=true when there are NO blocking gaps (review_items may still be listed).
605
+ Set report_needed=true if there is ANY blocking gap OR any review item.
606
+ outputs:
607
+ - { name: fidelity_ok, from: "$.ok" }
608
+ - { name: report_needed, from: "$.report_needed" }
609
+ - { name: blocking_gaps, from: "$.blocking_gaps" }
610
+ - { name: review_items, from: "$.review_items" }
611
+
612
+ # Write the Adopt Review report when there's anything to close out of band
613
+ # (blocking gaps to fix, or review items to confirm). The B1·R worklist.
614
+ - id: write_review_report
615
+ condition: "{{report_needed}} == true"
616
+ action: agent_author
617
+ include_standards: false
618
+ context: ["{{spec_file}}", "{{design_doc}}", "{{feature_dir}}/source-map.md"]
619
+ output_target: { type: file, path: "{{feature_dir}}/adopt-review-report.md" }
620
+ task: |
621
+ Write an Adopt Review report (the target) for aggregate '{{feature_name}}' —
622
+ the out-of-band worklist for this reverse-engineered baseline. Markdown:
623
+ - "# Adopt Review — {{feature_name}}" + today's date + "origin: reverse-engineered".
624
+ - "verdict:" line — "BLOCKING ✗ · <n>" if blocking gaps exist, else "REVIEW ○ · <m> item(s)".
625
+ - "## Blocking gaps" (if any): table | # | kind | artefact | detail | — MUST be
626
+ resolved before the slice is trustworthy (fix by re-reading the code / refining
627
+ spec+design, then re-run adopt-review or re-adopt).
628
+ Blocking gaps: {{blocking_gaps}}
629
+ - "## Review items" (close out of band): table | # | kind | where | confirm |.
630
+ These are inferred-vs-certain calls, as-built quirks, and missing-invariant
631
+ candidates — confirm each against the code/SME, then fold the answer into
632
+ spec.md (a resolved [NEEDS CLARIFICATION] / Assumption) or log a deviation.
633
+ Review items: {{review_items}}
634
+ - "## How to proceed": resolve blocking gaps first; then the slice is a normal
635
+ feature — run /appweaver analyze-design (spec↔design gate) if desired, then
636
+ drive every change through the CR delta loop. If a change edits untested legacy
637
+ behaviour with blast radius, characterize just that surface first (optional
638
+ on-touch fence) — it is not a required phase.
639
+ Return the report markdown only.
640
+
641
+ - id: fidelity_gate
642
+ action: verify_context
643
+ require_true: fidelity_ok
644
+ on_false: stop
645
+ on_false_message: "Fidelity FAILED for {{feature_name}} — the reversed spec/design do not match the code (blocking gaps: {{blocking_gaps}}). See specs/{{feature_name}}/adopt-review-report.md. Fix the unmapped code / remove fabricated items (re-read the source, refine spec.md + design.md + source-map.md), then re-run /appweaver adopt (after removing the dir) or resolve out of band."
646
+
647
+ # ═══════════ OKF CONCEPT — COMPLETE the shallow scan concept (deep reverse) ═══
648
+ # onboard wrote this aggregate's OKF concept SHALLOW (a discovery stub — enough to pick the
649
+ # feature). Now that the deep reverse produced a TRUSTWORTHY spec.md + design.md +
650
+ # source-map.md, COMPLETE the concept: deepen its detail to the reversed reality, LINK the
651
+ # authored artifacts, refresh source_files, and mark it ADOPTED. RECONCILE, not rewrite —
652
+ # keep OKF format + the bundle links; do NOT touch the Depends-On / Cross-References
653
+ # sections (xref_record owns those, next). Runs only after fidelity passes (deepened from
654
+ # trustworthy docs). The complement of the governance reconcile below — the DISCOVERY tier
655
+ # (OKF) is completed here, the GOVERNANCE tier (constitution + rule set) just after.
656
+ - id: ctx_complete_concept
657
+ action: build_context
658
+ context:
659
+ - { path: "{{concept_path}}" } # the shallow onboard concept to complete
660
+ - { path: "{{spec_file}}" } # the deep reversed spec (entities, US, BR/CN/DC/IC)
661
+ - { path: "{{design_doc}}" } # the deep reversed design (components, ports, integrations)
662
+ - { path: "{{feature_dir}}/source-map.md" } # the source anchor (files, seam, quirks)
663
+ - { path: .appweaver/templates/okf-concept-template.md } # OKF v0.1 format authority
664
+ - id: complete_concept
665
+ action: agent_generate
666
+ tools: "Read,Write,Edit"
667
+ permission_mode: acceptEdits
668
+ task: |
669
+ COMPLETE the OKF aggregate concept for '{{feature_name}}' at {{concept_path}} — onboard
670
+ wrote it SHALLOW (a discovery stub from the whole-repo scan). The deep reverse has now
671
+ produced a TRUSTWORTHY spec.md + design.md + source-map.md (in context); deepen the
672
+ concept to match and LINK those artifacts. Follow the OKF concept template in context.
673
+ RECONCILE, do NOT rewrite:
674
+ - DEEPEN the responsibilities + the owned entities / value objects / domain events /
675
+ commands (user stories) / API endpoints / persistence to match the reversed spec +
676
+ design — correct any drift the shallow scan got wrong (the deep docs win).
677
+ - LINK the deep artifacts: add bundle links to specs/{{feature_name}}/spec.md, design.md,
678
+ and source-map.md so the concept points at the deep truth.
679
+ - Refresh `source_files` from the source-map (grouped by the code's OWN folders, per
680
+ OKF), and set `timestamp` to the baseline (inventory HEAD) commit time.
681
+ - Update frontmatter: keep `origin: reverse-engineered`; mark the concept ADOPTED /
682
+ deep-reversed (no longer a shallow scan stub) and stamp `generated_by: aw-spec-adopt`.
683
+ - Resolve any `open_questions` the deep reverse answered; keep the rest.
684
+ - Do NOT touch the concept's Depends-On / Cross-References sections (xref_record
685
+ maintains those next), and do NOT edit any OTHER aggregate concept.
686
+ Append a one-line `log.md` entry (bundle root) under today's date noting '{{feature_name}}'
687
+ was deep-adopted. Write ONLY {{concept_path}} (+ its dir index.md / bundle log.md if a
688
+ link or description changed). Report what you deepened.
689
+ outputs:
690
+ - { name: concept_completed, from: "$.files" }
691
+
692
+ # 3b. OKF cross-references (brownfield seed). The reversed design.md now names this
693
+ # slice's cross-aggregate references (§1 References-by-id) + integration contracts
694
+ # (its External integrations table, IC-); record them into the shared OKF bundle — a
695
+ # Cross-References row in every
696
+ # SIBLING aggregate this slice uses (their inventory concepts already exist, so this
697
+ # resolves them rather than stubbing), plus this slice's own Depends-On. Same
698
+ # reconcile-on-write helper as forward implement, stamped origin reverse-engineered,
699
+ # additive to the inventory bundle. Runs only after fidelity passes.
700
+ - id: xref_record
701
+ action: execute_script
702
+ script: { ref: xref }
703
+ subcommand: record
704
+ args: ["--using", "{{feature_name}}", "--design", "{{design_doc}}", "--bundle", "{{bundle_dir}}", "--origin", "reverse-engineered"]
705
+ outputs:
706
+ - { name: xref_wrote, from: "$.wrote" }
707
+ - { name: xref_edge_count, from: "$.edge_count" }
708
+
709
+ # ═══════════ GOVERNANCE RECONCILE — upgrade onboard's PROVISIONAL scaffold ═══
710
+ # ⏸ HELD 2026-07-29: every step in this block is gated on `reconcile_governance`
711
+ # (default "false"), so adopt currently does NOT touch the constitution halves
712
+ # or the guardrails/projects/<project>/ rule set — onboard's provisional scaffold
713
+ # is left as-is. Flip the var to "true" (workflow vars) to restore the behaviour.
714
+ # Now that this feature is reversed to a TRUSTWORTHY spec (real BR-/CN-/DC-/IC- ids)
715
+ # + design (real code coordinates), reconcile that evidence INTO the governance
716
+ # onboard established. RECONCILE, NOT re-author: fill provisional entries with this
717
+ # feature's real ids; NEVER rewrite the project's principle set or another feature's
718
+ # evidence. Runs only after fidelity passes (governance derived from trustworthy docs).
719
+ # setup-constitution is idempotent (returns the paths without clobbering onboard's
720
+ # content). compose-constitution re-renders the human view.
721
+ - id: setup_constitution
722
+ condition: "{{reconcile_governance}} == true" # HELD — governance reconcile paused (see vars)
723
+ action: execute_script
724
+ script: { ref: actions }
725
+ subcommand: setup-constitution
726
+ outputs:
727
+ - { name: constitution_technical_file, from: "$.constitution_technical_file" }
728
+ - { name: constitution_domain_file, from: "$.constitution_domain_file" }
729
+
730
+ # RECONCILE the domain rule-file set with THIS feature's real ids.
731
+ - id: ctx_reconcile_pack
732
+ condition: "{{reconcile_governance}} == true" # HELD — governance reconcile paused (see vars)
733
+ action: build_context
734
+ context:
735
+ - { path: "{{spec_file}}" } # the feature's real BR-/CN-/DC-/IC-
736
+ - { path: "{{design_doc}}" }
737
+ - { path: "{{feature_dir}}/source-map.md" }
738
+ - { path: "guardrails/projects/{{gov_domain}}/domain-rule-bindings.md", optional: true }
739
+ - { path: .appweaver/RULE-PARTITION.md } # the rule-partition authority (which command reads what)
740
+ - id: reconcile_pack
741
+ condition: "{{reconcile_governance}} == true" # HELD — governance reconcile paused (see vars)
742
+ action: agent_generate
743
+ tools: "Read,Write,Edit"
744
+ permission_mode: acceptEdits
745
+ task: |
746
+ RECONCILE the domain rule-file set in guardrails/projects/{{gov_domain}}/domain/ with the
747
+ newly-adopted feature '{{feature_name}}'. onboard authored these rule files from the
748
+ whole-repo scan with per-feature specifics marked `PROVISIONAL — reconciled at
749
+ adopt`. READ this feature's reversed spec.md + design.md + source-map.md (in
750
+ context — the real evidence) and the EXISTING rule files under
751
+ guardrails/projects/{{gov_domain}}/.
752
+
753
+ RECONCILE, do NOT re-author:
754
+ - UPGRADE the provisional entries this feature now evidences: replace a
755
+ `PROVISIONAL` placeholder with the concrete rule, CITING the feature's real spec
756
+ ids (BR-/CN-/DC-/IC-/FR-). Leave provisional entries this feature does NOT touch
757
+ as they are — a later adopt reconciles them.
758
+ - ADD a `<concern>.domain.md` rule file ONLY if this feature evidences a concern the
759
+ the set has none for, and wire it into domain-rule-bindings.md under the correct partition
760
+ heading. If a rule file already covers the concern, MERGE this feature's evidence
761
+ into it — do NOT duplicate.
762
+ - Do NOT rewrite the set, re-scope it to this one aggregate, or remove another
763
+ feature's evidence. The set stays PROJECT-level; this feature is new evidence in it.
764
+ - Preserve the RULE PARTITION in domain-rule-bindings.md (constitution / specify / gate get
765
+ the domain files; design / implement get None). Keep each file's frontmatter and
766
+ note in `generated_by` that adopt reconciled '{{feature_name}}'.
767
+ Write ONLY inside guardrails/projects/{{gov_domain}}/. Report the files changed/added.
768
+ outputs:
769
+ - { name: pack_reconciled, from: "$.files" }
770
+
771
+ # RECONCILE the TECHNICAL constitution: ground provisional principles in this feature's
772
+ # real CODE COORDINATES (from the source-map). Domain-free.
773
+ - id: ctx_reconcile_technical
774
+ condition: "{{reconcile_governance}} == true" # HELD — governance reconcile paused (see vars)
775
+ action: build_context
776
+ context:
777
+ - { path: "{{constitution_technical_file}}" }
778
+ - { path: "{{design_doc}}" }
779
+ - { path: "{{feature_dir}}/source-map.md" }
780
+ - id: reconcile_technical
781
+ condition: "{{reconcile_governance}} == true" # HELD — governance reconcile paused (see vars)
782
+ action: agent_author
783
+ include_standards: false
784
+ output_target: { type: file, path: "{{constitution_technical_file}}" }
785
+ task: |
786
+ RECONCILE the TECHNICAL constitution (target in context) with the adopted feature
787
+ '{{feature_name}}'. onboard discovered the technology principle SET from the scan and
788
+ marked per-feature code coordinates `PROVISIONAL`. READ this feature's design.md +
789
+ source-map.md (in context — the code-coordinate bridge: real file paths / type names).
790
+
791
+ RECONCILE, do NOT re-author:
792
+ - Where a principle is PROVISIONAL and THIS feature's code now evidences it, replace
793
+ the placeholder with the real CODE COORDINATE (file path / type name from the
794
+ source-map) — keep the principle's wording; just ground it.
795
+ - Do NOT change the principle SET, re-number, or re-scope the constitution to this
796
+ aggregate. Add a NEW technology principle ONLY if this feature reveals a project-
797
+ level technology trait onboard genuinely missed (cite the code coordinate) — rare.
798
+ - Ignore the source-map's domain spec-ids / entity semantics (those belong to the
799
+ domain half). Stay domain-agnostic.
800
+ - Bump CONSTITUTION_VERSION by semver; prepend a one-line note to the Sync Impact
801
+ Report ("reconciled from adopt {{feature_name}}: <principles grounded>"). Preserve
802
+ heading hierarchy + every other principle. ISO YYYY-MM-DD dates.
803
+ Return the complete updated technical constitution content only.
804
+ - id: reconcile_technical_lint
805
+ condition: "{{reconcile_governance}} == true" # HELD — governance reconcile paused (see vars)
806
+ action: loop
807
+ while: "{{technical_ok}} != true"
808
+ max_iterations: 3
809
+ steps:
810
+ - id: rt_lint
811
+ action: execute_script
812
+ script: { ref: actions }
813
+ subcommand: constitution-verify
814
+ args: ["--file", "{{constitution_technical_file}}"]
815
+ outputs:
816
+ - { name: technical_ok, from: "$.ok" }
817
+ - { name: technical_issues, from: "$.issues" }
818
+ - id: rt_break
819
+ action: break
820
+ condition: "{{technical_ok}} == true"
821
+ - id: rt_patch
822
+ action: agent_author
823
+ context: ["{{constitution_technical_file}}"]
824
+ include_standards: false
825
+ output_target: { type: file, path: "{{constitution_technical_file}}" }
826
+ task: |
827
+ Fix these mechanical defects in the technical constitution (target in context),
828
+ changing NOTHING else — preserve every principle, the heading hierarchy, and the
829
+ Sync Impact Report. Fill any listed [ALL_CAPS] placeholder (or a justified
830
+ TODO(<FIELD>): reason); make the body version AGREE with the Sync Impact Report;
831
+ ISO YYYY-MM-DD dates. Defects: {{technical_issues}}
832
+ Return the complete updated technical constitution content only.
833
+
834
+ # RECONCILE the DOMAIN constitution: ground provisional domain principles in this
835
+ # feature's real spec ids; CONTINUE (do not renumber) the technical numbering.
836
+ - id: ctx_reconcile_domain
837
+ condition: "{{reconcile_governance}} == true" # HELD — governance reconcile paused (see vars)
838
+ action: build_context
839
+ context:
840
+ - { path: "{{constitution_domain_file}}" }
841
+ - { path: "{{constitution_technical_file}}" }
842
+ - { path: "{{spec_file}}" }
843
+ - { path: "guardrails/projects/{{gov_domain}}/domain-rule-bindings.md", optional: true }
844
+ - id: reconcile_domain
845
+ condition: "{{reconcile_governance}} == true" # HELD — governance reconcile paused (see vars)
846
+ action: agent_author
847
+ include_standards: false
848
+ output_target: { type: file, path: "{{constitution_domain_file}}" }
849
+ task: |
850
+ RECONCILE the DOMAIN addenda constitution (target in context) with the adopted
851
+ feature '{{feature_name}}'. onboard authored the domain principles from the scan and
852
+ marked per-feature specifics `PROVISIONAL`. READ this feature's spec.md (in context
853
+ — real BR-/CN-/DC-/IC- + ubiquitous language) + the reconciled set (domain-rule-bindings).
854
+
855
+ RECONCILE, do NOT re-author:
856
+ - Where a domain principle is PROVISIONAL and this feature evidences it, ground it in
857
+ the feature's real spec ids — keep the principle TITLED by DOMAIN CONCERN (not the
858
+ aggregate name), so it still holds when a later feature enters the same context.
859
+ - Do NOT re-number or re-scope to this aggregate. Continue the technical half's
860
+ numbering (read constitution.technical.md for its last numeral). Add a NEW domain
861
+ principle ONLY if this feature reveals a project-level domain concern onboard missed.
862
+ - Bump CONSTITUTION_VERSION by semver; prepend a one-line Sync Impact Report note
863
+ ("reconciled from adopt {{feature_name}}"). Preserve heading hierarchy + other
864
+ principles. NO residual [BRACKET] token may remain. ISO YYYY-MM-DD dates.
865
+ Return the complete updated domain addenda content only.
866
+ - id: reconcile_domain_lint
867
+ condition: "{{reconcile_governance}} == true" # HELD — governance reconcile paused (see vars)
868
+ action: loop
869
+ while: "{{domain_ok}} != true"
870
+ max_iterations: 3
871
+ steps:
872
+ - id: rd_lint
873
+ action: execute_script
874
+ script: { ref: actions }
875
+ subcommand: constitution-verify
876
+ args: ["--file", "{{constitution_domain_file}}"]
877
+ outputs:
878
+ - { name: domain_ok, from: "$.ok" }
879
+ - { name: domain_issues, from: "$.issues" }
880
+ - id: rd_break
881
+ action: break
882
+ condition: "{{domain_ok}} == true"
883
+ - id: rd_patch
884
+ action: agent_author
885
+ context: ["{{constitution_domain_file}}"]
886
+ include_standards: false
887
+ output_target: { type: file, path: "{{constitution_domain_file}}" }
888
+ task: |
889
+ Fix these mechanical defects in the domain addenda constitution (target in
890
+ context), changing NOTHING else — preserve every principle, the heading
891
+ hierarchy, and the Sync Impact Report. Fill any listed [ALL_CAPS] placeholder
892
+ (or a justified TODO(<FIELD>): reason); make the body version AGREE with the
893
+ Sync Impact Report; ISO YYYY-MM-DD dates. Defects: {{domain_issues}}
894
+ Return the complete updated domain addenda content only.
895
+
896
+ - id: recompose_constitution
897
+ condition: "{{reconcile_governance}} == true" # HELD — governance reconcile paused (see vars)
898
+ action: execute_script
899
+ script: { ref: actions }
900
+ subcommand: compose-constitution
901
+ outputs:
902
+ - { name: composed_file, from: "$.composed_file" }
903
+
904
+ # 4. Post-execution hooks.
905
+ - id: resolve_post_hooks
906
+ action: execute_script
907
+ script: { ref: actions }
908
+ subcommand: resolve-hooks
909
+ args: ["--phase", "after_adopt"]
910
+ outputs:
911
+ - { name: after_hooks, from: "$.hooks" }
912
+ - id: dispatch_post_hooks
913
+ action: dispatch_hooks
914
+ hooks_from_variable: after_hooks
915
+
916
+ outputs:
917
+ feature_dir: "{{feature_dir}}"
918
+ spec_file: "{{spec_file}}"
919
+ design_doc: "{{design_doc}}"
920
+ ui_design_doc: "{{ui_design_doc}}" # empty where this slice has no UI half
921
+ ui_lane: "{{ui_lane}}"
922
+ ui_count: "{{ui_count}}"
923
+ source_map: "{{feature_dir}}/source-map.md"
924
+ aggregate: "{{feature_name}}"
925
+ source_count: "{{source_count}}"
926
+ review_items: "{{review_items}}"
927
+ concept_completed: "{{concept_completed}}"
928
+ xref_edge_count: "{{xref_edge_count}}"
929
+ gov_domain: "{{gov_domain}}"
930
+ pack_reconciled: "{{pack_reconciled}}"
931
+ composed_file: "{{composed_file}}"
932
+ technical_reconcile_ok: "{{technical_ok}}"
933
+ domain_reconcile_ok: "{{domain_ok}}"
934
+ next: "Adopted {{feature_name}} (spec.md + design.md + source-map.md, v1.0) and COMPLETED its OKF concept (deepened + linked the deep artifacts; {{xref_edge_count}} cross-slice edge(s) recorded). UI HALF: ui_lane={{ui_lane}} — where it is true this slice also has design.ui.md, reversed from the {{ui_count}} UI file(s) the feature map attributes to it; where it is false the repo declared no frontend lane, or this aggregate owns no part of its surface, and a service-only adoption is the correct outcome rather than a gap. The SHARED UI surface (app shell, layout, design system) belongs to no slice and stays in {{bundle_dir}}/architecture/frontend.md. NOTE — governance reconcile is currently HELD (reconcile_governance=false): this run did NOT modify the constitution halves or the guardrails/projects/{{gov_domain}}/ rule set, so they keep onboard's provisional scaffold. Close any items in specs/{{feature_name}}/adopt-review-report.md out of band. The slice is now a NORMAL feature: refine via /appweaver analyze-design, then drive every change through the CR delta loop (/appweaver specify → design → analyze-delta-design → implement-delta → build → finalize-delta → analyze-slice → close-delta). If a change edits untested legacy behaviour with blast radius, characterize just that surface first (optional on-touch fence). To restore governance reconcile, set reconcile_governance to \"true\" in the workflow vars."