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,222 @@
1
+ ---
2
+ name: 'step-04-map-and-detect'
3
+ description: 'Map exports per unit and detect cross-unit integration points, flag stack skill candidates'
4
+
5
+ nextStepFile: './step-05-recommend.md'
6
+ outputFile: '{output_folder}/analyze-source-report-{project_name}.md'
7
+ heuristicsFile: '../data/unit-detection-heuristics.md'
8
+ ---
9
+
10
+ # Step 4: Map Exports and Detect Integrations
11
+
12
+ ## STEP GOAL:
13
+
14
+ To analyze each qualifying unit's export surface and import graph, detect cross-unit integration points, and flag potential stack skill candidates — completing the analysis foundation needed for recommendations.
15
+
16
+ ## MANDATORY EXECUTION RULES (READ FIRST):
17
+
18
+ ### Universal Rules:
19
+
20
+ - 🛑 NEVER generate content without user input
21
+ - 📖 CRITICAL: Read the complete step file before taking any action
22
+ - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
23
+ - 📋 YOU ARE A FACILITATOR, not a content generator
24
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
25
+ - ⚙️ 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
26
+
27
+ ### Role Reinforcement:
28
+
29
+ - ✅ You are a source code analyst and decomposition architect (Ferris Architect mode)
30
+ - ✅ If you already have been given a name, communication_style and identity, continue to use those while playing this new role
31
+ - ✅ Prescriptive precision — zero-hallucination, only report what is found
32
+ - ✅ File:line citation tracing — cite specific files and line numbers for all claims
33
+
34
+ ### Step-Specific Rules:
35
+
36
+ - 🎯 Use subprocess optimization (Pattern 2) — per-unit analysis for export mapping
37
+ - 💬 DO NOT BE LAZY — For EACH qualifying unit, perform thorough export surface analysis
38
+ - 🚫 FORBIDDEN to make recommendations in this step (that's step 05)
39
+ - 📋 Tier-aware depth: Quick (file-level exports), Forge (AST export analysis), Deep (AST + semantic relationships)
40
+
41
+ ## EXECUTION PROTOCOLS:
42
+
43
+ - 🎯 Follow the MANDATORY SEQUENCE exactly
44
+ - 💾 Append "## Export Map" and "## Integration Points" sections to {outputFile}
45
+ - 📖 Update stepsCompleted in {outputFile} frontmatter
46
+ - 🚫 FORBIDDEN to proceed without presenting findings to user
47
+
48
+ ## CONTEXT BOUNDARIES:
49
+
50
+ - Available: Identified Units section from report (qualifying units with paths, types, scope types, languages)
51
+ - Focus: Export surfaces, import graphs, and cross-unit integration patterns
52
+ - Limits: Do not recommend or filter units — present all findings objectively
53
+ - Dependencies: step-03-identify-units must have populated the Identified Units section
54
+
55
+ ## MANDATORY SEQUENCE
56
+
57
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
58
+
59
+ ### 1. Load Context
60
+
61
+ Read {outputFile} to obtain:
62
+ - Qualifying units from Identified Units section (names, paths, scope types, languages)
63
+ - `forge_tier` from frontmatter
64
+
65
+ Load {heuristicsFile} for stack skill candidate detection rules.
66
+
67
+ ### 2. Map Export Surfaces Per Unit
68
+
69
+ DO NOT BE LAZY — For EACH qualifying unit, launch a subprocess (or analyze in main thread) that:
70
+
71
+ 1. Scans the unit's directory for export/public interface files
72
+ 2. Counts and categorizes exports based on forge tier:
73
+ - **Quick tier:** Count files by type, identify index/barrel files, list directory structure
74
+ - **Forge tier:** Parse export statements, identify public API surface, count exported functions/classes/types
75
+ - **Deep tier:** All Forge analysis plus semantic relationship mapping between exports
76
+ 3. Returns structured findings to parent:
77
+ - Export count (files, functions, types, classes)
78
+ - Primary export patterns (barrel exports, direct exports, re-exports)
79
+ - Public API surface size estimate
80
+ - Key entry points
81
+
82
+ **Per-unit export summary:**
83
+
84
+ | Unit | Files | Exports | Export Pattern | API Surface |
85
+ |------|-------|---------|----------------|-------------|
86
+ | {name} | {count} | {count} | {pattern} | {small/medium/large} |
87
+
88
+ ### 3. Map Import Graph
89
+
90
+ For each qualifying unit, analyze inbound and outbound imports:
91
+
92
+ **Outbound imports (this unit imports from):**
93
+ - Which other qualifying units does it depend on?
94
+ - Which external dependencies does it use?
95
+
96
+ **Inbound imports (other units import from this):**
97
+ - Which other qualifying units consume this unit's exports?
98
+ - How many import sites exist?
99
+
100
+ **Build cross-reference matrix:**
101
+
102
+ | Unit | Imports From | Imported By | External Deps |
103
+ |------|-------------|-------------|---------------|
104
+ | {name} | {list units} | {list units} | {count} |
105
+
106
+ ### 4. Detect Integration Points
107
+
108
+ Identify cross-unit integration patterns:
109
+
110
+ **Direct integrations:**
111
+ - Unit A imports from Unit B → document the interface boundary
112
+ - Shared type definitions across units
113
+ - Cross-unit function calls
114
+
115
+ **For each integration point document:**
116
+ - Source unit → Target unit
117
+ - Integration type (import, shared types, API call, message passing, shared state)
118
+ - Files involved (with paths)
119
+ - Coupling strength (tight / loose / indirect)
120
+
121
+ ### 5. Flag Stack Skill Candidates
122
+
123
+ Using rules from {heuristicsFile}, check for stack skill indicators:
124
+
125
+ 1. **Co-import frequency:** Two or more units imported together in 3+ files
126
+ 2. **Integration adapter:** A unit exists primarily to bridge two other units
127
+ 3. **Shared state:** Multiple units read/write to the same data store
128
+ 4. **Orchestration layer:** A unit coordinates calls across multiple other units
129
+
130
+ **For each candidate, document:**
131
+ - Units involved
132
+ - Detection signal
133
+ - Recommended stack skill grouping
134
+ - Evidence (specific files/lines)
135
+
136
+ ### 6. Present Findings
137
+
138
+ "**Export Mapping and Integration Detection Complete**
139
+
140
+ **Export Map Summary:**
141
+ {Per-unit export summary table}
142
+
143
+ **Cross-Reference Matrix:**
144
+ {Import graph matrix}
145
+
146
+ **Integration Points:** {count}
147
+ {List each integration with source → target, type, coupling}
148
+
149
+ **Stack Skill Candidates:** {count}
150
+ {List each candidate with units involved and detection signal}
151
+
152
+ **Observations:**
153
+ - {Key architectural patterns observed}
154
+ - {Tightly coupled areas}
155
+ - {Loosely coupled areas ideal for independent skills}
156
+
157
+ Does this analysis look complete? Any integration patterns I should investigate further?"
158
+
159
+ Wait for user feedback. Adjust analysis based on user input.
160
+
161
+ ### 7. Append to Report
162
+
163
+ Append the complete "## Export Map" section to {outputFile}:
164
+ Replace `[Appended by step-04-map-and-detect]` under Export Map with:
165
+ - Per-unit export summary table
166
+ - Export pattern analysis
167
+
168
+ Append the complete "## Integration Points" section to {outputFile}:
169
+ Replace `[Appended by step-04-map-and-detect]` under Integration Points with:
170
+ - Cross-reference matrix
171
+ - Integration point details
172
+ - Stack skill candidate flags
173
+
174
+ Update {outputFile} frontmatter:
175
+ ```yaml
176
+ stepsCompleted: ['step-01-init', 'step-02-scan-project', 'step-03-identify-units', 'step-04-map-and-detect']
177
+ lastStep: 'step-04-map-and-detect'
178
+ stack_skill_candidates: [{list flagged candidate groupings}]
179
+ ```
180
+
181
+ ### 8. Present MENU OPTIONS
182
+
183
+ Display: "**Select:** [C] Continue to Recommendations"
184
+
185
+ #### Menu Handling Logic:
186
+
187
+ - IF C: Save findings to {outputFile}, update frontmatter, then load, read entire file, then execute {nextStepFile}
188
+ - IF Any other: help user, then [Redisplay Menu Options](#8-present-menu-options)
189
+
190
+ #### EXECUTION RULES:
191
+
192
+ - ALWAYS halt and wait for user input after presenting menu
193
+ - ONLY proceed to next step when user selects 'C'
194
+
195
+ ## CRITICAL STEP COMPLETION NOTE
196
+
197
+ ONLY WHEN both the Export Map and Integration Points sections have been appended to {outputFile} with complete findings, and frontmatter stepsCompleted and stack_skill_candidates have been updated, will you load and read fully {nextStepFile} to begin recommendations.
198
+
199
+ ---
200
+
201
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
202
+
203
+ ### ✅ SUCCESS:
204
+
205
+ - Every qualifying unit's export surface mapped with tier-appropriate depth
206
+ - Import graph built showing cross-unit dependencies
207
+ - Integration points documented with coupling strength
208
+ - Stack skill candidates flagged with evidence
209
+ - Findings presented to user for confirmation
210
+ - Report updated with both Export Map and Integration Points sections
211
+ - stepsCompleted and stack_skill_candidates updated in frontmatter
212
+
213
+ ### ❌ SYSTEM FAILURE:
214
+
215
+ - Skipping units during export analysis (DO NOT BE LAZY)
216
+ - Not building the cross-reference matrix
217
+ - Missing stack skill candidate detection
218
+ - Making recommendations in this step (that's step 05)
219
+ - Not citing specific files for integration points
220
+ - Not presenting findings for user confirmation
221
+
222
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,236 @@
1
+ ---
2
+ name: 'step-05-recommend'
3
+ description: 'Present unit recommendations with rationale for user confirmation or rejection'
4
+
5
+ nextStepFile: './step-06-generate-briefs.md'
6
+ outputFile: '{output_folder}/analyze-source-report-{project_name}.md'
7
+ schemaFile: '../data/skill-brief-schema.md'
8
+ advancedElicitationTask: '{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml'
9
+ partyModeWorkflow: '{project-root}/_bmad/core/workflows/party-mode/workflow.md'
10
+ ---
11
+
12
+ # Step 5: Recommend
13
+
14
+ ## STEP GOAL:
15
+
16
+ To present each qualifying unit as a recommendation with evidence-based rationale, allow the user to confirm, reject, or modify each recommendation, and build the confirmed units list that drives brief generation.
17
+
18
+ ## MANDATORY EXECUTION RULES (READ FIRST):
19
+
20
+ ### Universal Rules:
21
+
22
+ - 🛑 NEVER generate content without user input
23
+ - 📖 CRITICAL: Read the complete step file before taking any action
24
+ - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
25
+ - 📋 YOU ARE A FACILITATOR, not a content generator
26
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
27
+ - ⚙️ 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
28
+
29
+ ### Role Reinforcement:
30
+
31
+ - ✅ You are a source code analyst and decomposition architect (Ferris Architect mode)
32
+ - ✅ If you already have been given a name, communication_style and identity, continue to use those while playing this new role
33
+ - ✅ Prescriptive precision — zero-hallucination, every recommendation backed by evidence
34
+ - ✅ This is the COLLABORATIVE GATE — user must explicitly confirm each unit
35
+
36
+ ### Step-Specific Rules:
37
+
38
+ - 🎯 This is the primary user decision point — do NOT rush through it
39
+ - 🚫 FORBIDDEN to proceed without explicit confirmation for each unit
40
+ - 💬 Present evidence for each recommendation, invite questions and pushback
41
+ - 📋 User can ask "why?" for any recommendation — explain with specific file citations
42
+
43
+ ## EXECUTION PROTOCOLS:
44
+
45
+ - 🎯 Follow the MANDATORY SEQUENCE exactly
46
+ - 💾 Append "## Recommendations" section to {outputFile}
47
+ - 📖 Update stepsCompleted and confirmed_units in {outputFile} frontmatter
48
+ - 🚫 FORBIDDEN to generate briefs in this step (that's step 06)
49
+
50
+ ## CONTEXT BOUNDARIES:
51
+
52
+ - Available: Full report — Project Scan, Identified Units, Export Map, Integration Points
53
+ - Focus: Presenting evidence-based recommendations and capturing user decisions
54
+ - Limits: Do not generate skill-brief.yaml files — only confirm which units to brief
55
+ - Dependencies: steps 02-04 must have populated scan, units, exports, and integrations
56
+
57
+ ## MANDATORY SEQUENCE
58
+
59
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
60
+
61
+ ### 1. Load Context
62
+
63
+ Read {outputFile} completely to obtain:
64
+ - Qualifying units from Identified Units
65
+ - Export map data per unit
66
+ - Integration points and coupling analysis
67
+ - Stack skill candidates from frontmatter
68
+ - Existing skills from frontmatter
69
+
70
+ Load {schemaFile} for reference on what skill-brief.yaml requires (so recommendations are actionable).
71
+
72
+ ### 2. Build Recommendation Cards
73
+
74
+ For EACH qualifying unit, prepare a recommendation card:
75
+
76
+ ```
77
+ **Unit: {name}**
78
+ - Path: {path}
79
+ - Language: {language}
80
+ - Boundary: {type} | Scope: {scope_type}
81
+ - Exports: {count} ({pattern})
82
+ - API Surface: {size}
83
+ - Integrations: imports from {list}, imported by {list}
84
+ - Coupling: {tight/loose/indirect}
85
+ - Confidence: {high/medium/low}
86
+ - Stack Skill: {yes — grouped with {units} / no}
87
+ - Status: {new / already-skilled → recommend update-skill}
88
+
89
+ **Rationale:** {2-3 sentences explaining WHY this should be a skill, citing specific detection signals and file paths}
90
+
91
+ **Proposed Brief Fields:**
92
+ - name: {suggested kebab-case name}
93
+ - scope.type: {full-library / specific-modules / public-api}
94
+ - scope.include: {suggested glob patterns}
95
+ - description: {suggested 1-3 sentence description}
96
+ ```
97
+
98
+ ### 3. Present Recommendations
99
+
100
+ "**Recommendations for {project_name}**
101
+
102
+ I've analyzed {count} qualifying units. Here are my recommendations for skill creation:
103
+
104
+ ---"
105
+
106
+ Present each recommendation card, then after ALL cards:
107
+
108
+ "---
109
+
110
+ **Summary:**
111
+ - **Recommended for new skills:** {count}
112
+ - **Already-skilled (recommend update-skill):** {count}
113
+ - **Stack skill candidates:** {count}
114
+
115
+ **For each unit above, please indicate:**
116
+ - **Y** — Confirm: generate skill-brief.yaml
117
+ - **N** — Reject: skip this unit
118
+ - **M** — Modify: adjust name, scope, or description before confirming
119
+
120
+ You can respond with a list (e.g., '1:Y, 2:Y, 3:N, 4:M') or address each individually.
121
+
122
+ **Questions?** Ask 'why?' about any recommendation and I'll explain my reasoning with specific evidence."
123
+
124
+ ### 4. Process User Decisions
125
+
126
+ For each unit:
127
+
128
+ **IF Y (Confirm):**
129
+ - Add to confirmed_units list with proposed brief fields
130
+
131
+ **IF N (Reject):**
132
+ - Document rejection with user's reason (if provided)
133
+ - Remove from confirmed list
134
+
135
+ **IF M (Modify):**
136
+ - Ask what to modify (name, scope, description, scope.include patterns)
137
+ - Update the recommendation with user changes
138
+ - Confirm the modified version
139
+
140
+ **Continue until ALL units have a decision (Y/N/M).**
141
+
142
+ ### 5. Confirm Stack Skill Candidates
143
+
144
+ If stack skill candidates were flagged:
145
+
146
+ "**Stack Skill Candidates:**
147
+
148
+ The following unit groupings show strong co-integration patterns and may benefit from a consolidated stack skill via create-stack-skill:
149
+
150
+ {For each candidate: list units, detection signal, evidence}
151
+
152
+ Would you like to flag these for create-stack-skill? (Y/N per candidate)"
153
+
154
+ Document decisions.
155
+
156
+ ### 6. Present Final Confirmation
157
+
158
+ "**Confirmed Units for Brief Generation:** {count}
159
+
160
+ {List each confirmed unit with final name, scope type, and description}
161
+
162
+ **Rejected Units:** {count}
163
+ {List with reasons}
164
+
165
+ **Stack Skill Flags:** {count}
166
+ {List groupings flagged for create-stack-skill}
167
+
168
+ **This is your final confirmation before I generate skill-brief.yaml files.** All confirmed?"
169
+
170
+ Wait for explicit final confirmation.
171
+
172
+ ### 7. Append to Report
173
+
174
+ Append the complete "## Recommendations" section to {outputFile}:
175
+
176
+ Replace `[Appended by step-05-recommend]` with:
177
+ - All recommendation cards (including rationale)
178
+ - User decisions per unit (confirmed/rejected/modified)
179
+ - Stack skill candidate decisions
180
+ - Final confirmation status
181
+
182
+ Update {outputFile} frontmatter:
183
+ ```yaml
184
+ stepsCompleted: ['step-01-init', 'step-02-scan-project', 'step-03-identify-units', 'step-04-map-and-detect', 'step-05-recommend']
185
+ lastStep: 'step-05-recommend'
186
+ confirmed_units: [{list of confirmed unit names}]
187
+ stack_skill_candidates: [{updated list with user decisions}]
188
+ ```
189
+
190
+ ### 8. Present MENU OPTIONS
191
+
192
+ Display: "**Select an Option:** [A] Advanced Elicitation [P] Party Mode [C] Continue to Brief Generation"
193
+
194
+ #### Menu Handling Logic:
195
+
196
+ - IF A: Execute {advancedElicitationTask}, and when finished redisplay the menu
197
+ - IF P: Execute {partyModeWorkflow}, and when finished redisplay the menu
198
+ - IF C: Save recommendations to {outputFile}, update frontmatter, then load, read entire file, then execute {nextStepFile}
199
+ - IF Any other comments or queries: help user respond then [Redisplay Menu Options](#8-present-menu-options)
200
+
201
+ #### EXECUTION RULES:
202
+
203
+ - ALWAYS halt and wait for user input after presenting menu
204
+ - ONLY proceed to next step when user selects 'C'
205
+ - After other menu items execution, return to this menu
206
+ - User can chat or ask questions — always respond and then redisplay menu
207
+
208
+ ## CRITICAL STEP COMPLETION NOTE
209
+
210
+ ONLY WHEN all units have explicit user decisions (Y/N/M), the confirmed_units list is finalized in frontmatter, and the user has given final confirmation, will you load and read fully {nextStepFile} to begin brief generation.
211
+
212
+ ---
213
+
214
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
215
+
216
+ ### ✅ SUCCESS:
217
+
218
+ - Every qualifying unit presented with evidence-based recommendation
219
+ - User explicitly decided on each unit (Y/N/M)
220
+ - Modifications captured and confirmed
221
+ - Stack skill candidates addressed
222
+ - Already-skilled units directed to update-skill
223
+ - Final confirmation obtained before proceeding
224
+ - Report updated with complete Recommendations section
225
+ - confirmed_units populated in frontmatter
226
+
227
+ ### ❌ SYSTEM FAILURE:
228
+
229
+ - Auto-confirming units without user decision
230
+ - Not presenting evidence/rationale for recommendations
231
+ - Skipping the final confirmation
232
+ - Generating skill-brief.yaml files in this step (that's step 06)
233
+ - Not documenting rejection reasons
234
+ - Proceeding with empty confirmed_units list without user acknowledgment
235
+
236
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,239 @@
1
+ ---
2
+ name: 'step-06-generate-briefs'
3
+ description: 'Generate skill-brief.yaml per confirmed unit, write analysis summary, recommend next workflow'
4
+
5
+ outputFile: '{output_folder}/analyze-source-report-{project_name}.md'
6
+ schemaFile: '../data/skill-brief-schema.md'
7
+ ---
8
+
9
+ # Step 6: Generate Briefs
10
+
11
+ ## STEP GOAL:
12
+
13
+ To generate a valid skill-brief.yaml file for each confirmed unit using the schema, write the files to the forge data folder, append generation results to the analysis report, and recommend the appropriate next workflow for each unit — completing the analyze-source workflow.
14
+
15
+ ## MANDATORY EXECUTION RULES (READ FIRST):
16
+
17
+ ### Universal Rules:
18
+
19
+ - 🛑 NEVER generate content without user input
20
+ - 📖 CRITICAL: Read the complete step file before taking any action
21
+ - 📋 YOU ARE A FACILITATOR, not a content generator
22
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
23
+ - ⚙️ 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
24
+
25
+ ### Role Reinforcement:
26
+
27
+ - ✅ You are a source code analyst and decomposition architect (Ferris Architect mode)
28
+ - ✅ If you already have been given a name, communication_style and identity, continue to use those while playing this new role
29
+ - ✅ Prescriptive precision — zero-hallucination, every brief field backed by evidence from prior steps
30
+ - ✅ This is the GENERATION step — produce files that are immediately consumable by downstream workflows
31
+
32
+ ### Step-Specific Rules:
33
+
34
+ - 🎯 Generate ONLY for units in confirmed_units — no extras, no omissions
35
+ - 🚫 FORBIDDEN to modify recommendations or re-ask for confirmations (that was step 05)
36
+ - 💬 Every generated field must trace back to data collected in steps 02-05
37
+ - 📋 Validate each brief against the schema before writing
38
+
39
+ ## EXECUTION PROTOCOLS:
40
+
41
+ - 🎯 Follow the MANDATORY SEQUENCE exactly
42
+ - 💾 Write skill-brief.yaml files to `{forge_data_folder}/{unit-name}/`
43
+ - 💾 Append "## Generation Results" section to {outputFile}
44
+ - 📖 Update stepsCompleted and mark workflow COMPLETE in {outputFile} frontmatter
45
+ - 🚫 FORBIDDEN to skip validation of generated briefs
46
+
47
+ ## CONTEXT BOUNDARIES:
48
+
49
+ - Available: Full report — all sections from steps 02-05, confirmed_units list, stack_skill_candidates
50
+ - Focus: YAML generation, file writing, downstream workflow recommendation
51
+ - Limits: Do not re-analyze source code — use only data already captured in the report
52
+ - Dependencies: step-05-recommend must have populated confirmed_units with at least one entry
53
+
54
+ ## MANDATORY SEQUENCE
55
+
56
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
57
+
58
+ ### 1. Load Context
59
+
60
+ Read {outputFile} completely to obtain:
61
+ - `confirmed_units` from frontmatter (names of units approved in step 05)
62
+ - `project_path`, `forge_tier`, `user_name`, `forge_data_folder` from frontmatter
63
+ - Recommendation cards from "## Recommendations" section (proposed brief fields per unit)
64
+ - Export map and integration data from prior sections
65
+
66
+ Load {schemaFile} for validation reference.
67
+
68
+ **Guard clause:** If `confirmed_units` is empty, present:
69
+ "**No confirmed units to generate briefs for.** The analysis is complete with no skill briefs produced. Run analyze-source again with different scope or parameters if needed."
70
+ Mark workflow complete and halt.
71
+
72
+ ### 2. Generate Skill-Brief YAML Per Unit
73
+
74
+ For EACH unit in `confirmed_units`, construct a skill-brief.yaml using:
75
+
76
+ **Field mapping:**
77
+
78
+ | Field | Source |
79
+ |-------|--------|
80
+ | name | Confirmed name from step 05 recommendation card |
81
+ | version | `1.0.0` (default for new briefs) |
82
+ | source_repo | `{project_path}` from frontmatter |
83
+ | language | Primary language detected in step 03 |
84
+ | scope.type | Scope type from step 05 recommendation card |
85
+ | scope.include | Include patterns from step 05 recommendation card |
86
+ | scope.exclude | Inferred from heuristics (test files, generated code) |
87
+ | scope.notes | Rationale from step 05 recommendation card |
88
+ | description | Description from step 05 recommendation card |
89
+ | forge_tier | `{forge_tier}` from frontmatter |
90
+ | created | Current date (ISO format YYYY-MM-DD) |
91
+ | created_by | `{user_name}` from frontmatter |
92
+
93
+ ### 3. Validate Each Brief
94
+
95
+ For each generated brief, check against {schemaFile} validation rules:
96
+
97
+ 1. **Name uniqueness** — no duplicate names within the batch or existing skills
98
+ 2. **Source accessible** — project_path exists
99
+ 3. **Language recognized** — valid programming language identifier
100
+ 4. **Scope type valid** — matches `full-library`, `specific-modules`, or `public-api`
101
+ 5. **Include patterns** — at least one glob pattern present
102
+ 6. **Forge tier match** — matches forge_tier from config
103
+
104
+ **If validation fails for any brief:**
105
+ - Document the failure with specific field and reason
106
+ - Present to user for correction before writing
107
+ - Do NOT write invalid briefs
108
+
109
+ ### 4. Present Generation Preview
110
+
111
+ "**Skill Brief Generation Preview**
112
+
113
+ **Units to generate:** {count}
114
+
115
+ {For each unit:}
116
+ ---
117
+ **{unit-name}** → `{forge_data_folder}/{unit-name}/skill-brief.yaml`
118
+ ```yaml
119
+ {complete YAML content}
120
+ ```
121
+ ---
122
+
123
+ **Validation:** {all passed / N issues found}
124
+ {List any validation issues}
125
+
126
+ **Ready to write {count} skill-brief.yaml files.** Confirm to proceed? (Y to write / N to abort / M to modify a specific brief)"
127
+
128
+ Wait for explicit user confirmation before writing files.
129
+
130
+ ### 5. Write Files
131
+
132
+ **IF user confirms (Y):**
133
+
134
+ For each confirmed brief:
135
+ 1. Create directory `{forge_data_folder}/{unit-name}/` if it does not exist
136
+ 2. Write `skill-brief.yaml` to `{forge_data_folder}/{unit-name}/skill-brief.yaml`
137
+ 3. Verify file was written successfully
138
+
139
+ **IF user modifies (M):**
140
+ - Ask which brief and what to change
141
+ - Update the YAML, re-validate, present again
142
+ - Return to confirmation prompt
143
+
144
+ **IF user aborts (N):**
145
+ - Document abort decision
146
+ - Skip file writing, proceed to report update
147
+
148
+ ### 6. Determine Next Workflow Per Unit
149
+
150
+ For each generated brief, recommend the appropriate next workflow:
151
+
152
+ | Condition | Recommendation |
153
+ |-----------|---------------|
154
+ | Brief has `scope.type: full-library` and unit is well-bounded | create-skill — brief is sufficient for direct skill creation |
155
+ | Brief has `scope.type: specific-modules` or scope needs refinement | brief-skill — refine scope before creating skill |
156
+ | Brief has `scope.type: public-api` or complex interface | brief-skill — detailed scoping needed |
157
+ | Unit flagged as stack skill candidate | create-stack-skill — after individual skills exist |
158
+ | Unit flagged as already-skilled | update-skill — refresh existing skill |
159
+
160
+ ### 7. Append to Report
161
+
162
+ Append the complete "## Generation Results" section to {outputFile}:
163
+
164
+ Replace `[Appended by step-06-generate-briefs]` with:
165
+
166
+ **Generated Briefs:**
167
+ | # | Unit Name | Output Path | Validation | Next Workflow |
168
+ |---|-----------|-------------|------------|---------------|
169
+ | {n} | {name} | {path} | {pass/fail} | {recommendation} |
170
+
171
+ **Generation Summary:**
172
+ - Total confirmed units: {count}
173
+ - Briefs generated: {count}
174
+ - Briefs skipped/failed: {count}
175
+ - Stack skill candidates flagged: {count}
176
+
177
+ **Next Steps:**
178
+ {For each next workflow recommendation, a clear action item}
179
+
180
+ Update {outputFile} frontmatter:
181
+ ```yaml
182
+ stepsCompleted: ['step-01-init', 'step-02-scan-project', 'step-03-identify-units', 'step-04-map-and-detect', 'step-05-recommend', 'step-06-generate-briefs']
183
+ lastStep: 'step-06-generate-briefs'
184
+ nextWorkflow: '{primary recommendation}'
185
+ ```
186
+
187
+ ### 8. Present Completion Summary
188
+
189
+ "**Analyze-Source Workflow Complete**
190
+
191
+ **Project:** {project_name}
192
+ **Forge Tier:** {forge_tier}
193
+
194
+ **Results:**
195
+ - **Scanned:** {boundary count} boundaries detected
196
+ - **Identified:** {unit count} qualifying units classified
197
+ - **Confirmed:** {confirmed count} units approved for brief generation
198
+ - **Generated:** {brief count} skill-brief.yaml files written
199
+
200
+ **Files Created:**
201
+ {List each skill-brief.yaml with full path}
202
+
203
+ **Analysis Report:** {outputFile}
204
+
205
+ **Recommended Next Steps:**
206
+ {For each unit, the recommended next workflow with brief explanation}
207
+
208
+ {If stack skill candidates exist:}
209
+ **Stack Skill Candidates:**
210
+ {List candidates with recommendation to run create-stack-skill after individual skills are created}
211
+
212
+ **This analysis is complete.** To refine any brief, run the recommended next workflow. To re-analyze with different scope, run analyze-source again."
213
+
214
+ ---
215
+
216
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
217
+
218
+ ### ✅ SUCCESS:
219
+
220
+ - Every confirmed unit has a skill-brief.yaml generated and validated
221
+ - All 9 required schema fields present and valid in each brief
222
+ - Files written to correct paths in forge_data_folder
223
+ - User confirmed before files were written
224
+ - Next workflow recommended per unit
225
+ - Generation Results section appended to report
226
+ - stepsCompleted fully populated and workflow marked complete
227
+ - Completion summary presented with clear next steps
228
+
229
+ ### ❌ SYSTEM FAILURE:
230
+
231
+ - Generating briefs for units NOT in confirmed_units
232
+ - Writing files without user confirmation
233
+ - Missing required schema fields in generated YAML
234
+ - Not validating briefs against schema before writing
235
+ - Re-analyzing source code instead of using report data
236
+ - Not recommending next workflow per unit
237
+ - Not marking workflow as complete in frontmatter
238
+
239
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.