bmad-module-skill-forge 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +0 -8
  3. package/docs/_data/pinned.yaml +1 -1
  4. package/docs/_internal/STABILITY.md +1 -1
  5. package/docs/architecture.md +2 -2
  6. package/docs/examples.md +1 -1
  7. package/docs/workflows.md +5 -5
  8. package/package.json +2 -2
  9. package/src/README.md +1 -1
  10. package/src/knowledge/ccc-bridge.md +12 -12
  11. package/src/knowledge/qmd-registry.md +5 -5
  12. package/src/shared/health-check.md +5 -5
  13. package/src/shared/references/description-guard-protocol.md +100 -0
  14. package/src/shared/references/output-contract-schema.md +1 -1
  15. package/src/shared/scripts/schemas/skf-brief-result-envelope.v1.json +6 -6
  16. package/src/shared/scripts/schemas/skf-setup-result-envelope.v1.json +9 -3
  17. package/src/shared/scripts/schemas/skf-update-result-envelope.v1.json +149 -0
  18. package/src/shared/scripts/schemas/skill-brief.v1.json +22 -2
  19. package/src/shared/scripts/skf-build-change-manifest.py +420 -0
  20. package/src/shared/scripts/skf-check-workspace-drift.py +321 -0
  21. package/src/shared/scripts/skf-compare-file-hashes.py +357 -0
  22. package/src/shared/scripts/skf-description-guard.py +359 -0
  23. package/src/shared/scripts/skf-detect-language.py +2 -2
  24. package/src/shared/scripts/skf-detect-scripts-assets.py +613 -0
  25. package/src/shared/scripts/skf-detect-tools.py +97 -8
  26. package/src/shared/scripts/skf-detect-workspaces.py +1 -1
  27. package/src/shared/scripts/skf-disqualify-candidates.py +576 -0
  28. package/src/shared/scripts/skf-emit-brief-result-envelope.py +3 -3
  29. package/src/shared/scripts/skf-emit-result-envelope.py +93 -9
  30. package/src/shared/scripts/skf-enumerate-stack-skills.py +514 -0
  31. package/src/shared/scripts/skf-forge-tier-rw.py +11 -11
  32. package/src/shared/scripts/skf-hash-content.py +284 -0
  33. package/src/shared/scripts/skf-load-provenance.py +295 -0
  34. package/src/shared/scripts/skf-merge-ccc-exclusions.py +34 -4
  35. package/src/shared/scripts/skf-pair-intersect.py +250 -0
  36. package/src/shared/scripts/skf-provenance-gap-dispatch.py +433 -0
  37. package/src/shared/scripts/skf-qmd-classify-collections.py +42 -8
  38. package/src/shared/scripts/skf-recommend-scope-type.py +2 -2
  39. package/src/shared/scripts/skf-render-quick-metadata.py +2 -2
  40. package/src/shared/scripts/skf-resolve-authoritative-files.py +504 -0
  41. package/src/shared/scripts/skf-scan-manifests.py +738 -0
  42. package/src/shared/scripts/skf-scan-skill-md-structure.py +375 -0
  43. package/src/shared/scripts/skf-update-active-symlink.py +315 -0
  44. package/src/shared/scripts/skf-validate-brief-inputs.py +5 -5
  45. package/src/shared/scripts/skf-validate-brief-schema.py +348 -0
  46. package/src/shared/scripts/skf-write-skill-brief.py +61 -5
  47. package/src/skf-analyze-source/SKILL.md +69 -16
  48. package/src/skf-analyze-source/assets/skill-brief-schema.md +1 -1
  49. package/src/skf-analyze-source/customize.toml +55 -0
  50. package/src/skf-analyze-source/{steps-c/step-01b-continue.md → references/continue.md} +12 -12
  51. package/src/skf-analyze-source/{steps-c/step-06-generate-briefs.md → references/generate-briefs.md} +29 -10
  52. package/src/skf-analyze-source/{steps-c/step-07-health-check.md → references/health-check.md} +5 -3
  53. package/src/skf-analyze-source/{steps-c/step-03-identify-units.md → references/identify-units.md} +44 -14
  54. package/src/skf-analyze-source/{steps-c/step-01-init.md → references/init.md} +27 -6
  55. package/src/skf-analyze-source/{steps-c/step-04-map-and-detect.md → references/map-and-detect.md} +52 -25
  56. package/src/skf-analyze-source/{steps-c/step-05-recommend.md → references/recommend.md} +15 -8
  57. package/src/skf-analyze-source/{steps-c/step-02-scan-project.md → references/scan-project.md} +12 -10
  58. package/src/skf-analyze-source/references/unit-detection-heuristics.md +2 -0
  59. package/src/skf-analyze-source/templates/analysis-report-template.md +6 -6
  60. package/src/skf-audit-skill/SKILL.md +66 -15
  61. package/src/skf-audit-skill/assets/drift-report-template.md +6 -5
  62. package/src/skf-audit-skill/customize.toml +49 -0
  63. package/src/skf-audit-skill/{steps-c/step-07-health-check.md → references/health-check.md} +5 -3
  64. package/src/skf-audit-skill/{steps-c/step-01-init.md → references/init.md} +57 -19
  65. package/src/skf-audit-skill/{steps-c/step-02-re-index.md → references/re-index.md} +11 -11
  66. package/src/skf-audit-skill/{steps-c/step-06-report.md → references/report.md} +25 -7
  67. package/src/skf-audit-skill/{steps-c/step-04-semantic-diff.md → references/semantic-diff.md} +6 -6
  68. package/src/skf-audit-skill/{steps-c/step-05-severity-classify.md → references/severity-classify.md} +5 -5
  69. package/src/skf-audit-skill/references/severity-rules.md +2 -0
  70. package/src/skf-audit-skill/{steps-c/step-03-structural-diff.md → references/structural-diff.md} +29 -17
  71. package/src/skf-brief-skill/SKILL.md +48 -18
  72. package/src/skf-brief-skill/assets/description-voice-examples.md +1 -1
  73. package/src/skf-brief-skill/assets/skill-brief-schema.md +32 -2
  74. package/src/skf-brief-skill/customize.toml +44 -0
  75. package/src/skf-brief-skill/{steps-c/step-02-analyze-target.md → references/analyze-target.md} +5 -5
  76. package/src/skf-brief-skill/{steps-c/step-04-confirm-brief.md → references/confirm-brief.md} +13 -10
  77. package/src/skf-brief-skill/references/draft-checkpoint.md +4 -4
  78. package/src/skf-brief-skill/{steps-c/step-01-gather-intent.md → references/gather-intent.md} +24 -24
  79. package/src/skf-brief-skill/references/headless-args.md +9 -9
  80. package/src/skf-brief-skill/references/headless-source-authority-detection.md +1 -1
  81. package/src/skf-brief-skill/{steps-c/step-06-health-check.md → references/health-check.md} +4 -2
  82. package/src/skf-brief-skill/references/portfolio-similarity-check.md +2 -2
  83. package/src/skf-brief-skill/references/qmd-collection-registration.md +1 -1
  84. package/src/skf-brief-skill/{steps-c/step-03-scope-definition.md → references/scope-definition.md} +19 -16
  85. package/src/skf-brief-skill/references/version-resolution.md +2 -2
  86. package/src/skf-brief-skill/{steps-c/step-05-write-brief.md → references/write-brief.md} +11 -10
  87. package/src/skf-create-skill/SKILL.md +25 -19
  88. package/src/skf-create-skill/assets/compile-assembly-rules.md +3 -3
  89. package/src/skf-create-skill/assets/skill-sections.md +5 -5
  90. package/src/skf-create-skill/assets/tessl-dismissal-rules.md +11 -11
  91. package/src/skf-create-skill/customize.toml +35 -0
  92. package/src/skf-create-skill/references/authoritative-files-protocol.md +142 -0
  93. package/src/skf-create-skill/{steps-c/step-05-compile.md → references/compile.md} +16 -16
  94. package/src/skf-create-skill/{steps-c/step-03d-component-extraction.md → references/component-extraction.md} +16 -16
  95. package/src/skf-create-skill/{steps-c/step-02-ecosystem-check.md → references/ecosystem-check.md} +4 -4
  96. package/src/skf-create-skill/{steps-c/step-04-enrich.md → references/enrich.md} +3 -3
  97. package/src/skf-create-skill/{steps-c/step-03-extract.md → references/extract.md} +52 -120
  98. package/src/skf-create-skill/references/extraction-patterns.md +8 -8
  99. package/src/skf-create-skill/{steps-c/step-07-generate-artifacts.md → references/generate-artifacts.md} +11 -11
  100. package/src/skf-create-skill/{steps-c/step-09-health-check.md → references/health-check.md} +4 -2
  101. package/src/skf-create-skill/{steps-c/step-01-load-brief.md → references/load-brief.md} +40 -32
  102. package/src/skf-create-skill/{steps-c/step-08-report.md → references/report.md} +8 -8
  103. package/src/skf-create-skill/references/source-resolution-protocols.md +6 -6
  104. package/src/skf-create-skill/{steps-c/sub/step-02b-ccc-discover.md → references/sub/ccc-discover.md} +5 -5
  105. package/src/skf-create-skill/{steps-c/sub/step-03c-fetch-docs.md → references/sub/fetch-docs.md} +28 -12
  106. package/src/skf-create-skill/{steps-c/sub/step-03b-fetch-temporal.md → references/sub/fetch-temporal.md} +81 -50
  107. package/src/skf-create-skill/{steps-c/step-06-validate.md → references/validate.md} +46 -26
  108. package/src/skf-create-stack-skill/SKILL.md +76 -17
  109. package/src/skf-create-stack-skill/assets/provenance-map-schema.md +102 -0
  110. package/src/skf-create-stack-skill/assets/stack-skill-template.md +1 -1
  111. package/src/skf-create-stack-skill/customize.toml +46 -0
  112. package/src/skf-create-stack-skill/{steps-c/step-06-compile-stack.md → references/compile-stack.md} +6 -5
  113. package/src/skf-create-stack-skill/references/compose-mode-rules.md +3 -1
  114. package/src/skf-create-stack-skill/{steps-c/step-05-detect-integrations.md → references/detect-integrations.md} +32 -11
  115. package/src/skf-create-stack-skill/{steps-c/step-02-detect-manifests.md → references/detect-manifests.md} +28 -28
  116. package/src/skf-create-stack-skill/{steps-c/step-07-generate-output.md → references/generate-output.md} +11 -85
  117. package/src/skf-create-stack-skill/{steps-c/step-10-health-check.md → references/health-check.md} +4 -2
  118. package/src/skf-create-stack-skill/{steps-c/step-01-init.md → references/init.md} +70 -4
  119. package/src/skf-create-stack-skill/references/integration-patterns.md +2 -0
  120. package/src/skf-create-stack-skill/references/manifest-patterns.md +2 -0
  121. package/src/skf-create-stack-skill/{steps-c/step-04-parallel-extract.md → references/parallel-extract.md} +40 -17
  122. package/src/skf-create-stack-skill/{steps-c/step-03-rank-and-confirm.md → references/rank-and-confirm.md} +5 -4
  123. package/src/skf-create-stack-skill/{steps-c/step-09-report.md → references/report.md} +3 -3
  124. package/src/skf-create-stack-skill/{steps-c/step-08-validate.md → references/validate.md} +6 -6
  125. package/src/skf-drop-skill/SKILL.md +84 -12
  126. package/src/skf-drop-skill/customize.toml +57 -0
  127. package/src/skf-drop-skill/{steps-c/step-02-execute.md → references/execute.md} +49 -34
  128. package/src/skf-drop-skill/{steps-c/step-04-health-check.md → references/health-check.md} +6 -4
  129. package/src/skf-drop-skill/{steps-c/step-03-report.md → references/report.md} +13 -5
  130. package/src/skf-drop-skill/{steps-c/step-01-select.md → references/select.md} +63 -15
  131. package/src/skf-export-skill/SKILL.md +85 -16
  132. package/src/skf-export-skill/assets/managed-section-format.md +3 -3
  133. package/src/skf-export-skill/assets/snippet-format.md +2 -2
  134. package/src/skf-export-skill/customize.toml +49 -0
  135. package/src/skf-export-skill/{steps-c/step-03-generate-snippet.md → references/generate-snippet.md} +11 -11
  136. package/src/skf-export-skill/{steps-c/step-07-health-check.md → references/health-check.md} +6 -4
  137. package/src/skf-export-skill/{steps-c/step-01-load-skill.md → references/load-skill.md} +11 -49
  138. package/src/skf-export-skill/references/manifest-rebuild.md +68 -0
  139. package/src/skf-export-skill/references/multi-skill-mode.md +38 -0
  140. package/src/skf-export-skill/references/orphan-context-detection.md +75 -0
  141. package/src/skf-export-skill/references/orphan-row-detection.md +102 -0
  142. package/src/skf-export-skill/{steps-c/step-02-package.md → references/package.md} +7 -7
  143. package/src/skf-export-skill/references/preflight-snippet-root-probe.md +74 -0
  144. package/src/skf-export-skill/{steps-c/step-06-summary.md → references/summary.md} +20 -8
  145. package/src/skf-export-skill/{steps-c/step-05-token-report.md → references/token-report.md} +5 -5
  146. package/src/skf-export-skill/{steps-c/step-04-update-context.md → references/update-context.md} +109 -113
  147. package/src/skf-quick-skill/SKILL.md +63 -123
  148. package/src/skf-quick-skill/customize.toml +44 -0
  149. package/src/skf-quick-skill/references/batch-mode.md +102 -0
  150. package/src/skf-quick-skill/{steps-c/step-04-compile.md → references/compile.md} +10 -10
  151. package/src/skf-quick-skill/{steps-c/step-02-ecosystem-check.md → references/ecosystem-check.md} +5 -5
  152. package/src/skf-quick-skill/{steps-c/step-06-finalize.md → references/finalize.md} +7 -7
  153. package/src/skf-quick-skill/{steps-c/step-07-health-check.md → references/health-check.md} +3 -3
  154. package/src/skf-quick-skill/{steps-c/step-03-quick-extract.md → references/quick-extract.md} +5 -5
  155. package/src/skf-quick-skill/references/registry-resolution.md +2 -0
  156. package/src/skf-quick-skill/{steps-c/step-01-resolve-target.md → references/resolve-target.md} +14 -10
  157. package/src/skf-quick-skill/{steps-c/step-05-write-and-validate.md → references/write-and-validate.md} +4 -4
  158. package/src/skf-refine-architecture/SKILL.md +86 -16
  159. package/src/skf-refine-architecture/customize.toml +49 -0
  160. package/src/skf-refine-architecture/{steps-c/step-05-compile.md → references/compile.md} +4 -4
  161. package/src/skf-refine-architecture/{steps-c/step-02-gap-analysis.md → references/gap-analysis.md} +5 -5
  162. package/src/skf-refine-architecture/{steps-c/step-07-health-check.md → references/health-check.md} +6 -4
  163. package/src/skf-refine-architecture/{steps-c/step-04-improvements.md → references/improvements.md} +5 -5
  164. package/src/skf-refine-architecture/references/init.md +144 -0
  165. package/src/skf-refine-architecture/{steps-c/step-03-issue-detection.md → references/issue-detection.md} +5 -5
  166. package/src/skf-refine-architecture/references/refinement-rules.md +2 -0
  167. package/src/skf-refine-architecture/{steps-c/step-06-report.md → references/report.md} +14 -5
  168. package/src/skf-rename-skill/SKILL.md +82 -12
  169. package/src/skf-rename-skill/customize.toml +52 -0
  170. package/src/skf-rename-skill/{steps-c/step-02-execute.md → references/execute.md} +94 -99
  171. package/src/skf-rename-skill/references/health-check.md +30 -0
  172. package/src/skf-rename-skill/references/rebuild-context.md +110 -0
  173. package/src/skf-rename-skill/{steps-c/step-03-report.md → references/report.md} +13 -5
  174. package/src/skf-rename-skill/{steps-c/step-01-select.md → references/select.md} +59 -20
  175. package/src/skf-setup/SKILL.md +35 -35
  176. package/src/skf-setup/customize.toml +33 -0
  177. package/src/skf-setup/{steps-c/step-03-auto-index.md → references/auto-index.md} +10 -18
  178. package/src/skf-setup/{steps-c/step-01b-ccc-index.md → references/ccc-index.md} +16 -31
  179. package/src/skf-setup/{steps-c/step-01-detect-and-tier.md → references/detect-and-tier.md} +23 -10
  180. package/src/skf-setup/{steps-c/step-05-health-check.md → references/health-check.md} +1 -1
  181. package/src/skf-setup/{steps-c/step-04-report.md → references/report.md} +21 -19
  182. package/src/skf-setup/references/tier-rules.md +1 -1
  183. package/src/skf-setup/{steps-c/step-02-write-config.md → references/write-config.md} +14 -13
  184. package/src/skf-test-skill/SKILL.md +77 -15
  185. package/src/skf-test-skill/customize.toml +54 -0
  186. package/src/skf-test-skill/{steps-c/step-04-coherence-check.md → references/coherence-check.md} +28 -71
  187. package/src/skf-test-skill/{steps-c/step-03-coverage-check.md → references/coverage-check.md} +16 -39
  188. package/src/skf-test-skill/{steps-c/step-02-detect-mode.md → references/detect-mode.md} +4 -26
  189. package/src/skf-test-skill/{steps-c/step-04b-external-validators.md → references/external-validators.md} +6 -28
  190. package/src/skf-test-skill/references/health-check.md +14 -0
  191. package/src/skf-test-skill/{steps-c/step-01-init.md → references/init.md} +21 -37
  192. package/src/skf-test-skill/references/migration-section-rules.md +4 -2
  193. package/src/skf-test-skill/{steps-c/step-06-report.md → references/report.md} +41 -51
  194. package/src/skf-test-skill/{steps-c/step-05-score.md → references/score.md} +26 -43
  195. package/src/skf-test-skill/references/scoring-rules.md +8 -6
  196. package/src/skf-test-skill/references/source-access-protocol.md +7 -5
  197. package/src/skf-test-skill/scripts/compute-score.py +88 -17
  198. package/src/skf-test-skill/templates/test-report-template.md +13 -13
  199. package/src/skf-update-skill/SKILL.md +23 -14
  200. package/src/skf-update-skill/customize.toml +44 -0
  201. package/src/skf-update-skill/{steps-c/step-02-detect-changes.md → references/detect-changes.md} +176 -68
  202. package/src/skf-update-skill/references/health-check.md +32 -0
  203. package/src/skf-update-skill/{steps-c/step-01-init.md → references/init.md} +56 -8
  204. package/src/skf-update-skill/references/manual-section-rules.md +4 -0
  205. package/src/skf-update-skill/references/merge-conflict-rules.md +4 -0
  206. package/src/skf-update-skill/{steps-c/step-04-merge.md → references/merge.md} +8 -8
  207. package/src/skf-update-skill/{steps-c/step-03-re-extract.md → references/re-extract.md} +53 -44
  208. package/src/skf-update-skill/references/remote-source-resolution.md +5 -1
  209. package/src/skf-update-skill/references/report.md +214 -0
  210. package/src/skf-update-skill/{steps-c/step-05-validate.md → references/validate.md} +5 -5
  211. package/src/skf-update-skill/{steps-c/step-06-write.md → references/write.md} +73 -51
  212. package/src/skf-verify-stack/SKILL.md +89 -17
  213. package/src/skf-verify-stack/assets/feasibility-report-template.md +4 -4
  214. package/src/skf-verify-stack/customize.toml +50 -0
  215. package/src/skf-verify-stack/references/coverage-patterns.md +2 -2
  216. package/src/skf-verify-stack/{steps-c/step-02-coverage.md → references/coverage.md} +7 -7
  217. package/src/skf-verify-stack/{steps-c/step-07-health-check.md → references/health-check.md} +7 -5
  218. package/src/skf-verify-stack/references/init.md +166 -0
  219. package/src/skf-verify-stack/references/integration-verification-rules.md +1 -1
  220. package/src/skf-verify-stack/{steps-c/step-03-integrations.md → references/integrations.md} +12 -12
  221. package/src/skf-verify-stack/{steps-c/step-06-report.md → references/report.md} +22 -41
  222. package/src/skf-verify-stack/{steps-c/step-04-requirements.md → references/requirements.md} +7 -7
  223. package/src/skf-verify-stack/{steps-c/step-05-synthesize.md → references/synthesize.md} +8 -8
  224. package/tools/validate-docs-drift.js +1 -1
  225. package/src/skf-refine-architecture/steps-c/step-01-init.md +0 -136
  226. package/src/skf-rename-skill/steps-c/step-04-health-check.md +0 -22
  227. package/src/skf-test-skill/steps-c/step-07-health-check.md +0 -25
  228. package/src/skf-update-skill/steps-c/step-07-report.md +0 -148
  229. package/src/skf-update-skill/steps-c/step-08-health-check.md +0 -22
  230. package/src/skf-verify-stack/steps-c/step-01-init.md +0 -178
@@ -0,0 +1,55 @@
1
+ # DO NOT EDIT -- overwritten on every update.
2
+ #
3
+ # Workflow customization surface for skf-analyze-source.
4
+
5
+ [workflow]
6
+
7
+ # --- Configurable below. Overrides merge per BMad structural rules: ---
8
+ # scalars: override wins • arrays (persistent_facts, activation_steps_*): append
9
+ # arrays-of-tables with `code`/`id`: replace matching items, append new ones.
10
+
11
+ # Steps to run before the standard activation (uv probe, config load).
12
+ # Overrides append. Use for org-wide pre-flight checks (auth, network,
13
+ # compliance) that must precede any source-analysis work.
14
+
15
+ activation_steps_prepend = []
16
+
17
+ # Steps to run after activation but before the first stage executes.
18
+ # Overrides append. Use for context loads or banner customization that
19
+ # should run once activation completes successfully.
20
+
21
+ activation_steps_append = []
22
+
23
+ # Persistent facts the workflow keeps in mind for the whole run
24
+ # (house style, naming conventions, scope guardrails).
25
+ # Overrides append.
26
+ #
27
+ # Each entry is either:
28
+ # - a literal sentence, e.g. "Recommended skills must align with our agent stack."
29
+ # - a file reference prefixed with `file:`, e.g.
30
+ # "file:{project-root}/docs/analysis-style.md" (globs supported; file
31
+ # contents are loaded and treated as facts).
32
+
33
+ persistent_facts = [
34
+ "file:{project-root}/**/project-context.md",
35
+ ]
36
+
37
+ # --- Optional asset overrides ---
38
+ #
39
+ # Lift the canonical asset paths so orgs can substitute house-style copies
40
+ # without forking the skill. Empty string = use the bundled default.
41
+
42
+ unit_detection_heuristics_path = ""
43
+ brief_schema_path = ""
44
+ analysis_report_template_path = ""
45
+
46
+ # Pipeline-integration hook invoked after the final result JSON is written
47
+ # (see generate-briefs.md). The command is called as:
48
+ # <on_complete> --result-path=<absolute_path_to_result_json>
49
+ # Useful for Slack notifications, dashboard ingest, CI hooks, or chaining
50
+ # into checkpoint-preview / a brief linter. Failures are logged to
51
+ # workflow_warnings[] but never fail the workflow.
52
+ #
53
+ # Empty string = no-op (default).
54
+
55
+ on_complete = ""
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  outputFile: '{forge_data_folder}/analyze-source-report-{project_name}.md'
3
3
  nextStepOptions:
4
- step-02: './step-02-scan-project.md'
5
- step-03: './step-03-identify-units.md'
6
- step-04: './step-04-map-and-detect.md'
7
- step-05: './step-05-recommend.md'
8
- step-06: './step-06-generate-briefs.md'
4
+ step 2: 'scan-project.md'
5
+ step 3: 'identify-units.md'
6
+ step 4: 'map-and-detect.md'
7
+ step 5: 'recommend.md'
8
+ step 6: 'generate-briefs.md'
9
9
  ---
10
10
 
11
+ <!-- Config: communicate in {communication_language}. -->
12
+
11
13
  # Step 1b: Continue Analysis
12
14
 
13
15
  ## STEP GOAL:
@@ -22,8 +24,6 @@ To resume the analyze-source workflow from where it was left off in a previous s
22
24
 
23
25
  ## MANDATORY SEQUENCE
24
26
 
25
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
26
-
27
27
  ### 1. Welcome Back
28
28
 
29
29
  "**Welcome back!** Let me check where we left off with the source analysis..."
@@ -56,11 +56,11 @@ Map the last completed step to the next step file:
56
56
 
57
57
  | Last Completed | Next Step |
58
58
  |----------------|-----------|
59
- | step-01-init | step-02-scan-project |
60
- | step-02-scan-project | step-03-identify-units |
61
- | step-03-identify-units | step-04-map-and-detect |
62
- | step-04-map-and-detect | step-05-recommend |
63
- | step-05-recommend | step-06-generate-briefs |
59
+ | init | scan-project |
60
+ | scan-project | identify-units |
61
+ | identify-units | map-and-detect |
62
+ | map-and-detect | recommend |
63
+ | recommend | generate-briefs |
64
64
 
65
65
  **IF all steps completed:**
66
66
  "**This analysis appears to be complete.** All steps have been finished. Would you like to start a new analysis?"
@@ -1,9 +1,11 @@
1
1
  ---
2
2
  outputFile: '{forge_data_folder}/analyze-source-report-{project_name}.md'
3
3
  schemaFile: 'assets/skill-brief-schema.md'
4
- nextStepFile: './step-07-health-check.md'
4
+ nextStepFile: 'health-check.md'
5
5
  ---
6
6
 
7
+ <!-- Config: communicate in {communication_language}. Artifact text in {document_output_language}. -->
8
+
7
9
  # Step 6: Generate Briefs
8
10
 
9
11
  ## STEP GOAL:
@@ -19,8 +21,6 @@ To generate a valid skill-brief.yaml file for each confirmed unit using the sche
19
21
 
20
22
  ## MANDATORY SEQUENCE
21
23
 
22
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
23
-
24
24
  ### 1. Load Context
25
25
 
26
26
  Read {outputFile} completely to obtain:
@@ -89,7 +89,7 @@ For each generated brief, check against {schemaFile} validation rules:
89
89
  **Validation:** {all passed / N issues found}
90
90
  {List any validation issues}
91
91
 
92
- **Ready to write {count} skill-brief.yaml files.** Confirm to proceed? (Y to write / N to abort / M to modify a specific brief)"
92
+ **Ready to write {count} skill-brief.yaml files.** Confirm to proceed? (Y to write all briefs / N to skip writing but continue to report update / M to modify a specific brief / X to cancel and exit the workflow)"
93
93
 
94
94
  Wait for explicit user confirmation before writing files.
95
95
 
@@ -107,10 +107,13 @@ For each confirmed brief:
107
107
  - Update the YAML, re-validate, present again
108
108
  - Return to confirmation prompt
109
109
 
110
- **IF user aborts (N):**
111
- - Document abort decision
110
+ **IF user skips writing (N):**
111
+ - Document the skip decision
112
112
  - Skip file writing, proceed to report update
113
113
 
114
+ **IF user cancels (X):**
115
+ - HARD HALT with exit code 6 (`user-cancelled`). Emit the `SKF_ANALYZE_RESULT_JSON` envelope on stderr with `status: "error"`, `halt_reason: "user-cancelled"`, `brief_paths: []`, and `unit_counts` reflecting the confirmed/skipped/maybe state from step 5
116
+
114
117
  ### 6. Determine Next Workflow Per Unit
115
118
 
116
119
  For each generated brief, recommend the appropriate next workflow:
@@ -128,7 +131,7 @@ For each generated brief, recommend the appropriate next workflow:
128
131
 
129
132
  Append the complete "## Generation Results" section to {outputFile}:
130
133
 
131
- Replace `[Appended by step-06-generate-briefs]` with:
134
+ Replace `[Appended by generate-briefs]` with:
132
135
 
133
136
  **Generated Briefs:**
134
137
  | # | Unit Name | Output Path | Validation | Next Workflow |
@@ -146,8 +149,8 @@ Replace `[Appended by step-06-generate-briefs]` with:
146
149
 
147
150
  Update {outputFile} frontmatter:
148
151
  ```yaml
149
- stepsCompleted: [append 'step-06-generate-briefs' to existing array]
150
- lastStep: 'step-06-generate-briefs'
152
+ stepsCompleted: [append 'generate-briefs' to existing array]
153
+ lastStep: 'generate-briefs'
151
154
  nextWorkflow: '{primary recommendation}'
152
155
  ```
153
156
 
@@ -182,7 +185,23 @@ To refine any brief, run the recommended next workflow. To re-analyze with diffe
182
185
 
183
186
  Write the result contract per `shared/references/output-contract-schema.md`: the per-run record at `{forge_data_folder}/analyze-source-result-{YYYYMMDD-HHmmss}.json` (UTC timestamp, resolution to seconds) and a copy at `{forge_data_folder}/analyze-source-result-latest.json` (stable path for pipeline consumers — copy, not symlink). Include all generated `skill-brief.yaml` paths in `outputs` and brief counts in `summary`.
184
187
 
188
+ ### 9b. On-Complete Hook (pipeline integration)
189
+
190
+ If `{onCompleteCommand}` is non-empty, invoke it now — after the timestamped result JSON and the `analyze-source-result-latest.json` copy have both been written:
191
+
192
+ ```
193
+ {onCompleteCommand} --result-path={result_json_path}
194
+ ```
195
+
196
+ Where `{result_json_path}` is the absolute path to the freshly written `analyze-source-result-latest.json` (stable path is preferred over the timestamped copy so downstream consumers don't need to discover the timestamp).
197
+
198
+ - On success: log to `workflow_warnings[]` as informational only if the hook emitted stderr (`on_complete hook stderr: …`); otherwise no entry.
199
+ - On non-zero exit / process error: log to `workflow_warnings[]` (`on_complete hook failed (exit {code}): {stderr_snippet}`).
200
+ - **Never fail the workflow on hook errors** — the hook is for pipeline integration (Slack, dashboards, CI), not for gating skill-brief production.
201
+
202
+ If `{onCompleteCommand}` is empty, skip this section entirely (default behavior — no hook configured).
203
+
185
204
  ### 10. Chain to Health Check
186
205
 
187
- ONLY WHEN the briefs have been written (or skipped per user abort), the report updated, the summary presented, and the result contract saved will you then load, read the full file, and execute `{nextStepFile}`. The health-check step is the true terminal step — do not stop here even though the summary reads as final.
206
+ ONLY WHEN the briefs have been written (or skipped per user abort), the report updated, the summary presented, the result contract saved, and the on-complete hook invoked (or skipped per empty `{onCompleteCommand}`) will you then load, read the full file, and execute `{nextStepFile}`. The health-check step is the true terminal step — do not stop here even though the summary reads as final.
188
207
 
@@ -1,10 +1,12 @@
1
1
  ---
2
2
  # `shared/health-check.md` resolves relative to the SKF module root
3
- # (`_bmad/skf/` when installed, `src/` during development), NOT relative
4
- # to this step file.
3
+ # (`{project-root}/_bmad/skf/` when installed, `src/` during development),
4
+ # NOT relative to this step file.
5
5
  nextStepFile: 'shared/health-check.md'
6
6
  ---
7
7
 
8
+ <!-- Config: communicate in {communication_language}. -->
9
+
8
10
  # Step 7: Workflow Health Check
9
11
 
10
12
  ## STEP GOAL:
@@ -13,7 +15,7 @@ Chain to the shared workflow self-improvement health check at `{nextStepFile}`.
13
15
 
14
16
  ## Rules
15
17
 
16
- - No user-facing reports, file writes, or result contracts in this step — those belong in step-06
18
+ - No user-facing reports, file writes, or result contracts in this step — those belong in step 6
17
19
  - Delegate directly to `{nextStepFile}` with no additional commentary
18
20
  - Do not attempt any other action between loading this step and executing `{nextStepFile}`
19
21
 
@@ -1,9 +1,12 @@
1
1
  ---
2
- nextStepFile: './step-04-map-and-detect.md'
2
+ nextStepFile: 'map-and-detect.md'
3
3
  outputFile: '{forge_data_folder}/analyze-source-report-{project_name}.md'
4
4
  heuristicsFile: 'references/unit-detection-heuristics.md'
5
+ disqualifyCandidatesScript: '{project-root}/src/shared/scripts/skf-disqualify-candidates.py'
5
6
  ---
6
7
 
8
+ <!-- Config: communicate in {communication_language}. -->
9
+
7
10
  # Step 3: Identify Units
8
11
 
9
12
  ## STEP GOAL:
@@ -18,8 +21,6 @@ To classify each detected boundary from the project scan into discrete skillable
18
21
 
19
22
  ## MANDATORY SEQUENCE
20
23
 
21
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
22
-
23
24
  ### 1. Load Context
24
25
 
25
26
  Read {outputFile} to obtain:
@@ -49,13 +50,41 @@ For EACH detected boundary from the scan:
49
50
  - `specific-modules` — selected components or packages
50
51
  - `public-api` — only exported interfaces
51
52
 
52
- **Step D — Check disqualification rules:**
53
- - Too small (fewer than 3 source files or 100 lines)
54
- - Generated code
55
- - Pure configuration
56
- - Test-only
57
- - Vendor/dependency copy
58
- - Already skilled (exists in existing_skills list)
53
+ **Step D — Run deterministic disqualification filter (script):**
54
+
55
+ Run the shared disqualification helper to apply the deterministic subset of the rules from {heuristicsFile} (file-count, LoC, generated-code paths, auto-generated header sentinels). The script collapses what was prose-orchestrated counting + path-substring + header scanning into one deterministic call.
56
+
57
+ 1. **Build the boundaries JSON** from the detected boundaries (one entry per candidate boundary). Use forward-slash paths throughout. Shape:
58
+ ```json
59
+ [
60
+ {"name": "<unit-name>",
61
+ "path": "<rel-from-project-root>",
62
+ "files": ["<rel-path>", ...]},
63
+ ...
64
+ ]
65
+ ```
66
+ 2. **Invoke the script** via stdin:
67
+ ```bash
68
+ uv run {disqualifyCandidatesScript} filter --boundaries - --source-root {project-root}
69
+ ```
70
+ piping the boundaries JSON on stdin. The script emits:
71
+ ```json
72
+ {
73
+ "kept": [{"name": "...", "path": "...", "files_count": N, "loc_total": L}, ...],
74
+ "dropped": [{"name": "...", "reason": "<too-few-files|too-low-loc|generated-code|auto-generated-tag>", "context": {...}}, ...],
75
+ "stats": {"kept": N, "dropped": N, "by_reason": {"<reason>": N, ...}}
76
+ }
77
+ ```
78
+ 3. **Parse the JSON result** and stash `kept[]` and `dropped[]` in workflow state for §3 (classification table) and §5 (recommendation summary). The `kept` set is the candidate pool for the boundary-type + scope-type classification that follows; the `dropped` set drives the Disqualification table.
79
+
80
+ **LLM-judged disqualifications (not in script — apply on top of `kept[]`):**
81
+ - **Pure configuration** — only config files (e.g., `.json`/`.yaml`) with no executable logic
82
+ - **Test-only** — test utilities with no production code
83
+ - **Already skilled** — exists in `existing_skills` list (recommend `update-skill` instead)
84
+
85
+ Remove any boundary that fails one of these LLM-judged rules from the working `kept` set and append it to `dropped[]` with the appropriate reason. Reasons recorded by the script (`too-few-files`, `too-low-loc`, `generated-code`, `auto-generated-tag`) are authoritative; do NOT re-evaluate those rules manually.
86
+
87
+ **Qualification CONFIRMATION:** Visually skim the script's `kept`/`dropped` decisions for sanity (e.g., a boundary you expected to qualify that landed in `dropped` — surface the script's `reason` and `context.first_match` to the user in §5 so they can override if the heuristic was wrong for this project).
59
88
 
60
89
  ### 3. Build Unit Classification Table
61
90
 
@@ -105,7 +134,7 @@ Wait for user feedback. Adjust classifications based on user input.
105
134
 
106
135
  Append the complete "## Identified Units" section to {outputFile}:
107
136
 
108
- Replace the placeholder `[Appended by step-03-identify-units]` with:
137
+ Replace the placeholder `[Appended by identify-units]` with:
109
138
  - Classification table (qualifying units)
110
139
  - Disqualification table
111
140
  - Already-skilled units list
@@ -114,17 +143,18 @@ Replace the placeholder `[Appended by step-03-identify-units]` with:
114
143
 
115
144
  Update {outputFile} frontmatter:
116
145
  ```yaml
117
- stepsCompleted: [append 'step-03-identify-units' to existing array]
118
- lastStep: 'step-03-identify-units'
146
+ stepsCompleted: [append 'identify-units' to existing array]
147
+ lastStep: 'identify-units'
119
148
  ```
120
149
 
121
150
  ### 7. Present MENU OPTIONS
122
151
 
123
- Display: "**Select:** [C] Continue to Export Mapping and Integration Detection"
152
+ Display: "**Select:** [C] Continue to Export Mapping and Integration Detection | [X] Cancel and exit"
124
153
 
125
154
  #### Menu Handling Logic:
126
155
 
127
156
  - IF C: Save classifications to {outputFile}, update frontmatter, then load, read entire file, then execute {nextStepFile}
157
+ - IF X: HARD HALT with exit code 6 (`user-cancelled`). Emit the `SKF_ANALYZE_RESULT_JSON` envelope on stderr with `status: "error"`, `halt_reason: "user-cancelled"`, and counts/paths reflecting state at cancellation
128
158
  - IF Any other: help user, then [Redisplay Menu Options](#7-present-menu-options)
129
159
 
130
160
  #### EXECUTION RULES:
@@ -1,10 +1,12 @@
1
1
  ---
2
- nextStepFile: './step-02-scan-project.md'
3
- continueFile: './step-01b-continue.md'
2
+ nextStepFile: 'scan-project.md'
3
+ continueFile: 'continue.md'
4
4
  outputFile: '{forge_data_folder}/analyze-source-report-{project_name}.md'
5
5
  templateFile: 'templates/analysis-report-template.md'
6
6
  ---
7
7
 
8
+ <!-- Config: communicate in {communication_language}. -->
9
+
8
10
  # Step 1: Initialize Analysis
9
11
 
10
12
  ## STEP GOAL:
@@ -19,8 +21,6 @@ To initialize the analyze-source workflow by loading configuration, detecting co
19
21
 
20
22
  ## MANDATORY SEQUENCE
21
23
 
22
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
23
-
24
24
  ### 1. Check for Existing Report (Continuation Detection)
25
25
 
26
26
  Look for {outputFile}.
@@ -46,6 +46,8 @@ Look for {outputFile}.
46
46
 
47
47
  ### 3. Collect Project Path
48
48
 
49
+ **Headless flag consumption:** If `--project-path <path>` was passed at invocation, set `project_paths[]` directly from the flag value (comma-split if multiple paths were supplied), skip the prompt below, and proceed to validation. Otherwise prompt as today.
50
+
49
51
  "**Welcome to Analyze Source — the SKF decomposition engine.**
50
52
 
51
53
  I'll analyze your project to identify discrete skillable units and produce skill-brief.yaml files for each recommended unit.
@@ -68,8 +70,25 @@ Wait for user input.
68
70
  - **IF any invalid:** "Path `{path}` doesn't appear to be valid. Please correct it."
69
71
  - Store as `project_paths[]` array in report frontmatter (single path stored as 1-element array for consistency)
70
72
 
73
+ **Collect intent hint** (drives recommendation ranking in Step 5):
74
+
75
+ **Headless flag consumption:** If `--intent-hint <text>` was passed at invocation, set workflow-context `intent_hint` directly from the flag value, skip the prompt below, and proceed. If `{headless_mode}` is true and no `--intent-hint` was supplied, set `intent_hint = ""` (empty) and proceed without prompting.
76
+
77
+ "**Optional: What are you hoping to get out of this analysis?**
78
+
79
+ For example:
80
+ - Skills for a specific domain (e.g., 'authentication and authorization')
81
+ - Target consumer agents (e.g., 'skills our backend team's AI assistants will call')
82
+ - Constraints (e.g., 'we only want stable public APIs, no internal modules')
83
+
84
+ Type details, or press Enter to skip."
85
+
86
+ Wait for user input. Store as workflow-context `intent_hint` (empty string if skipped).
87
+
71
88
  ### 4. Collect Optional Scope Hints
72
89
 
90
+ **Headless flag consumption:** If `--scope-hint <text>` was passed at invocation, set workflow-context `scope_hint` directly from the flag value, skip the prompt below, and proceed. If `{headless_mode}` is true and no `--scope-hint` was supplied, set `scope_hint = ""` (empty) and proceed without prompting.
91
+
73
92
  "**Optional: Do you have scope hints to narrow the analysis?**
74
93
 
75
94
  For example:
@@ -99,8 +118,8 @@ Create {outputFile} from {templateFile}.
99
118
 
100
119
  **Populate frontmatter:**
101
120
  ```yaml
102
- stepsCompleted: ['step-01-init']
103
- lastStep: 'step-01-init'
121
+ stepsCompleted: ['init']
122
+ lastStep: 'init'
104
123
  lastContinued: ''
105
124
  date: '{current_date}'
106
125
  user_name: '{user_name}'
@@ -108,6 +127,8 @@ project_name: '{project_name}'
108
127
  project_paths: ['{provided_project_path}']
109
128
  forge_tier: '{detected_tier}'
110
129
  existing_skills: [{list of existing skill names}]
130
+ intent_hint: '{intent_hint or empty string}'
131
+ scope_hint: '{scope_hint or empty string}'
111
132
  confirmed_units: []
112
133
  stack_skill_candidates: []
113
134
  nextWorkflow: ''
@@ -1,9 +1,11 @@
1
1
  ---
2
- nextStepFile: './step-05-recommend.md'
2
+ nextStepFile: 'recommend.md'
3
3
  outputFile: '{forge_data_folder}/analyze-source-report-{project_name}.md'
4
4
  heuristicsFile: 'references/unit-detection-heuristics.md'
5
5
  ---
6
6
 
7
+ <!-- Config: communicate in {communication_language}. -->
8
+
7
9
  # Step 4: Map Exports and Detect Integrations
8
10
 
9
11
  ## STEP GOAL:
@@ -12,15 +14,13 @@ To analyze each qualifying unit's export surface and import graph, detect cross-
12
14
 
13
15
  ## Rules
14
16
 
15
- - Use subprocess Pattern 2 (per-unit deep analysis) when available
17
+ - Delegate per-unit deep analysis to a subagent when available (parallelizes across units; main-thread fallback is fine)
16
18
  - For each qualifying unit, perform thorough export surface analysis — do not shortcut
17
19
  - Do not make recommendations (Step 05)
18
20
  - Tier-aware depth: Quick (file-level), Forge (AST), Deep (AST + semantic)
19
21
 
20
22
  ## MANDATORY SEQUENCE
21
23
 
22
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
23
-
24
24
  ### 1. Load Context
25
25
 
26
26
  Read {outputFile} to obtain:
@@ -29,23 +29,31 @@ Read {outputFile} to obtain:
29
29
 
30
30
  Load {heuristicsFile} for stack skill candidate detection rules.
31
31
 
32
- ### 2. Map Export Surfaces Per Unit
32
+ ### 2. Map Export Surfaces Per Unit (Subagent Fan-Out)
33
+
34
+ DO NOT BE LAZY — For EACH qualifying unit, delegate deep analysis to a subagent so per-unit work runs in parallel and the parent's context stays clean.
33
35
 
34
- DO NOT BE LAZY — For EACH qualifying unit, launch a subprocess (or analyze in main thread) that:
36
+ **Subagent fan-out protocol:**
35
37
 
36
- **Size-aware strategy selection:**
37
- - **< 50 files:** Full export scan — analyze every file for exports
38
- - **50-200 files:** Targeted scan — entry points (`__init__.py`, `index.ts`, `lib.rs`) + public modules + barrel exports only
39
- - **200+ files:** Entry-point strategy — analyze top-level entry point for public API surface, list submodule entry points, analyze each submodule entry point only. Report coverage confidence based on percentage of files analyzed.
38
+ 1. **Build the qualifying-unit list.** Read the unit list produced upstream (Step §3 / §4 outputs already in workflow context — names, paths, scope types, languages, file counts). Do NOT re-scan the project here.
40
39
 
41
- **Per-unit analysis (scaled by strategy above):**
40
+ 2. **Delegate per-unit deep analysis to a subagent.** For each qualifying unit, launch a subagent task with these explicit constraints:
41
+ - The subagent reads ONLY that unit's directory tree
42
+ - The subagent analyzes exports / usage / CCC signals / scripts+assets for that one unit
43
+ - **The parent does NOT read the unit's source files before delegating** (avoid the implicit-read trap — the whole point of fan-out is to keep large source bodies out of the parent's context)
42
44
 
43
- 1. Scans the unit's directory for export/public interface files
44
- 2. Counts and categorizes exports based on forge tier:
45
+ 3. **Per-unit analysis the subagent performs (scaled by size-aware strategy):**
46
+
47
+ **Size-aware strategy selection:**
48
+ - **< 50 files:** Full export scan — analyze every file for exports
49
+ - **50-200 files:** Targeted scan — entry points (`__init__.py`, `index.ts`, `lib.rs`) + public modules + barrel exports only
50
+ - **200+ files:** Entry-point strategy — analyze top-level entry point for public API surface, list submodule entry points, analyze each submodule entry point only. Report coverage confidence based on percentage of files analyzed.
51
+
52
+ **Tier-aware depth:**
45
53
  - **Quick tier:** Count files by type, identify index/barrel files, list directory structure
46
54
  - **Forge tier:** Parse export statements, identify public API surface, count exported functions/classes/types
47
55
  - **Forge+ tier:** All Forge analysis plus:
48
- - If `tools.ccc` is true: run `ccc_bridge.search("{unit_name} exports public API", top_k=15)` **Tool resolution:** `/ccc` skill search (Claude Code), ccc MCP server (Cursor), or `ccc search` CLI; see `knowledge/tool-resolution.md` to discover semantically relevant files beyond directory scan
56
+ - If `tools.ccc` is true: run `ccc_bridge.search("{unit_name} exports public API", top_k=15)` to discover semantically relevant files beyond directory scan. Tool resolution: prefer the `/ccc` skill search (Claude Code) or ccc MCP server (Cursor); fall back to the `ccc search` CLI if neither is available; if no ccc tool resolves, skip CCC discovery and record `ccc: unavailable` in per-unit findings.
49
57
  - Merge CCC-discovered files with scoped file list — files from CCC that are within the unit's directory are added to the analysis queue
50
58
  - Record CCC signals in per-unit findings: top 3 CCC-ranked file names (or "—" if no ccc results)
51
59
  - **Deep tier:** All Forge analysis plus:
@@ -53,20 +61,39 @@ DO NOT BE LAZY — For EACH qualifying unit, launch a subprocess (or analyze in
53
61
  - ast-grep type/interface mapping: `ast-grep -p 'interface $NAME' --lang typescript` or `ast-grep -p 'class $NAME($$$)' --lang python`
54
62
  - If QMD available: query for temporal evolution of identified exports (deprecation signals, recent additions, refactoring patterns)
55
63
  - Record semantic relationships between exports (which exports reference/depend on each other)
56
- 3. Returns structured findings to parent:
57
- - Export count (files, functions, types, classes)
58
- - Primary export patterns (barrel exports, direct exports, re-exports)
59
- - Public API surface size estimate
60
- - Key entry points
61
- - Script/asset presence: check for `scripts/`, `bin/`, `assets/`, `templates/` directories and files matching detection signals in `{heuristicsFile}`. Record counts in per-unit findings.
64
+
65
+ **Subagent must also record:**
66
+ - Script/asset presence: check for `scripts/`, `bin/`, `assets/`, `templates/` directories and files matching detection signals in `{heuristicsFile}`
62
67
  - Analysis strategy used and coverage confidence
63
68
 
64
- **Per-unit export summary:**
69
+ 4. **Subagent return contract.** Each subagent returns ONLY this JSON object — no prose, no commentary, no markdown fences:
70
+
71
+ ```json
72
+ {
73
+ "unit_name": "...",
74
+ "files_count": N,
75
+ "exports_count": N,
76
+ "export_pattern": "...",
77
+ "api_surface": ["..."],
78
+ "scripts_assets": {"scripts": [], "assets": []},
79
+ "ccc_signals": {"top_files": [], "available": <bool>},
80
+ "strategy_used": "ast-grep|regex|main-thread",
81
+ "confidence": "T1|T2|T1-low"
82
+ }
83
+ ```
84
+
85
+ 5. **Parent post-processing.** Strip any wrapping markdown fences (subagents sometimes wrap JSON in ` ```json … ``` ` despite the contract) before parsing. Validate each payload against the contract; if a key is missing, log a warning to `workflow_warnings[]` and continue with that unit's degraded record.
86
+
87
+ 6. **Aggregate.** Collect all per-unit JSON payloads into `per_unit_findings[]` in workflow context for use by §3 (import graph), §4 (integration points), §5 (stack candidates), §6 (findings presentation), and downstream stages (recommend.md, generate-briefs.md).
88
+
89
+ **Per-unit export summary (built from `per_unit_findings[]`):**
65
90
 
66
91
  | Unit | Files | Exports | Export Pattern | API Surface | Scripts/Assets | CCC Signals |
67
92
  |------|-------|---------|----------------|-------------|----------------|-------------|
68
93
  | {name} | {count} | {count} | {pattern} | {small/medium/large} | {N scripts, M assets or --} | {CCC signals or --} |
69
94
 
95
+ **Graceful degradation.** If subagents are unavailable in the current runtime, the parent performs the per-unit analysis sequentially in the main thread using the same size-aware strategy and tier-aware depth as above. Each main-thread analysis still produces the same JSON record shape so downstream stages remain agnostic to the execution mode. Record `strategy_used: "main-thread"` for every unit processed this way.
96
+
70
97
  ### 3. Map Import Graph
71
98
 
72
99
  For each qualifying unit, analyze inbound and outbound imports:
@@ -143,20 +170,20 @@ Wait for user feedback. Adjust analysis based on user input.
143
170
  ### 7. Append to Report
144
171
 
145
172
  Append the complete "## Export Map" section to {outputFile}:
146
- Replace `[Appended by step-04-map-and-detect]` under Export Map with:
173
+ Replace `[Appended by map-and-detect]` under Export Map with:
147
174
  - Per-unit export summary table
148
175
  - Export pattern analysis
149
176
 
150
177
  Append the complete "## Integration Points" section to {outputFile}:
151
- Replace `[Appended by step-04-map-and-detect]` under Integration Points with:
178
+ Replace `[Appended by map-and-detect]` under Integration Points with:
152
179
  - Cross-reference matrix
153
180
  - Integration point details
154
181
  - Stack skill candidate flags
155
182
 
156
183
  Update {outputFile} frontmatter:
157
184
  ```yaml
158
- stepsCompleted: [append 'step-04-map-and-detect' to existing array]
159
- lastStep: 'step-04-map-and-detect'
185
+ stepsCompleted: [append 'map-and-detect' to existing array]
186
+ lastStep: 'map-and-detect'
160
187
  stack_skill_candidates: [{list flagged candidate groupings}]
161
188
  ```
162
189
 
@@ -1,11 +1,13 @@
1
1
  ---
2
- nextStepFile: './step-06-generate-briefs.md'
2
+ nextStepFile: 'generate-briefs.md'
3
3
  outputFile: '{forge_data_folder}/analyze-source-report-{project_name}.md'
4
4
  schemaFile: 'assets/skill-brief-schema.md'
5
5
  advancedElicitationSkill: '/bmad-advanced-elicitation'
6
6
  partyModeSkill: '/bmad-party-mode'
7
7
  ---
8
8
 
9
+ <!-- Config: communicate in {communication_language}. Artifact text in {document_output_language}. -->
10
+
9
11
  # Step 5: Recommend
10
12
 
11
13
  ## STEP GOAL:
@@ -20,8 +22,6 @@ To present each qualifying unit as a recommendation with evidence-based rational
20
22
 
21
23
  ## MANDATORY SEQUENCE
22
24
 
23
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
24
-
25
25
  ### 1. Load Context
26
26
 
27
27
  Read {outputFile} completely to obtain:
@@ -30,9 +30,12 @@ Read {outputFile} completely to obtain:
30
30
  - Integration points and coupling analysis
31
31
  - Stack skill candidates from frontmatter
32
32
  - Existing skills from frontmatter
33
+ - `intent_hint` from frontmatter (captured in init.md §3 — user's stated goal for the analysis; empty string if skipped)
33
34
 
34
35
  Load {schemaFile} for reference on what skill-brief.yaml requires (so recommendations are actionable).
35
36
 
37
+ **Apply `intent_hint` when ranking units.** If `intent_hint` is non-empty, use it to bias the order in which recommendation cards are presented and to soften the rationale for units that fall outside the stated intent (e.g., when `intent_hint` mentions "authentication and authorization", rank auth-related units first and flag unrelated units with a one-line rationale acknowledging the mismatch). If `intent_hint` is empty, present in the deterministic order from the export map.
38
+
36
39
  ### 2. Build Recommendation Cards
37
40
 
38
41
  For EACH qualifying unit, prepare a recommendation card:
@@ -81,7 +84,10 @@ Present each recommendation card, then after ALL cards:
81
84
  - **N** — Reject: skip this unit
82
85
  - **M** — Modify: adjust name, scope, or description before confirming
83
86
 
84
- You can respond with a list (e.g., '1:Y, 2:Y, 3:N, 4:M') or address each individually.
87
+ **Bulk shortcuts:**
88
+ - `all-Y` — confirm every recommendation as-is
89
+ - `all-N` — skip every recommendation
90
+ - Individual response list (e.g., `1:Y, 2:N, 3:M, ...`) — explicit per-unit decisions (use this when you want to mix Y/N/M or modify any unit)
85
91
 
86
92
  **Questions?** Ask 'why?' about any recommendation and I'll explain my reasoning with specific evidence."
87
93
 
@@ -137,7 +143,7 @@ Wait for explicit final confirmation.
137
143
 
138
144
  Append the complete "## Recommendations" section to {outputFile}:
139
145
 
140
- Replace `[Appended by step-05-recommend]` with:
146
+ Replace `[Appended by recommend]` with:
141
147
  - All recommendation cards (including rationale)
142
148
  - User decisions per unit (confirmed/rejected/modified)
143
149
  - Stack skill candidate decisions
@@ -145,15 +151,15 @@ Replace `[Appended by step-05-recommend]` with:
145
151
 
146
152
  Update {outputFile} frontmatter:
147
153
  ```yaml
148
- stepsCompleted: [append 'step-05-recommend' to existing array]
149
- lastStep: 'step-05-recommend'
154
+ stepsCompleted: [append 'recommend' to existing array]
155
+ lastStep: 'recommend'
150
156
  confirmed_units: [{list of confirmed unit names}]
151
157
  stack_skill_candidates: [{updated list with user decisions}]
152
158
  ```
153
159
 
154
160
  ### 8. Present MENU OPTIONS
155
161
 
156
- Display: "**Select an Option:** [A] Advanced Elicitation [P] Party Mode [D] Discover Additional Source [C] Continue to Brief Generation"
162
+ Display: "**Select an Option:** [A] Advanced Elicitation [P] Party Mode [D] Discover Additional Source [C] Continue to Brief Generation [X] Cancel and exit"
157
163
 
158
164
  #### Menu Handling Logic:
159
165
 
@@ -161,6 +167,7 @@ Display: "**Select an Option:** [A] Advanced Elicitation [P] Party Mode [D] Disc
161
167
  - IF P: Invoke {partyModeSkill}, and when finished redisplay the menu
162
168
  - IF D: Accept a new repo path/URL from the user. Run a lightweight scan + classify (subset of steps 02-03) for the new source only. Merge new units into the existing report and update `project_paths[]` in frontmatter. Run export mapping for the new units (same logic as step 04 section 2). Generate recommendation cards for the new units and present them for confirmation. Then redisplay this menu.
163
169
  - IF C: Save recommendations to {outputFile}, update frontmatter, then load, read entire file, then execute {nextStepFile}
170
+ - IF X: HARD HALT with exit code 6 (`user-cancelled`). Emit the `SKF_ANALYZE_RESULT_JSON` envelope on stderr with `status: "error"`, `halt_reason: "user-cancelled"`, and counts/paths reflecting state at cancellation
164
171
  - IF Any other comments or queries: help user respond then [Redisplay Menu Options](#8-present-menu-options)
165
172
 
166
173
  #### EXECUTION RULES: