Skip to main content

Module claims

Module claims 

Source
Expand description

Claim governance for token economics: no number about tokens, context or cost reaches a reader unless the evidence produced it.

Three checks, all deterministic and all run by majordomus economics check:

  • Bound claims. The methodology binds claims of docs/CLAIMS.yaml to metrics. A bound claim may be guaranteed only while its metric stands where the binding says — verified for sampled live evidence meeting the publication rule, measured for deterministic evidence — and while every suite behind that metric is current. Evidence that goes stale takes the guarantee with it.
  • Unbound claims. A guaranteed claim whose sentence says that tokens, context or cost go down has to be bound to a metric, or nothing would ever check it. A claim id that appears twice is refused too: a binding, a page and a gate would each read whichever copy they found first.
  • Unsupported quantities in prose. Every hand-written document, page and claim sentence is scanned for a quantity (a percentage, “N times fewer”, “half the tokens”) in the same sentence as a word of the economics vocabulary. Repository prose is hard-wrapped, so the scan reads paragraphs, not lines: a sentence wrapped over two lines is one sentence. Numbers about tokens are generated from evidence into generated artifacts; typed by hand, they are refused.

The check fails closed. Declarations it cannot read, a claims matrix it cannot parse and a repository git cannot list are findings, never an empty and therefore clean result.

use majordomus_cli::economics::claims::unsupported_quantity;
assert!(unsupported_quantity("Majordomus saves 50% of tokens.").is_some());
assert!(unsupported_quantity("Majordomus cuts cost by 3x.").is_some());
assert!(unsupported_quantity("The suite takes 50% longer on Linux.").is_none(), "no economics word");
assert!(unsupported_quantity("The context budget is 300 lines.").is_none(), "no quantity");

Structs§

EconomicsCheckInput
The input of economics.check: nothing to narrow; the check is over the repository. Unknown fields are refused rather than ignored, so a caller who tries to scope the check to a path learns that it cannot be scoped instead of reading a partial verdict as whole.
EconomicsCheckReport
The answer of economics.check, the same over the CLI, HTTP and MCP: how much was read and every refusal. ok is true exactly when findings is empty. scanned counts the hand-written files read, docs/CLAIMS.yaml included and generated files excluded; claims_checked counts the methodology’s claim bindings, whatever their status.
EconomicsFinding
One thing the check refuses. detail names the remedy, so a finding can be acted on without reading the methodology. A finding about a claim or a file rather than a line carries no line, and its JSON omits the key. The kinds:
ProseQuantity
A quantity prose_quantities found: the 1-based line the quantity starts on, the quantity as written, and whether it stands in a fenced code block. A quantity in a code block is still a finding — a pasted benchmark output is a number about tokens a person typed into the document — and the flag lets the finding say where it is.

Functions§

check
Run every check over the repository at root: the prose scan of scan_prose, and the claims of check_claims against a summary computed afresh by crate::economics::summarize, never a cached one. It never fails as a call: what cannot be read is a finding, and the report is ok exactly when no check found anything.
check_claims
Check the claims matrix against the methodology’s bindings and summary, and return how many bindings the methodology declares with every finding.
prose_quantities
Every unsupported quantity in the text of the file at path, read paragraph by paragraph so that a sentence hard-wrapped over several lines is read whole, with the line each quantity starts on. How lines group is decided by the file’s kind: Markdown and templates join consecutive non-blank lines, with each fenced code block, table row and heading a paragraph of its own and each list item starting a new one; TOML starts a paragraph at every key; YAML reads only the claim: and note: values, with their continuation lines. unsupported_quantity is the sentence-level test applied.
scan_prose
Scan the repository’s hand-written prose for unsupported quantities, and return how many files were read with every finding.
unsupported_quantity
The quantity in line that states something about token economics, if there is one: a number followed by %, %, percent, per cent, percentage points or pp, or a multiplier (3x, 3 × cheaper, 2 times fewer), in a sentence that also uses a plain word of the economics vocabulary; or a multiplier or fraction word (half, twice, a third) in a sentence that also says something went down. This reads one line as it stands; prose_quantities reads a whole file, with wrapped sentences joined.