Add a validate-provenance.sh script to skill-audit that validates the sources provenance chain is complete and internally consistent. Also add a new Provenance report dimension, update the sources.md template in skill-author, update skill-author Step 5 to write Research doc: fields, and backfill existing sources.md files.
Background
The provenance chain runs in three stages:
/research writes topic files + sources.md to a plugin-level output directory (e.g. plugins/<plugin>/docs/research/docs/<topic>/)
/skill-author reads those docs and builds the skill, recording provenance in references/sources.md (which skill files each source contributed to, and which research doc it came from) and source_keys frontmatter on each skill file (SKILL.md and references/*.md)
The chain is: research → plugin-level docs → skill. The plugin-level docs are not part of the skill — they live at the plugin level and are read as input during authoring.
Checks
New script: scripts/validate-provenance.sh
Always runs unconditionally (called from Step 1 of the audit alongside validate.sh). Handles the "nothing to validate" case internally.
Skill-level checks (FAIL):
Every source_keys entry in SKILL.md metadata has a matching slug in references/sources.md
Every source_keys entry in each references/*.md file (excluding sources.md itself) has a matching slug in references/sources.md
Every file listed under Contributing files in references/sources.md actually exists in the skill directory — entries starting with (none are skipped; multiple files are comma-separated
No unfilled FILL IN: placeholders remain in references/sources.md
Every non-(none)Contributing files entry in references/sources.md: the listed file's source_keys includes the parent slug (bidirectional check) — skip if file doesn't exist (already caught above) or if file is sources.md itself
Every entry in references/sources.md has a Research doc: field pointing to the upstream plugin-level research sources file
Upstream checks (assume marketplace context for now):
Forward: slug in skill's references/sources.md not found in the upstream research sources.md declared by Research doc: → INFO
Reverse: extracted slug in upstream research sources.md with Contributing files pointing at this skill, missing from skill's references/sources.md → FAIL
INFO (not FAIL):
references/*.md file (excluding sources.md) has no source_keys frontmatter when sources.md is present
Edge cases:
source_keys declared anywhere but references/sources.md absent → FAIL
Skip bidirectional Contributing files check for files that don't exist (caught by existence check) and for references/sources.md itself
New report dimension: Provenance
Always appears in the Checked: coverage line
Script embeds full FAIL/INFO format including Why and Fix per finding
INFO findings do not affect pass/fail verdict
Updated result block format
PASS
PASS (N suggestions)
PASS · P info
PASS (N suggestions) · P info
FAIL (N fails · M suggestions)
FAIL (N fails · M suggestions) · P info
INFO is counted separately and never changes the PASS/FAIL determination.
Changes required
scripts/validate-provenance.sh — new script with all checks above
tests/validate-provenance.bats — fixture-based tests covering: clean pass, missing slug, orphaned Contributing file, missing Research doc path, upstream mismatch both directions, (none) skip case, source_keys without sources.md
skill-audit/SKILL.md — add second script call to Step 1; add Provenance to coverage line; update result block format in Step 4
## Summary
Add a `validate-provenance.sh` script to `skill-audit` that validates the sources provenance chain is complete and internally consistent. Also add a new `Provenance` report dimension, update the `sources.md` template in `skill-author`, update `skill-author` Step 5 to write `Research doc:` fields, and backfill existing sources.md files.
## Background
The provenance chain runs in three stages:
1. `/research` writes topic files + `sources.md` to a plugin-level output directory (e.g. `plugins/<plugin>/docs/research/docs/<topic>/`)
2. `/skill-author` reads those docs and builds the skill, recording provenance in `references/sources.md` (which skill files each source contributed to, and which research doc it came from) and `source_keys` frontmatter on each skill file (`SKILL.md` and `references/*.md`)
The chain is: research → plugin-level docs → skill. The plugin-level docs are not part of the skill — they live at the plugin level and are read as input during authoring.
## Checks
### New script: `scripts/validate-provenance.sh`
Always runs unconditionally (called from Step 1 of the audit alongside `validate.sh`). Handles the "nothing to validate" case internally.
**Skill-level checks (FAIL):**
- [x] Every `source_keys` entry in `SKILL.md` metadata has a matching slug in `references/sources.md`
- [x] Every `source_keys` entry in each `references/*.md` file (excluding `sources.md` itself) has a matching slug in `references/sources.md`
- [x] Every file listed under `Contributing files` in `references/sources.md` actually exists in the skill directory — entries starting with `(none` are skipped; multiple files are comma-separated
- [x] No unfilled `FILL IN:` placeholders remain in `references/sources.md`
- [x] Every non-`(none)` `Contributing files` entry in `references/sources.md`: the listed file's `source_keys` includes the parent slug (bidirectional check) — skip if file doesn't exist (already caught above) or if file is `sources.md` itself
- [x] Every entry in `references/sources.md` has a `Research doc:` field pointing to the upstream plugin-level research sources file
**Upstream checks (assume marketplace context for now):**
- Forward: slug in skill's `references/sources.md` not found in the upstream research sources.md declared by `Research doc:` → INFO
- Reverse: extracted slug in upstream research sources.md with Contributing files pointing at this skill, missing from skill's `references/sources.md` → FAIL
**INFO (not FAIL):**
- `references/*.md` file (excluding `sources.md`) has no `source_keys` frontmatter when `sources.md` is present
**Edge cases:**
- `source_keys` declared anywhere but `references/sources.md` absent → FAIL
- Skip bidirectional Contributing files check for files that don't exist (caught by existence check) and for `references/sources.md` itself
### New report dimension: `Provenance`
- Always appears in the `Checked:` coverage line
- Script embeds full FAIL/INFO format including Why and Fix per finding
- INFO findings do not affect pass/fail verdict
### Updated result block format
```
PASS
PASS (N suggestions)
PASS · P info
PASS (N suggestions) · P info
FAIL (N fails · M suggestions)
FAIL (N fails · M suggestions) · P info
```
INFO is counted separately and never changes the PASS/FAIL determination.
## Changes required
- [x] `scripts/validate-provenance.sh` — new script with all checks above
- [x] `tests/validate-provenance.bats` — fixture-based tests covering: clean pass, missing slug, orphaned Contributing file, missing Research doc path, upstream mismatch both directions, `(none)` skip case, source_keys without sources.md
- [x] `skill-audit/SKILL.md` — add second script call to Step 1; add Provenance to coverage line; update result block format in Step 4
- [x] `skill-author/assets/templates/references/sources.md` — add `Research doc:` field; formalize comma-separated Contributing files; document `(none)` convention
- [x] `skill-author/SKILL.md` Step 5 — record `Research doc:` path when writing `references/sources.md`
- [x] Backfill `skill-audit/references/sources.md` — add `Research doc:` field to all entries
- [x] Backfill `skill-author/references/sources.md` — add `Research doc:` field to all entries
## Non-goals
- Requiring `references/sources.md` to be present — it is optional; only created when research input was provided
- Auto-detecting marketplace vs. normal `.agents` context — deferred; for now assume marketplace
## Prerequisite
Issue #4 must be merged first.
Claude
added this to the Kyberforge basics milestone 2026-06-26 20:34:19 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Add a
validate-provenance.shscript toskill-auditthat validates the sources provenance chain is complete and internally consistent. Also add a newProvenancereport dimension, update thesources.mdtemplate inskill-author, updateskill-authorStep 5 to writeResearch doc:fields, and backfill existing sources.md files.Background
The provenance chain runs in three stages:
/researchwrites topic files +sources.mdto a plugin-level output directory (e.g.plugins/<plugin>/docs/research/docs/<topic>/)/skill-authorreads those docs and builds the skill, recording provenance inreferences/sources.md(which skill files each source contributed to, and which research doc it came from) andsource_keysfrontmatter on each skill file (SKILL.mdandreferences/*.md)The chain is: research → plugin-level docs → skill. The plugin-level docs are not part of the skill — they live at the plugin level and are read as input during authoring.
Checks
New script:
scripts/validate-provenance.shAlways runs unconditionally (called from Step 1 of the audit alongside
validate.sh). Handles the "nothing to validate" case internally.Skill-level checks (FAIL):
source_keysentry inSKILL.mdmetadata has a matching slug inreferences/sources.mdsource_keysentry in eachreferences/*.mdfile (excludingsources.mditself) has a matching slug inreferences/sources.mdContributing filesinreferences/sources.mdactually exists in the skill directory — entries starting with(noneare skipped; multiple files are comma-separatedFILL IN:placeholders remain inreferences/sources.md(none)Contributing filesentry inreferences/sources.md: the listed file'ssource_keysincludes the parent slug (bidirectional check) — skip if file doesn't exist (already caught above) or if file issources.mditselfreferences/sources.mdhas aResearch doc:field pointing to the upstream plugin-level research sources fileUpstream checks (assume marketplace context for now):
references/sources.mdnot found in the upstream research sources.md declared byResearch doc:→ INFOreferences/sources.md→ FAILINFO (not FAIL):
references/*.mdfile (excludingsources.md) has nosource_keysfrontmatter whensources.mdis presentEdge cases:
source_keysdeclared anywhere butreferences/sources.mdabsent → FAILreferences/sources.mditselfNew report dimension:
ProvenanceChecked:coverage lineUpdated result block format
INFO is counted separately and never changes the PASS/FAIL determination.
Changes required
scripts/validate-provenance.sh— new script with all checks abovetests/validate-provenance.bats— fixture-based tests covering: clean pass, missing slug, orphaned Contributing file, missing Research doc path, upstream mismatch both directions,(none)skip case, source_keys without sources.mdskill-audit/SKILL.md— add second script call to Step 1; add Provenance to coverage line; update result block format in Step 4skill-author/assets/templates/references/sources.md— addResearch doc:field; formalize comma-separated Contributing files; document(none)conventionskill-author/SKILL.mdStep 5 — recordResearch doc:path when writingreferences/sources.mdskill-audit/references/sources.md— addResearch doc:field to all entriesskill-author/references/sources.md— addResearch doc:field to all entriesNon-goals
references/sources.mdto be present — it is optional; only created when research input was provided.agentscontext — deferred; for now assume marketplacePrerequisite
Issue #4 must be merged first.