bmad-module-skill-forge 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/.nvmrc +1 -0
  2. package/LICENSE +26 -0
  3. package/README.md +213 -0
  4. package/docs/404.md +20 -0
  5. package/docs/agents.md +73 -0
  6. package/docs/architecture.md +301 -0
  7. package/docs/examples.md +144 -0
  8. package/docs/getting-started.md +198 -0
  9. package/docs/index.md +75 -0
  10. package/docs/workflows.md +190 -0
  11. package/package.json +109 -0
  12. package/src/agents/forger.agent.yaml +93 -0
  13. package/src/forger/README.md +17 -0
  14. package/src/forger/forge-tier.yaml +13 -0
  15. package/src/forger/preferences.yaml +10 -0
  16. package/src/knowledge/agentskills-spec.md +158 -0
  17. package/src/knowledge/confidence-tiers.md +153 -0
  18. package/src/knowledge/manual-section-integrity.md +156 -0
  19. package/src/knowledge/overview.md +56 -0
  20. package/src/knowledge/progressive-capability.md +120 -0
  21. package/src/knowledge/provenance-tracking.md +163 -0
  22. package/src/knowledge/skf-knowledge-index.csv +9 -0
  23. package/src/knowledge/skill-lifecycle.md +150 -0
  24. package/src/knowledge/zero-hallucination.md +101 -0
  25. package/src/module-help.csv +12 -0
  26. package/src/module.yaml +22 -0
  27. package/src/workflows/README.md +148 -0
  28. package/src/workflows/analyze-source/data/skill-brief-schema.md +75 -0
  29. package/src/workflows/analyze-source/data/unit-detection-heuristics.md +88 -0
  30. package/src/workflows/analyze-source/steps-c/step-01-init.md +191 -0
  31. package/src/workflows/analyze-source/steps-c/step-01b-continue.md +144 -0
  32. package/src/workflows/analyze-source/steps-c/step-02-scan-project.md +208 -0
  33. package/src/workflows/analyze-source/steps-c/step-03-identify-units.md +199 -0
  34. package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +222 -0
  35. package/src/workflows/analyze-source/steps-c/step-05-recommend.md +236 -0
  36. package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +239 -0
  37. package/src/workflows/analyze-source/templates/analysis-report-template.md +41 -0
  38. package/src/workflows/analyze-source/validation-report.md +657 -0
  39. package/src/workflows/analyze-source/workflow-plan-analyze-source.md +385 -0
  40. package/src/workflows/analyze-source/workflow.md +61 -0
  41. package/src/workflows/audit-skill/data/drift-report-template.md +62 -0
  42. package/src/workflows/audit-skill/data/severity-rules.md +52 -0
  43. package/src/workflows/audit-skill/steps-c/step-01-init.md +195 -0
  44. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +191 -0
  45. package/src/workflows/audit-skill/steps-c/step-03-structural-diff.md +194 -0
  46. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +199 -0
  47. package/src/workflows/audit-skill/steps-c/step-05-severity-classify.md +210 -0
  48. package/src/workflows/audit-skill/steps-c/step-06-report.md +217 -0
  49. package/src/workflows/audit-skill/validation-report.md +545 -0
  50. package/src/workflows/audit-skill/workflow-plan-audit-skill.md +318 -0
  51. package/src/workflows/audit-skill/workflow.md +63 -0
  52. package/src/workflows/brief-skill/data/skill-brief-schema.md +82 -0
  53. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +184 -0
  54. package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +203 -0
  55. package/src/workflows/brief-skill/steps-c/step-03-scope-definition.md +225 -0
  56. package/src/workflows/brief-skill/steps-c/step-04-confirm-brief.md +185 -0
  57. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +156 -0
  58. package/src/workflows/brief-skill/validation-report.md +630 -0
  59. package/src/workflows/brief-skill/workflow-plan-brief-skill.md +360 -0
  60. package/src/workflows/brief-skill/workflow.md +57 -0
  61. package/src/workflows/create-skill/data/extraction-patterns.md +63 -0
  62. package/src/workflows/create-skill/data/skill-sections.md +166 -0
  63. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +176 -0
  64. package/src/workflows/create-skill/steps-c/step-02-ecosystem-check.md +143 -0
  65. package/src/workflows/create-skill/steps-c/step-03-extract.md +184 -0
  66. package/src/workflows/create-skill/steps-c/step-04-enrich.md +152 -0
  67. package/src/workflows/create-skill/steps-c/step-05-compile.md +198 -0
  68. package/src/workflows/create-skill/steps-c/step-06-validate.md +162 -0
  69. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +165 -0
  70. package/src/workflows/create-skill/steps-c/step-08-report.md +160 -0
  71. package/src/workflows/create-skill/validation-report.md +189 -0
  72. package/src/workflows/create-skill/workflow-plan-create-skill.md +491 -0
  73. package/src/workflows/create-skill/workflow.md +52 -0
  74. package/src/workflows/create-stack-skill/data/integration-patterns.md +61 -0
  75. package/src/workflows/create-stack-skill/data/manifest-patterns.md +35 -0
  76. package/src/workflows/create-stack-skill/data/stack-skill-template.md +110 -0
  77. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +142 -0
  78. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +145 -0
  79. package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +161 -0
  80. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +155 -0
  81. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +154 -0
  82. package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +160 -0
  83. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +202 -0
  84. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +193 -0
  85. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +137 -0
  86. package/src/workflows/create-stack-skill/validation-report.md +401 -0
  87. package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +481 -0
  88. package/src/workflows/create-stack-skill/workflow.md +59 -0
  89. package/src/workflows/export-skill/data/managed-section-format.md +70 -0
  90. package/src/workflows/export-skill/data/snippet-format.md +32 -0
  91. package/src/workflows/export-skill/steps-c/step-01-load-skill.md +184 -0
  92. package/src/workflows/export-skill/steps-c/step-02-package.md +153 -0
  93. package/src/workflows/export-skill/steps-c/step-03-generate-snippet.md +166 -0
  94. package/src/workflows/export-skill/steps-c/step-04-update-context.md +222 -0
  95. package/src/workflows/export-skill/steps-c/step-05-token-report.md +126 -0
  96. package/src/workflows/export-skill/steps-c/step-06-summary.md +167 -0
  97. package/src/workflows/export-skill/validation-report.md +263 -0
  98. package/src/workflows/export-skill/workflow-plan-export-skill.md +369 -0
  99. package/src/workflows/export-skill/workflow.md +56 -0
  100. package/src/workflows/quick-skill/data/registry-resolution.md +91 -0
  101. package/src/workflows/quick-skill/data/skill-template.md +66 -0
  102. package/src/workflows/quick-skill/steps-c/step-01-resolve-target.md +165 -0
  103. package/src/workflows/quick-skill/steps-c/step-02-ecosystem-check.md +143 -0
  104. package/src/workflows/quick-skill/steps-c/step-03-quick-extract.md +177 -0
  105. package/src/workflows/quick-skill/steps-c/step-04-compile.md +180 -0
  106. package/src/workflows/quick-skill/steps-c/step-05-validate.md +150 -0
  107. package/src/workflows/quick-skill/steps-c/step-06-write.md +160 -0
  108. package/src/workflows/quick-skill/validation-report.md +543 -0
  109. package/src/workflows/quick-skill/workflow-plan-quick-skill.md +405 -0
  110. package/src/workflows/quick-skill/workflow.md +56 -0
  111. package/src/workflows/setup-forge/data/tier-rules.md +50 -0
  112. package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +140 -0
  113. package/src/workflows/setup-forge/steps-c/step-02-write-config.md +141 -0
  114. package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +116 -0
  115. package/src/workflows/setup-forge/steps-c/step-04-report.md +131 -0
  116. package/src/workflows/setup-forge/validation-report.md +504 -0
  117. package/src/workflows/setup-forge/workflow-plan-setup-forge.md +428 -0
  118. package/src/workflows/setup-forge/workflow.md +49 -0
  119. package/src/workflows/test-skill/data/output-section-formats.md +96 -0
  120. package/src/workflows/test-skill/data/scoring-rules.md +74 -0
  121. package/src/workflows/test-skill/steps-c/step-01-init.md +185 -0
  122. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +162 -0
  123. package/src/workflows/test-skill/steps-c/step-03-coverage-check.md +222 -0
  124. package/src/workflows/test-skill/steps-c/step-04-coherence-check.md +249 -0
  125. package/src/workflows/test-skill/steps-c/step-05-score.md +222 -0
  126. package/src/workflows/test-skill/steps-c/step-06-report.md +175 -0
  127. package/src/workflows/test-skill/templates/test-report-template.md +24 -0
  128. package/src/workflows/test-skill/validation-report.md +390 -0
  129. package/src/workflows/test-skill/workflow-plan-test-skill.md +288 -0
  130. package/src/workflows/test-skill/workflow.md +57 -0
  131. package/src/workflows/update-skill/data/manual-section-rules.md +44 -0
  132. package/src/workflows/update-skill/data/merge-conflict-rules.md +62 -0
  133. package/src/workflows/update-skill/steps-c/step-01-init.md +208 -0
  134. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +184 -0
  135. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +187 -0
  136. package/src/workflows/update-skill/steps-c/step-04-merge.md +230 -0
  137. package/src/workflows/update-skill/steps-c/step-05-validate.md +187 -0
  138. package/src/workflows/update-skill/steps-c/step-06-write.md +204 -0
  139. package/src/workflows/update-skill/steps-c/step-07-report.md +201 -0
  140. package/src/workflows/update-skill/validation-report.md +559 -0
  141. package/src/workflows/update-skill/workflow-plan-update-skill.md +441 -0
  142. package/src/workflows/update-skill/workflow.md +56 -0
  143. package/tools/cli/commands/install.js +33 -0
  144. package/tools/cli/commands/status.js +195 -0
  145. package/tools/cli/commands/uninstall.js +226 -0
  146. package/tools/cli/commands/update.js +63 -0
  147. package/tools/cli/lib/compiler.js +306 -0
  148. package/tools/cli/lib/ide-commands.js +244 -0
  149. package/tools/cli/lib/installer.js +307 -0
  150. package/tools/cli/lib/manifest.js +109 -0
  151. package/tools/cli/lib/ui.js +277 -0
  152. package/tools/cli/lib/version-check.js +86 -0
  153. package/tools/cli/skf-cli.js +45 -0
  154. package/tools/skf-npx-wrapper.js +36 -0
@@ -0,0 +1,156 @@
1
+ # Manual Section Integrity
2
+
3
+ ## Principle
4
+
5
+ Sections marked with `[MANUAL]` delimiters contain developer-authored content that the forge never modifies, regenerates, or removes. The merge algorithm treats \[MANUAL\] blocks as inviolable during updates — they are preserved in place, and any conflict between generated content and manual content is escalated to the user.
6
+
7
+ ## Rationale
8
+
9
+ Generated skills cover what can be extracted from source code, but developers often need to add context that no tool can infer: architectural rationale, migration guides, team conventions, known gotchas. The \[MANUAL\] marker system gives developers a safe zone for hand-written content that survives regeneration cycles.
10
+
11
+ Without \[MANUAL\] preservation:
12
+ - Developer-authored content is overwritten on every update-skill run
13
+ - Users stop adding valuable context because it disappears
14
+ - Skills become purely mechanical extractions with no human insight
15
+
16
+ With \[MANUAL\] preservation:
17
+ - Hand-written content persists across unlimited regeneration cycles
18
+ - Developers invest in skill quality knowing their work is protected
19
+ - Skills combine machine-extracted precision with human-authored context
20
+
21
+ ## Marker Format
22
+
23
+ \[MANUAL\] sections use HTML comment delimiters:
24
+
25
+ ```markdown
26
+ <!-- [MANUAL:section-name] -->
27
+
28
+ Developer-authored content here. This content is never modified
29
+ by the forge during updates or regeneration.
30
+
31
+ <!-- [/MANUAL:section-name] -->
32
+ ```
33
+
34
+ **Rules:**
35
+ - `section-name` must be unique within the file
36
+ - Opening and closing markers must match exactly
37
+ - Multiple \[MANUAL\] blocks allowed per file
38
+ - Nested \[MANUAL\] blocks are forbidden — trigger an ERROR if detected
39
+ - Markers apply to any output file: `SKILL.md`, `references/*.md`, integration files
40
+
41
+ ## Pattern Examples
42
+
43
+ ### Example 1: Adding Manual Context to a Generated Skill
44
+
45
+ **Context:** A developer wants to add migration notes to an API function that the forge generated.
46
+
47
+ **Implementation:**
48
+ ```markdown
49
+ ## `migrateDatabase(config: MigrateConfig): Promise<void>`
50
+
51
+ Runs pending database migrations in sequence.
52
+
53
+ **Parameters:**
54
+ | Name | Type | Required | Default |
55
+ | --- | --- | --- | --- |
56
+ | config | `MigrateConfig` | yes | — |
57
+
58
+ [AST:src/migrate.ts:L15]
59
+
60
+ <!-- [MANUAL:migrate-notes] -->
61
+
62
+ ### Migration Gotchas
63
+
64
+ - Always run `backupDatabase()` before migration in production
65
+ - Migrations are not reversible after v2.3.0 — the rollback API was removed
66
+ - If using connection pooling, set `pool.max = 1` during migration to avoid lock conflicts
67
+
68
+ <!-- [/MANUAL:migrate-notes] -->
69
+ ```
70
+
71
+ **Key Points:**
72
+ - The \[MANUAL\] block sits naturally within the generated skill structure
73
+ - Content inside the markers is entirely developer-controlled
74
+ - The forge regenerates everything outside the markers; the block is re-inserted in place
75
+
76
+ ### Example 2: Merge Algorithm During Update
77
+
78
+ **Context:** The update-skill workflow needs to regenerate a skill while preserving \[MANUAL\] blocks.
79
+
80
+ **Implementation:** The merge follows this sequence:
81
+ 1. **Extract** all \[MANUAL\] blocks from the existing skill, recording their section-name and parent section context
82
+ 2. **Map** each block to its parent section in the document structure
83
+ 3. **Regenerate** the skill content from fresh source extraction
84
+ 4. **Re-insert** \[MANUAL\] blocks into their original positions relative to parent sections
85
+ 5. **Flag conflicts** if any arise (see conflict types below)
86
+
87
+ **Key Points:**
88
+ - \[MANUAL\] blocks are extracted before regeneration and re-inserted after
89
+ - Position is determined by parent section, not absolute line number
90
+ - The merge is deterministic — same inputs always produce same output
91
+
92
+ ### Example 3: Conflict Resolution
93
+
94
+ **Context:** Regeneration produces content that conflicts with existing \[MANUAL\] blocks.
95
+
96
+ **Implementation:** Four conflict severity levels:
97
+
98
+ | Severity | Condition | Resolution |
99
+ | --- | --- | --- |
100
+ | HIGH | Regenerated content overlaps \[MANUAL\] position | Present both versions, user chooses |
101
+ | WARNING | Parent section deleted, \[MANUAL\] block orphaned | Flag orphaned block, user decides to keep or remove |
102
+ | MEDIUM | \[MANUAL\] references a deleted export | Flag stale reference for user review |
103
+ | LOW | New export generated adjacent to \[MANUAL\] block | Auto-resolve: place new content before the block |
104
+
105
+ **Key Points:**
106
+ - HIGH and WARNING conflicts always require user input — never auto-resolved
107
+ - MEDIUM conflicts are flagged but do not block the update
108
+ - LOW conflicts are auto-resolved with a deterministic rule (new content before block)
109
+
110
+ ### Example 4: Orphan Detection
111
+
112
+ **Context:** An export that contained a \[MANUAL\] block has been removed from source.
113
+
114
+ **Implementation:**
115
+ ```
116
+ WARNING: Orphaned [MANUAL] block detected
117
+
118
+ Section: [MANUAL:migrate-notes]
119
+ Previous parent: ## `migrateDatabase(config: MigrateConfig): Promise<void>`
120
+ Status: Parent export removed from source
121
+
122
+ Options:
123
+ 1. Keep block in a "Legacy Notes" section at end of skill
124
+ 2. Remove block (content will be shown for copy before deletion)
125
+ 3. Relocate to a different section (specify target)
126
+ ```
127
+
128
+ **Key Points:**
129
+ - Orphaned blocks are never silently deleted
130
+ - The user always sees the content and chooses its fate
131
+ - Option 1 preserves the content without cluttering the active skill sections
132
+
133
+ ## Audit Interaction
134
+
135
+ The audit-skill workflow detects \[MANUAL\] section integrity issues:
136
+ - **Malformed markers**: Missing closing tag, mismatched names
137
+ - **Nested markers**: \[MANUAL\] inside \[MANUAL\] — always an error
138
+ - **Stale references**: \[MANUAL\] content mentioning exports that no longer exist
139
+ - **Orphaned blocks**: Parent section no longer in the skill
140
+
141
+ These findings appear in the drift report with appropriate severity classifications.
142
+
143
+ ## Anti-Patterns
144
+
145
+ - Modifying content inside \[MANUAL\] markers during automated updates — always preserve exactly
146
+ - Silently removing orphaned \[MANUAL\] blocks — always escalate to user
147
+ - Nesting \[MANUAL\] blocks — one level only, nesting is an error
148
+ - Using \[MANUAL\] markers in provenance-map.json or metadata.json — markers are for markdown content files only
149
+
150
+ ## Related Fragments
151
+
152
+ - [provenance-tracking.md](provenance-tracking.md) — how \[MANUAL\] sections interact with provenance (no source location, author: "manual")
153
+ - [zero-hallucination.md](zero-hallucination.md) — \[MANUAL\] sections are the designated space for human-authored claims
154
+ - [skill-lifecycle.md](skill-lifecycle.md) — \[MANUAL\] preservation is critical in the update and audit phases
155
+
156
+ _Source: consolidated from manual-section-rules.md, merge-conflict-rules.md, and update-skill steps_
@@ -0,0 +1,56 @@
1
+ # SKF Knowledge Overview
2
+
3
+ ## Principle
4
+
5
+ Agent-level knowledge files capture cross-cutting principles and patterns that Ferris applies across multiple workflows. They are distinct from workflow `data/` files, which contain step-specific operational artifacts. Knowledge is loaded just-in-time when a workflow step directs — never preloaded into context.
6
+
7
+ ## Rationale
8
+
9
+ The SKF module has 10 workflows containing 19 operational `data/` files embedded in step directories. These data files define schemas, templates, scoring formulas, and extraction rules tightly coupled to individual steps. But several principles — zero hallucination, confidence tiers, provenance — cut across multiple workflows and need a single authoritative source rather than fragmented repetition.
10
+
11
+ Without a knowledge folder:
12
+ - Cross-cutting principles get duplicated across workflow steps
13
+ - Updates to foundational rules require changes in multiple locations
14
+ - Ferris has no centralized reference for judgment calls that span workflows
15
+
16
+ With knowledge files:
17
+ - Each principle has one canonical definition
18
+ - Workflow steps reference knowledge files instead of re-stating rules
19
+ - Ferris loads only the knowledge relevant to the current task
20
+
21
+ ## Knowledge Map
22
+
23
+ | File | Purpose | Key Workflows |
24
+ | --- | --- | --- |
25
+ | [zero-hallucination.md](zero-hallucination.md) | Every claim traces to source; uncitable content excluded | AN, BS, CS, QS, SS, US, AS, TS |
26
+ | [confidence-tiers.md](confidence-tiers.md) | T1/T1-low/T2/T3 trust model and citation formats | AN, BS, CS, QS, SS, US, AS, TS, EX |
27
+ | [progressive-capability.md](progressive-capability.md) | Quick/Forge/Deep tier philosophy and behavior adaptation | All 10 |
28
+ | [agentskills-spec.md](agentskills-spec.md) | agentskills.io output format principles and compliance | CS, QS, SS, US, TS, EX |
29
+ | [skill-lifecycle.md](skill-lifecycle.md) | End-to-end pipeline, artifact flow, workflow selection | All 10 |
30
+ | [provenance-tracking.md](provenance-tracking.md) | Provenance-map.json, evidence reports, claim traceability | CS, QS, SS, US, AS, TS |
31
+ | [manual-section-integrity.md](manual-section-integrity.md) | \[MANUAL\] marker preservation and merge algorithm | CS, US, AS, TS, EX |
32
+
33
+ ## JiT Loading Protocol
34
+
35
+ 1. Ferris receives a task or workflow activation
36
+ 2. Consult `skf-knowledge-index.csv` to identify relevant knowledge fragments by tags or description
37
+ 3. Load only the files needed for the current task — never bulk-load all knowledge
38
+ 4. Apply knowledge principles during workflow execution alongside step-specific `data/` files
39
+
40
+ ## Knowledge vs. Data
41
+
42
+ | Aspect | Knowledge Files (`knowledge/`) | Data Files (`data/`) |
43
+ | --- | --- | --- |
44
+ | Scope | Cross-cutting, multi-workflow | Single workflow, single step |
45
+ | Content | Principles, patterns, judgment rules | Schemas, templates, scoring formulas |
46
+ | Loading | JiT via index lookup | JiT via step instruction |
47
+ | Examples | Zero hallucination, confidence tiers | skill-brief-schema.md, scoring-rules.md |
48
+ | Stability | Rarely changes | Changes with workflow evolution |
49
+
50
+ ## Related Fragments
51
+
52
+ - [confidence-tiers.md](confidence-tiers.md) — the trust model that underpins extraction and scoring
53
+ - [skill-lifecycle.md](skill-lifecycle.md) — the end-to-end pipeline connecting all workflows
54
+ - [progressive-capability.md](progressive-capability.md) — tier philosophy that affects every workflow
55
+
56
+ _Source: synthesized from module.yaml, README.md, and workflow README_
@@ -0,0 +1,120 @@
1
+ # Progressive Capability
2
+
3
+ ## Principle
4
+
5
+ Every capability tier — Quick, Forge, and Deep — produces legitimate, useful skills. Tiers describe what tools are available, not a quality hierarchy. A Quick skill is complete at its tier; a Deep skill adds depth, not correctness. Framing is always positive: describe what each tier enables, never what it lacks.
6
+
7
+ ## Rationale
8
+
9
+ Skill Forge operates in diverse environments. Some users have ast-grep, GitHub CLI, and QMD installed; others have none. The progressive capability model ensures Ferris adapts to the environment without making users feel their setup is insufficient.
10
+
11
+ Without progressive capability:
12
+ - Users without ast-grep see error messages or degraded output
13
+ - Quick tier skills feel like failures rather than valid deliverables
14
+ - Workflow steps contain conditional logic for missing tools scattered throughout
15
+
16
+ With progressive capability:
17
+ - Each tier has a clear identity and positive capability description
18
+ - Workflow behavior adapts cleanly based on the detected tier
19
+ - Users understand what their tier enables and what upgrading would add
20
+
21
+ ## Tier Definitions
22
+
23
+ | Tier | Requirements | Capabilities | Identity |
24
+ | --- | --- | --- | --- |
25
+ | Quick | No tools required | Fast, template-driven, package-name resolution | Speed-first skill creation |
26
+ | Forge | ast-grep available | AST-backed structural analysis, line-level citations | Precision-focused compilation |
27
+ | Deep | ast-grep + gh + qmd | AST + GitHub exploration + QMD synthesis, maximum provenance | Full intelligence pipeline |
28
+
29
+ ## Pattern Examples
30
+
31
+ ### Example 1: Tool Detection and Tier Assignment
32
+
33
+ **Context:** The setup-forge workflow detects available tools and assigns a tier.
34
+
35
+ **Implementation:** Each tool is verified by executing its version command — presence in PATH is insufficient. The tier is the highest level where all required tools pass verification:
36
+
37
+ ```
38
+ ast-grep --version → required for Forge
39
+ gh --version → required for Deep
40
+ qmd status → required for Deep
41
+ ```
42
+
43
+ If ast-grep passes but gh fails, the tier is Forge (not a "degraded Deep").
44
+
45
+ **Key Points:**
46
+ - Tools must be functional, not just installed
47
+ - Tier assignment is deterministic — no ambiguity
48
+ - The result is written to `forge-tier.yaml` in the sidecar and persists across sessions
49
+
50
+ ### Example 2: Positive Tier Framing
51
+
52
+ **Context:** Reporting the detected tier to the user.
53
+
54
+ **Implementation:**
55
+ ```
56
+ Quick: "Fast, template-driven skill creation — package-name resolution and
57
+ source reading. Skills ready in minutes."
58
+
59
+ Forge: "AST-backed structural analysis — line-level citations with verified
60
+ signatures. Precision-focused compilation."
61
+
62
+ Deep: "Full intelligence pipeline — AST verification plus GitHub exploration
63
+ and QMD knowledge synthesis. Maximum provenance depth."
64
+ ```
65
+
66
+ **Key Points:**
67
+ - Each description leads with what the tier does, not what it misses
68
+ - No tier mentions another tier's capabilities as something it lacks
69
+ - Quick is "fast" not "limited"; Forge is "precise" not "partial"
70
+
71
+ ### Example 3: Tier-Adaptive Extraction
72
+
73
+ **Context:** The create-skill extraction step adapts its strategy based on the forge tier.
74
+
75
+ **Implementation:**
76
+ - **Quick:** Reads source files, applies pattern matching for exports and signatures, produces T1-low citations. Uses `gh_bridge` for file structure when available as a convenience, not a requirement.
77
+ - **Forge:** Uses `ast_bridge.scan_definitions()` for structural parsing, produces T1 citations with exact AST node types. Falls back to source reading for files ast-grep cannot parse.
78
+ - **Deep:** Identical extraction to Forge, plus QMD enrichment in a separate step. T2 annotations layer on top of the T1 base without replacing it.
79
+
80
+ **Key Points:**
81
+ - Extraction quality increases with tier, but every tier produces complete output
82
+ - Forge and Deep share the same extraction core — Deep adds enrichment, not better parsing
83
+ - Fallback within a tier (e.g., ast-grep fails on one file) degrades gracefully to T1-low for that file only
84
+
85
+ ### Example 4: Tier-Adaptive Scoring
86
+
87
+ **Context:** The test-skill workflow adjusts scoring weights based on the forge tier.
88
+
89
+ **Implementation:**
90
+ - **Quick (Naive mode):** Export Coverage 50%, Signature Accuracy 30%, Type Coverage 20%. No coherence check — AST verification unavailable.
91
+ - **Forge (Contextual mode):** Export Coverage 40%, Signature Accuracy 25%, Type Coverage 15%, Coherence 20%. Full AST-backed verification.
92
+ - **Deep (Contextual mode):** Same weights as Forge, plus cross-repo verification and QMD coherence checks feed into the coherence score.
93
+
94
+ **Key Points:**
95
+ - Pass threshold (80%) is the same across all tiers — quality bar is tier-independent
96
+ - Weight redistribution reflects what each tier can actually measure
97
+ - A Quick skill scoring 85% and a Deep skill scoring 85% both pass — different measurements, same bar
98
+
99
+ ## Graceful Degradation
100
+
101
+ When a tool becomes unavailable mid-session (e.g., ast-grep uninstalled between runs):
102
+ 1. Setup-forge re-detects and downgrades the tier
103
+ 2. Existing skills retain their original citations — they don't retroactively lose confidence
104
+ 3. New extractions use the current tier's capabilities
105
+ 4. The tier change is logged in the sidecar for audit trail
106
+
107
+ ## Anti-Patterns
108
+
109
+ - Describing Quick tier as "basic" or "limited" — it is fast and legitimate
110
+ - Requiring ast-grep for workflows that work fine without it (setup-forge, brief-skill)
111
+ - Mixing tier capabilities in a single extraction (e.g., T1 citations when only source reading was used)
112
+ - Failing a workflow because the tier is "too low" — adapt behavior instead
113
+
114
+ ## Related Fragments
115
+
116
+ - [confidence-tiers.md](confidence-tiers.md) — how tier determines available confidence levels
117
+ - [skill-lifecycle.md](skill-lifecycle.md) — how tier affects workflow selection and artifact flow
118
+ - [zero-hallucination.md](zero-hallucination.md) — Quick tier has lower confidence but the same integrity standard
119
+
120
+ _Source: distilled from forge-tier.yaml, tier-rules.md, and setup-forge workflow_
@@ -0,0 +1,163 @@
1
+ # Provenance Tracking
2
+
3
+ ## Principle
4
+
5
+ Every claim in a generated skill has a recorded provenance chain — from the assertion in the skill back to the source location, extraction method, and confidence tier. Provenance is stored in machine-readable format (`provenance-map.json`) alongside human-readable evidence reports, making claims independently verifiable.
6
+
7
+ ## Rationale
8
+
9
+ Skills make hundreds of individual claims: function signatures, parameter types, default values, behavioral descriptions. Without provenance, there is no way to verify whether a claim is current, to detect drift when source changes, or to trace a broken instruction back to its origin.
10
+
11
+ Without provenance tracking:
12
+ - Audit workflows cannot compare skill claims against current source
13
+ - Update workflows cannot identify which claims need re-extraction
14
+ - Users cannot distinguish verified claims from stale or fabricated ones
15
+
16
+ With provenance tracking:
17
+ - Every claim maps to a specific source location and extraction method
18
+ - Audit workflows perform precise structural and semantic diffing
19
+ - Update workflows selectively re-extract only changed claims
20
+
21
+ ## Provenance Artifacts
22
+
23
+ | Artifact | Format | Purpose | Generated By |
24
+ | --- | --- | --- | --- |
25
+ | `provenance-map.json` | JSON | Machine-readable claim-to-source mapping | CS, QS, SS |
26
+ | `evidence-report.md` | Markdown | Human-readable extraction summary | CS, QS, SS |
27
+ | Inline citations | `[TAG:path:Lnn]` | Per-claim source reference in SKILL.md | CS, QS, SS, US |
28
+ | `drift-report.md` | Markdown | Findings from source comparison | AS |
29
+
30
+ ## Pattern Examples
31
+
32
+ ### Example 1: Provenance Map Structure
33
+
34
+ **Context:** The create-skill workflow generates a `provenance-map.json` alongside each skill.
35
+
36
+ **Implementation:**
37
+ ```json
38
+ {
39
+ "version": "1.0",
40
+ "generated_at": "2025-01-15T10:30:00Z",
41
+ "extraction_tier": "forge",
42
+ "claims": {
43
+ "createServer": {
44
+ "source_file": "src/server.ts",
45
+ "line": 23,
46
+ "confidence": "t1",
47
+ "extraction_method": "ast-grep",
48
+ "ast_node_type": "export_statement > function_declaration",
49
+ "signature": "createServer(options: ServerOptions): Server"
50
+ },
51
+ "parseConfig": {
52
+ "source_file": "src/config.ts",
53
+ "line": 45,
54
+ "confidence": "t1_low",
55
+ "extraction_method": "source-read",
56
+ "ast_node_type": null,
57
+ "signature": "parseConfig(input)"
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ **Key Points:**
64
+ - Each claim is keyed by export name for direct lookup
65
+ - `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
68
+
69
+ ### Example 2: Evidence Report
70
+
71
+ **Context:** The evidence report provides a human-readable summary of the extraction.
72
+
73
+ **Implementation:**
74
+ ```markdown
75
+ # Evidence Report: express-skill
76
+
77
+ ## Extraction Summary
78
+ - **Tier:** Forge
79
+ - **Tool versions:** ast-grep 0.25.0
80
+ - **Source files scanned:** 12
81
+ - **Exports extracted:** 47
82
+ - **Confidence distribution:** T1: 42, T1-low: 5, T2: 0, T3: 0
83
+
84
+ ## Validation Results
85
+ - Signature accuracy: all T1 claims verified against AST
86
+ - Coverage: 47/52 public exports documented (5 internal re-exports excluded)
87
+ - Gaps: 3 exports with incomplete type information (marked T1-low)
88
+
89
+ ## Extraction Log
90
+ | Export | File | Line | Confidence | Notes |
91
+ | --- | --- | --- | --- | --- |
92
+ | createServer | src/server.ts | 23 | T1 | Full signature with generics |
93
+ | parseConfig | src/config.ts | 45 | T1-low | Type annotation missing |
94
+ | ... | ... | ... | ... | ... |
95
+ ```
96
+
97
+ **Key Points:**
98
+ - Tool versions recorded for reproducibility
99
+ - Coverage calculated against actual public exports, not estimated
100
+ - Gaps explicitly listed — they feed into test-skill scoring
101
+
102
+ ### Example 3: Audit Drift Detection Using Provenance
103
+
104
+ **Context:** The audit-skill workflow uses the provenance map to detect drift.
105
+
106
+ **Implementation:** The audit process:
107
+ 1. Load the existing `provenance-map.json`
108
+ 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:
110
+ - **Signature changed** → CRITICAL or HIGH severity
111
+ - **Export removed** → CRITICAL severity
112
+ - **New export undocumented** → HIGH (if > 3) or MEDIUM (if 1-3)
113
+ - **Implementation changed, API stable** → MEDIUM severity
114
+ - **Style/whitespace only** → LOW severity
115
+ 4. Produce a drift report with severity classifications
116
+
117
+ **Key Points:**
118
+ - Provenance enables precise diffing — compare specific claims, not entire files
119
+ - Severity classification uses the rules from audit-skill/data/severity-rules.md
120
+ - The drift report feeds into the update-skill workflow as re-extraction targets
121
+
122
+ ### Example 4: Provenance Preservation During Updates
123
+
124
+ **Context:** The update-skill workflow merges fresh extractions with existing provenance.
125
+
126
+ **Implementation:**
127
+ 1. Load existing provenance map
128
+ 2. Identify claims that need re-extraction (from audit drift report or source change detection)
129
+ 3. Re-extract only affected claims using current tier tools
130
+ 4. Merge fresh provenance entries into the existing map:
131
+ - Changed claims: replace with new provenance
132
+ - Unchanged claims: preserve existing provenance (timestamp unchanged)
133
+ - Removed exports: remove from provenance map
134
+ - New exports: add with fresh provenance
135
+ 5. Regenerate evidence report reflecting the update
136
+
137
+ **Key Points:**
138
+ - Selective re-extraction — only changed claims are re-processed
139
+ - Provenance timestamps show when each claim was last verified
140
+ - The merge preserves \[MANUAL\] section provenance (author: "manual", no source location)
141
+
142
+ ## Inline Citation Rules
143
+
144
+ Citations appear directly in SKILL.md content:
145
+ - Place citations at the end of the relevant line or block
146
+ - Use the citation format matching the confidence tier (see [confidence-tiers.md](confidence-tiers.md))
147
+ - Multiple citations on the same claim are ordered by confidence: T1 > T1-low > T2 > T3
148
+ - Citations in \[MANUAL\] sections are author-provided and not managed by the forge
149
+
150
+ ## Anti-Patterns
151
+
152
+ - Generating provenance-map.json with fabricated line numbers — line numbers must come from actual extraction
153
+ - Copying provenance from a previous extraction without re-verifying — timestamps must reflect actual verification time
154
+ - Omitting the evidence report — it is required for every compilation, not optional
155
+ - Using provenance from one source file version against a different version — provenance is version-bound
156
+
157
+ ## Related Fragments
158
+
159
+ - [confidence-tiers.md](confidence-tiers.md) — defines the citation formats used in provenance
160
+ - [zero-hallucination.md](zero-hallucination.md) — the principle that provenance enforces
161
+ - [manual-section-integrity.md](manual-section-integrity.md) — how \[MANUAL\] sections interact with provenance
162
+
163
+ _Source: consolidated from create-skill steps 03/05/07, audit-skill steps 02/03, and skill-sections.md_
@@ -0,0 +1,9 @@
1
+ id,name,description,tags,tier,fragment_file
2
+ overview,Knowledge Overview,"Entry point — knowledge map, JiT loading protocol, relationship to workflow data/ files","knowledge,navigation,jit-loading",core,knowledge/overview.md
3
+ zero-hallucination,Zero Hallucination Principle,"Foundational principle — uncitable content is excluded not guessed, every claim traces to source","integrity,provenance,extraction",core,knowledge/zero-hallucination.md
4
+ confidence-tiers,Confidence Tiers,"Trust model — T1/T1-low/T2/T3 labels, citation formats, tier interaction rules","confidence,citations,evidence,tiers",core,knowledge/confidence-tiers.md
5
+ progressive-capability,Progressive Capability,"Quick/Forge/Deep philosophy — every tier is legitimate, positive framing, graceful degradation","tiers,quick,forge,deep,capability",core,knowledge/progressive-capability.md
6
+ agentskills-spec,agentskills.io Specification,"Format principles — frontmatter, progressive disclosure, directory structure, compliance rules","agentskills,format,compliance,output",core,knowledge/agentskills-spec.md
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
+ provenance-tracking,Provenance Tracking,"Provenance mechanism — provenance-map.json, evidence reports, claim traceability","provenance,evidence,traceability,citations",core,knowledge/provenance-tracking.md
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
@@ -0,0 +1,150 @@
1
+ # Skill Lifecycle
2
+
3
+ ## Principle
4
+
5
+ The 10 SKF workflows form an end-to-end pipeline from source discovery through verified export. Each workflow produces artifacts consumed by downstream workflows. Understanding the lifecycle enables Ferris to recommend the right workflow for a user's situation and to maintain artifact continuity across the pipeline.
6
+
7
+ ## Rationale
8
+
9
+ Skills are not created in a single step — they move through discovery, design, compilation, verification, and distribution phases. Each phase has dedicated workflows with specific inputs and outputs. The lifecycle model prevents users from skipping critical steps and ensures artifacts flow cleanly between workflows.
10
+
11
+ Without lifecycle awareness:
12
+ - Users jump to create-skill without proper analysis or briefing
13
+ - Generated skills lack provenance because upstream artifacts were skipped
14
+ - Export packages reference stale or untested skills
15
+
16
+ With lifecycle awareness:
17
+ - Ferris recommends the appropriate entry point based on the user's context
18
+ - Artifact dependencies are explicit — each workflow declares its inputs
19
+ - The full pipeline produces verified, export-ready skills with complete provenance
20
+
21
+ ## Pipeline Phases
22
+
23
+ | Phase | Workflows | Purpose | Artifacts Produced |
24
+ | --- | --- | --- | --- |
25
+ | Setup | SF (Setup Forge) | Detect environment and set capability tier | `forge-tier.yaml` |
26
+ | Discovery | AN (Analyze Source) | Scan project, identify skillable units | Analysis report, skill briefs |
27
+ | Design | BS (Brief Skill) | Interactive scope definition for one skill | `skill-brief.yaml` |
28
+ | Compilation | CS, QS, SS (Create/Quick/Stack) | Extract source and compile skill | `SKILL.md`, metadata, provenance |
29
+ | Maintenance | US, AS (Update/Audit) | Detect drift and refresh skills | Updated `SKILL.md`, drift report |
30
+ | Verification | TS (Test Skill) | Quality gate — completeness scoring | Test report, pass/fail decision |
31
+ | Distribution | EX (Export Skill) | Package and inject into agent context | agentskills.io bundle, snippets |
32
+
33
+ ## Typical Flows
34
+
35
+ ### First-Time Setup (Brownfield Project)
36
+
37
+ ```
38
+ SF → AN → CS (--batch) → TS → EX
39
+ ```
40
+
41
+ 1. **SF** detects tools, writes forge tier
42
+ 2. **AN** scans the project, identifies skillable units, generates skill briefs
43
+ 3. **CS** compiles skills from briefs (batch mode processes all briefs)
44
+ 4. **TS** runs completeness verification on each skill
45
+ 5. **EX** packages passing skills for distribution
46
+
47
+ ### Single Skill (Full Quality)
48
+
49
+ ```
50
+ SF → BS → CS → TS → EX
51
+ ```
52
+
53
+ 1. **SF** ensures environment is configured
54
+ 2. **BS** guides the user through scope definition, produces a validated brief
55
+ 3. **CS** compiles the skill with full provenance
56
+ 4. **TS** verifies completeness
57
+ 5. **EX** packages for distribution
58
+
59
+ ### Single Skill (Fast)
60
+
61
+ ```
62
+ SF → QS → EX
63
+ ```
64
+
65
+ 1. **SF** ensures environment is configured
66
+ 2. **QS** resolves a package name or URL to source and compiles directly — no brief needed
67
+ 3. **EX** packages for distribution (optional TS between QS and EX for quality assurance)
68
+
69
+ ### Maintenance
70
+
71
+ ```
72
+ AS → US → TS → EX
73
+ ```
74
+
75
+ 1. **AS** detects drift between skill and current source
76
+ 2. **US** re-extracts changed exports and merges, preserving \[MANUAL\] sections
77
+ 3. **TS** re-verifies the updated skill
78
+ 4. **EX** re-exports the updated package
79
+
80
+ ## Pattern Examples
81
+
82
+ ### Example 1: Workflow Selection Decision
83
+
84
+ **Context:** A user asks Ferris to create a skill for a specific library.
85
+
86
+ **Implementation:** Ferris evaluates the situation:
87
+
88
+ | Condition | Recommended Flow |
89
+ | --- | --- |
90
+ | User knows exactly what to skill, has a brief | CS directly |
91
+ | User knows the library but needs scope guidance | BS → CS |
92
+ | User has a package name, wants fast results | QS |
93
+ | User wants to skill their entire project | AN → CS (batch) |
94
+ | User has an existing skill that may be outdated | AS → US |
95
+
96
+ **Key Points:**
97
+ - SF is always prerequisite (but only needs to run once per project)
98
+ - Quick skill (QS) skips briefing — appropriate for well-known packages
99
+ - Analyze source (AN) is the brownfield entry point for large projects
100
+
101
+ ### Example 2: Artifact Flow Between Workflows
102
+
103
+ **Context:** Tracking how artifacts flow through the pipeline.
104
+
105
+ **Implementation:**
106
+ ```
107
+ SF → forge-tier.yaml
108
+ ↓ (read by all subsequent workflows)
109
+ AN → analysis-report.md + skill-brief.yaml[]
110
+ ↓ (briefs consumed by CS)
111
+ CS → SKILL.md + metadata.json + provenance-map.json + evidence-report.md
112
+ ↓ (skill consumed by TS)
113
+ TS → test-report.md (pass/fail gate)
114
+ ↓ (passing skill consumed by EX)
115
+ EX → agentskills.io bundle + context snippets
116
+ ```
117
+
118
+ **Key Points:**
119
+ - `forge-tier.yaml` is the universal dependency — all workflows read it
120
+ - Skill briefs are the handoff between discovery/design and compilation
121
+ - TS acts as a gate — failing skills do not proceed to EX
122
+
123
+ ### Example 3: Stack Skill vs. Individual Skills
124
+
125
+ **Context:** A user wants to document how multiple libraries work together in their project.
126
+
127
+ **Implementation:** Two approaches serve different needs:
128
+ - **Individual skills** (via CS or QS): One skill per library, each with its own provenance and lifecycle. Best for reusable skills that apply across projects.
129
+ - **Stack skill** (via SS): A single consolidated skill documenting how libraries connect. Detects co-import patterns and integration surfaces. Best for project-specific context.
130
+
131
+ **Key Points:**
132
+ - Stack skills and individual skills are complementary, not competing
133
+ - SS detects integration patterns (e.g., "express + passport always used together for auth routes")
134
+ - Individual skills track per-library provenance; stack skills track inter-library relationships
135
+
136
+ ## Integration Points
137
+
138
+ - **Setup Forge** must run before any other workflow — it establishes the tier
139
+ - **Analyze Source** and **Brief Skill** are alternative entry points to compilation
140
+ - **Test Skill** is optional but recommended — the quality gate before export
141
+ - **Audit Skill** and **Update Skill** form the maintenance loop
142
+ - **Export Skill** is the terminal workflow — it produces the distributable artifact
143
+
144
+ ## Related Fragments
145
+
146
+ - [progressive-capability.md](progressive-capability.md) — how the forge tier affects each pipeline phase
147
+ - [agentskills-spec.md](agentskills-spec.md) — the output format that export-skill packages
148
+ - [provenance-tracking.md](provenance-tracking.md) — how provenance flows through the pipeline
149
+
150
+ _Source: synthesized from all 10 workflow.md files and module-help.csv_