Contextfulv0.23.0

Docs / Guides

contract assurance · 80-formal.md · 81-engineering.md · 82-consumer.md · 83-gate.md · guide · card

Assurance

The problem assurance solves

A specification is only useful if the engine follows it. Assurance gathers three kinds of evidence, and each proves something different. Lean, a proof checker, proves properties of a model. A differential test checks that the engine agrees with the model on generated cases. Engineering checks test source changes and search quality. The assurance claim names what it covers and which assumptions it trusts (claim-sentence).

Flowchart diagram Flowchart, top to bottom. 7 nodes, 7 edges. specification → Lean models [modelled clauses] Lean packages: Lean models → assumption audit [theorems and assumptions]; → differential harness [reference answers] Rust engine: store engine → differential harness [engine answers] assumption audit → CI gate [audit verdict] differential harness → CI gate [agreement verdict] quality harness → CI gate [retrieval scores] Lean packages Lean models Rust engine store engine modelled clauses theorems and assumptions reference answers engine answers audit verdict agreement verdict retrieval scores specification assumption audit differential harness CI gate quality harness

Models and proofs

Authors write each model definition from the specification text and from no engine source (from-the-spec). Every definition is total, so the model answers every input (total-definitions).

The policy proofs cover combining enforcement layers. For example, every member layer admits a row the composed filter admits (composition-sound). Each theorem states its negative space: what it leaves open, such as whether execution reaches the filter at all (negative-space).

The protocol model describes how leases, fenced commits, pauses and crashes change state (protocol-model). A bounded check evaluates every invariant over every short step sequence and prints the shortest breaking one (protocol-check).

Why a successful build proves too little

Lean compiles a proof that still contains an unfinished step. The assumption audit therefore reads the compiled environment, not the build’s exit status (verdict-input). A proof depending on the hole assumption fails the audit (hole-assumption).

A theorem whose statement changed without its inventory entry fails too (statement-drift). A recheck rebuilds from pinned source in an environment holding no credential (credential-free).

Following one change

A contributor changes zone admission so the allow-set entry on-prem:* rejects on-prem:lab, a zone the specification admits (disjunctive).

Zone admission is one of the harness’s decision cases (decision-cases). The harness runs the reference binary, built from the model’s definitions, and the engine’s decision module on each generated case (harness).

The reference admits and the engine rejects. The harness shrinks the case to a minimal form and records it (minimized). Every later run replays that case before any fresh one (corpus-replay).

The full formal stage runs nightly, not on every change (formal-stage). A change merged between two nightly runs therefore holds no formal result until the next run.

The claim stays within its evidence. A composition proof offered as a mediation proof fails, because composition says nothing about whether every read passes the filter (mediation-from-composition).

Engineering checks

Enforcement and credential resolution each resolve to one implementation (one-home). Contributors and the gate run the same typed subcommands (one-path).

A change to Rust source adds a test that fails against the base commit (test-first). The gate runs its stages in a fixed order (stage-sequence). A shared target directory recompiles workspace packages per checkout (checkout-artifacts).

Search quality

Evaluation loads its corpus through the real store and retriever (through-the-store). A row a case forbids holds at zero percent of returned rows (forbidden-row-rate). A baseline update only moves entries in the improving direction (raise-only).

A backtest replays historical cases. The report places each case by its resolution instant relative to the reader model’s training cutoff (cutoff-slice). A split removes from training every case whose label interval overlaps a test case’s, and every case starting within the embargo span after a test fold ends (split).

Flowchart diagram Flowchart, top to bottom. 10 nodes, 10 edges. case set → Resolved before reader cutoff? [resolution minus cutoff]; → Where does the label fall? [label intervals] Resolved before reader cutoff? → exposed slice [before: exposed]; → unseen slice [after: unseen] exposed slice → leakage estimate [scores] unseen slice → leakage estimate [scores] declared reference → leakage estimate [discontinuity or control] Where does the label fall? → purged training cases [overlaps a test label]; → embargoed training cases [starts within post-fold embargo]; → training fold [clear of both] resolution minuscutoff before: exposed after: unseen discontinuity orcontrol scores scores label intervals overlaps a testlabel starts withinpost-foldembargo clear of both case set Resolved beforereader cutoff? exposed slice unseen slice declaredreference leakage estimate Where does thelabel fall? purged trainingcases embargoedtraining cases training fold

Forecast tracks keep separate scores and pool into no single figure (tracks-separate). The target ledger ties each measured target to the specification rule it serves (ledger).

Releases and consumers

contextful-ci tag creates a signed tag only after every release check clears; a dirty working tree fails first (dirty-tree). The conformance suite runs the released artifact through its public surfaces, outside a source checkout (suite).

A Cloudflare app ships through one hand-dispatched workflow whose single step is the command an operator runs locally (one-command); the deploy succeeds only once the app answers its expected status (health).