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,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-skill
|
|
3
|
+
description: Cognitive completeness verification. Naive and contextual modes.
|
|
4
|
+
web_bundle: true
|
|
5
|
+
installed_path: '{project-root}/_bmad/skf/workflows/test-skill'
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test Skill
|
|
9
|
+
|
|
10
|
+
**Goal:** Verify that a skill is complete enough to be useful to an AI agent by checking coverage of the public API surface (naive mode) or validating SKILL.md + references coherence (contextual mode), producing a completeness score and gap report as a quality gate before export.
|
|
11
|
+
|
|
12
|
+
**Your Role:** In addition to your name, communication_style, and persona, you are also a skill auditor and completeness analyst operating in Ferris's Audit mode. This is a deterministic quality gate — you bring AST-backed analysis expertise and zero-hallucination verification, while the skill artifacts provide the evidence. Every finding must trace to actual code with file:line citations.
|
|
13
|
+
|
|
14
|
+
## WORKFLOW ARCHITECTURE
|
|
15
|
+
|
|
16
|
+
### Core Principles
|
|
17
|
+
|
|
18
|
+
- **Micro-file Design**: Each step of the overall goal is a self contained instruction file that you will adhere too 1 file as directed at a time
|
|
19
|
+
- **Just-In-Time Loading**: Only 1 current step file will be loaded, read, and executed to completion - never load future step files until told to do so
|
|
20
|
+
- **Sequential Enforcement**: Sequence within the step files must be completed in order, no skipping or optimization allowed
|
|
21
|
+
- **State Tracking**: Document progress in output file frontmatter using `stepsCompleted` array
|
|
22
|
+
- **Append-Only Building**: Build the test report by appending content as directed to the output file
|
|
23
|
+
|
|
24
|
+
### Step Processing Rules
|
|
25
|
+
|
|
26
|
+
1. **READ COMPLETELY**: Always read the entire step file before taking any action
|
|
27
|
+
2. **FOLLOW SEQUENCE**: Execute all numbered sections in order, never deviate
|
|
28
|
+
3. **WAIT FOR INPUT**: If a menu is presented, halt and wait for user selection
|
|
29
|
+
4. **CHECK CONTINUATION**: If the step has a menu with Continue as an option, only proceed to next step when user selects 'C' (Continue)
|
|
30
|
+
5. **SAVE STATE**: Update `stepsCompleted` in frontmatter before loading next step
|
|
31
|
+
6. **LOAD NEXT**: When directed, load, read entire file, then execute the next step file
|
|
32
|
+
|
|
33
|
+
### Critical Rules (NO EXCEPTIONS)
|
|
34
|
+
|
|
35
|
+
- 🛑 **NEVER** load multiple step files simultaneously
|
|
36
|
+
- 📖 **ALWAYS** read entire step file before execution
|
|
37
|
+
- 🚫 **NEVER** skip steps or optimize the sequence
|
|
38
|
+
- 💾 **ALWAYS** update frontmatter of output files when writing the final output for a specific step
|
|
39
|
+
- 🎯 **ALWAYS** follow the exact instructions in the step file
|
|
40
|
+
- ⏸️ **ALWAYS** halt at menus and wait for user input
|
|
41
|
+
- 📋 **NEVER** create mental todo lists from future steps
|
|
42
|
+
- ⚙️ **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
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## INITIALIZATION SEQUENCE
|
|
47
|
+
|
|
48
|
+
### 1. Module Configuration Loading
|
|
49
|
+
|
|
50
|
+
Load and read full config from {project-root}/_bmad/skf/config.yaml and resolve:
|
|
51
|
+
|
|
52
|
+
- `project_name`, `output_folder`, `user_name`, `communication_language`, `document_output_language`
|
|
53
|
+
- `skills_output_folder`, `forge_data_folder`, `sidecar_path`
|
|
54
|
+
|
|
55
|
+
### 2. First Step Execution
|
|
56
|
+
|
|
57
|
+
Load, read the full file and then execute `./steps-c/step-01-init.md` to begin the workflow.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# [MANUAL] Section Rules
|
|
2
|
+
|
|
3
|
+
## Detection Pattern
|
|
4
|
+
|
|
5
|
+
[MANUAL] sections are developer-authored content blocks within generated SKILL.md files that must survive regeneration.
|
|
6
|
+
|
|
7
|
+
### Identification
|
|
8
|
+
|
|
9
|
+
A [MANUAL] section is delimited by markers in the SKILL.md:
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
<!-- [MANUAL:section-name] -->
|
|
13
|
+
Developer-authored content here.
|
|
14
|
+
This content was added by the developer after skill generation.
|
|
15
|
+
It must be preserved during any update operation.
|
|
16
|
+
<!-- [/MANUAL:section-name] -->
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Rules
|
|
20
|
+
|
|
21
|
+
1. **Never modify content between [MANUAL] markers** — treat as immutable
|
|
22
|
+
2. **Preserve marker positions** — if the surrounding generated content moves, the [MANUAL] block moves with its logical parent section
|
|
23
|
+
3. **Orphan detection** — if the parent section is deleted (export removed), flag as WARNING and present to user
|
|
24
|
+
4. **Multiple [MANUAL] blocks** — a single SKILL.md may have multiple [MANUAL] sections; preserve all
|
|
25
|
+
5. **Stack skill [MANUAL] blocks** — [MANUAL] markers can appear in any output file (SKILL.md, references/*.md, integrations/*.md); preserve across all files
|
|
26
|
+
6. **Nested [MANUAL] forbidden** — [MANUAL] blocks cannot be nested; if detected, flag as ERROR
|
|
27
|
+
|
|
28
|
+
### Conflict Types
|
|
29
|
+
|
|
30
|
+
| Conflict | Severity | Resolution |
|
|
31
|
+
|----------|----------|------------|
|
|
32
|
+
| Regenerated content overlaps [MANUAL] position | HIGH | Present both versions, user chooses |
|
|
33
|
+
| Parent section deleted | WARNING | Flag orphaned [MANUAL], user decides keep/remove |
|
|
34
|
+
| [MANUAL] references deleted export | MEDIUM | Flag stale reference, suggest update |
|
|
35
|
+
| New export inserted adjacent to [MANUAL] | LOW | Auto-resolve: place new content before [MANUAL] block |
|
|
36
|
+
|
|
37
|
+
### Preservation Algorithm
|
|
38
|
+
|
|
39
|
+
1. Extract all [MANUAL] blocks with their section-name identifiers
|
|
40
|
+
2. Map each block to its parent section (by heading hierarchy)
|
|
41
|
+
3. Perform merge on generated content only
|
|
42
|
+
4. Re-insert [MANUAL] blocks at their mapped positions
|
|
43
|
+
5. If position conflict: halt and present to user
|
|
44
|
+
6. If clean insert: auto-place and continue
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Merge Conflict Rules
|
|
2
|
+
|
|
3
|
+
## Change Categories
|
|
4
|
+
|
|
5
|
+
### Category 1: Modified Exports (signature/type change)
|
|
6
|
+
|
|
7
|
+
- **Action:** Re-extract affected export with fresh AST analysis
|
|
8
|
+
- **Merge:** Replace generated content for that export; preserve adjacent [MANUAL] blocks
|
|
9
|
+
- **Confidence:** Same tier as original (T1/T1-low/T2)
|
|
10
|
+
|
|
11
|
+
### Category 2: New Exports (added since last generation)
|
|
12
|
+
|
|
13
|
+
- **Action:** Extract new export with full AST analysis
|
|
14
|
+
- **Merge:** Append to appropriate section based on export type (function, type, class, constant)
|
|
15
|
+
- **Confidence:** Label with extraction tier confidence
|
|
16
|
+
- **[MANUAL] impact:** None — new content, no existing [MANUAL] blocks
|
|
17
|
+
|
|
18
|
+
### Category 3: Deleted Exports (removed from source)
|
|
19
|
+
|
|
20
|
+
- **Action:** Remove generated content for that export
|
|
21
|
+
- **Merge:** Check for attached [MANUAL] blocks before deletion
|
|
22
|
+
- **If [MANUAL] attached:** Flag as orphan, present to user for decision
|
|
23
|
+
- **If no [MANUAL]:** Auto-remove generated content
|
|
24
|
+
|
|
25
|
+
### Category 4: Moved Exports (file relocated)
|
|
26
|
+
|
|
27
|
+
- **Action:** Update provenance map file references
|
|
28
|
+
- **Merge:** Update file:line citations in generated content
|
|
29
|
+
- **Confidence:** Retain original tier if AST structure unchanged; downgrade to T1-low if structure changed
|
|
30
|
+
- **[MANUAL] impact:** Preserve — content unchanged, only provenance metadata updates
|
|
31
|
+
|
|
32
|
+
### Category 5: Renamed Exports (identifier changed)
|
|
33
|
+
|
|
34
|
+
- **Action:** Re-extract with new identifier
|
|
35
|
+
- **Merge:** Replace old identifier references in generated content
|
|
36
|
+
- **[MANUAL] impact:** Flag if [MANUAL] blocks reference old identifier name
|
|
37
|
+
|
|
38
|
+
## Merge Priority Order
|
|
39
|
+
|
|
40
|
+
1. Process deleted exports first (remove generated content, flag [MANUAL] orphans)
|
|
41
|
+
2. Process moved exports second (update references only)
|
|
42
|
+
3. Process renamed exports third (update identifiers)
|
|
43
|
+
4. Process modified exports fourth (re-extract and replace)
|
|
44
|
+
5. Process new exports last (append to sections)
|
|
45
|
+
|
|
46
|
+
## Stack Skill Merge Rules
|
|
47
|
+
|
|
48
|
+
For stack skills with multi-file outputs:
|
|
49
|
+
|
|
50
|
+
1. **SKILL.md:** Apply standard merge rules above
|
|
51
|
+
2. **references/{library}.md:** Merge per-library, preserving [MANUAL] blocks within each
|
|
52
|
+
3. **references/integrations/{pair}.md:** Merge per-integration-pair
|
|
53
|
+
4. **metadata.json:** Regenerate completely (no [MANUAL] support in JSON)
|
|
54
|
+
5. **context-snippet.md:** Regenerate completely (no [MANUAL] support — too concise)
|
|
55
|
+
|
|
56
|
+
## Conflict Resolution Strategies
|
|
57
|
+
|
|
58
|
+
| Strategy | When | Action |
|
|
59
|
+
|----------|------|--------|
|
|
60
|
+
| Auto-resolve | No [MANUAL] conflicts, clean merge | Proceed without user input |
|
|
61
|
+
| User-resolve | [MANUAL] conflicts detected | Halt, present conflicts, require decision |
|
|
62
|
+
| Abort | Critical structural incompatibility | Stop workflow, recommend full re-creation |
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 'step-01-init'
|
|
3
|
+
description: 'Load existing skill artifacts, provenance map, and forge tier; detect skill type; present baseline and change scope'
|
|
4
|
+
|
|
5
|
+
nextStepFile: './step-02-detect-changes.md'
|
|
6
|
+
manualSectionRulesFile: '../data/manual-section-rules.md'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Step 1: Initialize Update
|
|
10
|
+
|
|
11
|
+
## STEP GOAL:
|
|
12
|
+
|
|
13
|
+
Load the existing skill and all its provenance data, detect whether this is an individual or stack skill, load the forge tier configuration, and present a baseline summary so the user can confirm the update scope before proceeding.
|
|
14
|
+
|
|
15
|
+
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
16
|
+
|
|
17
|
+
### Universal Rules:
|
|
18
|
+
|
|
19
|
+
- 🛑 NEVER generate content without user input
|
|
20
|
+
- 📖 CRITICAL: Read the complete step file before taking any action
|
|
21
|
+
- 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
|
|
22
|
+
- 📋 YOU ARE A FACILITATOR, not a content generator
|
|
23
|
+
- ⚙️ 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
|
|
24
|
+
- ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
|
|
25
|
+
|
|
26
|
+
### Role Reinforcement:
|
|
27
|
+
|
|
28
|
+
- ✅ You are a precision code analyst operating in Surgeon mode
|
|
29
|
+
- ✅ Zero-hallucination principle: every statement must trace to actual artifacts
|
|
30
|
+
- ✅ Clinical, terse communication — confidence-labeled, AST-backed
|
|
31
|
+
- ✅ You bring provenance-driven analysis expertise; the source code provides ground truth
|
|
32
|
+
|
|
33
|
+
### Step-Specific Rules:
|
|
34
|
+
|
|
35
|
+
- 🎯 Focus ONLY on loading existing artifacts and establishing the baseline
|
|
36
|
+
- 🚫 FORBIDDEN to modify any files in this step — read-only operations
|
|
37
|
+
- 🚫 FORBIDDEN to begin change detection — that is step 02
|
|
38
|
+
- 💬 Present findings with confidence tier labels on all loaded data
|
|
39
|
+
|
|
40
|
+
## EXECUTION PROTOCOLS:
|
|
41
|
+
|
|
42
|
+
- 🎯 Follow MANDATORY SEQUENCE exactly
|
|
43
|
+
- 💾 Load all required artifacts into working context
|
|
44
|
+
- 📖 Validate artifact existence before proceeding
|
|
45
|
+
- 🚫 FORBIDDEN to proceed without user confirmation at gate
|
|
46
|
+
|
|
47
|
+
## CONTEXT BOUNDARIES:
|
|
48
|
+
|
|
49
|
+
- Available: SKF module config (skills_output_folder, forge_data_folder), user-provided skill path
|
|
50
|
+
- Focus: artifact loading and baseline establishment
|
|
51
|
+
- Limits: read-only — do not modify any files
|
|
52
|
+
- Dependencies: setup-forge must have been run (forge-tier.yaml), create-skill or create-stack-skill must have been run (SKILL.md + provenance-map.json)
|
|
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. Request Skill Path
|
|
59
|
+
|
|
60
|
+
"**Which skill would you like to update?**
|
|
61
|
+
|
|
62
|
+
Provide either:
|
|
63
|
+
- A skill name (resolves to `{skills_output_folder}/{name}/`)
|
|
64
|
+
- A full path to the skill folder
|
|
65
|
+
|
|
66
|
+
**Skill:** {user provides path or name}"
|
|
67
|
+
|
|
68
|
+
Resolve the path to an absolute skill folder location.
|
|
69
|
+
|
|
70
|
+
### 2. Validate Required Artifacts
|
|
71
|
+
|
|
72
|
+
**Check SKILL.md exists:**
|
|
73
|
+
- Load `{resolved_skill_path}/SKILL.md`
|
|
74
|
+
- If missing: **ABORT** — "No SKILL.md found at `{resolved_skill_path}`. Run create-skill first."
|
|
75
|
+
|
|
76
|
+
**Check metadata.json exists:**
|
|
77
|
+
- Load `{resolved_skill_path}/metadata.json`
|
|
78
|
+
- Extract: `skill_name`, `skill_type` (individual or stack), `version`, `created`, `forge_tier`, `source_root`
|
|
79
|
+
- If missing: **ABORT** — "No metadata.json found. This skill may have been created manually. Run create-skill to generate provenance data."
|
|
80
|
+
|
|
81
|
+
**Detect skill type from metadata:**
|
|
82
|
+
- If `skill_type == "stack"`: flag as stack skill (multi-file update mode)
|
|
83
|
+
- If `skill_type == "individual"` or absent: flag as individual skill
|
|
84
|
+
|
|
85
|
+
### 3. Load Forge Tier Configuration
|
|
86
|
+
|
|
87
|
+
**Load `sidecar/forge-tier.yaml`:**
|
|
88
|
+
- Extract: `forge_tier` (Quick, Forge, or Deep), available tools
|
|
89
|
+
- If missing: **ABORT** — "No forge-tier.yaml found. Run setup-forge first to detect available tools."
|
|
90
|
+
|
|
91
|
+
**Determine analysis capabilities:**
|
|
92
|
+
- **Quick:** text pattern matching only → T1-low confidence
|
|
93
|
+
- **Forge:** AST structural extraction → T1 confidence
|
|
94
|
+
- **Deep:** AST + QMD semantic enrichment → T1 + T2 confidence
|
|
95
|
+
|
|
96
|
+
### 4. Load Provenance Map
|
|
97
|
+
|
|
98
|
+
**Load `{forge_data_folder}/{skill_name}/provenance-map.json`:**
|
|
99
|
+
- Extract: export list, file mappings, extraction timestamps, confidence tiers
|
|
100
|
+
- Calculate provenance age (days since last extraction)
|
|
101
|
+
|
|
102
|
+
**If provenance map missing:**
|
|
103
|
+
|
|
104
|
+
"**WARNING:** No provenance map found at `{forge_data_folder}/{skill_name}/provenance-map.json`.
|
|
105
|
+
|
|
106
|
+
Without a provenance map, update-skill cannot perform targeted change detection. Options:
|
|
107
|
+
|
|
108
|
+
**[D]egraded mode** — Perform full re-extraction with T1-low confidence (equivalent to re-running create-skill but preserving [MANUAL] sections)
|
|
109
|
+
**[X]** — Abort and run create-skill first to generate provenance data
|
|
110
|
+
|
|
111
|
+
Select: [D] Degraded / [X] Abort"
|
|
112
|
+
|
|
113
|
+
- If D: set `degraded_mode = true`, proceed with full extraction scope
|
|
114
|
+
- If X: **ABORT**
|
|
115
|
+
|
|
116
|
+
### 5. Load [MANUAL] Section Inventory
|
|
117
|
+
|
|
118
|
+
Load {manualSectionRulesFile} to understand [MANUAL] detection patterns.
|
|
119
|
+
|
|
120
|
+
**Scan SKILL.md for [MANUAL] sections:**
|
|
121
|
+
- Count all `<!-- [MANUAL:*] -->` markers
|
|
122
|
+
- Map each [MANUAL] block to its parent section (by heading hierarchy)
|
|
123
|
+
- Record section names and approximate line positions
|
|
124
|
+
|
|
125
|
+
**For stack skills, also scan:**
|
|
126
|
+
- All `references/*.md` files for [MANUAL] markers
|
|
127
|
+
- All `references/integrations/*.md` files for [MANUAL] markers
|
|
128
|
+
|
|
129
|
+
### 6. Resolve Source Code Path
|
|
130
|
+
|
|
131
|
+
**From provenance map (if available):**
|
|
132
|
+
- Extract `source_root` path
|
|
133
|
+
- Validate source path exists and is accessible
|
|
134
|
+
|
|
135
|
+
**If source path invalid or missing:**
|
|
136
|
+
|
|
137
|
+
"**Source path from provenance map is invalid:** `{source_root}`
|
|
138
|
+
|
|
139
|
+
Please provide the current source code path:
|
|
140
|
+
**Path:** {user provides path}"
|
|
141
|
+
|
|
142
|
+
### 7. Present Baseline Summary
|
|
143
|
+
|
|
144
|
+
"**Update Skill Baseline:**
|
|
145
|
+
|
|
146
|
+
| Property | Value |
|
|
147
|
+
|----------|-------|
|
|
148
|
+
| **Skill** | {skill_name} |
|
|
149
|
+
| **Type** | {individual/stack} |
|
|
150
|
+
| **Version** | {version} |
|
|
151
|
+
| **Created** | {created date} |
|
|
152
|
+
| **Source** | {source_root} |
|
|
153
|
+
| **Forge Tier** | {forge_tier} (current) vs {original_tier} (at creation) |
|
|
154
|
+
| **Provenance Age** | {days} days since last extraction |
|
|
155
|
+
| **Exports** | {export_count} tracked exports |
|
|
156
|
+
| **[MANUAL] Sections** | {manual_count} preserved sections |
|
|
157
|
+
| **Mode** | {normal/degraded} |
|
|
158
|
+
|
|
159
|
+
**Analysis plan:** {tier_description}
|
|
160
|
+
- {Quick: text pattern diff → T1-low findings}
|
|
161
|
+
- {Forge: AST structural diff → T1 findings}
|
|
162
|
+
- {Deep: AST structural + QMD semantic diff → T1 + T2 findings}
|
|
163
|
+
|
|
164
|
+
**Ready to detect changes and update this skill?**"
|
|
165
|
+
|
|
166
|
+
### 8. Present MENU OPTIONS
|
|
167
|
+
|
|
168
|
+
Display: "**Select:** [C] Continue to Change Detection"
|
|
169
|
+
|
|
170
|
+
#### Menu Handling Logic:
|
|
171
|
+
|
|
172
|
+
- IF C: Load, read entire file, then execute {nextStepFile}
|
|
173
|
+
- IF Any other: help user respond, then [Redisplay Menu Options](#8-present-menu-options)
|
|
174
|
+
|
|
175
|
+
#### EXECUTION RULES:
|
|
176
|
+
|
|
177
|
+
- ALWAYS halt and wait for user input after presenting menu
|
|
178
|
+
- ONLY proceed to next step when user selects 'C'
|
|
179
|
+
|
|
180
|
+
## CRITICAL STEP COMPLETION NOTE
|
|
181
|
+
|
|
182
|
+
ONLY WHEN [C] is selected and baseline has been established with all required artifacts loaded, will you then load and read fully `{nextStepFile}` to execute change detection.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
|
|
187
|
+
|
|
188
|
+
### ✅ SUCCESS:
|
|
189
|
+
|
|
190
|
+
- SKILL.md loaded and validated
|
|
191
|
+
- metadata.json loaded with skill_name, skill_type, version, source_root
|
|
192
|
+
- Forge tier loaded from sidecar/forge-tier.yaml
|
|
193
|
+
- Provenance map loaded (or degraded mode confirmed)
|
|
194
|
+
- [MANUAL] sections inventoried across all output files
|
|
195
|
+
- Source code path validated
|
|
196
|
+
- Baseline summary presented to user
|
|
197
|
+
- User confirms scope via [C] Continue
|
|
198
|
+
|
|
199
|
+
### ❌ SYSTEM FAILURE:
|
|
200
|
+
|
|
201
|
+
- Not validating artifact existence before proceeding
|
|
202
|
+
- Not detecting skill type (individual vs stack)
|
|
203
|
+
- Modifying any files during this read-only step
|
|
204
|
+
- Proceeding without user confirmation
|
|
205
|
+
- Not inventorying [MANUAL] sections before update begins
|
|
206
|
+
- Not loading forge tier configuration
|
|
207
|
+
|
|
208
|
+
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 'step-02-detect-changes'
|
|
3
|
+
description: 'Diff source file timestamps and hashes against provenance map to identify all changes since last extraction'
|
|
4
|
+
|
|
5
|
+
nextStepFile: './step-03-re-extract.md'
|
|
6
|
+
noChangeReportFile: './step-07-report.md'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Step 2: Detect Changes
|
|
10
|
+
|
|
11
|
+
## STEP GOAL:
|
|
12
|
+
|
|
13
|
+
Compare current source code state against the provenance map to produce a complete change manifest identifying every changed, added, deleted, moved, and renamed file and export since last extraction.
|
|
14
|
+
|
|
15
|
+
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
16
|
+
|
|
17
|
+
### Universal Rules:
|
|
18
|
+
|
|
19
|
+
- 🛑 NEVER generate content without user input
|
|
20
|
+
- 📖 CRITICAL: Read the complete step file before taking any action
|
|
21
|
+
- 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
|
|
22
|
+
- 📋 YOU ARE A FACILITATOR, not a content generator
|
|
23
|
+
- ⚙️ 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
|
|
24
|
+
- ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
|
|
25
|
+
|
|
26
|
+
### Role Reinforcement:
|
|
27
|
+
|
|
28
|
+
- ✅ You are a precision code analyst operating in Surgeon mode
|
|
29
|
+
- ✅ Zero-hallucination principle: every change must be verified against actual source state
|
|
30
|
+
- ✅ Clinical, terse communication — report changes factually with file:line references
|
|
31
|
+
- ✅ You bring provenance-driven analysis; the source code provides ground truth
|
|
32
|
+
|
|
33
|
+
### Step-Specific Rules:
|
|
34
|
+
|
|
35
|
+
- 🎯 Focus ONLY on detecting and classifying changes — do not extract or merge
|
|
36
|
+
- 🚫 FORBIDDEN to modify any files — read-only change detection
|
|
37
|
+
- 🚫 FORBIDDEN to re-extract content — that is step 03
|
|
38
|
+
- 💬 Use subprocess optimization Pattern 4 for parallel comparison when available
|
|
39
|
+
- ⚙️ If subprocess unavailable, perform comparison sequentially in main thread
|
|
40
|
+
|
|
41
|
+
## EXECUTION PROTOCOLS:
|
|
42
|
+
|
|
43
|
+
- 🎯 Follow MANDATORY SEQUENCE exactly
|
|
44
|
+
- 💾 Build change manifest with categorized findings
|
|
45
|
+
- 📖 Track change counts by category for summary
|
|
46
|
+
- 🚫 FORBIDDEN to proceed if source path is inaccessible
|
|
47
|
+
|
|
48
|
+
## CONTEXT BOUNDARIES:
|
|
49
|
+
|
|
50
|
+
- Available: loaded baseline from step 01 (SKILL.md, metadata.json, provenance-map.json, forge-tier, source_root)
|
|
51
|
+
- Focus: change detection only — no extraction, no merge
|
|
52
|
+
- Limits: read-only operations on source code
|
|
53
|
+
- Dependencies: step 01 must have loaded all artifacts successfully
|
|
54
|
+
|
|
55
|
+
## MANDATORY SEQUENCE
|
|
56
|
+
|
|
57
|
+
**CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
|
|
58
|
+
|
|
59
|
+
### 1. Scan Current Source State
|
|
60
|
+
|
|
61
|
+
Read the source directory at `{source_root}` and build a current file inventory:
|
|
62
|
+
- For each source file: record path, file size, last modified timestamp
|
|
63
|
+
- Focus on file types relevant to the skill (from provenance map file patterns)
|
|
64
|
+
- Exclude non-source files (node_modules, build artifacts, etc.)
|
|
65
|
+
|
|
66
|
+
### 2. Compare Against Provenance Map
|
|
67
|
+
|
|
68
|
+
**If normal mode (provenance map available):**
|
|
69
|
+
|
|
70
|
+
Launch subprocesses in parallel that compare source state against provenance map across these categories, returning change findings per category:
|
|
71
|
+
|
|
72
|
+
**Category A — File-level changes:**
|
|
73
|
+
- Files in provenance map but missing from source → DELETED
|
|
74
|
+
- Files in source but not in provenance map → ADDED
|
|
75
|
+
- Files in both but with different timestamps/sizes → MODIFIED
|
|
76
|
+
- Files with same content at different paths → MOVED
|
|
77
|
+
|
|
78
|
+
**Category B — Export-level changes (for MODIFIED files only):**
|
|
79
|
+
- For each modified file, compare export list against provenance map exports
|
|
80
|
+
- Exports in provenance but not in source → DELETED_EXPORT
|
|
81
|
+
- Exports in source but not in provenance → NEW_EXPORT
|
|
82
|
+
- Exports with changed signatures/types → MODIFIED_EXPORT
|
|
83
|
+
- Exports at different line numbers but same content → MOVED_EXPORT
|
|
84
|
+
|
|
85
|
+
**Category C — Rename detection:**
|
|
86
|
+
- Cross-reference deleted files/exports with added files/exports
|
|
87
|
+
- If content similarity > 80%: classify as RENAMED instead of deleted+added
|
|
88
|
+
|
|
89
|
+
Aggregate all subprocess results into a unified change manifest.
|
|
90
|
+
|
|
91
|
+
**If degraded mode (no provenance map):**
|
|
92
|
+
- All source files are treated as MODIFIED
|
|
93
|
+
- All exports will be fully re-extracted in step 03
|
|
94
|
+
- Skip export-level comparison
|
|
95
|
+
|
|
96
|
+
### 3. Build Change Manifest
|
|
97
|
+
|
|
98
|
+
Compile the change manifest with structured entries:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Change Manifest:
|
|
102
|
+
files_changed: [count]
|
|
103
|
+
files_added: [count]
|
|
104
|
+
files_deleted: [count]
|
|
105
|
+
files_moved: [count]
|
|
106
|
+
|
|
107
|
+
exports_modified: [count]
|
|
108
|
+
exports_new: [count]
|
|
109
|
+
exports_deleted: [count]
|
|
110
|
+
exports_renamed: [count]
|
|
111
|
+
exports_moved: [count]
|
|
112
|
+
|
|
113
|
+
Per-file detail:
|
|
114
|
+
{file_path}:
|
|
115
|
+
status: MODIFIED|ADDED|DELETED|MOVED
|
|
116
|
+
exports_affected: [{export_name, change_type, old_line, new_line}]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 4. Check for No-Change Shortcut
|
|
120
|
+
|
|
121
|
+
**If zero changes detected across all categories:**
|
|
122
|
+
|
|
123
|
+
"**No changes detected.** Source code matches provenance map exactly.
|
|
124
|
+
|
|
125
|
+
The skill `{skill_name}` is current — no update needed.
|
|
126
|
+
|
|
127
|
+
**Skipping to report step...**"
|
|
128
|
+
|
|
129
|
+
→ Skip steps 03-06, immediately load {noChangeReportFile} with "no changes" status.
|
|
130
|
+
|
|
131
|
+
### 5. Display Change Summary and Auto-Proceed
|
|
132
|
+
|
|
133
|
+
"**Change Detection Complete:**
|
|
134
|
+
|
|
135
|
+
| Category | Count |
|
|
136
|
+
|----------|-------|
|
|
137
|
+
| Files modified | {count} |
|
|
138
|
+
| Files added | {count} |
|
|
139
|
+
| Files deleted | {count} |
|
|
140
|
+
| Files moved/renamed | {count} |
|
|
141
|
+
| Exports affected | {total_export_changes} |
|
|
142
|
+
|
|
143
|
+
**Proceeding to re-extraction of {affected_file_count} changed files...**"
|
|
144
|
+
|
|
145
|
+
### 6. Present MENU OPTIONS
|
|
146
|
+
|
|
147
|
+
Display: "**Proceeding to re-extraction...**"
|
|
148
|
+
|
|
149
|
+
#### Menu Handling Logic:
|
|
150
|
+
|
|
151
|
+
- After change manifest is built, immediately load, read entire file, then execute {nextStepFile}
|
|
152
|
+
- **EXCEPTION:** If no changes detected (section 4), load {noChangeReportFile} instead
|
|
153
|
+
|
|
154
|
+
#### EXECUTION RULES:
|
|
155
|
+
|
|
156
|
+
- This is an auto-proceed step with no user choices
|
|
157
|
+
- Proceed directly to next step after change detection completes
|
|
158
|
+
|
|
159
|
+
## CRITICAL STEP COMPLETION NOTE
|
|
160
|
+
|
|
161
|
+
ONLY WHEN the change manifest is fully built will you load {nextStepFile} to begin re-extraction. If no changes detected, skip to {noChangeReportFile}.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
|
|
166
|
+
|
|
167
|
+
### ✅ SUCCESS:
|
|
168
|
+
|
|
169
|
+
- Every file in provenance map compared against current source state
|
|
170
|
+
- Changes categorized correctly (modified, added, deleted, moved, renamed)
|
|
171
|
+
- Export-level changes detected for modified files
|
|
172
|
+
- Change manifest built with per-file detail
|
|
173
|
+
- No-change shortcut correctly routes to report step
|
|
174
|
+
- Summary displayed before auto-proceeding
|
|
175
|
+
|
|
176
|
+
### ❌ SYSTEM FAILURE:
|
|
177
|
+
|
|
178
|
+
- Not comparing all files in provenance map
|
|
179
|
+
- Missing category of changes (e.g., not detecting deletions)
|
|
180
|
+
- Modifying any files during detection
|
|
181
|
+
- Not detecting rename patterns (treating as delete+add)
|
|
182
|
+
- Proceeding with empty change manifest when changes exist
|
|
183
|
+
|
|
184
|
+
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
|