bmad-module-skill-forge 1.9.0 → 2.0.1

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 (281) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.nvmrc +1 -1
  3. package/README.md +10 -5
  4. package/docs/_data/pinned.yaml +2 -2
  5. package/docs/agents.md +11 -2
  6. package/docs/architecture.md +5 -4
  7. package/docs/bmad-synergy.md +30 -7
  8. package/docs/campaign.md +172 -0
  9. package/docs/examples.md +7 -3
  10. package/docs/forge-auto.md +90 -0
  11. package/docs/getting-started.md +9 -0
  12. package/docs/how-it-works.md +6 -4
  13. package/docs/index.md +4 -3
  14. package/docs/skill-model.md +1 -1
  15. package/docs/troubleshooting.md +17 -1
  16. package/docs/verifying-a-skill.md +2 -2
  17. package/docs/why-skf.md +1 -1
  18. package/docs/workflows.md +64 -24
  19. package/package.json +2 -2
  20. package/src/knowledge/skill-lifecycle.md +1 -1
  21. package/src/module-help.csv +4 -3
  22. package/src/shared/data/language-corpora.json +32 -0
  23. package/src/shared/references/pipeline-contracts.md +6 -3
  24. package/src/shared/scripts/schemas/skill-brief.v1.json +6 -1
  25. package/src/shared/scripts/skf-comention-pairs.py +350 -0
  26. package/src/shared/scripts/skf-count-tokens.py +222 -0
  27. package/src/shared/scripts/skf-derive-assembly-shape.py +107 -0
  28. package/src/shared/scripts/skf-detect-docs.py +240 -4
  29. package/src/shared/scripts/skf-detect-language.py +82 -3
  30. package/src/shared/scripts/skf-detect-tools.py +105 -2
  31. package/src/shared/scripts/skf-emit-result-envelope.py +17 -0
  32. package/src/shared/scripts/skf-enumerate-stack-skills.py +111 -2
  33. package/src/shared/scripts/skf-extract-public-api.py +53 -0
  34. package/src/shared/scripts/skf-find-cycles.py +246 -0
  35. package/src/shared/scripts/skf-hash-content.py +487 -2
  36. package/src/shared/scripts/skf-language-corpora.py +100 -0
  37. package/src/shared/scripts/skf-manifest-ops.py +67 -1
  38. package/src/shared/scripts/skf-merge-doc-urls.py +244 -0
  39. package/src/shared/scripts/skf-preapply.py +1 -1
  40. package/src/shared/scripts/skf-rebuild-managed-sections.py +180 -0
  41. package/src/shared/scripts/skf-recommend-scope-type.py +1 -2
  42. package/src/shared/scripts/skf-render-metadata-stats.py +499 -0
  43. package/src/shared/scripts/skf-rewrite-skill-name.py +308 -0
  44. package/src/shared/scripts/skf-shape-detect.py +576 -25
  45. package/src/shared/scripts/skf-shard-body.py +461 -0
  46. package/src/shared/scripts/skf-skill-inventory.py +139 -3
  47. package/src/shared/scripts/skf-structural-diff.py +307 -67
  48. package/src/shared/scripts/skf-validate-brief-schema.py +41 -6
  49. package/src/shared/scripts/skf-validate-feasibility-report.py +234 -0
  50. package/src/shared/scripts/skf-validate-frontmatter.py +17 -12
  51. package/src/shared/scripts/skf-validate-output.py +443 -10
  52. package/src/shared/scripts/skf-validate-pins.py +3 -3
  53. package/src/shared/scripts/skf-verify-no-trace.py +214 -0
  54. package/src/shared/scripts/skf-verify-provenance-completeness.py +439 -0
  55. package/src/shared/scripts/skf-write-skill-brief.py +21 -5
  56. package/src/skf-analyze-source/SKILL.md +17 -32
  57. package/src/skf-analyze-source/assets/skill-brief-schema.md +1 -1
  58. package/src/skf-analyze-source/customize.toml +2 -0
  59. package/src/skf-analyze-source/references/auto-docs-only.md +116 -0
  60. package/src/skf-analyze-source/references/continue.md +8 -13
  61. package/src/skf-analyze-source/references/generate-briefs.md +28 -12
  62. package/src/skf-analyze-source/references/headless-contract.md +33 -0
  63. package/src/skf-analyze-source/references/health-check.md +1 -2
  64. package/src/skf-analyze-source/references/identify-units.md +25 -36
  65. package/src/skf-analyze-source/references/init.md +12 -25
  66. package/src/skf-analyze-source/references/map-and-detect.md +8 -20
  67. package/src/skf-analyze-source/references/recommend.md +4 -14
  68. package/src/skf-analyze-source/references/scan-project.md +3 -11
  69. package/src/skf-analyze-source/references/step-auto-scope.md +211 -197
  70. package/src/skf-analyze-source/references/step-shape-detect.md +20 -13
  71. package/src/skf-analyze-source/references/unit-detection-heuristics.md +2 -2
  72. package/src/skf-audit-skill/SKILL.md +9 -6
  73. package/src/skf-audit-skill/customize.toml +2 -0
  74. package/src/skf-audit-skill/references/init.md +58 -32
  75. package/src/skf-audit-skill/references/re-index.md +15 -34
  76. package/src/skf-audit-skill/references/report.md +11 -58
  77. package/src/skf-audit-skill/references/semantic-diff.md +4 -22
  78. package/src/skf-audit-skill/references/severity-classify.md +53 -87
  79. package/src/skf-audit-skill/references/step-doc-drift.md +49 -19
  80. package/src/skf-audit-skill/references/structural-diff.md +43 -68
  81. package/src/skf-brief-skill/SKILL.md +7 -36
  82. package/src/skf-brief-skill/assets/scope-templates.md +1 -1
  83. package/src/skf-brief-skill/assets/skill-brief-schema.md +1 -1
  84. package/src/skf-brief-skill/customize.toml +14 -0
  85. package/src/skf-brief-skill/references/analyze-target.md +13 -18
  86. package/src/skf-brief-skill/references/confirm-brief.md +2 -15
  87. package/src/skf-brief-skill/references/draft-checkpoint.md +8 -8
  88. package/src/skf-brief-skill/references/gather-intent.md +27 -24
  89. package/src/skf-brief-skill/references/headless-args.md +1 -1
  90. package/src/skf-brief-skill/references/health-check.md +1 -22
  91. package/src/skf-brief-skill/references/invocation-contract.md +37 -0
  92. package/src/skf-brief-skill/references/scope-definition.md +6 -15
  93. package/src/skf-brief-skill/references/step-auto-brief.md +22 -9
  94. package/src/skf-brief-skill/references/step-auto-validate.md +3 -7
  95. package/src/skf-brief-skill/references/version-resolution.md +1 -1
  96. package/src/skf-brief-skill/references/write-brief.md +19 -13
  97. package/src/skf-campaign/SKILL.md +121 -0
  98. package/src/skf-campaign/assets/campaign-state-schema.json +191 -0
  99. package/src/skf-campaign/customize.toml +75 -0
  100. package/src/skf-campaign/manifest.yaml +15 -0
  101. package/src/skf-campaign/references/campaign-contracts.md +67 -0
  102. package/src/skf-campaign/references/campaign-directive-spec.md +32 -0
  103. package/src/skf-campaign/references/health-check.md +35 -0
  104. package/src/skf-campaign/references/step-01-setup.md +121 -0
  105. package/src/skf-campaign/references/step-02-strategy.md +102 -0
  106. package/src/skf-campaign/references/step-03-pins.md +56 -0
  107. package/src/skf-campaign/references/step-04-provenance.md +63 -0
  108. package/src/skf-campaign/references/step-05-skill-loop.md +103 -0
  109. package/src/skf-campaign/references/step-06-batch.md +88 -0
  110. package/src/skf-campaign/references/step-07-capstone.md +63 -0
  111. package/src/skf-campaign/references/step-08-verify.md +75 -0
  112. package/src/skf-campaign/references/step-09-refine.md +83 -0
  113. package/src/skf-campaign/references/step-10-export.md +106 -0
  114. package/src/skf-campaign/references/step-11-maintenance.md +84 -0
  115. package/src/skf-campaign/references/step-resume.md +115 -0
  116. package/src/skf-campaign/scripts/.gitkeep +0 -0
  117. package/src/skf-campaign/scripts/campaign-deps.py +244 -0
  118. package/src/skf-campaign/scripts/campaign-parse-manifest.py +119 -0
  119. package/src/skf-campaign/scripts/campaign-provenance.py +247 -0
  120. package/src/skf-campaign/scripts/campaign-render-batch.py +199 -0
  121. package/src/skf-campaign/scripts/campaign-render-kickoff.py +158 -0
  122. package/src/skf-campaign/scripts/campaign-report.py +249 -0
  123. package/src/skf-campaign/scripts/campaign-status.py +162 -0
  124. package/src/skf-campaign/scripts/campaign-validate-pins.py +174 -0
  125. package/src/skf-campaign/scripts/campaign-validate-state.py +207 -0
  126. package/src/skf-campaign/templates/campaign-brief-template.yaml +34 -0
  127. package/src/skf-campaign/templates/campaign-report-template.md +54 -0
  128. package/src/skf-campaign/templates/kickoff-template.md +48 -0
  129. package/src/skf-create-skill/SKILL.md +15 -4
  130. package/src/skf-create-skill/assets/compile-assembly-rules.md +35 -34
  131. package/src/skf-create-skill/assets/skill-sections.md +9 -100
  132. package/src/skf-create-skill/assets/tessl-dismissal-rules.md +4 -13
  133. package/src/skf-create-skill/customize.toml +13 -0
  134. package/src/skf-create-skill/references/authoritative-files-protocol.md +7 -7
  135. package/src/skf-create-skill/references/compile.md +37 -47
  136. package/src/skf-create-skill/references/component-extraction.md +8 -35
  137. package/src/skf-create-skill/references/ecosystem-check.md +9 -25
  138. package/src/skf-create-skill/references/enrich.md +4 -17
  139. package/src/skf-create-skill/references/extract.md +20 -27
  140. package/src/skf-create-skill/references/extraction-patterns-tracing.md +1 -1
  141. package/src/skf-create-skill/references/extraction-patterns.md +10 -8
  142. package/src/skf-create-skill/references/generate-artifacts.md +20 -25
  143. package/src/skf-create-skill/references/health-check.md +2 -2
  144. package/src/skf-create-skill/references/load-brief.md +16 -18
  145. package/src/skf-create-skill/references/report.md +27 -14
  146. package/src/skf-create-skill/references/source-resolution-protocols.md +4 -4
  147. package/src/skf-create-skill/references/step-auto-shard.md +52 -25
  148. package/src/skf-create-skill/references/step-doc-rot.md +33 -15
  149. package/src/skf-create-skill/references/step-doc-sources.md +13 -4
  150. package/src/skf-create-skill/references/sub/ccc-discover.md +2 -13
  151. package/src/skf-create-skill/references/sub/fetch-docs.md +33 -46
  152. package/src/skf-create-skill/references/sub/fetch-temporal.md +5 -20
  153. package/src/skf-create-skill/references/tier-degradation-rules.md +6 -8
  154. package/src/skf-create-skill/references/validate.md +69 -29
  155. package/src/skf-create-skill/scripts/scan-doc-rot.py +245 -0
  156. package/src/skf-create-stack-skill/SKILL.md +15 -9
  157. package/src/skf-create-stack-skill/assets/provenance-map-schema.md +1 -1
  158. package/src/skf-create-stack-skill/customize.toml +10 -0
  159. package/src/skf-create-stack-skill/references/compile-stack.md +7 -8
  160. package/src/skf-create-stack-skill/references/compose-mode-rules.md +2 -13
  161. package/src/skf-create-stack-skill/references/detect-integrations.md +49 -54
  162. package/src/skf-create-stack-skill/references/detect-manifests.md +37 -30
  163. package/src/skf-create-stack-skill/references/generate-output.md +24 -75
  164. package/src/skf-create-stack-skill/references/init.md +9 -81
  165. package/src/skf-create-stack-skill/references/manifest-patterns.md +5 -35
  166. package/src/skf-create-stack-skill/references/parallel-extract.md +12 -27
  167. package/src/skf-create-stack-skill/references/rank-and-confirm.md +6 -6
  168. package/src/skf-create-stack-skill/references/report.md +27 -62
  169. package/src/skf-create-stack-skill/references/validate.md +35 -31
  170. package/src/skf-drop-skill/SKILL.md +20 -23
  171. package/src/skf-drop-skill/customize.toml +10 -0
  172. package/src/skf-drop-skill/references/execute.md +67 -36
  173. package/src/skf-drop-skill/references/headless-contract.md +18 -0
  174. package/src/skf-drop-skill/references/health-check.md +1 -13
  175. package/src/skf-drop-skill/references/report.md +44 -10
  176. package/src/skf-drop-skill/references/select.md +93 -48
  177. package/src/skf-drop-skill/scripts/dir-sizes.py +116 -0
  178. package/src/skf-export-skill/SKILL.md +17 -14
  179. package/src/skf-export-skill/assets/managed-section-format.md +2 -5
  180. package/src/skf-export-skill/customize.toml +10 -6
  181. package/src/skf-export-skill/references/generate-snippet.md +21 -35
  182. package/src/skf-export-skill/references/load-skill.md +44 -42
  183. package/src/skf-export-skill/references/multi-skill-mode.md +1 -1
  184. package/src/skf-export-skill/references/orphan-context-detection.md +11 -3
  185. package/src/skf-export-skill/references/package.md +27 -33
  186. package/src/skf-export-skill/references/preflight-snippet-root-probe.md +24 -5
  187. package/src/skf-export-skill/references/result-envelope.md +28 -0
  188. package/src/skf-export-skill/references/summary.md +11 -5
  189. package/src/skf-export-skill/references/token-report.md +42 -24
  190. package/src/skf-export-skill/references/update-context.md +32 -33
  191. package/src/skf-forger/SKILL.md +32 -39
  192. package/src/skf-forger/references/pipeline-mode.md +34 -0
  193. package/src/skf-forger/scripts/parse-pipeline.py +270 -0
  194. package/src/skf-quick-skill/SKILL.md +10 -60
  195. package/src/skf-quick-skill/customize.toml +9 -0
  196. package/src/skf-quick-skill/references/batch-mode.md +6 -4
  197. package/src/skf-quick-skill/references/compile.md +15 -52
  198. package/src/skf-quick-skill/references/ecosystem-check.md +5 -20
  199. package/src/skf-quick-skill/references/finalize.md +12 -6
  200. package/src/skf-quick-skill/references/halt-contract.md +54 -0
  201. package/src/skf-quick-skill/references/health-check.md +3 -4
  202. package/src/skf-quick-skill/references/quick-extract.md +7 -18
  203. package/src/skf-quick-skill/references/registry-resolution.md +1 -23
  204. package/src/skf-quick-skill/references/resolve-target.md +27 -34
  205. package/src/skf-quick-skill/references/write-and-validate.md +10 -25
  206. package/src/skf-refine-architecture/SKILL.md +16 -8
  207. package/src/skf-refine-architecture/customize.toml +9 -0
  208. package/src/skf-refine-architecture/references/compile.md +10 -8
  209. package/src/skf-refine-architecture/references/gap-analysis.md +21 -50
  210. package/src/skf-refine-architecture/references/health-check.md +1 -1
  211. package/src/skf-refine-architecture/references/improvements.md +9 -25
  212. package/src/skf-refine-architecture/references/init.md +9 -16
  213. package/src/skf-refine-architecture/references/issue-detection.md +10 -25
  214. package/src/skf-refine-architecture/references/refinement-rules.md +4 -16
  215. package/src/skf-refine-architecture/references/report.md +14 -11
  216. package/src/skf-rename-skill/SKILL.md +11 -21
  217. package/src/skf-rename-skill/customize.toml +10 -0
  218. package/src/skf-rename-skill/references/execute.md +112 -82
  219. package/src/skf-rename-skill/references/exit-codes.md +12 -0
  220. package/src/skf-rename-skill/references/report.md +16 -8
  221. package/src/skf-rename-skill/references/select.md +69 -42
  222. package/src/skf-rename-skill/scripts/skf-validate-rename-name.py +161 -0
  223. package/src/skf-setup/SKILL.md +21 -13
  224. package/src/skf-setup/customize.toml +10 -0
  225. package/src/skf-setup/references/auto-index.md +11 -10
  226. package/src/skf-setup/references/ccc-index.md +14 -15
  227. package/src/skf-setup/references/detect-and-tier.md +10 -8
  228. package/src/skf-setup/references/report.md +26 -32
  229. package/src/skf-setup/references/tier-rules.md +2 -32
  230. package/src/skf-setup/references/write-config.md +9 -10
  231. package/src/skf-test-skill/SKILL.md +10 -8
  232. package/src/skf-test-skill/customize.toml +2 -0
  233. package/src/skf-test-skill/references/coherence-check.md +19 -31
  234. package/src/skf-test-skill/references/coverage-check.md +111 -67
  235. package/src/skf-test-skill/references/detect-mode.md +10 -41
  236. package/src/skf-test-skill/references/external-validators.md +11 -19
  237. package/src/skf-test-skill/references/init.md +39 -21
  238. package/src/skf-test-skill/references/migration-section-rules.md +4 -4
  239. package/src/skf-test-skill/references/report.md +60 -40
  240. package/src/skf-test-skill/references/score.md +32 -64
  241. package/src/skf-test-skill/references/scoring-rules.md +6 -62
  242. package/src/skf-test-skill/references/source-access-protocol.md +15 -5
  243. package/src/skf-test-skill/references/step-hard-gate.md +1 -3
  244. package/src/skf-test-skill/scripts/aggregate-coherence.py +276 -0
  245. package/src/skf-test-skill/scripts/check-metadata-coherence.py +359 -0
  246. package/src/skf-test-skill/scripts/combine-external-scores.py +190 -0
  247. package/src/skf-test-skill/scripts/compute-score.py +135 -4
  248. package/src/skf-test-skill/scripts/reconcile-coverage.py +327 -0
  249. package/src/skf-test-skill/scripts/validate-inventory.py +251 -0
  250. package/src/skf-test-skill/scripts/verify-declared-numerator.py +192 -0
  251. package/src/skf-update-skill/SKILL.md +17 -5
  252. package/src/skf-update-skill/customize.toml +11 -6
  253. package/src/skf-update-skill/references/detect-changes.md +48 -36
  254. package/src/skf-update-skill/references/health-check.md +5 -11
  255. package/src/skf-update-skill/references/init.md +40 -32
  256. package/src/skf-update-skill/references/manual-section-rules.md +1 -2
  257. package/src/skf-update-skill/references/merge-conflict-rules.md +1 -52
  258. package/src/skf-update-skill/references/merge.md +13 -57
  259. package/src/skf-update-skill/references/re-extract.md +27 -25
  260. package/src/skf-update-skill/references/report.md +14 -7
  261. package/src/skf-update-skill/references/validate.md +32 -30
  262. package/src/skf-update-skill/references/write.md +86 -51
  263. package/src/skf-update-skill/scripts/skf-new-file-diff.py +167 -0
  264. package/src/skf-verify-stack/SKILL.md +11 -21
  265. package/src/skf-verify-stack/customize.toml +12 -3
  266. package/src/skf-verify-stack/references/coverage-patterns.md +1 -29
  267. package/src/skf-verify-stack/references/coverage.md +21 -10
  268. package/src/skf-verify-stack/references/exit-codes.md +14 -0
  269. package/src/skf-verify-stack/references/health-check.md +1 -1
  270. package/src/skf-verify-stack/references/init.md +20 -25
  271. package/src/skf-verify-stack/references/integration-verification-rules.md +10 -19
  272. package/src/skf-verify-stack/references/integrations.md +44 -49
  273. package/src/skf-verify-stack/references/report.md +28 -34
  274. package/src/skf-verify-stack/references/requirements.md +3 -3
  275. package/src/skf-verify-stack/references/synthesize.md +36 -39
  276. package/src/skf-verify-stack/scripts/skf-coverage-tally.py +196 -0
  277. package/src/skf-verify-stack/scripts/skf-report-delta.py +256 -0
  278. package/src/skf-verify-stack/scripts/skf-verdict-rollup.py +258 -0
  279. package/tools/cli/lib/ui.js +3 -2
  280. package/docs/deepwiki.md +0 -89
  281. package/src/skf-rename-skill/references/rebuild-context.md +0 -110
@@ -22,21 +22,15 @@ Find undocumented integration paths — library pairs that have compatible APIs
22
22
 
23
23
  Use the refinement rules loaded in Step 01 from `{refinementRulesData}`. If not available in context, reload from `{refinementRulesData}`.
24
24
 
25
- Extract: gap classification (Missing Integration Path, Undocumented Data Flow, Absent Bridge Layer), detection method, and citation format.
25
+ Extract: gap classification (Missing Integration Path, Undocumented Data Flow, Absent Bridge Layer) and detection method.
26
26
 
27
27
  ### 2. Extract Integration Claims from Architecture
28
28
 
29
29
  Parse the architecture document for statements describing two or more technologies working together.
30
30
 
31
- **Detection method — prose-based co-mention analysis:**
32
- - Identify sentences or paragraphs where two or more technology names appear together
33
- - Look for integration verbs: "connects to", "communicates with", "wraps", "extends", "consumes", "produces", "bridges", "integrates with", "sits between", "feeds into", "receives from"
34
- - Look for data flow descriptions: "{A} sends data to {B}", "{A} results are consumed by {B}"
35
- - Look for layer boundary descriptions: "{A} at the API layer connects to {B} at the data layer"
31
+ **Detection method — prose-based co-mention analysis:** From prose text, find sentences or paragraphs where two or more technology names appear in an *integration relationship* — data flowing between them, one wrapping/bridging/extending/consuming another, or a layer boundary connecting them — not mere co-mention in the same document.
36
32
 
37
- **CRITICAL:** Do NOT parse Mermaid diagram syntax. Use only prose text for co-mention detection.
38
-
39
- **Mermaid Limitation Warning:** If `` ```mermaid `` blocks are present in the architecture document, inform the user: "Integration paths documented exclusively in Mermaid diagrams are excluded from co-mention analysis and may appear as false-positive gaps. Consider adding prose descriptions for diagram-only integration paths." Display this warning informatively and immediately continue — this does not halt or modify the analysis sequence.
33
+ **Mermaid limitation:** Detect co-mentions from prose text only, not from Mermaid diagram syntax an integration drawn only in a diagram would otherwise surface as a false-positive gap. If `` ```mermaid `` blocks are present in the architecture document, inform the user: "Integration paths documented exclusively in Mermaid diagrams are excluded from co-mention analysis and may appear as false-positive gaps. Consider adding prose descriptions for diagram-only integration paths." Display this warning informatively and immediately continue — this does not halt or modify the analysis sequence.
40
34
 
41
35
  **Build documented pairs list:**
42
36
  - Each pair: `{library_a, library_b, architectural_context}`
@@ -44,7 +38,7 @@ Parse the architecture document for statements describing two or more technologi
44
38
 
45
39
  ### 2b. Establish Document Scope
46
40
 
47
- The skill inventory (Step 01 §2) can span a wider product surface than the architecture document under refinement. Pairs drawn from a different surface are NOT actionable gaps for THIS document — surfacing them injects irrelevant integration recommendations (e.g. wiring real-time A/V libraries into an admin-dashboard architecture).
41
+ The skill inventory (Step 01 §2) can span a wider product surface than the architecture document under refinement. Pairs drawn from a different surface are not actionable gaps for this document — surfacing them injects irrelevant integration recommendations (e.g. wiring real-time A/V libraries into an admin-dashboard architecture).
48
42
 
49
43
  Resolve the in-scope skill set:
50
44
 
@@ -53,15 +47,15 @@ Resolve the in-scope skill set:
53
47
 
54
48
  `{out_of_scope_skills}` = inventory skills not in `{in_scope_skills}`. A library pair is **out-of-scope** when either of its libraries is in `{out_of_scope_skills}`.
55
49
 
56
- **Safe default:** If scope cannot be derived (e.g. the architecture references no inventory skill by name) and no `{scope_skills}` was provided, treat ALL skills as in-scope and note: "Could not derive document scope — analyzing all skill pairs." This preserves prior behavior rather than hiding gaps.
50
+ **Safe default:** If scope cannot be derived (e.g. the architecture references no inventory skill by name) and no `{scope_skills}` was provided, treat all skills as in-scope and note: "Could not derive document scope — analyzing all skill pairs." This keeps borderline gaps visible rather than hiding them.
57
51
 
58
52
  Store `{in_scope_skills}` and `{out_of_scope_skills}` as workflow state — Step 03 (issue detection) reuses them.
59
53
 
60
- ### 3. Generate All Possible Library Pairs
54
+ ### 3. Read the Pre-Computed Library Pairs
61
55
 
62
- From the skill inventory, generate all unique combinations of library pairs.
56
+ Read the pre-computed unique library pairs from `skill_inventory.pairs` (the enumerate helper's `--pairs` output cached in Step 01 §2 — the complete, deterministic pair set). Do not re-derive it in-context: a silently dropped or duplicated pair is a missed integration gap, this workflow's headline output.
63
57
 
64
- For N skills, this produces N*(N-1)/2 unique pairs.
58
+ If `skill_inventory.pairs` is absent (the helper was unavailable and the Step 01 §2 fallback path ran), derive the pairs from the inventory as a graceful-degradation fallback only.
65
59
 
66
60
  ### 4. Load Skill API Surfaces for Cross-Reference
67
61
 
@@ -69,10 +63,10 @@ For N skills, this produces N*(N-1)/2 unique pairs.
69
63
 
70
64
  For each library in the skill inventory, delegate reading to a parallel subagent. Launch up to **8 subagents concurrently** (batch larger inventories in rounds of 8).
71
65
 
72
- **Each subagent receives one skill's SKILL.md path and MUST:**
73
- 1. Read the SKILL.md file
74
- 2. Extract the API surface
75
- 3. ONLY return this compact JSON — no prose, no extra commentary:
66
+ **Each subagent receives one skill's SKILL.md path and:**
67
+ 1. Reads the SKILL.md file
68
+ 2. Extracts the API surface
69
+ 3. Returns only this compact JSON — no prose or extra commentary:
76
70
 
77
71
  ```json
78
72
  {
@@ -89,7 +83,7 @@ For each library in the skill inventory, delegate reading to a parallel subagent
89
83
  - `data_formats`: any data format indicators found in the SKILL.md
90
84
  - If a field has no matches, return an empty array `[]`
91
85
 
92
- **Parent collects all subagent JSON summaries.** Do not load full SKILL.md content into parent context.
86
+ **Parent collects all subagent JSON summaries.** Do not load full SKILL.md content into parent context. Store the collected summaries as `{skill_api_surfaces}` workflow state — Step 03 (issue detection) and Step 04 (improvements) reuse them exactly like `{in_scope_skills}`, rather than re-reading each SKILL.md into the parent. This §4 delegate-the-read (compact-JSON return, no full-file load in parent) is the canonical API-surface read pattern for the workflow.
93
87
 
94
88
  **From metadata.json (read in parent — lightweight), also extract:**
95
89
  - `language` — primary programming language
@@ -97,21 +91,21 @@ For each library in the skill inventory, delegate reading to a parallel subagent
97
91
 
98
92
  ### 5. Cross-Reference: Identify Gaps
99
93
 
100
- For each possible library pair NOT already documented in the architecture:
94
+ For each library pair in `skill_inventory.pairs` (from §3) not already documented in the architecture:
101
95
 
102
96
  **Check API compatibility:**
103
97
  - Does Library A export types or data that Library B can consume?
104
98
  - Do both libraries share a compatible protocol or data format?
105
99
  - Are they in the same language or is there a bridge mechanism available?
106
100
 
107
- **Scope routing (from §2b):** Before classifying, check the pair's scope. If the pair is **out-of-scope** (either library is in `{out_of_scope_skills}`), do NOT add it to the gap list even when its APIs are compatible — record it in the informational **Out-of-Scope** bucket instead (a compatible pair that belongs to a different product surface than this architecture). Only **in-scope** pairs proceed to gap classification below.
101
+ **Scope routing (from §2b):** Before classifying, check the pair's scope. If the pair is **out-of-scope** (either library is in `{out_of_scope_skills}`), do not add it to the gap list even when its APIs are compatible — record it in the informational **Out-of-Scope** bucket instead (a compatible pair that belongs to a different product surface than this architecture). Only **in-scope** pairs proceed to gap classification below.
108
102
 
109
103
  **If compatible APIs exist (in-scope pair) but NO architecture mention:**
110
104
  - Classify the gap type (Missing Integration Path, Undocumented Data Flow, or Absent Bridge Layer)
111
105
  - Document the connecting APIs from both skills
112
106
  - Propose a brief architecture section describing the integration
113
107
 
114
- **Apply the citation format from {refinementRulesData}:**
108
+ **Cite each gap in this format:**
115
109
  ```
116
110
  **[GAP]**: {description}
117
111
 
@@ -125,37 +119,14 @@ Suggestion: {proposed architecture section content}
125
119
 
126
120
  **If no compatible APIs:** Skip this pair — not all pairs need to integrate.
127
121
 
128
- ### 6. Display Gap Analysis Results
129
-
130
- "**Pass 1: Gap Analysis — Undocumented Integration Paths**
131
-
132
- **Gaps Found (in-scope):** {count}
133
-
134
- {IF gaps found:}
135
- | # | Library A | Library B | Gap Type | Connecting APIs |
136
- |---|-----------|-----------|----------|-----------------|
137
- | {n} | {lib_a} | {lib_b} | {gap_type} | {brief API description} |
138
-
139
- {For each gap, display the full citation with evidence and suggestion}
140
-
141
- {IF out-of-scope compatible pairs exist (from §2b/§5):}
142
- **Out of scope for this document:** {oos_count} compatible pair(s) involve skills outside this architecture's surface — `{out_of_scope_skills}` — and were NOT counted as gaps. Listed for awareness only:
143
-
144
- | Library A | Library B | Reason |
145
- |-----------|-----------|--------|
146
- | {lib_a} | {lib_b} | out-of-scope — not referenced in this architecture |
147
-
148
- If any of these belongs in this architecture, re-run with `--scope-skills` naming the skills to include.
149
-
150
- {IF no gaps found AND N > 1:}
151
- **No undocumented integration paths detected.** The architecture document covers all compatible in-scope library pairs.
122
+ ### 6. Report Gaps & Store Findings
152
123
 
153
- {IF no gaps found AND N == 1:}
154
- **⚠️ Gap analysis skipped — only 1 skill loaded.** Pairwise integration analysis requires at least 2 skills. If the architecture references multiple libraries, those without a matching skill are invisible to gap analysis. **Recommendation:** Generate skills for all architecture libraries with [CS] or [QS] before running [RA] for comprehensive gap detection.
124
+ Report the in-scope gap count, then list each gap as a row of **# / Library A / Library B / Gap Type / Connecting APIs** followed by its full §5 citation. Two signals are not inferable from the counts and must survive regardless of format:
155
125
 
156
- **Proceeding to issue detection (still produces value with 1 skill)...**"
126
+ - **N == 1 (only one skill loaded):** gap analysis is skipped — pairwise integration analysis needs ≥2 skills, and libraries without a matching skill are invisible to it. Recommend generating skills for all architecture libraries with [CS] or [QS] before re-running [RA], and note issue detection still runs.
127
+ - **Out-of-scope compatible pairs exist (from §2b/§5):** list them separately for awareness only — they were not counted as gaps — and note that re-running with `--scope-skills` (naming the skills to include) pulls any that belong into scope.
157
128
 
158
- Store all **in-scope** gap findings as workflow state for Step 05. To ensure durability across long runs, also append a `<!-- [RA-GAPS] ... -->` comment block to `{forge_data_folder}/ra-state-{project_name}.md` containing the **complete formatted gap findings** (full citation blocks with evidence and suggestions, not just counts) — Step 05 can read this back if context degrades. Record out-of-scope pairs under a separate `<!-- [RA-OUT-OF-SCOPE] ... -->` marker (NOT `[RA-GAPS]`) so Step 05 does not compile them into the refined document — they are informational only. **Do NOT write to `{output_folder}/refined-architecture-{project_name}.md` — that file is created only in step 5.**
129
+ Store the **in-scope** gap findings per the Finding Storage rule (refinement rules), under a `<!-- [RA-GAPS] ... -->` block. Record out-of-scope pairs under a separate `<!-- [RA-OUT-OF-SCOPE] ... -->` marker so Step 05 leaves them out of the refined document — they are informational only.
159
130
 
160
131
  ### 7. Auto-Proceed to Next Step
161
132
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  # Note: `shared/health-check.md` resolves relative to the SKF module root
3
3
  # ({project-root}/_bmad/skf/ when installed, {project-root}/src/ during
4
- # development), NOT relative to this step file.
4
+ # development), not relative to this step file.
5
5
  nextStepFile: 'shared/health-check.md'
6
6
  ---
7
7
 
@@ -23,7 +23,7 @@ Identify capability expansions — library features documented in the generated
23
23
 
24
24
  Use the refinement rules loaded in Step 01 from `{refinementRulesData}`. If not available in context, reload from `{refinementRulesData}`.
25
25
 
26
- Extract: improvement classification (Unused Capability, Cross-Library Synergy, Alternative Pattern), detection method, and citation format.
26
+ Extract: improvement classification (Unused Capability, Cross-Library Synergy, Alternative Pattern) and detection method.
27
27
 
28
28
  ### 2. Build Architecture Usage Map
29
29
 
@@ -39,15 +39,13 @@ This creates a map of `{library} -> {described_usage[]}` for comparison against
39
39
 
40
40
  For each skill in the inventory:
41
41
 
42
- **Load the full API surface from SKILL.md:**
43
- - All exported functions with signatures
44
- - All exported types and interfaces
45
- - All documented capabilities and features
46
- - All protocol support indicators
42
+ **Start from the surfaces already collected.** Reuse `{skill_api_surfaces}` (the compact `{exports, protocols, data_formats}` summaries from Step 02 §4) for exports, types, and protocol support — do not re-read SKILL.md in the parent.
43
+
44
+ **For the fuller capability read** — documented capabilities and features that go beyond §4's exports/protocols/data_formats extraction — delegate to parallel subagents mirroring Step 02 §4 (the canonical delegate-the-read pattern): each subagent reads one SKILL.md and returns compact JSON listing that skill's documented capabilities/features; the parent collects the summaries without loading full SKILL.md content. Reload a file directly only if its summary is unavailable or context has compacted.
47
45
 
48
46
  **Compare against the architecture usage map:**
49
47
  - Which exports does the architecture reference or imply usage of?
50
- - Which exports are NOT referenced in the architecture at all?
48
+ - Which exports are not referenced in the architecture at all?
51
49
 
52
50
  **For each unreferenced capability:**
53
51
  - Evaluate relevance: would this capability strengthen the architecture?
@@ -66,7 +64,7 @@ Examine pairs of skills for complementary capabilities not exploited in the arch
66
64
 
67
65
  ### 5. Document Each Improvement
68
66
 
69
- For each detected improvement, apply the citation format from {refinementRulesData}:
67
+ For each detected improvement, cite it in this format:
70
68
 
71
69
  ```
72
70
  **[IMPROVEMENT]**: {description}
@@ -84,25 +82,11 @@ Suggestion: {how to incorporate this capability into the architecture}
84
82
  - **Medium:** Capabilities that add convenience or efficiency improvements
85
83
  - **Low:** Capabilities that are nice-to-have but not impactful
86
84
 
87
- ### 6. Display Improvement Suggestions
88
-
89
- "**Pass 3: Improvement Detection — Untapped Capabilities**
90
-
91
- **Improvements Found:** {count} ({high_count} high value, {medium_count} medium, {low_count} low)
92
-
93
- {IF improvements found:}
94
- | # | Library | Improvement Type | Value | Summary |
95
- |---|---------|-----------------|-------|---------|
96
- | {n} | {lib} | {type} | {value} | {brief description} |
97
-
98
- {For each improvement, display the full citation with evidence and suggestion}
99
-
100
- {IF no improvements found:}
101
- **No untapped capabilities detected.** The architecture fully leverages the skill API surfaces.
85
+ ### 6. Report Improvements & Store Findings
102
86
 
103
- **Proceeding to compile refined architecture...**"
87
+ Report the improvement count with its high/medium/low value breakdown, then list each improvement as a row of **# / Library / Improvement Type / Value / Summary** followed by its full §5 citation.
104
88
 
105
- Store all improvement findings as workflow state for Step 05. To ensure durability across long runs, also append a `<!-- [RA-IMPROVEMENTS] ... -->` comment block to `{forge_data_folder}/ra-state-{project_name}.md` containing the **complete formatted improvement findings** (full citation blocks with evidence, value ratings, and suggestions — not just counts) — Step 05 can read this back if context degrades. **Do NOT write to `{output_folder}/refined-architecture-{project_name}.md` — that file is created only in step 5.**
89
+ Store the improvement findings per the Finding Storage rule (refinement rules), under a `<!-- [RA-IMPROVEMENTS] ... -->` block (its citations carry the evidence, value rating, and suggestion).
106
90
 
107
91
  ### 7. Auto-Proceed to Next Step
108
92
 
@@ -5,8 +5,7 @@ refinementRulesData: '{refinementRulesPath}'
5
5
  # `{enumerateStackSkillsProbeOrder}` in order (installed SKF module path
6
6
  # first, src/ dev-checkout fallback); first existing path wins. §2 calls
7
7
  # it for the deterministic skill inventory (cascade-resolved exports,
8
- # metadata-hash, confidence-tier mapping) — replacing a hand-rolled
9
- # subagent fan-out that re-derived the same data on every run.
8
+ # metadata-hash, confidence-tier mapping).
10
9
  enumerateStackSkillsProbeOrder:
11
10
  - '{project-root}/_bmad/skf/shared/scripts/skf-enumerate-stack-skills.py'
12
11
  - '{project-root}/src/shared/scripts/skf-enumerate-stack-skills.py'
@@ -46,6 +45,8 @@ Wait for user input. Store the validated architecture document path as `architec
46
45
  - If missing or unreadable: "Architecture document not found at `{path}`. Provide a valid path."
47
46
  - HALT (exit code 2, `halt_reason: "input-invalid"`) if the user cannot provide a valid path. In headless, emit the error envelope per SKILL.md "Result Contract (Headless)" immediately.
48
47
 
48
+ **Resolve `{arch_project_name}` (names the refined output file):** Read the architecture document's YAML frontmatter. If it declares a `project_name`, store that value as `{arch_project_name}`; otherwise fall back to the config `{project_name}` resolved at activation. Stash `{arch_project_name}` as a workflow-context variable — `compile.md` and `report.md` resolve `{outputFile}` from it. This makes a producer-side refine of a consumer's architecture doc (the producer/consumer forge split) name the proposal after the doc's own project rather than the forge workspace config. Producer-side working state (`ra-state-{project_name}.md`) and the VS report auto-probe stay keyed on the config `{project_name}`.
49
+
49
50
  **Validate VS report (if provided via `--vs-report-path` or interactive input):**
50
51
  - Confirm the file exists and is readable
51
52
  - If missing at user-provided path: attempt auto-probe (below) before giving up
@@ -60,16 +61,18 @@ Wait for user input. Store the validated architecture document path as `architec
60
61
  **Primary path — deterministic enumeration via shared helper:**
61
62
 
62
63
  ```bash
63
- python3 {enumerateStackSkillsHelper} enumerate {skills_output_folder}
64
+ python3 {enumerateStackSkillsHelper} enumerate {skills_output_folder} --pairs --reliability
64
65
  ```
65
66
 
66
67
  The helper walks `{skills_output_folder}`, reads each `metadata.json`, applies the version-aware resolution (export-manifest → `active` symlink → flat fallback), captures the exports cascade (metadata → references → SKILL.md), maps `confidence_tier`, and emits structured JSON with one entry per skill plus a top-level `warnings[]` array. Cache the result as `skill_inventory`.
67
68
 
69
+ `--pairs` additionally attaches `skill_inventory.pairs` — the complete, deterministic set of unique `{library_a, library_b}` combinations over the skill names (`itertools.combinations`, sorted-name order, `pair_count == N*(N-1)/2`) — plus `skill_inventory.pair_count`. Cache both alongside the inventory. This is the exact pair set Step 02 (gap analysis) iterates; the helper owns the combinatorics, so a pair can never be silently dropped or duplicated at larger N and downstream steps read the set rather than re-deriving it.
70
+
68
71
  Each helper-emitted entry includes: `skill_name`, `version`, `language`, `confidence_tier`, `exports_documented`, `source_repo`, `source_root`, and a `metadata_hash` for change-detection across runs. The helper's `warnings[]` carries per-skill skip reasons (missing SKILL.md/metadata.json, non-symlink `active`, orphan-versions, schema-version violations).
69
72
 
70
- **Failure-budget guard:** If `len(warnings) / (len(skill_inventory) + len(warnings)) > 0.20`, HALT (exit code 7, `halt_reason: "inventory-unreliable"`) with: "Inventory scan unreliable — {len(warnings)}/{total} skills returned skip warnings. Re-run [RA] after skills stabilize." In headless, emit the error envelope.
73
+ **Failure-budget guard:** `--reliability` attaches the helper-computed verdict — `inventory_reliable` (boolean), `unreliable_ratio`, `skill_count`, `warning_count` so the reliability threshold lives in one unit-tested place and this step reads a boolean rather than re-deriving a ratio. If `inventory_reliable` is false, HALT (exit code 7, `halt_reason: "inventory-unreliable"`) with: "Inventory scan unreliable — {warning_count}/{skill_count + warning_count} skills returned skip warnings. Re-run [RA] after skills stabilize." In headless, emit the error envelope.
71
74
 
72
- **Fallback path — graceful degradation when the helper is unavailable:** If `{enumerateStackSkillsHelper}` has no existing candidate, fall through to the LLM-driven inventory: walk `{skills_output_folder}` and for each `{skill_package}` read `metadata.json` and extract `name`, `language`, `confidence_tier`, `stats.exports_documented`, `source_repo`/`source_root`. Skip packages missing SKILL.md or metadata.json with a logged warning. Same 20% failure budget applies.
75
+ **Fallback path — graceful degradation when the helper is unavailable:** If `{enumerateStackSkillsHelper}` has no existing candidate, fall through to the LLM-driven inventory: walk `{skills_output_folder}` and for each `{skill_package}` read `metadata.json` and extract `name`, `language`, `confidence_tier`, `stats.exports_documented`, `source_repo`/`source_root`. Skip packages missing SKILL.md or metadata.json with a logged warning. On this degraded path only — with no helper to consult — treat the run as unreliable and HALT the same way if skip warnings exceed one in five of the scanned packages.
73
76
 
74
77
  ### 3. Validate Minimum Requirements
75
78
 
@@ -79,17 +82,7 @@ Each helper-emitted entry includes: `skill_name`, `version`, `language`, `confid
79
82
  - HALT (exit code 5, `halt_reason: "insufficient-skills"`). In headless, emit the error envelope.
80
83
  - If exactly 1 valid skill found: "⚠️ Proceeding with 1 skill. Note: gap analysis will find no gaps — pairwise analysis requires at least 2 skills. Step 02 will still execute and issue an appropriate notice. Issue detection and improvement detection will proceed normally."
81
84
 
82
- **Check `{outputFolderPath}`** (resolved at activation from `output_folder` config + customize override):
83
- - Verify the path is non-empty
84
- - If undefined or empty: "**Cannot proceed.** `output_folder` is not configured in config.yaml. Add an `output_folder` path and re-run [RA]."
85
- - HALT (exit code 3, `halt_reason: "output-folder-unconfigured"`). In headless, emit the error envelope.
86
- - The directory existence + writability was probed at On-Activation §5 — if it failed there, this section never runs.
87
-
88
- **Check forge_data_folder:**
89
- - Verify `forge_data_folder` was resolved from config.yaml and is non-empty
90
- - If undefined or empty: "**Cannot proceed.** `forge_data_folder` is not configured in config.yaml. Add a `forge_data_folder` path to your config.yaml and re-run [RA]."
91
- - HALT (exit code 3, `halt_reason: "forge-folder-unconfigured"`). In headless, emit the error envelope.
92
- - The directory existence + writability was probed at On-Activation §5.
85
+ **Output paths (`{outputFolderPath}`, `forge_data_folder`):** both were asserted non-empty (config-completeness exit 3, `output-folder-unconfigured` / `forge-folder-unconfigured`) and then probed for writability (→ exit 4, `write-failed`) at On-Activation §5. If either was unconfigured or unwritable the run already halted there, so both are guaranteed present and writable here — no re-check needed.
93
86
 
94
87
  **Check architecture document:**
95
88
  - Confirm it was loaded successfully in section 1
@@ -23,7 +23,7 @@ Find contradictions between what the architecture document claims and what the g
23
23
 
24
24
  Use the refinement rules loaded in Step 01 from `{refinementRulesData}`. If not available in context, reload from `{refinementRulesData}`.
25
25
 
26
- Extract: issue classification (API Mismatch, Protocol Contradiction, Language Boundary Ignored, Type Incompatibility), VS report integration rules, and citation format.
26
+ Extract: issue classification (API Mismatch, Protocol Contradiction, Language Boundary Ignored, Type Incompatibility) and VS report integration rules.
27
27
 
28
28
  ### 2. Extract Integration Claims from Architecture
29
29
 
@@ -43,7 +43,7 @@ For each claim, record:
43
43
 
44
44
  ### 3. Verify Claims Against Skill API Surfaces
45
45
 
46
- For each extracted claim, load the relevant skill(s) and check:
46
+ For each extracted claim, verify against the compact API surfaces already collected in Step 02 §4 — the per-skill `{skill_api_surfaces}` summaries (`{exports, protocols, data_formats}`), carried forward as workflow state exactly like `{in_scope_skills}`. Reload a skill's SKILL.md directly only if its summary is unavailable or context has compacted (see Step 02 §4 for the canonical delegate-the-read pattern). Then check:
47
47
 
48
48
  **API Mismatch check:**
49
49
  - Does the claimed API actually exist in the skill's export list?
@@ -66,11 +66,11 @@ For each extracted claim, load the relevant skill(s) and check:
66
66
 
67
67
  If `vs_report_available` is true:
68
68
 
69
- **Scope filter (reuse `{out_of_scope_skills}` from Step 02 §2b):** The VS report carries verdicts across the entire skill set, which may exceed this architecture's surface. Before promoting any verdict, check the pair's scope — if a verdict is for an **out-of-scope** pair (either library in `{out_of_scope_skills}`), do NOT promote it to an issue for THIS architecture; record it under the informational Out-of-Scope bucket instead. Only **in-scope** pairs' verdicts are promoted by the rules below.
69
+ **Scope filter (reuse `{out_of_scope_skills}` from Step 02 §2b):** The VS report carries verdicts across the entire skill set, which may exceed this architecture's surface. Before promoting any verdict, check the pair's scope — if a verdict is for an **out-of-scope** pair (either library in `{out_of_scope_skills}`), do not promote it to an issue for this architecture; record it under the informational Out-of-Scope bucket instead. Only **in-scope** pairs' verdicts are promoted by the rules below.
70
70
 
71
71
  **Load the VS feasibility report and extract verdicts:**
72
- - **Risky verdicts** (match case-insensitively: "Risky", "RISKY", "risky"): Promote to confirmed issues with the VS evidence as additional citation
73
- - **Blocked verdicts** (match case-insensitively: "Blocked", "BLOCKED", "blocked"): Promote to critical issues requiring architecture redesign
72
+ - **Risky verdicts** (match case-insensitively): Promote to confirmed issues with the VS evidence as additional citation
73
+ - **Blocked verdicts** (match case-insensitively): Promote to critical issues requiring architecture redesign
74
74
  - **Plausible verdicts:** Note informatively — Plausible is not an issue by itself. Only flag as a potential issue if the VS rationale text explicitly states "no direct API evidence" or "weak evidence"
75
75
 
76
76
  **For each VS-sourced issue, include dual citations:**
@@ -81,7 +81,7 @@ If `vs_report_available` is false: Skip this section. Issue detection proceeds w
81
81
 
82
82
  ### 5. Document Each Issue
83
83
 
84
- For each detected issue, apply the citation format from {refinementRulesData}:
84
+ For each detected issue, cite it in this format:
85
85
 
86
86
  ```
87
87
  **[ISSUE]**: {description}
@@ -98,28 +98,13 @@ Suggestion: {specific correction with API evidence}
98
98
  - **Major:** Risky VS verdicts, protocol mismatches, missing bridge layers
99
99
  - **Minor:** Plausible VS verdicts where the VS rationale explicitly states "no direct API evidence" or "weak evidence", minor type differences with easy conversion
100
100
 
101
- ### 6. Display Issue Detection Results
101
+ ### 6. Report Issues & Store Findings
102
102
 
103
- "**Pass 2: Issue Detection Architecture vs. API Reality**
103
+ Report the in-scope issue count with its critical/major/minor breakdown, then list each issue as a row of **# / Libraries / Issue Type / Severity / Summary** followed by its full §5 citation. One signal is not inferable from the counts and must survive regardless of format:
104
104
 
105
- **Issues Found (in-scope):** {count} ({critical_count} critical, {major_count} major, {minor_count} minor)
105
+ - **Out-of-scope VS verdicts were set aside (from §4):** list them separately for awareness only — they were not counted as issues — and note that re-running with `--scope-skills` pulls any that belong into scope.
106
106
 
107
- {IF issues found:}
108
- | # | Libraries | Issue Type | Severity | Summary |
109
- |---|-----------|-----------|----------|---------|
110
- | {n} | {libs} | {issue_type} | {severity} | {brief description} |
111
-
112
- {For each issue, display the full citation with evidence and suggestion}
113
-
114
- {IF out-of-scope VS verdicts were set aside (from §4):}
115
- **Out of scope for this document:** {oos_issue_count} VS verdict(s) involve skills outside this architecture's surface (`{out_of_scope_skills}`) and were NOT counted as issues. Listed for awareness only — re-run with `--scope-skills` if any belongs in scope.
116
-
117
- {IF no issues found:}
118
- **No contradictions detected.** Architecture claims align with verified in-scope skill API surfaces.
119
-
120
- **Proceeding to improvement detection...**"
121
-
122
- Store all **in-scope** issue findings as workflow state for Step 05. To ensure durability across long runs, also append a `<!-- [RA-ISSUES] ... -->` comment block to `{forge_data_folder}/ra-state-{project_name}.md` containing the **complete formatted issue findings** (full citation blocks with architecture claims, skill evidence, VS verdicts, severity, and suggestions — not just counts) — Step 05 can read this back if context degrades. Record any out-of-scope VS verdicts under the shared `<!-- [RA-OUT-OF-SCOPE] ... -->` marker (NOT `[RA-ISSUES]`) so Step 05 does not compile them — they are informational only. **Do NOT write to `{output_folder}/refined-architecture-{project_name}.md` — that file is created only in step 5.**
107
+ Store the **in-scope** issue findings per the Finding Storage rule (refinement rules), under a `<!-- [RA-ISSUES] ... -->` block (its citations carry the architecture claim, skill evidence, VS verdict, severity, and suggestion). Record any out-of-scope VS verdicts under the shared `<!-- [RA-OUT-OF-SCOPE] ... -->` marker so Step 05 leaves them out — informational only.
123
108
 
124
109
  ### 7. Auto-Proceed to Next Step
125
110
 
@@ -14,7 +14,7 @@ Gaps are undocumented integration paths — library pairs that have compatible A
14
14
 
15
15
  ### Detection Method
16
16
 
17
- 1. Generate all possible library pairs from the skill inventory
17
+ 1. Read the pre-computed unique library pairs from `skill_inventory.pairs` (emitted by the enumerate helper's `--pairs` flag) — do not re-derive them in-context
18
18
  2. For each pair, check if both skills export APIs that could connect (compatible types, shared protocols, complementary producer/consumer patterns)
19
19
  3. Cross-reference against the architecture document: does the document describe how these two libraries interact?
20
20
  4. If compatible APIs exist but NO architecture description exists, this is a **gap**
@@ -77,27 +77,15 @@ Improvements are capability expansions — library features documented in skills
77
77
 
78
78
  ---
79
79
 
80
- ## Refinement Citation Format
80
+ ## Finding Storage (Steps 02-04)
81
81
 
82
- Every refinement (gap, issue, or improvement) MUST cite evidence:
83
-
84
- ```
85
- **[GAP|ISSUE|IMPROVEMENT]**: {description}
86
-
87
- Evidence:
88
- - {skill_name} exports: `{function_name}({params}) -> {return_type}`
89
- - {skill_name} provides: `{type_or_protocol}`
90
- - Architecture states: "{quoted text from original document}"
91
- - {IF VS report}: VS verdict: {verdict} for {pair}
92
-
93
- Suggestion: {specific, actionable recommendation}
94
- ```
82
+ Each analysis step stores its findings two ways: as workflow state for Step 05, and appended to `{forge_data_folder}/ra-state-{project_name}.md` as a labeled `<!-- [RA-...] ... -->` block holding the **complete formatted findings** — full citation blocks with evidence and suggestions, not just counts so Step 05 can recover them if context degrades on a long run. The refined document itself is written once, in Step 05; Steps 02-04 never write to it.
95
83
 
96
84
  ---
97
85
 
98
86
  ## Preservation Rules
99
87
 
100
- 1. **NEVER delete original content** — only add annotations and subsections
88
+ 1. **Never delete original content** — only add annotations and subsections
101
89
  2. **Follow original section layout** — add refinement subsections within existing sections
102
90
  3. **Use callout blocks** for issues: `> [!WARNING]` or `> [!NOTE]` format
103
91
  4. **Mark additions clearly** — prefix added subsections with "RA:" or use a refinement marker
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  # {outputFile} resolves from the activation-stored {outputFolderPath}
3
3
  # variable (set in SKILL.md On Activation §4 from output_folder config +
4
- # customize override).
5
- outputFile: '{outputFolderPath}/refined-architecture-{project_name}.md'
4
+ # customize override) and {arch_project_name} (resolved in init.md from the
5
+ # architecture doc's frontmatter project_name, else config project_name).
6
+ outputFile: '{outputFolderPath}/refined-architecture-{arch_project_name}.md'
6
7
  nextStepFile: 'health-check.md'
7
8
  ---
8
9
 
@@ -18,7 +19,7 @@ Present the complete refinement summary to the user. Display counts of gaps fill
18
19
 
19
20
  - Focus only on presenting the completed refinement — no new analysis
20
21
  - Do not discover new gaps, issues, or improvements, and do not modify the refined document
21
- - Chains to the local health-check step via `{nextStepFile}` after completion — the user-facing summary is NOT the terminal step
22
+ - Chains to the local health-check step via `{nextStepFile}` after completion — the user-facing summary is not the terminal step
22
23
 
23
24
  ## MANDATORY SEQUENCE
24
25
 
@@ -26,7 +27,7 @@ Present the complete refinement summary to the user. Display counts of gaps fill
26
27
 
27
28
  Read the `{outputFile}` to have all data available for presentation.
28
29
 
29
- Verify the `## Refinement Summary` section is present. If it is absent, HALT: "⚠️ Refinement Summary not found in `{outputFile}`. Step 05 may not have completed successfully. Re-run [RA] from the beginning."
30
+ Verify the `## Refinement Summary` section is present. If it is absent, HALT (exit code 8, `halt_reason: "recovery-failed"`): "⚠️ Refinement Summary not found in `{outputFile}`. Step 05 may not have completed successfully. Re-run [RA] from the beginning." In headless, emit the error envelope per SKILL.md "Result Contract (Headless)" with `refined_path: null`.
30
31
 
31
32
  **Extract metrics from the Refinement Summary section:** Parse `gap_count`, `issue_count`, `improvement_count`, `critical_count`, `major_count`, `minor_count`, `high_count`, `medium_count`, `low_count`, and `skill_count` from the Changes Made table and Evidence Sources table. Use these extracted values in the summary table and next-steps sections below.
32
33
 
@@ -92,15 +93,17 @@ Re-run **[RA] Refine Architecture** anytime after updating your skills or archit
92
93
  SKF_REFINE_ARCHITECTURE_RESULT_JSON: {"status":"success","refined_path":"{outputFile}","gap_count":{gap_count},"issue_count":{issue_count},"improvement_count":{improvement_count},"exit_code":0,"halt_reason":null}
93
94
  ```
94
95
 
95
- Then load, read the full file, and execute `{nextStepFile}` the health-check step is the true terminal step of this workflow.
96
+ **Post-completion hook (optional).** If `{onCompleteCommand}` is non-empty (resolved at SKILL.md On Activation §4 from `workflow.on_complete`), invoke it after the result contract is finalized:
96
97
 
97
- #### EXECUTION RULES:
98
+ ```bash
99
+ {onCompleteCommand} --result-path={result_json_path}
100
+ ```
98
101
 
99
- - ALWAYS halt and wait for user input after presenting the menu
100
- - R may be selected multiple times — always walk through all refinements
101
- - X triggers the health check, which is the true workflow exit
102
+ where `{result_json_path}` is the per-run record written above (`{outputFolderPath}/refine-architecture-result-{timestamp}.json`). Log success/failure to `workflow_warnings[]` — never fail the workflow on a hook error. The hook runs after the result contract is finalized so notifiers, indexers, or downstream pipelines (index the refined doc, chain the next workflow) see a complete record. When `{onCompleteCommand}` is empty (bundled default), skip the invocation entirely.
102
103
 
103
- ## CRITICAL STEP COMPLETION NOTE
104
+ Then load, read the full file, and execute `{nextStepFile}` — the health-check step is the true terminal step of this workflow.
105
+
106
+ #### EXECUTION RULES:
104
107
 
105
- When the user selects X, this step chains to the local health-check step (`{nextStepFile}`), which in turn delegates to `shared/health-check.md`. After the health check completes, the refine-architecture workflow is fully done. The refined architecture at `{outputFile}` contains the full original content plus all gap-fills, issue annotations, and improvement suggestions backed by skill API evidence.
108
+ - This is the exit gate: halt for the user's choice. [R] walks every refinement with its evidence (repeatable re-shows this menu after each pass); [X] chains to the health check, the true workflow exit. Headless auto-selects [X].
106
109
 
@@ -21,7 +21,7 @@ Renames a skill across all its versions with transactional safety — copy to th
21
21
 
22
22
  ## Role
23
23
 
24
- You are Ferris in Management mode — a precision surgeon who operates on the entire skill group atomically. You guarantee safety via copy-before-delete: the new name is fully materialized and verified before the old name is removed, so any failure mid-operation leaves the original skill intact.
24
+ You are Ferris in Management mode — a precision surgeon who operates on the entire skill group atomically.
25
25
 
26
26
  ## Workflow Rules
27
27
 
@@ -31,7 +31,7 @@ These rules apply to every step in this workflow:
31
31
  - Never proceed past a verification failure — roll back (delete new directories) and halt
32
32
  - Never allow a rename to collide with an existing skill name
33
33
  - Only load one step file at a time — never preload future steps
34
- - If any instruction references a subprocess or tool you lack, achieve the outcome in your main context thread
34
+ - If any instruction references a subprocess or tool you lack, achieve the outcome in your main context thread — **except** the atomicity and commit-gate safety helpers that execute.md §0 resolves: a missing one there is a HARD HALT (exit 4), never an LLM fall-through, because hand-driven writes/scans would silently regress the transactional guarantees that keep a failed rename recoverable
35
35
  - Always communicate in `{communication_language}`
36
36
  - At any interactive prompt, the inputs `cancel`, `exit`, `[X]`, `q`, or `:q` exit cleanly with exit code 6 (`halt_reason: "user-cancelled"`)
37
37
  - If `{headless_mode}` is true, auto-proceed through confirmation gates with their default action and log each auto-decision
@@ -53,32 +53,19 @@ These rules apply to every step in this workflow:
53
53
  | **Flags** | `--headless` / `-H` (auto-resolve all gates); `--dry-run` (run selection + validation + display the §8 confirmation block, then exit with `status="dry-run"` — no copy, no manifest re-key, no delete). Useful for verifying the rename plan before the irreversible §8 (delete old) section. |
54
54
  | **Gates** | step 1: Input Gate [use args] x2, Confirm Gate [Y] |
55
55
  | **Outputs** | Renamed skill directories, updated manifest, updated context files, `{new_name}/rename-skill-result-{timestamp}.json` and `{new_name}/rename-skill-result-latest.json` |
56
- | **Concurrency** | Two simultaneous rename runs against the same `old_name` would corrupt state mid-copy. select.md §4b acquires a PID-file lock at `{forge_data_folder}/{old_name}/.skf-rename.lock` once `old_name` is resolved; live-PID collisions HALT with `halt_reason: "halted-for-concurrent-run"`. Stale locks (dead PID) are cleared silently with a warning. The lock is released by the terminal health-check step (step 4) and by every documented halt path. |
56
+ | **Concurrency** | A PID-file lock at `{forge_data_folder}/{old_name}/.skf-rename.lock` serializes concurrent runs against the same `old_name`; a live-PID collision HALTs with `halt_reason: "halted-for-concurrent-run"` (exit 5). See select.md §4b for the acquire / stale-clear / release mechanism. |
57
57
  | **Headless** | All gates auto-resolve with default action when `{headless_mode}` is true. The §6 source-authority warning HALTs by default in headless when `source_authority="official"`; set `force_source_authority_in_headless = "true"` in `customize.toml` to auto-acknowledge and proceed (the override is recorded in `headless_decisions[]`). |
58
- | **Exit codes** | See "Exit Codes" below |
59
-
60
- ## Exit Codes
61
-
62
- Every HARD HALT in this workflow exits with a stable code so headless automators can branch on the failure class without grepping message text:
63
-
64
- | Code | Meaning | Raised by |
65
- | ---- | -------------------- | -------------------------------------------------------------------------------------------- |
66
- | 0 | success | step 4 (terminal) |
67
- | 2 | input-missing / input-invalid | step 1 §4/§5 (headless missing `old_name`/`new_name` arg) → `input-missing`; new name fails kebab-case / length / same-as-old → `input-invalid` |
68
- | 3 | resolution-failure | step 1 §2 (manifest is malformed JSON); step 1 §3 (no skills found anywhere) |
69
- | 4 | write-failure | On-Activation §3 pre-flight write probe (skills_output_folder / forge_data_folder unwritable); step 2 §1 (copy); step 2 §3 (file content update); step 2 §6 (manifest write); step 2 §7 (context-file rewrite) |
70
- | 5 | state-conflict | step 1 §5 (name-collision check fails: target name already in use); step 1 §6 (source-authority="official" headless without `force_source_authority_in_headless`); concurrency lock collision (`halted-for-concurrent-run`) |
71
- | 6 | user-cancelled | step 1 §6 (source-authority warning [N]); step 1 §8 confirmation gate `[N]`; any prompt that accepted `cancel`/`exit`/`:q` |
58
+ | **Exit codes** | Stable per-failure-class codes see `references/exit-codes.md` |
72
59
 
73
60
  ## Result Contract (Headless)
74
61
 
75
62
  When `{headless_mode}` is true, step 3 emits a single-line JSON envelope on **stdout** before chaining to step 4, and every HARD HALT emits the same envelope shape on **stderr** with `status: "error"`:
76
63
 
77
64
  ```
78
- SKF_RENAME_SKILL_RESULT_JSON: {"status":"success|error|dry-run","old_name":"…|null","new_name":"…|null","versions_renamed":[],"manifest_rekeyed":false,"context_files_updated":[],"exit_code":0,"halt_reason":null}
65
+ SKF_RENAME_SKILL_RESULT_JSON: {"status":"success|error|dry-run","old_name":"…|null","new_name":"…|null","versions_renamed":[],"manifest_rekeyed":false,"context_files_updated":[],"exit_code":0,"halt_reason":null,"headless_decisions":[]}
79
66
  ```
80
67
 
81
- `status` is `"success"` on the terminal happy path, `"dry-run"` when `--dry-run` was set and the workflow exited before §9 stores decisions, `"error"` on any HALT. `halt_reason` is one of: `null` (success), `"input-missing"`, `"input-invalid"`, `"manifest-corrupt"`, `"nothing-to-rename"`, `"name-collision"`, `"source-authority-blocked"`, `"halted-for-concurrent-run"`, `"copy-failed"`, `"verify-failed"`, `"manifest-write-failed"`, `"context-rebuild-failed"`, `"write-failed"`, `"user-cancelled"`. `exit_code` matches the table above.
68
+ `status` is `"success"` on the terminal happy path, `"dry-run"` when `--dry-run` was set and the workflow exited before §9 stores decisions, `"error"` on any HALT. `halt_reason` is one of: `null` (success), `"input-missing"`, `"input-invalid"`, `"manifest-corrupt"`, `"nothing-to-rename"`, `"name-collision"`, `"source-authority-blocked"`, `"halted-for-concurrent-run"`, `"copy-failed"`, `"verify-failed"`, `"manifest-write-failed"`, `"write-failed"`, `"user-cancelled"`. (§7 context-file rebuild is best-effort and never halts, so it has no `halt_reason`.) `exit_code` matches `references/exit-codes.md`. `headless_decisions` is the audit trail of confirmation gates auto-resolved under `{headless_mode}` — each entry `{gate, default_action, taken_action, reason}` (the §6 source-authority override and the §8 auto-confirm); it is `[]` in interactive runs and whenever no gate was auto-resolved before the envelope was emitted.
82
69
 
83
70
  ## On Activation
84
71
 
@@ -105,13 +92,16 @@ SKF_RENAME_SKILL_RESULT_JSON: {"status":"success|error|dry-run","old_name":"…|
105
92
 
106
93
  If the script fails or is missing, fall back to reading `{skill-root}/customize.toml` directly — the bundled defaults are an empty string for each scalar.
107
94
 
108
- Apply the scalar fallback now so stage files don't have to repeat the conditional logic. For each of the three scalars, if the merged value is empty or absent, the bundled default applies:
95
+ Apply the scalar fallback now so stage files don't have to repeat the conditional logic. For each of the four scalars, if the merged value is empty or absent, the bundled default applies:
109
96
 
110
97
  - `{forceSourceAuthorityInHeadless}` ← `workflow.force_source_authority_in_headless` (empty or non-`"true"` = HALT in headless on `"official"` source-authority)
111
98
  - `{unknownIdeDefaultContextFile}` ← `workflow.unknown_ide_default_context_file` if non-empty, else `AGENTS.md`
112
99
  - `{unknownIdeDefaultSkillRoot}` ← `workflow.unknown_ide_default_skill_root` if non-empty, else `.agents/skills/`
100
+ - `{onCompleteCommand}` ← `workflow.on_complete` if non-empty, else empty string (no-op — step 3 skips the post-completion hook invocation)
101
+
102
+ Stash all four as workflow-context variables. Stage files reference them directly — no conditional at the usage site.
113
103
 
114
- Stash all three as workflow-context variables. Stage files reference them directly no conditional at the usage site.
104
+ Then apply the resolved array surfaces so they are not silent no-ops: execute each entry in `workflow.activation_steps_prepend` in order now; treat every entry in `workflow.persistent_facts` as standing context for the whole run (entries prefixed `file:` are paths or globs whose contents load as facts — the bundled default loads any `project-context.md` so rename-policy and public-name-stability guardrails stay in mind); and after activation completes, execute each entry in `workflow.activation_steps_append` in order.
115
105
 
116
106
  4. **Pre-flight write probe.** Verify both `{skills_output_folder}` and `{forge_data_folder}` are writable. A read-only mount, full disk, or permissions-denied path otherwise only surfaces inside step 2's transactional copy — by then the user has already gone through name validation and confirmation:
117
107
 
@@ -1,6 +1,8 @@
1
1
  # DO NOT EDIT -- overwritten on every update.
2
2
  #
3
3
  # Workflow customization surface for skf-rename-skill.
4
+ # Team overrides: _bmad/custom/skf-rename-skill.toml (under {project-root})
5
+ # Personal overrides: _bmad/custom/skf-rename-skill.user.toml (under {project-root})
4
6
 
5
7
  [workflow]
6
8
 
@@ -34,6 +36,14 @@ persistent_facts = [
34
36
  "file:{project-root}/**/project-context.md",
35
37
  ]
36
38
 
39
+ # Optional post-completion hook. When non-empty, invoked with
40
+ # `--result-path=<path>` in step 3 after the rename result JSON is
41
+ # finalized (before the terminal health-check step). Failures are logged
42
+ # but never fail the workflow — the rename is already committed. Use for
43
+ # an audit-log emit, skill-registry re-index, or a post-rename notifier.
44
+
45
+ on_complete = ""
46
+
37
47
  # --- Optional safety + default scalars ---
38
48
  #
39
49
  # Auto-acknowledge the source-authority="official" warning in headless mode.