Example

Declare what must survive, then measure what did

Declare obligations before the transformation, assess a summary against them, and watch the check be probed by breaking a faithful output five different ways.

Every transformation creates an obligation: to measure what survived it. The chapter’s mechanism is to write the obligations down before the transformation happens, then assess the output against them as a three-valued profile — lost, survived, or not assessable — with no total score.

Run it

git clone https://github.com/ernanhughes/project-language.git
cd project-language
git checkout 329660f679a5a87831f91fe1430c20ac9360dda8
npm ci
npm run example:ch10

No model is called. The one-liner and the faithful rendering are both written by hand, and the repair loop at the end drives a scripted stand-in.

Expected outcome

The obligations are declared first, in plain language, and the declaration is what the output is later judged against:

...
declaration decl_d624f143bd3012cb, declared 2026-10-15T09:00:00.000Z
  [number] retries stop after three attempts
  [claim] idempotent requests are exempt
  [uncertainty] it is unclear how a third-party timeout is handled
  [provenance] the decision it comes from (ADR-17)

A fluent summary loses three of the four obligations, and the profile says what is not covered:

...
Preservation profile for one-liner against decl_d624f143bd3012cb
  SURVIVED       [number] retries stop after three attempts
  LOST           [claim] idempotent requests are exempt
  LOST           [uncertainty] it is unclear how a third-party timeout is handled
  LOST           [provenance] the decision it comes from (ADR-17)
  not covered: emphasis; truth of the source

The check is itself an instrument, so it is probed by breaking a faithful output — and it says what it misses:

...
  noticed      drop the sentence that carries it
  noticed      reverse the direction of the relation
  noticed      turn a hedge into a certainty
  noticed      change a number
  NOT NOTICED  swap a word for its opposite

And an instrument’s standing is not something a caller can assert:

...
  assess(..., "validated") with no validation behind it      → unvalidated
  assess(..., <validation of different obligations>)         → unvalidated
  assess(..., <validation of these obligations>)             → validated

Declaring an obligation

An obligation is plain language plus a criterion over the observed output. The criterion is what the check will actually look for:

export interface Obligation {
	id: string;
	dimension: Dimension;
	/** Plain language, written before the transformation. */
	statement: string;
	/** A verify criterion over the observed output. */
	criterion: VerificationCriterion;
	/** The lower-case regex sources the criterion requires, kept so the instrument can be probed. */
	patterns: string[];
	/** Relation obligations: the three parts, kept so a reversal can be tried. */
	parts?: { subject: string; verb: string; object: string };
	/** Anchored obligations: a short key phrase whose adjacent word pairs must survive, in order, within one sentence or line. */
	anchor?: { passage: string; min: number };
	/** mustNotSay only: a sample of the forbidden claim, so the instrument can be shown to notice it. */
	violation?: string;
}

The two obligation kinds that matter for the run are a pattern obligation and an anchored one. The anchored kind is the one that survives keyword stuffing:

export function mustKeep(id: string, dimension: Dimension, statement: string, passage: string, opts: { min?: number; patterns?: string[] } = {}): Obligation {
	if (id.includes(".")) throw new Error("an anchored obligation id cannot contain a dot: " + id);
	const min = opts.min ?? 0.66;
	const patterns = (opts.patterns ?? []).map((p) => p.toLowerCase());
	const anchorLeaf: EvidenceFieldCriterion = { kind: "evidence_field", path: "observation.anchors." + id, operator: "GTE", expected: min, evidence_kind: "structured_observation" };
	return { id, dimension, statement, criterion: all([anchorLeaf, ...patterns.map((p) => leaf("MATCHES", p))]), patterns, anchor: { passage, min } };
}

And the standing of the instrument is resolved, never taken on trust:

export function resolveInstrument(declaration: Declaration, instrument: InstrumentStatus | InstrumentValidation): InstrumentStatus {
	if (typeof instrument === "string") return instrument === "validated" ? "unvalidated" : instrument;
	return instrument.obligations_sha256 === declaration.obligations_sha256 ? instrument.status : "unvalidated";
}

Mechanism and limitations

Documented: the three-valued outcome, the six dimensions, the two things explicitly not covered (emphasis, truth of the source), and the scope note — “It says nothing about whether the source was right” — are in core/preservation/src/index.ts.

Observed: the run above. The one-liner lost three of four obligations; the faithful rendering lost none; the instrument probe noticed four of five mutations and did not notice a word swapped for its opposite; a bare "validated" was refused and a validation of a different obligation set was refused. The run also records the history: the first probe missed a reversed relation and a hedge turned into a certainty, and the report was made order-, negation- and hedge-aware in response.

Not shown. That report still cannot see one word swapped for its opposite inside a long sentence, and it reads a faithful paraphrase as lost. Anchoring defeats a bag of words but cannot tell what the sentence around a copied phrase now says: copying the key phrases in order around nonsense still passes. Pattern obligations are source-independent and can accept a negated claim. Emphasis and the truth of the source are not covered. The addition check is a heuristic for numbers and absolute words. An obligation with no probe that can be applied to it keeps the check unvalidated, and a forbidden-claim obligation with no sample of the forbidden claim cannot be probed at all.

Preservation is not truth: a false claim, faithfully kept, reports SURVIVED.

Canonical source and the preservation module .

Understand this example

Copy this prompt into your AI tool. No code runs here.

Apply this example

Copy this prompt into your AI tool. No code runs here.