Script library

Every script in this library, in pipeline order. Each page shows what the script does, how to run it, and its full source code.

These pages are generated from the files in scripts/. Edit a source file and run python3 scripts/site/sync.py --write; never edit a page here by hand.

ID Title Purpose
X-S1-01 Blueprint check Check a weighted blueprint JSON file for the errors and warnings described below, and print the domain by cognitive level cross-tab.
X-S1-02 Deduplicate search candidates Group candidate search records that likely describe the same document, keep the most complete record from each group, and flag records older than a minimum year for a person to review.
X-S1-03 Run a search plan’s queries one at a time Run every query in a search plan against one backend, one query in flight at a time, retry a transient failure, open a circuit breaker after repeated failures, and print a manifest line for each query.
X-S1-04 Conversion quality check Check a converted Markdown file against a second, independently produced plain-text copy of the same document, to catch common conversion problems before anyone reads the converted copy.
X-S1-05 Injection screening scanner Scan converted and original source files for prompt-injection patterns and print one line per finding. Looks for override phrases, sentences that address an assistant, model, reviewer or summarizer with a steering verb, invisible or bidirectional control characters (including ones written as HTML character references), hidden HTML carriers, data URIs and long encoded runs. Never decodes or acts on the matched text; it only reports where it is.
X-S1-06 Concept list lint Check a per-source concept JSON file for name and definition lengths, relation types, relation targets and quotes, duplicate names, near-duplicate concepts, and an unusual average number of relations.
X-S1-07 Quote bank check Check every quote in a distillate’s quote bank against a source file, after normalizing typography on both sides, and print one line per quote with a pass or fail reason.
X-S1-08 Knowledge-item dedupe and mint Group draft knowledge items into canonical items, minting one id per group, then shortlist likely-but-uncertain duplicates, including a match across two different sources, for a person to read and decide.
X-S1-09 Concept graph check Check a concept-map catalog JSON file for cycles, dangling prerequisites, out-of-range tiers and duplicate node ids, then print a topological order and a tier-count summary.
X-S1-10 Gap check Flag each blueprint objective whose supported_by list has fewer entries than a minimum source count, and print a summary line.
X-S2-01 Chapter structure check Check a chapter draft Markdown file’s H2 headings, the objectives list under Learning Objectives, and the Content section’s lab or formative-check heading, then print a summary line.
X-S2-02 Condensation check Check a condensed passage against its original: how much shorter it is, and how much each of two readability scores moved.
X-S2-03 Readability report Print a text file’s Grade Level and Reading Ease scores against target bands, each clearly labelled, and never fail on its own.
X-S2-04 Prerequisite check Check, section by section, whether every concept a section requires was already taught by that point, and at a tier no higher than the concept map’s own tier for it.
X-S3-01 Claim source check Check whether every claim in a chapter’s claim list cites a source id that is actually present among the admitted sources, and fail loudly, rather than silently, if no admitted sources are found at all.
X-S3-02 Review record check Check a set of Layer 2 review flags: that each status is one of the four allowed values, that every flag gives a reason, and that a flag whose status calls for a suggestion has one.
X-S3-03 Citation fidelity check Check that every claim’s quoted phrase is an exact substring of its named source file, across a whole folder of admitted sources.
X-S3-04 Source tier check Print each admitted source’s own credibility tier, then warn if too large a share of them sit at Tier 3 or below.
X-S5-01 Concept item check Check an assessment concept item JSON file for a malformed id, a duplicate id, or fewer than two misconceptions, then print a summary.
X-S5-02 Stem plan check Check a chapter’s stem plan JSON file against its own assessment concept items: whether each planned row’s concept-item count matches its own difficulty’s range, whether every concept item id a row names actually exists, and how far the plan’s own overall difficulty mix sits from the reference implementation’s 30/50/20 split.
X-S5-03 Format rules check Check a stems JSON file against this guide’s own format rules for a finished, assembled test question: single-best-answer only, no negative stem, no “all of the above” or “none of the above” option, a distractor named to exactly one misconception, three to four distractors, and option lengths that do not give the answer away.
X-S5-04 Bank composition check Check a bank composition file’s per-domain item counts against a blueprint’s own weights, and its bank-wide difficulty split against the reference implementation’s 30/50/20 split.
X-S5-05 Answer key check Check an answer key JSON file against a stems JSON file: every stem id in the key resolves to a real stem, and every answer letter the key uses (a correct answer or a feedback key) is a real option for that stem, matching that stem’s own real correct answer.
X-S5-06 Delivery coverage check Flag each stem a finished bank actually holds that is not assigned to any deliverable kind in a delivery manifest, and print a summary line.
X-CA-01 Schedule check Check a study-schedule JSON file for the errors and warnings described below: that every chapter’s reading and active-learning minutes sum to its own stated total, and that no lower importance-tier chapter is given strictly more total time than a higher-tier chapter.
X-DL-01 Slide notes check Check a slide-notes Markdown file against the schema described in “Delivery: slides and infographics”: a chapter heading; one or more “## Slide N:” sections, each with 4 to 7 flat bullets; a bolded “**Presenter Script:**” block of 150 to 250 words; and, where present, a well-formed “References:” block.
X-DL-02 Volume manifest check Check a proposed chapter-to-volume manifest for an off-convention chapter id, a section id that does not reset at its own chapter’s boundary, and a volume whose chapters are not in numeral-aware order.
X-OP-01 LLM adapter with mock and OpenAI-compatible providers Give every script one function, complete(prompt), that returns text from a language model. The default mock provider is deterministic and offline, so tests and dry runs need no network and no key.
X-OP-02 Run record check Check a run record JSON file’s own required core, its breakdowns[] scale values, and whether a declared category is missing an explicit zero row.
X-OP-03 Citation key check Check a body-text excerpt’s citation keys against a reference list, in both directions: a key used in the text but not defined in the reference list is an error, and a key defined but never used is a warning.
X-OP-04 Hand-off completeness check Check a hand-off document JSON file for the five required structured fields described below, and flag a purely narrative hand-off (free text, with none of them) as a finding rather than accepting it silently.
X-OP-05 Completion signal check Check a batch of worker output files against a declared completion test (required fields present and non-empty), so a file’s mere existence, or a file merely being non-empty, is never mistaken for proof that the work behind it is actually finished.

Table of contents


To the extent possible under law, copyright and related rights in this work are waived under CC0 1.0 Universal.

This site uses Just the Docs, a documentation theme for Jekyll.