bmad-module-skill-forge 0.7.0 → 0.7.2

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 (50) hide show
  1. package/docs/how-it-works.md +2 -0
  2. package/package.json +1 -1
  3. package/src/knowledge/ccc-bridge.md +2 -1
  4. package/src/knowledge/overview.md +1 -0
  5. package/src/knowledge/progressive-capability.md +2 -0
  6. package/src/knowledge/qmd-registry.md +6 -1
  7. package/src/knowledge/skf-knowledge-index.csv +1 -0
  8. package/src/knowledge/tool-resolution.md +55 -0
  9. package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +2 -2
  10. package/src/workflows/audit-skill/steps-c/step-01-init.md +1 -1
  11. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +3 -1
  12. package/src/workflows/audit-skill/steps-c/step-03-structural-diff.md +2 -2
  13. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +1 -1
  14. package/src/workflows/audit-skill/steps-c/step-05-severity-classify.md +1 -1
  15. package/src/workflows/brief-skill/data/skill-brief-schema.md +15 -0
  16. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +16 -0
  17. package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +34 -6
  18. package/src/workflows/brief-skill/steps-c/step-03-scope-definition.md +14 -0
  19. package/src/workflows/brief-skill/steps-c/step-04-confirm-brief.md +20 -0
  20. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +34 -9
  21. package/src/workflows/brief-skill/workflow.md +1 -1
  22. package/src/workflows/create-skill/data/extraction-patterns.md +16 -3
  23. package/src/workflows/create-skill/data/source-resolution-protocols.md +16 -2
  24. package/src/workflows/create-skill/data/tier-degradation-rules.md +1 -1
  25. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +5 -5
  26. package/src/workflows/create-skill/steps-c/step-02b-ccc-discover.md +5 -1
  27. package/src/workflows/create-skill/steps-c/step-03-extract.md +5 -1
  28. package/src/workflows/create-skill/steps-c/step-03b-fetch-temporal.md +16 -1
  29. package/src/workflows/create-skill/steps-c/step-03c-fetch-docs.md +9 -3
  30. package/src/workflows/create-skill/steps-c/step-04-enrich.md +2 -0
  31. package/src/workflows/create-skill/steps-c/step-05-compile.md +6 -1
  32. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +1 -1
  33. package/src/workflows/create-stack-skill/data/manifest-patterns.md +23 -1
  34. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +2 -0
  35. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +2 -1
  36. package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +3 -1
  37. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +26 -7
  38. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +5 -1
  39. package/src/workflows/quick-skill/steps-c/step-04-compile.md +1 -1
  40. package/src/workflows/setup-forge/steps-c/step-01b-ccc-index.md +4 -2
  41. package/src/workflows/test-skill/data/output-section-formats.md +15 -0
  42. package/src/workflows/test-skill/data/scoring-rules.md +12 -0
  43. package/src/workflows/test-skill/steps-c/step-03-coverage-check.md +39 -5
  44. package/src/workflows/test-skill/steps-c/step-04-coherence-check.md +48 -4
  45. package/src/workflows/test-skill/steps-c/step-04b-external-validators.md +9 -1
  46. package/src/workflows/test-skill/steps-c/step-05-score.md +2 -0
  47. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +1 -1
  48. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +3 -1
  49. package/src/workflows/update-skill/steps-c/step-05-validate.md +1 -1
  50. package/tools/cli/lib/installer.js +4 -0
@@ -111,16 +111,16 @@ Halt with specific error: "Brief validation failed: missing required field `{fie
111
111
 
112
112
  ### 4. Resolve Source Code Location
113
113
 
114
- **If `source_type: "docs-only"`:** Skip source resolution. Set `source_location: null` in context. Proceed directly to section 5 (Report Initialization) — docs-only skills have no source to resolve.
114
+ **If `source_type: "docs-only"`:** Skip source resolution. Set `source_root: null` in context. Proceed directly to section 5 (Report Initialization) — docs-only skills have no source to resolve.
115
115
 
116
116
  **If source_repo is a GitHub URL or owner/repo format:**
117
- - Verify repository exists via `gh_bridge.list_tree(owner, repo, branch)`
117
+ - Verify repository exists via `gh_bridge.list_tree(owner, repo, branch)` — **Tool resolution:** `gh api repos/{owner}/{repo}/git/trees/{branch}?recursive=1` or direct file listing if local; see [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
118
118
  - If branch not specified, detect default branch
119
- - Store resolved: owner, repo, branch, file tree
119
+ - Store resolved: owner, repo, branch, file tree — note: `source_root` for remote repos is set to the ephemeral clone path during extraction (step-03)
120
120
 
121
121
  **If source_repo is a local path:**
122
122
  - Verify path exists and contains source files
123
- - Store resolved: local path, file listing
123
+ - Store resolved: local path as `source_root`, file listing
124
124
 
125
125
  **If source cannot be resolved:**
126
126
  Halt with: "Source not found: `{source_repo}`. Verify the repository exists and is accessible."
@@ -170,7 +170,7 @@ ONLY WHEN forge-tier.yaml is loaded, skill-brief.yaml is validated, and source c
170
170
 
171
171
  - Forge tier loaded from sidecar with tool availability
172
172
  - Skill brief loaded and all required fields validated
173
- - Source code location resolved and accessible (or `source_location: null` confirmed for docs-only skills)
173
+ - Source code location resolved and accessible (or `source_root: null` confirmed for docs-only skills)
174
174
  - Initialization summary displayed with tier and capabilities
175
175
  - Auto-proceeded to step-02
176
176
 
@@ -71,10 +71,12 @@ If `tools.ccc` is true, continue to section 2.
71
71
 
72
72
  Read `ccc_index` from forge-tier.yaml:
73
73
 
74
- - If `ccc_index.status` is `"fresh"`: continue to section 3.
74
+ - If `ccc_index.status` is `"fresh"` or `"created"`: continue to section 3.
75
75
  - If `ccc_index.status` is `"stale"`: display brief note — "CCC index is stale — discovery results may miss recent changes." Continue to section 3.
76
76
  - If `ccc_index.status` is `"none"` or `"failed"`: attempt lazy indexing via `ccc_bridge.ensure_index(source_root)`. If indexing succeeds, continue to section 3. If indexing fails, set `{ccc_discovery: []}` and auto-proceed to section 5.
77
77
 
78
+ **Tool resolution for ccc_bridge.ensure_index:** Use `/ccc` skill indexing (Claude Code), ccc MCP server (Cursor), or `ccc init` + `ccc index {source_root}` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
79
+
78
80
  ### 3. Construct Semantic Query
79
81
 
80
82
  Build the discovery query from the brief data:
@@ -91,6 +93,8 @@ Where:
91
93
 
92
94
  Run `ccc_bridge.search(query, source_root, top_k=20)`:
93
95
 
96
+ **Tool resolution for ccc_bridge.search:** Use `/ccc` skill search (Claude Code), ccc MCP server (Cursor), or `ccc search "{query}" --path {source_root} --top 20` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
97
+
94
98
  **If search succeeds:**
95
99
 
96
100
  Store results as `{ccc_discovery: [{file, score, snippet}]}` in context.
@@ -46,7 +46,7 @@ To extract all public exports, function signatures, type definitions, and co-imp
46
46
 
47
47
  ## CONTEXT BOUNDARIES:
48
48
 
49
- - Available: brief_data, tier, source_location, file_tree from step-01; ecosystem check outcome from step-02 (proceed/halt decision — no named variable stored)
49
+ - Available: brief_data, tier, source_root, file_tree from step-01; ecosystem check outcome from step-02 (proceed/halt decision — no named variable stored)
50
50
  - Focus: Source code extraction and inventory building
51
51
  - Limits: Do NOT compile, assemble, or write any output
52
52
  - Dependencies: Source code must be accessible (resolved in step-01)
@@ -92,6 +92,8 @@ Load `{sourceResolutionData}` completely. Follow the **Remote Source Resolution*
92
92
  5. Infer types from JSDoc, docstrings, type annotations
93
93
  6. Confidence: All results T1-low — `[SRC:{file}:L{line}]`
94
94
 
95
+ **Tool resolution for gh_bridge:** Use `gh api repos/{owner}/{repo}/git/trees/{branch}?recursive=1` for list_tree, `gh api repos/{owner}/{repo}/contents/{path}` for read_file. If source is local, use direct file listing/reading instead. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
96
+
95
97
  **Forge/Forge+/Deep Tier (AST available):**
96
98
 
97
99
  **CCC Discovery Integration (Forge+ and Deep with ccc only):**
@@ -115,6 +117,8 @@ If `{ccc_discovery}` is empty or not in context: proceed with existing file orde
115
117
  5. Build extraction rules YAML data for reproducibility
116
118
  6. Confidence: All results T1 — `[AST:{file}:L{line}]`
117
119
 
120
+ **Tool resolution for ast_bridge:** Use ast-grep MCP tools (`mcp__ast-grep__find_code`, `mcp__ast-grep__find_code_by_rule`) as specified in the AST Extraction Protocol above, or `ast-grep` CLI. For `detect_co_imports`, use `find_code_by_rule` with a co-import YAML rule scoped to the libraries list. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
121
+
118
122
  **If AST tool is unavailable at Forge/Deep tier** (see `{tierDegradationRulesData}` for full rules):
119
123
 
120
124
  ⚠️ **Warn the user explicitly:** "AST tools are unavailable — extraction will use source reading (T1-low). Run [SF] Setup Forge to detect and configure AST tools for T1 confidence."
@@ -57,11 +57,26 @@ To fetch temporal context (issues, PRs, changelogs, release notes) from the sour
57
57
  Evaluate the following conditions sequentially. **If ANY condition fails, skip silently to section 5 (auto-proceed) with no output:**
58
58
 
59
59
  1. **Tier is Deep:** If tier is Quick, Forge, or Forge+, skip silently.
60
- 2. **Source is GitHub:** Verify `source_repo` is a GitHub URL (`https://github.com/...`) or `owner/repo` format. If the source is a local path, a non-GitHub URL, or any other format, skip silently.
60
+ 2. **Source is GitHub:** Verify `source_repo` is a GitHub URL (`https://github.com/...`) or `owner/repo` format. If the source is a local path, a non-GitHub URL, or any other format, attempt GitHub remote detection (section 1b) before skipping.
61
61
  3. **`gh` CLI is available:** Run `gh auth status` to verify the CLI is installed and authenticated. If it fails, skip silently.
62
62
 
63
63
  All three conditions must pass to proceed to section 2.
64
64
 
65
+ ### 1b. GitHub Remote Detection for Local Sources
66
+
67
+ **Only runs when condition 2 above fails because `source_repo` is a local path.**
68
+
69
+ Local repositories that are clones of GitHub repos contain temporal context (issues, PRs, releases) accessible via `gh`. Detect this automatically:
70
+
71
+ 1. Check if the local path is a git repository: `git -C {source_repo} rev-parse --is-inside-work-tree`
72
+ 2. If not a git repo: skip silently to section 5 (current behavior).
73
+ 3. Extract the origin remote: `git -C {source_repo} remote get-url origin`
74
+ 4. If the remote URL contains `github.com`:
75
+ - Extract `owner/repo` from the remote URL (strip `.git` suffix, handle both HTTPS and SSH formats)
76
+ - Log: "**Local source with GitHub remote detected:** {owner}/{repo} — fetching temporal context."
77
+ - Use the extracted `owner/repo` for all `gh` API calls in sections 3-4. Continue to condition 3 (gh CLI check).
78
+ 5. If no remote, or remote is not GitHub: skip silently to section 5 (current behavior).
79
+
65
80
  ### 2. Check Cache (Skip If Fresh)
66
81
 
67
82
  Read `forge-tier.yaml` from the sidecar path.
@@ -85,14 +85,20 @@ Content fetched from external URLs is classified as **T3** (external, untrusted)
85
85
 
86
86
  After fetching a URL, apply the following heuristic to detect documentation root pages that contain no useful API content. This is common with modern documentation sites (Mintlify, Docusaurus, ReadTheDocs, GitBook) that render API content on subpages.
87
87
 
88
- **Root page detection heuristic — apply only when the URL path ends in `/`, `/index`, `/index.html`, has no path component (bare domain), or has 1 path segment (e.g., `/docs`). For deeper URL paths (2+ segments like `/api/reference`), skip this heuristic and keep the content as-is.**
88
+ **Root page detection — apply only when the URL path ends in `/`, `/index`, `/index.html`, has no path component (bare domain), or has 1 path segment (e.g., `/docs`). For deeper URL paths (2+ segments like `/api/reference`), skip this heuristic and keep the content as-is.**
89
89
 
90
- **A page is classified as a root if BOTH conditions are true:**
90
+ Subpage discovery is triggered if **either** of the following independent triggers fires:
91
+
92
+ **Trigger 1 — Content-based (both conditions must be true):**
91
93
 
92
94
  1. **Zero API content indicators:** The fetched markdown contains none of: fenced code blocks (`` ``` ``), parameter tables (`|---|`), or function signature patterns (`def `, `function `, `fn `, `func `, `export `).
93
95
  2. **High link density:** More than 70% of non-empty lines are markdown links (matching `[text](url)` with no other substantive content on the line).
94
96
 
95
- If only one condition is true, treat the page as having partial content keep it as-is and do NOT trigger subpage discovery.
97
+ **Trigger 2URL-based (independent of content analysis):**
98
+
99
+ The URL matches the path criteria above (ends in `/`, bare domain, or 1 segment) AND the fetched content is under **2000 words**. Short content on root-like URLs almost certainly indicates a navigation hub or landing page, even if it contains introductory code examples that would prevent Trigger 1 from firing. This handles modern doc sites (Mintlify, Docusaurus, GitBook) that include hero sections with code snippets on their root pages.
100
+
101
+ If neither trigger fires, keep the page content as-is and do NOT trigger subpage discovery.
96
102
 
97
103
  **If a root URL with minimal content is detected:**
98
104
 
@@ -96,6 +96,8 @@ For each function, derive the **module context** from the extraction inventory's
96
96
 
97
97
  4. **Semantic migration context:** `qmd_bridge.vector_search("{module_context} {function_name} migration deprecated")` — adds semantic matches (synonyms, paraphrases) that BM25 keyword search may miss. Merge results with search #3, deduplicating by document ID. If `vector_search` fails (VRAM, GPU driver, model loading), discard silently — the BM25 results from search #3 provide baseline coverage.
98
98
 
99
+ **Tool resolution for qmd_bridge:** Use QMD MCP tools — `mcp__plugin_qmd-plugin_qmd__search` for BM25 search, `mcp__plugin_qmd-plugin_qmd__vector_search` for semantic search (Claude Code). Cursor: qmd MCP server. CLI: `qmd search "{query}"` / `qmd vector_search "{query}"`. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
100
+
99
101
  **For each QMD result:**
100
102
 
101
103
  - Create a T2 annotation: `[QMD:{collection}:{doc}]`
@@ -100,7 +100,12 @@ Following the structure from the skill-sections data file:
100
100
  - Set `description` from the SKILL.md frontmatter `description` field (already assembled in section 2)
101
101
  - Set `language` from source analysis (e.g., `"typescript"`, `"python"`) — use the primary language of the entry point file
102
102
  - Set `ast_node_count` from extraction stats if ast-grep was used (Forge/Deep tier), otherwise omit
103
- - Set `tool_versions` based on tier and available tools. Resolve `{skf_version}` from the installed module's `package.json` at `{project-root}/_bmad/skf/package.json`. If unresolvable there, fall back to `node -p "require('./node_modules/bmad-module-skill-forge/package.json').version"`. If still unresolvable, use `"unknown"` and add a warning to the evidence report. Never hardcode the version.
103
+ - Set `tool_versions` based on tier and available tools. Resolve `{skf_version}` using this resolution chain (try each in order, use the first that succeeds):
104
+ 1. `{project-root}/_bmad/skf/package.json` → read `.version` field
105
+ 2. `node -p "require('./node_modules/bmad-module-skill-forge/package.json').version"`
106
+ 3. `{project-root}/_bmad/skf/VERSION` → read plain text file (single line containing version string, written by the SKF installer)
107
+ 4. `"unknown"` (final fallback — add a warning to the evidence report)
108
+ Never hardcode the version.
104
109
  - Store `commit_short` = first 8 characters of `source_commit` (or `"unknown"` if unavailable) for use in step-08 report.
105
110
  - If `scripts_inventory` is non-empty, populate `scripts[]` array and set `stats.scripts_count`. If `assets_inventory` is non-empty, populate `assets[]` array and set `stats.assets_count`. Omit these fields entirely when inventories are empty.
106
111
 
@@ -43,7 +43,7 @@ To write all compiled content to disk — 4 deliverable files to `{skills_output
43
43
 
44
44
  ## CONTEXT BOUNDARIES:
45
45
 
46
- - Available: All compiled content from step-05, validation results from step-06
46
+ - Available: All compiled content from step-05, validation results from step-06, source_root from step-01 (needed for section 5b CCC registration)
47
47
  - Focus: File system operations — create directories, write files
48
48
  - Limits: Do NOT modify content during writing
49
49
  - Dependencies: All content must be compiled and validated in context
@@ -20,6 +20,28 @@
20
20
  3. Normalize names across ecosystems (e.g., `@scope/package` → `package`)
21
21
  4. Deduplicate across multiple manifests
22
22
 
23
+ ## Scan Exclusion Patterns
24
+
25
+ When scanning for manifest files, ALWAYS exclude these directories from glob results:
26
+
27
+ **Dependency/Vendor Directories:**
28
+ - `node_modules/`
29
+ - `.venv/` / `venv/` / `.env/`
30
+ - `vendor/` (PHP Composer, Go modules)
31
+ - `Pods/` (iOS CocoaPods)
32
+
33
+ **Build Output Directories:**
34
+ - `dist/` / `build/` / `out/`
35
+ - `target/` (Rust, Java/Maven)
36
+ - `__pycache__/`
37
+ - `.next/` / `.nuxt/` / `.output/`
38
+
39
+ **Hidden and VCS Directories:**
40
+ - `.git/`
41
+ - Any directory starting with `.` (except project root hidden config files like `.csproj`)
42
+
43
+ **Monorepo Note:** For monorepo structures (e.g., `packages/*/package.json`), the depth 0-1 scan rule already limits scope. If monorepo manifest detection is needed at deeper levels, these exclusions become critical to prevent scanning dependency trees within each package.
44
+
23
45
  ## Filtering Rules
24
46
 
25
47
  - Exclude dev-only dependencies unless they appear in production imports
@@ -32,4 +54,4 @@
32
54
  For each dependency, count distinct files that import it:
33
55
  - Use grep patterns from Import Pattern column
34
56
  - Count unique file paths, not total import statements
35
- - Exclude test files, config files, and build artifacts from count
57
+ - Exclude test files (`*/test/*`, `*_test.*`, `*.spec.*`, `*.test.*`), config files (`*.config.*`, `.eslintrc`, etc.), and build artifacts (`dist/`, `build/`, `node_modules/`, `target/`, `__pycache__/`) from count
@@ -84,6 +84,8 @@ Extract:
84
84
  - **Forge+:** ast_bridge + ccc_bridge (ccc semantic co-import augmentation) — ccc available for step-05
85
85
  - **Deep:** qmd_bridge (QMD temporal enrichment) — required for Deep tier
86
86
 
87
+ See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md) for how each bridge name resolves to concrete tools per IDE environment.
88
+
87
89
  Report tool availability. If a tier-required tool is missing, downgrade tier and note:
88
90
 
89
91
  "**Tier adjusted:** {original_tier} → {adjusted_tier} — {missing_tool} unavailable."
@@ -99,10 +99,11 @@ Store the explicit list as `raw_dependencies` and skip to [Display Detection Sum
99
99
 
100
100
  Load `{manifestPatterns}` for supported ecosystem detection patterns.
101
101
 
102
- Scan the project root (depth 0-1) for manifest files:
102
+ Scan the project root (depth 0-1) for manifest files, **excluding directories listed in the Scan Exclusion Patterns section of `{manifestPatterns}`**:
103
103
 
104
104
  - Search for each supported manifest filename
105
105
  - Record: file path, ecosystem type, file size
106
+ - **Apply exclusion patterns** from `{manifestPatterns}` — skip `node_modules/`, `.venv/`, `vendor/`, `dist/`, `build/`, `target/`, `.git/`, and all hidden directories when globbing
106
107
  - Note any unusual structures (monorepo with multiple manifests, workspace configurations)
107
108
 
108
109
  **If no manifest files found:**
@@ -30,7 +30,7 @@ Count import frequency for each dependency across the codebase, rank by usage, a
30
30
  - 🎯 Focus on counting imports, ranking, and getting user confirmation
31
31
  - 🚫 FORBIDDEN to extract library documentation — that is step 04
32
32
  - 💬 Present data clearly so user can make informed scope decisions
33
- - 🎯 Use subprocess (Pattern 1 grep) for import counting when available
33
+ - 🎯 Use subprocess (Pattern 1 grep/search): In Claude Code, use the Grep tool or Bash with `rg`. In Cursor, use built-in search. In CLI, use `grep`/`rg` directly. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
34
34
 
35
35
  ## EXECUTION PROTOCOLS:
36
36
 
@@ -80,6 +80,8 @@ For each dependency in `raw_dependencies`:
80
80
 
81
81
  **Launch a subprocess** that runs grep across all source files in the project to count import statements for each library. Return only the counts, not file contents.
82
82
 
83
+ **Subprocess resolution:** Use the Grep tool (Claude Code), built-in search (Cursor), or `grep`/`rg` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
84
+
83
85
  Use ecosystem-appropriate import patterns:
84
86
  - JavaScript/TypeScript: `import .* from ['"]library`, `require\(['"]library`
85
87
  - Python: `import library`, `from library import`
@@ -27,7 +27,7 @@ For each confirmed dependency, extract key exports, usage patterns, and API surf
27
27
 
28
28
  ### Step-Specific Rules:
29
29
 
30
- - 🎯 Extract per-library using Pattern 4 (parallel subprocess) when available
30
+ - 🎯 Extract per-library using Pattern 4 (parallel): In Claude Code, use multiple parallel Agent tool calls or `run_in_background: true`. In Cursor, use parallel requests (IDE-dependent). In CLI, use `xargs -P` or background processes. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
31
31
  - 💬 Each subprocess returns structured extraction, not raw file contents
32
32
  - 🚫 FORBIDDEN to analyze cross-library integrations — that is step 05
33
33
  - ⚙️ If parallel subprocess unavailable, extract libraries sequentially in main thread
@@ -105,14 +105,25 @@ For each library in `confirmed_dependencies`, determine extraction strategy base
105
105
  - Confidence: T1 (AST-verified structural extraction)
106
106
 
107
107
  **Deep Tier (adds to Forge):**
108
- - Use qmd_bridge for temporal usage evolution
109
- - Identify deprecated patterns and migration paths
110
- - Track API changes across project history
111
- - Confidence: T2 (QMD-enriched temporal context)
108
+ - Perform all Forge tier extractions (T1)
109
+ - Additionally: query existing QMD temporal collections for each library
110
+ - Read the `qmd_collections` registry from `{sidecar_path}/forge-tier.yaml`
111
+ - For each library in `confirmed_dependencies`, search for a registry entry where `skill_name` matches the library name AND `type` is `"temporal"`
112
+ - **If a matching temporal collection exists:**
113
+ - Query `qmd_bridge.search("{library_name} deprecated OR removed OR breaking change")` for deprecation context
114
+ - Query `qmd_bridge.search("{library_name} migration OR upgrade")` for migration patterns
115
+ - Query `qmd_bridge.search("{library_name} version issue OR bug OR workaround")` for version-specific warnings
116
+ - **Tool resolution for qmd_bridge:** Use QMD MCP tools — `mcp__plugin_qmd-plugin_qmd__search` (Claude Code), qmd MCP server (Cursor), `qmd search "{query}"` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
117
+ - Classify each result as T2-past (historical) or T2-future (planned changes) per confidence-tiers.md
118
+ - Append temporal findings to the library's extraction as T2 annotations with `[QMD:{collection}:{doc}]` citations
119
+ - **If no matching temporal collection found:**
120
+ - Log: "No temporal collection for {library_name}. T2 enrichment skipped."
121
+ - Continue with T1/T1-low extraction only
122
+ - Confidence: T1 for structural (AST), T2 for temporal annotations (QMD-enriched)
112
123
 
113
124
  ### 2. Launch Parallel Extraction
114
125
 
115
- **Launch subprocesses in parallel** (max_parallel_generation) — one per confirmed library:
126
+ **Launch subprocesses in parallel** (max_parallel_generation: 3–5 concurrent Agent tool calls in Claude Code, IDE-dependent in Cursor, CPU core count in CLI) — one per confirmed library:
116
127
 
117
128
  Each subprocess:
118
129
  1. Reads all files importing the library (from step 03 file lists)
@@ -129,7 +140,13 @@ Each subprocess:
129
140
  usage_patterns: ["pattern description with file:line"],
130
141
  confidence: "T1|T1-low|T2",
131
142
  files_analyzed: count,
132
- warnings: []
143
+ warnings: [],
144
+ temporal: {
145
+ deprecated_exports: ["export_name — reason [QMD:collection:doc]"],
146
+ migration_notes: ["note [QMD:collection:doc]"],
147
+ version_warnings: ["warning [QMD:collection:doc]"],
148
+ t2_annotation_count: count
149
+ }
133
150
  }
134
151
  ```
135
152
 
@@ -161,6 +178,8 @@ For each library extraction:
161
178
 
162
179
  **Results:** {success_count}/{total_count} libraries extracted
163
180
  **Confidence distribution:** T1: {count}, T1-low: {count}, T2: {count}
181
+ {If Deep tier:} **T2 enrichment:** {enriched_count}/{total_count} libraries had temporal collections available
182
+ {If libraries without temporal > 0:} **Tip:** Run [CS] Create Skill at Deep tier for individual libraries to generate temporal collections, then re-run [SS] for full T2 enrichment.
164
183
  {If warnings:} **Warnings:** {warning_count} issues noted
165
184
 
166
185
  **Proceeding to integration detection...**"
@@ -29,7 +29,7 @@ Analyze co-import patterns between confirmed libraries to identify integration p
29
29
 
30
30
  ### Step-Specific Rules:
31
31
 
32
- - 🎯 Focus on detecting cross-library patterns using Pattern 1 (grep) subprocess
32
+ - 🎯 Focus on detecting cross-library patterns using Pattern 1 (grep/search): In Claude Code, use the Grep tool or Bash with `rg`. In Cursor, use built-in search. In CLI, use `grep`/`rg` directly. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
33
33
  - 🚫 FORBIDDEN to compile SKILL.md — that is step 06
34
34
  - 💬 Integration detection is the core differentiator of stack skills vs individual skills
35
35
  - ⚙️ If subprocess unavailable, perform grep operations in main thread
@@ -93,6 +93,8 @@ For each library pair (A, B):
93
93
 
94
94
  **Launch a subprocess** that greps across all source files to find files importing BOTH library A and library B. Return only file paths and import line numbers.
95
95
 
96
+ **Subprocess resolution:** Use the Grep tool (Claude Code), built-in search (Cursor), or `grep`/`rg` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
97
+
96
98
  **Subprocess returns:** `{pair: [A, B], co_import_files: [{path, line_A, line_B}], count: N}`
97
99
 
98
100
  **If subprocess unavailable:** Intersect the file lists from step 03 import counts for each pair.
@@ -105,6 +107,8 @@ If `tools.ccc` is true AND `ccc_index.status` is `"fresh"` or `"stale"` in forge
105
107
 
106
108
  For each library pair that has exactly 1 co-import file (below the 2-file threshold), run `ccc_bridge.search("{libA} {libB}", source_root, top_k=10)` to find files where the two libraries interact semantically — even without explicit import co-location. If CCC returns additional files where both libraries appear, add them to the pair's co-import candidate list and re-evaluate against the 2-file threshold.
107
109
 
110
+ **Tool resolution for ccc_bridge.search:** Use `/ccc` skill search (Claude Code), ccc MCP server (Cursor), or `ccc search "{libA} {libB}" --path {source_root} --top 10` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
111
+
108
112
  For pairs that already qualify (2+ files), CCC is not needed for detection — but the CCC results may surface additional integration files for richer classification in section 3.
109
113
 
110
114
  CCC failures: skip augmentation silently, proceed with grep-only results.
@@ -145,7 +145,7 @@ Generate metadata.json following the exact structure defined in {skillTemplateDa
145
145
  "tool_versions": {
146
146
  "ast_grep": null,
147
147
  "qmd": null,
148
- "skf": "{skf_version}"
148
+ "skf": "{skf_version}" // Resolution chain: _bmad/skf/package.json → npm require → _bmad/skf/VERSION → "unknown"
149
149
  },
150
150
  "stats": {
151
151
  "exports_documented": "{number of exports found}",
@@ -86,9 +86,9 @@ The `ccc index` command auto-starts the daemon when needed. Proceed with indexin
86
86
 
87
87
  Attempt indexing anyway — errors will be caught below.
88
88
 
89
- Run:
89
+ Run (CWD must be `{project-root}`):
90
90
  ```bash
91
- ccc init {project-root}
91
+ ccc init
92
92
  ```
93
93
 
94
94
  **If init fails** (project may already be initialized): continue — this is not an error.
@@ -98,6 +98,8 @@ Then run:
98
98
  ccc index
99
99
  ```
100
100
 
101
+ **Note:** `ccc index` can take several minutes on large codebases (1000+ files). Run with an extended timeout or in background mode. Use `ccc status` to verify completion — check that `Chunks` and `Files` counts are non-zero.
102
+
101
103
  **If succeeds:**
102
104
  - Run `ccc status` to get file count
103
105
  - Store `{ccc_index_result: "created", ccc_indexed_path: {project-root}, ccc_last_indexed: {current ISO timestamp}, ccc_file_count: {count from status}}`
@@ -17,6 +17,21 @@
17
17
  **Structural Issues:** {count}
18
18
  ```
19
19
 
20
+ ## Coherence Analysis — Naive Mode: Reference Consistency (split-body)
21
+
22
+ Only rendered when `references/` directory exists alongside SKILL.md.
23
+
24
+ ```markdown
25
+ ### Reference Consistency (split-body)
26
+
27
+ | # | Reference File | Export | Issue | SKILL.md Line | Reference Line |
28
+ |---|---------------|--------|-------|---------------|---------------|
29
+ | {per-mismatch rows} |
30
+
31
+ **Exports Cross-Checked:** {count}
32
+ **Mismatches Found:** {count}
33
+ ```
34
+
20
35
  ## Coherence Analysis — Contextual Mode
21
36
 
22
37
  ```markdown
@@ -42,6 +42,18 @@ tessl evaluates SKILL.md body content only — it does not read `references/*.md
42
42
  - Score based on: structural completeness only
43
43
  - Weight redistribution: skipped categories' weights (Signature Accuracy 22% + Type Coverage 14%) redistributed proportionally to remaining active categories
44
44
 
45
+ ### Docs-Only Mode (Quick tier, all [EXT:...] citations)
46
+
47
+ When `docs_only_mode: true` is set by step-03 (indicating a Quick tier skill where all SKILL.md citations are `[EXT:...]` format with no local source code):
48
+
49
+ - **Signature Accuracy:** Not scored (no source to compare against)
50
+ - **Type Coverage:** Not scored (no source to compare against)
51
+ - **Weight redistribution:** Same as Quick tier — Signature Accuracy (22%) and Type Coverage (14%) weights redistributed proportionally to remaining active categories
52
+ - **Export Coverage basis:** Documentation completeness rather than source coverage. Score = (documented_items_with_complete_descriptions / total_documented_items) * 100. A "complete" item has: description, parameters (if function/method), and return type (if function/method).
53
+ - **Coherence:** Standard rules for the detected mode (naive or contextual) apply unchanged
54
+
55
+ This is functionally identical to Quick tier weight redistribution but with a different coverage denominator (self-consistency instead of source comparison).
56
+
45
57
  ### Forge Tier (ast-grep)
46
58
  - Export Coverage: AST-backed export comparison
47
59
  - Signature Accuracy: AST-verified signature matching
@@ -87,6 +87,38 @@ Build the **documented inventory** — a list of everything the SKILL.md claims
87
87
 
88
88
  **Split-body traversal:** If a `references/` directory exists alongside SKILL.md and SKILL.md's `## Full` headings are absent or stubs (not a stack skill's structural references), extend the documented inventory scan to include all `references/*.md` files. After split-body, Tier 2 content (Full API Reference, Full Type Definitions) lives in reference files — the inventory must reflect the full skill content regardless of where it resides.
89
89
 
90
+ ### 1b. Cross-Check Split-Body Consistency
91
+
92
+ **Only execute if a `references/` directory exists alongside SKILL.md** (detected during split-body traversal in Section 1). Skip silently otherwise.
93
+
94
+ For each function, class, type, or interface that appears in BOTH the SKILL.md body AND any `references/*.md` file, compare the documented signatures:
95
+
96
+ - **Parameters:** name, type, order, optionality
97
+ - **Return types:** exact type match
98
+ - **Description:** no contradictions (brief vs detailed is acceptable; conflicting semantics is not)
99
+
100
+ **SKILL.md body is authoritative.** When a mismatch is found, the reference file is the one that needs updating.
101
+
102
+ Build a split-body consistency findings list:
103
+
104
+ ```json
105
+ {
106
+ "cross_check_mismatches": [
107
+ {
108
+ "export": "formatDate",
109
+ "skill_md_line": 42,
110
+ "reference_file": "references/api-reference.md",
111
+ "reference_line": 18,
112
+ "issue": "SKILL.md shows (date: Date) => string, reference shows (date: Date, format?: string) => string"
113
+ }
114
+ ],
115
+ "exports_cross_checked": 12,
116
+ "mismatches_found": 1
117
+ }
118
+ ```
119
+
120
+ Flag each mismatch as **High severity** — signature inconsistency between SKILL.md body and reference files undermines agent trust. These findings feed into the gap report (step-06).
121
+
90
122
  ### 2. Analyze Source Code (Tier-Dependent)
91
123
 
92
124
  Start from the package entry point (see 0b) and identify the public API surface. Then analyze those exports at the appropriate tier depth.
@@ -181,11 +213,13 @@ Append the **Coverage Analysis** section to `{outputFile}`:
181
213
 
182
214
  ### Category Scores
183
215
 
184
- | Category | Score | Weight | Weighted |
185
- |----------|-------|--------|----------|
186
- | Export Coverage | {N}% | {weight}% | {weighted}% |
187
- | Signature Accuracy | {N}% | {weight}% | {weighted}% |
188
- | Type Coverage | {N}% | {weight}% | {weighted}% |
216
+ | Category | Score |
217
+ |----------|-------|
218
+ | Export Coverage | {N}% |
219
+ | Signature Accuracy | {N}% or N/A |
220
+ | Type Coverage | {N}% or N/A |
221
+
222
+ Note: Weight application is deferred to step-05 where all category weights are calculated after external validation availability is known.
189
223
  ```
190
224
 
191
225
  ### 6. Report Coverage Results
@@ -91,7 +91,27 @@ Build a simple structural findings list:
91
91
  }
92
92
  ```
93
93
 
94
- **After naive coherence → Skip to Section 6 (Append Results)**
94
+ **After naive coherence → Execute Section 2b if gate conditions met, then skip to Section 6 (Append Results)**
95
+
96
+ ### 2b. Migration/Deprecation Verification (Mode-Independent)
97
+
98
+ **Gate check:** Execute this section ONLY IF both conditions are met:
99
+ 1. Forge tier is **Deep** (tool-gated)
100
+ 2. `{forge_data_folder}/{skill_name}/evidence-report.md` exists (data-gated)
101
+
102
+ If either condition fails, skip silently and proceed to Section 6.
103
+
104
+ **This check runs regardless of naive/contextual mode.** T2-future annotations are a property of the source code and enrichment data, not the skill type.
105
+
106
+ Check whether SKILL.md contains a "Migration & Deprecation Warnings" section (Section 4b). Then check the skill's `evidence-report.md` (at `{forge_data_folder}/{skill_name}/evidence-report.md`) for T2-future annotation counts.
107
+
108
+ - **If T2-future annotations > 0 AND Section 4b is absent:** Flag as Medium severity gap: "Migration section missing — T2-future annotations exist but Section 4b is not present in SKILL.md Tier 1."
109
+ - **If T2-future annotations = 0 AND Section 4b is present:** Flag as Medium severity gap: "Migration section unexpected — Section 4b is present but no T2-future annotations were produced."
110
+ - **If evidence-report.md is unavailable:** Skip this check silently. Note: "Section 4b verification skipped — evidence-report.md not found."
111
+
112
+ Add findings to the coherence analysis results.
113
+
114
+ **After Section 2b (naive path) → Skip to Section 6 (Append Results)**
95
115
 
96
116
  ### 3. Contextual Mode: Extract References
97
117
 
@@ -121,6 +141,8 @@ DO NOT BE LAZY — For EACH reference found, launch a subprocess that:
121
141
 
122
142
  If subprocess unavailable, validate each reference in main thread.
123
143
 
144
+ 4. **Scripts/assets directory check:** If a `scripts/` or `assets/` directory exists alongside SKILL.md, verify that a "Scripts & Assets" section (Section 7b) is present in SKILL.md. This directory-level check applies in both modes (naive mode performs it in Section 2; contextual mode performs it here alongside per-reference validation). Flag absence as Medium severity gap per `{scoringRulesFile}`.
145
+
124
146
  ### 5. Contextual Mode: Check Integration Pattern Completeness
125
147
 
126
148
  For stack skills, verify integration patterns are complete:
@@ -146,11 +168,19 @@ Build integration completeness findings:
146
168
  }
147
169
  ```
148
170
 
149
- ### 5b. Contextual Mode + Deep Tier: Section 4b Verification
171
+ **Zero integration patterns:** If no integration patterns are documented in SKILL.md (e.g., a contextual-mode skill that uses shared types but has no middleware chains, plugin hooks, or event flows): record `patterns_documented: 0`, `patterns_complete: 0`. The coherence score will use reference validity alone — see `{scoringRulesFile}` Coherence Score Aggregation: "If no integration patterns exist, combined coherence equals reference validity."
150
172
 
151
- **Only execute if forge tier is Deep.** Skip silently for Quick/Forge tiers.
173
+ ### 5b. Migration/Deprecation Verification (Contextual Path)
152
174
 
153
- Check whether SKILL.md contains a "Migration & Deprecation Warnings" section (Section 4b). Then check the skill's `evidence-report.md` (at `{forge_data_folder}/{skill_name}/evidence-report.md`) for T2-future annotation counts.
175
+ **This section shares logic with Section 2b.** If you are on the contextual mode path (Sections 3-5), execute the migration check here using the same rules as Section 2b:
176
+
177
+ **Gate check:** Execute ONLY IF both conditions are met:
178
+ 1. Forge tier is **Deep** (tool-gated)
179
+ 2. `{forge_data_folder}/{skill_name}/evidence-report.md` exists (data-gated)
180
+
181
+ If either condition fails, skip silently.
182
+
183
+ Check whether SKILL.md contains a "Migration & Deprecation Warnings" section (Section 4b). Then check the skill's `evidence-report.md` for T2-future annotation counts.
154
184
 
155
185
  - **If T2-future annotations > 0 AND Section 4b is absent:** Flag as Medium severity gap: "Migration section missing — T2-future annotations exist but Section 4b is not present in SKILL.md Tier 1."
156
186
  - **If T2-future annotations = 0 AND Section 4b is present:** Flag as Medium severity gap: "Migration section unexpected — Section 4b is present but no T2-future annotations were produced."
@@ -158,6 +188,20 @@ Check whether SKILL.md contains a "Migration & Deprecation Warnings" section (Se
158
188
 
159
189
  Add findings to the coherence analysis results.
160
190
 
191
+ ### 5c. Calculate Coherence Scores
192
+
193
+ **Contextual mode only.** Calculate coherence percentages using the formulas defined in `{scoringRulesFile}` — Coherence Score Aggregation section:
194
+
195
+ ```
196
+ reference_validity = (valid_references / total_references) * 100
197
+ integration_completeness = (complete_patterns / total_patterns) * 100
198
+ combined_coherence = (reference_validity * 0.6) + (integration_completeness * 0.4)
199
+ ```
200
+
201
+ **Edge case:** If no integration patterns are documented (patterns_documented = 0), combined coherence equals reference validity alone. Do not divide by zero.
202
+
203
+ These values fill the `{percentage}%` placeholders in the output template loaded in Section 6.
204
+
161
205
  ### 6. Append Coherence Analysis to Output
162
206
 
163
207
  Load `{outputFormatsFile}` and use the appropriate Coherence Analysis section format (naive or contextual) to append findings to `{outputFile}`.
@@ -60,7 +60,15 @@ Read {outputFile} frontmatter to get the skill directory path (`skillDir`).
60
60
 
61
61
  Before running external validators, check if `{forge_data_folder}/{skill_name}/evidence-report.md` contains validation results (a `## Validation Results` section with quality scores).
62
62
 
63
- **Staleness check:** Compare the evidence report's generation date against SKILL.md's last-modified timestamp (or `metadata.json` `generation_date`). If SKILL.md was modified after the evidence report was generated (e.g., after update-skill), the cached results are stale — skip auto-reuse and proceed to section 2 for a fresh run.
63
+ **Staleness check:** Determine whether SKILL.md has changed since the evidence report was generated.
64
+
65
+ **Primary (git-tracked):** Run `git log -1 --format=%cI -- {skillDir}/SKILL.md` to get the last commit date of SKILL.md. Compare against the evidence report's generation date (from its frontmatter or the `## Validation Results` timestamp). If SKILL.md's last commit is newer, results are stale.
66
+
67
+ **Secondary (uncommitted changes):** Run `git diff --name-only -- {skillDir}/SKILL.md`. If output is non-empty, SKILL.md has uncommitted changes — treat results as stale regardless of commit dates.
68
+
69
+ **Fallback (non-git environments):** If git commands fail (not a git repository), fall back to `metadata.json` `generation_date` comparison with a warning: "Staleness check using metadata.json — may be identical to evidence report timestamp. Consider a git-tracked directory for reliable staleness detection."
70
+
71
+ If SKILL.md was modified after the evidence report was generated (e.g., after update-skill), the cached results are stale — skip auto-reuse and proceed to section 2 for a fresh run.
64
72
 
65
73
  If recent, non-stale results exist (from a create-skill run that just completed), auto-reuse them — skip re-running validators and use the existing scores. Record: "External validation: reused from create-skill evidence report." Skip to section 5 (append results).
66
74
 
@@ -64,6 +64,8 @@ Load `{scoringRulesFile}` to get:
64
64
  - Tier-dependent scoring adjustments
65
65
  - Any custom threshold override from workflow input
66
66
 
67
+ **Docs-only mode check:** If the Coverage Analysis section in `{outputFile}` notes docs-only mode (set by step-03 for skills with all `[EXT:...]` citations and no local source), apply Quick-tier weight redistribution: Signature Accuracy and Type Coverage are not scored, their weights (22% + 14%) are redistributed proportionally to remaining active categories. Coverage score is based on documentation completeness rather than source coverage (as calculated by step-03).
68
+
67
69
  ### 2. Read Category Scores from Output
68
70
 
69
71
  Read `{outputFile}` and extract the category scores calculated in previous steps:
@@ -35,7 +35,7 @@ Compare current source code state against the provenance map to produce a comple
35
35
  - 🎯 Focus ONLY on detecting and classifying changes — do not extract or merge
36
36
  - 🚫 FORBIDDEN to modify any files — read-only change detection
37
37
  - 🚫 FORBIDDEN to re-extract content — that is step 03
38
- - 💬 Use subprocess optimization Pattern 4 for parallel comparison when available
38
+ - 💬 Use subprocess Pattern 4 (parallel): In Claude Code, use multiple parallel Agent tool calls or `run_in_background: true`. In Cursor, use parallel requests (IDE-dependent). In CLI, use `xargs -P` or background processes. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
39
39
  - ⚙️ If subprocess unavailable, perform comparison sequentially in main thread
40
40
 
41
41
  ## EXECUTION PROTOCOLS:
@@ -101,6 +101,8 @@ Perform tier-aware extraction on only the changed files identified in step 02, p
101
101
  - QMD provides: usage patterns, historical context, related documentation
102
102
  - Confidence: T1 for structural, T2 for semantic enrichment
103
103
 
104
+ **Tool resolution:** `ast_bridge` → ast-grep MCP tools (`find_code`, `find_code_by_rule`) or `ast-grep` CLI. `qmd_bridge` → QMD MCP tools (`mcp__plugin_qmd-plugin_qmd__search`, `vector_search`) or `qmd` CLI. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
105
+
104
106
  ### 2. Extract Changed Files
105
107
 
106
108
  DO NOT BE LAZY — For EACH file in the change manifest with status MODIFIED, ADDED, or RENAMED, launch a subprocess that:
@@ -128,7 +130,7 @@ DO NOT BE LAZY — For EACH file in the change manifest with status MODIFIED, AD
128
130
 
129
131
  Before aggregating extraction results, use CCC to assess semantic significance of changes:
130
132
 
131
- 1. Run `ccc_bridge.search("{skill_name}", source_root, top_k=15)` to get the skill's most semantically central files
133
+ 1. Run `ccc_bridge.search("{skill_name}", source_root, top_k=15)` — **Tool resolution:** `/ccc` skill search (Claude Code), ccc MCP (Cursor), `ccc search` (CLI) — to get the skill's most semantically central files
132
134
  2. Cross-reference the change manifest files with CCC results
133
135
  3. Files appearing in BOTH the change manifest AND CCC's top results are **semantically significant changes** — flag them for priority in the merge step
134
136
  4. Store `{ccc_significant_changes: [{file, score}]}` in context