bmad-module-skill-forge 0.2.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 (154) hide show
  1. package/.nvmrc +1 -0
  2. package/LICENSE +26 -0
  3. package/README.md +213 -0
  4. package/docs/404.md +20 -0
  5. package/docs/agents.md +73 -0
  6. package/docs/architecture.md +301 -0
  7. package/docs/examples.md +144 -0
  8. package/docs/getting-started.md +198 -0
  9. package/docs/index.md +75 -0
  10. package/docs/workflows.md +190 -0
  11. package/package.json +109 -0
  12. package/src/agents/forger.agent.yaml +93 -0
  13. package/src/forger/README.md +17 -0
  14. package/src/forger/forge-tier.yaml +13 -0
  15. package/src/forger/preferences.yaml +10 -0
  16. package/src/knowledge/agentskills-spec.md +158 -0
  17. package/src/knowledge/confidence-tiers.md +153 -0
  18. package/src/knowledge/manual-section-integrity.md +156 -0
  19. package/src/knowledge/overview.md +56 -0
  20. package/src/knowledge/progressive-capability.md +120 -0
  21. package/src/knowledge/provenance-tracking.md +163 -0
  22. package/src/knowledge/skf-knowledge-index.csv +9 -0
  23. package/src/knowledge/skill-lifecycle.md +150 -0
  24. package/src/knowledge/zero-hallucination.md +101 -0
  25. package/src/module-help.csv +12 -0
  26. package/src/module.yaml +22 -0
  27. package/src/workflows/README.md +148 -0
  28. package/src/workflows/analyze-source/data/skill-brief-schema.md +75 -0
  29. package/src/workflows/analyze-source/data/unit-detection-heuristics.md +88 -0
  30. package/src/workflows/analyze-source/steps-c/step-01-init.md +191 -0
  31. package/src/workflows/analyze-source/steps-c/step-01b-continue.md +144 -0
  32. package/src/workflows/analyze-source/steps-c/step-02-scan-project.md +208 -0
  33. package/src/workflows/analyze-source/steps-c/step-03-identify-units.md +199 -0
  34. package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +222 -0
  35. package/src/workflows/analyze-source/steps-c/step-05-recommend.md +236 -0
  36. package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +239 -0
  37. package/src/workflows/analyze-source/templates/analysis-report-template.md +41 -0
  38. package/src/workflows/analyze-source/validation-report.md +657 -0
  39. package/src/workflows/analyze-source/workflow-plan-analyze-source.md +385 -0
  40. package/src/workflows/analyze-source/workflow.md +61 -0
  41. package/src/workflows/audit-skill/data/drift-report-template.md +62 -0
  42. package/src/workflows/audit-skill/data/severity-rules.md +52 -0
  43. package/src/workflows/audit-skill/steps-c/step-01-init.md +195 -0
  44. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +191 -0
  45. package/src/workflows/audit-skill/steps-c/step-03-structural-diff.md +194 -0
  46. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +199 -0
  47. package/src/workflows/audit-skill/steps-c/step-05-severity-classify.md +210 -0
  48. package/src/workflows/audit-skill/steps-c/step-06-report.md +217 -0
  49. package/src/workflows/audit-skill/validation-report.md +545 -0
  50. package/src/workflows/audit-skill/workflow-plan-audit-skill.md +318 -0
  51. package/src/workflows/audit-skill/workflow.md +63 -0
  52. package/src/workflows/brief-skill/data/skill-brief-schema.md +82 -0
  53. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +184 -0
  54. package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +203 -0
  55. package/src/workflows/brief-skill/steps-c/step-03-scope-definition.md +225 -0
  56. package/src/workflows/brief-skill/steps-c/step-04-confirm-brief.md +185 -0
  57. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +156 -0
  58. package/src/workflows/brief-skill/validation-report.md +630 -0
  59. package/src/workflows/brief-skill/workflow-plan-brief-skill.md +360 -0
  60. package/src/workflows/brief-skill/workflow.md +57 -0
  61. package/src/workflows/create-skill/data/extraction-patterns.md +63 -0
  62. package/src/workflows/create-skill/data/skill-sections.md +166 -0
  63. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +176 -0
  64. package/src/workflows/create-skill/steps-c/step-02-ecosystem-check.md +143 -0
  65. package/src/workflows/create-skill/steps-c/step-03-extract.md +184 -0
  66. package/src/workflows/create-skill/steps-c/step-04-enrich.md +152 -0
  67. package/src/workflows/create-skill/steps-c/step-05-compile.md +198 -0
  68. package/src/workflows/create-skill/steps-c/step-06-validate.md +162 -0
  69. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +165 -0
  70. package/src/workflows/create-skill/steps-c/step-08-report.md +160 -0
  71. package/src/workflows/create-skill/validation-report.md +189 -0
  72. package/src/workflows/create-skill/workflow-plan-create-skill.md +491 -0
  73. package/src/workflows/create-skill/workflow.md +52 -0
  74. package/src/workflows/create-stack-skill/data/integration-patterns.md +61 -0
  75. package/src/workflows/create-stack-skill/data/manifest-patterns.md +35 -0
  76. package/src/workflows/create-stack-skill/data/stack-skill-template.md +110 -0
  77. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +142 -0
  78. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +145 -0
  79. package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +161 -0
  80. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +155 -0
  81. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +154 -0
  82. package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +160 -0
  83. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +202 -0
  84. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +193 -0
  85. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +137 -0
  86. package/src/workflows/create-stack-skill/validation-report.md +401 -0
  87. package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +481 -0
  88. package/src/workflows/create-stack-skill/workflow.md +59 -0
  89. package/src/workflows/export-skill/data/managed-section-format.md +70 -0
  90. package/src/workflows/export-skill/data/snippet-format.md +32 -0
  91. package/src/workflows/export-skill/steps-c/step-01-load-skill.md +184 -0
  92. package/src/workflows/export-skill/steps-c/step-02-package.md +153 -0
  93. package/src/workflows/export-skill/steps-c/step-03-generate-snippet.md +166 -0
  94. package/src/workflows/export-skill/steps-c/step-04-update-context.md +222 -0
  95. package/src/workflows/export-skill/steps-c/step-05-token-report.md +126 -0
  96. package/src/workflows/export-skill/steps-c/step-06-summary.md +167 -0
  97. package/src/workflows/export-skill/validation-report.md +263 -0
  98. package/src/workflows/export-skill/workflow-plan-export-skill.md +369 -0
  99. package/src/workflows/export-skill/workflow.md +56 -0
  100. package/src/workflows/quick-skill/data/registry-resolution.md +91 -0
  101. package/src/workflows/quick-skill/data/skill-template.md +66 -0
  102. package/src/workflows/quick-skill/steps-c/step-01-resolve-target.md +165 -0
  103. package/src/workflows/quick-skill/steps-c/step-02-ecosystem-check.md +143 -0
  104. package/src/workflows/quick-skill/steps-c/step-03-quick-extract.md +177 -0
  105. package/src/workflows/quick-skill/steps-c/step-04-compile.md +180 -0
  106. package/src/workflows/quick-skill/steps-c/step-05-validate.md +150 -0
  107. package/src/workflows/quick-skill/steps-c/step-06-write.md +160 -0
  108. package/src/workflows/quick-skill/validation-report.md +543 -0
  109. package/src/workflows/quick-skill/workflow-plan-quick-skill.md +405 -0
  110. package/src/workflows/quick-skill/workflow.md +56 -0
  111. package/src/workflows/setup-forge/data/tier-rules.md +50 -0
  112. package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +140 -0
  113. package/src/workflows/setup-forge/steps-c/step-02-write-config.md +141 -0
  114. package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +116 -0
  115. package/src/workflows/setup-forge/steps-c/step-04-report.md +131 -0
  116. package/src/workflows/setup-forge/validation-report.md +504 -0
  117. package/src/workflows/setup-forge/workflow-plan-setup-forge.md +428 -0
  118. package/src/workflows/setup-forge/workflow.md +49 -0
  119. package/src/workflows/test-skill/data/output-section-formats.md +96 -0
  120. package/src/workflows/test-skill/data/scoring-rules.md +74 -0
  121. package/src/workflows/test-skill/steps-c/step-01-init.md +185 -0
  122. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +162 -0
  123. package/src/workflows/test-skill/steps-c/step-03-coverage-check.md +222 -0
  124. package/src/workflows/test-skill/steps-c/step-04-coherence-check.md +249 -0
  125. package/src/workflows/test-skill/steps-c/step-05-score.md +222 -0
  126. package/src/workflows/test-skill/steps-c/step-06-report.md +175 -0
  127. package/src/workflows/test-skill/templates/test-report-template.md +24 -0
  128. package/src/workflows/test-skill/validation-report.md +390 -0
  129. package/src/workflows/test-skill/workflow-plan-test-skill.md +288 -0
  130. package/src/workflows/test-skill/workflow.md +57 -0
  131. package/src/workflows/update-skill/data/manual-section-rules.md +44 -0
  132. package/src/workflows/update-skill/data/merge-conflict-rules.md +62 -0
  133. package/src/workflows/update-skill/steps-c/step-01-init.md +208 -0
  134. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +184 -0
  135. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +187 -0
  136. package/src/workflows/update-skill/steps-c/step-04-merge.md +230 -0
  137. package/src/workflows/update-skill/steps-c/step-05-validate.md +187 -0
  138. package/src/workflows/update-skill/steps-c/step-06-write.md +204 -0
  139. package/src/workflows/update-skill/steps-c/step-07-report.md +201 -0
  140. package/src/workflows/update-skill/validation-report.md +559 -0
  141. package/src/workflows/update-skill/workflow-plan-update-skill.md +441 -0
  142. package/src/workflows/update-skill/workflow.md +56 -0
  143. package/tools/cli/commands/install.js +33 -0
  144. package/tools/cli/commands/status.js +195 -0
  145. package/tools/cli/commands/uninstall.js +226 -0
  146. package/tools/cli/commands/update.js +63 -0
  147. package/tools/cli/lib/compiler.js +306 -0
  148. package/tools/cli/lib/ide-commands.js +244 -0
  149. package/tools/cli/lib/installer.js +307 -0
  150. package/tools/cli/lib/manifest.js +109 -0
  151. package/tools/cli/lib/ui.js +277 -0
  152. package/tools/cli/lib/version-check.js +86 -0
  153. package/tools/cli/skf-cli.js +45 -0
  154. package/tools/skf-npx-wrapper.js +36 -0
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: 'step-03-rank-and-confirm'
3
+ description: 'Rank dependencies by import frequency and confirm scope with user'
4
+
5
+ nextStepFile: './step-04-parallel-extract.md'
6
+ ---
7
+
8
+ # Step 3: Rank and Confirm Scope
9
+
10
+ ## STEP GOAL:
11
+
12
+ 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
+
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) for import counting when available
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
41
+
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
48
+
49
+ ## MANDATORY SEQUENCE
50
+
51
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
52
+
53
+ ### 1. Count Import Frequency
54
+
55
+ For each dependency in `raw_dependencies`:
56
+
57
+ **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.
58
+
59
+ Use ecosystem-appropriate import patterns:
60
+ - JavaScript/TypeScript: `import .* from ['"]library`, `require\(['"]library`
61
+ - Python: `import library`, `from library import`
62
+ - Rust: `use library::`, `extern crate library`
63
+ - Go: `"library"` in import blocks
64
+ - (Match patterns from manifest-patterns.md)
65
+
66
+ **Subprocess returns:** `{library_name: import_count, files: [file_paths]}` for each dependency.
67
+
68
+ **If subprocess unavailable:** Perform grep operations in main thread sequentially.
69
+
70
+ Exclude from counting:
71
+ - Test files (*/test/*, *_test.*, *.spec.*, *.test.*)
72
+ - Config files (*.config.*, .eslintrc, etc.)
73
+ - Build artifacts (dist/, build/, node_modules/, target/, __pycache__/)
74
+
75
+ ### 2. Rank and Filter
76
+
77
+ Sort dependencies by import count (descending).
78
+
79
+ Apply filtering:
80
+ - **Include by default:** Libraries with 2+ import files
81
+ - **Flag as trivial:** Libraries with 0-1 import files
82
+ - **Apply scope_overrides** from step 01 if provided (force include/exclude)
83
+
84
+ ### 3. Present Ranked List
85
+
86
+ "**Dependency ranking complete.** Here are your project's libraries ranked by usage:
87
+
88
+ | # | Library | Imports | Files | Category |
89
+ |---|---------|---------|-------|----------|
90
+ | 1 | {name} | {count} | {file_count} | runtime |
91
+ | 2 | {name} | {count} | {file_count} | runtime |
92
+ | ... | ... | ... | ... | ... |
93
+
94
+ **Below threshold** (0-1 imports — excluded by default):
95
+ | Library | Imports | Category |
96
+ |---------|---------|----------|
97
+ | {name} | {count} | {category} |
98
+
99
+ **Total:** {total} dependencies detected, {above_threshold} recommended for inclusion
100
+
101
+ ---
102
+
103
+ **Please confirm your scope:**
104
+ - Type **C** to accept the recommended scope (all above-threshold libraries)
105
+ - Type library names to **add** from the below-threshold list
106
+ - Type **-library_name** to **exclude** a recommended library
107
+ - Type a custom list to override entirely"
108
+
109
+ ### 4. Process User Response
110
+
111
+ **If C (accept recommended):**
112
+ Store all above-threshold libraries as `confirmed_dependencies`.
113
+
114
+ **If modifications requested:**
115
+ Apply additions/exclusions, display updated list, and ask for final confirmation.
116
+
117
+ **If custom list provided:**
118
+ Use the custom list as `confirmed_dependencies`.
119
+
120
+ Display final confirmation:
121
+
122
+ "**Scope confirmed:** {count} libraries selected for stack skill extraction.
123
+
124
+ {List confirmed libraries}
125
+
126
+ **Proceeding to parallel extraction...**"
127
+
128
+ ### 5. Present MENU OPTIONS
129
+
130
+ Display: **Select:** [C] Continue to Extraction
131
+
132
+ #### EXECUTION RULES:
133
+
134
+ - ALWAYS halt and wait for user input after presenting scope
135
+ - ONLY proceed to next step when user confirms scope and selects 'C'
136
+
137
+ #### Menu Handling Logic:
138
+
139
+ - IF C: Store confirmed_dependencies, then load, read entire file, then execute {nextStepFile}
140
+ - IF Any other: Process as scope modification, redisplay updated list, then [Redisplay Menu Options](#5-present-menu-options)
141
+
142
+ ---
143
+
144
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
145
+
146
+ ### ✅ SUCCESS:
147
+
148
+ - Import counts reflect actual codebase usage (not guesses)
149
+ - Dependencies ranked by import frequency
150
+ - Trivial dependencies filtered below threshold
151
+ - User explicitly confirmed scope
152
+ - confirmed_dependencies stored for step 04
153
+
154
+ ### ❌ SYSTEM FAILURE:
155
+
156
+ - Fabricating import counts without grepping
157
+ - Proceeding without user scope confirmation
158
+ - Including test/config files in import counts
159
+ - Starting library extraction (step 04's job)
160
+
161
+ **Master Rule:** Present data, let user decide. No extraction until scope is confirmed.
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: 'step-04-parallel-extract'
3
+ description: 'Extract per-library documentation in parallel using tier-dependent tools'
4
+
5
+ nextStepFile: './step-05-detect-integrations.md'
6
+ ---
7
+
8
+ # Step 4: Parallel Library Extraction
9
+
10
+ ## STEP GOAL:
11
+
12
+ For each confirmed dependency, extract key exports, usage patterns, and API surface documentation using tier-dependent tools in parallel.
13
+
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:
29
+
30
+ - 🎯 Extract per-library using Pattern 4 (parallel subprocess) when available
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
48
+
49
+ ## MANDATORY SEQUENCE
50
+
51
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
52
+
53
+ ### 1. Prepare Extraction Plan
54
+
55
+ For each library in `confirmed_dependencies`, determine extraction strategy based on forge tier:
56
+
57
+ **Quick Tier:**
58
+ - Read source files that import the library
59
+ - Extract usage patterns from import statements and function calls
60
+ - Identify key exports used in this project
61
+ - Confidence: T1-low (source reading inference)
62
+
63
+ **Forge Tier (adds to Quick):**
64
+ - Use ast_bridge to analyze structural exports from library source
65
+ - Extract function signatures, type definitions, class hierarchies
66
+ - Map parameter types and return types
67
+ - Confidence: T1 (AST-verified structural extraction)
68
+
69
+ **Deep Tier (adds to Forge):**
70
+ - Use qmd_bridge for temporal usage evolution
71
+ - Identify deprecated patterns and migration paths
72
+ - Track API changes across project history
73
+ - Confidence: T2 (QMD-enriched temporal context)
74
+
75
+ ### 2. Launch Parallel Extraction
76
+
77
+ **Launch subprocesses in parallel** (max_parallel_generation) — one per confirmed library:
78
+
79
+ Each subprocess:
80
+ 1. Reads all files importing the library (from step 03 file lists)
81
+ 2. Extracts key exports used in this project (functions, classes, types, constants)
82
+ 3. Identifies usage patterns (initialization, configuration, common call patterns)
83
+ 4. Labels confidence tier based on extraction method
84
+ 5. Returns structured extraction to parent:
85
+
86
+ ```
87
+ {
88
+ library: "name",
89
+ version: "from_manifest",
90
+ exports_found: ["fn1", "fn2", "Type1"],
91
+ usage_patterns: ["pattern description with file:line"],
92
+ confidence: "T1|T1-low|T2",
93
+ files_analyzed: count,
94
+ warnings: []
95
+ }
96
+ ```
97
+
98
+ **If parallel subprocess unavailable:** Process libraries sequentially in main thread. Report progress after each library.
99
+
100
+ ### 3. Handle Extraction Failures
101
+
102
+ For each library extraction:
103
+
104
+ **Success:** Store extraction result.
105
+
106
+ **Partial failure:** Store partial result with warnings, continue with other libraries.
107
+
108
+ **Complete failure:** Log failure reason, exclude from stack skill, note in report.
109
+
110
+ "**Warning:** Extraction failed for {library}: {reason}. Excluding from stack skill."
111
+
112
+ **If ALL extractions fail:** HALT — cannot produce meaningful stack skill.
113
+
114
+ ### 4. Display Extraction Summary
115
+
116
+ "**Library extraction complete.**
117
+
118
+ | Library | Exports | Patterns | Confidence | Status |
119
+ |---------|---------|----------|------------|--------|
120
+ | {name} | {count} | {count} | {tier} | ✓ |
121
+ | {name} | {count} | {count} | {tier} | ✓ |
122
+ | {name} | — | — | — | ⚠ partial |
123
+
124
+ **Results:** {success_count}/{total_count} libraries extracted
125
+ **Confidence distribution:** T1: {count}, T1-low: {count}, T2: {count}
126
+ {If warnings:} **Warnings:** {warning_count} issues noted
127
+
128
+ **Proceeding to integration detection...**"
129
+
130
+ ### 5. Auto-Proceed to Next Step
131
+
132
+ Load, read the full file and then execute `{nextStepFile}`.
133
+
134
+ ---
135
+
136
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
137
+
138
+ ### ✅ SUCCESS:
139
+
140
+ - All confirmed libraries have extraction attempted
141
+ - Extractions cite actual file:line references
142
+ - Confidence tiers correctly assigned per extraction method
143
+ - Partial failures handled gracefully (skip library, continue)
144
+ - Extraction summary displayed with accurate counts
145
+ - Auto-proceeded to step 05
146
+
147
+ ### ❌ SYSTEM FAILURE:
148
+
149
+ - Fabricating exports not found in source code
150
+ - Not assigning confidence tiers to extractions
151
+ - Halting on single library failure (should degrade gracefully)
152
+ - Analyzing cross-library integrations (step 05's job)
153
+ - Returning raw file contents instead of structured extractions
154
+
155
+ **Master Rule:** Extract per-library only. Every export must trace to actual code. Degrade gracefully on individual failures.
@@ -0,0 +1,154 @@
1
+ ---
2
+ name: 'step-05-detect-integrations'
3
+ description: 'Detect co-import patterns and integration points between confirmed libraries'
4
+
5
+ nextStepFile: './step-06-compile-stack.md'
6
+ integrationPatterns: '../data/integration-patterns.md'
7
+ ---
8
+
9
+ # Step 5: Detect Integrations
10
+
11
+ ## STEP GOAL:
12
+
13
+ Analyze co-import patterns between confirmed libraries to identify integration points — where and how libraries connect in this specific codebase.
14
+
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 an integration architect operating in Ferris Architect mode
26
+ - ✅ Zero hallucination — only document integrations evidenced in actual code
27
+ - ✅ Every integration pattern must cite co-import files with file:line references
28
+
29
+ ### Step-Specific Rules:
30
+
31
+ - 🎯 Focus on detecting cross-library patterns using Pattern 1 (grep) subprocess
32
+ - 🚫 FORBIDDEN to compile SKILL.md — that is step 06
33
+ - 💬 Integration detection is the core differentiator of stack skills vs individual skills
34
+ - ⚙️ If subprocess unavailable, perform grep operations in main thread
35
+
36
+ ## EXECUTION PROTOCOLS:
37
+
38
+ - 🎯 Load integration-patterns.md for detection rules
39
+ - 💾 Store integration_graph as workflow state
40
+ - 📖 Auto-proceed to step 06 after detection complete
41
+ - 🚫 Graceful handling if no integrations detected
42
+
43
+ ## CONTEXT BOUNDARIES:
44
+
45
+ - From step 03: confirmed_dependencies[] with file lists per library
46
+ - From step 04: per_library_extractions[] with exports and patterns
47
+ - This step produces: integration_graph {pairs[], types[], files[]}
48
+ - This is the VALUE-ADD step — what makes stack skills different from individual skills
49
+
50
+ ## MANDATORY SEQUENCE
51
+
52
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
53
+
54
+ ### 1. Generate Library Pairs
55
+
56
+ From `confirmed_dependencies`, generate all unique pairs:
57
+ - N libraries → N*(N-1)/2 pairs
58
+ - Skip pairs where either library had extraction failure in step 04
59
+
60
+ Report: "**Analyzing {pair_count} library pairs for integration patterns...**"
61
+
62
+ ### 2. Detect Co-Import Files
63
+
64
+ For each library pair (A, B):
65
+
66
+ **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.
67
+
68
+ **Subprocess returns:** `{pair: [A, B], co_import_files: [{path, line_A, line_B}], count: N}`
69
+
70
+ **If subprocess unavailable:** Intersect the file lists from step 03 import counts for each pair.
71
+
72
+ **Threshold:** A pair must have 2+ co-import files to qualify as an integration pattern (single file co-imports may be incidental).
73
+
74
+ ### 3. Classify Integration Types
75
+
76
+ Load `{integrationPatterns}` for classification rules.
77
+
78
+ For each qualifying pair (2+ co-import files), analyze the co-import files to classify the integration type:
79
+
80
+ - **Type 1: Middleware Chain** — Sequential function calls piping output between libraries
81
+ - **Type 2: Shared Types** — Type definitions exchanged between libraries
82
+ - **Type 3: Configuration Bridge** — One library configuring or initializing another
83
+ - **Type 4: Event Handler** — Event patterns crossing library boundaries
84
+ - **Type 5: Adapter/Wrapper** — Thin wrapper connecting library interfaces
85
+ - **Type 6: State Sharing** — Shared state stores or context providers
86
+
87
+ For each detected integration:
88
+ - Identify the top 3 files demonstrating the pattern
89
+ - Extract a brief description of how the libraries connect
90
+ - Assign confidence: T1 if AST-verified, T1-low if source reading
91
+
92
+ ### 4. Build Integration Graph
93
+
94
+ Assemble the integration graph:
95
+ - **Nodes:** Confirmed libraries (with extraction data from step 04)
96
+ - **Edges:** Detected integration pairs with type, file count, and description
97
+ - Identify **hub libraries** (connected to 3+ other libraries)
98
+ - Identify **cross-cutting patterns** (patterns spanning 3+ libraries)
99
+
100
+ ### 5. Display Integration Summary
101
+
102
+ **If integrations detected:**
103
+
104
+ "**Integration detection complete.**
105
+
106
+ **Integration graph:** {lib_count} libraries, {pair_count} integration pairs
107
+
108
+ **Hub libraries** (connected to 3+ others):
109
+ {For each hub:} - **{library}** — integrates with {partner_list}
110
+
111
+ **Detected integrations:**
112
+ | Library A | Library B | Type | Co-import Files | Confidence |
113
+ |-----------|-----------|------|-----------------|------------|
114
+ | {name} | {name} | {type} | {count} | {tier} |
115
+
116
+ {If cross-cutting patterns:}
117
+ **Cross-cutting patterns:**
118
+ - {description spanning 3+ libraries}
119
+
120
+ **Proceeding to stack compilation...**"
121
+
122
+ **If no integrations detected:**
123
+
124
+ "**No co-import integration patterns detected** between confirmed libraries.
125
+
126
+ The libraries in this project appear to operate independently. The stack skill will contain library summaries without an integration layer.
127
+
128
+ **Proceeding to stack compilation...**"
129
+
130
+ ### 6. Auto-Proceed to Next Step
131
+
132
+ Load, read the full file and then execute `{nextStepFile}`.
133
+
134
+ ---
135
+
136
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
137
+
138
+ ### ✅ SUCCESS:
139
+
140
+ - All library pairs analyzed for co-imports
141
+ - Integration types classified using pattern rules
142
+ - Hub libraries and cross-cutting patterns identified
143
+ - Integration graph built with confidence labels
144
+ - Graceful handling of zero integrations (not a failure)
145
+ - Auto-proceeded to step 06
146
+
147
+ ### ❌ SYSTEM FAILURE:
148
+
149
+ - Fabricating integrations not evidenced in code
150
+ - Not applying the 2+ file threshold for pairs
151
+ - Starting to compile SKILL.md (step 06's job)
152
+ - Treating zero integrations as a workflow failure (it's valid)
153
+
154
+ **Master Rule:** Only document integrations that exist in actual code. Zero integrations is a valid result.
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: 'step-06-compile-stack'
3
+ description: 'Compile SKILL.md with integration layer and present for user review'
4
+
5
+ nextStepFile: './step-07-generate-output.md'
6
+ stackSkillTemplate: '../data/stack-skill-template.md'
7
+ ---
8
+
9
+ # Step 6: Compile Stack Skill
10
+
11
+ ## STEP GOAL:
12
+
13
+ Assemble the main SKILL.md by combining per-library extractions with the integration layer, and present for user review before writing output files.
14
+
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 an integration architect operating in Ferris Architect mode
26
+ - ✅ The integration layer is the VALUE — not just concatenated library docs
27
+ - ✅ Zero hallucination — only include content backed by extraction evidence
28
+
29
+ ### Step-Specific Rules:
30
+
31
+ - 🎯 Compile SKILL.md following the stack-skill-template structure
32
+ - 🚫 FORBIDDEN to write output files — that is step 07
33
+ - 💬 Present compiled content for user review (Gate 2)
34
+ - 🎯 Integration patterns go FIRST — they are the primary value
35
+
36
+ ## EXECUTION PROTOCOLS:
37
+
38
+ - 🎯 Load stack-skill-template.md for section structure
39
+ - 💾 Store compiled skill_content as workflow state
40
+ - 📖 Wait for user review and approval before proceeding
41
+ - 🚫 FORBIDDEN to proceed without user confirming the compilation
42
+
43
+ ## CONTEXT BOUNDARIES:
44
+
45
+ - From step 04: per_library_extractions[] with exports, patterns, confidence
46
+ - From step 05: integration_graph with pairs, types, hub libraries, cross-cutting patterns
47
+ - This step produces: skill_content (compiled SKILL.md ready for writing)
48
+ - User interaction: Gate 2 — compile checkpoint required
49
+
50
+ ## MANDATORY SEQUENCE
51
+
52
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
53
+
54
+ ### 1. Load Template Structure
55
+
56
+ Load `{stackSkillTemplate}` and prepare SKILL.md section structure.
57
+
58
+ ### 2. Compile Integration Layer
59
+
60
+ **This is the core value of the stack skill.** Compile in order:
61
+
62
+ **Cross-cutting patterns** (if any):
63
+ - Patterns spanning 3+ libraries
64
+ - Middleware chains, shared configuration, common architectural patterns
65
+
66
+ **Library pair integrations:**
67
+ - For each detected integration pair from step 05:
68
+ - Type classification
69
+ - Pattern description with file:line citations
70
+ - Key files demonstrating the integration
71
+ - Confidence tier label
72
+
73
+ **Hub library connections:**
74
+ - For each hub library (3+ connections):
75
+ - Role in the stack architecture
76
+ - How it connects to partner libraries
77
+
78
+ ### 3. Compile Per-Library Sections
79
+
80
+ For each confirmed library (ordered by integration connectivity, then import count):
81
+
82
+ - Role in stack (one-line description)
83
+ - Key exports used in this project
84
+ - Usage patterns from extraction
85
+ - Confidence tier label
86
+ - Link to reference file: `./references/{library}.md`
87
+
88
+ ### 4. Compile Project Conventions
89
+
90
+ Extract project-specific conventions from the extractions:
91
+ - Common initialization patterns
92
+ - Error handling approaches across libraries
93
+ - Configuration conventions
94
+ - Import organization patterns
95
+
96
+ ### 5. Compile Library Reference Index
97
+
98
+ Create the reference index table:
99
+
100
+ | Library | Imports | Key Exports | Confidence | Reference |
101
+ |---------|---------|-------------|------------|-----------|
102
+ | ... | ... | ... | ... | ... |
103
+
104
+ ### 6. Present Compiled SKILL.md Preview
105
+
106
+ "**Stack skill compilation complete. Please review:**
107
+
108
+ ---
109
+
110
+ {Display full compiled SKILL.md content}
111
+
112
+ ---
113
+
114
+ **Compilation stats:**
115
+ - **Libraries:** {count}
116
+ - **Integration pairs:** {count}
117
+ - **Cross-cutting patterns:** {count}
118
+ - **Confidence:** T1: {count}, T1-low: {count}, T2: {count}
119
+
120
+ **Please review the integration layer and per-library sections.**
121
+ - Does the integration layer capture how your libraries connect?
122
+ - Are the per-library summaries accurate?
123
+ - Any sections to adjust before writing output?"
124
+
125
+ ### 7. Present MENU OPTIONS
126
+
127
+ Display: **Select:** [C] Continue to Output Generation
128
+
129
+ #### EXECUTION RULES:
130
+
131
+ - ALWAYS halt and wait for user input after presenting compilation
132
+ - ONLY proceed to next step when user approves and selects 'C'
133
+
134
+ #### Menu Handling Logic:
135
+
136
+ - IF C: Store skill_content, then load, read entire file, then execute {nextStepFile}
137
+ - IF Any other: Process as feedback, adjust compilation, redisplay preview, then [Redisplay Menu Options](#7-present-menu-options)
138
+
139
+ ---
140
+
141
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
142
+
143
+ ### ✅ SUCCESS:
144
+
145
+ - SKILL.md follows stack-skill-template structure
146
+ - Integration layer presented FIRST (primary value)
147
+ - All content includes confidence tier labels
148
+ - Per-library sections ordered by connectivity
149
+ - User reviewed and approved compilation
150
+ - skill_content stored for step 07
151
+
152
+ ### ❌ SYSTEM FAILURE:
153
+
154
+ - Integration layer missing or buried below library listings
155
+ - Content without confidence tier labels
156
+ - Proceeding without user review (Gate 2)
157
+ - Writing files in this step (step 07's job)
158
+ - Fabricating integration patterns not from step 05
159
+
160
+ **Master Rule:** Integration layer is the value. Present it first, get user approval before writing.