bmad-module-skill-forge 0.6.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 (136) 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 +85 -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 +1 -1
  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 +10 -7
  21. package/src/knowledge/progressive-capability.md +3 -2
  22. package/src/knowledge/qmd-registry.md +4 -1
  23. package/src/knowledge/skf-knowledge-index.csv +1 -0
  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 +3 -0
  29. package/src/workflows/README.md +35 -17
  30. package/src/workflows/analyze-source/data/skill-brief-schema.md +18 -5
  31. package/src/workflows/analyze-source/steps-c/step-01-init.md +2 -2
  32. package/src/workflows/analyze-source/steps-c/step-01b-continue.md +1 -1
  33. package/src/workflows/analyze-source/steps-c/step-02-scan-project.md +1 -1
  34. package/src/workflows/analyze-source/steps-c/step-03-identify-units.md +1 -1
  35. package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +1 -1
  36. package/src/workflows/analyze-source/steps-c/step-05-recommend.md +1 -1
  37. package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +2 -2
  38. package/src/workflows/analyze-source/workflow.md +2 -2
  39. package/src/workflows/audit-skill/data/severity-rules.md +1 -1
  40. package/src/workflows/audit-skill/steps-c/step-01-init.md +1 -0
  41. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +5 -0
  42. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +1 -1
  43. package/src/workflows/audit-skill/workflow.md +2 -1
  44. package/src/workflows/brief-skill/data/scope-templates.md +10 -0
  45. package/src/workflows/brief-skill/data/skill-brief-schema.md +25 -23
  46. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +1 -1
  47. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +3 -0
  48. package/src/workflows/create-skill/data/skill-sections.md +12 -11
  49. package/src/workflows/create-skill/data/source-resolution-protocols.md +1 -1
  50. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +13 -9
  51. package/src/workflows/create-skill/steps-c/step-03-extract.md +15 -19
  52. package/src/workflows/create-skill/steps-c/step-03b-fetch-temporal.md +3 -3
  53. package/src/workflows/create-skill/steps-c/step-03c-fetch-docs.md +3 -1
  54. package/src/workflows/create-skill/steps-c/step-04-enrich.md +1 -1
  55. package/src/workflows/create-skill/steps-c/step-05-compile.md +4 -3
  56. package/src/workflows/create-skill/steps-c/step-06-validate.md +2 -2
  57. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +33 -44
  58. package/src/workflows/create-skill/steps-c/step-08-report.md +25 -11
  59. package/src/workflows/create-skill/workflow.md +2 -2
  60. package/src/workflows/create-stack-skill/data/compose-mode-rules.md +65 -0
  61. package/src/workflows/create-stack-skill/data/stack-skill-template.md +28 -6
  62. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +23 -7
  63. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +35 -2
  64. package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +26 -2
  65. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +24 -0
  66. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +30 -2
  67. package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +5 -1
  68. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +53 -5
  69. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +3 -3
  70. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +8 -2
  71. package/src/workflows/create-stack-skill/workflow.md +2 -2
  72. package/src/workflows/export-skill/data/managed-section-format.md +8 -1
  73. package/src/workflows/export-skill/data/snippet-format.md +1 -1
  74. package/src/workflows/export-skill/steps-c/step-04-update-context.md +7 -2
  75. package/src/workflows/export-skill/steps-c/step-05-token-report.md +1 -1
  76. package/src/workflows/export-skill/workflow.md +3 -1
  77. package/src/workflows/quick-skill/data/skill-template.md +18 -6
  78. package/src/workflows/quick-skill/steps-c/step-04-compile.md +26 -6
  79. package/src/workflows/quick-skill/steps-c/step-05-validate.md +1 -1
  80. package/src/workflows/quick-skill/steps-c/step-06-write.md +3 -0
  81. package/src/workflows/quick-skill/workflow.md +1 -1
  82. package/src/workflows/refine-architecture/data/refinement-rules.md +102 -0
  83. package/src/workflows/refine-architecture/steps-c/step-01-init.md +188 -0
  84. package/src/workflows/refine-architecture/steps-c/step-02-gap-analysis.md +179 -0
  85. package/src/workflows/refine-architecture/steps-c/step-03-issue-detection.md +182 -0
  86. package/src/workflows/refine-architecture/steps-c/step-04-improvements.md +169 -0
  87. package/src/workflows/refine-architecture/steps-c/step-05-compile.md +200 -0
  88. package/src/workflows/refine-architecture/steps-c/step-06-report.md +147 -0
  89. package/src/workflows/refine-architecture/workflow.md +61 -0
  90. package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +2 -1
  91. package/src/workflows/setup-forge/steps-c/step-01b-ccc-index.md +1 -1
  92. package/src/workflows/setup-forge/steps-c/step-02-write-config.md +15 -16
  93. package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +1 -1
  94. package/src/workflows/setup-forge/steps-c/step-04-report.md +2 -2
  95. package/src/workflows/setup-forge/workflow.md +3 -2
  96. package/src/workflows/test-skill/data/scoring-rules.md +3 -0
  97. package/src/workflows/test-skill/data/source-access-protocol.md +1 -1
  98. package/src/workflows/test-skill/steps-c/step-01-init.md +1 -0
  99. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +2 -0
  100. package/src/workflows/test-skill/workflow.md +2 -2
  101. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +2 -2
  102. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +5 -2
  103. package/src/workflows/update-skill/steps-c/step-05-validate.md +7 -11
  104. package/src/workflows/update-skill/steps-c/step-06-write.md +5 -2
  105. package/src/workflows/update-skill/workflow.md +1 -1
  106. package/src/workflows/verify-stack/data/coverage-patterns.md +45 -0
  107. package/src/workflows/verify-stack/data/feasibility-report-template.md +63 -0
  108. package/src/workflows/verify-stack/data/integration-verification-rules.md +73 -0
  109. package/src/workflows/verify-stack/steps-c/step-01-init.md +174 -0
  110. package/src/workflows/verify-stack/steps-c/step-02-coverage.md +181 -0
  111. package/src/workflows/verify-stack/steps-c/step-03-integrations.md +195 -0
  112. package/src/workflows/verify-stack/steps-c/step-04-requirements.md +168 -0
  113. package/src/workflows/verify-stack/steps-c/step-05-synthesize.md +191 -0
  114. package/src/workflows/verify-stack/steps-c/step-06-report.md +197 -0
  115. package/src/workflows/verify-stack/workflow.md +61 -0
  116. package/src/workflows/analyze-source/validation-report.md +0 -657
  117. package/src/workflows/analyze-source/workflow-plan-analyze-source.md +0 -385
  118. package/src/workflows/audit-skill/validation-report.md +0 -545
  119. package/src/workflows/audit-skill/workflow-plan-audit-skill.md +0 -318
  120. package/src/workflows/brief-skill/validation-report.md +0 -630
  121. package/src/workflows/brief-skill/workflow-plan-brief-skill.md +0 -360
  122. package/src/workflows/create-skill/validation-report.md +0 -189
  123. package/src/workflows/create-skill/workflow-plan-create-skill.md +0 -525
  124. package/src/workflows/create-stack-skill/validation-report.md +0 -401
  125. package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +0 -481
  126. package/src/workflows/export-skill/validation-report.md +0 -263
  127. package/src/workflows/export-skill/workflow-plan-export-skill.md +0 -369
  128. package/src/workflows/quick-skill/validation-report.md +0 -543
  129. package/src/workflows/quick-skill/workflow-plan-quick-skill.md +0 -405
  130. package/src/workflows/setup-forge/validation-report.md +0 -504
  131. package/src/workflows/setup-forge/workflow-plan-setup-forge.md +0 -430
  132. package/src/workflows/test-skill/validation-report.md +0 -390
  133. package/src/workflows/test-skill/workflow-plan-test-skill.md +0 -292
  134. package/src/workflows/update-skill/data/tier-degradation-rules.md +0 -46
  135. package/src/workflows/update-skill/validation-report.md +0 -559
  136. package/src/workflows/update-skill/workflow-plan-update-skill.md +0 -441
@@ -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.
@@ -0,0 +1,169 @@
1
+ ---
2
+ name: 'step-04-improvements'
3
+ description: 'Suggest capability expansions from skill data not leveraged in the architecture'
4
+
5
+ nextStepFile: './step-05-compile.md'
6
+ refinementRulesData: '../data/refinement-rules.md'
7
+ ---
8
+
9
+ # Step 4: Improvement Detection
10
+
11
+ ## STEP GOAL:
12
+
13
+ Identify capability expansions — library features documented in the generated skills that the architecture does not leverage. Detect unused capabilities, cross-library synergies visible from skill API surfaces, and alternative patterns that could strengthen the architecture. For each improvement, document the capability and suggest how to incorporate it.
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 identifying untapped capabilities
27
+ - ✅ Every improvement must cite specific APIs from the generated skills — no speculation
28
+ - ✅ Improvements are suggestions, not mandates — present them as optional enhancements
29
+
30
+ ### Step-Specific Rules:
31
+
32
+ - 🎯 Focus ONLY on capability expansions not leveraged in the architecture
33
+ - 🚫 FORBIDDEN to detect gaps (Step 02) or issues (Step 03) — those are already captured
34
+ - 🎯 Improvements are ADDITIVE suggestions — they enhance, not contradict, the architecture
35
+ - 💬 Every improvement MUST include evidence citations from actual skill content
36
+
37
+ ## EXECUTION PROTOCOLS:
38
+
39
+ - Load refinement rules for improvement detection criteria
40
+ - Compare full skill API surfaces against architecture usage
41
+ - Detect unused capabilities, cross-library synergies, and alternative patterns
42
+ - Append improvement findings as workflow state for Step 05
43
+ - Only improvement detection — no gap or issue analysis
44
+
45
+ ## CONTEXT BOUNDARIES:
46
+
47
+ - Available: Architecture document content, skill inventory and SKILL.md files, refinement rules
48
+ - Focus: Finding capabilities in skills that the architecture does not use
49
+ - Limits: Only detect improvements — do not re-detect gaps or issues from earlier steps
50
+ - Dependencies: Step 01 (skill inventory), Steps 02-03 (complete — do not duplicate findings)
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: improvement classification (Unused Capability, Cross-Library Synergy, Alternative Pattern), detection method, and citation format.
61
+
62
+ ### 2. Build Architecture Usage Map
63
+
64
+ For each library referenced in the architecture document, extract how it is used:
65
+
66
+ - What capabilities are described (e.g., "Loro for real-time data sync")
67
+ - What APIs or features are referenced
68
+ - What role it plays in the architecture
69
+
70
+ This creates a map of `{library} -> {described_usage[]}` for comparison against full skill API surfaces.
71
+
72
+ ### 3. Compare Skill API Surfaces Against Architecture Usage
73
+
74
+ For each skill in the inventory:
75
+
76
+ **Load the full API surface from SKILL.md:**
77
+ - All exported functions with signatures
78
+ - All exported types and interfaces
79
+ - All documented capabilities and features
80
+ - All protocol support indicators
81
+
82
+ **Compare against the architecture usage map:**
83
+ - Which exports does the architecture reference or imply usage of?
84
+ - Which exports are NOT referenced in the architecture at all?
85
+
86
+ **For each unreferenced capability:**
87
+ - Evaluate relevance: would this capability strengthen the architecture?
88
+ - Skip trivial or internal-only exports (utilities, helpers, debug functions)
89
+ - Flag capabilities that could address architectural concerns or expand functionality
90
+
91
+ ### 4. Detect Cross-Library Synergies
92
+
93
+ Examine pairs of skills for complementary capabilities not exploited in the architecture:
94
+
95
+ - Does Library A export an event system that Library B could consume?
96
+ - Does Library A produce a data format that Library B has an optimized processor for?
97
+ - Do two libraries offer overlapping capabilities that could be unified?
98
+
99
+ **Only flag synergies where both sides have documented APIs** — do not speculate about undocumented features.
100
+
101
+ ### 5. Document Each Improvement
102
+
103
+ For each detected improvement, apply the citation format from {refinementRulesData}:
104
+
105
+ ```
106
+ **[IMPROVEMENT]**: {description}
107
+
108
+ Evidence:
109
+ - {skill_name} exports: `{function}({params}) -> {return_type}`
110
+ - Architecture uses: {what the architecture currently describes}
111
+ - Untapped: {what the skill offers that the architecture does not mention}
112
+
113
+ Suggestion: {how to incorporate this capability into the architecture}
114
+ ```
115
+
116
+ **Categorize improvements:**
117
+ - **High:** Capabilities that address known architectural concerns or significantly expand functionality
118
+ - **Medium:** Capabilities that add convenience or efficiency improvements
119
+ - **Low:** Capabilities that are nice-to-have but not impactful
120
+
121
+ ### 6. Display Improvement Suggestions
122
+
123
+ "**Pass 3: Improvement Detection — Untapped Capabilities**
124
+
125
+ **Improvements Found:** {count} ({high_count} high value, {medium_count} medium, {low_count} low)
126
+
127
+ {IF improvements found:}
128
+ | # | Library | Improvement Type | Value | Summary |
129
+ |---|---------|-----------------|-------|---------|
130
+ | {n} | {lib} | {type} | {value} | {brief description} |
131
+
132
+ {For each improvement, display the full citation with evidence and suggestion}
133
+
134
+ {IF no improvements found:}
135
+ **No untapped capabilities detected.** The architecture fully leverages the skill API surfaces.
136
+
137
+ **Proceeding to compile refined architecture...**"
138
+
139
+ Store all improvement findings as workflow state for Step 05. To ensure durability across long runs, also append a `<!-- [RA-IMPROVEMENTS] ... -->` comment block to `{forge_data_folder}/ra-state-{project_name}.md` containing the **complete formatted improvement findings** (full citation blocks with evidence, value ratings, 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.**
140
+
141
+ ### 7. Auto-Proceed to Next Step
142
+
143
+ Load, read the full file and then execute `{nextStepFile}`.
144
+
145
+ ---
146
+
147
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
148
+
149
+ ### ✅ SUCCESS:
150
+
151
+ - Refinement rules loaded from {refinementRulesData}
152
+ - Architecture usage map built for each referenced library
153
+ - Full skill API surfaces compared against architecture usage
154
+ - Cross-library synergies checked for complementary capabilities
155
+ - Every improvement includes evidence citations from actual skill content
156
+ - Improvements categorized by value (High, Medium, Low)
157
+ - Improvement results displayed with count and details
158
+ - Improvement findings stored as workflow state for Step 05
159
+ - Auto-proceeded to step 05
160
+
161
+ ### ❌ SYSTEM FAILURE:
162
+
163
+ - Improvements without evidence from actual skills (speculation)
164
+ - Re-detecting gaps (Step 02) or issues (Step 03)
165
+ - Presenting trivial internal-only exports as improvements
166
+ - Not categorizing improvements by value
167
+ - Hardcoded paths instead of frontmatter variables
168
+
169
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.