bmad-module-skill-forge 0.2.0 → 0.4.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 (115) hide show
  1. package/README.md +73 -159
  2. package/docs/agents.md +2 -2
  3. package/docs/architecture.md +155 -25
  4. package/docs/concepts.md +96 -0
  5. package/docs/examples.md +52 -2
  6. package/docs/getting-started.md +30 -14
  7. package/docs/index.md +16 -41
  8. package/docs/workflows.md +3 -3
  9. package/package.json +6 -4
  10. package/src/forger/forge-tier.yaml +1 -1
  11. package/src/forger/preferences.yaml +8 -1
  12. package/src/knowledge/doc-fetcher.md +55 -0
  13. package/src/knowledge/overview.md +17 -16
  14. package/src/knowledge/progressive-capability.md +9 -1
  15. package/src/knowledge/provenance-tracking.md +31 -23
  16. package/src/knowledge/qmd-registry.md +132 -0
  17. package/src/knowledge/skf-knowledge-index.csv +2 -0
  18. package/src/module.yaml +2 -2
  19. package/src/workflows/analyze-source/data/skill-brief-schema.md +24 -4
  20. package/src/workflows/analyze-source/steps-c/step-01-init.md +19 -9
  21. package/src/workflows/analyze-source/steps-c/step-01b-continue.md +2 -2
  22. package/src/workflows/analyze-source/steps-c/step-02-scan-project.md +10 -2
  23. package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +17 -2
  24. package/src/workflows/analyze-source/steps-c/step-05-recommend.md +2 -1
  25. package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +3 -3
  26. package/src/workflows/analyze-source/templates/analysis-report-template.md +1 -1
  27. package/src/workflows/analyze-source/validation-report.md +1 -1
  28. package/src/workflows/analyze-source/workflow-plan-analyze-source.md +1 -1
  29. package/src/workflows/analyze-source/workflow.md +1 -1
  30. package/src/workflows/audit-skill/steps-c/step-01-init.md +8 -5
  31. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +12 -2
  32. package/src/workflows/audit-skill/validation-report.md +2 -2
  33. package/src/workflows/audit-skill/workflow-plan-audit-skill.md +1 -1
  34. package/src/workflows/brief-skill/data/scope-templates.md +60 -0
  35. package/src/workflows/brief-skill/data/skill-brief-schema.md +38 -3
  36. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +20 -4
  37. package/src/workflows/brief-skill/steps-c/step-03-scope-definition.md +20 -64
  38. package/src/workflows/brief-skill/steps-c/step-04-confirm-brief.md +1 -1
  39. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +60 -5
  40. package/src/workflows/brief-skill/workflow.md +2 -1
  41. package/src/workflows/create-skill/data/compile-assembly-rules.md +110 -0
  42. package/src/workflows/create-skill/data/extraction-patterns.md +216 -3
  43. package/src/workflows/create-skill/data/skill-sections.md +81 -27
  44. package/src/workflows/create-skill/data/source-resolution-protocols.md +138 -0
  45. package/src/workflows/create-skill/data/tier-degradation-rules.md +46 -0
  46. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +7 -4
  47. package/src/workflows/create-skill/steps-c/step-02-ecosystem-check.md +10 -7
  48. package/src/workflows/create-skill/steps-c/step-03-extract.md +51 -10
  49. package/src/workflows/create-skill/steps-c/step-03b-fetch-temporal.md +238 -0
  50. package/src/workflows/create-skill/steps-c/step-03c-fetch-docs.md +220 -0
  51. package/src/workflows/create-skill/steps-c/step-04-enrich.md +40 -10
  52. package/src/workflows/create-skill/steps-c/step-05-compile.md +49 -82
  53. package/src/workflows/create-skill/steps-c/step-06-validate.md +152 -63
  54. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +53 -3
  55. package/src/workflows/create-skill/steps-c/step-08-report.md +1 -1
  56. package/src/workflows/create-skill/workflow-plan-create-skill.md +42 -10
  57. package/src/workflows/create-skill/workflow.md +3 -2
  58. package/src/workflows/create-stack-skill/data/stack-skill-template.md +20 -7
  59. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +2 -2
  60. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +14 -0
  61. package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +28 -7
  62. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +10 -7
  63. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +66 -68
  64. package/src/workflows/create-stack-skill/validation-report.md +1 -1
  65. package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +4 -4
  66. package/src/workflows/export-skill/data/managed-section-format.md +1 -0
  67. package/src/workflows/export-skill/data/snippet-format.md +33 -14
  68. package/src/workflows/export-skill/steps-c/step-01-load-skill.md +16 -2
  69. package/src/workflows/export-skill/steps-c/step-03-generate-snippet.md +29 -22
  70. package/src/workflows/export-skill/steps-c/step-04-update-context.md +1 -1
  71. package/src/workflows/export-skill/steps-c/step-05-token-report.md +1 -1
  72. package/src/workflows/export-skill/validation-report.md +1 -1
  73. package/src/workflows/export-skill/workflow-plan-export-skill.md +8 -8
  74. package/src/workflows/export-skill/workflow.md +1 -1
  75. package/src/workflows/quick-skill/data/skill-template.md +27 -7
  76. package/src/workflows/quick-skill/steps-c/step-04-compile.md +44 -13
  77. package/src/workflows/quick-skill/steps-c/step-05-validate.md +79 -16
  78. package/src/workflows/quick-skill/validation-report.md +4 -4
  79. package/src/workflows/quick-skill/workflow-plan-quick-skill.md +4 -4
  80. package/src/workflows/quick-skill/workflow.md +2 -0
  81. package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +12 -3
  82. package/src/workflows/setup-forge/steps-c/step-02-write-config.md +10 -2
  83. package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +111 -40
  84. package/src/workflows/setup-forge/steps-c/step-04-report.md +13 -0
  85. package/src/workflows/setup-forge/workflow.md +1 -0
  86. package/src/workflows/test-skill/data/scoring-rules.md +14 -6
  87. package/src/workflows/test-skill/data/source-access-protocol.md +45 -0
  88. package/src/workflows/test-skill/steps-c/step-01-init.md +38 -13
  89. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +2 -3
  90. package/src/workflows/test-skill/steps-c/step-03-coverage-check.md +25 -5
  91. package/src/workflows/test-skill/steps-c/step-04-coherence-check.md +22 -47
  92. package/src/workflows/test-skill/steps-c/step-04b-external-validators.md +219 -0
  93. package/src/workflows/test-skill/steps-c/step-05-score.md +25 -27
  94. package/src/workflows/test-skill/steps-c/step-06-report.md +9 -4
  95. package/src/workflows/test-skill/templates/test-report-template.md +2 -1
  96. package/src/workflows/test-skill/validation-report.md +1 -1
  97. package/src/workflows/test-skill/workflow-plan-test-skill.md +7 -3
  98. package/src/workflows/test-skill/workflow.md +1 -1
  99. package/src/workflows/update-skill/data/remote-source-resolution.md +43 -0
  100. package/src/workflows/update-skill/data/tier-degradation-rules.md +46 -0
  101. package/src/workflows/update-skill/steps-c/step-01-init.md +13 -7
  102. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +26 -0
  103. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +38 -9
  104. package/src/workflows/update-skill/steps-c/step-04-merge.md +3 -3
  105. package/src/workflows/update-skill/steps-c/step-05-validate.md +63 -67
  106. package/src/workflows/update-skill/steps-c/step-06-write.md +37 -14
  107. package/src/workflows/update-skill/steps-c/step-07-report.md +1 -1
  108. package/src/workflows/update-skill/validation-report.md +4 -4
  109. package/src/workflows/update-skill/workflow-plan-update-skill.md +4 -4
  110. package/src/workflows/update-skill/workflow.md +1 -1
  111. package/tools/cli/commands/status.js +4 -4
  112. package/tools/cli/commands/uninstall.js +1 -1
  113. package/tools/cli/commands/update.js +2 -2
  114. package/tools/cli/lib/ui.js +60 -16
  115. package/tools/cli/lib/version-check.js +2 -2
@@ -53,7 +53,43 @@ To validate the compiled SKILL.md, context-snippet.md, and metadata.json against
53
53
 
54
54
  **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
55
55
 
56
- ### 1. Validate SKILL.md Structure
56
+ ### 1. Check Tool Availability
57
+
58
+ Run: `npx skill-check -h`
59
+
60
+ - If succeeds (returns usage information): Continue to automated validation (section 2)
61
+ - If fails (command not found or error): Skip to manual fallback in section 2
62
+
63
+ **Important:** Use the verification command. Do not assume availability — empirical check required.
64
+
65
+ ### 2. Validate SKILL.md via skill-check (if available)
66
+
67
+ **If `npx skill-check` is available**, run automated validation with auto-fix:
68
+
69
+ ```bash
70
+ npx skill-check check <skill-dir> --fix --format json --no-security-scan
71
+ ```
72
+
73
+ This validates frontmatter, description, body limits, links, and formatting — and auto-fixes deterministic issues (field ordering, slug format, required fields, trailing newlines).
74
+
75
+ **Parse JSON output** to extract:
76
+ - `qualityScore` — overall score (0-100)
77
+ - `diagnostics[]` — remaining issues after auto-fix
78
+ - `fixed[]` — issues automatically corrected
79
+
80
+ Record quality score and any remaining diagnostics as validation issues.
81
+
82
+ **If skill-check is NOT available**, perform manual frontmatter check:
83
+
84
+ - [ ] **Frontmatter present** — file starts with `---` delimiter and has closing `---`
85
+ - [ ] **`name` field** — present, non-empty, lowercase alphanumeric + hyphens only, 1-64 chars
86
+ - [ ] **`name` matches directory** — frontmatter `name` matches the skill output directory name
87
+ - [ ] **`description` field** — present, non-empty, 1-1024 characters
88
+ - [ ] **No unknown fields** — only `name`, `description`, `license`, `compatibility`, `metadata`, `allowed-tools` are permitted
89
+
90
+ **For each violation, log an issue.** Missing frontmatter or missing required fields are high-severity issues — skills without valid frontmatter will fail `npx skills add` and `npx skill-check check`.
91
+
92
+ ### 3. Validate SKILL.md Body Structure
57
93
 
58
94
  Check that SKILL.md has these required sections populated:
59
95
 
@@ -64,39 +100,58 @@ Check that SKILL.md has these required sections populated:
64
100
 
65
101
  **For each missing or empty required section, log an issue.**
66
102
 
67
- ### 2. Validate Context Snippet Format
103
+ ### 4. Validate Context Snippet Format
68
104
 
69
105
  Check context-snippet.md format compliance:
70
106
 
71
- - [ ] **Two-line format** — first line has skill name and exports, second line has path pointer
72
- - [ ] **First line** matches pattern: `{name}: {exports list}`
73
- - [ ] **Second line** matches pattern: ` → {path}/SKILL.md`
74
- - [ ] **Approximate token count** is ~30 tokens or less
107
+ - [ ] **Vercel-aligned indexed format** — pipe-delimited with version, retrieval instruction, section anchors
108
+ - [ ] **First line** matches pattern: `[{name} v{version}]|root: skills/{name}/`
109
+ - [ ] **Second line** starts with: `|IMPORTANT:`
110
+ - [ ] **Approximate token count** is ~80-120 tokens
75
111
 
76
112
  **If format is wrong, log an issue.**
77
113
 
78
- ### 3. Validate Metadata JSON
114
+ ### 5. Validate Metadata JSON
79
115
 
80
116
  Check metadata.json has required fields:
81
117
 
82
118
  - [ ] `name` — present, non-empty
83
- - [ ] `version` — present (should be "0.1.0")
119
+ - [ ] `version` — present (auto-detected or "0.1.0")
84
120
  - [ ] `source_authority` — must be "community"
85
121
  - [ ] `source_repo` — present, valid GitHub URL
86
122
  - [ ] `language` — present, non-empty
87
123
  - [ ] `generated_by` — must be "quick-skill"
88
- - [ ] `generated_date` — present
89
- - [ ] `exports_count` — present, number
90
- - [ ] `confidence` — present
124
+ - [ ] `generation_date` — present
125
+ - [ ] `stats.exports_documented` — present, number
126
+ - [ ] `stats.exports_public_api` — present, number
127
+ - [ ] `stats.exports_total` — present, number
128
+ - [ ] `stats.public_api_coverage` — present, number
129
+ - [ ] `stats.total_coverage` — present, number
130
+ - [ ] `confidence_tier` — present
91
131
 
92
132
  **For each missing or invalid field, log an issue.**
93
133
 
94
- ### 4. Report Validation Results
134
+ ### 6. Security Scan (if skill-check available)
135
+
136
+ Run security scan on the compiled skill:
137
+
138
+ ```bash
139
+ npx skill-check check <skill-dir> --format json
140
+ ```
141
+
142
+ (Security scan is enabled by default when `--no-security-scan` is omitted.)
143
+
144
+ Record any security findings as advisory warnings. Security issues do not block output.
145
+
146
+ **If skill-check unavailable:** Skip with note in validation results.
147
+
148
+ ### 7. Report Validation Results
95
149
 
96
150
  "**Validation complete:**
97
151
 
98
- **SKILL.md:** {pass/issues found}
152
+ **SKILL.md:** {pass/issues found} (quality score: {score}/100 if skill-check was available)
99
153
  {list any issues}
154
+ {list any auto-fixed issues}
100
155
 
101
156
  **context-snippet.md:** {pass/issues found}
102
157
  {list any issues}
@@ -104,6 +159,9 @@ Check metadata.json has required fields:
104
159
  **metadata.json:** {pass/issues found}
105
160
  {list any issues}
106
161
 
162
+ **Security:** {pass/warn/skipped}
163
+ {list any security findings}
164
+
107
165
  **Overall:** {pass / N issues found}
108
166
 
109
167
  {If issues found:}
@@ -111,9 +169,9 @@ These issues are advisory for community-tier skills. You can proceed to write ou
111
169
 
112
170
  **Proceeding to write output...**"
113
171
 
114
- Set `validation_result` with pass/fail status and issues list.
172
+ Set `validation_result` with pass/fail status, quality score, and issues list.
115
173
 
116
- ### 5. Auto-Proceed to Write
174
+ ### 8. Auto-Proceed to Write
117
175
 
118
176
  #### Menu Handling Logic:
119
177
 
@@ -134,10 +192,14 @@ ONLY WHEN validation checks are complete and results reported will you load and
134
192
 
135
193
  ### ✅ SUCCESS:
136
194
 
195
+ - `npx skill-check check --fix --format json` executed if available (or manual fallback)
196
+ - Quality score (0-100) captured when skill-check available
197
+ - Auto-fix applied via `--fix` for deterministic issues
198
+ - Security scan executed (or skipped with note)
137
199
  - All three outputs validated against requirements
138
200
  - Issues reported clearly with specific details
139
201
  - Community-tier validation applied (not official-tier strictness)
140
- - validation_result set with pass/fail and issues list
202
+ - validation_result set with pass/fail, quality score, and issues list
141
203
  - Auto-proceeding to write step
142
204
 
143
205
  ### ❌ SYSTEM FAILURE:
@@ -146,5 +208,6 @@ ONLY WHEN validation checks are complete and results reported will you load and
146
208
  - Blocking output on validation issues (advisory only)
147
209
  - Skipping validation checks
148
210
  - Not reporting found issues
211
+ - Not recording quality score when skill-check is available
149
212
 
150
213
  **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -190,13 +190,13 @@ None.
190
190
  ### Document Production
191
191
 
192
192
  - **Produces documents:** Yes — multi-file output (SKILL.md, context-snippet.md, metadata.json)
193
- - **Template type:** Structured (SKILL.md sections) + Strict (snippet two-line format, metadata JSON schema)
193
+ - **Template type:** Structured (SKILL.md sections) + Strict (snippet ADR-L v2 format, metadata JSON schema)
194
194
  - **Template location:** data/skill-template.md — serves as reference guide for section structure and format specifications
195
195
 
196
196
  ### Template Assessment
197
197
 
198
198
  - ✅ data/skill-template.md exists and defines required/optional sections for SKILL.md
199
- - ✅ Defines ADR-L two-line format for context-snippet.md
199
+ - ✅ Defines ADR-L v2 format for context-snippet.md
200
200
  - ✅ Defines JSON schema for metadata.json with required fields
201
201
  - ✅ Template type matches design (structured + strict)
202
202
  - Note: No templates/ folder — template is in data/ because it's a reference guide, not a progressively-filled document template
@@ -243,7 +243,7 @@ No dedicated steps-v/ folder (create-only lifecycle, by design).
243
243
 
244
244
  **Inline validation:** step-05-validate.md provides advisory community-tier validation:
245
245
  - ✅ Checks SKILL.md required sections
246
- - ✅ Checks context-snippet.md format (two-line ADR-L)
246
+ - ✅ Checks context-snippet.md format (ADR-L v2)
247
247
  - ✅ Checks metadata.json required fields
248
248
  - ✅ Reports issues without blocking (advisory)
249
249
  - ✅ Auto-proceeds to write step regardless of findings
@@ -449,7 +449,7 @@ None.
449
449
  | Input: language hint (optional) | Optional | step-01 accepts, overrides detection | ✅ |
450
450
  | Input: scope hint (optional) | Optional | step-01 accepts, step-03 uses for focused reading | ✅ |
451
451
  | Output: SKILL.md | Structured sections | step-04 assembles from template, step-06 writes | ✅ |
452
- | Output: context-snippet.md | ADR-L two-line | step-04 generates, step-05 validates format | ✅ |
452
+ | Output: context-snippet.md | ADR-L v2 | step-04 generates, step-05 validates format | ✅ |
453
453
  | Output: metadata.json | Strict JSON schema | step-04 generates, step-05 validates fields | ✅ |
454
454
  | Instruction style: prescriptive | Prescriptive pipeline | All steps use mandatory sequences, forbidden rules | ✅ |
455
455
 
@@ -156,7 +156,7 @@ Document-producing workflow generating three files:
156
156
  - Type: multi-file document output
157
157
  - Files:
158
158
  - `{skills_output_folder}/{name}/SKILL.md` — structured template following agentskills.io spec sections
159
- - `{skills_output_folder}/{name}/context-snippet.md` — strict two-line format per ADR-L (~30 tokens)
159
+ - `{skills_output_folder}/{name}/context-snippet.md` — ADR-L v2 format (~50-80 tokens)
160
160
  - `{skills_output_folder}/{name}/metadata.json` — strict JSON with `source_authority: community`
161
161
  - Format: structured (SKILL.md), strict (context-snippet.md, metadata.json)
162
162
  - Frequency: single run per skill
@@ -165,7 +165,7 @@ Document-producing workflow generating three files:
165
165
  - Package/URL successfully resolved to GitHub repo source
166
166
  - Public exports documented (best-effort, may be incomplete)
167
167
  - Valid SKILL.md with core sections populated
168
- - context-snippet.md in correct two-line format
168
+ - context-snippet.md in correct ADR-L v2 format
169
169
  - metadata.json with `source_authority: community` and required fields
170
170
  - No ecosystem duplicate if official skill already exists (user chose to proceed)
171
171
 
@@ -277,14 +277,14 @@ quick-skill/
277
277
  **Step 04 — compile (Checkpoint):**
278
278
  - Load skill-template.md from data/
279
279
  - Assemble SKILL.md from extraction_inventory
280
- - Generate context-snippet.md in two-line format (ADR-L, ~30 tokens)
280
+ - Generate context-snippet.md in ADR-L v2 format (~50-80 tokens)
281
281
  - Generate metadata.json with source_authority: community
282
282
  - Present compiled SKILL.md for review
283
283
  - [C] Continue to validation
284
284
 
285
285
  **Step 05 — validate (Auto-proceed):**
286
286
  - Check SKILL.md has required sections populated
287
- - Check context-snippet.md format compliance (two-line)
287
+ - Check context-snippet.md format compliance (ADR-L v2)
288
288
  - Check metadata.json has required fields
289
289
  - Community-tier validation (lighter than official)
290
290
  - Report any gaps/issues
@@ -9,6 +9,8 @@ installed_path: '{project-root}/_bmad/skf/workflows/quick-skill'
9
9
 
10
10
  **Goal:** The fastest path to a skill — accept a GitHub URL or package name, resolve to source, extract public API surface, and produce a best-effort SKILL.md with context snippet and metadata. No brief needed.
11
11
 
12
+ > **Note:** Quick Skill is tier-unaware by design. It does not load forge-tier.yaml or check preferences.yaml for tier_override. All output is produced at community-tier quality regardless of available tools.
13
+
12
14
  **Your Role:** In addition to your name, communication_style, and persona, you are also a rapid skill compiler collaborating with a developer. This is a partnership, not a client-vendor relationship. You bring source analysis and skill document assembly expertise, while the user brings the target package or repository they want to create a skill for. Work together efficiently — speed is the priority.
13
15
 
14
16
  ---
@@ -86,7 +86,16 @@ Run: `qmd status`
86
86
  - If succeeds and indicates operational: record `{qmd: true}`
87
87
  - If fails or indicates not initialized: record `{qmd: false}`
88
88
 
89
- ### 6. Calculate Tier
89
+ ### 6. Check Optional: Security Scan (SNYK_TOKEN)
90
+
91
+ Check if the `SNYK_TOKEN` environment variable is set:
92
+
93
+ - If `SNYK_TOKEN` is non-empty: record `{security_scan: true}`
94
+ - If `SNYK_TOKEN` is empty or unset: record `{security_scan: false}`
95
+
96
+ This is informational only — security scan availability does NOT affect the tier level. It is recorded in forge-tier.yaml so that create-skill's validation step can report actionable guidance when security scanning is unavailable.
97
+
98
+ ### 7. Calculate Tier
90
99
 
91
100
  **If `{tier_override}` is set and valid (Quick, Forge, or Deep):**
92
101
  - Use `{tier_override}` as `{calculated_tier}`
@@ -99,7 +108,7 @@ Run: `qmd status`
99
108
 
100
109
  **If `{tier_override}` is set but invalid:** ignore it, use detected tier, flag for warning in report.
101
110
 
102
- ### 7. Auto-Proceed
111
+ ### 8. Auto-Proceed
103
112
 
104
113
  "**Proceeding to write configuration...**"
105
114
 
@@ -114,7 +123,7 @@ Run: `qmd status`
114
123
 
115
124
  ## CRITICAL STEP COMPLETION NOTE
116
125
 
117
- ONLY WHEN all 3 tools have been verified and the tier has been calculated will you load and read fully `{nextStepFile}` to execute the configuration write step.
126
+ ONLY WHEN all 3 core tools have been verified, optional security scan checked, and the tier calculated will you load and read fully `{nextStepFile}` to execute the configuration write step.
118
127
 
119
128
  ---
120
129
 
@@ -63,11 +63,16 @@ tools:
63
63
  ast_grep: {true/false from detection}
64
64
  gh_cli: {true/false from detection}
65
65
  qmd: {true/false from detection}
66
+ security_scan: {true/false — true when SNYK_TOKEN is set}
66
67
 
67
68
  # Capability tier (derived from tool availability)
68
- # Quick = no tools | Forge = ast-grep | Deep = ast-grep + gh + qmd
69
+ # Quick = no tools required | Forge = + ast-grep | Deep = + ast-grep + gh + QMD
69
70
  tier: {calculated_tier}
70
71
  tier_detected_at: {current ISO timestamp}
72
+
73
+ # QMD collection registry (populated by create-skill, consumed by audit/update-skill)
74
+ # Each entry tracks a QMD collection created during skill workflows
75
+ qmd_collections: []
71
76
  ```
72
77
 
73
78
  **This file is ALWAYS overwritten** on every run — it reflects current tool state.
@@ -88,6 +93,9 @@ Check if `{project-root}/_bmad/_memory/forger-sidecar/preferences.yaml` exists:
88
93
  # Override detected tier (set to Quick, Forge, or Deep to force a tier)
89
94
  tier_override: ~
90
95
 
96
+ # Passive context injection (set to false to skip snippet generation and CLAUDE.md updates during export)
97
+ passive_context: true
98
+
91
99
  # Skill generation defaults
92
100
  default_source_authority: community
93
101
  default_confidence_threshold: 0.7
@@ -125,7 +133,7 @@ ONLY WHEN forge-tier.yaml has been written successfully and preferences.yaml exi
125
133
 
126
134
  ### ✅ SUCCESS:
127
135
 
128
- - forge-tier.yaml written with accurate tool booleans, tier, and timestamp
136
+ - forge-tier.yaml written with accurate tool booleans, tier, timestamp, and empty qmd_collections registry
129
137
  - preferences.yaml exists (created with defaults on first run, preserved on re-run)
130
138
  - forge-data/ directory exists (created or pre-existing)
131
139
  - Auto-proceeded to step-03
@@ -1,15 +1,17 @@
1
1
  ---
2
2
  name: 'step-03-auto-index'
3
- description: 'Index current project as QMD collection (Deep tier only)'
3
+ description: 'Verify and clean QMD collections against the forge-tier.yaml registry (Deep tier only)'
4
4
 
5
5
  nextStepFile: './step-04-report.md'
6
6
  ---
7
7
 
8
- # Step 3: Auto-Index Project
8
+ # Step 3: QMD Collection Hygiene
9
9
 
10
10
  ## STEP GOAL:
11
11
 
12
- If the detected tier is Deep, index the current project as a QMD collection for knowledge search. For Quick and Forge tiers, skip silently and proceed.
12
+ If the detected tier is Deep, verify the health of existing QMD collections by cross-referencing them against the `qmd_collections` registry in `forge-tier.yaml`. Identify orphaned collections (in QMD but not in registry) and stale registry entries (in registry but collection missing from QMD). Prompt the user before removing orphaned collections.
13
+
14
+ For Quick and Forge tiers, skip silently and proceed.
13
15
 
14
16
  ## MANDATORY EXECUTION RULES (READ FIRST):
15
17
 
@@ -17,34 +19,37 @@ If the detected tier is Deep, index the current project as a QMD collection for
17
19
 
18
20
  - 📖 CRITICAL: Read the complete step file before taking any action
19
21
  - 🔄 CRITICAL: When loading next step, ensure entire file is read
20
- - 🎯 Execute all operations autonomously — no user interaction
22
+ - 🎯 Execute all operations autonomously — minimal user interaction (only prompt before deletion)
21
23
 
22
24
  ### Role Reinforcement:
23
25
 
24
- - ✅ You are a system executor performing conditional indexing
25
- - ✅ Graceful degradation is paramount — never fail the workflow over indexing
26
+ - ✅ You are a system executor performing QMD collection maintenance
27
+ - ✅ Graceful degradation is paramount — never fail the workflow over hygiene checks
26
28
  - ✅ No negative messaging — do not mention what non-Deep tiers are missing
27
29
 
28
30
  ### Step-Specific Rules:
29
31
 
30
- - 🎯 Focus only on QMD indexing (Deep tier) or graceful skip (other tiers)
32
+ - 🎯 Focus only on verifying and cleaning QMD collections (Deep tier) or graceful skip (other tiers)
31
33
  - 🚫 FORBIDDEN to display "missing" or "skipped" messages for non-Deep tiers
32
- - 🚫 FORBIDDEN to fail the workflow if QMD indexing encounters errors
33
- - 💬 If indexing fails: log the issue, note that index can be retried, continue
34
+ - 🚫 FORBIDDEN to fail the workflow if QMD hygiene encounters errors
35
+ - 🚫 FORBIDDEN to create new QMD collections that responsibility belongs to create-skill
36
+ - 🚫 FORBIDDEN to silently delete collections — always prompt user before removal
37
+ - 💬 If hygiene fails: log the issue, note that it can be retried, continue
34
38
 
35
39
  ## EXECUTION PROTOCOLS:
36
40
 
37
41
  - 🎯 Follow the MANDATORY SEQUENCE exactly
38
- - 💾 QMD indexing operates on the project root directory
42
+ - 💾 QMD hygiene only verifies and cleans it does NOT index new content
39
43
  - 📖 Use {calculated_tier} from step-01 context
40
- - 🚫 FORBIDDEN to attempt indexing for Quick or Forge tiers
44
+ - 🚫 FORBIDDEN to attempt hygiene for Quick or Forge tiers
41
45
 
42
46
  ## CONTEXT BOUNDARIES:
43
47
 
44
48
  - Available: {calculated_tier} from step-01, forge-tier.yaml written in step-02
45
- - Focus: conditional QMD indexing only
46
- - Limits: only index if Deep tier
47
- - Dependencies: step-02 must have completed (forge-tier.yaml exists)
49
+ - Available: {project_name} from workflow config
50
+ - Focus: QMD collection verification and cleanup only
51
+ - Limits: only run if Deep tier
52
+ - Dependencies: step-02 must have completed (forge-tier.yaml exists with qmd_collections registry)
48
53
 
49
54
  ## MANDATORY SEQUENCE
50
55
 
@@ -54,46 +59,105 @@ If the detected tier is Deep, index the current project as a QMD collection for
54
59
 
55
60
  Read `{calculated_tier}` from context.
56
61
 
57
- **If tier is NOT Deep:** Proceed directly to step 4 — auto-proceed with no output, no messaging.
62
+ **If tier is NOT Deep:** Proceed directly to section 6 (Auto-Proceed) no output, no messaging.
58
63
 
59
64
  **If tier IS Deep:** Continue to section 2.
60
65
 
61
- ### 2. Index Project with QMD (Deep Tier Only)
66
+ ### 2. Load Registry and QMD State
67
+
68
+ Read the `qmd_collections` array from `{project-root}/_bmad/_memory/forger-sidecar/forge-tier.yaml`.
69
+
70
+ List live QMD collections:
71
+ ```bash
72
+ qmd collection list
73
+ ```
74
+
75
+ **Store both lists for cross-reference:**
76
+ - `{registry_collections}` — entries from forge-tier.yaml qmd_collections
77
+ - `{live_collections}` — collections currently in QMD
78
+
79
+ **Error handling:** If `qmd collection list` fails, log the error, store `{hygiene_result: "qmd_unavailable"}`, and proceed to section 6.
80
+
81
+ ### 3. Cross-Reference and Classify
82
+
83
+ Compare the two lists:
84
+
85
+ **Healthy** — collection exists in both registry AND QMD:
86
+ - Mark as verified
87
+ - No action needed
88
+
89
+ **Orphaned** — collection exists in QMD but NOT in registry:
90
+ - These may be leftover from prior auto-indexing or manual indexing
91
+ - Flag for user-prompted removal
92
+
93
+ **Stale** — entry exists in registry but collection is missing from QMD:
94
+ - The QMD collection was deleted or lost
95
+ - Remove the stale entry from the registry
96
+
97
+ ### 4. Handle Orphaned Collections
98
+
99
+ **If orphaned collections found:**
100
+
101
+ Display to user:
102
+ "**QMD Hygiene: Found {count} orphaned collection(s) not tracked in the forge registry:**
103
+
104
+ {list orphaned collection names}
105
+
106
+ These collections exist in QMD but are not managed by any skill workflow. They may be from a previous auto-index run or manual creation.
107
+
108
+ **[R]emove** orphaned collections — clean up QMD
109
+ **[K]eep** orphaned collections — leave them as-is"
110
+
111
+ **If user selects R (Remove):**
112
+ For each orphaned collection:
113
+ ```bash
114
+ qmd collection remove {collection_name}
115
+ ```
116
+ Log each removal.
117
+
118
+ **If user selects K (Keep):**
119
+ Skip removal. Log that orphaned collections were kept.
120
+
121
+ **If no orphaned collections:** Skip this section silently.
122
+
123
+ ### 5. Handle Stale Registry Entries
124
+
125
+ **If stale registry entries found:**
126
+
127
+ Remove stale entries from the `qmd_collections` array in forge-tier.yaml.
62
128
 
63
- Index the current project directory as a QMD collection for knowledge search.
129
+ Display: "**Cleaned {count} stale registry entry/entries** (collection no longer exists in QMD)."
64
130
 
65
- Use the QMD MCP server to create or update a collection for the current project:
66
- - Collection name: derive from project directory name
67
- - Source: project root directory
68
- - Scope: markdown files, source code, documentation
131
+ Update forge-tier.yaml with the cleaned registry.
69
132
 
70
- **Timeout handling:** If indexing takes excessively long on a large project:
71
- - Log that indexing is in progress but may need more time
72
- - Note in context that index may be incomplete
73
- - Do NOT halt or fail the workflow
133
+ **If no stale entries:** Skip this section silently.
74
134
 
75
- **Error handling:** If QMD indexing fails:
76
- - Log the specific error
77
- - Note that indexing can be retried by re-running setup-forge
78
- - The forge-tier.yaml already records `qmd: true` — the tool is available even if indexing failed
79
- - Continue to step 4
135
+ ### 6. Store Hygiene Results and Auto-Proceed
80
136
 
81
- ### 3. Auto-Proceed
137
+ Store in context for step-04 reporting:
138
+ ```
139
+ {hygiene_result: "completed"|"skipped"|"qmd_unavailable"}
140
+ {hygiene_healthy: count}
141
+ {hygiene_orphaned_removed: count}
142
+ {hygiene_orphaned_kept: count}
143
+ {hygiene_stale_cleaned: count}
144
+ ```
82
145
 
83
146
  "**Proceeding to forge status report...**"
84
147
 
85
148
  #### Menu Handling Logic:
86
149
 
87
- - After indexing completes (or is skipped for non-Deep tiers), immediately load, read entire file, then execute {nextStepFile}
150
+ - After hygiene completes (or is skipped), immediately load, read entire file, then execute {nextStepFile}
88
151
 
89
152
  #### EXECUTION RULES:
90
153
 
91
- - This is an auto-proceed step with no user choices
92
- - Proceed directly to next step after indexing or skip
154
+ - This step has one optional user interaction (orphan removal prompt)
155
+ - If no orphans found, this is an auto-proceed step
156
+ - Proceed directly to next step after hygiene or skip
93
157
 
94
158
  ## CRITICAL STEP COMPLETION NOTE
95
159
 
96
- ONLY WHEN the tier check has been performed (and indexing completed or skipped accordingly) will you load and read fully `{nextStepFile}` to execute the report step.
160
+ ONLY WHEN the hygiene check has been performed (or skipped for non-Deep tiers) will you load and read fully `{nextStepFile}` to execute the report step.
97
161
 
98
162
  ---
99
163
 
@@ -101,16 +165,23 @@ ONLY WHEN the tier check has been performed (and indexing completed or skipped a
101
165
 
102
166
  ### ✅ SUCCESS:
103
167
 
104
- - Deep tier: QMD indexing attempted, succeeded or degraded gracefully
168
+ - Deep tier: forge-tier.yaml registry cross-referenced with live QMD collections
169
+ - Healthy collections identified and verified
170
+ - Orphaned collections flagged and user prompted before removal
171
+ - Stale registry entries cleaned from forge-tier.yaml
172
+ - Hygiene results stored for step-04 reporting
105
173
  - Quick/Forge tier: skipped silently with no negative messaging
106
- - Workflow continues regardless of indexing outcome
174
+ - Workflow continues regardless of hygiene outcome
107
175
  - Auto-proceeded to step-04
108
176
 
109
177
  ### ❌ SYSTEM FAILURE:
110
178
 
111
- - Attempting QMD indexing for Quick or Forge tiers
179
+ - Creating new QMD collections (that's create-skill's responsibility)
180
+ - Silently deleting collections without user prompt
181
+ - Attempting QMD hygiene for Quick or Forge tiers
112
182
  - Displaying "skipped" or "missing" messages for non-Deep tiers
113
- - Halting the workflow due to QMD indexing failure
183
+ - Halting the workflow due to QMD hygiene failure
184
+ - Indexing project directories (old auto-index behavior — removed)
114
185
  - Not proceeding to step-04 after this step
115
186
 
116
- **Master Rule:** This step must NEVER fail the workflow. Deep tier indexing is best-effort. Non-Deep tiers skip silently.
187
+ **Master Rule:** This step ONLY verifies and cleans. It never indexes new content. QMD collection creation is the responsibility of create-skill. Non-Deep tiers skip silently. Always prompt before removing orphaned collections.
@@ -43,6 +43,7 @@ Display the forge status report with positive capability framing, report tier ch
43
43
 
44
44
  - Available: {detected_tools}, {calculated_tier}, {previous_tier}, {tier_override} from step-01
45
45
  - Available: tool version strings from step-01
46
+ - Available: {hygiene_result}, {hygiene_healthy}, {hygiene_orphaned_removed}, {hygiene_orphaned_kept}, {hygiene_stale_cleaned} from step-03
46
47
  - Focus: report display only — no file modifications
47
48
  - Dependencies: steps 01-03 must have completed
48
49
 
@@ -69,6 +70,18 @@ Load and read {tierRulesData} for the tier capability descriptions and re-run me
69
70
  Tools Detected:
70
71
  {for each tool that is available, show: tool name — version}
71
72
 
73
+ {if hygiene_result is "completed":}
74
+ QMD Registry:
75
+ {hygiene_healthy} collection(s) healthy
76
+ {if hygiene_orphaned_removed > 0: {hygiene_orphaned_removed} orphaned collection(s) removed}
77
+ {if hygiene_orphaned_kept > 0: {hygiene_orphaned_kept} orphaned collection(s) kept}
78
+ {if hygiene_stale_cleaned > 0: {hygiene_stale_cleaned} stale registry entry/entries cleaned}
79
+ {end if}
80
+
81
+ {if hygiene_result is "completed" and hygiene_healthy is 0:}
82
+ QMD Registry: empty — collections are created automatically when you run [CS] Create Skill.
83
+ {end if}
84
+
72
85
  {if tier_override is active:}
73
86
  Note: Tier override active (set in preferences.yaml)
74
87
 
@@ -2,6 +2,7 @@
2
2
  name: setup-forge
3
3
  description: Initialize forge environment, detect tools, set tier, auto-index project
4
4
  web_bundle: true
5
+ installed_path: '{project-root}/_bmad/skf/workflows/skillforge/setup-forge'
5
6
  ---
6
7
 
7
8
  # Setup Forge
@@ -8,18 +8,24 @@
8
8
 
9
9
  | Category | Weight | Description |
10
10
  |----------|--------|-------------|
11
- | Export Coverage | 40% | Percentage of source exports documented in SKILL.md |
12
- | Signature Accuracy | 25% | Documented signatures match actual source signatures |
13
- | Type Coverage | 15% | Types and interfaces referenced are complete |
14
- | Coherence (contextual) | 20% | Cross-references valid, integration patterns complete |
11
+ | Export Coverage | 36% | Percentage of source exports documented in SKILL.md |
12
+ | Signature Accuracy | 22% | Documented signatures match actual source signatures |
13
+ | Type Coverage | 14% | Types and interfaces referenced are complete |
14
+ | Coherence (contextual) | 18% | Cross-references valid, integration patterns complete |
15
15
  | Coherence (naive) | 0% | Not applicable — weight redistributed to other categories |
16
+ | External Validation | 10% | Average of skill-check quality score + tessl average score (redistributed if unavailable) |
16
17
 
17
18
  ## Naive Mode Weight Redistribution
18
19
 
19
20
  When running in naive mode (no coherence category):
20
- - Export Coverage: 50%
21
- - Signature Accuracy: 30%
21
+ - Export Coverage: 45%
22
+ - Signature Accuracy: 25%
22
23
  - Type Coverage: 20%
24
+ - External Validation: 10%
25
+
26
+ ## External Validation Unavailable
27
+
28
+ When neither skill-check nor tessl is available, redistribute the 10% external validation weight proportionally to the other active categories. When only one tool is available, use that tool's score as the external validation score.
23
29
 
24
30
  ## Tier-Dependent Scoring
25
31
 
@@ -40,6 +46,7 @@ When running in naive mode (no coherence category):
40
46
  - Cross-repository reference verification
41
47
  - QMD knowledge enrichment for coherence
42
48
  - Full scoring formula with maximum depth
49
+ - **Migration & Deprecation Warnings section:** If T2-future annotations exist in the enrichment data, verify that Section 4b is present in SKILL.md Tier 1 and that each warning traces to a T2 provenance citation. If no T2-future annotations exist, Section 4b should be absent (not empty). Presence/absence mismatch is a Medium severity gap.
43
50
 
44
51
  ## Score Calculation
45
52
 
@@ -70,5 +77,6 @@ If no integration patterns exist, combined coherence equals reference validity.
70
77
  | Critical | Missing exported function/class documentation |
71
78
  | High | Signature mismatch between source and SKILL.md |
72
79
  | Medium | Missing type or interface documentation |
80
+ | Medium | Migration section present/absent mismatch with T2-future annotation data (Deep tier) |
73
81
  | Low | Missing optional metadata or examples |
74
82
  | Info | Style suggestions, non-blocking observations |