Triggers & routing
- Trigger: module coverage, source coverage, tutorial grounding, module coverage, source coverage.
- Use when:
source-tutorialof C2, already hasoutline/module_plan.yml, need to confirm that every module can be traced back to sources. - Skip if: module plan or source ingest is incomplete.
- Network: none.
- Guardrail: only do grounding audit, do not write tutorial body.
Builds outline/source_coverage.jsonl, one coverage record per module.
Inputs
outline/module_plan.ymlsources/index.jsonlsources/provenance.jsonl
Output
outline/source_coverage.jsonl
Contract
Each module record must include:
module_idmodule_titlesource_idsand/or explicitgaps
Plus exactly one corpus-reconciliation record (record_type: corpus_reconciliation,
no module_id) listing ingested_source_ids, attributed_source_ids, and
unused_source_ids, with an explicit gaps entry whenever a source was ingested
but used by no module. A per-module audit alone cannot surface a source that
contributed to zero modules, so this record keeps an unused source explicit
instead of silently dropped.
Script boundary
scripts/run.py should:
- score module-to-source relevance
- choose a small source set per module
- record explicit grounding gaps when coverage is weak
- append the corpus-reconciliation record so unused ingested sources are flagged
Keep text matching and snippet scoring in shared tutorial tooling, not in the wrapper.
Acceptance
outline/source_coverage.jsonlexists- every module appears exactly once
- exactly one
corpus_reconciliationrecord accounts for every ingested source - missing grounding is explicit instead of silent
Non-goals
- context pack assembly
- tutorial prose