Quality system
Executable guards encode conventions that matter: reference integrity, naming rules, schema truthfulness, and site link integrity. Recurring authoring mistakes become named anti-patterns, mechanical guards, and baselines that ratchet toward zero.
For contributors. Guards live in guards/ as npm run check:*; tests run under Vitest in tests/.
The guard suite
Guards are TypeScript programs under guards/ that walk the pointed corpus or this site's HTML and report violations. Each convention named in a specification or architecture page has a matching check — the spec defines the rule; the guard enforces it mechanically. Run them with npm run check:<name>; a clean tree always yields the same result.
guards/ and in the spec pages that name them — for example Workflows, State, Resolution, and Fidelity.npm test when a live corpus is present; a corpus tree may carry its own verify job that walks the registry; engine verify runs typecheck, check:schemas, the tool-call-shape guard, test:ci, and the fixture delivery gate; and deploy-docs rebuilds the generated regions and checks them for drift.Most guards are hard-zero — any finding fails the run. Where a guard measures debt the corpus already carries, every finding is triaged once by hand in a committed file that records a verdict and a named rationale against each one: harmless by design, a real seam accepted for now, or a live bug that keeps the guard red until it is fixed. There is no re-snapshot flag, because classifying a finding is a judgement rather than a regeneration — and an entry that stops matching anything is reported too, so a seam cannot leave the ledger by going quiet. The full command list is in package.json.
The test architecture
The Vitest suite is organized around what could break:
- Unit coverage of the machinery — schema validation and generation, every loader, and the session store's sharp edges: HMAC sealing, index derivation, collision handling.
- Fidelity behaviour — the runtime validators, binding provenance, fetch observability (including
technique_bundledcoverage), reference-not-repeat delivery, and trace-token signing, each tested as an observable contract rather than an implementation detail. - End-to-end execution —
mcp-server.test.tsdrives real tool calls; a deterministic walker (tests/e2e/walker.ts) drives the all-workflows walk, which, when a corpus checkout is present, walks every reachable activity of every workflow through the live server in graph mode — each activity loads and its technique references resolve, and no steps run. A corpus verify job walks the registry on that tree's pull requests. - Documentation —
site.test.tschecks the generated regions for drift, as described below, and that every page carries the global navigation, making stale documentation a red build. - Agent smoke runs —
tests/smoke/drives a real agent through a workflow for the behaviour no deterministic walk can check: whether the instructions actually steer a model.
Generated, then guarded
Two artifacts are machine-derived from the source, and both are guarded against drift rather than trusted to stay fresh. The documentation site itself follows the same pattern — hand-authored pages with generated API regions — and check:site / check:svg keep links and diagrams honest:
The same discipline extends to deployment: the GitHub Pages workflow rebuilds the generated regions and fails if the committed pages have drifted, so the deployed site is exactly the checked, committed one. The job typechecks the server source before it rebuilds.
Next
Where this machinery lives in the server is server anatomy; how runs are kept on-script at runtime is fidelity.