bmad-module-skill-forge 0.5.0 → 0.7.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 (149) hide show
  1. package/README.md +4 -3
  2. package/docs/agents.md +12 -5
  3. package/docs/concepts.md +37 -15
  4. package/docs/examples.md +49 -5
  5. package/docs/getting-started.md +43 -17
  6. package/docs/how-it-works.md +115 -90
  7. package/docs/index.md +2 -2
  8. package/docs/workflows.md +89 -41
  9. package/package.json +2 -2
  10. package/src/agents/forger.agent.yaml +18 -6
  11. package/src/forger/README.md +1 -1
  12. package/src/forger/forge-tier.yaml +18 -1
  13. package/src/forger/preferences.yaml +6 -8
  14. package/src/knowledge/agentskills-spec.md +1 -1
  15. package/src/knowledge/architecture-verification.md +102 -0
  16. package/src/knowledge/ccc-bridge.md +110 -0
  17. package/src/knowledge/confidence-tiers.md +14 -3
  18. package/src/knowledge/doc-fetcher.md +1 -1
  19. package/src/knowledge/manual-section-integrity.md +2 -2
  20. package/src/knowledge/overview.md +10 -6
  21. package/src/knowledge/progressive-capability.md +15 -6
  22. package/src/knowledge/qmd-registry.md +18 -1
  23. package/src/knowledge/skf-knowledge-index.csv +3 -1
  24. package/src/knowledge/skill-lifecycle.md +26 -2
  25. package/src/knowledge/split-body-strategy.md +16 -2
  26. package/src/knowledge/zero-hallucination.md +11 -8
  27. package/src/module-help.csv +9 -6
  28. package/src/module.yaml +4 -1
  29. package/src/workflows/README.md +36 -18
  30. package/src/workflows/analyze-source/data/skill-brief-schema.md +18 -5
  31. package/src/workflows/analyze-source/data/unit-detection-heuristics.md +1 -0
  32. package/src/workflows/analyze-source/steps-c/step-01-init.md +4 -4
  33. package/src/workflows/analyze-source/steps-c/step-01b-continue.md +1 -1
  34. package/src/workflows/analyze-source/steps-c/step-02-scan-project.md +1 -1
  35. package/src/workflows/analyze-source/steps-c/step-03-identify-units.md +1 -1
  36. package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +8 -4
  37. package/src/workflows/analyze-source/steps-c/step-05-recommend.md +1 -1
  38. package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +2 -2
  39. package/src/workflows/analyze-source/workflow.md +2 -2
  40. package/src/workflows/audit-skill/data/drift-report-template.md +6 -6
  41. package/src/workflows/audit-skill/data/severity-rules.md +1 -1
  42. package/src/workflows/audit-skill/steps-c/step-01-init.md +3 -2
  43. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +23 -1
  44. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +6 -6
  45. package/src/workflows/audit-skill/workflow.md +3 -2
  46. package/src/workflows/brief-skill/data/scope-templates.md +10 -0
  47. package/src/workflows/brief-skill/data/skill-brief-schema.md +25 -23
  48. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +4 -4
  49. package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +15 -0
  50. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +3 -0
  51. package/src/workflows/create-skill/data/extraction-patterns.md +37 -1
  52. package/src/workflows/create-skill/data/skill-sections.md +14 -13
  53. package/src/workflows/create-skill/data/source-resolution-protocols.md +1 -1
  54. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +18 -12
  55. package/src/workflows/create-skill/steps-c/step-02-ecosystem-check.md +2 -2
  56. package/src/workflows/create-skill/steps-c/step-02b-ccc-discover.md +157 -0
  57. package/src/workflows/create-skill/steps-c/step-03-extract.md +25 -20
  58. package/src/workflows/create-skill/steps-c/step-03b-fetch-temporal.md +8 -8
  59. package/src/workflows/create-skill/steps-c/step-03c-fetch-docs.md +3 -1
  60. package/src/workflows/create-skill/steps-c/step-04-enrich.md +9 -9
  61. package/src/workflows/create-skill/steps-c/step-05-compile.md +4 -3
  62. package/src/workflows/create-skill/steps-c/step-06-validate.md +3 -3
  63. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +60 -39
  64. package/src/workflows/create-skill/steps-c/step-08-report.md +26 -11
  65. package/src/workflows/create-skill/workflow.md +3 -3
  66. package/src/workflows/create-stack-skill/data/compose-mode-rules.md +65 -0
  67. package/src/workflows/create-stack-skill/data/stack-skill-template.md +29 -7
  68. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +25 -8
  69. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +35 -2
  70. package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +26 -2
  71. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +24 -0
  72. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +40 -2
  73. package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +5 -1
  74. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +53 -5
  75. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +4 -4
  76. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +8 -2
  77. package/src/workflows/create-stack-skill/workflow.md +3 -3
  78. package/src/workflows/export-skill/data/managed-section-format.md +8 -1
  79. package/src/workflows/export-skill/data/snippet-format.md +1 -1
  80. package/src/workflows/export-skill/steps-c/step-01-load-skill.md +1 -1
  81. package/src/workflows/export-skill/steps-c/step-02-package.md +1 -1
  82. package/src/workflows/export-skill/steps-c/step-04-update-context.md +7 -2
  83. package/src/workflows/export-skill/steps-c/step-05-token-report.md +1 -1
  84. package/src/workflows/export-skill/workflow.md +3 -1
  85. package/src/workflows/quick-skill/data/skill-template.md +24 -4
  86. package/src/workflows/quick-skill/steps-c/step-02-ecosystem-check.md +1 -3
  87. package/src/workflows/quick-skill/steps-c/step-04-compile.md +26 -6
  88. package/src/workflows/quick-skill/steps-c/step-05-validate.md +1 -1
  89. package/src/workflows/quick-skill/steps-c/step-06-write.md +3 -0
  90. package/src/workflows/quick-skill/workflow.md +1 -1
  91. package/src/workflows/refine-architecture/data/refinement-rules.md +102 -0
  92. package/src/workflows/refine-architecture/steps-c/step-01-init.md +188 -0
  93. package/src/workflows/refine-architecture/steps-c/step-02-gap-analysis.md +179 -0
  94. package/src/workflows/refine-architecture/steps-c/step-03-issue-detection.md +182 -0
  95. package/src/workflows/refine-architecture/steps-c/step-04-improvements.md +169 -0
  96. package/src/workflows/refine-architecture/steps-c/step-05-compile.md +200 -0
  97. package/src/workflows/refine-architecture/steps-c/step-06-report.md +147 -0
  98. package/src/workflows/refine-architecture/workflow.md +61 -0
  99. package/src/workflows/setup-forge/data/tier-rules.md +16 -6
  100. package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +33 -15
  101. package/src/workflows/setup-forge/steps-c/step-01b-ccc-index.md +148 -0
  102. package/src/workflows/setup-forge/steps-c/step-02-write-config.md +29 -12
  103. package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +29 -6
  104. package/src/workflows/setup-forge/steps-c/step-04-report.md +16 -4
  105. package/src/workflows/setup-forge/workflow.md +4 -3
  106. package/src/workflows/test-skill/data/scoring-rules.md +8 -0
  107. package/src/workflows/test-skill/data/source-access-protocol.md +1 -1
  108. package/src/workflows/test-skill/steps-c/step-01-init.md +3 -2
  109. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +2 -0
  110. package/src/workflows/test-skill/templates/test-report-template.md +3 -0
  111. package/src/workflows/test-skill/workflow.md +2 -2
  112. package/src/workflows/update-skill/steps-c/step-01-init.md +3 -2
  113. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +2 -2
  114. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +24 -4
  115. package/src/workflows/update-skill/steps-c/step-05-validate.md +7 -11
  116. package/src/workflows/update-skill/steps-c/step-06-write.md +7 -4
  117. package/src/workflows/update-skill/workflow.md +1 -1
  118. package/src/workflows/verify-stack/data/coverage-patterns.md +45 -0
  119. package/src/workflows/verify-stack/data/feasibility-report-template.md +63 -0
  120. package/src/workflows/verify-stack/data/integration-verification-rules.md +73 -0
  121. package/src/workflows/verify-stack/steps-c/step-01-init.md +174 -0
  122. package/src/workflows/verify-stack/steps-c/step-02-coverage.md +181 -0
  123. package/src/workflows/verify-stack/steps-c/step-03-integrations.md +195 -0
  124. package/src/workflows/verify-stack/steps-c/step-04-requirements.md +168 -0
  125. package/src/workflows/verify-stack/steps-c/step-05-synthesize.md +191 -0
  126. package/src/workflows/verify-stack/steps-c/step-06-report.md +197 -0
  127. package/src/workflows/verify-stack/workflow.md +61 -0
  128. package/tools/cli/commands/status.js +2 -1
  129. package/src/workflows/analyze-source/validation-report.md +0 -657
  130. package/src/workflows/analyze-source/workflow-plan-analyze-source.md +0 -385
  131. package/src/workflows/audit-skill/validation-report.md +0 -545
  132. package/src/workflows/audit-skill/workflow-plan-audit-skill.md +0 -318
  133. package/src/workflows/brief-skill/validation-report.md +0 -630
  134. package/src/workflows/brief-skill/workflow-plan-brief-skill.md +0 -360
  135. package/src/workflows/create-skill/validation-report.md +0 -189
  136. package/src/workflows/create-skill/workflow-plan-create-skill.md +0 -523
  137. package/src/workflows/create-stack-skill/validation-report.md +0 -401
  138. package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +0 -481
  139. package/src/workflows/export-skill/validation-report.md +0 -263
  140. package/src/workflows/export-skill/workflow-plan-export-skill.md +0 -369
  141. package/src/workflows/quick-skill/validation-report.md +0 -543
  142. package/src/workflows/quick-skill/workflow-plan-quick-skill.md +0 -405
  143. package/src/workflows/setup-forge/validation-report.md +0 -504
  144. package/src/workflows/setup-forge/workflow-plan-setup-forge.md +0 -428
  145. package/src/workflows/test-skill/validation-report.md +0 -390
  146. package/src/workflows/test-skill/workflow-plan-test-skill.md +0 -292
  147. package/src/workflows/update-skill/data/tier-degradation-rules.md +0 -46
  148. package/src/workflows/update-skill/validation-report.md +0 -559
  149. package/src/workflows/update-skill/workflow-plan-update-skill.md +0 -441
@@ -103,7 +103,7 @@ Extract from `metadata.json`:
103
103
  - `source_authority` — `official`, `internal`, or `community`
104
104
  - `exports` — Array of exported functions/types
105
105
  - `generation_date` — When the skill was last generated
106
- - `confidence_tier` — Quick/Forge/Deep
106
+ - `confidence_tier` — Quick/Forge/Forge+/Deep
107
107
 
108
108
  **For stack skills, also extract:**
109
109
  - `components` — Array of dependencies with versions
@@ -75,7 +75,7 @@ Verify the skill directory contains the expected agentskills.io package layout:
75
75
  - `source_authority` ("official", "internal", or "community")
76
76
  - `exports` (array)
77
77
  - `generation_date` (ISO date string)
78
- - `confidence_tier` ("Quick", "Forge", or "Deep")
78
+ - `confidence_tier` ("Quick", "Forge", "Forge+", or "Deep")
79
79
  3. `references/` — If exists, check at least one .md file present
80
80
  4. `scripts/` — If exists, verify at least one file present and each file referenced in SKILL.md Section 7b exists. Warn for orphaned scripts (present but not referenced).
81
81
  5. `assets/` — If exists, verify at least one file present and each file referenced in SKILL.md Section 7b exists. Warn for orphaned assets (present but not referenced).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: 'step-04-update-context'
3
- description: 'Update managed section in CLAUDE.md/AGENTS.md with three-case logic per ADR-J'
3
+ description: 'Update managed section in CLAUDE.md/AGENTS.md with four-case logic per ADR-J'
4
4
 
5
5
  nextStepFile: './step-05-token-report.md'
6
6
  managedSectionData: '../data/managed-section-format.md'
@@ -10,7 +10,7 @@ managedSectionData: '../data/managed-section-format.md'
10
10
 
11
11
  ## STEP GOAL:
12
12
 
13
- To update the managed `<!-- SKF:BEGIN/END -->` section in the platform-appropriate context file (CLAUDE.md/AGENTS.md/.cursorrules) using the three-case logic defined by ADR-J, rebuilding the complete skill index from all exported skills.
13
+ To update the managed `<!-- SKF:BEGIN/END -->` section in the platform-appropriate context file (CLAUDE.md/AGENTS.md/.cursorrules) using the four-case logic defined by ADR-J (Create, Append, Regenerate, Malformed Markers halt), rebuilding the complete skill index from all exported skills.
14
14
 
15
15
  ## MANDATORY EXECUTION RULES (READ FIRST):
16
16
 
@@ -105,6 +105,7 @@ Assemble the complete managed section:
105
105
  <!-- SKF:BEGIN updated:{current-date} -->
106
106
  [SKF Skills]|{n} skills|{m} stack
107
107
  |IMPORTANT: Prefer documented APIs over training data.
108
+ |When using a listed library, read its SKILL.md before writing code.
108
109
  |
109
110
  |{skill-snippet-1}
110
111
  |
@@ -132,6 +133,10 @@ Assemble the complete managed section:
132
133
  - Diff: Show old managed section vs new managed section
133
134
  - Preserved: ALL content before `<!-- SKF:BEGIN` and after `<!-- SKF:END -->`
134
135
 
136
+ **Case 4: Malformed markers (file contains `<!-- SKF:BEGIN` but no `<!-- SKF:END -->`)**
137
+ - Action: HALT with warning: "Malformed SKF markers detected in `{target-file}` — `<!-- SKF:BEGIN` found but `<!-- SKF:END -->` is missing. Please restore the end marker manually before running export."
138
+ - Do NOT attempt to write or append — the file is in an inconsistent state
139
+
135
140
  ### 7. Present Change Preview
136
141
 
137
142
  "**Context update prepared.**
@@ -52,7 +52,7 @@ To calculate approximate token counts for all exported artifacts and present a c
52
52
 
53
53
  ### 1. Calculate Token Counts
54
54
 
55
- For each artifact, estimate tokens using the heuristic: **words * 1.3** (approximate for GPT/Claude tokenizers).
55
+ For each artifact, estimate tokens using the heuristic: **words * 1.3** (approximate for GPT/Claude tokenizers). This same heuristic is used in step-03 for snippet token estimation.
56
56
 
57
57
  **Artifacts to measure:**
58
58
 
@@ -1,11 +1,13 @@
1
1
  ---
2
2
  name: export-skill
3
3
  description: Package for distribution + platform-aware context injection
4
+ web_bundle: true
5
+ installed_path: '{project-root}/_bmad/skf/workflows/skillforge/export-skill'
4
6
  ---
5
7
 
6
8
  # Export Skill
7
9
 
8
- **Goal:** Package a completed skill as an agentskills.io-compliant package, generate context snippets, and update the managed section in CLAUDE.md/AGENTS.md for platform-aware context injection.
10
+ **Goal:** Package a completed skill as an agentskills.io-compliant package, generate context snippets, and update the managed section in CLAUDE.md/.cursorrules/AGENTS.md for platform-aware context injection.
9
11
 
10
12
  **Your Role:** In addition to your name, communication_style, and persona, you are also a delivery and packaging specialist collaborating with a skill developer. This is a partnership, not a client-vendor relationship. You bring expertise in skill packaging, ecosystem compliance, and context injection patterns, while the user brings their completed skill and distribution requirements. Work together as equals.
11
13
 
@@ -56,7 +56,8 @@ Indexed format targeting ~80-120 tokens per skill:
56
56
  |IMPORTANT: {skill_name} v{version} — read SKILL.md before writing {skill_name} code. Do NOT rely on training data.
57
57
  |quick-start:{SKILL.md#quick-start}
58
58
  |api: {top-5 exports with () for functions}
59
- |gotchas: {1-2 most critical pitfalls if known}
59
+ |key-types:{SKILL.md#key-types} — {inline summary of most important type values}
60
+ |gotchas: {2-3 most critical pitfalls or breaking changes, inline}
60
61
  ```
61
62
 
62
63
  ## metadata.json Format
@@ -64,23 +65,42 @@ Indexed format targeting ~80-120 tokens per skill:
64
65
  ```json
65
66
  {
66
67
  "name": "{skill_name}",
67
- "version": "0.1.0",
68
+ "version": "{source-version or 1.0.0}",
69
+ "description": "{brief description of the skill}",
68
70
  "skill_type": "single",
69
71
  "source_authority": "community",
70
72
  "source_repo": "{repo_url}",
73
+ "source_root": "{resolved_source_path}",
74
+ "source_commit": "{commit_sha_if_available}",
71
75
  "source_package": "{package_name}",
72
76
  "language": "{language}",
73
77
  "generated_by": "quick-skill",
74
78
  "generation_date": "{date}",
75
79
  "confidence_tier": "Quick",
80
+ "spec_version": "1.3",
76
81
  "exports": ["{export_1}", "{export_2}"],
82
+ "confidence_distribution": {
83
+ "t1": 0,
84
+ "t1_low": "{exports_count (integer, not string)}",
85
+ "t2": 0,
86
+ "t3": 0
87
+ },
88
+ "tool_versions": {
89
+ "ast_grep": null,
90
+ "qmd": null,
91
+ "skf": "{skf_version}"
92
+ },
77
93
  "stats": {
78
94
  "exports_documented": "{number}",
79
95
  "exports_public_api": "{number}",
80
96
  "exports_internal": 0,
81
97
  "exports_total": "{number}",
82
98
  "public_api_coverage": 1.0,
83
- "total_coverage": 1.0
84
- }
99
+ "total_coverage": 1.0,
100
+ "scripts_count": 0,
101
+ "assets_count": 0
102
+ },
103
+ "dependencies": [],
104
+ "compatibility": "{semver-range}"
85
105
  }
86
106
  ```
@@ -71,9 +71,7 @@ Search for an existing official skill matching `{repo_name}` in the agentskills.
71
71
 
72
72
  **If no match found:**
73
73
  - Set `ecosystem_status: no-match`
74
- - Auto-proceed to step 3:
75
-
76
- "**No existing official skill found for {repo_name}. Proceeding to extraction...**"
74
+ - Auto-proceed silently to step 3. Do not display any message — absence of a match is the expected case.
77
75
 
78
76
  **If match found:**
79
77
  - Set `ecosystem_status: match`
@@ -107,7 +107,8 @@ Create context-snippet.md in Vercel-aligned indexed format (~80-120 tokens):
107
107
  |IMPORTANT: {skill_name} v{version} — read SKILL.md before writing {skill_name} code. Do NOT rely on training data.
108
108
  |quick-start:{SKILL.md#quick-start}
109
109
  |api: {top-5 exports with () for functions}
110
- |gotchas: {1-2 most critical pitfalls if known}
110
+ |key-types:{SKILL.md#key-types} — {inline summary of most important type values}
111
+ |gotchas: {2-3 most critical pitfalls or breaking changes, inline}
111
112
  ```
112
113
 
113
114
  **If fewer than 5 exports:** Use all available exports.
@@ -116,29 +117,48 @@ Create context-snippet.md in Vercel-aligned indexed format (~80-120 tokens):
116
117
 
117
118
  ### 4. Generate Metadata JSON
118
119
 
119
- Create metadata.json:
120
+ Generate metadata.json following the exact structure defined in {skillTemplateData} metadata.json section. Populate fields from extraction_inventory:
120
121
 
121
122
  ```json
122
123
  {
123
- "name": "{repo_name}",
124
- "version": "{extraction_inventory.version or 0.1.0}",
124
+ "name": "{skill_name}",
125
+ "version": "{extraction_inventory.version or 1.0.0}",
126
+ "description": "{brief description of the skill}",
125
127
  "skill_type": "single",
126
128
  "source_authority": "community",
127
129
  "source_repo": "{resolved_url}",
130
+ "source_root": "{resolved_source_path}",
131
+ "source_commit": "{commit_sha_if_available}",
128
132
  "source_package": "{package_name from manifest}",
129
133
  "language": "{language}",
130
134
  "generated_by": "quick-skill",
131
135
  "generation_date": "{current ISO date}",
132
136
  "confidence_tier": "Quick",
137
+ "spec_version": "1.3",
133
138
  "exports": ["{export_1}", "{export_2}"],
139
+ "confidence_distribution": {
140
+ "t1": 0,
141
+ "t1_low": "{number of exports found — must be integer, not string}",
142
+ "t2": 0,
143
+ "t3": 0
144
+ },
145
+ "tool_versions": {
146
+ "ast_grep": null,
147
+ "qmd": null,
148
+ "skf": "{skf_version}"
149
+ },
134
150
  "stats": {
135
151
  "exports_documented": "{number of exports found}",
136
152
  "exports_public_api": "{number of exports found}",
137
153
  "exports_internal": 0,
138
154
  "exports_total": "{number of exports found}",
139
155
  "public_api_coverage": 1.0,
140
- "total_coverage": 1.0
141
- }
156
+ "total_coverage": 1.0,
157
+ "scripts_count": 0,
158
+ "assets_count": 0
159
+ },
160
+ "dependencies": [],
161
+ "compatibility": "{semver-range or null}"
142
162
  }
143
163
  ```
144
164
 
@@ -116,7 +116,7 @@ Check context-snippet.md format compliance:
116
116
  Check metadata.json has required fields:
117
117
 
118
118
  - [ ] `name` — present, non-empty
119
- - [ ] `version` — present (auto-detected or "0.1.0")
119
+ - [ ] `version` — present (auto-detected or "1.0.0")
120
120
  - [ ] `source_authority` — must be "community"
121
121
  - [ ] `source_repo` — present, valid GitHub URL
122
122
  - [ ] `language` — present, non-empty
@@ -62,6 +62,9 @@ If directory already exists, confirm with user before overwriting:
62
62
 
63
63
  "**Directory `{skills_output_folder}/{repo_name}/` already exists.** Overwrite existing files? [Y/N]"
64
64
 
65
+ - **If user selects Y:** Proceed to section 2.
66
+ - **If user selects N:** Halt with: "Overwrite cancelled. Existing skill preserved. Run [QS] with a different skill name or remove the existing directory manually."
67
+
65
68
  ### 2. Write SKILL.md
66
69
 
67
70
  Write the compiled SKILL.md content to:
@@ -2,7 +2,7 @@
2
2
  name: quick-skill
3
3
  description: Brief-less fast skill with package-to-repo resolution
4
4
  web_bundle: true
5
- installed_path: '{project-root}/_bmad/skf/workflows/quick-skill'
5
+ installed_path: '{project-root}/_bmad/skf/workflows/skillforge/quick-skill'
6
6
  ---
7
7
 
8
8
  # Quick Skill
@@ -0,0 +1,102 @@
1
+ # Architecture Refinement Rules
2
+
3
+ ## Purpose
4
+
5
+ Rules for detecting gaps, issues, and improvements in an architecture document using generated skill data as the evidence source.
6
+
7
+ ---
8
+
9
+ ## Gap Detection Rules
10
+
11
+ Gaps are undocumented integration paths — library pairs that have compatible APIs but no architecture description.
12
+
13
+ ### Detection Method
14
+
15
+ 1. Generate all possible library pairs from the skill inventory
16
+ 2. For each pair, check if both skills export APIs that could connect (compatible types, shared protocols, complementary producer/consumer patterns)
17
+ 3. Cross-reference against the architecture document: does the document describe how these two libraries interact?
18
+ 4. If compatible APIs exist but NO architecture description exists, this is a **gap**
19
+
20
+ ### Gap Classification
21
+
22
+ | Gap Type | Description | Example |
23
+ |----------|-------------|---------|
24
+ | **Missing Integration Path** | Two libraries can connect but the architecture never describes how | Skill A exports JSON producer, Skill B accepts JSON input, no mention of A-to-B flow |
25
+ | **Undocumented Data Flow** | Data moves between libraries but the flow is not described | Architecture mentions both libraries but not their data exchange mechanism |
26
+ | **Absent Bridge Layer** | Cross-language or cross-protocol libraries need a bridge not mentioned | Rust library and TypeScript library with no IPC/FFI description |
27
+
28
+ ---
29
+
30
+ ## Issue Detection Rules
31
+
32
+ Issues are contradictions between architecture claims and verified API reality from the skills.
33
+
34
+ ### Detection Method
35
+
36
+ 1. Extract every integration claim from the architecture document (prose co-mention analysis)
37
+ 2. For each claim, verify against the actual API surfaces in the skills
38
+ 3. Flag contradictions: claimed APIs that do not exist, assumed compatibility that breaks, missing bridge layers
39
+
40
+ ### Issue Classification
41
+
42
+ | Issue Type | Description | Example |
43
+ |------------|-------------|---------|
44
+ | **API Mismatch** | Architecture describes an API that does not exist in the skill | "Library X exposes a streaming API" but skill shows only batch APIs |
45
+ | **Protocol Contradiction** | Architecture assumes a protocol the library does not support | "Communicates via gRPC" but skill shows HTTP-only exports |
46
+ | **Language Boundary Ignored** | Architecture assumes direct calls across language boundaries | "Calls Rust functions from TypeScript" with no FFI/IPC mechanism described |
47
+ | **Type Incompatibility** | Architecture assumes type compatibility that does not hold | "Passes CRDT documents directly" but types are incompatible across libraries |
48
+
49
+ ### VS Report Integration
50
+
51
+ When a VS feasibility report is available:
52
+ - RISKY verdicts become **confirmed issues** with the VS evidence as additional citation
53
+ - BLOCKED verdicts become **critical issues** requiring architecture redesign
54
+ - Plausible verdicts become potential issues **only if** the VS rationale text explicitly states "no direct API evidence" or "weak evidence" — otherwise they are informational only
55
+
56
+ ---
57
+
58
+ ## Improvement Detection Rules
59
+
60
+ Improvements are capability expansions — library features documented in skills but not leveraged in the architecture.
61
+
62
+ ### Detection Method
63
+
64
+ 1. For each skill, enumerate its full API surface (all exports, types, protocols)
65
+ 2. Compare against how the architecture uses that library
66
+ 3. Identify capabilities present in the skill but absent from the architecture
67
+
68
+ ### Improvement Classification
69
+
70
+ | Improvement Type | Description | Example |
71
+ |------------------|-------------|---------|
72
+ | **Unused Capability** | Library has a feature the architecture does not mention | "Loro supports document CRDTs but architecture only uses data sync" |
73
+ | **Cross-Library Synergy** | Two libraries have complementary features not combined in architecture | "Library A's event system could feed Library B's stream processor" |
74
+ | **Alternative Pattern** | Skill documents a better pattern than the one described in architecture | "Skill shows batch API is more efficient than the per-item approach described" |
75
+
76
+ ---
77
+
78
+ ## Refinement Citation Format
79
+
80
+ Every refinement (gap, issue, or improvement) MUST cite evidence:
81
+
82
+ ```
83
+ **[GAP|ISSUE|IMPROVEMENT]**: {description}
84
+
85
+ Evidence:
86
+ - {skill_name} exports: `{function_name}({params}) -> {return_type}`
87
+ - {skill_name} provides: `{type_or_protocol}`
88
+ - Architecture states: "{quoted text from original document}"
89
+ - {IF VS report}: VS verdict: {verdict} for {pair}
90
+
91
+ Suggestion: {specific, actionable recommendation}
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Preservation Rules
97
+
98
+ 1. **NEVER delete original content** — only add annotations and subsections
99
+ 2. **Follow original section layout** — add refinement subsections within existing sections
100
+ 3. **Use callout blocks** for issues: `> [!WARNING]` or `> [!NOTE]` format
101
+ 4. **Mark additions clearly** — prefix added subsections with "RA:" or use a refinement marker
102
+ 5. **Maintain original heading hierarchy** — refinement subsections are one level deeper than the parent
@@ -0,0 +1,188 @@
1
+ ---
2
+ name: 'step-01-init'
3
+ description: 'Load architecture doc, scan skills folder, load optional VS report, validate inputs'
4
+
5
+ nextStepFile: './step-02-gap-analysis.md'
6
+ refinementRulesData: '../data/refinement-rules.md'
7
+ ---
8
+
9
+ # Step 1: Initialize Refinement
10
+
11
+ ## STEP GOAL:
12
+
13
+ Load the architecture document (required), scan the skills folder to build a skill inventory with metadata, load the optional VS feasibility report for context, validate that all inputs exist and meet minimum requirements, and present an initialization summary before auto-proceeding.
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 architecture refinement analyst operating in Ferris Architect mode
26
+ - ✅ Execute with analytical precision — every loaded skill must be validated against actual files
27
+ - ✅ You enforce the zero-hallucination principle: only report skills that physically exist on disk
28
+
29
+ ### Step-Specific Rules:
30
+
31
+ - 🎯 Focus ONLY on loading inputs, scanning skills, and validating prerequisites
32
+ - 🚫 FORBIDDEN to perform any gap analysis, issue detection, or improvement suggestions
33
+ - 🚫 No A/P menu — this is an auto-proceed init step
34
+ - 💬 Present a clear initialization summary so downstream steps have validated inputs
35
+
36
+ ## EXECUTION PROTOCOLS:
37
+
38
+ - Collect and validate all input documents and skill artifacts
39
+ - Load refinement rules from {refinementRulesData} for downstream step reference
40
+ - Auto-proceed to next step after successful initialization
41
+ - HALT with actionable error if minimum requirements not met
42
+
43
+ ## CONTEXT BOUNDARIES:
44
+
45
+ - This is the first step — no prior workflow state exists
46
+ - Requires skills to have been generated by create-skill or quick-skill workflows
47
+ - User provides architecture document path (required) and optional VS report path
48
+ - No dependency on forge-tier — this workflow operates on skill content only
49
+ - Requires `forge_data_folder` from config.yaml for durability state (directory is created automatically if missing)
50
+
51
+ ## MANDATORY SEQUENCE
52
+
53
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
54
+
55
+ ### 1. Accept Input Documents
56
+
57
+ "**Refine Architecture — Evidence-Backed Refinement**
58
+
59
+ Please provide the following:
60
+ 1. **Architecture document path** (REQUIRED) — your project's architecture doc to refine
61
+ 2. **VS feasibility report path** (OPTIONAL) — from a previous [VS] Verify Stack run, for additional context"
62
+
63
+ Wait for user input. Store the validated architecture document path as `architecture_doc`.
64
+
65
+ **Validate architecture document:**
66
+ - Confirm the file exists and is readable
67
+ - If missing or unreadable: "Architecture document not found at `{path}`. Provide a valid path."
68
+ - HALT until a valid architecture document is provided
69
+
70
+ **Validate VS report (if provided):**
71
+ - Confirm the file exists and is readable
72
+ - If missing at user-provided path: attempt auto-probe (below) before giving up
73
+ - Store VS report availability as `vs_report_available: true|false` and `vs_report_path`
74
+
75
+ ### 2. Scan Skills Folder
76
+
77
+ Read the `{skills_output_folder}` directory.
78
+
79
+ For each subdirectory, check for the presence of `SKILL.md` and `metadata.json`.
80
+
81
+ **For each valid skill directory, extract from metadata.json:**
82
+ - `name` — skill name
83
+ - `language` — primary language
84
+ - `confidence_tier` — Quick, Forge, Forge+, or Deep
85
+ - `exports_documented` — read from `stats.exports_documented` in metadata.json (count of documented exports)
86
+ - `source_repo` or `source_root` — original source repository
87
+
88
+ **Build a skill inventory** as an internal list of all loaded skills with the fields above.
89
+
90
+ **If a subdirectory lacks SKILL.md or metadata.json:**
91
+ - Log: "Skipping `{dir_name}` — missing SKILL.md or metadata.json"
92
+ - Do not include in inventory
93
+
94
+ ### 3. Validate Minimum Requirements
95
+
96
+ **Check skill count:**
97
+ - At least 1 valid skill must exist
98
+ - If no skills found: "**Cannot proceed.** No skills found in `{skills_output_folder}`. Generate skills with [CS] Create Skill or [QS] Quick Skill, then re-run [RA]."
99
+ - HALT workflow
100
+ - If exactly 1 valid skill found: "⚠️ Proceeding with 1 skill. Note: gap analysis will find no gaps — pairwise analysis requires at least 2 skills. Step 02 will still execute and issue an appropriate notice. Issue detection and improvement detection will proceed normally."
101
+
102
+ **Check output_folder:**
103
+ - Verify `output_folder` was resolved from config.yaml and is non-empty
104
+ - If undefined or empty: "**Cannot proceed.** `output_folder` is not configured in config.yaml. Add an `output_folder` path and re-run [RA]."
105
+ - HALT workflow
106
+ - Verify the `output_folder` directory exists. If it does not exist, create it. HALT with error if creation fails.
107
+
108
+ **Check forge_data_folder:**
109
+ - Verify `forge_data_folder` was resolved from config.yaml and is non-empty
110
+ - If undefined or empty: "**Cannot proceed.** `forge_data_folder` is not configured in config.yaml. Add a `forge_data_folder` path to your config.yaml and re-run [RA]."
111
+ - HALT workflow
112
+ - Verify the `forge_data_folder` directory exists. If it does not exist, attempt to create it. If creation fails: "**Cannot proceed.** `forge_data_folder` at `{forge_data_folder}` does not exist and could not be created. Create the directory manually and re-run [RA]."
113
+ - HALT workflow on creation failure
114
+
115
+ **Check architecture document:**
116
+ - Confirm it was loaded successfully in section 1
117
+ - If not: HALT with error (should not reach here if section 1 validation passed)
118
+
119
+ ### 3b. Auto-Probe VS Report
120
+
121
+ **Auto-probe VS report (if not provided by user in section 1, OR if user-provided path was invalid):**
122
+ - Only attempt if `forge_data_folder` is non-empty and the directory exists (validated above); otherwise skip probe and set `vs_report_available: false`
123
+ - Check for `{forge_data_folder}/feasibility-report-{project_name}.md`
124
+ - If found: "Auto-discovered VS report at `{path}`. Loading for additional context."
125
+ - Store `vs_report_available: true` and `vs_report_path`
126
+ - If not found: `vs_report_available: false` — "Proceeding without VS report — issue detection will rely on skill data only."
127
+
128
+ ### 3c. Reset RA State File
129
+
130
+ Create (or overwrite) `{forge_data_folder}/ra-state-{project_name}.md` with a fresh header:
131
+
132
+ ```markdown
133
+ <!-- RA state for {project_name} — generated {current_date} -->
134
+ ```
135
+
136
+ This ensures steps 02-04 append to a clean slate and context recovery in step-05 never loads stale findings from a prior run.
137
+
138
+ ### 4. Load Refinement Rules
139
+
140
+ Load `{refinementRulesData}` for reference by downstream steps.
141
+
142
+ Extract: gap detection rules, issue detection rules, improvement detection rules, citation format, and preservation rules.
143
+
144
+ ### 5. Display Initialization Summary
145
+
146
+ "**Architecture Refinement Initialized**
147
+
148
+ | Field | Value |
149
+ |-------|-------|
150
+ | **Architecture Doc** | {architecture_doc} |
151
+ | **VS Report** | {vs_report_path or 'Not provided — issue detection will use skill data only'} |
152
+ | **Skills Loaded** | {skill_count} |
153
+
154
+ **Skill Inventory:**
155
+
156
+ | Skill | Language | Tier | Exports |
157
+ |-------|----------|------|---------|
158
+ | {skill_name} | {language} | {confidence_tier} | {exports_documented} |
159
+
160
+ **Proceeding to gap analysis...**"
161
+
162
+ ### 6. Auto-Proceed to Next Step
163
+
164
+ Load, read the full file and then execute `{nextStepFile}`.
165
+
166
+ ---
167
+
168
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
169
+
170
+ ### ✅ SUCCESS:
171
+
172
+ - Architecture document loaded and validated
173
+ - VS report loaded or absence recorded
174
+ - Skills folder scanned with SKILL.md and metadata.json validation per skill
175
+ - At least 1 valid skill in inventory
176
+ - Refinement rules loaded from {refinementRulesData}
177
+ - Initialization summary displayed with skill inventory table
178
+ - Auto-proceeded to step 02
179
+
180
+ ### ❌ SYSTEM FAILURE:
181
+
182
+ - Proceeding with no valid skills
183
+ - Proceeding without a valid architecture document
184
+ - Not validating SKILL.md and metadata.json existence per skill directory
185
+ - Performing gap analysis, issue detection, or improvement suggestions in this step
186
+ - Hardcoded paths instead of frontmatter variables
187
+
188
+ **Master Rule:** This step validates inputs and initializes state. No analysis, no comparison, no refinement suggestions.