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
@@ -22,7 +22,7 @@ With provenance tracking:
22
22
 
23
23
  | Artifact | Format | Purpose | Generated By |
24
24
  | --- | --- | --- | --- |
25
- | `provenance-map.json` | JSON | Machine-readable claim-to-source mapping | CS, QS, SS |
25
+ | `provenance-map.json` | JSON | Machine-readable export-to-source mapping | CS, QS, SS |
26
26
  | `evidence-report.md` | Markdown | Human-readable extraction summary | CS, QS, SS |
27
27
  | Inline citations | `[TAG:path:Lnn]` | Per-claim source reference in SKILL.md | CS, QS, SS, US |
28
28
  | `drift-report.md` | Markdown | Findings from source comparison | AS |
@@ -36,35 +36,43 @@ With provenance tracking:
36
36
  **Implementation:**
37
37
  ```json
38
38
  {
39
- "version": "1.0",
39
+ "skill_name": "express-skill",
40
+ "source_repo": "https://github.com/expressjs/express",
41
+ "source_commit": "abc1234",
40
42
  "generated_at": "2025-01-15T10:30:00Z",
41
- "extraction_tier": "forge",
42
- "claims": {
43
- "createServer": {
43
+ "entries": [
44
+ {
45
+ "export_name": "createServer",
46
+ "export_type": "function",
47
+ "params": ["options: ServerOptions"],
48
+ "return_type": "Server",
44
49
  "source_file": "src/server.ts",
45
- "line": 23,
46
- "confidence": "t1",
50
+ "source_line": 23,
51
+ "confidence": "T1",
47
52
  "extraction_method": "ast-grep",
48
- "ast_node_type": "export_statement > function_declaration",
49
- "signature": "createServer(options: ServerOptions): Server"
53
+ "ast_node_type": "export_statement > function_declaration"
50
54
  },
51
- "parseConfig": {
55
+ {
56
+ "export_name": "parseConfig",
57
+ "export_type": "function",
58
+ "params": ["input"],
59
+ "return_type": null,
52
60
  "source_file": "src/config.ts",
53
- "line": 45,
54
- "confidence": "t1_low",
61
+ "source_line": 45,
62
+ "confidence": "T1-low",
55
63
  "extraction_method": "source-read",
56
- "ast_node_type": null,
57
- "signature": "parseConfig(input)"
64
+ "ast_node_type": null
58
65
  }
59
- }
66
+ ]
60
67
  }
61
68
  ```
62
69
 
63
70
  **Key Points:**
64
- - Each claim is keyed by export name for direct lookup
71
+ - Each entry uses structured fields (`export_name`, `params[]`, `return_type`) for incremental updates
65
72
  - `ast_node_type` is null for non-AST extractions — never fabricated
66
- - `extraction_method` distinguishes how the claim was obtained
67
- - Confidence tier is recorded per-claim, not per-file
73
+ - `extraction_method` distinguishes how the entry was obtained
74
+ - Confidence tier is recorded per-entry, not per-file
75
+ - `params` is an array of typed strings (e.g., `"userId: string"`) — enables param-by-param diffing
68
76
 
69
77
  ### Example 2: Evidence Report
70
78
 
@@ -106,7 +114,7 @@ With provenance tracking:
106
114
  **Implementation:** The audit process:
107
115
  1. Load the existing `provenance-map.json`
108
116
  2. Re-index current source to build a fresh reference (same extraction method)
109
- 3. For each claim in the provenance map, compare against fresh reference:
117
+ 3. For each entry in the provenance map, compare against fresh reference:
110
118
  - **Signature changed** → CRITICAL or HIGH severity
111
119
  - **Export removed** → CRITICAL severity
112
120
  - **New export undocumented** → HIGH (if > 3) or MEDIUM (if 1-3)
@@ -128,15 +136,15 @@ With provenance tracking:
128
136
  2. Identify claims that need re-extraction (from audit drift report or source change detection)
129
137
  3. Re-extract only affected claims using current tier tools
130
138
  4. Merge fresh provenance entries into the existing map:
131
- - Changed claims: replace with new provenance
132
- - Unchanged claims: preserve existing provenance (timestamp unchanged)
139
+ - Changed entries: replace with new provenance
140
+ - Unchanged entries: preserve existing provenance (timestamp unchanged)
133
141
  - Removed exports: remove from provenance map
134
142
  - New exports: add with fresh provenance
135
143
  5. Regenerate evidence report reflecting the update
136
144
 
137
145
  **Key Points:**
138
- - Selective re-extraction — only changed claims are re-processed
139
- - Provenance timestamps show when each claim was last verified
146
+ - Selective re-extraction — only changed entries are re-processed
147
+ - Provenance timestamps show when each entry was last verified
140
148
  - The merge preserves \[MANUAL\] section provenance (author: "manual", no source location)
141
149
 
142
150
  ## Inline Citation Rules
@@ -0,0 +1,132 @@
1
+ # QMD Collection Registry
2
+
3
+ ## Principle
4
+
5
+ QMD collections in the Skill Forge follow a **progressive registry architecture**: workflow steps that produce artifacts index them into QMD collections and register them in `forge-tier.yaml`. Downstream workflow steps discover and query collections through the registry — never by convention or assumption. Collections are created by producers, consumed by searchers, and maintained by a janitor.
6
+
7
+ ## Rationale
8
+
9
+ Early SKF versions used a blind auto-index strategy: setup-forge would scan all project directories and index them into QMD collections. This created three problems:
10
+
11
+ - On fresh workspaces, auto-indexing found nothing — wasted work
12
+ - Raw source code indexing produced low signal-to-noise search results
13
+ - No connection between what was indexed and what workflows actually queried
14
+
15
+ The progressive registry solves all three by indexing **curated workflow artifacts** (extraction snapshots, skill briefs) instead of raw source files, and only when a workflow produces them.
16
+
17
+ ## Architecture
18
+
19
+ ### Roles
20
+
21
+ | Role | Workflow | Responsibility |
22
+ | --- | --- | --- |
23
+ | **Producer** | brief-skill, create-skill | Creates QMD collections from workflow artifacts and registers them in forge-tier.yaml |
24
+ | **Consumer** | audit-skill, update-skill | Reads the registry, discovers collections by skill name and type, queries via qmd_bridge |
25
+ | **Janitor** | setup-forge | Cross-references live QMD collections against the registry, cleans orphans and stale entries |
26
+
27
+ ### Registry Schema
28
+
29
+ The `qmd_collections` array lives in `forge-tier.yaml` alongside tool availability and tier:
30
+
31
+ ```yaml
32
+ qmd_collections:
33
+ - name: "my-lib-extraction"
34
+ type: "extraction"
35
+ source_workflow: "create-skill"
36
+ skill_name: "my-lib"
37
+ created_at: "2026-03-14"
38
+ - name: "my-lib-brief"
39
+ type: "brief"
40
+ source_workflow: "brief-skill"
41
+ skill_name: "my-lib"
42
+ created_at: "2026-03-14"
43
+ ```
44
+
45
+ ### Collection Types
46
+
47
+ | Type | Producer | Content | Primary Consumers |
48
+ | --- | --- | --- | --- |
49
+ | `extraction` | create-skill step-07 | Compiled SKILL.md, references, context-snippet — structured, confidence-rated exports | audit-skill (drift detection), update-skill (T2 enrichment) |
50
+ | `brief` | brief-skill step-05 | skill-brief.yaml — intent, scope, target repository metadata | Portfolio-level search (cross-skill deduplication) |
51
+ | `docs` | create-skill step-03c | Fetched external documentation — API references, guides, usage examples (T3 confidence) | step-04 enrichment (cross-reference doc context with source-extracted functions) |
52
+
53
+ ### Lifecycle
54
+
55
+ ```
56
+ brief-skill writes brief → indexes {name}-brief → registers in forge-tier.yaml
57
+
58
+ create-skill fetches docs → indexes {name}-docs → registers in forge-tier.yaml (Deep only)
59
+
60
+ create-skill compiles skill → indexes {name}-extraction → registers in forge-tier.yaml
61
+
62
+ audit-skill reads registry → queries {name}-extraction for temporal context
63
+ update-skill reads registry → queries {name}-extraction for T2 enrichment
64
+
65
+ setup-forge reads registry + QMD state → cleans orphans, removes stale entries
66
+ ```
67
+
68
+ ## Collection Gate
69
+
70
+ A new QMD collection type is justified ONLY when:
71
+
72
+ 1. A specific **workflow step** performs a **programmatic search** against it
73
+ 2. The data is not already accessible through existing artifacts (provenance map, file I/O)
74
+ 3. QMD search adds value beyond what direct file reading provides
75
+
76
+ Human readability alone is not sufficient justification — the file is already on disk.
77
+
78
+ ## Rejected Candidates
79
+
80
+ ### Source Clone Indexing
81
+
82
+ **Proposal:** Clone the target repository and index all source files into QMD.
83
+
84
+ **Rejection reason:** Freshness problem. A cloned repo is a snapshot pretending to be current. No clear owner for refresh lifecycle. The provenance map already records `file:line` for every export, and ast-grep provides structural queries against local source. QMD indexing of raw source adds noise, not signal.
85
+
86
+ ### Source-Map Indexing
87
+
88
+ **Proposal:** Index the GitHub API tree response (directory structure + file metadata) as a lightweight `{name}-source-map` collection.
89
+
90
+ **Rejection reason:** No workflow consumer. Audit-skill already has file paths from provenance-map.json. The source-map would only serve ad-hoc developer queries, which don't justify the collection overhead.
91
+
92
+ ### Analysis Report Indexing
93
+
94
+ **Proposal:** Index the analyze-source decomposition report as a `{name}-analysis` collection.
95
+
96
+ **Rejection reason:** Decision artifact, not a compilation input. The analyze-source report tells users which skills to create, but create-stack-skill works from individual skill artifacts, not the analysis report. The only consumer would be a human reading the file — which they can do directly.
97
+
98
+ ## Pattern Examples
99
+
100
+ ### Example 1: Producer Registration (create-skill)
101
+
102
+ **Context:** After writing all skill artifacts to disk, create-skill registers them with QMD.
103
+
104
+ **Implementation:** Deep tier only. Atomic replace if collection exists:
105
+
106
+ ```
107
+ qmd collection remove {name}-extraction (if exists)
108
+ qmd collection add skills/{name} --name {name}-extraction --mask "**/*"
109
+ qmd embed
110
+ ```
111
+
112
+ Then append/replace the registry entry in forge-tier.yaml. Failures never block the workflow. The `qmd embed` call generates vector embeddings required for `vector_search` and `deep_search`.
113
+
114
+ ### Example 2: Consumer Discovery (audit-skill)
115
+
116
+ **Context:** Audit-skill needs temporal context for drift detection.
117
+
118
+ **Implementation:** Read `qmd_collections` from forge-tier.yaml. Find entry where `skill_name` matches AND `type` is `"extraction"`. If found, query via qmd_bridge. If not found, log and continue without T2 enrichment — not an error.
119
+
120
+ ### Example 3: Janitor Hygiene (setup-forge)
121
+
122
+ **Context:** Setup-forge verifies QMD health on every run.
123
+
124
+ **Implementation:** Cross-reference live QMD collections against registry. Classify as healthy (in both), orphaned (in QMD only), or stale (in registry only). Prompt user before removing orphans. Silently clean stale registry entries.
125
+
126
+ ## Related Fragments
127
+
128
+ - [progressive-capability.md](progressive-capability.md) — tier model that gates QMD availability to Deep tier
129
+ - [skill-lifecycle.md](skill-lifecycle.md) — end-to-end pipeline showing where producers and consumers sit
130
+ - [provenance-tracking.md](provenance-tracking.md) — provenance map that provides file:line context without QMD
131
+
132
+ _Source: progressive QMD registry architecture implemented across setup-forge, brief-skill, create-skill, audit-skill, and update-skill workflows_
@@ -7,3 +7,5 @@ agentskills-spec,agentskills.io Specification,"Format principles — frontmatter
7
7
  skill-lifecycle,Skill Lifecycle,"End-to-end pipeline — workflow connections, artifact flow, decision rules for workflow selection","lifecycle,pipeline,workflows,artifacts",core,knowledge/skill-lifecycle.md
8
8
  provenance-tracking,Provenance Tracking,"Provenance mechanism — provenance-map.json, evidence reports, claim traceability","provenance,evidence,traceability,citations",core,knowledge/provenance-tracking.md
9
9
  manual-section-integrity,Manual Section Integrity,"[MANUAL] preservation — marker format, merge algorithm, orphan detection","manual,preservation,merge,markers",core,knowledge/manual-section-integrity.md
10
+ qmd-registry,QMD Collection Registry,"Progressive registry architecture — producer/consumer/janitor roles, collection gate principle, forge-tier.yaml registry schema","qmd,registry,collections,deep,indexing",core,knowledge/qmd-registry.md
11
+ doc-fetcher,Doc Fetcher,"T3 external documentation — tool-agnostic URL fetching, quarantine rules, conflict resolution","doc-fetcher,t3,external,documentation,quarantine",extended,knowledge/doc-fetcher.md
package/src/module.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  code: skf
2
2
  name: "SKF: Skill Forge — Evidence-Based Agent Skills Compiler"
3
- header: "Automated skill compiler AST-verified, provenance-backed agent skills from code repositories, documentation, and developer discourse"
4
- subheader: "Zero hallucination tolerance. Every instruction traces to code."
3
+ header: "Turn code and docs into instructions AI agents can actually follow"
4
+ subheader: "Every instruction traces to source. Zero hallucination tolerance."
5
5
  description: "Skill Forge transforms code repositories, documentation, and developer discourse into agentskills.io-compliant, version-pinned, provenance-backed agent skills. Uses ast-grep for structural truth, QMD for knowledge intelligence, and a progressive capability model (Quick/Forge/Deep). Standalone module — no other modules required. Recommended alongside BMM for full development workflow integration."
6
6
  default_selected: false
7
7
 
@@ -9,8 +9,8 @@ Defines the output contract for skill-brief.yaml files generated by analyze-sour
9
9
  | Field | Type | Constraint | Description |
10
10
  |-------|------|------------|-------------|
11
11
  | name | string | kebab-case `[a-z0-9-]+` | Unique skill identifier |
12
- | version | string | Semantic `X.Y.Z` | Defaults to `1.0.0` |
13
- | source_repo | string | GitHub URL or local path | Repository or project root |
12
+ | version | string | Semantic `X.Y.Z` | Auto-detect from source (see Version Detection below), fall back to `1.0.0` |
13
+ | source_repo | string | GitHub URL or local path | Repository or project root (optional when `source_type: "docs-only"`) |
14
14
  | language | string | Recognized language | Primary programming language |
15
15
  | scope | object | See Scope Object below | Boundary definition |
16
16
  | description | string | 1-3 sentences | What the skill covers |
@@ -18,11 +18,29 @@ Defines the output contract for skill-brief.yaml files generated by analyze-sour
18
18
  | created | string | ISO date `YYYY-MM-DD` | Generation date |
19
19
  | created_by | string | user_name from config | Who generated the brief |
20
20
 
21
+ ## Optional Fields
22
+
23
+ | Field | Type | Constraint | Description |
24
+ |-------|------|------------|-------------|
25
+ | source_type | string | `source` or `docs-only` | Default `source`. When `docs-only`: `source_repo` optional, `doc_urls` required |
26
+ | doc_urls | array | `{url, label}` objects | Documentation URLs for T3 content. Required when `source_type: "docs-only"` |
27
+
28
+ ## Version Detection
29
+
30
+ During brief generation, attempt to auto-detect the source version before defaulting to `"1.0.0"`. Check the first matching file in the source:
31
+
32
+ - **Python:** `pyproject.toml` `[project] version` (static) → if `dynamic = ["version"]`, check `__init__.py` for `__version__` → `_version.py` if exists → `setup.py` `version=` → `git describe --tags --abbrev=0`
33
+ - **JavaScript/TypeScript:** `package.json` (`"version"`)
34
+ - **Rust:** `Cargo.toml` `[package] version` (static) → if `version = { workspace = true }`, resolve from workspace root `Cargo.toml` → `git describe --tags --abbrev=0`
35
+ - **Go:** version tag from `go.mod` or `git describe --tags --abbrev=0`
36
+
37
+ If detection succeeds, use the detected version. If it fails or returns a non-semver value, fall back to `"1.0.0"`.
38
+
21
39
  ## Scope Object
22
40
 
23
41
  ```yaml
24
42
  scope:
25
- type: full-library | specific-modules | public-api
43
+ type: full-library | specific-modules | public-api | docs-only
26
44
  include:
27
45
  - 'src/**/*.ts' # At least one required
28
46
  exclude:
@@ -42,7 +60,8 @@ scope:
42
60
 
43
61
  ```yaml
44
62
  name: '{unit-name}'
45
- version: '1.0.0'
63
+ version: '{detected-version or 1.0.0}'
64
+ source_type: 'source'
46
65
  source_repo: '{project_path}'
47
66
  language: '{detected_language}'
48
67
  scope:
@@ -66,6 +85,7 @@ created_by: '{user_name}'
66
85
  4. **Scope type valid**: Must match one of the three defined types
67
86
  5. **Include patterns**: At least one include glob pattern required
68
87
  6. **Forge tier match**: Must match value in forge-tier.yaml
88
+ 7. **Docs-only mode**: When `source_type: "docs-only"`, `doc_urls` required (>= 1), `source_repo` optional
69
89
 
70
90
  ## Output Location
71
91
 
@@ -72,10 +72,12 @@ Look for {outputFile}.
72
72
  ### 2. Verify Prerequisites
73
73
 
74
74
  **Check forge-tier.yaml:**
75
- - Look for `{forge_data_folder}/forge-tier.yaml`
76
- - **IF missing:** HARD HALT — "**Cannot proceed.** forge-tier.yaml not found at `{forge_data_folder}/forge-tier.yaml`. Please run the setup-forge workflow first to configure your forge tier (Quick/Forge/Deep)."
75
+ - Look for `{sidecar_path}/forge-tier.yaml`
76
+ - **IF missing:** HARD HALT — "**Cannot proceed.** forge-tier.yaml not found at `{sidecar_path}/forge-tier.yaml`. Please run the setup-forge workflow first to configure your forge tier (Quick/Forge/Deep)."
77
77
  - **IF found:** Read and note the forge tier value
78
78
 
79
+ **Apply tier override:** Read `{sidecar_path}/preferences.yaml`. If `tier_override` is set and is a valid tier value (Quick, Forge, or Deep), use it instead of the detected tier.
80
+
79
81
  "**Forge tier detected:** {tier} — analysis depth will be calibrated accordingly."
80
82
 
81
83
  ### 3. Collect Project Path
@@ -84,15 +86,23 @@ Look for {outputFile}.
84
86
 
85
87
  I'll analyze your project to identify discrete skillable units and produce skill-brief.yaml files for each recommended unit.
86
88
 
87
- **Please provide the project root path to analyze:**
89
+ **Please provide the project root path(s) to analyze:**
90
+
91
+ This can be:
92
+ - A single root directory of a repo or multi-service project
93
+ - Multiple paths or URLs (comma-separated) for multi-repo analysis (e.g., integration/stack skills)
88
94
 
89
- This should be the root directory of the repo or multi-service project you want to decompose."
95
+ Examples:
96
+ - `/path/to/project`
97
+ - `owner/repo, owner/repo2`
98
+ - `/path/to/project, https://github.com/owner/repo2`"
90
99
 
91
100
  Wait for user input.
92
101
 
93
- **Validate the path:**
94
- - Check that the path exists and contains source files
95
- - **IF invalid:** "That path doesn't appear to be a valid project directory. Please provide the correct path."
102
+ **Validate the path(s):**
103
+ - For each provided path/URL: check that it exists (local) or is accessible (remote)
104
+ - **IF any invalid:** "Path `{path}` doesn't appear to be valid. Please correct it."
105
+ - Store as `project_paths[]` array in report frontmatter (single path stored as 1-element array for consistency)
96
106
 
97
107
  ### 4. Collect Optional Scope Hints
98
108
 
@@ -131,7 +141,7 @@ lastContinued: ''
131
141
  date: '{current_date}'
132
142
  user_name: '{user_name}'
133
143
  project_name: '{project_name}'
134
- project_path: '{provided_project_path}'
144
+ project_paths: ['{provided_project_path}']
135
145
  forge_tier: '{detected_tier}'
136
146
  existing_skills: [{list of existing skill names}]
137
147
  confirmed_units: []
@@ -163,7 +173,7 @@ Display: "**Proceeding to project scan...**"
163
173
 
164
174
  ## CRITICAL STEP COMPLETION NOTE
165
175
 
166
- ONLY WHEN the output report has been created with populated frontmatter (project_path, forge_tier, existing_skills) will you load and read fully {nextStepFile} to execute and begin the project scan.
176
+ ONLY WHEN the output report has been created with populated frontmatter (project_paths, forge_tier, existing_skills) will you load and read fully {nextStepFile} to execute and begin the project scan.
167
177
 
168
178
  ---
169
179
 
@@ -66,7 +66,7 @@ To resume the analyze-source workflow from where it was left off in a previous s
66
66
 
67
67
  Load {outputFile} and read frontmatter:
68
68
  - `stepsCompleted` array
69
- - `project_path`
69
+ - `project_paths`
70
70
  - `project_name`
71
71
  - `forge_tier`
72
72
  - `existing_skills`
@@ -76,7 +76,7 @@ Load {outputFile} and read frontmatter:
76
76
 
77
77
  "**Analysis Progress for {project_name}:**
78
78
 
79
- **Project:** {project_path}
79
+ **Project:** {project_paths}
80
80
  **Forge Tier:** {forge_tier}
81
81
  **Steps Completed:** {list stepsCompleted}
82
82
  **Last Step:** {last entry in stepsCompleted}
@@ -38,6 +38,8 @@ To map the complete project structure by scanning directory trees, detecting ser
38
38
  - 💬 Use subprocess optimization (Pattern 1) for scanning across many files
39
39
  - 📋 Tier-aware scanning depth: Quick (file structure only), Forge (+ manifest parsing), Deep (+ config analysis)
40
40
 
41
+ **AST Degradation Fallback:** If the AST tool (ast-grep) is unavailable at Forge or Deep tier, degrade to Quick-tier behavior for this step and emit a warning: "AST tool unavailable — falling back to file-structure scanning for this step."
42
+
41
43
  ## EXECUTION PROTOCOLS:
42
44
 
43
45
  - 🎯 Follow the MANDATORY SEQUENCE exactly
@@ -59,7 +61,7 @@ To map the complete project structure by scanning directory trees, detecting ser
59
61
  ### 1. Load Context
60
62
 
61
63
  Read {outputFile} frontmatter to obtain:
62
- - `project_path` — the root to scan
64
+ - `project_paths[]` — the root(s) to scan (one or more paths/URLs)
63
65
  - `forge_tier` — determines scanning depth
64
66
  - Scope hints (if any were provided in step 01)
65
67
 
@@ -67,7 +69,7 @@ Load {heuristicsFile} for reference on detection signals.
67
69
 
68
70
  ### 2. Scan Directory Structure
69
71
 
70
- Launch a subprocess that scans the project directory structure:
72
+ **For each path in `project_paths[]`**, launch a subprocess that scans the project directory structure (aggregate results across all repos with clear repo-level grouping):
71
73
 
72
74
  1. Map the top-level directory tree (2-3 levels deep)
73
75
  2. Identify workspace configuration files (pnpm-workspace.yaml, lerna.json, Cargo.toml [workspace], go.work, etc.)
@@ -82,6 +84,12 @@ Launch a subprocess that scans the project directory structure:
82
84
  - If specific directories were given, scan only those
83
85
  - If exclusion patterns were given, skip matching directories
84
86
 
87
+ **Deep tier additional scanning (IF Deep tier):**
88
+ - Use ast-grep to detect structural patterns across the codebase: `ast-grep -p 'class $NAME' --lang python` (or equivalent per language) to build a class/type inventory
89
+ - Use ast-grep to identify exported function patterns: `ast-grep -p 'def $FUNC($$$PARAMS)' --lang python` at entry points
90
+ - If QMD is available, query for temporal context on the project: recent changes, active development areas, refactoring patterns
91
+ - Record Deep-tier findings separately — they supplement (not replace) the Quick/Forge scan results
92
+
85
93
  ### 3. Detect Service Boundaries
86
94
 
87
95
  Based on scan results, identify potential service boundaries:
@@ -38,6 +38,8 @@ To analyze each qualifying unit's export surface and import graph, detect cross-
38
38
  - 🚫 FORBIDDEN to make recommendations in this step (that's step 05)
39
39
  - 📋 Tier-aware depth: Quick (file-level exports), Forge (AST export analysis), Deep (AST + semantic relationships)
40
40
 
41
+ **AST Degradation Fallback:** If the AST tool (ast-grep) is unavailable at Forge or Deep tier, degrade to Quick-tier behavior for this step and emit a warning: "AST tool unavailable — falling back to file-level export mapping for this step."
42
+
41
43
  ## EXECUTION PROTOCOLS:
42
44
 
43
45
  - 🎯 Follow the MANDATORY SEQUENCE exactly
@@ -68,16 +70,28 @@ Load {heuristicsFile} for stack skill candidate detection rules.
68
70
 
69
71
  DO NOT BE LAZY — For EACH qualifying unit, launch a subprocess (or analyze in main thread) that:
70
72
 
73
+ **Size-aware strategy selection:**
74
+ - **< 50 files:** Full export scan — analyze every file for exports
75
+ - **50-200 files:** Targeted scan — entry points (`__init__.py`, `index.ts`, `lib.rs`) + public modules + barrel exports only
76
+ - **200+ files:** Entry-point strategy — analyze top-level entry point for public API surface, list submodule entry points, analyze each submodule entry point only. Report coverage confidence based on percentage of files analyzed.
77
+
78
+ **Per-unit analysis (scaled by strategy above):**
79
+
71
80
  1. Scans the unit's directory for export/public interface files
72
81
  2. Counts and categorizes exports based on forge tier:
73
82
  - **Quick tier:** Count files by type, identify index/barrel files, list directory structure
74
83
  - **Forge tier:** Parse export statements, identify public API surface, count exported functions/classes/types
75
- - **Deep tier:** All Forge analysis plus semantic relationship mapping between exports
84
+ - **Deep tier:** All Forge analysis plus:
85
+ - ast-grep structural export extraction: `ast-grep -p 'export $$$' --lang typescript` or equivalent per language to build a verified export inventory
86
+ - ast-grep type/interface mapping: `ast-grep -p 'interface $NAME' --lang typescript` or `ast-grep -p 'class $NAME($$$)' --lang python`
87
+ - If QMD available: query for temporal evolution of identified exports (deprecation signals, recent additions, refactoring patterns)
88
+ - Record semantic relationships between exports (which exports reference/depend on each other)
76
89
  3. Returns structured findings to parent:
77
90
  - Export count (files, functions, types, classes)
78
91
  - Primary export patterns (barrel exports, direct exports, re-exports)
79
92
  - Public API surface size estimate
80
93
  - Key entry points
94
+ - Analysis strategy used and coverage confidence
81
95
 
82
96
  **Per-unit export summary:**
83
97
 
@@ -180,11 +194,12 @@ stack_skill_candidates: [{list flagged candidate groupings}]
180
194
 
181
195
  ### 8. Present MENU OPTIONS
182
196
 
183
- Display: "**Select:** [C] Continue to Recommendations"
197
+ Display: "**Select:** [C] Continue to Recommendations | [D] Discover Additional Source"
184
198
 
185
199
  #### Menu Handling Logic:
186
200
 
187
201
  - IF C: Save findings to {outputFile}, update frontmatter, then load, read entire file, then execute {nextStepFile}
202
+ - IF D: Accept a new repo path/URL from the user. Run a lightweight scan (directory structure + manifest detection from step 02) and classify (unit identification from step 03) for the new source only. Merge results into the existing report — append new units to the unit list, update `project_paths[]` in frontmatter. Then redisplay this step's export mapping for the new units before returning to the menu.
188
203
  - IF Any other: help user, then [Redisplay Menu Options](#8-present-menu-options)
189
204
 
190
205
  #### EXECUTION RULES:
@@ -189,12 +189,13 @@ stack_skill_candidates: [{updated list with user decisions}]
189
189
 
190
190
  ### 8. Present MENU OPTIONS
191
191
 
192
- Display: "**Select an Option:** [A] Advanced Elicitation [P] Party Mode [C] Continue to Brief Generation"
192
+ Display: "**Select an Option:** [A] Advanced Elicitation [P] Party Mode [D] Discover Additional Source [C] Continue to Brief Generation"
193
193
 
194
194
  #### Menu Handling Logic:
195
195
 
196
196
  - IF A: Execute {advancedElicitationTask}, and when finished redisplay the menu
197
197
  - IF P: Execute {partyModeWorkflow}, and when finished redisplay the menu
198
+ - IF D: Accept a new repo path/URL from the user. Run a lightweight scan + classify (subset of steps 02-03) for the new source only. Merge new units into the existing report and update `project_paths[]` in frontmatter. Run export mapping for the new units (same logic as step 04 section 2). Generate recommendation cards for the new units and present them for confirmation. Then redisplay this menu.
198
199
  - IF C: Save recommendations to {outputFile}, update frontmatter, then load, read entire file, then execute {nextStepFile}
199
200
  - IF Any other comments or queries: help user respond then [Redisplay Menu Options](#8-present-menu-options)
200
201
 
@@ -59,7 +59,7 @@ To generate a valid skill-brief.yaml file for each confirmed unit using the sche
59
59
 
60
60
  Read {outputFile} completely to obtain:
61
61
  - `confirmed_units` from frontmatter (names of units approved in step 05)
62
- - `project_path`, `forge_tier`, `user_name`, `forge_data_folder` from frontmatter
62
+ - `project_paths`, `forge_tier`, `user_name`, `forge_data_folder` from frontmatter
63
63
  - Recommendation cards from "## Recommendations" section (proposed brief fields per unit)
64
64
  - Export map and integration data from prior sections
65
65
 
@@ -78,8 +78,8 @@ For EACH unit in `confirmed_units`, construct a skill-brief.yaml using:
78
78
  | Field | Source |
79
79
  |-------|--------|
80
80
  | name | Confirmed name from step 05 recommendation card |
81
- | version | `1.0.0` (default for new briefs) |
82
- | source_repo | `{project_path}` from frontmatter |
81
+ | version | Auto-detect from source (see schema Version Detection), fall back to `1.0.0` |
82
+ | source_repo | `{project_paths[0]}` from frontmatter (or per-unit path if multi-repo) |
83
83
  | language | Primary language detected in step 03 |
84
84
  | scope.type | Scope type from step 05 recommendation card |
85
85
  | scope.include | Include patterns from step 05 recommendation card |
@@ -6,7 +6,7 @@ lastContinued: ''
6
6
  date: ''
7
7
  user_name: ''
8
8
  project_name: ''
9
- project_path: ''
9
+ project_paths: []
10
10
  forge_tier: ''
11
11
  existing_skills: []
12
12
  confirmed_units: []
@@ -339,7 +339,7 @@ Data files in `data/` support the workflow's inline validation:
339
339
 
340
340
  | File | Style | Appropriate | Key Language | Status |
341
341
  |------|-------|-------------|--------------|--------|
342
- | step-01-init | Prescriptive | ✅ | "Check forge-tier.yaml", "HARD HALT", "Validate the path" | PASS |
342
+ | step-01-init | Prescriptive | ✅ | "Check forge-tier.yaml", "HARD HALT", "Validate the path", checks `preferences.yaml` for `tier_override` | PASS |
343
343
  | step-01b-continue | Prescriptive | ✅ | "Read frontmatter", "Map last completed step to next step" | PASS |
344
344
  | step-02-scan-project | Prescriptive | ✅ | "Map top-level directory tree", "Identify workspace configs", "Detect service boundaries" | PASS |
345
345
  | step-03-identify-units | Prescriptive | ✅ | "Count detection signals", "Classify boundary type", "Check disqualification rules" | PASS |
@@ -207,7 +207,7 @@ Decomposition engine — discover what to skill, recommend stack skill. Analyzes
207
207
  ## Tools Configuration
208
208
 
209
209
  **Core BMAD Tools:**
210
- - **Party Mode:** excludedno creative exploration phase in evidence-based analysis
210
+ - **Party Mode:** available at step-05 (recommend) included as optional [P] menu for creative exploration during collaborative unit review
211
211
  - **Advanced Elicitation:** included as optional [A] menu at Step 05 only — quality gate for challenging unit boundary decisions
212
212
  - **Brainstorming:** excluded — no ideation needed in code analysis
213
213
 
@@ -54,7 +54,7 @@ installed_path: '{project-root}/_bmad/skf/workflows/analyze-source'
54
54
 
55
55
  Load and read full config from {project-root}/_bmad/skf/config.yaml and resolve:
56
56
 
57
- - `project_name`, `output_folder`, `user_name`, `communication_language`, `document_output_language`, `forge_data_folder`, `skills_output_folder`
57
+ - `project_name`, `output_folder`, `user_name`, `communication_language`, `document_output_language`, `forge_data_folder`, `skills_output_folder`, `sidecar_path`
58
58
 
59
59
  ### 2. First Step Execution
60
60
 
@@ -50,7 +50,8 @@ Load the existing skill artifacts, provenance map, and forge tier configuration
50
50
  - Available: User-provided skill path, SKF module config variables
51
51
  - Focus: Loading and validating all inputs needed for drift analysis
52
52
  - Limits: Do not analyze or compare — only load and baseline
53
- - Dependencies: setup-forge must be completed (forge-tier.yaml exists), skill must have been created by create-skill (provenance-map.json exists)
53
+ - Dependencies: setup-forge must be completed (forge-tier.yaml exists), skill must have been created by create-skill (provenance-map.json exists for source-based skills)
54
+ - Docs-only limitation: If `metadata.json` indicates `source_type: "docs-only"` or `confidence_tier: "Quick"` with all T3 citations, inform user: "**This is a docs-only skill.** Drift detection compares against upstream documentation, not source code. Re-run `@Ferris US` to re-fetch documentation URLs and detect content changes." Audit-skill's structural diff is not applicable to docs-only skills — recommend update-skill instead.
54
55
 
55
56
  ## MANDATORY SEQUENCE
56
57
 
@@ -84,6 +85,8 @@ Load `{sidecar_path}/forge-tier.yaml` to detect available tools.
84
85
  - Extract tier level: Quick / Forge / Deep
85
86
  - Extract available tools: gh_bridge, ast_bridge, qmd_bridge
86
87
 
88
+ **Apply tier override:** Read `{sidecar_path}/preferences.yaml`. If `tier_override` is set and is a valid tier value (Quick, Forge, or Deep), use it instead of the detected tier.
89
+
87
90
  ### 3. Load Skill Artifacts
88
91
 
89
92
  Load the following from the skill directory:
@@ -93,8 +96,8 @@ Load the following from the skill directory:
93
96
  - `metadata.json` — Skill metadata (version, created date, export count)
94
97
 
95
98
  **Extract from metadata.json:**
96
- - `skill_name`, `version`, `created` date, `forge_tier` used during creation
97
- - `source_root` — Original source code path
99
+ - `name`, `version`, `generation_date`, `confidence_tier` used during creation
100
+ - `source_root` — Resolved source code path used during extraction
98
101
 
99
102
  ### 4. Load Provenance Map
100
103
 
@@ -137,7 +140,7 @@ Create `{outputFile}` from `{templateFile}`:
137
140
  | Field | Value |
138
141
  |-------|-------|
139
142
  | **Skill** | {skill_name} v{version} |
140
- | **Created** | {created_date} |
143
+ | **Created** | {generation_date} |
141
144
  | **Source** | {source_path} |
142
145
  | **Forge Tier** | {current_tier} (created at {original_tier}) |
143
146
  | **Provenance Age** | {days} days since last extraction |
@@ -176,7 +179,7 @@ ONLY WHEN C is selected and the drift report has been created with baseline data
176
179
  ### ✅ SUCCESS:
177
180
 
178
181
  - Skill artifacts loaded (SKILL.md, metadata.json)
179
- - Forge tier detected from sidecar
182
+ - Forge tier detected from sidecar (and override applied if set in preferences.yaml)
180
183
  - Provenance map loaded (or degraded mode confirmed)
181
184
  - Source path resolved and validated
182
185
  - Drift report created from template with populated frontmatter
@@ -97,7 +97,7 @@ Identify all source files in the source directory that contain public exports.
97
97
  ```
98
98
  {
99
99
  "extraction_date": "{timestamp}",
100
- "forge_tier": "{tier}",
100
+ "confidence_tier": "{tier}",
101
101
  "source_root": "{source_path}",
102
102
  "files_scanned": {count},
103
103
  "exports": [
@@ -117,13 +117,23 @@ Identify all source files in the source directory that contain public exports.
117
117
 
118
118
  **IF forge tier is Deep:**
119
119
 
120
- Query qmd_bridge for temporal context on each extracted export:
120
+ Read the `qmd_collections` registry from `{sidecar_path}/forge-tier.yaml`.
121
+
122
+ Find the collection entry matching the current skill: look for an entry where `skill_name` matches the current skill being audited AND `type` is `"extraction"`.
123
+
124
+ **If a matching extraction collection is found:**
125
+ Query qmd_bridge against the `{skill_name}-extraction` collection for temporal context on each extracted export:
121
126
  - When was this export first added?
122
127
  - Has it been modified recently?
123
128
  - What is its usage frequency across the codebase?
129
+ - How does the current extraction compare to the previously compiled skill content?
124
130
 
125
131
  Append temporal metadata to each export in the snapshot.
126
132
 
133
+ **If no matching collection found in registry:**
134
+ Log: "No QMD extraction collection found for {skill_name}. Temporal enrichment skipped. Re-run [CS] Create Skill to generate the collection."
135
+ Continue without T2 enrichment — this is not an error.
136
+
127
137
  **IF forge tier is Quick or Forge:**
128
138
  Skip this section. Temporal context requires Deep tier.
129
139