bmad-module-skill-forge 0.9.0 → 0.10.1-alpha.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 (268) hide show
  1. package/.claude-plugin/marketplace.json +39 -0
  2. package/.gitattributes +16 -0
  3. package/README.md +105 -38
  4. package/docs/404.md +13 -10
  5. package/docs/RELEASING.md +185 -0
  6. package/docs/STABILITY.md +123 -0
  7. package/docs/_data/pinned.yaml +98 -0
  8. package/docs/agents.md +16 -11
  9. package/docs/architecture.md +221 -0
  10. package/docs/bmad-synergy.md +11 -13
  11. package/docs/concepts.md +18 -108
  12. package/docs/examples.md +121 -80
  13. package/docs/getting-started.md +85 -147
  14. package/docs/how-it-works.md +25 -536
  15. package/docs/index.md +44 -27
  16. package/docs/skill-model.md +328 -0
  17. package/docs/troubleshooting.md +39 -0
  18. package/docs/verifying-a-skill.md +232 -0
  19. package/docs/why-skf.md +93 -0
  20. package/docs/workflows.md +119 -13
  21. package/package.json +25 -4
  22. package/src/README.md +23 -25
  23. package/src/forger/forge-tier.yaml +4 -2
  24. package/src/forger/preferences.yaml +7 -1
  25. package/src/knowledge/agentskills-spec.md +1 -1
  26. package/src/knowledge/architecture-verification.md +1 -1
  27. package/src/knowledge/ccc-bridge.md +16 -15
  28. package/src/knowledge/overview.md +11 -11
  29. package/src/knowledge/progressive-capability.md +3 -3
  30. package/src/knowledge/provenance-tracking.md +9 -3
  31. package/src/knowledge/qmd-registry.md +8 -8
  32. package/src/knowledge/skf-knowledge-index.csv +2 -2
  33. package/src/knowledge/skill-lifecycle.md +16 -1
  34. package/src/knowledge/split-body-strategy.md +1 -1
  35. package/src/knowledge/version-paths.md +17 -12
  36. package/src/module-help.csv +18 -17
  37. package/src/module.yaml +4 -0
  38. package/src/shared/health-check.md +372 -0
  39. package/src/shared/references/feasibility-report-schema.md +86 -0
  40. package/src/shared/references/headless-gate-convention.md +62 -0
  41. package/src/shared/references/output-contract-schema.md +35 -0
  42. package/src/shared/references/pipeline-contracts.md +102 -0
  43. package/src/shared/scripts/skf-atomic-write.py +370 -0
  44. package/src/shared/scripts/skf-manifest-ops.py +236 -0
  45. package/src/shared/scripts/skf-preflight.py +164 -0
  46. package/src/shared/scripts/skf-rebuild-managed-sections.py +201 -0
  47. package/src/shared/scripts/skf-severity-classify.py +163 -0
  48. package/src/shared/scripts/skf-skill-inventory.py +210 -0
  49. package/src/shared/scripts/skf-structural-diff.py +257 -0
  50. package/src/shared/scripts/skf-validate-frontmatter.py +318 -0
  51. package/src/shared/scripts/skf-validate-output.py +247 -0
  52. package/src/skf-analyze-source/SKILL.md +57 -0
  53. package/src/skf-analyze-source/assets/skill-brief-schema.md +125 -0
  54. package/src/skf-analyze-source/references/unit-detection-heuristics.md +124 -0
  55. package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-01-init.md +6 -66
  56. package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-01b-continue.md +4 -59
  57. package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-02-scan-project.md +7 -68
  58. package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-03-identify-units.md +6 -66
  59. package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-04-map-and-detect.md +7 -68
  60. package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-05-recommend.md +6 -66
  61. package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-06-generate-briefs.md +14 -66
  62. package/src/skf-analyze-source/steps-c/step-07-health-check.md +22 -0
  63. package/src/skf-audit-skill/SKILL.md +59 -0
  64. package/src/{workflows/audit-skill/data → skf-audit-skill/assets}/drift-report-template.md +7 -7
  65. package/src/{workflows/audit-skill/data → skf-audit-skill/references}/severity-rules.md +11 -11
  66. package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-01-init.md +24 -68
  67. package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-02-re-index.md +36 -71
  68. package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-03-structural-diff.md +21 -63
  69. package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-04-semantic-diff.md +6 -65
  70. package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-05-severity-classify.md +5 -63
  71. package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-06-report.md +10 -59
  72. package/src/skf-audit-skill/steps-c/step-07-health-check.md +22 -0
  73. package/src/skf-brief-skill/SKILL.md +53 -0
  74. package/src/{workflows/brief-skill/data → skf-brief-skill/assets}/scope-templates.md +23 -0
  75. package/src/skf-brief-skill/assets/skill-brief-schema.md +206 -0
  76. package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-01-gather-intent.md +6 -67
  77. package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-02-analyze-target.md +6 -66
  78. package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-03-scope-definition.md +12 -68
  79. package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-04-confirm-brief.md +5 -63
  80. package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-05-write-brief.md +10 -69
  81. package/src/skf-brief-skill/steps-c/step-06-health-check.md +22 -0
  82. package/src/skf-create-skill/SKILL.md +63 -0
  83. package/src/{workflows/create-skill/data → skf-create-skill/assets}/compile-assembly-rules.md +60 -0
  84. package/src/{workflows/create-skill/data → skf-create-skill/assets}/skill-sections.md +92 -23
  85. package/src/skf-create-skill/assets/tessl-dismissal-rules.md +102 -0
  86. package/src/{workflows/create-skill/data → skf-create-skill/references}/extraction-patterns-tracing.md +13 -13
  87. package/src/{workflows/create-skill/data → skf-create-skill/references}/extraction-patterns.md +8 -3
  88. package/src/skf-create-skill/references/source-resolution-protocols.md +239 -0
  89. package/src/{workflows/create-skill/data → skf-create-skill/references}/tier-degradation-rules.md +8 -7
  90. package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-01-load-brief.md +25 -63
  91. package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-02-ecosystem-check.md +8 -64
  92. package/src/skf-create-skill/steps-c/step-03-extract.md +379 -0
  93. package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-03d-component-extraction.md +18 -35
  94. package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-04-enrich.md +12 -69
  95. package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-05-compile.md +71 -75
  96. package/src/skf-create-skill/steps-c/step-06-validate.md +267 -0
  97. package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-07-generate-artifacts.md +30 -74
  98. package/src/skf-create-skill/steps-c/step-08-report.md +145 -0
  99. package/src/skf-create-skill/steps-c/step-09-health-check.md +23 -0
  100. package/src/{workflows/create-skill/steps-c → skf-create-skill/steps-c/sub}/step-02b-ccc-discover.md +8 -66
  101. package/src/skf-create-skill/steps-c/sub/step-03b-fetch-temporal.md +229 -0
  102. package/src/{workflows/create-skill/steps-c → skf-create-skill/steps-c/sub}/step-03c-fetch-docs.md +18 -42
  103. package/src/skf-create-stack-skill/SKILL.md +64 -0
  104. package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/assets}/stack-skill-template.md +2 -1
  105. package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/references}/compose-mode-rules.md +19 -5
  106. package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/references}/integration-patterns.md +1 -1
  107. package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/references}/manifest-patterns.md +10 -10
  108. package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-01-init.md +14 -55
  109. package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-02-detect-manifests.md +29 -63
  110. package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-03-rank-and-confirm.md +9 -59
  111. package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-04-parallel-extract.md +29 -64
  112. package/src/skf-create-stack-skill/steps-c/step-05-detect-integrations.md +164 -0
  113. package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-06-compile-stack.md +7 -60
  114. package/src/skf-create-stack-skill/steps-c/step-07-generate-output.md +328 -0
  115. package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-08-validate.md +17 -63
  116. package/src/skf-create-stack-skill/steps-c/step-09-report.md +128 -0
  117. package/src/skf-create-stack-skill/steps-c/step-10-health-check.md +22 -0
  118. package/src/skf-drop-skill/SKILL.md +57 -0
  119. package/src/{workflows/drop-skill → skf-drop-skill}/steps-c/step-01-select.md +9 -69
  120. package/src/{workflows/drop-skill → skf-drop-skill}/steps-c/step-02-execute.md +30 -106
  121. package/src/skf-drop-skill/steps-c/step-03-report.md +83 -0
  122. package/src/skf-drop-skill/steps-c/step-04-health-check.md +22 -0
  123. package/src/skf-export-skill/SKILL.md +57 -0
  124. package/src/skf-export-skill/assets/managed-section-format.md +138 -0
  125. package/src/{workflows/export-skill/data → skf-export-skill/assets}/snippet-format.md +8 -12
  126. package/src/skf-export-skill/steps-c/step-01-load-skill.md +247 -0
  127. package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-02-package.md +5 -58
  128. package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-03-generate-snippet.md +15 -77
  129. package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-04-update-context.md +59 -133
  130. package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-05-token-report.md +4 -58
  131. package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-06-summary.md +20 -64
  132. package/src/skf-export-skill/steps-c/step-07-health-check.md +22 -0
  133. package/src/skf-forger/SKILL.md +110 -0
  134. package/src/skf-forger/bmad-skill-manifest.yaml +11 -0
  135. package/src/skf-quick-skill/SKILL.md +56 -0
  136. package/src/{workflows/quick-skill/data → skf-quick-skill/references}/registry-resolution.md +6 -6
  137. package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-01-resolve-target.md +9 -62
  138. package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-02-ecosystem-check.md +5 -59
  139. package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-03-quick-extract.md +18 -61
  140. package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-04-compile.md +6 -60
  141. package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-05-validate.md +58 -78
  142. package/src/skf-quick-skill/steps-c/step-06-write.md +73 -0
  143. package/src/skf-quick-skill/steps-c/step-07-health-check.md +22 -0
  144. package/src/skf-refine-architecture/SKILL.md +57 -0
  145. package/src/{workflows/refine-architecture/data → skf-refine-architecture/references}/refinement-rules.md +16 -16
  146. package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-01-init.md +6 -63
  147. package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-02-gap-analysis.md +29 -71
  148. package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-03-issue-detection.md +5 -65
  149. package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-04-improvements.md +5 -64
  150. package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-05-compile.md +5 -56
  151. package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-06-report.md +14 -64
  152. package/src/skf-refine-architecture/steps-c/step-07-health-check.md +22 -0
  153. package/src/skf-rename-skill/SKILL.md +58 -0
  154. package/src/{workflows/rename-skill → skf-rename-skill}/steps-c/step-01-select.md +12 -73
  155. package/src/{workflows/rename-skill → skf-rename-skill}/steps-c/step-02-execute.md +32 -113
  156. package/src/skf-rename-skill/steps-c/step-03-report.md +83 -0
  157. package/src/skf-rename-skill/steps-c/step-04-health-check.md +22 -0
  158. package/src/skf-setup/SKILL.md +55 -0
  159. package/src/{workflows/setup-forge → skf-setup}/steps-c/step-01-detect-and-tier.md +6 -62
  160. package/src/{workflows/setup-forge → skf-setup}/steps-c/step-01b-ccc-index.md +9 -65
  161. package/src/{workflows/setup-forge → skf-setup}/steps-c/step-02-write-config.md +15 -60
  162. package/src/{workflows/setup-forge → skf-setup}/steps-c/step-03-auto-index.md +7 -66
  163. package/src/skf-setup/steps-c/step-04-report.md +92 -0
  164. package/src/skf-setup/steps-c/step-05-health-check.md +22 -0
  165. package/src/skf-test-skill/SKILL.md +59 -0
  166. package/src/skf-test-skill/references/migration-section-rules.md +114 -0
  167. package/src/skf-test-skill/references/scoring-rules.md +207 -0
  168. package/src/skf-test-skill/references/source-access-protocol.md +109 -0
  169. package/src/skf-test-skill/scripts/compute-score.py +310 -0
  170. package/src/skf-test-skill/steps-c/step-01-init.md +238 -0
  171. package/src/{workflows/test-skill → skf-test-skill}/steps-c/step-02-detect-mode.md +4 -62
  172. package/src/skf-test-skill/steps-c/step-03-coverage-check.md +347 -0
  173. package/src/skf-test-skill/steps-c/step-04-coherence-check.md +239 -0
  174. package/src/{workflows/test-skill → skf-test-skill}/steps-c/step-04b-external-validators.md +42 -77
  175. package/src/skf-test-skill/steps-c/step-05-score.md +266 -0
  176. package/src/skf-test-skill/steps-c/step-06-report.md +290 -0
  177. package/src/skf-test-skill/steps-c/step-07-health-check.md +25 -0
  178. package/src/skf-test-skill/templates/test-report-template.md +58 -0
  179. package/src/skf-update-skill/SKILL.md +58 -0
  180. package/src/{workflows/update-skill/data → skf-update-skill/references}/manual-section-rules.md +6 -6
  181. package/src/{workflows/update-skill/data → skf-update-skill/references}/merge-conflict-rules.md +5 -5
  182. package/src/skf-update-skill/references/remote-source-resolution.md +94 -0
  183. package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-01-init.md +22 -69
  184. package/src/skf-update-skill/steps-c/step-02-detect-changes.md +255 -0
  185. package/src/skf-update-skill/steps-c/step-03-re-extract.md +336 -0
  186. package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-04-merge.md +60 -72
  187. package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-05-validate.md +5 -62
  188. package/src/skf-update-skill/steps-c/step-06-write.md +278 -0
  189. package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-07-report.md +11 -66
  190. package/src/skf-update-skill/steps-c/step-08-health-check.md +22 -0
  191. package/src/skf-verify-stack/SKILL.md +60 -0
  192. package/src/skf-verify-stack/assets/feasibility-report-template.md +76 -0
  193. package/src/{workflows/verify-stack/data → skf-verify-stack/references}/coverage-patterns.md +12 -4
  194. package/src/skf-verify-stack/references/integration-verification-rules.md +78 -0
  195. package/src/skf-verify-stack/steps-c/step-01-init.md +178 -0
  196. package/src/{workflows/verify-stack → skf-verify-stack}/steps-c/step-02-coverage.md +27 -72
  197. package/src/skf-verify-stack/steps-c/step-03-integrations.md +179 -0
  198. package/src/{workflows/verify-stack → skf-verify-stack}/steps-c/step-04-requirements.md +14 -67
  199. package/src/skf-verify-stack/steps-c/step-05-synthesize.md +147 -0
  200. package/src/skf-verify-stack/steps-c/step-06-report.md +156 -0
  201. package/src/skf-verify-stack/steps-c/step-07-health-check.md +25 -0
  202. package/tools/cli/commands/install.js +1 -1
  203. package/tools/cli/commands/status.js +21 -23
  204. package/tools/cli/commands/uninstall.js +11 -19
  205. package/tools/cli/commands/update.js +2 -2
  206. package/tools/cli/lib/ide-skills.js +216 -0
  207. package/tools/cli/lib/installer.js +29 -52
  208. package/tools/cli/lib/manifest.js +11 -5
  209. package/tools/cli/lib/platform-codes.yaml +223 -0
  210. package/tools/cli/lib/ui.js +76 -47
  211. package/tools/validate-docs-drift.js +193 -0
  212. package/src/agents/forger.agent.yaml +0 -114
  213. package/src/workflows/README.md +0 -174
  214. package/src/workflows/analyze-source/data/skill-brief-schema.md +0 -125
  215. package/src/workflows/analyze-source/data/unit-detection-heuristics.md +0 -124
  216. package/src/workflows/analyze-source/workflow.md +0 -61
  217. package/src/workflows/audit-skill/workflow.md +0 -64
  218. package/src/workflows/brief-skill/data/skill-brief-schema.md +0 -159
  219. package/src/workflows/brief-skill/workflow.md +0 -58
  220. package/src/workflows/create-skill/data/source-resolution-protocols.md +0 -200
  221. package/src/workflows/create-skill/steps-c/step-03-extract.md +0 -301
  222. package/src/workflows/create-skill/steps-c/step-03b-fetch-temporal.md +0 -253
  223. package/src/workflows/create-skill/steps-c/step-06-validate.md +0 -254
  224. package/src/workflows/create-skill/steps-c/step-08-report.md +0 -176
  225. package/src/workflows/create-skill/workflow.md +0 -53
  226. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +0 -196
  227. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +0 -270
  228. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +0 -145
  229. package/src/workflows/create-stack-skill/workflow.md +0 -59
  230. package/src/workflows/drop-skill/steps-c/step-03-report.md +0 -135
  231. package/src/workflows/drop-skill/workflow.md +0 -63
  232. package/src/workflows/export-skill/data/managed-section-format.md +0 -103
  233. package/src/workflows/export-skill/steps-c/step-01-load-skill.md +0 -237
  234. package/src/workflows/export-skill/workflow.md +0 -58
  235. package/src/workflows/quick-skill/steps-c/step-06-write.md +0 -179
  236. package/src/workflows/quick-skill/workflow.md +0 -58
  237. package/src/workflows/refine-architecture/workflow.md +0 -61
  238. package/src/workflows/rename-skill/steps-c/step-03-report.md +0 -132
  239. package/src/workflows/rename-skill/workflow.md +0 -64
  240. package/src/workflows/setup-forge/steps-c/step-04-report.md +0 -156
  241. package/src/workflows/setup-forge/workflow.md +0 -51
  242. package/src/workflows/test-skill/data/scoring-rules.md +0 -123
  243. package/src/workflows/test-skill/data/source-access-protocol.md +0 -51
  244. package/src/workflows/test-skill/steps-c/step-01-init.md +0 -217
  245. package/src/workflows/test-skill/steps-c/step-03-coverage-check.md +0 -280
  246. package/src/workflows/test-skill/steps-c/step-04-coherence-check.md +0 -271
  247. package/src/workflows/test-skill/steps-c/step-05-score.md +0 -222
  248. package/src/workflows/test-skill/steps-c/step-06-report.md +0 -207
  249. package/src/workflows/test-skill/templates/test-report-template.md +0 -28
  250. package/src/workflows/test-skill/workflow.md +0 -57
  251. package/src/workflows/update-skill/data/remote-source-resolution.md +0 -57
  252. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +0 -221
  253. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +0 -256
  254. package/src/workflows/update-skill/steps-c/step-06-write.md +0 -265
  255. package/src/workflows/update-skill/workflow.md +0 -56
  256. package/src/workflows/verify-stack/data/feasibility-report-template.md +0 -63
  257. package/src/workflows/verify-stack/data/integration-verification-rules.md +0 -73
  258. package/src/workflows/verify-stack/steps-c/step-01-init.md +0 -179
  259. package/src/workflows/verify-stack/steps-c/step-03-integrations.md +0 -195
  260. package/src/workflows/verify-stack/steps-c/step-05-synthesize.md +0 -191
  261. package/src/workflows/verify-stack/steps-c/step-06-report.md +0 -197
  262. package/src/workflows/verify-stack/workflow.md +0 -61
  263. package/tools/cli/lib/compiler.js +0 -306
  264. package/tools/cli/lib/ide-commands.js +0 -244
  265. /package/src/{workflows/analyze-source → skf-analyze-source}/templates/analysis-report-template.md +0 -0
  266. /package/src/{workflows/quick-skill/data → skf-quick-skill/assets}/skill-template.md +0 -0
  267. /package/src/{workflows/setup-forge/data → skf-setup/references}/tier-rules.md +0 -0
  268. /package/src/{workflows/test-skill/data → skf-test-skill/assets}/output-section-formats.md +0 -0
@@ -1,9 +1,6 @@
1
1
  ---
2
- name: 'step-02-detect-manifests'
3
- description: 'Scan project for dependency manifests and extract raw dependency list'
4
-
5
2
  nextStepFile: './step-03-rank-and-confirm.md'
6
- manifestPatterns: '../data/manifest-patterns.md'
3
+ manifestPatterns: 'references/manifest-patterns.md'
7
4
  ---
8
5
 
9
6
  # Step 2: Detect Manifests
@@ -12,39 +9,11 @@ manifestPatterns: '../data/manifest-patterns.md'
12
9
 
13
10
  Scan the project root for dependency manifest files, parse each to extract dependency names and versions, and produce a raw dependency list for ranking.
14
11
 
15
- ## MANDATORY EXECUTION RULES (READ FIRST):
16
-
17
- ### Universal Rules:
18
-
19
- - 📖 CRITICAL: Read the complete step file before taking any action
20
- - ⚙️ TOOL/SUBPROCESS FALLBACK: If any instruction references a subprocess, subagent, or tool you do not have access to, you MUST still achieve the outcome in your main context thread
21
- - ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
22
-
23
- ### Role Reinforcement:
24
-
25
- - ✅ You are a dependency analyst operating in Ferris Architect mode
26
- - ✅ Prescriptive precision — report exactly what was found, nothing assumed
27
- - ✅ Zero hallucination — only list dependencies actually present in manifest files
28
-
29
- ### Step-Specific Rules:
12
+ ## Rules
30
13
 
31
- - 🎯 Focus ONLY on finding and parsing manifest files
32
- - 🚫 FORBIDDEN to count imports or rank dependencies that is step 03
33
- - 🚫 FORBIDDEN to extract library documentation that is step 04
34
- - 💬 If explicit dependency list was provided in step 01, use it and skip detection
35
-
36
- ## EXECUTION PROTOCOLS:
37
-
38
- - 🎯 Load manifest-patterns.md for detection rules
39
- - 💾 Store manifests found and raw dependency list as workflow state
40
- - 📖 Auto-proceed to step 03 after successful detection
41
- - 🚫 HALT if no manifests found and no explicit list provided — **unless `compose_mode` is true** (compose mode skips manifest detection)
42
-
43
- ## CONTEXT BOUNDARIES:
44
-
45
- - From step 01: forge tier, available tools, optional explicit_deps, project_root
46
- - This step produces: manifests[], raw_dependencies[]
47
- - Does NOT rank, filter, or analyze — just detect and parse
14
+ - Focus only on finding and parsing manifest files
15
+ - Do not count imports or rank dependencies (Step 03) or extract documentation (Step 04)
16
+ - If explicit dependency list was provided in step 01, use it and skip detection
48
17
 
49
18
  ## MANDATORY SEQUENCE
50
19
 
@@ -58,23 +27,38 @@ Use the explicit dependency list directly. Store the explicit list as `raw_depen
58
27
 
59
28
  **If `compose_mode` is true AND `explicit_deps` was NOT provided:**
60
29
 
61
- Discover skills in `{skills_output_folder}` using version-aware resolution — see [knowledge/version-paths.md](../../../knowledge/version-paths.md) for path templates.
30
+ Discover skills in `{skills_output_folder}` using version-aware resolution — see `knowledge/version-paths.md` for path templates.
62
31
 
63
32
  **Version-aware skill enumeration:**
64
33
 
65
34
  1. **Primary: Export manifest** — Read `{skills_output_folder}/.export-manifest.json`. For each entry in `exports`, resolve the active version path: `{skills_output_folder}/{skill-name}/{active_version}/{skill-name}/` — this directory must contain both `SKILL.md` and `metadata.json`.
66
- 2. **Fallback: `active` symlinks** — If the manifest does not exist, is empty, or a manifest entry lacks an `active_version`, scan for `{skills_output_folder}/*/active/*/SKILL.md`. Each match resolves to a skill package at `{skills_output_folder}/{skill-name}/active/{skill-name}/` (the `{active_skill}` template).
67
35
 
68
- **Filter:** Skip any skill named `{project_name}-stack` or any skill where `metadata.json` has `"skill_type": "stack"` stack skills must not be loaded as source dependencies to avoid self-referencing loops.
36
+ **Stale manifest fallback (H6):** If a manifest entry resolves to a path that does not exist (broken `active_version`, deleted version dir, missing `SKILL.md` / `metadata.json`), do NOT HALT for that single entry. Instead:
37
+ a. Fall back to the symlink scan (rule 2) **for that one skill only**: probe `{skills_output_folder}/{skill-name}/active/{skill-name}/SKILL.md`.
38
+ b. If the symlink-based path resolves, use it and log a warning: `"export-manifest entry '{skill-name}' is stale — resolved via active symlink instead"`.
39
+ c. If BOTH the manifest path AND the symlink path fail, only then HALT with a manifest-corruption diagnostic naming the affected skill and pointing the user at `[SKF-update-skill]` to repair.
40
+
41
+ **Manifest JSON parse guard (B3):** Wrap the `.export-manifest.json` parse in try/except. If JSON parsing fails for any reason, fall through entirely to the `active` symlink scan (rule 2) across all skills; log a warning and validate each symlink target exists before including it.
42
+
43
+ 2. **Fallback: `active` symlinks** — If the manifest does not exist, is empty, JSON-parse fails, or an individual manifest entry fails to resolve, scan for `{skills_output_folder}/*/active/*/SKILL.md`. Each match resolves to a skill package at `{skills_output_folder}/{skill-name}/active/{skill-name}/` (the `{active_skill}` template). Verify the active symlink target actually exists and contains both `SKILL.md` and `metadata.json`.
44
+
45
+ **Filter & cycle guard (B4):** Skip any skill where the filter below matches:
46
+
47
+ - Skill name equals `{project_name}-stack`, OR
48
+ - `metadata.json` has `"skill_type": "stack"`, OR
49
+ - `metadata.json` is missing or unreadable (treat `skill_type: unknown` as non-loadable — exclude to avoid loading a partially-written or self-referential skill).
50
+
51
+ Maintain a **visited set keyed by `skill_dir`** (the top-level dir under `{skills_output_folder}`) while resolving. If a skill would be revisited via a circular reference (e.g., a constituent that claims another stack as dependency), skip the duplicate and log a warning `"cycle detected at {skill_dir} — skipping"`. Stack skills must not be loaded as source dependencies to avoid self-referencing loops.
69
52
 
70
53
  **If zero skills remain after filtering:** HALT with: "**Cannot proceed in compose-mode.** No individual skills found in `{skills_output_folder}` (after filtering stack skills). Run [CS] Create Skill or [QS] Quick Skill to generate individual skills first, then re-run [SS]."
71
54
 
72
55
  For each skill found:
73
- 1. Read `metadata.json` from the resolved version-aware path (`{skill_package}` or `{active_skill}`)
56
+ 1. Read `metadata.json` from the resolved version-aware path (`{skill_package}` or `{active_skill}`). **Skill-type gate (S1):** the sibling `metadata.json` MUST be present AND parseable AND contain a `skill_type` field whose value is one of the known set (`skill`, `stack`, or any future values explicitly recognised by this workflow). Directories lacking a qualifying `metadata.json`/`skill_type` are NOT treated as skills — log `"{dir_name}: not a skill (no valid metadata.json/skill_type) — excluding"` and skip.
74
57
  2. Extract: name, language, confidence_tier, source_repo, exports count, version
75
58
  3. Store the skill group directory name as `skill_dir` (the top-level name under `{skills_output_folder}`, distinct from `name` — the directory may differ from the metadata name)
76
59
  4. Store the resolved package path as `skill_package_path` for use in later steps
77
- 5. Store as `raw_dependencies` with source: "existing_skill"
60
+ 5. **Hash the constituent metadata at read-time (S13):** compute `sha256` of the raw `metadata.json` bytes just read, and store it in workflow state as `metadata_hash` alongside `skill_package_path`. Step-07 uses this stored hash (not a re-read) for `constituents[].metadata_hash` in `provenance-map.json`, so drift between step-02 read and step-07 write is captured.
61
+ 6. Store as `raw_dependencies` with source: "existing_skill"
78
62
 
79
63
  Display:
80
64
  "**Loaded {N} existing skills as dependencies.**
@@ -114,6 +98,10 @@ Scan the project root (depth 0-1) for manifest files, **excluding directories li
114
98
 
115
99
  **If no manifest files found:**
116
100
 
101
+ **Headless auto-cancel (S2):** If `{headless_mode}` is true, do NOT wait for user input. Emit a structured error contract `{"status":"error","skill":"skf-create-stack-skill","stage":"step-02","reason":"no manifests found, headless cannot prompt"}` on stderr and exit non-zero. Headless mode cannot proceed without an explicit dependency list.
102
+
103
+ **Interactive mode:**
104
+
117
105
  "**No dependency manifests detected** in the project root.
118
106
 
119
107
  Searched for: package.json, requirements.txt, Cargo.toml, go.mod, pom.xml, build.gradle, Gemfile, composer.json, *.csproj
@@ -161,25 +149,3 @@ Deduplicate dependencies found across multiple manifests.
161
149
 
162
150
  Load, read the full file and then execute `{nextStepFile}`.
163
151
 
164
- ---
165
-
166
- ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
167
-
168
- ### ✅ SUCCESS:
169
-
170
- - All manifest files in project root detected
171
- - Each manifest parsed with dependency names extracted
172
- - Runtime vs dev-only categorization applied
173
- - Deduplication across multiple manifests completed
174
- - Detection summary displayed with accurate counts
175
- - Auto-proceeded to step 03
176
-
177
- ### ❌ SYSTEM FAILURE:
178
-
179
- - Missing manifest files that exist in the project
180
- - Inventing dependencies not in manifest files
181
- - Starting to rank or analyze dependencies (step 03's job)
182
- - Not halting when no manifests found
183
- - Displaying A/P menu (this is auto-proceed)
184
-
185
- **Master Rule:** Detect and parse only. No ranking, no filtering, no analysis.
@@ -1,7 +1,4 @@
1
1
  ---
2
- name: 'step-03-rank-and-confirm'
3
- description: 'Rank dependencies by import frequency and confirm scope with user'
4
-
5
2
  nextStepFile: './step-04-parallel-extract.md'
6
3
  ---
7
4
 
@@ -11,40 +8,10 @@ nextStepFile: './step-04-parallel-extract.md'
11
8
 
12
9
  Count import frequency for each dependency across the codebase, rank by usage, and present for user confirmation of which libraries to include in the stack skill.
13
10
 
14
- ## MANDATORY EXECUTION RULES (READ FIRST):
15
-
16
- ### Universal Rules:
17
-
18
- - 📖 CRITICAL: Read the complete step file before taking any action
19
- - ⚙️ TOOL/SUBPROCESS FALLBACK: If any instruction references a subprocess, subagent, or tool you do not have access to, you MUST still achieve the outcome in your main context thread
20
- - ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
21
-
22
- ### Role Reinforcement:
23
-
24
- - ✅ You are a dependency analyst operating in Ferris Architect mode
25
- - ✅ Prescriptive precision — import counts must reflect actual code
26
- - ✅ User has final authority on scope — present data, let them decide
27
-
28
- ### Step-Specific Rules:
29
-
30
- - 🎯 Focus on counting imports, ranking, and getting user confirmation
31
- - 🚫 FORBIDDEN to extract library documentation — that is step 04
32
- - 💬 Present data clearly so user can make informed scope decisions
33
- - 🎯 Use subprocess (Pattern 1 — grep/search): In Claude Code, use the Grep tool or Bash with `rg`. In Cursor, use built-in search. In CLI, use `grep`/`rg` directly. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
34
-
35
- ## EXECUTION PROTOCOLS:
36
-
37
- - 🎯 Count imports per library across the codebase
38
- - 💾 Store confirmed_dependencies as workflow state
39
- - 📖 Wait for user confirmation before proceeding
40
- - 🚫 FORBIDDEN to proceed without explicit user scope confirmation
11
+ ## Rules
41
12
 
42
- ## CONTEXT BOUNDARIES:
43
-
44
- - From step 02: raw_dependencies[] with ecosystem info
45
- - This step produces: confirmed_dependencies[] (user-approved scope)
46
- - User interaction: Gate 1 — scope confirmation required
47
- - Apply scope_overrides from step 01 if provided
13
+ - Focus on counting imports, ranking, and getting user confirmation — do not extract documentation (Step 04)
14
+ - Use subprocess Pattern 1 (grep/search) when available
48
15
 
49
16
  ## MANDATORY SEQUENCE
50
17
 
@@ -60,9 +27,11 @@ Set `confirmed_dependencies` = all `raw_dependencies` (the list already stored a
60
27
 
61
28
  **Apply scope_overrides:** If `scope_overrides` were provided in step 01, apply them now — force-include or force-exclude skills as specified. Log any overrides applied.
62
29
 
30
+ **Validate override keys (S4):** Every key in `scope_overrides` MUST be present in `raw_dependencies`. For any unknown key, emit `"scope_override: unknown dependency '{key}' — skipping"` and drop that override entry (do not fail the run). Known-key overrides still apply.
31
+
63
32
  Present skills sorted by architectural layer (from architecture doc if available):
64
- - If `architecture_doc_path` is not null: parse architecture doc for section headers to determine layer grouping
65
- - If `architecture_doc_path` is null or layers not detectable: present alphabetically
33
+ - If `architecture_doc_path` is not null: **wrap the architecture-doc parse in try/except (S5)**. On any parse error (file unreadable, malformed markdown, no H2 structure), fall back to alphabetical ordering and log a warning `"architecture-doc parse failed: {error} — falling back to alphabetical"`. Otherwise parse section headers to determine layer grouping.
34
+ - If `architecture_doc_path` is null or layers not detectable: present alphabetically.
66
35
 
67
36
  Display skills as a table:
68
37
 
@@ -80,7 +49,7 @@ For each dependency in `raw_dependencies`:
80
49
 
81
50
  **Launch a subprocess** that runs grep across all source files in the project to count import statements for each library. Return only the counts, not file contents.
82
51
 
83
- **Subprocess resolution:** Use the Grep tool (Claude Code), built-in search (Cursor), or `grep`/`rg` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
52
+ **Subprocess resolution:** Use the Grep tool (Claude Code), built-in search (Cursor), or `grep`/`rg` (CLI). See `knowledge/tool-resolution.md`.
84
53
 
85
54
  Use ecosystem-appropriate import patterns:
86
55
  - JavaScript/TypeScript: `import .* from ['"]library`, `require\(['"]library`
@@ -158,6 +127,7 @@ Display: **Select:** [C] Continue to Extraction
158
127
  #### EXECUTION RULES:
159
128
 
160
129
  - ALWAYS halt and wait for user input after presenting scope
130
+ - **GATE [default: C]** — If `{headless_mode}`: auto-proceed with [C] Continue (accept all ranked libraries), log: "headless: auto-confirm library scope"
161
131
  - ONLY proceed to next step when user confirms scope and selects 'C'
162
132
 
163
133
  #### Menu Handling Logic:
@@ -165,23 +135,3 @@ Display: **Select:** [C] Continue to Extraction
165
135
  - IF C: Store current `confirmed_dependencies` (including any modifications made since initial presentation), then load, read entire file, then execute {nextStepFile}
166
136
  - 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)
167
137
 
168
- ---
169
-
170
- ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
171
-
172
- ### ✅ SUCCESS:
173
-
174
- - Import counts reflect actual codebase usage (not guesses)
175
- - Dependencies ranked by import frequency
176
- - Trivial dependencies filtered below threshold
177
- - User explicitly confirmed scope
178
- - confirmed_dependencies stored for step 04
179
-
180
- ### ❌ SYSTEM FAILURE:
181
-
182
- - Fabricating import counts without grepping
183
- - Proceeding without user scope confirmation
184
- - Including test/config files in import counts
185
- - Starting library extraction (step 04's job)
186
-
187
- **Master Rule:** Present data, let user decide. No extraction until scope is confirmed.
@@ -1,7 +1,4 @@
1
1
  ---
2
- name: 'step-04-parallel-extract'
3
- description: 'Extract per-library documentation in parallel using tier-dependent tools'
4
-
5
2
  nextStepFile: './step-05-detect-integrations.md'
6
3
  ---
7
4
 
@@ -11,40 +8,11 @@ nextStepFile: './step-05-detect-integrations.md'
11
8
 
12
9
  For each confirmed dependency, extract key exports, usage patterns, and API surface documentation using tier-dependent tools in parallel.
13
10
 
14
- ## MANDATORY EXECUTION RULES (READ FIRST):
15
-
16
- ### Universal Rules:
17
-
18
- - 📖 CRITICAL: Read the complete step file before taking any action
19
- - ⚙️ TOOL/SUBPROCESS FALLBACK: If any instruction references a subprocess, subagent, or tool you do not have access to, you MUST still achieve the outcome in your main context thread
20
- - ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
21
-
22
- ### Role Reinforcement:
23
-
24
- - ✅ You are a dependency analyst operating in Ferris Architect mode
25
- - ✅ Zero hallucination — only extract what exists in actual source code
26
- - ✅ Every export and pattern must cite actual file:line references
27
-
28
- ### Step-Specific Rules:
11
+ ## Rules
29
12
 
30
- - 🎯 Extract per-library using Pattern 4 (parallel): In Claude Code, use multiple parallel Agent tool calls or `run_in_background: true`. In Cursor, use parallel requests (IDE-dependent). In CLI, use `xargs -P` or background processes. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
31
- - 💬 Each subprocess returns structured extraction, not raw file contents
32
- - 🚫 FORBIDDEN to analyze cross-library integrations that is step 05
33
- - ⚙️ If parallel subprocess unavailable, extract libraries sequentially in main thread
34
-
35
- ## EXECUTION PROTOCOLS:
36
-
37
- - 🎯 Launch parallel extraction per confirmed library
38
- - 💾 Store per_library_extractions with confidence tier labels
39
- - 📖 Report extraction summary before auto-proceeding
40
- - 🚫 FORBIDDEN to proceed if zero libraries successfully extracted
41
-
42
- ## CONTEXT BOUNDARIES:
43
-
44
- - From step 03: confirmed_dependencies[] (user-approved scope)
45
- - From step 01: forge_tier, available_tools
46
- - This step produces: per_library_extractions[] per library
47
- - Each extraction includes: exports, patterns, confidence tier
13
+ - Extract per-library using subprocess Pattern 4 (parallel) when available; if unavailable, extract sequentially
14
+ - Each subprocess returns structured extraction, not raw file contents
15
+ - Do not analyze cross-library integrations (Step 05)
48
16
 
49
17
  ## MANDATORY SEQUENCE
50
18
 
@@ -56,11 +24,24 @@ For each confirmed dependency, extract key exports, usage patterns, and API surf
56
24
 
57
25
  "**Extraction data already available from individual skills. Skipping extraction phase.**"
58
26
 
59
- For each confirmed skill, load SKILL.md from the version-aware path resolved in step-02. Use `skill_package_path` (stored in step-02) 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](../../../knowledge/version-paths.md)). Build a `per_library_extractions[]` entry for each skill with the following fields:
27
+ For each confirmed skill, load SKILL.md from the version-aware path resolved in step-02.
28
+
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).
30
+
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`).
32
+
33
+ **Exports resolution order (H1):** For each confirmed skill, populate the `exports` field using the first source that returns a non-empty list:
34
+
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.
38
+
39
+ Build a `per_library_extractions[]` entry for each skill with the following fields:
60
40
  - `library`: skill name from metadata.json
61
- - `exports`: exports list extracted from the SKILL.md exports section
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)
62
43
  - `usage_patterns`: usage patterns from the SKILL.md usage section
63
- - `confidence`: the skill's existing confidence tier (T1, T1-low, T2) — inherited directly
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.
64
45
 
65
46
  Display an extraction summary:
66
47
 
@@ -113,7 +94,7 @@ For each library in `confirmed_dependencies`, determine extraction strategy base
113
94
  - Query `qmd_bridge.search("{library_name} deprecated OR removed OR breaking change")` for deprecation context
114
95
  - Query `qmd_bridge.search("{library_name} migration OR upgrade")` for migration patterns
115
96
  - Query `qmd_bridge.search("{library_name} version issue OR bug OR workaround")` for version-specific warnings
116
- - **Tool resolution for qmd_bridge:** Use QMD MCP tools — `mcp__plugin_qmd-plugin_qmd__search` (Claude Code), qmd MCP server (Cursor), `qmd search "{query}"` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
97
+ - **Tool resolution for qmd_bridge:** Use QMD MCP tools — `mcp__plugin_qmd-plugin_qmd__search` (Claude Code), qmd MCP server (Cursor), `qmd search "{query}"` (CLI). See `knowledge/tool-resolution.md`
117
98
  - Classify each result as T2-past (historical) or T2-future (planned changes) per confidence-tiers.md
118
99
  - Append temporal findings to the library's extraction as T2 annotations with `[QMD:{collection}:{doc}]` citations
119
100
  - **If no matching temporal collection found:**
@@ -138,7 +119,7 @@ Each subprocess:
138
119
  version: "from_manifest",
139
120
  exports_found: ["fn1", "fn2", "Type1"],
140
121
  usage_patterns: ["pattern description with file:line"],
141
- confidence: "T1|T1-low|T2",
122
+ confidence: "T1|T1-low|T2|T3",
142
123
  files_analyzed: count,
143
124
  warnings: [],
144
125
  temporal: {
@@ -152,6 +133,8 @@ Each subprocess:
152
133
 
153
134
  **If parallel subprocess unavailable:** Process libraries sequentially in main thread. Report progress after each library.
154
135
 
136
+ **Per-subprocess timeout (S6):** Apply a 60-second wall-clock timeout to each library's extraction subprocess. On timeout, mark the library as `partial-failure` with `warnings: ["extraction timeout after 60s"]`, store whatever partial data was returned (if any), and continue with the remaining libraries. Do NOT abort the batch on a single timeout.
137
+
155
138
  ### 3. Handle Extraction Failures
156
139
 
157
140
  For each library extraction:
@@ -164,7 +147,11 @@ For each library extraction:
164
147
 
165
148
  "**Warning:** Extraction failed for {library}: {reason}. Excluding from stack skill."
166
149
 
167
- **If ALL extractions fail:** HALT — cannot produce meaningful stack skill.
150
+ **If ALL extractions fail:** HALT — cannot produce meaningful stack skill. Before halting (B7):
151
+
152
+ 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":[...]}`.
154
+ 3. Exit with a non-zero status so headless pipelines detect the failure.
168
155
 
169
156
  ### 4. Display Extraction Summary
170
157
 
@@ -188,25 +175,3 @@ For each library extraction:
188
175
 
189
176
  Load, read the full file and then execute `{nextStepFile}`.
190
177
 
191
- ---
192
-
193
- ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
194
-
195
- ### ✅ SUCCESS:
196
-
197
- - All confirmed libraries have extraction attempted
198
- - Extractions cite actual file:line references
199
- - Confidence tiers correctly assigned per extraction method
200
- - Partial failures handled gracefully (skip library, continue)
201
- - Extraction summary displayed with accurate counts
202
- - Auto-proceeded to step 05
203
-
204
- ### ❌ SYSTEM FAILURE:
205
-
206
- - Fabricating exports not found in source code
207
- - Not assigning confidence tiers to extractions
208
- - Halting on single library failure (should degrade gracefully)
209
- - Analyzing cross-library integrations (step 05's job)
210
- - Returning raw file contents instead of structured extractions
211
-
212
- **Master Rule:** Extract per-library only. Every export must trace to actual code. Degrade gracefully on individual failures.
@@ -0,0 +1,164 @@
1
+ ---
2
+ nextStepFile: './step-06-compile-stack.md'
3
+ integrationPatterns: 'references/integration-patterns.md'
4
+ composeModeRules: 'references/compose-mode-rules.md'
5
+ ---
6
+
7
+ # Step 5: Detect Integrations
8
+
9
+ ## STEP GOAL:
10
+
11
+ Analyze co-import patterns between confirmed libraries to identify integration points — where and how libraries connect in this specific codebase.
12
+
13
+ ## Rules
14
+
15
+ - Focus on detecting cross-library patterns using subprocess Pattern 1 (grep/search)
16
+ - Do not compile SKILL.md (Step 06)
17
+ - Integration detection is the core differentiator of stack skills vs individual skills
18
+
19
+ ## MANDATORY SEQUENCE
20
+
21
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
22
+
23
+ ### 1. Generate Library Pairs
24
+
25
+ From `confirmed_dependencies`, generate all unique pairs:
26
+ - N libraries → N*(N-1)/2 pairs
27
+ - Skip pairs where either library had extraction failure in step 04
28
+
29
+ **File-list intersection fast path (MANDATORY first pass, all N):** before issuing any pair grep, compute each pair's candidate file set by **intersecting the per-library file lists recorded by step-03 import-count extraction**. Pairs with an empty intersection cannot be integration candidates by construction — drop them. Subsequent grep passes run only against pairs with a non-empty intersection, and grep scope is restricted to those intersection files rather than the whole source tree. This is NOT a "subprocess-unavailable" fallback; it is the default strategy for every N. Rationale: at N≈21 this collapses 210 prescribed pair greps to ~12 non-empty-intersection pairs in typical codebases; at larger N the compression is even greater.
30
+
31
+ **Top-K cap (S7, lowered to 20):** If the file-list-intersection prune still leaves more than **20** non-empty-intersection pairs, cap at the top 20 pairs ranked by intersection size (or by import count if tied). Dropped pairs are excluded from integration detection — warn the user explicitly: `"non-empty-intersection pair count {N} exceeds cap — analyzing top 20 by intersection size; {excluded_count} pairs skipped"`. Record this cap in the evidence report. The legacy 50-dependency threshold that formerly gated a separate Top-K pass is retired — the file-intersection prune does the bulk of the work and the cap is now a second-order safety limit, not a primary strategy.
32
+
33
+ Report: "**Analyzing {pair_count} library pairs for integration patterns** (pruned from {N*(N-1)/2} via file-list intersection; {capped_count} after Top-K if applicable)**...**"
34
+
35
+ ### 2. Detect Co-Import Files
36
+
37
+ **If `compose_mode` is true:**
38
+
39
+ Instead of co-import grep, detect integrations from architecture document:
40
+
41
+ 1. Load `{composeModeRules}` for integration evidence format rules
42
+ 2. **If `{architecture_doc_path}` is null or not available:** Skip directly to the "If no architecture document available" fallback below
43
+ 3. Load the architecture document from `{architecture_doc_path}`
44
+ 4. **Prose-based co-mention analysis with precision guards (H2):**
45
+ - Use **word-boundary matching** when searching for skill names in the architecture document: `\b{skill_name}\b` (case-insensitive). This prevents substring false positives (e.g., `react` matching inside `reactive`).
46
+ - **Exclude non-body sections.** Detect H1 and H2 markdown headers (`^# ` and `^## `) and skip any paragraphs under headers that normalise to `introduction`, `overview`, `glossary`, `table of contents`, `references`, `appendix`, or `index`. Co-mentions inside headings themselves also do not qualify.
47
+ - **Require ≥2 qualifying paragraphs.** A pair `(A, B)` qualifies only when at least two distinct body paragraphs each contain word-boundary matches for both `A` and `B`. A single co-mention paragraph is insufficient evidence.
48
+ - Risks and rationale are documented in `{composeModeRules}` under "Compose-mode co-mention precision".
49
+ 5. For each detected integration pair:
50
+ - Load both skills' export lists and API signatures
51
+ - Compose an integration section following the format from `{composeModeRules}`
52
+ - Include VS feasibility verdict if a feasibility report matching the filename pattern defined in `src/shared/references/feasibility-report-schema.md` exists under `{forge_data_folder}/` (timestamped `feasibility-report-{project_slug}-{YYYYMMDD-HHmmss}.md` or the stable `feasibility-report-{project_slug}-latest.md` copy). Schema version `"1.0"` is required; see the schema for the full contract.
53
+ - Cite evidence from both skills: `[from skill: {skill_name}]`
54
+
55
+ All integration evidence inherits confidence tiers from the source skills. Load and apply the full **Confidence Tier Inheritance** matrix from `{composeModeRules}` to compute the correct tier for each pair (covers T1+T1, T1+T1-low, T1-low+T1-low, T1+T2, T1-low+T2, T2+T2 cases). Apply the `[composed]` suffix to all confidence labels — e.g., `T1 [composed]`, `T1-low [composed, +T2 annotations]`.
56
+
57
+ **VS verdict parsing (if feasibility report exists):** The feasibility report format is defined by the shared schema at `src/shared/references/feasibility-report-schema.md` (single source of truth; skf-verify-stack is the producer, this skill is the consumer). Follow the schema strictly:
58
+
59
+ - Locate the report via the filename pattern in the schema: `{forge_data_folder}/feasibility-report-{project_slug}-{YYYYMMDD-HHmmss}.md` (or the stable `feasibility-report-{project_slug}-latest.md` copy next to it).
60
+ - **Schema version guard:** Parse the report's YAML frontmatter and verify `schemaVersion == "1.0"`. If the field is missing or mismatched, HALT with an explicit error: `"feasibility-report schemaVersion mismatch: expected '1.0', got '{value}' — refusing to proceed"`. Do NOT attempt to interpret unknown versions.
61
+ - Read `overallVerdict` from frontmatter (exactly one of `FEASIBLE|CONDITIONALLY_FEASIBLE|NOT_FEASIBLE`).
62
+ - Parse the `## Integration Verdicts` markdown table for per-pair verdicts (exactly one of `Verified|Plausible|Risky|Blocked`). Any unknown verdict token is a hard error per the schema — do not silently drop or map.
63
+ - For each architecture-detected pair, include `VS overall: {overallVerdict}` and `VS pair: {verdict}` in the integration evidence per the format in `{composeModeRules}`. VS verdicts do not apply to inferred integrations since the VS report operates on architecture-described interactions only. Additionally, flag any pairs where VS reported `Risky` or `Blocked` by appending a `[VS: Risky]` or `[VS: Blocked]` warning annotation to the integration entry.
64
+
65
+ If no architecture document available:
66
+ - Infer potential integrations from skills sharing the same `language` field or sharing domain keywords in their SKILL.md descriptions (use the `usage_patterns` and `exports` fields from `per_library_extractions[]` built in step-04, or reload SKILL.md from the version-aware path: use `skill_package_path` from step-02, or resolve via `{skills_output_folder}/{skill_dir}/active/{skill_dir}/SKILL.md` — see `knowledge/version-paths.md`)
67
+ - Mark inferred integrations: `[inferred from shared domain]` — use this suffix instead of `[composed]` for inferred integrations
68
+ - Inferred integrations qualify automatically — no file-count threshold applies
69
+
70
+ Skip to section 3 (Classify Integration Types) with the compose-mode pairs.
71
+
72
+ **If not compose_mode:**
73
+
74
+ For each library pair (A, B):
75
+
76
+ **Launch a subprocess** that greps across all source files to find files importing BOTH library A and library B. Return only file paths and import line numbers.
77
+
78
+ **Subprocess resolution:** Use the Grep tool (Claude Code), built-in search (Cursor), or `grep`/`rg` (CLI). See `knowledge/tool-resolution.md`.
79
+
80
+ **Subprocess returns:** `{pair: [A, B], co_import_files: [{path, line_A, line_B}], count: N}`
81
+
82
+ **Note on file-list intersection:** per §1, the intersection has already been computed and the pair's `intersection_files` set is known. The grep below runs against that set only, not the whole source tree. If a subprocess is entirely unavailable, the intersection itself is the integration evidence — count the intersection files against the 2-file threshold below without the grep. The intersection is mandatory first-pass work, not a fallback.
83
+
84
+ **Threshold:** A pair must have 2+ co-import files to qualify as an integration pattern (single file co-imports may be incidental).
85
+
86
+ **CCC Semantic Augmentation (Forge+ and Deep with ccc):**
87
+
88
+ If `tools.ccc` is true AND `ccc_index.status` is `"fresh"` or `"stale"` in forge-tier.yaml, augment co-import detection with semantic search (max 1 query per library pair):
89
+
90
+ For each library pair with **0 or 1 co-import files** (below the 2-file threshold — S9, symmetric to give the 0-hit case the same chance as the 1-hit case), run `ccc_bridge.search("{libA} {libB}", source_root, top_k=10)` to find files where the two libraries interact semantically — even without explicit import co-location. If CCC returns additional files where both libraries appear, add them to the pair's co-import candidate list and re-evaluate against the 2-file threshold.
91
+
92
+ **CCC precision guard for 1-file pairs (H3):** When a CCC hit would elevate a 1-file pair to qualifying status, run a post-hoc verification on that file: re-grep the file and confirm it contains explicit import statements for **both** libraries (per the ecosystem import patterns from `references/manifest-patterns.md`). If either import is missing (e.g., one library is only name-dropped in a comment or string), drop the CCC-added file from the candidate list. Only pairs with ≥2 files that each contain explicit imports for both libraries qualify. Log rejected CCC candidates in workflow state for the evidence report.
93
+
94
+ **Tool resolution for ccc_bridge.search:** Use `/ccc` skill search (Claude Code), ccc MCP server (Cursor), or `ccc search "{libA} {libB}" --path {source_root} --top 10` (CLI). See `knowledge/tool-resolution.md`.
95
+
96
+ For pairs that already qualify (2+ files), CCC is not needed for detection — but the CCC results may surface additional integration files for richer classification in section 3.
97
+
98
+ CCC failures: skip augmentation silently, proceed with grep-only results.
99
+
100
+ ### 3. Classify Integration Types
101
+
102
+ Load `{integrationPatterns}` for classification rules.
103
+
104
+ For each qualifying pair, analyze to classify the integration type (**in compose-mode**: all architecture-document-detected pairs qualify automatically — the 2+ co-import file threshold applies only in code-mode; **in code-mode**: pair must have 2+ co-import files):
105
+
106
+ - **Type 1: Middleware Chain** — Sequential function calls piping output between libraries
107
+ - **Type 2: Shared Types** — Type definitions exchanged between libraries
108
+ - **Type 3: Configuration Bridge** — One library configuring or initializing another
109
+ - **Type 4: Event Handler** — Event patterns crossing library boundaries
110
+ - **Type 5: Adapter/Wrapper** — Thin wrapper connecting library interfaces
111
+ - **Type 6: State Sharing** — Shared state stores or context providers
112
+
113
+ For each detected integration:
114
+ - Identify the top 3 files demonstrating the pattern
115
+ - Extract a brief description of how the libraries connect
116
+ - **Assign confidence (M1/M3) — derive from per-library tiers + detection-method qualifier (NOT from AST):** integration detection here is grep + co-import (optionally CCC-augmented), never AST. The integration's confidence is the **weaker** of the two libraries' tiers from `per_library_extractions[]` (tie-break: T1-low > T1, T2 > T1-low, T3 > T2 — never overstate). Then append a detection-method qualifier:
117
+ - `grep-co-import` — the pair qualified via direct co-import grep (the default).
118
+ - `ccc-augmented` — the pair qualified only after CCC semantic search elevated it (per §2 CCC augmentation), and the post-hoc import verification (H3) confirmed both imports.
119
+ - `architecture-co-mention` — compose-mode pair qualified via word-boundary co-mention in the architecture document (per §2 H2 guards).
120
+ - `inferred-shared-domain` — compose-mode pair without an architecture document, inferred from shared `language` or domain keywords.
121
+ - Render as `{tier} ({qualifier})` — e.g., `T1-low (grep-co-import)`, `T1 (ccc-augmented)`, `T1-low (architecture-co-mention) [composed]`. The `[composed]`/`[inferred from shared domain]` suffix from `compose-mode-rules.md` is appended after the qualifier in compose-mode.
122
+
123
+ ### 4. Build Integration Graph
124
+
125
+ Assemble the integration graph:
126
+ - **Nodes:** Confirmed libraries (with extraction data from step 04)
127
+ - **Edges:** Detected integration pairs with type, file count, and description
128
+ - Identify **hub libraries** (connected to 3+ other libraries)
129
+ - Identify **cross-cutting patterns** (patterns spanning 3+ libraries)
130
+
131
+ ### 5. Display Integration Summary
132
+
133
+ **If integrations detected:**
134
+
135
+ "**Integration detection complete.**
136
+
137
+ **Integration graph:** {lib_count} libraries, {pair_count} integration pairs
138
+
139
+ **Hub libraries** (connected to 3+ others):
140
+ {For each hub:} - **{library}** — integrates with {partner_list}
141
+
142
+ **Detected integrations:**
143
+ | Library A | Library B | Type | Co-import Files | Confidence |
144
+ |-----------|-----------|------|-----------------|------------|
145
+ | {name} | {name} | {type} | {count} | {tier} |
146
+
147
+ {If cross-cutting patterns:}
148
+ **Cross-cutting patterns:**
149
+ - {description spanning 3+ libraries}
150
+
151
+ **Proceeding to stack compilation...**"
152
+
153
+ **If no integrations detected:**
154
+
155
+ "**No co-import integration patterns detected** between confirmed libraries.
156
+
157
+ The libraries in this project appear to operate independently. The stack skill will contain library summaries without an integration layer.
158
+
159
+ **Proceeding to stack compilation...**"
160
+
161
+ ### 6. Auto-Proceed to Next Step
162
+
163
+ Load, read the full file and then execute `{nextStepFile}`.
164
+