bmad-module-skill-forge 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -0
- package/LICENSE +26 -0
- package/README.md +213 -0
- package/docs/404.md +20 -0
- package/docs/agents.md +73 -0
- package/docs/architecture.md +301 -0
- package/docs/examples.md +144 -0
- package/docs/getting-started.md +198 -0
- package/docs/index.md +75 -0
- package/docs/workflows.md +190 -0
- package/package.json +109 -0
- package/src/agents/forger.agent.yaml +93 -0
- package/src/forger/README.md +17 -0
- package/src/forger/forge-tier.yaml +13 -0
- package/src/forger/preferences.yaml +10 -0
- package/src/knowledge/agentskills-spec.md +158 -0
- package/src/knowledge/confidence-tiers.md +153 -0
- package/src/knowledge/manual-section-integrity.md +156 -0
- package/src/knowledge/overview.md +56 -0
- package/src/knowledge/progressive-capability.md +120 -0
- package/src/knowledge/provenance-tracking.md +163 -0
- package/src/knowledge/skf-knowledge-index.csv +9 -0
- package/src/knowledge/skill-lifecycle.md +150 -0
- package/src/knowledge/zero-hallucination.md +101 -0
- package/src/module-help.csv +12 -0
- package/src/module.yaml +22 -0
- package/src/workflows/README.md +148 -0
- package/src/workflows/analyze-source/data/skill-brief-schema.md +75 -0
- package/src/workflows/analyze-source/data/unit-detection-heuristics.md +88 -0
- package/src/workflows/analyze-source/steps-c/step-01-init.md +191 -0
- package/src/workflows/analyze-source/steps-c/step-01b-continue.md +144 -0
- package/src/workflows/analyze-source/steps-c/step-02-scan-project.md +208 -0
- package/src/workflows/analyze-source/steps-c/step-03-identify-units.md +199 -0
- package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +222 -0
- package/src/workflows/analyze-source/steps-c/step-05-recommend.md +236 -0
- package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +239 -0
- package/src/workflows/analyze-source/templates/analysis-report-template.md +41 -0
- package/src/workflows/analyze-source/validation-report.md +657 -0
- package/src/workflows/analyze-source/workflow-plan-analyze-source.md +385 -0
- package/src/workflows/analyze-source/workflow.md +61 -0
- package/src/workflows/audit-skill/data/drift-report-template.md +62 -0
- package/src/workflows/audit-skill/data/severity-rules.md +52 -0
- package/src/workflows/audit-skill/steps-c/step-01-init.md +195 -0
- package/src/workflows/audit-skill/steps-c/step-02-re-index.md +191 -0
- package/src/workflows/audit-skill/steps-c/step-03-structural-diff.md +194 -0
- package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +199 -0
- package/src/workflows/audit-skill/steps-c/step-05-severity-classify.md +210 -0
- package/src/workflows/audit-skill/steps-c/step-06-report.md +217 -0
- package/src/workflows/audit-skill/validation-report.md +545 -0
- package/src/workflows/audit-skill/workflow-plan-audit-skill.md +318 -0
- package/src/workflows/audit-skill/workflow.md +63 -0
- package/src/workflows/brief-skill/data/skill-brief-schema.md +82 -0
- package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +184 -0
- package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +203 -0
- package/src/workflows/brief-skill/steps-c/step-03-scope-definition.md +225 -0
- package/src/workflows/brief-skill/steps-c/step-04-confirm-brief.md +185 -0
- package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +156 -0
- package/src/workflows/brief-skill/validation-report.md +630 -0
- package/src/workflows/brief-skill/workflow-plan-brief-skill.md +360 -0
- package/src/workflows/brief-skill/workflow.md +57 -0
- package/src/workflows/create-skill/data/extraction-patterns.md +63 -0
- package/src/workflows/create-skill/data/skill-sections.md +166 -0
- package/src/workflows/create-skill/steps-c/step-01-load-brief.md +176 -0
- package/src/workflows/create-skill/steps-c/step-02-ecosystem-check.md +143 -0
- package/src/workflows/create-skill/steps-c/step-03-extract.md +184 -0
- package/src/workflows/create-skill/steps-c/step-04-enrich.md +152 -0
- package/src/workflows/create-skill/steps-c/step-05-compile.md +198 -0
- package/src/workflows/create-skill/steps-c/step-06-validate.md +162 -0
- package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +165 -0
- package/src/workflows/create-skill/steps-c/step-08-report.md +160 -0
- package/src/workflows/create-skill/validation-report.md +189 -0
- package/src/workflows/create-skill/workflow-plan-create-skill.md +491 -0
- package/src/workflows/create-skill/workflow.md +52 -0
- package/src/workflows/create-stack-skill/data/integration-patterns.md +61 -0
- package/src/workflows/create-stack-skill/data/manifest-patterns.md +35 -0
- package/src/workflows/create-stack-skill/data/stack-skill-template.md +110 -0
- package/src/workflows/create-stack-skill/steps-c/step-01-init.md +142 -0
- package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +145 -0
- package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +161 -0
- package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +155 -0
- package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +154 -0
- package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +160 -0
- package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +202 -0
- package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +193 -0
- package/src/workflows/create-stack-skill/steps-c/step-09-report.md +137 -0
- package/src/workflows/create-stack-skill/validation-report.md +401 -0
- package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +481 -0
- package/src/workflows/create-stack-skill/workflow.md +59 -0
- package/src/workflows/export-skill/data/managed-section-format.md +70 -0
- package/src/workflows/export-skill/data/snippet-format.md +32 -0
- package/src/workflows/export-skill/steps-c/step-01-load-skill.md +184 -0
- package/src/workflows/export-skill/steps-c/step-02-package.md +153 -0
- package/src/workflows/export-skill/steps-c/step-03-generate-snippet.md +166 -0
- package/src/workflows/export-skill/steps-c/step-04-update-context.md +222 -0
- package/src/workflows/export-skill/steps-c/step-05-token-report.md +126 -0
- package/src/workflows/export-skill/steps-c/step-06-summary.md +167 -0
- package/src/workflows/export-skill/validation-report.md +263 -0
- package/src/workflows/export-skill/workflow-plan-export-skill.md +369 -0
- package/src/workflows/export-skill/workflow.md +56 -0
- package/src/workflows/quick-skill/data/registry-resolution.md +91 -0
- package/src/workflows/quick-skill/data/skill-template.md +66 -0
- package/src/workflows/quick-skill/steps-c/step-01-resolve-target.md +165 -0
- package/src/workflows/quick-skill/steps-c/step-02-ecosystem-check.md +143 -0
- package/src/workflows/quick-skill/steps-c/step-03-quick-extract.md +177 -0
- package/src/workflows/quick-skill/steps-c/step-04-compile.md +180 -0
- package/src/workflows/quick-skill/steps-c/step-05-validate.md +150 -0
- package/src/workflows/quick-skill/steps-c/step-06-write.md +160 -0
- package/src/workflows/quick-skill/validation-report.md +543 -0
- package/src/workflows/quick-skill/workflow-plan-quick-skill.md +405 -0
- package/src/workflows/quick-skill/workflow.md +56 -0
- package/src/workflows/setup-forge/data/tier-rules.md +50 -0
- package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +140 -0
- package/src/workflows/setup-forge/steps-c/step-02-write-config.md +141 -0
- package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +116 -0
- package/src/workflows/setup-forge/steps-c/step-04-report.md +131 -0
- package/src/workflows/setup-forge/validation-report.md +504 -0
- package/src/workflows/setup-forge/workflow-plan-setup-forge.md +428 -0
- package/src/workflows/setup-forge/workflow.md +49 -0
- package/src/workflows/test-skill/data/output-section-formats.md +96 -0
- package/src/workflows/test-skill/data/scoring-rules.md +74 -0
- package/src/workflows/test-skill/steps-c/step-01-init.md +185 -0
- package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +162 -0
- package/src/workflows/test-skill/steps-c/step-03-coverage-check.md +222 -0
- package/src/workflows/test-skill/steps-c/step-04-coherence-check.md +249 -0
- package/src/workflows/test-skill/steps-c/step-05-score.md +222 -0
- package/src/workflows/test-skill/steps-c/step-06-report.md +175 -0
- package/src/workflows/test-skill/templates/test-report-template.md +24 -0
- package/src/workflows/test-skill/validation-report.md +390 -0
- package/src/workflows/test-skill/workflow-plan-test-skill.md +288 -0
- package/src/workflows/test-skill/workflow.md +57 -0
- package/src/workflows/update-skill/data/manual-section-rules.md +44 -0
- package/src/workflows/update-skill/data/merge-conflict-rules.md +62 -0
- package/src/workflows/update-skill/steps-c/step-01-init.md +208 -0
- package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +184 -0
- package/src/workflows/update-skill/steps-c/step-03-re-extract.md +187 -0
- package/src/workflows/update-skill/steps-c/step-04-merge.md +230 -0
- package/src/workflows/update-skill/steps-c/step-05-validate.md +187 -0
- package/src/workflows/update-skill/steps-c/step-06-write.md +204 -0
- package/src/workflows/update-skill/steps-c/step-07-report.md +201 -0
- package/src/workflows/update-skill/validation-report.md +559 -0
- package/src/workflows/update-skill/workflow-plan-update-skill.md +441 -0
- package/src/workflows/update-skill/workflow.md +56 -0
- package/tools/cli/commands/install.js +33 -0
- package/tools/cli/commands/status.js +195 -0
- package/tools/cli/commands/uninstall.js +226 -0
- package/tools/cli/commands/update.js +63 -0
- package/tools/cli/lib/compiler.js +306 -0
- package/tools/cli/lib/ide-commands.js +244 -0
- package/tools/cli/lib/installer.js +307 -0
- package/tools/cli/lib/manifest.js +109 -0
- package/tools/cli/lib/ui.js +277 -0
- package/tools/cli/lib/version-check.js +86 -0
- package/tools/cli/skf-cli.js +45 -0
- package/tools/skf-npx-wrapper.js +36 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 'step-03-re-extract'
|
|
3
|
+
description: 'Tier-aware AST extraction on changed files only, producing fresh exports with confidence tiers'
|
|
4
|
+
|
|
5
|
+
nextStepFile: './step-04-merge.md'
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Step 3: Re-Extract Changed Exports
|
|
9
|
+
|
|
10
|
+
## STEP GOAL:
|
|
11
|
+
|
|
12
|
+
Perform tier-aware extraction on only the changed files identified in step 02, producing fresh export data with confidence tier labels (T1/T1-low/T2) that will be merged into the existing skill in step 04.
|
|
13
|
+
|
|
14
|
+
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
15
|
+
|
|
16
|
+
### Universal Rules:
|
|
17
|
+
|
|
18
|
+
- 🛑 NEVER generate content without user input
|
|
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
|
+
- 📋 YOU ARE A FACILITATOR, not a content generator
|
|
22
|
+
- ⚙️ 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
|
|
23
|
+
- ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
|
|
24
|
+
|
|
25
|
+
### Role Reinforcement:
|
|
26
|
+
|
|
27
|
+
- ✅ You are a precision code analyst operating in Surgeon mode
|
|
28
|
+
- ✅ Zero-hallucination principle: every extracted instruction must include AST file:line citation
|
|
29
|
+
- ✅ Confidence tier labels are MANDATORY on all extracted content
|
|
30
|
+
- ✅ You bring AST-backed structural analysis; the source code provides ground truth
|
|
31
|
+
|
|
32
|
+
### Step-Specific Rules:
|
|
33
|
+
|
|
34
|
+
- 🎯 Focus ONLY on extracting changed exports — do not merge or modify existing skill
|
|
35
|
+
- 🚫 FORBIDDEN to extract unchanged files — only files in the change manifest
|
|
36
|
+
- 🚫 FORBIDDEN to modify SKILL.md — extraction produces intermediate data for step 04
|
|
37
|
+
- 💬 DO NOT BE LAZY — For EACH changed file, launch a subprocess for deep AST analysis (Pattern 2)
|
|
38
|
+
- ⚙️ If subprocess unavailable, perform extraction sequentially in main thread
|
|
39
|
+
|
|
40
|
+
## EXECUTION PROTOCOLS:
|
|
41
|
+
|
|
42
|
+
- 🎯 Follow MANDATORY SEQUENCE exactly
|
|
43
|
+
- 💾 Produce structured extraction results per changed file
|
|
44
|
+
- 📖 Label every extraction with confidence tier
|
|
45
|
+
- 🚫 FORBIDDEN to hallucinate exports — only extract what exists in source
|
|
46
|
+
|
|
47
|
+
## CONTEXT BOUNDARIES:
|
|
48
|
+
|
|
49
|
+
- Available: change manifest from step 02, forge tier from step 01, source files
|
|
50
|
+
- Focus: extraction only — no merge, no write
|
|
51
|
+
- Limits: only changed files from manifest
|
|
52
|
+
- Dependencies: step 02 must have produced change manifest
|
|
53
|
+
|
|
54
|
+
## MANDATORY SEQUENCE
|
|
55
|
+
|
|
56
|
+
**CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
|
|
57
|
+
|
|
58
|
+
### 1. Determine Extraction Strategy by Tier
|
|
59
|
+
|
|
60
|
+
**Quick tier (text pattern matching):**
|
|
61
|
+
- Extract function/class/type names via regex patterns
|
|
62
|
+
- Extract export statements via text matching
|
|
63
|
+
- Confidence: T1-low (pattern-matched, not AST-verified)
|
|
64
|
+
|
|
65
|
+
**Forge tier (AST structural extraction):**
|
|
66
|
+
- Use ast_bridge for full structural extraction
|
|
67
|
+
- Extract: function signatures, type definitions, class members, exported constants
|
|
68
|
+
- Extract: parameter types, return types, JSDoc/docstring comments
|
|
69
|
+
- Confidence: T1 (AST-verified structural truth)
|
|
70
|
+
|
|
71
|
+
**Deep tier (AST + QMD semantic enrichment):**
|
|
72
|
+
- Perform all Forge tier extractions (T1)
|
|
73
|
+
- Additionally: launch a subprocess that queries qmd_bridge for temporal context on changed exports, returning T2 evidence per export
|
|
74
|
+
- QMD provides: usage patterns, historical context, related documentation
|
|
75
|
+
- Confidence: T1 for structural, T2 for semantic enrichment
|
|
76
|
+
|
|
77
|
+
### 2. Extract Changed Files
|
|
78
|
+
|
|
79
|
+
DO NOT BE LAZY — For EACH file in the change manifest with status MODIFIED, ADDED, or RENAMED, launch a subprocess that:
|
|
80
|
+
|
|
81
|
+
1. Loads the source file
|
|
82
|
+
2. Performs tier-appropriate extraction (Quick/Forge/Deep)
|
|
83
|
+
3. For each export found:
|
|
84
|
+
- Record: export name, type (function/class/type/constant), signature
|
|
85
|
+
- Record: file path, start line, end line
|
|
86
|
+
- Record: parameters with types (if function/method)
|
|
87
|
+
- Record: return type (if function/method)
|
|
88
|
+
- Record: JSDoc/docstring summary (if present)
|
|
89
|
+
- Label: confidence tier (T1/T1-low/T2)
|
|
90
|
+
4. Returns structured extraction findings to parent
|
|
91
|
+
|
|
92
|
+
**For DELETED files:** No extraction needed — deletions handled in merge step.
|
|
93
|
+
|
|
94
|
+
**For MOVED files:** Re-extract at new location to update file:line references.
|
|
95
|
+
|
|
96
|
+
### 3. Deep Tier QMD Enrichment (Conditional)
|
|
97
|
+
|
|
98
|
+
**ONLY if forge_tier == Deep:**
|
|
99
|
+
|
|
100
|
+
Launch a subprocess that loads qmd_bridge and for each changed export:
|
|
101
|
+
1. Queries QMD collection for semantic context related to the export
|
|
102
|
+
2. Searches for usage patterns, documentation references, temporal history
|
|
103
|
+
3. Returns T2 evidence per export (usage frequency, context snippets, related concepts)
|
|
104
|
+
|
|
105
|
+
**If forge_tier != Deep:** Skip this section with notice: "QMD enrichment skipped (tier: {forge_tier})"
|
|
106
|
+
|
|
107
|
+
### 4. Compile Extraction Results
|
|
108
|
+
|
|
109
|
+
Aggregate all subprocess results into structured extraction data:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
Extraction Results:
|
|
113
|
+
files_extracted: [count]
|
|
114
|
+
exports_extracted: [count]
|
|
115
|
+
confidence_breakdown:
|
|
116
|
+
T1: [count]
|
|
117
|
+
T1-low: [count]
|
|
118
|
+
T2: [count]
|
|
119
|
+
|
|
120
|
+
Per-file extractions:
|
|
121
|
+
{file_path}:
|
|
122
|
+
exports:
|
|
123
|
+
- name: {export_name}
|
|
124
|
+
type: function|class|type|constant
|
|
125
|
+
signature: {full signature}
|
|
126
|
+
location: {file}:{start_line}-{end_line}
|
|
127
|
+
confidence: T1|T1-low|T2
|
|
128
|
+
parameters: [{name, type}]
|
|
129
|
+
return_type: {type}
|
|
130
|
+
docstring: {summary}
|
|
131
|
+
qmd_evidence: {if Deep tier}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 5. Display Extraction Summary and Auto-Proceed
|
|
135
|
+
|
|
136
|
+
"**Re-Extraction Complete:**
|
|
137
|
+
|
|
138
|
+
| Metric | Count |
|
|
139
|
+
|--------|-------|
|
|
140
|
+
| Files extracted | {count} |
|
|
141
|
+
| Exports extracted | {count} |
|
|
142
|
+
| T1 (AST-verified) | {count} |
|
|
143
|
+
| T1-low (pattern-matched) | {count} |
|
|
144
|
+
| T2 (QMD-enriched) | {count} |
|
|
145
|
+
|
|
146
|
+
**Proceeding to merge with existing skill...**"
|
|
147
|
+
|
|
148
|
+
### 6. Present MENU OPTIONS
|
|
149
|
+
|
|
150
|
+
Display: "**Proceeding to merge...**"
|
|
151
|
+
|
|
152
|
+
#### Menu Handling Logic:
|
|
153
|
+
|
|
154
|
+
- After extraction results are compiled, immediately load, read entire file, then execute {nextStepFile}
|
|
155
|
+
|
|
156
|
+
#### EXECUTION RULES:
|
|
157
|
+
|
|
158
|
+
- This is an auto-proceed step with no user choices
|
|
159
|
+
- Proceed directly to next step after extraction completes
|
|
160
|
+
|
|
161
|
+
## CRITICAL STEP COMPLETION NOTE
|
|
162
|
+
|
|
163
|
+
ONLY WHEN all changed files have been extracted and results compiled will you load {nextStepFile} to begin the merge operation.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
|
|
168
|
+
|
|
169
|
+
### ✅ SUCCESS:
|
|
170
|
+
|
|
171
|
+
- Every changed file from manifest extracted with tier-appropriate method
|
|
172
|
+
- All exports labeled with confidence tier (T1/T1-low/T2)
|
|
173
|
+
- AST file:line citations on every extracted export
|
|
174
|
+
- QMD enrichment performed for Deep tier (skipped with notice for Quick/Forge)
|
|
175
|
+
- Extraction results compiled with per-file detail
|
|
176
|
+
- Summary displayed before auto-proceeding
|
|
177
|
+
- No unchanged files extracted
|
|
178
|
+
|
|
179
|
+
### ❌ SYSTEM FAILURE:
|
|
180
|
+
|
|
181
|
+
- Extracting unchanged files (wasting resources)
|
|
182
|
+
- Missing confidence tier labels on any export
|
|
183
|
+
- Hallucinating exports not present in source code
|
|
184
|
+
- Skipping QMD enrichment at Deep tier
|
|
185
|
+
- Modifying SKILL.md or any existing artifacts during extraction
|
|
186
|
+
|
|
187
|
+
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 'step-04-merge'
|
|
3
|
+
description: 'Merge new extractions into existing skill content, preserving all [MANUAL] sections with conflict resolution'
|
|
4
|
+
|
|
5
|
+
nextStepFile: './step-05-validate.md'
|
|
6
|
+
manualSectionRulesFile: '../data/manual-section-rules.md'
|
|
7
|
+
mergeConflictRulesFile: '../data/merge-conflict-rules.md'
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Step 4: Merge
|
|
11
|
+
|
|
12
|
+
## STEP GOAL:
|
|
13
|
+
|
|
14
|
+
Merge freshly extracted export data into the existing SKILL.md content while preserving all [MANUAL] sections. Detect and resolve conflicts where regenerated content overlaps developer-authored content. For stack skills, merge across all output files.
|
|
15
|
+
|
|
16
|
+
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
17
|
+
|
|
18
|
+
### Universal Rules:
|
|
19
|
+
|
|
20
|
+
- 🛑 NEVER generate content without user input
|
|
21
|
+
- 📖 CRITICAL: Read the complete step file before taking any action
|
|
22
|
+
- 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
|
|
23
|
+
- 📋 YOU ARE A FACILITATOR, not a content generator
|
|
24
|
+
- ⚙️ 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
|
|
25
|
+
- ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
|
|
26
|
+
|
|
27
|
+
### Role Reinforcement:
|
|
28
|
+
|
|
29
|
+
- ✅ You are a precision code analyst operating in Surgeon mode
|
|
30
|
+
- ✅ [MANUAL] section preservation is the HIGHEST PRIORITY — zero content loss
|
|
31
|
+
- ✅ Every merge decision must be traceable and reversible
|
|
32
|
+
- ✅ When in doubt about [MANUAL] conflicts, HALT and ask the user
|
|
33
|
+
|
|
34
|
+
### Step-Specific Rules:
|
|
35
|
+
|
|
36
|
+
- 🎯 Focus ONLY on merging extractions into existing skill content
|
|
37
|
+
- 🚫 FORBIDDEN to delete or modify [MANUAL] section content
|
|
38
|
+
- 🚫 FORBIDDEN to write files — merge produces in-memory result for step 06
|
|
39
|
+
- 💬 If [MANUAL] conflicts detected: HALT and present to user for resolution
|
|
40
|
+
- 💬 If clean merge: auto-proceed without user interaction
|
|
41
|
+
|
|
42
|
+
## EXECUTION PROTOCOLS:
|
|
43
|
+
|
|
44
|
+
- 🎯 Follow MANDATORY SEQUENCE exactly
|
|
45
|
+
- 💾 Load merge rules from data files for conflict resolution
|
|
46
|
+
- 📖 Track every merge operation for evidence report
|
|
47
|
+
- 🚫 FORBIDDEN to auto-resolve [MANUAL] conflicts — user must decide
|
|
48
|
+
|
|
49
|
+
## CONTEXT BOUNDARIES:
|
|
50
|
+
|
|
51
|
+
- Available: extraction results from step 03, existing SKILL.md content, [MANUAL] inventory from step 01, change manifest from step 02
|
|
52
|
+
- Focus: content merge and [MANUAL] preservation
|
|
53
|
+
- Limits: in-memory merge only — no file writes
|
|
54
|
+
- Dependencies: step 03 must have produced extraction results
|
|
55
|
+
|
|
56
|
+
## MANDATORY SEQUENCE
|
|
57
|
+
|
|
58
|
+
**CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
|
|
59
|
+
|
|
60
|
+
### 1. Load Merge Rules
|
|
61
|
+
|
|
62
|
+
Load {manualSectionRulesFile} for [MANUAL] detection and preservation patterns.
|
|
63
|
+
Load {mergeConflictRulesFile} for change category merge strategies and priority order.
|
|
64
|
+
|
|
65
|
+
### 2. Extract [MANUAL] Blocks
|
|
66
|
+
|
|
67
|
+
From the [MANUAL] inventory captured in step 01:
|
|
68
|
+
- Extract every `<!-- [MANUAL:section-name] -->` ... `<!-- [/MANUAL:section-name] -->` block
|
|
69
|
+
- Map each block to its parent section heading
|
|
70
|
+
- Store blocks in a preservation map keyed by section-name
|
|
71
|
+
|
|
72
|
+
### 3. Apply Merge by Priority Order
|
|
73
|
+
|
|
74
|
+
Follow the merge priority order from {mergeConflictRulesFile}:
|
|
75
|
+
|
|
76
|
+
**Priority 1 — Process DELETED exports:**
|
|
77
|
+
- Remove generated content for deleted exports
|
|
78
|
+
- Check if deleted export has attached [MANUAL] blocks
|
|
79
|
+
- If [MANUAL] attached: flag as ORPHAN conflict (do not remove)
|
|
80
|
+
- If no [MANUAL]: remove generated content cleanly
|
|
81
|
+
|
|
82
|
+
**Priority 2 — Process MOVED exports:**
|
|
83
|
+
- Update file:line citations in generated content
|
|
84
|
+
- Update provenance map file references
|
|
85
|
+
- [MANUAL] blocks unaffected (content unchanged)
|
|
86
|
+
|
|
87
|
+
**Priority 3 — Process RENAMED exports:**
|
|
88
|
+
- Replace old identifier with new identifier in generated content
|
|
89
|
+
- Check if [MANUAL] blocks reference old identifier name
|
|
90
|
+
- If referenced: flag as STALE_REFERENCE conflict
|
|
91
|
+
|
|
92
|
+
**Priority 4 — Process MODIFIED exports:**
|
|
93
|
+
- Replace generated content for the export with fresh extraction
|
|
94
|
+
- Preserve [MANUAL] blocks adjacent to the export
|
|
95
|
+
- Check for position conflicts (new content shifts [MANUAL] block)
|
|
96
|
+
- If position conflict: flag as POSITION conflict
|
|
97
|
+
|
|
98
|
+
**Priority 5 — Process NEW exports:**
|
|
99
|
+
- Append new export content to appropriate section
|
|
100
|
+
- Place before any [MANUAL] blocks at section boundary
|
|
101
|
+
- No conflicts expected (new content, no existing [MANUAL])
|
|
102
|
+
|
|
103
|
+
### 4. Check for Conflicts
|
|
104
|
+
|
|
105
|
+
Scan all merge operations for flagged conflicts:
|
|
106
|
+
|
|
107
|
+
**If ZERO conflicts:**
|
|
108
|
+
- Report clean merge
|
|
109
|
+
- Auto-proceed to step 05
|
|
110
|
+
|
|
111
|
+
**If conflicts detected:**
|
|
112
|
+
|
|
113
|
+
Present each conflict to user:
|
|
114
|
+
|
|
115
|
+
"**[MANUAL] Conflict Resolution Required:**
|
|
116
|
+
|
|
117
|
+
**Conflict {N} of {total}:** {conflict_type}
|
|
118
|
+
|
|
119
|
+
{Detailed description of the conflict with before/after context}
|
|
120
|
+
|
|
121
|
+
**Options:**
|
|
122
|
+
- **[K]eep** — Preserve [MANUAL] content as-is, adjust generated content around it
|
|
123
|
+
- **[R]emove** — Remove the [MANUAL] block (content will be lost)
|
|
124
|
+
- **[E]dit** — Show me both versions, I'll provide the resolution
|
|
125
|
+
|
|
126
|
+
Select: [K] Keep / [R] Remove / [E] Edit"
|
|
127
|
+
|
|
128
|
+
Process each conflict with user's decision.
|
|
129
|
+
|
|
130
|
+
### 5. Stack Skill Merge (Conditional)
|
|
131
|
+
|
|
132
|
+
**ONLY if skill_type == "stack":**
|
|
133
|
+
|
|
134
|
+
Apply the same merge process to each stack output file:
|
|
135
|
+
- `references/{library}.md` — merge per-library changes, preserve [MANUAL] blocks
|
|
136
|
+
- `references/integrations/{pair}.md` — merge per-integration-pair
|
|
137
|
+
- `metadata.json` — regenerate completely (no [MANUAL] support)
|
|
138
|
+
- `context-snippet.md` — regenerate completely (no [MANUAL] support)
|
|
139
|
+
|
|
140
|
+
Report stack file merge status for each file.
|
|
141
|
+
|
|
142
|
+
**If skill_type != "stack":** Skip with notice: "Individual skill — single file merge."
|
|
143
|
+
|
|
144
|
+
### 6. Compile Merge Results
|
|
145
|
+
|
|
146
|
+
Build merge result summary:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
Merge Results:
|
|
150
|
+
exports_updated: [count]
|
|
151
|
+
exports_added: [count]
|
|
152
|
+
exports_removed: [count]
|
|
153
|
+
exports_moved: [count]
|
|
154
|
+
exports_renamed: [count]
|
|
155
|
+
|
|
156
|
+
manual_sections_preserved: [count]
|
|
157
|
+
manual_conflicts_resolved: [count]
|
|
158
|
+
manual_orphans_kept: [count]
|
|
159
|
+
manual_orphans_removed: [count]
|
|
160
|
+
|
|
161
|
+
stack_files_merged: [count] (if stack skill)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 7. Display Merge Summary
|
|
165
|
+
|
|
166
|
+
"**Merge Complete:**
|
|
167
|
+
|
|
168
|
+
| Metric | Count |
|
|
169
|
+
|--------|-------|
|
|
170
|
+
| Exports updated | {count} |
|
|
171
|
+
| Exports added | {count} |
|
|
172
|
+
| Exports removed | {count} |
|
|
173
|
+
| [MANUAL] sections preserved | {count} |
|
|
174
|
+
| Conflicts resolved | {count} |"
|
|
175
|
+
|
|
176
|
+
### 8. Present MENU OPTIONS
|
|
177
|
+
|
|
178
|
+
**If conflicts were resolved (user interaction occurred):**
|
|
179
|
+
|
|
180
|
+
Display: "**Merge complete with conflict resolution. Select:** [C] Continue to Validation"
|
|
181
|
+
|
|
182
|
+
#### Menu Handling Logic:
|
|
183
|
+
|
|
184
|
+
- IF C: Load, read entire file, then execute {nextStepFile}
|
|
185
|
+
- IF Any other: help user respond, then [Redisplay Menu Options](#8-present-menu-options)
|
|
186
|
+
|
|
187
|
+
#### EXECUTION RULES:
|
|
188
|
+
|
|
189
|
+
- ALWAYS halt and wait for user input after conflict resolution
|
|
190
|
+
- ONLY proceed when user selects 'C'
|
|
191
|
+
|
|
192
|
+
**If clean merge (no conflicts):**
|
|
193
|
+
|
|
194
|
+
Display: "**Clean merge — proceeding to validation...**"
|
|
195
|
+
|
|
196
|
+
#### Clean Merge Menu Handling Logic:
|
|
197
|
+
|
|
198
|
+
- Immediately load, read entire file, then execute {nextStepFile}
|
|
199
|
+
|
|
200
|
+
#### Clean Merge EXECUTION RULES:
|
|
201
|
+
|
|
202
|
+
- This is an auto-proceed path when no conflicts exist
|
|
203
|
+
|
|
204
|
+
## CRITICAL STEP COMPLETION NOTE
|
|
205
|
+
|
|
206
|
+
ONLY WHEN all merge operations are complete and any [MANUAL] conflicts have been resolved by the user will you load {nextStepFile} to begin validation.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
|
|
211
|
+
|
|
212
|
+
### ✅ SUCCESS:
|
|
213
|
+
|
|
214
|
+
- All [MANUAL] sections preserved with zero content loss
|
|
215
|
+
- Merge applied in correct priority order (delete → move → rename → modify → add)
|
|
216
|
+
- Every conflict presented to user for resolution (no auto-resolution of [MANUAL] conflicts)
|
|
217
|
+
- Stack skill files merged if applicable
|
|
218
|
+
- Merge results compiled with full accounting
|
|
219
|
+
- Clean merges auto-proceed; conflict merges require user [C]
|
|
220
|
+
|
|
221
|
+
### ❌ SYSTEM FAILURE:
|
|
222
|
+
|
|
223
|
+
- ANY [MANUAL] content lost or modified without user consent
|
|
224
|
+
- Auto-resolving [MANUAL] conflicts without user input
|
|
225
|
+
- Writing files during merge (merge is in-memory only)
|
|
226
|
+
- Applying merge out of priority order
|
|
227
|
+
- Not detecting orphaned [MANUAL] blocks on deleted exports
|
|
228
|
+
- Not handling stack skill multi-file merge
|
|
229
|
+
|
|
230
|
+
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 'step-05-validate'
|
|
3
|
+
description: 'Validate updated skill against spec, verify MANUAL integrity, and check confidence tier consistency'
|
|
4
|
+
|
|
5
|
+
nextStepFile: './step-06-write.md'
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Step 5: Validate
|
|
9
|
+
|
|
10
|
+
## STEP GOAL:
|
|
11
|
+
|
|
12
|
+
Validate the merged skill content against the agentskills.io specification, verify all [MANUAL] sections survived the merge intact, and check confidence tier consistency across all re-extracted content. This is an advisory validation — findings are warnings, not blockers.
|
|
13
|
+
|
|
14
|
+
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
15
|
+
|
|
16
|
+
### Universal Rules:
|
|
17
|
+
|
|
18
|
+
- 🛑 NEVER generate content without user input
|
|
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
|
+
- 📋 YOU ARE A FACILITATOR, not a content generator
|
|
22
|
+
- ⚙️ 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
|
|
23
|
+
- ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
|
|
24
|
+
|
|
25
|
+
### Role Reinforcement:
|
|
26
|
+
|
|
27
|
+
- ✅ You are a precision code analyst operating in Surgeon mode
|
|
28
|
+
- ✅ Validation is advisory — flag issues but do not block the workflow
|
|
29
|
+
- ✅ Every finding must include specific file:line reference
|
|
30
|
+
- ✅ Zero-hallucination principle applies to validation findings too
|
|
31
|
+
|
|
32
|
+
### Step-Specific Rules:
|
|
33
|
+
|
|
34
|
+
- 🎯 Focus ONLY on validation — do not fix issues (that's the user's choice)
|
|
35
|
+
- 🚫 FORBIDDEN to modify merged content — validation is read-only
|
|
36
|
+
- 💬 Launch parallel validation checks when subprocess available (Pattern 4)
|
|
37
|
+
- ⚙️ If subprocess unavailable, perform checks sequentially in main thread
|
|
38
|
+
|
|
39
|
+
## EXECUTION PROTOCOLS:
|
|
40
|
+
|
|
41
|
+
- 🎯 Follow MANDATORY SEQUENCE exactly
|
|
42
|
+
- 💾 Compile validation findings with severity levels
|
|
43
|
+
- 📖 Track pass/fail for each validation category
|
|
44
|
+
- 🚫 Validation is ADVISORY — do not block on warnings
|
|
45
|
+
|
|
46
|
+
## CONTEXT BOUNDARIES:
|
|
47
|
+
|
|
48
|
+
- Available: merged skill content from step 04, extraction results from step 03, [MANUAL] inventory from step 01
|
|
49
|
+
- Focus: quality assurance — spec compliance, [MANUAL] integrity, confidence consistency
|
|
50
|
+
- Limits: read-only — do not modify merged content
|
|
51
|
+
- Dependencies: step 04 must have completed merge (with or without conflict resolution)
|
|
52
|
+
|
|
53
|
+
## MANDATORY SEQUENCE
|
|
54
|
+
|
|
55
|
+
**CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
|
|
56
|
+
|
|
57
|
+
### 1. Launch Parallel Validation Checks
|
|
58
|
+
|
|
59
|
+
Launch subprocesses in parallel for each validation category, aggregating results when complete:
|
|
60
|
+
|
|
61
|
+
**Check A — Spec Compliance:**
|
|
62
|
+
- Validate merged SKILL.md structure against agentskills.io specification (via skills_ref if available)
|
|
63
|
+
- Verify required sections present: exports, usage patterns, conventions
|
|
64
|
+
- Verify export entries have: name, type, signature, file:line reference
|
|
65
|
+
- Flag missing or incomplete sections
|
|
66
|
+
|
|
67
|
+
**Check B — [MANUAL] Section Integrity:**
|
|
68
|
+
- Compare [MANUAL] inventory from step 01 against merged content
|
|
69
|
+
- Verify every [MANUAL] block from inventory exists in merged result
|
|
70
|
+
- Verify [MANUAL] content is byte-identical (zero modification)
|
|
71
|
+
- Flag any [MANUAL] blocks that were moved, truncated, or missing
|
|
72
|
+
|
|
73
|
+
**Check C — Confidence Tier Consistency:**
|
|
74
|
+
- Verify all re-extracted exports have confidence labels (T1/T1-low/T2)
|
|
75
|
+
- Verify tier labels match forge tier capabilities:
|
|
76
|
+
- Quick tier: only T1-low allowed
|
|
77
|
+
- Forge tier: T1 expected (T1-low for degraded operations)
|
|
78
|
+
- Deep tier: T1 + T2 expected
|
|
79
|
+
- Flag mismatched or missing tier labels
|
|
80
|
+
|
|
81
|
+
**Check D — Provenance Completeness:**
|
|
82
|
+
- Verify every export in merged SKILL.md has a provenance map entry
|
|
83
|
+
- Verify file:line references point to actual source locations
|
|
84
|
+
- Verify no stale references to old file paths or line numbers
|
|
85
|
+
- Flag orphaned provenance entries (export removed but provenance remains)
|
|
86
|
+
|
|
87
|
+
### 2. Aggregate Validation Results
|
|
88
|
+
|
|
89
|
+
Compile results from all checks:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Validation Results:
|
|
93
|
+
spec_compliance:
|
|
94
|
+
status: PASS|WARN|FAIL
|
|
95
|
+
findings: [{severity, description, location}]
|
|
96
|
+
|
|
97
|
+
manual_integrity:
|
|
98
|
+
status: PASS|WARN|FAIL
|
|
99
|
+
sections_verified: [count]
|
|
100
|
+
sections_intact: [count]
|
|
101
|
+
findings: [{severity, description, section_name}]
|
|
102
|
+
|
|
103
|
+
confidence_consistency:
|
|
104
|
+
status: PASS|WARN|FAIL
|
|
105
|
+
exports_checked: [count]
|
|
106
|
+
findings: [{severity, description, export_name, expected_tier, actual_tier}]
|
|
107
|
+
|
|
108
|
+
provenance_completeness:
|
|
109
|
+
status: PASS|WARN|FAIL
|
|
110
|
+
entries_checked: [count]
|
|
111
|
+
findings: [{severity, description, export_name}]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 3. For Stack Skills — Validate Reference Files
|
|
115
|
+
|
|
116
|
+
**ONLY if skill_type == "stack":**
|
|
117
|
+
|
|
118
|
+
Repeat checks A-D for each reference file:
|
|
119
|
+
- `references/{library}.md` — spec compliance and [MANUAL] integrity
|
|
120
|
+
- `references/integrations/{pair}.md` — spec compliance and [MANUAL] integrity
|
|
121
|
+
|
|
122
|
+
**If skill_type != "stack":** Skip with notice.
|
|
123
|
+
|
|
124
|
+
### 4. Display Validation Summary
|
|
125
|
+
|
|
126
|
+
"**Validation Results:**
|
|
127
|
+
|
|
128
|
+
| Check | Status | Findings |
|
|
129
|
+
|-------|--------|----------|
|
|
130
|
+
| Spec Compliance | {PASS/WARN/FAIL} | {count} findings |
|
|
131
|
+
| [MANUAL] Integrity | {PASS/WARN/FAIL} | {count} findings |
|
|
132
|
+
| Confidence Tiers | {PASS/WARN/FAIL} | {count} findings |
|
|
133
|
+
| Provenance | {PASS/WARN/FAIL} | {count} findings |
|
|
134
|
+
|
|
135
|
+
**Overall: {ALL_PASS / WARNINGS_FOUND / FAILURES_FOUND}**"
|
|
136
|
+
|
|
137
|
+
**If WARNINGS or FAILURES found:**
|
|
138
|
+
|
|
139
|
+
List each finding with severity and description:
|
|
140
|
+
|
|
141
|
+
"**Findings:**
|
|
142
|
+
1. [{severity}] {description} — {location}
|
|
143
|
+
2. [{severity}] {description} — {location}
|
|
144
|
+
..."
|
|
145
|
+
|
|
146
|
+
"**Note:** Validation is advisory. These findings are reported for your awareness but do not block the update. You may choose to address them after the update completes."
|
|
147
|
+
|
|
148
|
+
### 5. Present MENU OPTIONS
|
|
149
|
+
|
|
150
|
+
Display: "**Proceeding to write updated files...**"
|
|
151
|
+
|
|
152
|
+
#### Menu Handling Logic:
|
|
153
|
+
|
|
154
|
+
- After validation summary is displayed, immediately load, read entire file, then execute {nextStepFile}
|
|
155
|
+
|
|
156
|
+
#### EXECUTION RULES:
|
|
157
|
+
|
|
158
|
+
- This is an auto-proceed validation step with no user choices
|
|
159
|
+
- Validation is advisory — findings are informational, not blocking
|
|
160
|
+
- Proceed directly to next step after summary display
|
|
161
|
+
|
|
162
|
+
## CRITICAL STEP COMPLETION NOTE
|
|
163
|
+
|
|
164
|
+
ONLY WHEN all validation checks have completed and findings are displayed will you load {nextStepFile} to write the updated files. Validation does NOT block — it informs.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
|
|
169
|
+
|
|
170
|
+
### ✅ SUCCESS:
|
|
171
|
+
|
|
172
|
+
- All four validation checks executed (spec, [MANUAL], confidence, provenance)
|
|
173
|
+
- Stack skill reference files validated if applicable
|
|
174
|
+
- Findings reported with severity and specific locations
|
|
175
|
+
- [MANUAL] integrity verified with byte-level comparison
|
|
176
|
+
- Validation results displayed clearly
|
|
177
|
+
- Auto-proceeds regardless of findings (advisory mode)
|
|
178
|
+
|
|
179
|
+
### ❌ SYSTEM FAILURE:
|
|
180
|
+
|
|
181
|
+
- Skipping any of the four validation checks
|
|
182
|
+
- Blocking the workflow on validation warnings
|
|
183
|
+
- Not verifying [MANUAL] section integrity
|
|
184
|
+
- Hallucinating validation findings not backed by actual comparison
|
|
185
|
+
- Modifying merged content during validation
|
|
186
|
+
|
|
187
|
+
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
|