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,144 @@
1
+ ---
2
+ name: 'step-01b-continue'
3
+ description: 'Handle workflow continuation from previous session'
4
+
5
+ outputFile: '{output_folder}/analyze-source-report-{project_name}.md'
6
+ nextStepOptions:
7
+ step-02: './step-02-scan-project.md'
8
+ step-03: './step-03-identify-units.md'
9
+ step-04: './step-04-map-and-detect.md'
10
+ step-05: './step-05-recommend.md'
11
+ step-06: './step-06-generate-briefs.md'
12
+ ---
13
+
14
+ # Step 1b: Continue Analysis
15
+
16
+ ## STEP GOAL:
17
+
18
+ To resume the analyze-source workflow from where it was left off in a previous session by reading the analysis report's progress state and routing to the correct next step.
19
+
20
+ ## MANDATORY EXECUTION RULES (READ FIRST):
21
+
22
+ ### Universal Rules:
23
+
24
+ - 🛑 NEVER generate content without user input
25
+ - 📖 CRITICAL: Read the complete step file before taking any action
26
+ - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
27
+ - 📋 YOU ARE A FACILITATOR, not a content generator
28
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
29
+ - ⚙️ 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
30
+
31
+ ### Role Reinforcement:
32
+
33
+ - ✅ You are a source code analyst and decomposition architect (Ferris Architect mode)
34
+ - ✅ If you already have been given a name, communication_style and identity, continue to use those while playing this new role
35
+ - ✅ Prescriptive precision — resume exactly where we left off
36
+
37
+ ### Step-Specific Rules:
38
+
39
+ - 🎯 Focus only on reading state and routing — do NOT perform any analysis
40
+ - 🚫 FORBIDDEN to re-run completed steps
41
+ - 💬 Present progress summary to user before resuming
42
+
43
+ ## EXECUTION PROTOCOLS:
44
+
45
+ - 🎯 Follow the MANDATORY SEQUENCE exactly
46
+ - 💾 Update lastContinued in output frontmatter
47
+ - 📖 Route to the correct next step based on stepsCompleted
48
+ - 🚫 FORBIDDEN to skip the progress summary
49
+
50
+ ## CONTEXT BOUNDARIES:
51
+
52
+ - Available: Existing analysis report with stepsCompleted array
53
+ - Focus: State detection and routing only
54
+ - Limits: Do not modify any existing report content
55
+ - Dependencies: Output file must exist with valid stepsCompleted
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. Welcome Back
62
+
63
+ "**Welcome back!** Let me check where we left off with the source analysis..."
64
+
65
+ ### 2. Read Progress State
66
+
67
+ Load {outputFile} and read frontmatter:
68
+ - `stepsCompleted` array
69
+ - `project_path`
70
+ - `project_name`
71
+ - `forge_tier`
72
+ - `existing_skills`
73
+ - `confirmed_units`
74
+
75
+ ### 3. Present Progress Summary
76
+
77
+ "**Analysis Progress for {project_name}:**
78
+
79
+ **Project:** {project_path}
80
+ **Forge Tier:** {forge_tier}
81
+ **Steps Completed:** {list stepsCompleted}
82
+ **Last Step:** {last entry in stepsCompleted}
83
+
84
+ **Progress:**
85
+ {For each completed step, summarize what was accomplished — read the relevant sections from the report}"
86
+
87
+ ### 4. Determine Next Step
88
+
89
+ Map the last completed step to the next step file:
90
+
91
+ | Last Completed | Next Step |
92
+ |----------------|-----------|
93
+ | step-01-init | step-02-scan-project |
94
+ | step-02-scan-project | step-03-identify-units |
95
+ | step-03-identify-units | step-04-map-and-detect |
96
+ | step-04-map-and-detect | step-05-recommend |
97
+ | step-05-recommend | step-06-generate-briefs |
98
+
99
+ **IF all steps completed:**
100
+ "**This analysis appears to be complete.** All steps have been finished. Would you like to start a new analysis?"
101
+
102
+ ### 5. Update and Route
103
+
104
+ Update {outputFile} frontmatter:
105
+ ```yaml
106
+ lastContinued: '{current_date}'
107
+ ```
108
+
109
+ "**Resuming from {next_step_name}...**"
110
+
111
+ #### Menu Handling Logic:
112
+
113
+ - After progress is confirmed, immediately load, read entire file, then execute the appropriate step from {nextStepOptions}
114
+
115
+ #### EXECUTION RULES:
116
+
117
+ - This is an auto-proceed continuation step
118
+ - Route directly to the next incomplete step
119
+
120
+ ## CRITICAL STEP COMPLETION NOTE
121
+
122
+ ONLY WHEN the progress state has been read, summarized to the user, and lastContinued updated will you load the appropriate next step file to resume the workflow.
123
+
124
+ ---
125
+
126
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
127
+
128
+ ### ✅ SUCCESS:
129
+
130
+ - Analysis report loaded and progress state read
131
+ - Progress summary presented to user
132
+ - Correct next step identified from stepsCompleted
133
+ - lastContinued updated in frontmatter
134
+ - Routed to correct step file
135
+
136
+ ### ❌ SYSTEM FAILURE:
137
+
138
+ - Not reading stepsCompleted from report
139
+ - Skipping progress summary
140
+ - Routing to wrong step
141
+ - Re-running already completed steps
142
+ - Not updating lastContinued
143
+
144
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,208 @@
1
+ ---
2
+ name: 'step-02-scan-project'
3
+ description: 'Map project structure, detect service boundaries, and identify package manifests'
4
+
5
+ nextStepFile: './step-03-identify-units.md'
6
+ outputFile: '{output_folder}/analyze-source-report-{project_name}.md'
7
+ heuristicsFile: '../data/unit-detection-heuristics.md'
8
+ ---
9
+
10
+ # Step 2: Scan Project
11
+
12
+ ## STEP GOAL:
13
+
14
+ To map the complete project structure by scanning directory trees, detecting service boundaries, identifying package manifests, and cataloging entry points — building the foundation that subsequent steps use for unit identification.
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 for all claims
33
+
34
+ ### Step-Specific Rules:
35
+
36
+ - 🎯 Focus only on structural scanning — do NOT classify units or map exports yet
37
+ - 🚫 FORBIDDEN to read source file contents beyond manifest files and entry points
38
+ - 💬 Use subprocess optimization (Pattern 1) for scanning across many files
39
+ - 📋 Tier-aware scanning depth: Quick (file structure only), Forge (+ manifest parsing), Deep (+ config analysis)
40
+
41
+ ## EXECUTION PROTOCOLS:
42
+
43
+ - 🎯 Follow the MANDATORY SEQUENCE exactly
44
+ - 💾 Append "## Project Scan" section to {outputFile}
45
+ - 📖 Update stepsCompleted in {outputFile} frontmatter
46
+ - 🚫 FORBIDDEN to proceed without presenting scan results to user
47
+
48
+ ## CONTEXT BOUNDARIES:
49
+
50
+ - Available: project_path, forge_tier, scope_hints, existing_skills from report frontmatter
51
+ - Focus: Project structure mapping only — directory tree, manifests, entry points, service configs
52
+ - Limits: Do not analyze exports, imports, or integration points (that's steps 03-04)
53
+ - Dependencies: step-01-init must have created the report with valid project_path
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} frontmatter to obtain:
62
+ - `project_path` — the root to scan
63
+ - `forge_tier` — determines scanning depth
64
+ - Scope hints (if any were provided in step 01)
65
+
66
+ Load {heuristicsFile} for reference on detection signals.
67
+
68
+ ### 2. Scan Directory Structure
69
+
70
+ Launch a subprocess that scans the project directory structure:
71
+
72
+ 1. Map the top-level directory tree (2-3 levels deep)
73
+ 2. Identify workspace configuration files (pnpm-workspace.yaml, lerna.json, Cargo.toml [workspace], go.work, etc.)
74
+ 3. Find all package manifests (package.json, Cargo.toml, go.mod, requirements.txt, pyproject.toml, build.gradle, pom.xml)
75
+ 4. Locate entry point files (index.ts, main.ts, app.ts, main.go, main.rs, __init__.py, etc.)
76
+ 5. Detect service configuration (Dockerfile, docker-compose.yml, kubernetes manifests, serverless.yml)
77
+ 6. Return structured findings — file paths and types only, not contents
78
+
79
+ **If subprocess unavailable:** Perform directory scanning in main thread using file I/O tools.
80
+
81
+ **Apply scope hints if provided:**
82
+ - If specific directories were given, scan only those
83
+ - If exclusion patterns were given, skip matching directories
84
+
85
+ ### 3. Detect Service Boundaries
86
+
87
+ Based on scan results, identify potential service boundaries:
88
+
89
+ **Strong boundary signals:**
90
+ - Independent package manifest (own package.json, Cargo.toml, etc.)
91
+ - Docker/container configuration
92
+ - Separate entry point file
93
+ - Workspace member listing
94
+
95
+ **Document each detected boundary with:**
96
+ - Path relative to project root
97
+ - Boundary type (service / package / module)
98
+ - Detection signals found (list specific files)
99
+ - Confidence level (strong / moderate / weak)
100
+
101
+ ### 4. Catalog Manifests and Entry Points
102
+
103
+ Create a structured catalog:
104
+
105
+ **Manifests found:**
106
+ | Path | Type | Language Indicator |
107
+ |------|------|-------------------|
108
+ | {path} | {manifest_type} | {language} |
109
+
110
+ **Entry points found:**
111
+ | Path | Type |
112
+ |------|------|
113
+ | {path} | {entry_type} |
114
+
115
+ **Service configurations found:**
116
+ | Path | Type |
117
+ |------|------|
118
+ | {path} | {config_type} |
119
+
120
+ ### 5. Present Scan Results
121
+
122
+ "**Project Scan Complete**
123
+
124
+ **Project:** {project_path}
125
+ **Forge Tier:** {forge_tier}
126
+
127
+ **Structure Overview:**
128
+ {top-level directory tree}
129
+
130
+ **Detected Boundaries:** {count}
131
+ {list each boundary with path, type, confidence}
132
+
133
+ **Manifests Found:** {count}
134
+ {summary table}
135
+
136
+ **Entry Points Found:** {count}
137
+ {summary table}
138
+
139
+ **Service Configurations:** {count}
140
+ {summary table}
141
+
142
+ **Scope Applied:** {hints or 'Full project scan'}
143
+
144
+ Does this scan look complete? Any directories I should investigate further or skip?"
145
+
146
+ Wait for user feedback. If user identifies gaps, rescan as directed.
147
+
148
+ ### 6. Append to Report
149
+
150
+ Append the complete "## Project Scan" section to {outputFile}:
151
+
152
+ Replace the placeholder `[Appended by step-02-scan-project]` with the full scan results including:
153
+ - Structure overview
154
+ - Detected boundaries table
155
+ - Manifests catalog
156
+ - Entry points catalog
157
+ - Service configurations catalog
158
+ - Scope notes
159
+
160
+ Update {outputFile} frontmatter:
161
+ ```yaml
162
+ stepsCompleted: ['step-01-init', 'step-02-scan-project']
163
+ lastStep: 'step-02-scan-project'
164
+ ```
165
+
166
+ ### 7. Present MENU OPTIONS
167
+
168
+ Display: "**Select:** [C] Continue to Unit Identification"
169
+
170
+ #### Menu Handling Logic:
171
+
172
+ - IF C: Save scan results to {outputFile}, update frontmatter, then load, read entire file, then execute {nextStepFile}
173
+ - IF Any other: help user, then [Redisplay Menu Options](#7-present-menu-options)
174
+
175
+ #### EXECUTION RULES:
176
+
177
+ - ALWAYS halt and wait for user input after presenting menu
178
+ - ONLY proceed to next step when user selects 'C'
179
+
180
+ ## CRITICAL STEP COMPLETION NOTE
181
+
182
+ ONLY WHEN the Project Scan section has been appended to {outputFile} with complete boundary, manifest, and entry point catalogs, and frontmatter stepsCompleted has been updated, will you load and read fully {nextStepFile} to begin unit identification.
183
+
184
+ ---
185
+
186
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
187
+
188
+ ### ✅ SUCCESS:
189
+
190
+ - Complete directory structure mapped
191
+ - All package manifests found and cataloged
192
+ - Entry points identified
193
+ - Service boundaries detected with confidence levels
194
+ - Scope hints applied correctly
195
+ - Results presented to user for confirmation
196
+ - Report updated with Project Scan section
197
+ - stepsCompleted updated in frontmatter
198
+
199
+ ### ❌ SYSTEM FAILURE:
200
+
201
+ - Incomplete directory scan (missing subdirectories)
202
+ - Not detecting workspace configuration files
203
+ - Reading source file contents (only manifests/configs allowed)
204
+ - Not presenting results for user confirmation
205
+ - Classifying units in this step (that's step 03)
206
+ - Hardcoded paths instead of using frontmatter variables
207
+
208
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,199 @@
1
+ ---
2
+ name: 'step-03-identify-units'
3
+ description: 'Classify discrete skillable units from scan results using detection heuristics and assign scope types'
4
+
5
+ nextStepFile: './step-04-map-and-detect.md'
6
+ outputFile: '{output_folder}/analyze-source-report-{project_name}.md'
7
+ heuristicsFile: '../data/unit-detection-heuristics.md'
8
+ ---
9
+
10
+ # Step 3: Identify Units
11
+
12
+ ## STEP GOAL:
13
+
14
+ To classify each detected boundary from the project scan into discrete skillable units by applying detection heuristics, assigning boundary types and scope types, and filtering out disqualified candidates.
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 detection signals with specific file paths
33
+
34
+ ### Step-Specific Rules:
35
+
36
+ - 🎯 Focus only on unit classification — do NOT map exports or integration points yet
37
+ - 🚫 FORBIDDEN to generate skill-brief.yaml in this step
38
+ - 💬 Apply heuristics systematically to each detected boundary
39
+ - 📋 Every classification must cite the detection signals that justify it
40
+
41
+ ## EXECUTION PROTOCOLS:
42
+
43
+ - 🎯 Follow the MANDATORY SEQUENCE exactly
44
+ - 💾 Append "## Identified Units" section to {outputFile}
45
+ - 📖 Update stepsCompleted in {outputFile} frontmatter
46
+ - 🚫 FORBIDDEN to proceed without presenting classifications to user
47
+
48
+ ## CONTEXT BOUNDARIES:
49
+
50
+ - Available: Project Scan section from report (boundaries, manifests, entry points, configs)
51
+ - Focus: Classification of boundaries into skillable units with scope types
52
+ - Limits: Do not analyze file contents beyond what's needed for classification
53
+ - Dependencies: step-02-scan-project must have populated the Project Scan 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
+ - Project Scan results (detected boundaries, manifests, entry points)
63
+ - `forge_tier` from frontmatter
64
+ - `existing_skills` from frontmatter
65
+
66
+ Load {heuristicsFile} for classification rules.
67
+
68
+ ### 2. Apply Detection Heuristics
69
+
70
+ For EACH detected boundary from the scan:
71
+
72
+ **Step A — Count detection signals:**
73
+ - Check strong signals (independent manifest, separate entry point, Docker config, distinct export surface, workspace member)
74
+ - Check moderate signals (directory depth, naming convention, separate tests, README, CI/CD reference)
75
+ - Check weak signals (large directory, comment boundaries, import clustering)
76
+
77
+ **Step B — Classify boundary type:**
78
+ - Service Boundary — independent deployable unit
79
+ - Package Boundary — workspace member or independently versioned
80
+ - Module Boundary — logical grouping within a package
81
+ - Library Boundary — third-party with significant project-specific usage
82
+
83
+ **Step C — Assign scope type:**
84
+ - `full-library` — entire codebase of the unit
85
+ - `specific-modules` — selected components or packages
86
+ - `public-api` — only exported interfaces
87
+
88
+ **Step D — Check disqualification rules:**
89
+ - Too small (fewer than 3 source files or 100 lines)
90
+ - Generated code
91
+ - Pure configuration
92
+ - Test-only
93
+ - Vendor/dependency copy
94
+ - Already skilled (exists in existing_skills list)
95
+
96
+ ### 3. Build Unit Classification Table
97
+
98
+ For each candidate that passes disqualification:
99
+
100
+ | # | Unit Name | Path | Boundary Type | Scope Type | Signals | Confidence | Status |
101
+ |---|-----------|------|---------------|------------|---------|------------|--------|
102
+ | 1 | {name} | {path} | {type} | {scope} | {signal count: strong/moderate/weak} | {high/medium/low} | {new/already-skilled} |
103
+
104
+ For disqualified candidates, note reason:
105
+
106
+ **Disqualified:**
107
+ | Path | Reason |
108
+ |------|--------|
109
+ | {path} | {disqualification reason} |
110
+
111
+ ### 4. Detect Primary Language Per Unit
112
+
113
+ For each qualifying unit, determine the primary programming language based on:
114
+ - File extensions in the unit directory
115
+ - Manifest file type (package.json → JS/TS, Cargo.toml → Rust, go.mod → Go, etc.)
116
+ - Entry point file extension
117
+
118
+ ### 5. Present Classifications
119
+
120
+ "**Unit Identification Complete**
121
+
122
+ **Qualifying Units:** {count}
123
+
124
+ {Classification table}
125
+
126
+ **Disqualified Candidates:** {count}
127
+ {Disqualification table}
128
+
129
+ **Already-Skilled Units:** {count from existing_skills match}
130
+ {List with recommendation to run update-skill if source has changed}
131
+
132
+ **Notes:**
133
+ - {Any observations about project structure patterns}
134
+ - {Any ambiguous boundaries that need user clarification}
135
+
136
+ Do these classifications look correct? Should any units be added, removed, or reclassified?"
137
+
138
+ Wait for user feedback. Adjust classifications based on user input.
139
+
140
+ ### 6. Append to Report
141
+
142
+ Append the complete "## Identified Units" section to {outputFile}:
143
+
144
+ Replace the placeholder `[Appended by step-03-identify-units]` with:
145
+ - Classification table (qualifying units)
146
+ - Disqualification table
147
+ - Already-skilled units list
148
+ - Language detection results
149
+ - Any user adjustments noted
150
+
151
+ Update {outputFile} frontmatter:
152
+ ```yaml
153
+ stepsCompleted: ['step-01-init', 'step-02-scan-project', 'step-03-identify-units']
154
+ lastStep: 'step-03-identify-units'
155
+ ```
156
+
157
+ ### 7. Present MENU OPTIONS
158
+
159
+ Display: "**Select:** [C] Continue to Export Mapping and Integration Detection"
160
+
161
+ #### Menu Handling Logic:
162
+
163
+ - IF C: Save classifications to {outputFile}, update frontmatter, then load, read entire file, then execute {nextStepFile}
164
+ - IF Any other: help user, then [Redisplay Menu Options](#7-present-menu-options)
165
+
166
+ #### EXECUTION RULES:
167
+
168
+ - ALWAYS halt and wait for user input after presenting menu
169
+ - ONLY proceed to next step when user selects 'C'
170
+
171
+ ## CRITICAL STEP COMPLETION NOTE
172
+
173
+ ONLY WHEN the Identified Units section has been appended to {outputFile} with complete classification tables, disqualification records, and language detection results, and frontmatter stepsCompleted has been updated, will you load and read fully {nextStepFile} to begin export mapping and integration detection.
174
+
175
+ ---
176
+
177
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
178
+
179
+ ### ✅ SUCCESS:
180
+
181
+ - Every detected boundary evaluated against heuristics
182
+ - Detection signals cited with specific file paths
183
+ - Scope types assigned to each qualifying unit
184
+ - Disqualification rules applied and documented
185
+ - Existing skills cross-referenced
186
+ - Primary language detected per unit
187
+ - Classifications presented to user for confirmation
188
+ - Report updated with Identified Units section
189
+
190
+ ### ❌ SYSTEM FAILURE:
191
+
192
+ - Classifying without citing detection signals
193
+ - Missing disqualification checks
194
+ - Not cross-referencing existing_skills
195
+ - Mapping exports or integrations in this step (that's step 04)
196
+ - Generating skill-brief.yaml in this step (that's step 06)
197
+ - Not presenting classifications for user confirmation
198
+
199
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.