feat: skill-audit — validate sources provenance chain #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.