bmad-module-skill-forge 0.6.0 → 0.7.1

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 (144) hide show
  1. package/README.md +2 -2
  2. package/docs/agents.md +9 -5
  3. package/docs/concepts.md +17 -13
  4. package/docs/examples.md +19 -4
  5. package/docs/getting-started.md +34 -19
  6. package/docs/how-it-works.md +87 -84
  7. package/docs/index.md +1 -1
  8. package/docs/workflows.md +88 -40
  9. package/package.json +1 -1
  10. package/src/agents/forger.agent.yaml +17 -5
  11. package/src/forger/README.md +1 -1
  12. package/src/forger/forge-tier.yaml +2 -1
  13. package/src/forger/preferences.yaml +5 -7
  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 +3 -2
  17. package/src/knowledge/confidence-tiers.md +12 -1
  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 +11 -7
  21. package/src/knowledge/progressive-capability.md +5 -2
  22. package/src/knowledge/qmd-registry.md +5 -2
  23. package/src/knowledge/skf-knowledge-index.csv +2 -0
  24. package/src/knowledge/skill-lifecycle.md +26 -2
  25. package/src/knowledge/split-body-strategy.md +16 -2
  26. package/src/knowledge/tool-resolution.md +55 -0
  27. package/src/knowledge/zero-hallucination.md +11 -8
  28. package/src/module-help.csv +9 -6
  29. package/src/module.yaml +3 -0
  30. package/src/workflows/README.md +35 -17
  31. package/src/workflows/analyze-source/data/skill-brief-schema.md +18 -5
  32. package/src/workflows/analyze-source/steps-c/step-01-init.md +2 -2
  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 +3 -3
  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/severity-rules.md +1 -1
  41. package/src/workflows/audit-skill/steps-c/step-01-init.md +2 -1
  42. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +8 -1
  43. package/src/workflows/audit-skill/steps-c/step-03-structural-diff.md +2 -2
  44. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +2 -2
  45. package/src/workflows/audit-skill/steps-c/step-05-severity-classify.md +1 -1
  46. package/src/workflows/audit-skill/workflow.md +2 -1
  47. package/src/workflows/brief-skill/data/scope-templates.md +10 -0
  48. package/src/workflows/brief-skill/data/skill-brief-schema.md +25 -23
  49. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +1 -1
  50. package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +1 -1
  51. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +3 -0
  52. package/src/workflows/create-skill/data/extraction-patterns.md +7 -1
  53. package/src/workflows/create-skill/data/skill-sections.md +12 -11
  54. package/src/workflows/create-skill/data/source-resolution-protocols.md +2 -2
  55. package/src/workflows/create-skill/data/tier-degradation-rules.md +1 -1
  56. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +14 -10
  57. package/src/workflows/create-skill/steps-c/step-02b-ccc-discover.md +4 -0
  58. package/src/workflows/create-skill/steps-c/step-03-extract.md +19 -19
  59. package/src/workflows/create-skill/steps-c/step-03b-fetch-temporal.md +3 -3
  60. package/src/workflows/create-skill/steps-c/step-03c-fetch-docs.md +3 -1
  61. package/src/workflows/create-skill/steps-c/step-04-enrich.md +3 -1
  62. package/src/workflows/create-skill/steps-c/step-05-compile.md +4 -3
  63. package/src/workflows/create-skill/steps-c/step-06-validate.md +2 -2
  64. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +33 -44
  65. package/src/workflows/create-skill/steps-c/step-08-report.md +25 -11
  66. package/src/workflows/create-skill/workflow.md +2 -2
  67. package/src/workflows/create-stack-skill/data/compose-mode-rules.md +65 -0
  68. package/src/workflows/create-stack-skill/data/manifest-patterns.md +23 -1
  69. package/src/workflows/create-stack-skill/data/stack-skill-template.md +28 -6
  70. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +25 -7
  71. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +37 -3
  72. package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +29 -3
  73. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +50 -7
  74. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +35 -3
  75. package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +5 -1
  76. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +53 -5
  77. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +3 -3
  78. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +8 -2
  79. package/src/workflows/create-stack-skill/workflow.md +2 -2
  80. package/src/workflows/export-skill/data/managed-section-format.md +8 -1
  81. package/src/workflows/export-skill/data/snippet-format.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 +18 -6
  86. package/src/workflows/quick-skill/steps-c/step-04-compile.md +26 -6
  87. package/src/workflows/quick-skill/steps-c/step-05-validate.md +1 -1
  88. package/src/workflows/quick-skill/steps-c/step-06-write.md +3 -0
  89. package/src/workflows/quick-skill/workflow.md +1 -1
  90. package/src/workflows/refine-architecture/data/refinement-rules.md +102 -0
  91. package/src/workflows/refine-architecture/steps-c/step-01-init.md +188 -0
  92. package/src/workflows/refine-architecture/steps-c/step-02-gap-analysis.md +179 -0
  93. package/src/workflows/refine-architecture/steps-c/step-03-issue-detection.md +182 -0
  94. package/src/workflows/refine-architecture/steps-c/step-04-improvements.md +169 -0
  95. package/src/workflows/refine-architecture/steps-c/step-05-compile.md +200 -0
  96. package/src/workflows/refine-architecture/steps-c/step-06-report.md +147 -0
  97. package/src/workflows/refine-architecture/workflow.md +61 -0
  98. package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +2 -1
  99. package/src/workflows/setup-forge/steps-c/step-01b-ccc-index.md +5 -3
  100. package/src/workflows/setup-forge/steps-c/step-02-write-config.md +15 -16
  101. package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +1 -1
  102. package/src/workflows/setup-forge/steps-c/step-04-report.md +2 -2
  103. package/src/workflows/setup-forge/workflow.md +3 -2
  104. package/src/workflows/test-skill/data/scoring-rules.md +3 -0
  105. package/src/workflows/test-skill/data/source-access-protocol.md +1 -1
  106. package/src/workflows/test-skill/steps-c/step-01-init.md +1 -0
  107. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +2 -0
  108. package/src/workflows/test-skill/workflow.md +2 -2
  109. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +3 -3
  110. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +8 -3
  111. package/src/workflows/update-skill/steps-c/step-05-validate.md +8 -12
  112. package/src/workflows/update-skill/steps-c/step-06-write.md +5 -2
  113. package/src/workflows/update-skill/workflow.md +1 -1
  114. package/src/workflows/verify-stack/data/coverage-patterns.md +45 -0
  115. package/src/workflows/verify-stack/data/feasibility-report-template.md +63 -0
  116. package/src/workflows/verify-stack/data/integration-verification-rules.md +73 -0
  117. package/src/workflows/verify-stack/steps-c/step-01-init.md +174 -0
  118. package/src/workflows/verify-stack/steps-c/step-02-coverage.md +181 -0
  119. package/src/workflows/verify-stack/steps-c/step-03-integrations.md +195 -0
  120. package/src/workflows/verify-stack/steps-c/step-04-requirements.md +168 -0
  121. package/src/workflows/verify-stack/steps-c/step-05-synthesize.md +191 -0
  122. package/src/workflows/verify-stack/steps-c/step-06-report.md +197 -0
  123. package/src/workflows/verify-stack/workflow.md +61 -0
  124. package/src/workflows/analyze-source/validation-report.md +0 -657
  125. package/src/workflows/analyze-source/workflow-plan-analyze-source.md +0 -385
  126. package/src/workflows/audit-skill/validation-report.md +0 -545
  127. package/src/workflows/audit-skill/workflow-plan-audit-skill.md +0 -318
  128. package/src/workflows/brief-skill/validation-report.md +0 -630
  129. package/src/workflows/brief-skill/workflow-plan-brief-skill.md +0 -360
  130. package/src/workflows/create-skill/validation-report.md +0 -189
  131. package/src/workflows/create-skill/workflow-plan-create-skill.md +0 -525
  132. package/src/workflows/create-stack-skill/validation-report.md +0 -401
  133. package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +0 -481
  134. package/src/workflows/export-skill/validation-report.md +0 -263
  135. package/src/workflows/export-skill/workflow-plan-export-skill.md +0 -369
  136. package/src/workflows/quick-skill/validation-report.md +0 -543
  137. package/src/workflows/quick-skill/workflow-plan-quick-skill.md +0 -405
  138. package/src/workflows/setup-forge/validation-report.md +0 -504
  139. package/src/workflows/setup-forge/workflow-plan-setup-forge.md +0 -430
  140. package/src/workflows/test-skill/validation-report.md +0 -390
  141. package/src/workflows/test-skill/workflow-plan-test-skill.md +0 -292
  142. package/src/workflows/update-skill/data/tier-degradation-rules.md +0 -46
  143. package/src/workflows/update-skill/validation-report.md +0 -559
  144. package/src/workflows/update-skill/workflow-plan-update-skill.md +0 -441
@@ -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.
@@ -0,0 +1,179 @@
1
+ ---
2
+ name: 'step-02-gap-analysis'
3
+ description: 'Find undocumented integration paths that the architecture does not describe but skill APIs suggest'
4
+
5
+ nextStepFile: './step-03-issue-detection.md'
6
+ refinementRulesData: '../data/refinement-rules.md'
7
+ ---
8
+
9
+ # Step 2: Gap Analysis
10
+
11
+ ## STEP GOAL:
12
+
13
+ Find undocumented integration paths — library pairs that have compatible APIs (from the generated skills) but are not described in the architecture document. For each gap, document what APIs connect and propose an architecture section describing the integration.
14
+
15
+ ## MANDATORY EXECUTION RULES (READ FIRST):
16
+
17
+ ### Universal Rules:
18
+
19
+ - 📖 CRITICAL: Read the complete step file before taking any action
20
+ - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
21
+ - ⚙️ 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
22
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
23
+
24
+ ### Role Reinforcement:
25
+
26
+ - ✅ You are an architecture refinement analyst performing gap detection
27
+ - ✅ Every gap must cite specific APIs from the generated skills — no speculation
28
+ - ✅ Apply the gap detection rules from {refinementRulesData} strictly
29
+
30
+ ### Step-Specific Rules:
31
+
32
+ - 🎯 Focus ONLY on undocumented integration paths (gaps)
33
+ - 🚫 FORBIDDEN to detect contradictions or issues — that is Step 03
34
+ - 🚫 FORBIDDEN to suggest capability expansions or improvements — that is Step 04
35
+ - 💬 Every gap MUST include evidence citations from actual skill content
36
+
37
+ ## EXECUTION PROTOCOLS:
38
+
39
+ - Load refinement rules for gap detection criteria
40
+ - Extract integration claims from architecture document using prose co-mention analysis
41
+ - Generate all possible library pairs and cross-reference against architecture
42
+ - Append gap analysis findings as workflow state for Step 05
43
+ - Only gap detection — no issue detection, no improvement suggestions
44
+
45
+ ## CONTEXT BOUNDARIES:
46
+
47
+ - Available: Architecture document content, skill inventory from Step 01, SKILL.md and metadata.json files, refinement rules
48
+ - Focus: Finding library pairs with compatible APIs that the architecture does not describe
49
+ - Limits: Only detect gaps — do not flag issues or suggest improvements
50
+ - Dependencies: Step 01 must have loaded skill inventory and validated architecture document
51
+
52
+ ## MANDATORY SEQUENCE
53
+
54
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
55
+
56
+ ### 1. Reference Refinement Rules
57
+
58
+ Use the refinement rules loaded in Step 01 from `{refinementRulesData}`. If not available in context, reload from `{refinementRulesData}`.
59
+
60
+ Extract: gap classification (Missing Integration Path, Undocumented Data Flow, Absent Bridge Layer), detection method, and citation format.
61
+
62
+ ### 2. Extract Integration Claims from Architecture
63
+
64
+ Parse the architecture document for statements describing two or more technologies working together.
65
+
66
+ **Detection method — prose-based co-mention analysis:**
67
+ - Identify sentences or paragraphs where two or more technology names appear together
68
+ - Look for integration verbs: "connects to", "communicates with", "wraps", "extends", "consumes", "produces", "bridges", "integrates with", "sits between", "feeds into", "receives from"
69
+ - Look for data flow descriptions: "{A} sends data to {B}", "{A} results are consumed by {B}"
70
+ - Look for layer boundary descriptions: "{A} at the API layer connects to {B} at the data layer"
71
+
72
+ **CRITICAL:** Do NOT parse Mermaid diagram syntax. Use only prose text for co-mention detection.
73
+
74
+ **Mermaid Limitation Warning:** If `` ```mermaid `` blocks are present in the architecture document, inform the user: "Integration paths documented exclusively in Mermaid diagrams are excluded from co-mention analysis and may appear as false-positive gaps. Consider adding prose descriptions for diagram-only integration paths." Display this warning informatively and immediately continue — this does not halt or modify the analysis sequence.
75
+
76
+ **Build documented pairs list:**
77
+ - Each pair: `{library_a, library_b, architectural_context}`
78
+ - `architectural_context`: the quoted text or paraphrased description of their relationship
79
+
80
+ ### 3. Generate All Possible Library Pairs
81
+
82
+ From the skill inventory, generate all unique combinations of library pairs.
83
+
84
+ For N skills, this produces N*(N-1)/2 unique pairs.
85
+
86
+ ### 4. Load Skill API Surfaces for Cross-Reference
87
+
88
+ For each library in the skill inventory, load the skill artifacts:
89
+
90
+ **From SKILL.md, extract:**
91
+ - Exported functions and their signatures
92
+ - Exported types, interfaces, and classes
93
+ - Protocol indicators (HTTP, gRPC, WebSocket, message queue, file I/O, IPC)
94
+ - Data format indicators (JSON, protobuf, CSV, binary, streaming)
95
+
96
+ **From metadata.json, extract:**
97
+ - `language` — primary programming language
98
+ - `exports` — export count and names
99
+
100
+ ### 5. Cross-Reference: Identify Gaps
101
+
102
+ For each possible library pair NOT already documented in the architecture:
103
+
104
+ **Check API compatibility:**
105
+ - Does Library A export types or data that Library B can consume?
106
+ - Do both libraries share a compatible protocol or data format?
107
+ - Are they in the same language or is there a bridge mechanism available?
108
+
109
+ **If compatible APIs exist but NO architecture mention:**
110
+ - Classify the gap type (Missing Integration Path, Undocumented Data Flow, or Absent Bridge Layer)
111
+ - Document the connecting APIs from both skills
112
+ - Propose a brief architecture section describing the integration
113
+
114
+ **Apply the citation format from {refinementRulesData}:**
115
+ ```
116
+ **[GAP]**: {description}
117
+
118
+ Evidence:
119
+ - {skill_a} exports: `{function}({params}) -> {return_type}`
120
+ - {skill_b} accepts: `{function}({params})`
121
+ - Compatibility: {explanation}
122
+
123
+ Suggestion: {proposed architecture section content}
124
+ ```
125
+
126
+ **If no compatible APIs:** Skip this pair — not all pairs need to integrate.
127
+
128
+ ### 6. Display Gap Analysis Results
129
+
130
+ "**Pass 1: Gap Analysis — Undocumented Integration Paths**
131
+
132
+ **Gaps Found:** {count}
133
+
134
+ {IF gaps found:}
135
+ | # | Library A | Library B | Gap Type | Connecting APIs |
136
+ |---|-----------|-----------|----------|-----------------|
137
+ | {n} | {lib_a} | {lib_b} | {gap_type} | {brief API description} |
138
+
139
+ {For each gap, display the full citation with evidence and suggestion}
140
+
141
+ {IF no gaps found AND N > 1:}
142
+ **No undocumented integration paths detected.** The architecture document covers all compatible library pairs.
143
+
144
+ {IF no gaps found AND N == 1:}
145
+ **⚠️ Gap analysis skipped — only 1 skill loaded.** Pairwise integration analysis requires at least 2 skills. If the architecture references multiple libraries, those without a matching skill are invisible to gap analysis. **Recommendation:** Generate skills for all architecture libraries with [CS] or [QS] before running [RA] for comprehensive gap detection.
146
+
147
+ **Proceeding to issue detection (still produces value with 1 skill)...**"
148
+
149
+ Store all gap findings as workflow state for Step 05. To ensure durability across long runs, also append a `<!-- [RA-GAPS] ... -->` comment block to `{forge_data_folder}/ra-state-{project_name}.md` containing the **complete formatted gap findings** (full citation blocks with evidence and suggestions, not just counts) — Step 05 can read this back if context degrades. **Do NOT write to `{output_folder}/refined-architecture-{project_name}.md` — that file is created only in step-05.**
150
+
151
+ ### 7. Auto-Proceed to Next Step
152
+
153
+ Load, read the full file and then execute `{nextStepFile}`.
154
+
155
+ ---
156
+
157
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
158
+
159
+ ### ✅ SUCCESS:
160
+
161
+ - Refinement rules loaded from {refinementRulesData}
162
+ - Integration claims extracted from architecture document using prose co-mention analysis
163
+ - All possible library pairs generated from skill inventory
164
+ - Skill API surfaces loaded for cross-reference
165
+ - Each gap includes evidence citations from actual skill content
166
+ - Gap analysis results displayed with count and details
167
+ - Gap findings stored as workflow state for Step 05
168
+ - Auto-proceeded to step 03
169
+
170
+ ### ❌ SYSTEM FAILURE:
171
+
172
+ - Inventing APIs not present in the actual skills
173
+ - Flagging contradictions or issues (that is Step 03)
174
+ - Suggesting capability improvements (that is Step 04)
175
+ - Gaps without evidence citations from generated skills
176
+ - Parsing Mermaid diagrams instead of using prose-based co-mention analysis
177
+ - Hardcoded paths instead of frontmatter variables
178
+
179
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: 'step-03-issue-detection'
3
+ description: 'Find contradictions between architecture claims and verified API reality from skills and optional VS report'
4
+
5
+ nextStepFile: './step-04-improvements.md'
6
+ refinementRulesData: '../data/refinement-rules.md'
7
+ ---
8
+
9
+ # Step 3: Issue Detection
10
+
11
+ ## STEP GOAL:
12
+
13
+ Find contradictions between what the architecture document claims and what the generated skills reveal about actual API surfaces. Detect language boundary issues not addressed, protocol mismatches assumed away, and missing bridge layers. If a VS feasibility report is available, incorporate RISKY and BLOCKED verdicts as confirmed issues.
14
+
15
+ ## MANDATORY EXECUTION RULES (READ FIRST):
16
+
17
+ ### Universal Rules:
18
+
19
+ - 📖 CRITICAL: Read the complete step file before taking any action
20
+ - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
21
+ - ⚙️ 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
22
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
23
+
24
+ ### Role Reinforcement:
25
+
26
+ - ✅ You are an architecture refinement analyst performing contradiction detection
27
+ - ✅ Every issue must cite evidence from actual skill content AND the architecture claim it contradicts
28
+ - ✅ Apply the issue detection rules from {refinementRulesData} strictly
29
+
30
+ ### Step-Specific Rules:
31
+
32
+ - 🎯 Focus ONLY on contradictions between architecture claims and skill API reality
33
+ - 🚫 FORBIDDEN to detect undocumented integration paths — that was Step 02
34
+ - 🚫 FORBIDDEN to suggest capability expansions — that is Step 04
35
+ - 💬 Every issue MUST cite both the architecture claim AND the contradicting skill evidence
36
+
37
+ ## EXECUTION PROTOCOLS:
38
+
39
+ - Load refinement rules for issue detection criteria
40
+ - Extract all integration claims from the architecture document
41
+ - Verify each claim against skill API surfaces
42
+ - Incorporate VS report verdicts if available
43
+ - Append issue findings as workflow state for Step 05
44
+ - Only issue detection — no gap analysis, no improvement suggestions
45
+
46
+ ## CONTEXT BOUNDARIES:
47
+
48
+ - Available: Architecture document content, skill inventory and SKILL.md files, VS feasibility report (if provided), refinement rules
49
+ - Focus: Finding contradictions between documented claims and verified API reality
50
+ - Limits: Only detect issues — do not fill gaps or suggest improvements
51
+ - Dependencies: Step 01 (skill inventory, architecture doc, VS report status), Step 02 (gap analysis complete)
52
+
53
+ ## MANDATORY SEQUENCE
54
+
55
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
56
+
57
+ ### 1. Reference Refinement Rules
58
+
59
+ Use the refinement rules loaded in Step 01 from `{refinementRulesData}`. If not available in context, reload from `{refinementRulesData}`.
60
+
61
+ Extract: issue classification (API Mismatch, Protocol Contradiction, Language Boundary Ignored, Type Incompatibility), VS report integration rules, and citation format.
62
+
63
+ ### 2. Extract Integration Claims from Architecture
64
+
65
+ Parse the architecture document for specific claims about how technologies interact.
66
+
67
+ **Claim types to extract:**
68
+ - **API claims:** "Library X provides/exposes/exports {function/endpoint}"
69
+ - **Protocol claims:** "Library X communicates via {protocol}"
70
+ - **Data flow claims:** "Data flows from X to Y as {format}"
71
+ - **Integration claims:** "X and Y integrate through {mechanism}"
72
+ - **Capability claims:** "Library X handles {capability}"
73
+
74
+ For each claim, record:
75
+ - The exact text or paraphrase from the architecture
76
+ - The section where it appears
77
+ - The libraries referenced
78
+
79
+ ### 3. Verify Claims Against Skill API Surfaces
80
+
81
+ For each extracted claim, load the relevant skill(s) and check:
82
+
83
+ **API Mismatch check:**
84
+ - Does the claimed API actually exist in the skill's export list?
85
+ - Does the function signature match what the architecture describes?
86
+ - If the architecture describes an API that does not appear in the skill: flag as issue
87
+
88
+ **Protocol Contradiction check:**
89
+ - Does the skill document the protocol the architecture assumes?
90
+ - If the architecture claims gRPC but the skill shows HTTP-only: flag as issue
91
+
92
+ **Language Boundary check:**
93
+ - If two libraries are in different languages, does the architecture describe a bridge mechanism?
94
+ - If the architecture assumes direct calls across language boundaries without FFI/IPC: flag as issue
95
+
96
+ **Type Incompatibility check:**
97
+ - Does the architecture assume type compatibility that the skills contradict?
98
+ - If Library A exports Type X but the architecture claims Library B consumes it, and Library B expects Type Y: flag as issue
99
+
100
+ ### 4. Incorporate VS Report (If Available)
101
+
102
+ If `vs_report_available` is true:
103
+
104
+ **Load the VS feasibility report and extract verdicts:**
105
+ - **Risky verdicts** (match case-insensitively: "Risky", "RISKY", "risky"): Promote to confirmed issues with the VS evidence as additional citation
106
+ - **Blocked verdicts** (match case-insensitively: "Blocked", "BLOCKED", "blocked"): Promote to critical issues requiring architecture redesign
107
+ - **Plausible verdicts:** Note informatively — Plausible is not an issue by itself. Only flag as a potential issue if the VS rationale text explicitly states "no direct API evidence" or "weak evidence"
108
+
109
+ **For each VS-sourced issue, include dual citations:**
110
+ - Evidence from the skill content
111
+ - Verdict and rationale from the VS report
112
+
113
+ If `vs_report_available` is false: Skip this section. Issue detection proceeds with skill data only.
114
+
115
+ ### 5. Document Each Issue
116
+
117
+ For each detected issue, apply the citation format from {refinementRulesData}:
118
+
119
+ ```
120
+ **[ISSUE]**: {description}
121
+
122
+ Architecture states: "{quoted claim from original document}" (Section: {section_name})
123
+ Skill reality: {skill_name} exports: `{actual_api}` — {explanation of contradiction}
124
+ {IF VS report}: VS verdict: {Risky|Blocked} for {pair} — {VS rationale}
125
+
126
+ Suggestion: {specific correction with API evidence}
127
+ ```
128
+
129
+ **Severity classification:**
130
+ - **Critical:** Blocked VS verdicts, fundamental language barriers with no bridge
131
+ - **Major:** Risky VS verdicts, protocol mismatches, missing bridge layers
132
+ - **Minor:** Plausible VS verdicts where the VS rationale explicitly states "no direct API evidence" or "weak evidence", minor type differences with easy conversion
133
+
134
+ ### 6. Display Issue Detection Results
135
+
136
+ "**Pass 2: Issue Detection — Architecture vs. API Reality**
137
+
138
+ **Issues Found:** {count} ({critical_count} critical, {major_count} major, {minor_count} minor)
139
+
140
+ {IF issues found:}
141
+ | # | Libraries | Issue Type | Severity | Summary |
142
+ |---|-----------|-----------|----------|---------|
143
+ | {n} | {libs} | {issue_type} | {severity} | {brief description} |
144
+
145
+ {For each issue, display the full citation with evidence and suggestion}
146
+
147
+ {IF no issues found:}
148
+ **No contradictions detected.** Architecture claims align with verified skill API surfaces.
149
+
150
+ **Proceeding to improvement detection...**"
151
+
152
+ Store all issue findings as workflow state for Step 05. To ensure durability across long runs, also append a `<!-- [RA-ISSUES] ... -->` comment block to `{forge_data_folder}/ra-state-{project_name}.md` containing the **complete formatted issue findings** (full citation blocks with architecture claims, skill evidence, VS verdicts, severity, and suggestions — not just counts) — Step 05 can read this back if context degrades. **Do NOT write to `{output_folder}/refined-architecture-{project_name}.md` — that file is created only in step-05.**
153
+
154
+ ### 7. Auto-Proceed to Next Step
155
+
156
+ Load, read the full file and then execute `{nextStepFile}`.
157
+
158
+ ---
159
+
160
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
161
+
162
+ ### ✅ SUCCESS:
163
+
164
+ - Refinement rules loaded from {refinementRulesData}
165
+ - All integration claims extracted from architecture document
166
+ - Each claim verified against actual skill API surfaces
167
+ - VS report verdicts incorporated if report was provided
168
+ - Every issue includes both architecture citation AND contradicting skill evidence
169
+ - Issues classified by severity (Critical, Major, Minor)
170
+ - Issue detection results displayed with count and details
171
+ - Issue findings stored as workflow state for Step 05
172
+ - Auto-proceeded to step 04
173
+
174
+ ### ❌ SYSTEM FAILURE:
175
+
176
+ - Issues without evidence from actual skills (speculation)
177
+ - Not citing the architecture claim that is contradicted
178
+ - Filling gaps (that was Step 02) or suggesting improvements (that is Step 04)
179
+ - Ignoring VS report verdicts when the report was provided
180
+ - Hardcoded paths instead of frontmatter variables
181
+
182
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.