bmad-module-skill-forge 1.4.0 → 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 (231) 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 +45 -1
  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/references/init.md +305 -0
  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 -16
  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} +17 -9
  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} +18 -12
  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} +21 -51
  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} +30 -6
  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} +116 -91
  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} +14 -22
  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-audit-skill/steps-c/step-01-init.md +0 -221
  226. package/src/skf-refine-architecture/steps-c/step-01-init.md +0 -136
  227. package/src/skf-rename-skill/steps-c/step-04-health-check.md +0 -22
  228. package/src/skf-test-skill/steps-c/step-07-health-check.md +0 -25
  229. package/src/skf-update-skill/steps-c/step-07-report.md +0 -148
  230. package/src/skf-update-skill/steps-c/step-08-health-check.md +0 -22
  231. package/src/skf-verify-stack/steps-c/step-01-init.md +0 -178
@@ -1,6 +1,7 @@
1
1
  ---
2
- nextStepFile: './step-08-validate.md'
2
+ nextStepFile: 'validate.md'
3
3
  stackSkillTemplate: 'assets/stack-skill-template.md'
4
+ provenanceMapSchemaPath: 'assets/provenance-map-schema.md'
4
5
  # Resolve `{atomicWriteHelper}` by probing `{atomicWriteProbeOrder}` in order
5
6
  # (installed SKF module path first, src/ dev-checkout fallback); first existing
6
7
  # path wins. HALT if neither resolves — stage/commit/flip-link/write below
@@ -10,6 +11,8 @@ atomicWriteProbeOrder:
10
11
  - '{project-root}/src/shared/scripts/skf-atomic-write.py'
11
12
  ---
12
13
 
14
+ <!-- Config: communicate in {communication_language}. Artifact text in {document_output_language}. -->
15
+
13
16
  # Step 7: Generate Output Files
14
17
 
15
18
  ## STEP GOAL:
@@ -24,8 +27,6 @@ Write all deliverable and workspace artifact files to their target directories.
24
27
 
25
28
  ## MANDATORY SEQUENCE
26
29
 
27
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
28
-
29
30
  ### 1. Resolve Paths and Stage Target Directory
30
31
 
31
32
  Resolve `{version}` from the primary library version or default to `1.0.0` (see S11 in "Primary library" note below). The final artifact paths are:
@@ -40,7 +41,7 @@ Resolve `{version}` from the primary library version or default to `1.0.0` (see
40
41
 
41
42
  Where the skill name is `{project_name}-stack` and `{version}` is the semver version (with build metadata stripped per `knowledge/version-paths.md`).
42
43
 
43
- **Primary library definition (S11):** In code-mode, the primary library is the dependency with the highest import count from step-03; its `version` (from the manifest) becomes `{primary_library_version}`. In compose-mode, use the highest semver across constituent skill `metadata.json` files. If neither is available, fall back to `1.0.0`.
44
+ **Primary library definition (S11):** In code-mode, the primary library is the dependency with the highest import count from step 3; its `version` (from the manifest) becomes `{primary_library_version}`. In compose-mode, use the highest semver across constituent skill `metadata.json` files. If neither is available, fall back to `1.0.0`.
44
45
 
45
46
  **Pre-flight: group-dir type check (S3):** If `{skills_output_folder}/{project_name}-stack/` already exists, probe `{skills_output_folder}/{project_name}-stack/active/{project_name}-stack/metadata.json`. If that metadata exists and `skill_type != "stack"`, HALT with:
46
47
 
@@ -74,7 +75,7 @@ mkdir -p {forge_version}
74
75
  python3 {atomicWriteHelper} commit-dir --rollback --target {skill_package}
75
76
  ```
76
77
 
77
- Then abort with a structured error contract (see B7): purge any `{forge_version}/*-tmp` staging artifacts, emit `{"status":"error","skill":"skf-create-stack-skill","stage":"step-07","reason":"<message>"}` on stderr, and halt the workflow.
78
+ Then abort with a structured error contract (see B7): purge any `{forge_version}/*-tmp` staging artifacts, emit `{"status":"error","skill":"skf-create-stack-skill","stage":"step 7","reason":"<message>"}` on stderr, and halt the workflow.
78
79
 
79
80
  ### 2. Stage SKILL.md
80
81
 
@@ -136,7 +137,7 @@ Write `{skill_staging}/metadata.json`:
136
137
  Populate all fields from the metadata.json schema defined in `{stackSkillTemplate}`.
137
138
 
138
139
  **Tier fields:**
139
- - `forge_tier` — the run tier (Quick/Forge/Forge+/Deep) resolved in step-01.
140
+ - `forge_tier` — the run tier (Quick/Forge/Forge+/Deep) resolved in step 1.
140
141
  - `confidence_tier` — the dominant T-code from `confidence_distribution`. Pick the tier with the highest count; resolve ties toward the weaker tier (T1-low > T1, T2 > T1-low, T3 > T2) so the reported value never overstates confidence. When `confidence_distribution` is empty (no libraries extracted), emit `"T1-low"` as the conservative default.
141
142
 
142
143
  ```json
@@ -191,87 +192,12 @@ If any workspace write fails, invoke the rollback contract from §1.
191
192
 
192
193
  **provenance-map.json:**
193
194
 
194
- **In code-mode:**
195
- ```json
196
- {
197
- "provenance_version": "2.0",
198
- "skill_name": "{project_name}-stack",
199
- "skill_type": "stack",
200
- "source_repo": ["{repo_url_1}", "{repo_url_2}"],
201
- "source_commit": {"{repo_1}": "{hash_1}", "{repo_2}": "{hash_2}"},
202
- "generated_at": "{ISO-8601}",
203
- "entries": [
204
- {
205
- "export_name": "{name}",
206
- "export_type": "{type}",
207
- "source_library": "{library-name}",
208
- "params": [],
209
- "return_type": "{type}",
210
- "source_file": "{file}",
211
- "source_line": 0,
212
- "confidence": "T1|T1-low|T2",
213
- "extraction_method": "ast_bridge|source_reading|qmd_bridge",
214
- "signature_source": "T1|T2|T3"
215
- }
216
- ],
217
- "integrations": [
218
- {
219
- "libraries": ["{libA}", "{libB}"],
220
- "pattern_type": "{type}",
221
- "detection_method": "co-import grep",
222
- "co_import_files": [{"file": "{path}", "line": 0}],
223
- "confidence": "T1|T2"
224
- }
225
- ]
226
- }
227
- ```
195
+ Use the schema from `{provenanceMapSchemaPath}` — see that asset for the canonical templates and field definitions of both variants:
228
196
 
229
- **In compose-mode:**
230
- ```json
231
- {
232
- "provenance_version": "2.0",
233
- "skill_name": "{project_name}-stack",
234
- "skill_type": "stack",
235
- "source_repo": null,
236
- "source_commit": null,
237
- "source_ref": null,
238
- "generated_at": "{ISO-8601}",
239
- "entries": [
240
- {
241
- "export_name": "{name}",
242
- "export_type": "{type}",
243
- "source_library": "{library-name}",
244
- "params": [],
245
- "return_type": "{type}",
246
- "source_file": "{from constituent skill}",
247
- "source_line": 0,
248
- "confidence": "T1|T1-low|T2",
249
- "extraction_method": "compose-from-skill",
250
- "signature_source": "T1|T2|T3"
251
- }
252
- ],
253
- "integrations": [
254
- {
255
- "libraries": ["{libA}", "{libB}"],
256
- "pattern_type": "{type}",
257
- "detection_method": "architecture_co_mention|inferred_from_shared_domain",
258
- "co_import_files": [],
259
- "confidence": "T2|T3"
260
- }
261
- ],
262
- "constituents": [
263
- {
264
- "skill_name": "{constituent-skill-name}",
265
- "skill_path": "skills/{skill-dir}/",
266
- "version": "{version from constituent metadata.json}",
267
- "composed_at": "{ISO-8601}",
268
- "metadata_hash": "sha256:{hash of constituent metadata.json}"
269
- }
270
- ]
271
- }
272
- ```
197
+ - **In code-mode:** use the code-mode variant (`source_repo` / `source_commit` populated; `extraction_method` ∈ `ast_bridge|source_reading|qmd_bridge`; `detection_method = "co-import grep"`).
198
+ - **In compose-mode:** use the compose-mode variant (source-anchor fields `null`; `extraction_method = "compose-from-skill"`; `detection_method ∈ "architecture_co_mention|inferred_from_shared_domain"`; includes the additional `constituents[]` array for drift detection).
273
199
 
274
- > **Note:** Per-export entries use the same schema as single skills (see `skill-sections.md`), with `source_library` identifying the originating library. In compose-mode, `constituents[]` enables audit to detect constituent drift via metadata hash comparison. **Use the `metadata_hash` value already stored in workflow state during step-02 (S13) — do NOT re-read and re-hash at step-07 time. The stored hash captures the state as it was at manifest-detection time, which is the correct provenance anchor.**
200
+ **Use the `metadata_hash` value already stored in workflow state during step 2 (S13) — do NOT re-read and re-hash at step 7 time. The stored hash captures the state as it was at manifest-detection time, which is the correct provenance anchor.**
275
201
 
276
202
  **evidence-report.md:**
277
203
  - Extraction summary per library
@@ -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
3
+ # (`{project-root}/_bmad/skf/` when installed, `src/` during development), NOT relative
4
4
  # 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 10: 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-09
18
+ - No user-facing reports, file writes, or result contracts in this step — those belong in step 9
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,8 +1,10 @@
1
1
  ---
2
- nextStepFile: './step-02-detect-manifests.md'
2
+ nextStepFile: 'detect-manifests.md'
3
3
  forgeTierFile: '{sidecar_path}/forge-tier.yaml'
4
4
  ---
5
5
 
6
+ <!-- Config: communicate in {communication_language}. -->
7
+
6
8
  # Step 1: Initialize
7
9
 
8
10
  ## STEP GOAL:
@@ -15,8 +17,6 @@ Load forge tier configuration, validate prerequisites, and prepare the stack ski
15
17
 
16
18
  ## MANDATORY SEQUENCE
17
19
 
18
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
19
-
20
20
  ### 0. Validate Project Config
21
21
 
22
22
  Before anything else, load `{project-root}/_bmad/skf/config.yaml`. If the file is missing OR fails YAML parse OR lacks the required top-level keys (`project_name`, `output_folder`, `skills_output_folder`, `forge_data_folder`, `sidecar_path`), HALT with:
@@ -29,6 +29,72 @@ Before anything else, load `{project-root}/_bmad/skf/config.yaml`. If the file i
29
29
 
30
30
  STOP — do not proceed.
31
31
 
32
+ ### 0b. Resume Check
33
+
34
+ Before any further init work, check for an interrupted prior run.
35
+
36
+ **Probe path.** Resolve `{resume_skill_name}` as `{project_name}-stack` (the same skill name used at step 7) and probe `{forge_data_folder}/{resume_skill_name}/in-progress.json`. (The file lives at the version-agnostic skill root so it can be found before `{version}` resolution.)
37
+
38
+ **If no in-progress.json exists:** Continue to §1.
39
+
40
+ **If in-progress.json exists:** Load and parse it. Read `last_completed_step` and `started_at` (ISO-8601 timestamp). Surface a soft gate:
41
+
42
+ "**Resume previous run?**
43
+
44
+ Found a previous in-progress run at `{forge_data_folder}/{resume_skill_name}/in-progress.json` from {started_at}, last completed at step {last_completed_step}.
45
+
46
+ - **[C] Continue** (recommended) — resume from the next step after {last_completed_step}, restoring saved workflow state.
47
+ - **[F] Fresh** — archive the existing in-progress.json (rename to `in-progress.{timestamp}.json`) and start over from step 1.
48
+ - **[X] Cancel and exit** — leave the in-progress.json untouched and halt.
49
+
50
+ Select [C/F/X]:"
51
+
52
+ **Headless default:** `[C]` Continue.
53
+
54
+ **On [C] Continue:**
55
+ 1. Restore workflow context from in-progress.json fields: `last_completed_step`, `workflow_state` (mode, tier, scope), and any accumulator fields (partial extractions, ranked libraries, integration pairs, compile-stack output) that the writing step persisted.
56
+ 2. Determine the resume target: the step file that runs immediately after `last_completed_step`.
57
+ 3. Jump directly to that step file by loading and executing it (skip the remaining §0b–§5 init substeps for this run).
58
+
59
+ **On [F] Fresh:**
60
+ 1. Compute `{archive_timestamp}` as the current UTC time in `YYYYMMDDTHHMMSSZ` form.
61
+ 2. Rename `{forge_data_folder}/{resume_skill_name}/in-progress.json` → `{forge_data_folder}/{resume_skill_name}/in-progress.{archive_timestamp}.json`.
62
+ 3. Continue with §1 of this file as if no prior run existed.
63
+
64
+ **On [X] Cancel and exit:** HARD HALT with exit code 6 (user-cancelled). Do NOT modify the in-progress.json. Emit the result envelope on stderr per the Result Contract in SKILL.md:
65
+
66
+ ```
67
+ SKF_STACK_RESULT_JSON: {"status":"error","skill_package":null,"skill_name":"{resume_skill_name}","stack_libraries":[],"mode":null,"exit_code":6,"halt_reason":"user-cancelled"}
68
+ ```
69
+
70
+ **in-progress.json schema (read side).** This PR wires only the READ side of the resume protocol. The WRITE side — each stage step persisting an updated in-progress.json after it completes — is deferred to a follow-up PR. When write-side wiring lands, each step writes the file via `skf-atomic-write.py write` at the end of its mandatory sequence with this shape:
71
+
72
+ ```json
73
+ {
74
+ "schema_version": "1.0",
75
+ "skill_name": "{project_name}-stack",
76
+ "started_at": "{ISO-8601 of step 1 start}",
77
+ "updated_at": "{ISO-8601 of most recent step completion}",
78
+ "last_completed_step": "step-NN",
79
+ "workflow_state": {
80
+ "mode": "code|compose",
81
+ "forge_tier": "Quick|Forge|Forge+|Deep",
82
+ "headless_mode": false,
83
+ "scope": {"explicit_deps": [], "scope_overrides": {}, "architecture_doc_path": null}
84
+ },
85
+ "accumulators": {
86
+ "manifests": [],
87
+ "ranked_libraries": [],
88
+ "extractions": {},
89
+ "integration_pairs": [],
90
+ "compiled_stack": null,
91
+ "workflow_warnings": []
92
+ }
93
+ }
94
+ ```
95
+
96
+ Until the write side is wired, in-progress.json will not naturally appear and §0b will fall through to §1 on every run. The resume gate is a no-op until that follow-up lands.
97
+
32
98
  ### 1. Load Forge Tier Configuration
33
99
 
34
100
  Load `{forgeTierFile}` from the Ferris sidecar.
@@ -60,7 +126,7 @@ Extract:
60
126
  **Tier-dependent tools:**
61
127
  - **Quick:** gh_bridge (source reading) — graceful degradation to local file reading if unavailable
62
128
  - **Forge:** ast_bridge (ast-grep structural analysis) — required for Forge tier
63
- - **Forge+:** ast_bridge + ccc_bridge (ccc semantic co-import augmentation) — ccc available for step-05
129
+ - **Forge+:** ast_bridge + ccc_bridge (ccc semantic co-import augmentation) — ccc available for step 5
64
130
  - **Deep:** qmd_bridge (QMD temporal enrichment) — required for Deep tier
65
131
 
66
132
  See `knowledge/tool-resolution.md` for how each bridge name resolves to concrete tools per IDE environment.
@@ -1,3 +1,5 @@
1
+ <!-- Config: communicate in {communication_language}. -->
2
+
1
3
  # Integration Pattern Detection Rules
2
4
 
3
5
  ## Co-Import Detection
@@ -1,3 +1,5 @@
1
+ <!-- Config: communicate in {communication_language}. -->
2
+
1
3
  # Manifest Detection Patterns
2
4
 
3
5
  ## Supported Ecosystems
@@ -1,7 +1,10 @@
1
1
  ---
2
- nextStepFile: './step-05-detect-integrations.md'
2
+ nextStepFile: 'detect-integrations.md'
3
+ enumerateStackSkillsScript: '{project-root}/src/shared/scripts/skf-enumerate-stack-skills.py'
3
4
  ---
4
5
 
6
+ <!-- Config: communicate in {communication_language}. -->
7
+
5
8
  # Step 4: Parallel Library Extraction
6
9
 
7
10
  ## STEP GOAL:
@@ -16,32 +19,52 @@ For each confirmed dependency, extract key exports, usage patterns, and API surf
16
19
 
17
20
  ## MANDATORY SEQUENCE
18
21
 
19
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
20
-
21
22
  ### 0. Check Compose Mode
22
23
 
23
24
  **If `compose_mode` is true:**
24
25
 
25
26
  "**Extraction data already available from individual skills. Skipping extraction phase.**"
26
27
 
27
- For each confirmed skill, load SKILL.md from the version-aware path resolved in step-02.
28
+ For each confirmed skill, load SKILL.md from the version-aware path resolved in step 2.
29
+
30
+ **Re-resolve at step 4 entry (S17):** Between step 2 manifest detection and step 4 extraction, a concurrent write could have advanced a skill's `active_version`. On entering this step, re-resolve `skill_package_path` for each confirmed skill via the export-manifest (or symlink fallback) and capture the freshly-read `version` and `metadata_hash` into workflow state. If the `metadata_hash` diverges from the value stored in step 2, log a warning `"constituent '{skill_name}' changed between step 2 and step 4 — using fresh values"` and replace the workflow-state entry (so step 7 provenance records the hash active at extraction time, with the drift logged for audit).
28
31
 
29
- **Re-resolve at step-04 entry (S17):** Between step-02 manifest detection and step-04 extraction, a concurrent write could have advanced a skill's `active_version`. On entering this step, re-resolve `skill_package_path` for each confirmed skill via the export-manifest (or symlink fallback) and capture the freshly-read `version` and `metadata_hash` into workflow state. If the `metadata_hash` diverges from the value stored in step-02, log a warning `"constituent '{skill_name}' changed between step-02 and step-04 — using fresh values"` and replace the workflow-state entry (so step-07 provenance records the hash active at extraction time, with the drift logged for audit).
32
+ Use `skill_package_path` (stored in step 2 and optionally refreshed above) directly this already points to the resolved `{skill_package}` or `{active_skill}` directory containing the skill's artifacts. If `skill_package_path` is not available, resolve via the `{active_skill}` template: `{skills_output_folder}/{skill_dir}/active/{skill_dir}/SKILL.md` (see `knowledge/version-paths.md`).
30
33
 
31
- Use `skill_package_path` (stored in step-02 and optionally refreshed above) directly this already points to the resolved `{skill_package}` or `{active_skill}` directory containing the skill's artifacts. If `skill_package_path` is not available, resolve via the `{active_skill}` template: `{skills_output_folder}/{skill_dir}/active/{skill_dir}/SKILL.md` (see `knowledge/version-paths.md`).
34
+ **Exports resolution order (H1) script-driven:** Do NOT walk per-skill `metadata.json` `references/` SKILL.md by hand. Invoke the helper once at step entry to compute the full inventory for every confirmed skill in one deterministic call:
35
+
36
+ ```bash
37
+ uv run {enumerateStackSkillsScript} enumerate {skills_output_folder}
38
+ ```
32
39
 
33
- **Exports resolution order (H1):** For each confirmed skill, populate the `exports` field using the first source that returns a non-empty list:
40
+ The script emits JSON of the form:
41
+
42
+ ```json
43
+ {
44
+ "skills": [
45
+ {
46
+ "name": "<skill-name>",
47
+ "path": "<rel-to-skills-root, forward-slash>",
48
+ "exports": ["..."],
49
+ "exports_source": "metadata|references|skill-md|unknown",
50
+ "confidence": "T1|T2|T1-low",
51
+ "metadata_hash": "sha256:..." | null
52
+ }
53
+ ],
54
+ "cycles": ["<skill-name>"],
55
+ "warnings": ["<text>"]
56
+ }
57
+ ```
34
58
 
35
- 1. **Primary `metadata.json.exports[]`:** Read the skill's `metadata.json` and use the `exports[]` array directly. This is the most structured and trustworthy source.
36
- 2. **Fallback — `references/`:** If `metadata.json.exports[]` is empty or missing, scan the `references/` subdirectory of the skill package for per-export files and reconstruct the export list from filenames/headers. Log a warning: `"{skill_name}: metadata.json.exports[] empty — reconstructed from references/"` and record the warning in workflow state for the evidence report.
37
- 3. **Last resort — SKILL.md prose parsing:** If both prior sources are unavailable, parse the SKILL.md "Exports" / "API" section prose. Log a stronger warning: `"{skill_name}: falling back to SKILL.md prose parsing — exports may be incomplete"` and record it in workflow state.
59
+ Cache this result as `stack_skill_inventory` in workflow state — the per-skill subagent fan-out at §1+ MUST read from this cache rather than re-reading each skill's `SKILL.md` / `metadata.json` / `references/` to determine exports. Append every entry in `warnings[]` to workflow state for the evidence report (the script already labels them per-skill, e.g. `"<skill-name>: no exports found via any resolution path"`). For every entry in `cycles[]`, halt with a structured-error contract on stderr — a composes-cycle makes the stack unbuildable.
38
60
 
39
- Build a `per_library_extractions[]` entry for each skill with the following fields:
40
- - `library`: skill name from metadata.json
41
- - `exports`: exports list resolved via the order above
42
- - `exports_source`: one of `metadata|references|prose` — capture which resolution path was used (so step-07 provenance can record it)
43
- - `usage_patterns`: usage patterns from the SKILL.md usage section
44
- - `confidence`: the skill's existing confidence tier (one of `T1|T1-low|T2|T3` per `confidence-tiers.md`)inherited directly. Do not silently drop T3 evidence; carry whatever tier the source skill declared.
61
+ Build a `per_library_extractions[]` entry for each skill by reading from the cached inventory:
62
+ - `library`: `inventory.skills[i].name`
63
+ - `exports`: `inventory.skills[i].exports`
64
+ - `exports_source`: `inventory.skills[i].exports_source` (one of `metadata|references|skill-md|unknown` — capture for step 7 provenance)
65
+ - `confidence`: `inventory.skills[i].confidence` (one of `T1|T2|T1-low`; `unknown` source ⇒ `T1-low`). Do not silently drop T3 evidence; carry whatever tier the source skill declared if §1+ subagent analysis upgrades the value.
66
+ - `metadata_hash`: `inventory.skills[i].metadata_hash` — record for step 7 provenance (null when exports came from references/ or SKILL.md prose).
67
+ - `usage_patterns`: populated by the §1+ per-skill subagent fan-out, NOT by this script. The script provides the inventory + exports; the subagent does the per-skill usage analysis. They're complementary.
45
68
 
46
69
  Display an extraction summary:
47
70
 
@@ -150,7 +173,7 @@ For each library extraction:
150
173
  **If ALL extractions fail:** HALT — cannot produce meaningful stack skill. Before halting (B7):
151
174
 
152
175
  1. Purge any in-flight staging artifacts under the forge workspace: remove `{forge_data_folder}/{project_name}-stack/{version}/*-tmp` and any `{forge_data_folder}/{project_name}-stack/{version}/*.skf-tmp` directories so partial state does not linger.
153
- 2. Emit a structured error contract on stderr: `{"status":"error","skill":"skf-create-stack-skill","stage":"step-04","reason":"all extractions failed","libraries":[...]}`.
176
+ 2. Emit a structured error contract on stderr: `{"status":"error","skill":"skf-create-stack-skill","stage":"step 4","reason":"all extractions failed","libraries":[...]}`.
154
177
  3. Exit with a non-zero status so headless pipelines detect the failure.
155
178
 
156
179
  ### 4. Display Extraction Summary
@@ -1,7 +1,9 @@
1
1
  ---
2
- nextStepFile: './step-04-parallel-extract.md'
2
+ nextStepFile: 'parallel-extract.md'
3
3
  ---
4
4
 
5
+ <!-- Config: communicate in {communication_language}. -->
6
+
5
7
  # Step 3: Rank and Confirm Scope
6
8
 
7
9
  ## STEP GOAL:
@@ -15,8 +17,6 @@ Count import frequency for each dependency across the codebase, rank by usage, a
15
17
 
16
18
  ## MANDATORY SEQUENCE
17
19
 
18
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
19
-
20
20
  ### 1. Count Import Frequency
21
21
 
22
22
  **If `compose_mode` is true:**
@@ -122,7 +122,7 @@ Display final confirmation:
122
122
 
123
123
  ### 5. Present MENU OPTIONS
124
124
 
125
- Display: **Select:** [C] Continue to Extraction
125
+ Display: **Select:** [C] Continue to Extraction | [X] Cancel and exit
126
126
 
127
127
  #### EXECUTION RULES:
128
128
 
@@ -133,5 +133,6 @@ Display: **Select:** [C] Continue to Extraction
133
133
  #### Menu Handling Logic:
134
134
 
135
135
  - IF C: Store current `confirmed_dependencies` (including any modifications made since initial presentation), then load, read entire file, then execute {nextStepFile}
136
+ - IF X: Invoke the rollback contract (purge any `{forge_data_folder}/{project_name}-stack/{version}/*-tmp` and `*.skf-tmp` staging artifacts under the forge workspace, leave any existing committed stack package untouched), emit the `SKF_STACK_RESULT_JSON` envelope on stderr with `status: "error"`, `halt_reason: "user-cancelled"`, `exit_code: 6`, and exit with code 6
136
137
  - IF Any other: Process as scope modification (add/remove skills from `confirmed_dependencies`), update the in-memory `confirmed_dependencies` list accordingly, redisplay the updated skills table, then [Redisplay Menu Options](#5-present-menu-options)
137
138
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- nextStepFile: './step-10-health-check.md'
2
+ nextStepFile: 'health-check.md'
3
3
  # Resolve `{atomicWriteHelper}` by probing `{atomicWriteProbeOrder}` in order
4
4
  # (installed SKF module path first, src/ dev-checkout fallback); first existing
5
5
  # path wins. HALT if neither resolves.
@@ -8,6 +8,8 @@ atomicWriteProbeOrder:
8
8
  - '{project-root}/src/shared/scripts/skf-atomic-write.py'
9
9
  ---
10
10
 
11
+ <!-- Config: communicate in {communication_language}. Artifact text in {document_output_language}. -->
12
+
11
13
  # Step 9: Stack Skill Report
12
14
 
13
15
  ## STEP GOAL:
@@ -23,8 +25,6 @@ Display the final summary of the forged stack skill with confidence distribution
23
25
 
24
26
  ## MANDATORY SEQUENCE
25
27
 
26
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
27
-
28
28
  ### 1. Display Stack Forged Banner
29
29
 
30
30
  "**Stack forged: {project_name}-stack — {lib_count} libraries, {integration_count} integration patterns**
@@ -1,8 +1,10 @@
1
1
  ---
2
- nextStepFile: './step-09-report.md'
2
+ nextStepFile: 'report.md'
3
3
  stackSkillTemplate: 'assets/stack-skill-template.md'
4
4
  ---
5
5
 
6
+ <!-- Config: communicate in {communication_language}. Artifact text in {document_output_language}. -->
7
+
6
8
  # Step 8: Validate Output
7
9
 
8
10
  ## STEP GOAL:
@@ -16,8 +18,6 @@ Validate all written output files against their expected structure and verify co
16
18
 
17
19
  ## MANDATORY SEQUENCE
18
20
 
19
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
20
-
21
21
  ### 1. Verify File Existence
22
22
 
23
23
  Check that all expected files exist from written_files[]:
@@ -47,7 +47,7 @@ timeout 10s npx --no-install skill-check -h
47
47
  ```
48
48
 
49
49
  - If exits 0: Use skill-check for automated validation in sections 3, 9.
50
- - If exits non-zero, times out, or returns "command not found": Use manual fallback paths. Mark `metadata.validation_status: "manual-only"` (do this in step-07 when appropriate) and record every skipped check in the evidence report.
50
+ - If exits non-zero, times out, or returns "command not found": Use manual fallback paths. Mark `metadata.validation_status: "manual-only"` (do this in step 7 when appropriate) and record every skipped check in the evidence report.
51
51
 
52
52
  **Important:** Do not assume availability — empirical check required.
53
53
 
@@ -57,7 +57,7 @@ timeout 10s npx --no-install skill-check -h
57
57
 
58
58
  This validates frontmatter, description, body limits, links, formatting — and auto-fixes deterministic issues. Parse JSON for `qualityScore`, `diagnostics[]`, `fixed[]`.
59
59
 
60
- **Post-fix provenance drift guard (S15):** If `fixed[]` is non-empty, `skill-check --fix` has modified `SKILL.md` after step-07 wrote it. The safe default for v1.0 is to emit a **WARNING** finding listing each auto-fix (`"skill-check --fix modified SKILL.md: {fix_description} — metadata.json hashes/provenance may be out of date"`). Do NOT silently accept the fixes without surfacing the drift. If the caller wants authoritative metadata, they should re-run the workflow.
60
+ **Post-fix provenance drift guard (S15):** If `fixed[]` is non-empty, `skill-check --fix` has modified `SKILL.md` after step 7 wrote it. The safe default for v1.0 is to emit a **WARNING** finding listing each auto-fix (`"skill-check --fix modified SKILL.md: {fix_description} — metadata.json hashes/provenance may be out of date"`). Do NOT silently accept the fixes without surfacing the drift. If the caller wants authoritative metadata, they should re-run the workflow.
61
61
 
62
62
  **If `body.max_lines` reported**, prefer selective split: extract only the largest Tier 2 section(s) to `references/`, keeping Tier 1 content inline (inline passive context achieves 100% task accuracy vs 79% for on-demand retrieval). Fall back to `npx skill-check split-body <skill-dir> --write` if not feasible. Verify `#quick-start` and `#key-types` anchors still resolve after split. Then re-validate.
63
63
 
@@ -120,7 +120,7 @@ Verify context-snippet.md follows Vercel-aligned indexed format:
120
120
  - [ ] First line matches: `[{project}-stack v{version}]|root: {prefix}{project}-stack/` where prefix is `skills/` (draft form) or any IDE skill root (`.{dir}/skills/`)
121
121
  - [ ] Second line starts with `|IMPORTANT:`
122
122
  - [ ] Stack and integrations lines present
123
- - [ ] Approximate token count is ~80-120 tokens (use the `ceil(char_count / 4)` heuristic from step-07 §5; tolerate up to ~150 if the overflow strategy was applied and a workflow_warning was emitted)
123
+ - [ ] Approximate token count is ~80-120 tokens (use the `ceil(char_count / 4)` heuristic from step 7 §5; tolerate up to ~150 if the overflow strategy was applied and a workflow_warning was emitted)
124
124
 
125
125
  Record format violations as **WARNING** findings.
126
126
 
@@ -9,6 +9,16 @@ description: Drop a specific skill version or an entire skill — soft (deprecat
9
9
 
10
10
  Drops a specific skill version or an entire skill, either as a soft deprecation (manifest-only, files retained) or a hard purge (files deleted). Ensures platform context files are rebuilt to exclude dropped versions. Every destructive action requires explicit user confirmation — nothing is deleted silently. The export manifest is the source of truth; the filesystem is updated to match.
11
11
 
12
+ ## Conventions
13
+
14
+ - Bare paths (e.g. `references/<name>.md`) resolve from the skill root.
15
+ - `references/` holds prompt content carved out of SKILL.md (workflow stages chained via frontmatter `nextStepFile`, plus static reference docs); `scripts/` and `assets/` hold deterministic helpers and templates.
16
+ - `{skill-root}` resolves to this skill's installed directory (where `customize.toml` lives, if present).
17
+ - `{project-root}`-prefixed paths resolve from the project working directory.
18
+ - `{skill-name}` resolves to the skill directory's basename.
19
+ - **Module-level path exception:** paths starting with `knowledge/` or `shared/` resolve from the SKF module root, not the skill root — install layout puts both at `{project-root}/_bmad/skf/`. The `versionPathsKnowledge: 'knowledge/version-paths.md'` frontmatter scalar in stage files uses this convention; same for `shared/health-check.md` chained from the terminal step.
20
+ - **Cross-skill data coupling:** `references/execute.md` reads `skf-export-skill/assets/managed-section-format.md` for the IDE→context-file mapping table and the four-case (Create / Append / Regenerate / Malformed) logic when rebuilding context files. Drop-skill assumes that asset is present at install time and that its semantics are stable across the two skills' versions.
21
+
12
22
  ## Role
13
23
 
14
24
  You are Ferris in Management mode — a destructive operation specialist who enforces safety guards. You treat every drop as potentially irreversible and require explicit confirmation before touching the manifest or filesystem. You protect the active version, keep the export manifest consistent with on-disk state, and ensure downstream platform context files are rebuilt.
@@ -19,39 +29,101 @@ These rules apply to every step in this workflow:
19
29
 
20
30
  - Never delete files without explicit user confirmation in purge mode
21
31
  - Never drop an active version when other non-deprecated versions exist — enforce the active version guard
22
- - Read each step file completely before taking any action
23
- - Follow the mandatory sequence in each step exactly — do not skip, reorder, or optimize
24
32
  - Only load one step file at a time — never preload future steps
25
33
  - If any instruction references a subprocess or tool you lack, achieve the outcome in your main context thread
26
34
  - Always communicate in `{communication_language}`
35
+ - At any interactive prompt, the inputs `cancel`, `exit`, `[X]`, `q`, or `:q` exit cleanly with exit code 6 (`halt_reason: "user-cancelled"`)
27
36
  - If `{headless_mode}` is true, auto-proceed through confirmation gates with their default action and log each auto-decision
28
37
 
29
38
  ## Stages
30
39
 
31
40
  | # | Step | File | Auto-proceed |
32
41
  |---|------|------|--------------|
33
- | 1 | Select Target | steps-c/step-01-select.md | No (confirm) |
34
- | 2 | Execute Drop | steps-c/step-02-execute.md | Yes |
35
- | 3 | Report | steps-c/step-03-report.md | Yes |
36
- | 4 | Workflow Health Check | steps-c/step-04-health-check.md | Yes |
42
+ | 1 | Select Target | references/select.md | No (confirm) |
43
+ | 2 | Execute Drop | references/execute.md | Yes |
44
+ | 3 | Report | references/report.md | Yes |
45
+ | 4 | Workflow Health Check | references/health-check.md | Yes |
37
46
 
38
47
  ## Invocation Contract
39
48
 
40
49
  | Aspect | Detail |
41
50
  |--------|--------|
42
51
  | **Inputs** | skill_name [required], mode (deprecate/purge) [required], version (all/specific) [required] |
43
- | **Gates** | step-01: Input Gate [use args], Confirm Gate [Y] |
44
- | **Outputs** | Updated manifest, rebuilt context files, (purge: deleted directories) |
45
- | **Headless** | All gates auto-resolve with default action when `{headless_mode}` is true |
52
+ | **Flags** | `--headless` / `-H` (auto-resolve all gates); `--dry-run` (run selection + display the §10 confirmation block, then exit with `status="dry-run"` — no manifest mutation, no file deletion). Useful for "show me what this would touch before I commit." |
53
+ | **Gates** | step 1: Input Gate [use args], Confirm Gate [Y] |
54
+ | **Outputs** | Updated manifest, rebuilt context files, (purge: deleted directories), `drop-skill-result-{timestamp}.json` and `drop-skill-result-latest.json` |
55
+ | **Headless** | All gates auto-resolve with default action when `{headless_mode}` is true. When `forbid_purge_in_headless` is `"true"` in `customize.toml` AND `drop_mode = "purge"`, On-Activation §4 HALTs with exit code 6 (`halt_reason: "headless-purge-forbidden"`) before any work begins. |
56
+ | **Exit codes** | See "Exit Codes" below |
57
+
58
+ ## Exit Codes
59
+
60
+ Every HARD HALT in this workflow exits with a stable code so headless automators can branch on the failure class without grepping message text:
61
+
62
+ | Code | Meaning | Raised by |
63
+ | ---- | -------------------- | -------------------------------------------------------------------------------------------- |
64
+ | 0 | success | step 4 (terminal) |
65
+ | 2 | input-missing / input-invalid | step 1 §4 (headless missing `skill_name` arg) → `input-missing`; non-existent skill / unparseable version → `input-invalid` |
66
+ | 3 | resolution-failure | step 1 §2 (manifest is malformed JSON); step 1 §3 (no skills found anywhere) |
67
+ | 4 | write-failure | On-Activation §3 pre-flight write probe (skills_output_folder unwritable); step 2 §2 (manifest write); step 2 §3 (context-file rewrite); step 2 §4 (directory delete) |
68
+ | 5 | state-conflict | step 1 §7 (active-version-guard refuses to drop the active version while non-deprecated peers remain) |
69
+ | 6 | user-cancelled | step 1 §10 confirmation gate `[N]`; any prompt that accepted `cancel`/`exit`/`:q`; On-Activation §4 (`headless-purge-forbidden`) |
70
+
71
+ ## Result Contract (Headless)
72
+
73
+ 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"`:
74
+
75
+ ```
76
+ SKF_DROP_SKILL_RESULT_JSON: {"status":"success|error|dry-run","skill":"…|null","drop_mode":"…|null","versions_affected":[],"files_deleted":[],"manifest_updated":false,"exit_code":0,"halt_reason":null}
77
+ ```
78
+
79
+ `status` is `"success"` on the terminal happy path, `"dry-run"` when `--dry-run` was set and the workflow exited before §11 stores decisions, `"error"` on any HALT. `halt_reason` is one of: `null` (success), `"input-missing"`, `"input-invalid"`, `"manifest-corrupt"`, `"nothing-to-drop"`, `"active-version-guard-refused"`, `"headless-purge-forbidden"`, `"manifest-write-failed"`, `"context-rebuild-failed"`, `"delete-failed"`, `"write-failed"`, `"user-cancelled"`. `exit_code` matches the table above.
46
80
 
47
81
  ## On Activation
48
82
 
49
83
  1. Load config from `{project-root}/_bmad/skf/config.yaml` and resolve:
50
84
  - `project_name`, `output_folder`, `user_name`, `communication_language`, `document_output_language`
51
85
  - `skills_output_folder`, `forge_data_folder`, `sidecar_path`
52
- - `snippet_skill_root_override` (optional string) — when set, the context-file rebuild in step-02 preserves any snippet `root:` prefix that matches the override instead of rewriting it to the target IDE's skill root. See `skf-export-skill/assets/managed-section-format.md` for full semantics.
86
+ - `snippet_skill_root_override` (optional string) — when set, the context-file rebuild in step 2 preserves any snippet `root:` prefix that matches the override instead of rewriting it to the target IDE's skill root. See `skf-export-skill/assets/managed-section-format.md` for full semantics.
53
87
  - Generate and store `timestamp` as `YYYYMMDD-HHmmss` format. This value is fixed for the entire workflow run.
54
88
 
55
- 2. **Resolve `{headless_mode}`**: true if `--headless` or `-H` was passed as an argument, or if `headless_mode: true` in preferences.yaml. Default: false.
89
+ 2. **Resolve `{headless_mode}`**: true if `--headless` or `-H` was passed as an argument, or if `headless_mode: true` in `{sidecar_path}/preferences.yaml`. Default: false.
90
+
91
+ 3. **Resolve workflow customization.** Run:
92
+
93
+ ```bash
94
+ python3 {project-root}/_bmad/scripts/resolve_customization.py \
95
+ --skill {skill-root} --key workflow
96
+ ```
97
+
98
+ The script merges the three customization layers per `bmad-customize`'s structural merge rules (scalars override, arrays append):
99
+
100
+ - `{skill-root}/customize.toml` — bundled defaults
101
+ - `_bmad/custom/<skill-name>.toml` under `{project-root}` — team overrides (committed)
102
+ - `_bmad/custom/<skill-name>.user.toml` under `{project-root}` — personal overrides (gitignored)
103
+
104
+ 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.
105
+
106
+ 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:
107
+
108
+ - `{defaultMode}` ← `workflow.default_mode` (empty = always prompt; `"deprecate"` or `"purge"` = skip §8 Ask Mode)
109
+ - `{forbidPurgeInHeadless}` ← `workflow.forbid_purge_in_headless` (empty or non-`"true"` = no guard)
110
+ - `{unknownIdeDefaultContextFile}` ← `workflow.unknown_ide_default_context_file` if non-empty, else `AGENTS.md`
111
+ - `{unknownIdeDefaultSkillRoot}` ← `workflow.unknown_ide_default_skill_root` if non-empty, else `.agents/skills/`
112
+
113
+ Stash all four as workflow-context variables. Stage files reference them directly — no conditional at the usage site.
114
+
115
+ 4. **Pre-flight write probe + headless-purge guard.**
116
+
117
+ First, verify `{skills_output_folder}` is writable. A read-only mount, full disk, or permissions-denied path otherwise only surfaces at step 2's manifest write — by then the user has already gone through every selection prompt:
118
+
119
+ ```bash
120
+ mkdir -p "{skills_output_folder}" && \
121
+ printf 'probe' > "{skills_output_folder}/.skf-write-probe" && \
122
+ rm "{skills_output_folder}/.skf-write-probe"
123
+ ```
124
+
125
+ On any non-zero exit: HALT (exit code 4, `halt_reason: "write-failed"`). In headless mode, emit the error envelope per **Result Contract (Headless)** with `skill: null` and `drop_mode: null` (neither is resolved yet at activation time).
126
+
127
+ Second, enforce the headless-purge guard. If `{headless_mode}` is true AND `{forbidPurgeInHeadless}` is `"true"` AND the parsed `mode` arg is `"purge"`: HALT with exit code 6 and `halt_reason: "headless-purge-forbidden"`, emit the error envelope, and exit immediately. The operator must re-run with `mode=deprecate` or set `forbid_purge_in_headless = ""` (or omit the override entirely) to proceed.
56
128
 
57
- 3. Load, read the full file, and then execute `./steps-c/step-01-select.md` to begin the workflow.
129
+ 5. Load, read the full file, and then execute `references/select.md` to begin the workflow.