aw-spec-cli 0.1.3 → 0.1.5

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 (230) hide show
  1. package/README.md +291 -0
  2. package/assets/.agents/agent.json +28 -0
  3. package/assets/.agents/skills/aw-spec-orch/SKILL.md +56 -0
  4. package/assets/.agents/skills/aw-spec-orch-demo/SKILL.md +59 -0
  5. package/assets/.aw-spec/DESIGN-FORMAT.md +151 -0
  6. package/assets/.aw-spec/ORCH-DIALECT.md +156 -0
  7. package/assets/.aw-spec/RULE-PARTITION.md +126 -0
  8. package/assets/.aw-spec/extensions/agent-context/extension.yml +12 -9
  9. package/assets/.aw-spec/extensions.yml +12 -19
  10. package/assets/.aw-spec/integrations/aw-spec.manifest.json +1 -9
  11. package/assets/.aw-spec/interpreter/run-skill.py +1158 -0
  12. package/assets/.aw-spec/orchestrator/AGENT-PROFILE.md +94 -0
  13. package/assets/.aw-spec/orchestrator/README.md +300 -0
  14. package/assets/.aw-spec/orchestrator/adapters/claude_agent_sdk.py +74 -0
  15. package/assets/.aw-spec/orchestrator/adapters/google_antigravity.py +74 -0
  16. package/assets/.aw-spec/orchestrator/modules/delta-design.orch.yaml +105 -0
  17. package/assets/.aw-spec/orchestrator/modules/delta-spec.orch.yaml +79 -0
  18. package/assets/.aw-spec/orchestrator/modules/domain-select.orch.yaml +81 -0
  19. package/assets/.aw-spec/orchestrator/modules/tech-select.orch.yaml +75 -0
  20. package/assets/.aw-spec/orchestrator/orchestrator.py +1721 -0
  21. package/assets/.aw-spec/orchestrator/rev-templates/ai-rules.reference.md +40 -0
  22. package/assets/.aw-spec/orchestrator/rev-templates/comandrulemap.skeleton.md +59 -0
  23. package/assets/.aw-spec/orchestrator/rev-templates/commandtechrulemap.skeleton.md +97 -0
  24. package/assets/.aw-spec/orchestrator/rev-templates/domain-constitution.skeleton.md +61 -0
  25. package/assets/.aw-spec/orchestrator/rev-templates/domain-requirements.skeleton.md +48 -0
  26. package/assets/.aw-spec/orchestrator/rev-templates/domain-rule-file.skeleton.md +39 -0
  27. package/assets/.aw-spec/orchestrator/rev-templates/technical-constitution.skeleton.md +106 -0
  28. package/assets/.aw-spec/orchestrator/rev-templates/technical-rule-file.skeleton.md +54 -0
  29. package/assets/.aw-spec/orchestrator/workflows/_smoke.orch.yaml +160 -0
  30. package/assets/.aw-spec/orchestrator/workflows/aw-spec-add-component.orch.yaml +244 -0
  31. package/assets/.aw-spec/orchestrator/workflows/aw-spec-adopt.orch.yaml +775 -0
  32. package/assets/.aw-spec/orchestrator/workflows/aw-spec-analyze-delta-design.orch.yaml +248 -0
  33. package/assets/.aw-spec/orchestrator/workflows/aw-spec-analyze-design.orch.yaml +261 -0
  34. package/assets/.aw-spec/orchestrator/workflows/aw-spec-analyze-slice.orch.yaml +425 -0
  35. package/assets/.aw-spec/orchestrator/workflows/aw-spec-build.orch.yaml +188 -0
  36. package/assets/.aw-spec/orchestrator/workflows/aw-spec-characterize.orch.yaml +474 -0
  37. package/assets/.aw-spec/orchestrator/workflows/aw-spec-close-delta.orch.yaml +181 -0
  38. package/assets/.aw-spec/orchestrator/workflows/aw-spec-constitution.orch.yaml +284 -0
  39. package/assets/.aw-spec/orchestrator/workflows/aw-spec-demo.orch.yaml +103 -0
  40. package/assets/.aw-spec/orchestrator/workflows/aw-spec-dependency-tree.orch.yaml +69 -0
  41. package/assets/.aw-spec/orchestrator/workflows/aw-spec-deploy.orch.yaml +85 -0
  42. package/assets/.aw-spec/orchestrator/workflows/aw-spec-design.orch.yaml +382 -0
  43. package/assets/.aw-spec/orchestrator/workflows/aw-spec-finalize-delta.orch.yaml +382 -0
  44. package/assets/.aw-spec/orchestrator/workflows/aw-spec-foundation.orch.yaml +246 -0
  45. package/assets/.aw-spec/orchestrator/workflows/aw-spec-implement-delta.orch.yaml +231 -0
  46. package/assets/.aw-spec/orchestrator/workflows/aw-spec-implement.orch.yaml +258 -0
  47. package/assets/.aw-spec/orchestrator/workflows/aw-spec-inventory.orch.yaml +236 -0
  48. package/assets/.aw-spec/orchestrator/workflows/aw-spec-onboard.orch.yaml +949 -0
  49. package/assets/.aw-spec/orchestrator/workflows/aw-spec-parity.orch.yaml +293 -0
  50. package/assets/.aw-spec/orchestrator/workflows/aw-spec-run.orch.yaml +177 -0
  51. package/assets/.aw-spec/orchestrator/workflows/aw-spec-select-domain.orch.yaml +79 -0
  52. package/assets/.aw-spec/orchestrator/workflows/aw-spec-select-feature.orch.yaml +128 -0
  53. package/assets/.aw-spec/orchestrator/workflows/aw-spec-specify.orch.yaml +412 -0
  54. package/assets/.aw-spec/scripts/bash/aw-inventory.sh +14 -0
  55. package/assets/.aw-spec/scripts/bash/aw-parity.sh +13 -0
  56. package/assets/.aw-spec/scripts/bash/aw-rev-constitution.sh +13 -0
  57. package/assets/.aw-spec/scripts/bash/aw-spec-actions.sh +1899 -0
  58. package/assets/.aw-spec/scripts/bash/aw-xref.sh +15 -0
  59. package/assets/.aw-spec/scripts/bash/common.sh +11 -60
  60. package/assets/.aw-spec/scripts/powershell/aw-inventory.ps1 +14 -0
  61. package/assets/.aw-spec/scripts/powershell/aw-parity.ps1 +13 -0
  62. package/assets/.aw-spec/scripts/powershell/aw-rev-constitution.ps1 +13 -0
  63. package/assets/.aw-spec/scripts/powershell/aw-spec-actions.ps1 +1563 -0
  64. package/assets/.aw-spec/scripts/powershell/aw-xref.ps1 +15 -0
  65. package/assets/.aw-spec/scripts/python/aw-inventory.py +683 -0
  66. package/assets/.aw-spec/scripts/python/aw-parity.py +380 -0
  67. package/assets/.aw-spec/scripts/python/aw-rev-constitution.py +312 -0
  68. package/assets/.aw-spec/scripts/python/aw-xref.py +1330 -0
  69. package/assets/.aw-spec/scripts/python/validate_okf.py +349 -0
  70. package/assets/.aw-spec/templates/constitution-domain-template.md +75 -0
  71. package/assets/.aw-spec/templates/constitution-technical-template.md +70 -0
  72. package/assets/.aw-spec/templates/delta-design-template.md +69 -0
  73. package/assets/.aw-spec/templates/delta-spec-template.md +60 -0
  74. package/assets/.aw-spec/templates/design-template.md +383 -0
  75. package/assets/.aw-spec/templates/okf-concept-template.md +103 -0
  76. package/assets/.aw-spec/templates/parity-manifest-template.json +49 -0
  77. package/assets/.aw-spec/templates/source-map-template.md +85 -0
  78. package/assets/.aw-spec/templates/spec-template.md +192 -71
  79. package/assets/.claude/agent.json +27 -0
  80. package/assets/.claude/skills/aw-spec-orch/SKILL.md +55 -0
  81. package/assets/.claude/skills/aw-spec-orch-demo/SKILL.md +59 -0
  82. package/assets/.kilocode/agent.json +28 -0
  83. package/assets/.kilocode/workflows/aw-spec-orch-demo.md +59 -0
  84. package/assets/.kilocode/workflows/aw-spec-orch.md +55 -0
  85. package/assets/docs/architecture/clean-architecture.md +1 -1
  86. package/assets/docs/architecture/cqrs.md +1 -1
  87. package/assets/docs/architecture/eventing.md +1 -1
  88. package/assets/docs/architecture/folder-structure.md +1 -1
  89. package/assets/docs/architecture/modular-monolith.md +1 -1
  90. package/assets/docs/architecture/persistence.md +1 -1
  91. package/assets/docs/architecture/testing.md +1 -1
  92. package/assets/docs/architecture/vertical-slices.md +1 -1
  93. package/assets/docs/components/Email/README.md +1 -1
  94. package/assets/docs/components/Jobs/README.md +1 -1
  95. package/assets/docs/components/QrGenerator/README.md +1 -1
  96. package/assets/docs/components/README.md +1 -1
  97. package/assets/docs/domain/domain-driven-design.md +1 -1
  98. package/assets/docs/domainspecs/healthcare/api-versioning.domain.md +1 -1
  99. package/assets/docs/domainspecs/healthcare/auditing.domain.md +86 -18
  100. package/assets/docs/domainspecs/healthcare/authorization.domain.md +1 -1
  101. package/assets/docs/domainspecs/healthcare/clinical-terms.md +1 -1
  102. package/assets/docs/domainspecs/healthcare/coding-standards.domain.md +1 -1
  103. package/assets/docs/domainspecs/healthcare/comandrulemap.md +58 -124
  104. package/assets/docs/domainspecs/healthcare/commandtechrulemap.md +119 -0
  105. package/assets/docs/domainspecs/healthcare/consent.md +1 -1
  106. package/assets/docs/domainspecs/healthcare/cqrs.domain.md +1 -1
  107. package/assets/docs/domainspecs/healthcare/data-classification.domain.md +1 -1
  108. package/assets/docs/domainspecs/healthcare/dependency-policy.domain.md +1 -1
  109. package/assets/docs/domainspecs/healthcare/dicom.md +1 -1
  110. package/assets/docs/domainspecs/healthcare/domain-driven-design.domain.md +1 -1
  111. package/assets/docs/domainspecs/healthcare/eventing.domain.md +1 -1
  112. package/assets/docs/domainspecs/healthcare/fhir.md +1 -1
  113. package/assets/docs/domainspecs/healthcare/folder-structure.domain.md +1 -1
  114. package/assets/docs/domainspecs/healthcare/hipaa.md +1 -1
  115. package/assets/docs/domainspecs/healthcare/hl7.md +1 -1
  116. package/assets/docs/domainspecs/healthcare/integration-terms.md +1 -1
  117. package/assets/docs/domainspecs/healthcare/persistence.domain.md +1 -1
  118. package/assets/docs/domainspecs/healthcare/terminology.md +1 -1
  119. package/assets/docs/domainspecs/healthcare/testing.domain.md +1 -1
  120. package/assets/docs/domainspecs/healthcare/vertical-slices.domain.md +1 -1
  121. package/assets/docs/domainspecs/healthcare/zero-trust.domain.md +1 -1
  122. package/assets/docs/domainspecs/pharma/api-versioning.domain.md +1 -1
  123. package/assets/docs/domainspecs/pharma/atc.md +1 -1
  124. package/assets/docs/domainspecs/pharma/auditing.domain.md +80 -16
  125. package/assets/docs/domainspecs/pharma/authorization.domain.md +1 -1
  126. package/assets/docs/domainspecs/pharma/coding-standards.domain.md +1 -1
  127. package/assets/docs/domainspecs/pharma/comandrulemap.md +64 -142
  128. package/assets/docs/domainspecs/pharma/commandtechrulemap.md +119 -0
  129. package/assets/docs/domainspecs/pharma/cqrs.domain.md +1 -1
  130. package/assets/docs/domainspecs/pharma/data-classification.domain.md +1 -1
  131. package/assets/docs/domainspecs/pharma/data-provenance.md +1 -1
  132. package/assets/docs/domainspecs/pharma/dependency-policy.domain.md +1 -1
  133. package/assets/docs/domainspecs/pharma/domain-driven-design.domain.md +1 -1
  134. package/assets/docs/domainspecs/pharma/eventing.domain.md +1 -1
  135. package/assets/docs/domainspecs/pharma/fhir.md +1 -1
  136. package/assets/docs/domainspecs/pharma/folder-structure.domain.md +1 -1
  137. package/assets/docs/domainspecs/pharma/hl7.md +1 -1
  138. package/assets/docs/domainspecs/pharma/idmp.md +1 -1
  139. package/assets/docs/domainspecs/pharma/integration-terms.md +1 -1
  140. package/assets/docs/domainspecs/pharma/ndc.md +1 -1
  141. package/assets/docs/domainspecs/pharma/persistence.domain.md +1 -1
  142. package/assets/docs/domainspecs/pharma/pharma-terms.md +1 -1
  143. package/assets/docs/domainspecs/pharma/product-lifecycle.domain.md +1 -1
  144. package/assets/docs/domainspecs/pharma/regulatory-compliance.md +1 -1
  145. package/assets/docs/domainspecs/pharma/terminology.md +1 -1
  146. package/assets/docs/domainspecs/pharma/testing.domain.md +1 -1
  147. package/assets/docs/domainspecs/pharma/vertical-slices.domain.md +1 -1
  148. package/assets/docs/domainspecs/pharma/zero-trust.domain.md +1 -1
  149. package/assets/docs/governance/api-versioning.md +1 -1
  150. package/assets/docs/governance/coding-standards.md +1 -1
  151. package/assets/docs/governance/dependency-policy.md +1 -1
  152. package/assets/docs/requirement-spec.txt +13 -1
  153. package/assets/docs/security/auditing.md +54 -11
  154. package/assets/docs/security/authorization.md +1 -1
  155. package/assets/docs/security/data-classification.md +1 -1
  156. package/assets/docs/security/zero-trust.md +1 -1
  157. package/dist/commands/update.d.ts +3 -0
  158. package/dist/commands/update.d.ts.map +1 -0
  159. package/dist/commands/update.js +142 -0
  160. package/dist/commands/update.js.map +1 -0
  161. package/dist/utils/manifest.d.ts +31 -0
  162. package/dist/utils/manifest.d.ts.map +1 -0
  163. package/dist/utils/manifest.js +91 -0
  164. package/dist/utils/manifest.js.map +1 -0
  165. package/dist/utils/paths.js +2 -2
  166. package/dist/utils/paths.js.map +1 -1
  167. package/dist/utils/update-engine.d.ts +52 -0
  168. package/dist/utils/update-engine.d.ts.map +1 -0
  169. package/dist/utils/update-engine.js +203 -0
  170. package/dist/utils/update-engine.js.map +1 -0
  171. package/package.json +1 -1
  172. package/assets/.agents/skills/aw-spec-addcomponent/SKILL.md +0 -129
  173. package/assets/.agents/skills/aw-spec-agent-context-update/SKILL.md +0 -31
  174. package/assets/.agents/skills/aw-spec-analyze/SKILL.md +0 -296
  175. package/assets/.agents/skills/aw-spec-checklist/SKILL.md +0 -374
  176. package/assets/.agents/skills/aw-spec-clarify/SKILL.md +0 -320
  177. package/assets/.agents/skills/aw-spec-constitution/SKILL.md +0 -194
  178. package/assets/.agents/skills/aw-spec-fast-implement/SKILL.md +0 -268
  179. package/assets/.agents/skills/aw-spec-foundation/SKILL.md +0 -358
  180. package/assets/.agents/skills/aw-spec-implement/SKILL.md +0 -279
  181. package/assets/.agents/skills/aw-spec-minimal-implementation/SKILL.md +0 -209
  182. package/assets/.agents/skills/aw-spec-plan/SKILL.md +0 -221
  183. package/assets/.agents/skills/aw-spec-select-domain/SKILL.md +0 -73
  184. package/assets/.agents/skills/aw-spec-specify/SKILL.md +0 -382
  185. package/assets/.agents/skills/aw-spec-tasks/SKILL.md +0 -259
  186. package/assets/.agents/skills/aw-spec-taskstoissues/SKILL.md +0 -107
  187. package/assets/.aw-spec/integrations/claude.manifest.json +0 -17
  188. package/assets/.aw-spec/scripts/bash/check-prerequisites.sh +0 -189
  189. package/assets/.aw-spec/scripts/bash/create-new-feature.sh +0 -299
  190. package/assets/.aw-spec/scripts/bash/setup-plan.sh +0 -84
  191. package/assets/.aw-spec/scripts/bash/setup-tasks.sh +0 -91
  192. package/assets/.aw-spec/templates/checklist-template.md +0 -40
  193. package/assets/.aw-spec/templates/constitution-template.md +0 -57
  194. package/assets/.aw-spec/templates/plan-template.md +0 -113
  195. package/assets/.aw-spec/templates/tasks-template.md +0 -252
  196. package/assets/.aw-spec/workflows/aw-spec/workflow.yml +0 -77
  197. package/assets/.aw-spec/workflows/workflow-registry.json +0 -13
  198. package/assets/.claude/skills/aw-spec-addcomponent/SKILL.md +0 -129
  199. package/assets/.claude/skills/aw-spec-agent-context-update/SKILL.md +0 -31
  200. package/assets/.claude/skills/aw-spec-analyze/SKILL.md +0 -296
  201. package/assets/.claude/skills/aw-spec-checklist/SKILL.md +0 -374
  202. package/assets/.claude/skills/aw-spec-clarify/SKILL.md +0 -320
  203. package/assets/.claude/skills/aw-spec-constitution/SKILL.md +0 -194
  204. package/assets/.claude/skills/aw-spec-fast-implement/SKILL.md +0 -268
  205. package/assets/.claude/skills/aw-spec-foundation/SKILL.md +0 -358
  206. package/assets/.claude/skills/aw-spec-implement/SKILL.md +0 -279
  207. package/assets/.claude/skills/aw-spec-minimal-implementation/SKILL.md +0 -209
  208. package/assets/.claude/skills/aw-spec-plan/SKILL.md +0 -221
  209. package/assets/.claude/skills/aw-spec-select-domain/SKILL.md +0 -73
  210. package/assets/.claude/skills/aw-spec-specify/SKILL.md +0 -382
  211. package/assets/.claude/skills/aw-spec-tasks/SKILL.md +0 -259
  212. package/assets/.claude/skills/aw-spec-taskstoissues/SKILL.md +0 -107
  213. package/assets/.kilocode/rules/specify-rules.md +0 -4
  214. package/assets/.kilocode/workflows/aw-spec-addcomponent.md +0 -129
  215. package/assets/.kilocode/workflows/aw-spec-agent-context.update.md +0 -31
  216. package/assets/.kilocode/workflows/aw-spec-analyze.md +0 -296
  217. package/assets/.kilocode/workflows/aw-spec-checklist.md +0 -374
  218. package/assets/.kilocode/workflows/aw-spec-clarify.md +0 -320
  219. package/assets/.kilocode/workflows/aw-spec-constitution.md +0 -194
  220. package/assets/.kilocode/workflows/aw-spec-fast-implement.md +0 -263
  221. package/assets/.kilocode/workflows/aw-spec-foundation.md +0 -358
  222. package/assets/.kilocode/workflows/aw-spec-implement.md +0 -279
  223. package/assets/.kilocode/workflows/aw-spec-minimal-implementation.md +0 -204
  224. package/assets/.kilocode/workflows/aw-spec-plan.md +0 -221
  225. package/assets/.kilocode/workflows/aw-spec-select-domain.md +0 -73
  226. package/assets/.kilocode/workflows/aw-spec-specify.md +0 -382
  227. package/assets/.kilocode/workflows/aw-spec-tasks.md +0 -259
  228. package/assets/.kilocode/workflows/aw-spec-taskstoissues.md +0 -107
  229. package/assets/docs/command.txt +0 -295
  230. package/assets/docs/pharma-constitution.my-ref.md +0 -86
@@ -1,320 +0,0 @@
1
- ---
2
- name: "aw-spec-clarify"
3
- description: "Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec."
4
- argument-hint: "Optional areas to clarify in the spec"
5
- compatibility: "Requires aw-spec project structure with .aw-spec/ directory"
6
- metadata:
7
- author: "github-aw-spec"
8
- source: "templates/commands/clarify.md"
9
- user-invocable: true
10
- disable-model-invocation: false
11
- ---
12
-
13
-
14
- ## User Input
15
-
16
- ```text
17
- $ARGUMENTS
18
- ```
19
-
20
- You **MUST** consider the user input before proceeding (if not empty).
21
-
22
- ## Context Reuse (cross-command dedup)
23
-
24
- **Skip Read-ing any file already in this conversation.** Before loading a standards/domain/template/spec file this command names, check whether it is already in context (loaded earlier here or by a prior `/aw-spec-*` command). If present and unchanged, reuse it and **skip the Read** — only Read files not yet loaded. A file already in context still counts as loaded; this just avoids the redundant re-read.
25
-
26
- ## Auto-Loaded Engineering Standards (Required Context)
27
-
28
- **Before doing anything else in this command, load the project engineering-standards files listed below into context using the Read tool.** These were previously supplied manually as `@docs/...` mentions; they are now loaded automatically so the user does not need to pass them. Rules:
29
-
30
- - Read each file below **before** starting the Pre-Execution Checks / Outline. Treat their contents as authoritative engineering standards for this command, second only to `.aw-spec/memory/constitution.md`.
31
- - If a listed file does not exist, skip it silently and continue — do **not** error and do **not** ask the user to provide it.
32
- - This is the **domain-agnostic technical** set, so the framework is reusable across domains. Domain-specific rule files (e.g. healthcare FHIR/HL7/PHI) are **not** part of this set — they are offered separately in the **Domain Rule-File Selection** section below (sourced from `comandrulemap.md`). You can also add any extra file directly with an `@` mention.
33
-
34
- Standards for `/aw-spec-clarify`:
35
- - docs/domain/domain-driven-design.md
36
-
37
- ## Domain Rule-File Selection (interactive)
38
-
39
- After the technical standards above are loaded, and **before** the Pre-Execution Checks, resolve the active domain and ask the user which **domain** rule files to load for this command:
40
-
41
- 1. **Resolve the active domain.** Read `.aw-spec/domain.json` and take its `domain` value — the active domain-specs folder name. The candidate domain rule files are the bullet list under the `## /aw-spec-clarify` heading in `docs/domainspecs/<domain>/comandrulemap.md`.
42
- 2. **Domain gate (missing domain or rules).** If `.aw-spec/domain.json` is absent or its `domain` is empty, **or** `docs/domainspecs/<domain>/comandrulemap.md` does not exist:
43
- - Ask one single-select question with the AskUserQuestion tool — *"Domain is not set or its rule files are missing (state which: no domain set / domain '<domain>' has no comandrulemap.md). Continue without domain rules?"* — with options **"Continue (technical only)"** and **"Exit"**.
44
- - **Continue (technical only)** → skip steps 3-5 and proceed with only the auto-loaded technical standards (plus any `@`-mentioned files).
45
- - **Exit** → stop the command **immediately** with no side effects: do **not** run the Pre-Execution Checks, hooks, Outline, or any later step, and create/modify nothing. Tell the user to run `/aw-spec-select-domain` (or fix the domain folder) and re-run.
46
- - If interactive questions cannot be asked (non-interactive/automated run), default to **Continue (technical only)**.
47
- - Exception: if `comandrulemap.md` exists but has **no entries under this command's heading**, this is **not** a gate trigger — load no domain files for this command and continue normally to the Pre-Execution Checks.
48
- 3. **Show a selection box** using the AskUserQuestion tool:
49
- - Ask one single-select question — *"Domain rule files for /aw-spec-clarify:"* — with options **"Select all (recommended)"**, **"Pick a subset"**, and **"None (technical only)"**.
50
- - If the user chooses **"Pick a subset"**, follow up with **multi-select** questions whose options are the individual candidate files so the user can tick the ones they want. AskUserQuestion allows ≤4 options per question and ≤4 questions per call, so split the candidates into groups of ≤4 (by category: architecture overlays, clinical domain, security overlays, governance overlays, glossary) across as many calls as needed.
51
- - If interactive questions cannot be asked (non-interactive or automated run), skip the prompt and default to **Select all**.
52
- 4. **Load the selection.** Read every file the user selected (the full list for "Select all"; nothing extra for "None"). If any selected file does not exist on disk, skip it silently and continue — do not error.
53
- 5. **Final context set** = the always-loaded technical standards (section above) **+** the domain files selected here **+** any files the user passed via `@` mention in their command. The `@`-mentioned files are always loaded in addition, whether or not they appear in the candidate list, and are never removed by a "None"/subset choice.
54
- 6. Proceed to the Pre-Execution Checks only after the selected files are loaded.
55
-
56
- ## Pre-Execution Checks
57
-
58
- **Check for extension hooks (before clarification)**:
59
- - Check if `.aw-spec/extensions.yml` exists in the project root.
60
- - If it exists, read it and look for entries under the `hooks.before_clarify` key
61
- - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
62
- - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
63
- - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
64
- - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
65
- - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
66
- - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
67
- - For each executable hook, output the following based on its `optional` flag:
68
- - **Optional hook** (`optional: true`):
69
- ```
70
- ## Extension Hooks
71
-
72
- **Optional Pre-Hook**: {extension}
73
- Command: `/{command}`
74
- Description: {description}
75
-
76
- Prompt: {prompt}
77
- To execute: `/{command}`
78
- ```
79
- - **Mandatory hook** (`optional: false`):
80
- ```
81
- ## Extension Hooks
82
-
83
- **Automatic Pre-Hook**: {extension}
84
- Executing: `/{command}`
85
- EXECUTE_COMMAND: {command}
86
-
87
- Wait for the result of the hook command before proceeding to the Outline.
88
- ```
89
- - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently
90
-
91
- ## Outline
92
-
93
- Goal: Detect and reduce ambiguity or missing decision points in the active feature specification and record the clarifications directly in the spec file.
94
-
95
- Note: This clarification workflow is expected to run (and be completed) BEFORE invoking `/aw-spec-plan`. If the user explicitly states they are skipping clarification (e.g., exploratory spike), you may proceed, but must warn that downstream rework risk increases.
96
-
97
- Execution steps:
98
-
99
- 1. Run `.aw-spec/scripts/bash/check-prerequisites.sh --json --paths-only` from repo root **once** (combined `--json --paths-only` mode / `-Json -PathsOnly`). Parse minimal JSON payload fields:
100
- - `FEATURE_DIR`
101
- - `FEATURE_SPEC`
102
- - (Optionally capture `IMPL_PLAN`, `TASKS` for future chained flows.)
103
- - If JSON parsing fails, abort and instruct user to re-run `/aw-spec-specify` or verify feature branch environment.
104
- - For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
105
-
106
- 2. **IF EXISTS**: Load `.aw-spec/memory/constitution.md` for project principles and governance constraints.
107
-
108
- 3. Load the current spec file. Perform a structured ambiguity & coverage scan using this taxonomy. For each category, mark status: Clear / Partial / Missing. Produce an internal coverage map used for prioritization (do not output raw map unless no questions will be asked).
109
-
110
- Functional Scope & Behavior:
111
- - Core user goals & success criteria
112
- - Explicit out-of-scope declarations
113
- - User roles / personas differentiation
114
-
115
- Domain & Data Model:
116
- - Entities, attributes, relationships
117
- - Identity & uniqueness rules
118
- - Lifecycle/state transitions
119
- - Data volume / scale assumptions
120
-
121
- Interaction & UX Flow:
122
- - Critical user journeys / sequences
123
- - Error/empty/loading states
124
- - Accessibility or localization notes
125
-
126
- Non-Functional Quality Attributes:
127
- - Performance (latency, throughput targets)
128
- - Scalability (horizontal/vertical, limits)
129
- - Reliability & availability (uptime, recovery expectations)
130
- - Observability (logging, metrics, tracing signals)
131
- - Security & privacy (authN/Z, data protection, threat assumptions)
132
- - Compliance / regulatory constraints (if any)
133
-
134
- Integration & External Dependencies:
135
- - External services/APIs and failure modes
136
- - Data import/export formats
137
- - Protocol/versioning assumptions
138
-
139
- Edge Cases & Failure Handling:
140
- - Negative scenarios
141
- - Rate limiting / throttling
142
- - Conflict resolution (e.g., concurrent edits)
143
-
144
- Constraints & Tradeoffs:
145
- - Technical constraints (language, storage, hosting)
146
- - Explicit tradeoffs or rejected alternatives
147
-
148
- Terminology & Consistency:
149
- - Canonical glossary terms
150
- - Avoided synonyms / deprecated terms
151
-
152
- Completion Signals:
153
- - Acceptance criteria testability
154
- - Measurable Definition of Done style indicators
155
-
156
- Misc / Placeholders:
157
- - TODO markers / unresolved decisions
158
- - Ambiguous adjectives ("robust", "intuitive") lacking quantification
159
-
160
- For each category with Partial or Missing status, add a candidate question opportunity unless:
161
- - Clarification would not materially change implementation or validation strategy
162
- - Information is better deferred to planning phase (note internally)
163
-
164
- 4. Generate (internally) a prioritized queue of candidate clarification questions (maximum 5). Do NOT output them all at once. Apply these constraints:
165
- - Maximum of 5 total questions across the whole session.
166
- - Each question must be answerable with EITHER:
167
- - A short multiple‑choice selection (2–5 distinct, mutually exclusive options), OR
168
- - A one-word / short‑phrase answer (explicitly constrain: "Answer in <=5 words").
169
- - Only include questions whose answers materially impact architecture, data modeling, task decomposition, test design, UX behavior, operational readiness, or compliance validation.
170
- - Ensure category coverage balance: attempt to cover the highest impact unresolved categories first; avoid asking two low-impact questions when a single high-impact area (e.g., security posture) is unresolved.
171
- - Exclude questions already answered, trivial stylistic preferences, or plan-level execution details (unless blocking correctness).
172
- - Favor clarifications that reduce downstream rework risk or prevent misaligned acceptance tests.
173
- - If more than 5 categories remain unresolved, select the top 5 by (Impact * Uncertainty) heuristic.
174
-
175
- 5. Sequential questioning loop (interactive):
176
- - Present EXACTLY ONE question at a time.
177
- - For multiple‑choice questions:
178
- - **Analyze all options** and determine the **most suitable option** based on:
179
- - Best practices for the project type
180
- - Common patterns in similar implementations
181
- - Risk reduction (security, performance, maintainability)
182
- - Alignment with any explicit project goals or constraints visible in the spec
183
- - Present your **recommended option prominently** at the top with clear reasoning (1-2 sentences explaining why this is the best choice).
184
- - Format as: `**Recommended:** Option [X] - <reasoning>`
185
- - Then render all options as a Markdown table:
186
-
187
- | Option | Description |
188
- |--------|-------------|
189
- | A | <Option A description> |
190
- | B | <Option B description> |
191
- | C | <Option C description> (add D/E as needed up to 5) |
192
- | Short | Provide a different short answer (<=5 words) (Include only if free-form alternative is appropriate) |
193
-
194
- - After the table, add: `You can reply with the option letter (e.g., "A"), accept the recommendation by saying "yes" or "recommended", or provide your own short answer.`
195
- - For short‑answer style (no meaningful discrete options):
196
- - Provide your **suggested answer** based on best practices and context.
197
- - Format as: `**Suggested:** <your proposed answer> - <brief reasoning>`
198
- - Then output: `Format: Short answer (<=5 words). You can accept the suggestion by saying "yes" or "suggested", or provide your own answer.`
199
- - After the user answers:
200
- - If the user replies with "yes", "recommended", or "suggested", use your previously stated recommendation/suggestion as the answer.
201
- - Otherwise, validate the answer maps to one option or fits the <=5 word constraint.
202
- - If ambiguous, ask for a quick disambiguation (count still belongs to same question; do not advance).
203
- - Once satisfactory, record it in working memory (do not yet write to disk) and move to the next queued question.
204
- - Stop asking further questions when:
205
- - All critical ambiguities resolved early (remaining queued items become unnecessary), OR
206
- - User signals completion ("done", "good", "no more"), OR
207
- - You reach 5 asked questions.
208
- - Never reveal future queued questions in advance.
209
- - If no valid questions exist at start, immediately report no critical ambiguities.
210
-
211
- 6. Integration after EACH accepted answer (incremental update approach):
212
- - Maintain in-memory representation of the spec (loaded once at start) plus the raw file contents.
213
- - For the first integrated answer in this session:
214
- - Ensure a `## Clarifications` section exists (create it just after the highest-level contextual/overview section per the spec template if missing).
215
- - Under it, create (if not present) a `### Session YYYY-MM-DD` subheading for today.
216
- - Append a bullet line immediately after acceptance: `- Q: <question> → A: <final answer>`.
217
- - Then immediately apply the clarification to the most appropriate section(s):
218
- - Functional ambiguity → Update or add a bullet in Functional Requirements.
219
- - User interaction / actor distinction → Update User Stories or Actors subsection (if present) with clarified role, constraint, or scenario.
220
- - Data shape / entities → Update Data Model (add fields, types, relationships) preserving ordering; note added constraints succinctly.
221
- - Non-functional constraint → Add/modify measurable criteria in Success Criteria > Measurable Outcomes (convert vague adjective to metric or explicit target).
222
- - Edge case / negative flow → Add a new bullet under Edge Cases / Error Handling (or create such subsection if template provides placeholder for it).
223
- - Terminology conflict → Normalize term across spec; retain original only if necessary by adding `(formerly referred to as "X")` once.
224
- - If the clarification invalidates an earlier ambiguous statement, replace that statement instead of duplicating; leave no obsolete contradictory text.
225
- - Save the spec file AFTER each integration to minimize risk of context loss (atomic overwrite).
226
- - Preserve formatting: do not reorder unrelated sections; keep heading hierarchy intact.
227
- - Keep each inserted clarification minimal and testable (avoid narrative drift).
228
-
229
- 7. Validation (performed after EACH write plus final pass):
230
- - Clarifications session contains exactly one bullet per accepted answer (no duplicates).
231
- - Total asked (accepted) questions ≤ 5.
232
- - Updated sections contain no lingering vague placeholders the new answer was meant to resolve.
233
- - No contradictory earlier statement remains (scan for now-invalid alternative choices removed).
234
- - Markdown structure valid; only allowed new headings: `## Clarifications`, `### Session YYYY-MM-DD`.
235
- - Terminology consistency: same canonical term used across all updated sections.
236
-
237
- 8. Write the updated spec back to `FEATURE_SPEC`.
238
-
239
- 9. **Re-validate Spec Quality Checklist** (if it exists):
240
- - Check if `FEATURE_DIR/checklists/requirements.md` exists.
241
- - If it does NOT exist, skip this step silently.
242
- - If it exists:
243
- 1. Read the checklist file.
244
- 2. Identify all GitHub task-list checkbox lines — lines matching `- [ ]`, `- [x]`, or `- [X]` (case-insensitive, tolerant of leading whitespace for nested items) outside of code fences. Ignore all other content (headings, notes, non-checkbox bullets, metadata).
245
- 3. For each checkbox line, record its current marker state (checked or unchecked) and item text into a before-snapshot list.
246
- 4. Re-evaluate each checkbox item against the **updated** spec (the version just saved in step 7).
247
- 5. For each checkbox item, update only if the checked/unchecked state actually changes:
248
- - If the item now passes and was unchecked: change `[ ]` to `[x]`.
249
- - If the item now fails and was checked: change `[x]`/`[X]` to `[ ]`.
250
- - If the state is unchanged: leave the marker as-is (preserve existing case to avoid cosmetic diffs).
251
- 6. Save the updated checklist file. **Only toggle the `[ ]`/`[x]` marker portion of checkbox lines whose state changed.** All other file content — headings, metadata, notes, line ordering, whitespace — must remain unchanged to avoid noisy diffs.
252
- 7. Compare the before-snapshot with the current state to compute three lists for the Completion Report:
253
- - **Newly passing**: items that changed from unchecked to checked.
254
- - **Regressions**: items that changed from checked to unchecked.
255
- - **Still unchecked**: items that remain unchecked.
256
- 8. Record the before/after pass counts as checked/total checkbox items (e.g., "12/16 → 15/16 items passing").
257
-
258
- Behavior rules:
259
-
260
- - If no meaningful ambiguities found (or all potential questions would be low-impact), respond: "No critical ambiguities detected worth formal clarification." and suggest proceeding.
261
- - If spec file missing, instruct user to run `/aw-spec-specify` first (do not create a new spec here).
262
- - Never exceed 5 total asked questions (clarification retries for a single question do not count as new questions).
263
- - Avoid speculative tech stack questions unless the absence blocks functional clarity.
264
- - Respect user early termination signals ("stop", "done", "proceed").
265
- - If no questions asked due to full coverage, output a compact coverage summary (all categories Clear) then suggest advancing.
266
- - If quota reached with unresolved high-impact categories remaining, explicitly flag them under Deferred with rationale.
267
-
268
- Context for prioritization: $ARGUMENTS
269
-
270
- ## Mandatory Post-Execution Hooks
271
-
272
- **You MUST complete this section before reporting completion to the user.**
273
-
274
- Check if `.aw-spec/extensions.yml` exists in the project root.
275
- - If it does not exist, or no hooks are registered under `hooks.after_clarify`, skip to the Completion Report.
276
- - If it exists, read it and look for entries under the `hooks.after_clarify` key.
277
- - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
278
- - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
279
- - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
280
- - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
281
- - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
282
- - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
283
- - For each executable hook, output the following based on its `optional` flag:
284
- - **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
285
- ```
286
- ## Extension Hooks
287
-
288
- **Automatic Hook**: {extension}
289
- Executing: `/{command}`
290
- EXECUTE_COMMAND: {command}
291
- ```
292
- - **Optional hook** (`optional: true`):
293
- ```
294
- ## Extension Hooks
295
-
296
- **Optional Hook**: {extension}
297
- Command: `/{command}`
298
- Description: {description}
299
-
300
- Prompt: {prompt}
301
- To execute: `/{command}`
302
- ```
303
-
304
- ## Completion Report
305
-
306
- Report completion (after questioning loop ends or early termination):
307
- - Number of questions asked & answered.
308
- - Path to updated spec.
309
- - Sections touched (list names).
310
- - Spec quality checklist status (if `FEATURE_DIR/checklists/requirements.md` was re-validated): show before/after pass counts (e.g., "Spec Quality Checklist: 12/16 → 15/16 items passing") and list any items that changed state — both newly checked (unchecked → checked) and any regressions (checked → unchecked). If any items remain unchecked, list them as areas needing attention.
311
- - Coverage summary table listing each taxonomy category with Status: Resolved (was Partial/Missing and addressed), Deferred (exceeds question quota or better suited for planning), Clear (already sufficient), Outstanding (still Partial/Missing but low impact).
312
- - If any Outstanding or Deferred remain, recommend whether to proceed to `/aw-spec-plan` or run `/aw-spec-clarify` again later post-plan.
313
- - Suggested next command.
314
-
315
- ## Done When
316
-
317
- - [ ] Spec ambiguities identified and clarifications integrated into spec file
318
- - [ ] Spec quality checklist re-validated against updated spec (if `FEATURE_DIR/checklists/requirements.md` exists)
319
- - [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
320
- - [ ] Completion reported to user with questions answered, sections touched, checklist status, and coverage summary
@@ -1,194 +0,0 @@
1
- ---
2
- name: "aw-spec-constitution"
3
- description: "Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync."
4
- argument-hint: "Principles or values for the project constitution"
5
- compatibility: "Requires aw-spec project structure with .aw-spec/ directory"
6
- metadata:
7
- author: "github-aw-spec"
8
- source: "templates/commands/constitution.md"
9
- user-invocable: true
10
- disable-model-invocation: false
11
- ---
12
-
13
-
14
- ## User Input
15
-
16
- ```text
17
- $ARGUMENTS
18
- ```
19
-
20
- You **MUST** consider the user input before proceeding (if not empty).
21
-
22
- ## Context Reuse (cross-command dedup)
23
-
24
- **Skip Read-ing any file already in this conversation.** Before loading a standards/domain/template/spec file this command names, check whether it is already in context (loaded earlier here or by a prior `/aw-spec-*` command). If present and unchanged, reuse it and **skip the Read** — only Read files not yet loaded. A file already in context still counts as loaded; this just avoids the redundant re-read.
25
-
26
- ## Auto-Loaded Engineering Standards (Required Context)
27
-
28
- **Before doing anything else in this command, load the project engineering-standards files listed below into context using the Read tool.** These were previously supplied manually as `@docs/...` mentions; they are now loaded automatically so the user does not need to pass them. Rules:
29
-
30
- - Read each file below **before** starting the Pre-Execution Checks / Outline. Treat their contents as authoritative engineering standards for this command (the constitution being built/updated here is supreme; these inform it).
31
- - If a listed file does not exist, skip it silently and continue — do **not** error and do **not** ask the user to provide it.
32
- - This is the **domain-agnostic technical** set, so the framework is reusable across domains. Domain-specific rule files (e.g. healthcare FHIR/HL7/PHI) are **not** part of this set — they are offered separately in the **Domain Rule-File Selection** section below (sourced from `comandrulemap.md`). You can also add any extra file directly with an `@` mention.
33
-
34
- Standards for `/aw-spec-constitution`:
35
- - docs/technology-constitution.md
36
- - docs/glossary/ai-rules.md
37
-
38
- > **Constitution source — compose model.** The **domain-agnostic technology base** (`docs/technology-constitution.md`, auto-loaded above) IS the reusable principle base to ratify (Core Principles I–XV, governance, folder/convention pointers) — treat it as the source foundation, not mere reference. The **domain addenda** (the per-domain principles XVI+, identity, regulatory regime) is **not** auto-loaded and is **not** part of the Domain Rule-File Selection set: the user supplies exactly one via an `@`-mentioned file (e.g. `@docs/<domain>-constitution.md` such as `@docs/pharma-constitution.md`) or pasted text, and it composes on top of the auto-loaded technology base. If no domain addenda is supplied, derive domain values from existing repo context per the Outline (do not invent principles).
39
-
40
- ## Domain Rule-File Selection (interactive)
41
-
42
- After the technical standards above are loaded, and **before** the Pre-Execution Checks, resolve the active domain and ask the user which **domain** rule files to load for this command:
43
-
44
- 1. **Resolve the active domain.** Read `.aw-spec/domain.json` and take its `domain` value — the active domain-specs folder name. The candidate domain rule files are the bullet list under the `## /aw-spec-constitution` heading in `docs/domainspecs/<domain>/comandrulemap.md`.
45
- 2. **Domain gate (missing domain or rules).** If `.aw-spec/domain.json` is absent or its `domain` is empty, **or** `docs/domainspecs/<domain>/comandrulemap.md` does not exist:
46
- - Ask one single-select question with the AskUserQuestion tool — *"Domain is not set or its rule files are missing (state which: no domain set / domain '<domain>' has no comandrulemap.md). Continue without domain rules?"* — with options **"Continue (technical only)"** and **"Exit"**.
47
- - **Continue (technical only)** → skip steps 3-5 and proceed with only the auto-loaded technical standards (plus any `@`-mentioned files).
48
- - **Exit** → stop the command **immediately** with no side effects: do **not** run the Pre-Execution Checks, hooks, Outline, or any later step, and create/modify nothing. Tell the user to run `/aw-spec-select-domain` (or fix the domain folder) and re-run.
49
- - If interactive questions cannot be asked (non-interactive/automated run), default to **Continue (technical only)**.
50
- - Exception: if `comandrulemap.md` exists but has **no entries under this command's heading**, this is **not** a gate trigger — load no domain files for this command and continue normally to the Pre-Execution Checks.
51
- 3. **Show a selection box** using the AskUserQuestion tool:
52
- - Ask one single-select question — *"Domain rule files for /aw-spec-constitution:"* — with options **"Select all (recommended)"**, **"Pick a subset"**, and **"None (technical only)"**.
53
- - If the user chooses **"Pick a subset"**, follow up with **multi-select** questions whose options are the individual candidate files so the user can tick the ones they want. AskUserQuestion allows ≤4 options per question and ≤4 questions per call, so split the candidates into groups of ≤4 (by category: architecture overlays, clinical domain, security overlays, governance overlays, glossary) across as many calls as needed.
54
- - If interactive questions cannot be asked (non-interactive or automated run), skip the prompt and default to **Select all**.
55
- 4. **Load the selection.** Read every file the user selected (the full list for "Select all"; nothing extra for "None"). If any selected file does not exist on disk, skip it silently and continue — do not error.
56
- 5. **Final context set** = the always-loaded technical standards (section above) **+** the domain files selected here **+** any files the user passed via `@` mention in their command. The `@`-mentioned files are always loaded in addition, whether or not they appear in the candidate list, and are never removed by a "None"/subset choice.
57
- 6. Proceed to the Pre-Execution Checks only after the selected files are loaded.
58
-
59
- ## Pre-Execution Checks
60
-
61
- **Check for extension hooks (before constitution update)**:
62
- - Check if `.aw-spec/extensions.yml` exists in the project root.
63
- - If it exists, read it and look for entries under the `hooks.before_constitution` key
64
- - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
65
- - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
66
- - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
67
- - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
68
- - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
69
- - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
70
- - For each executable hook, output the following based on its `optional` flag:
71
- - **Optional hook** (`optional: true`):
72
- ```
73
- ## Extension Hooks
74
-
75
- **Optional Pre-Hook**: {extension}
76
- Command: `/{command}`
77
- Description: {description}
78
-
79
- Prompt: {prompt}
80
- To execute: `/{command}`
81
- ```
82
- - **Mandatory hook** (`optional: false`):
83
- ```
84
- ## Extension Hooks
85
-
86
- **Automatic Pre-Hook**: {extension}
87
- Executing: `/{command}`
88
- EXECUTE_COMMAND: {command}
89
-
90
- Wait for the result of the hook command before proceeding to the Outline.
91
- ```
92
- - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently
93
-
94
- ## Outline
95
-
96
- You are updating the project constitution at `.aw-spec/memory/constitution.md`. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g. `[PROJECT_NAME]`, `[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts.
97
-
98
- **Note**: If `.aw-spec/memory/constitution.md` does not exist yet, it should have been initialized from `.aw-spec/templates/constitution-template.md` during project setup. If it's missing, copy the template first.
99
-
100
- Follow this execution flow:
101
-
102
- 1. Load the existing constitution at `.aw-spec/memory/constitution.md`.
103
- - Identify every placeholder token of the form `[ALL_CAPS_IDENTIFIER]`.
104
- **IMPORTANT**: The user might require less or more principles than the ones used in the template. If a number is specified, respect that - follow the general template. You will update the doc accordingly.
105
-
106
- 2. Collect/derive values for placeholders:
107
- - If user input (conversation) supplies a value, use it.
108
- - Otherwise infer from existing repo context (README, docs, prior constitution versions if embedded).
109
- - For governance dates: `RATIFICATION_DATE` is the original adoption date (if unknown ask or mark TODO), `LAST_AMENDED_DATE` is today if changes are made, otherwise keep previous.
110
- - `CONSTITUTION_VERSION` must increment according to semantic versioning rules:
111
- - MAJOR: Backward incompatible governance/principle removals or redefinitions.
112
- - MINOR: New principle/section added or materially expanded guidance.
113
- - PATCH: Clarifications, wording, typo fixes, non-semantic refinements.
114
- - If version bump type ambiguous, propose reasoning before finalizing.
115
-
116
- 3. Draft the updated constitution content:
117
- - Replace every placeholder with concrete text (no bracketed tokens left except intentionally retained template slots that the project has chosen not to define yet—explicitly justify any left).
118
- - Preserve heading hierarchy and comments can be removed once replaced unless they still add clarifying guidance.
119
- - Ensure each Principle section: succinct name line, paragraph (or bullet list) capturing non‑negotiable rules, explicit rationale if not obvious.
120
- - Ensure Governance section lists amendment procedure, versioning policy, and compliance review expectations.
121
-
122
- 4. Consistency propagation checklist (convert prior checklist into active validations):
123
- - Read `.aw-spec/templates/plan-template.md` and ensure any "Constitution Check" or rules align with updated principles.
124
- - Read `.aw-spec/templates/spec-template.md` for scope/requirements alignment—update if constitution adds/removes mandatory sections or constraints.
125
- - Read `.aw-spec/templates/tasks-template.md` and ensure task categorization reflects new or removed principle-driven task types (e.g., observability, versioning, testing discipline).
126
- - Read each command file in `.aw-spec/templates/commands/*.md` (including this one) to verify no outdated references (agent-specific names like CLAUDE only) remain when generic guidance is required.
127
- - Read any runtime guidance docs (e.g., `README.md`, `docs/quickstart.md`, or agent-specific guidance files if present). Update references to principles changed.
128
-
129
- 5. Produce a Sync Impact Report (prepend as an HTML comment at top of the constitution file after update):
130
- - Version change: old → new
131
- - List of modified principles (old title → new title if renamed)
132
- - Added sections
133
- - Removed sections
134
- - Templates requiring updates (✅ updated / ⚠ pending) with file paths
135
- - Follow-up TODOs if any placeholders intentionally deferred.
136
-
137
- 6. Validation before final output:
138
- - No remaining unexplained bracket tokens.
139
- - Version line matches report.
140
- - Dates ISO format YYYY-MM-DD.
141
- - Principles are declarative, testable, and free of vague language ("should" → replace with MUST/SHOULD rationale where appropriate).
142
-
143
- 7. Write the completed constitution back to `.aw-spec/memory/constitution.md` (overwrite).
144
-
145
- 8. Output a final summary to the user with:
146
- - New version and bump rationale.
147
- - Any files flagged for manual follow-up.
148
- - Suggested commit message (e.g., `docs: amend constitution to vX.Y.Z (principle additions + governance update)`).
149
-
150
- Formatting & Style Requirements:
151
-
152
- - Use Markdown headings exactly as in the template (do not demote/promote levels).
153
- - Wrap long rationale lines to keep readability (<100 chars ideally) but do not hard enforce with awkward breaks.
154
- - Keep a single blank line between sections.
155
- - Avoid trailing whitespace.
156
-
157
- If the user supplies partial updates (e.g., only one principle revision), still perform validation and version decision steps.
158
-
159
- If critical info missing (e.g., ratification date truly unknown), insert `TODO(<FIELD_NAME>): explanation` and include in the Sync Impact Report under deferred items.
160
-
161
- Do not create a new template; always operate on the existing `.aw-spec/memory/constitution.md` file.
162
-
163
- ## Post-Execution Checks
164
-
165
- **Check for extension hooks (after constitution update)**:
166
- Check if `.aw-spec/extensions.yml` exists in the project root.
167
- - If it exists, read it and look for entries under the `hooks.after_constitution` key
168
- - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
169
- - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
170
- - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
171
- - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
172
- - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
173
- - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
174
- - For each executable hook, output the following based on its `optional` flag:
175
- - **Optional hook** (`optional: true`):
176
- ```
177
- ## Extension Hooks
178
-
179
- **Optional Hook**: {extension}
180
- Command: `/{command}`
181
- Description: {description}
182
-
183
- Prompt: {prompt}
184
- To execute: `/{command}`
185
- ```
186
- - **Mandatory hook** (`optional: false`):
187
- ```
188
- ## Extension Hooks
189
-
190
- **Automatic Hook**: {extension}
191
- Executing: `/{command}`
192
- EXECUTE_COMMAND: {command}
193
- ```
194
- - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently