Skip to content

What the context compiler selects, out of what it judged relevant, is counted in tokens of a named tokenizer and recorded, never estimated

For every issue of the repository's plan, majordomus economics measure asks the context compiler (majordomus devcontext) for the context of that work and counts, in tokens of a named and pinned tokenizer, what it judged relevant and what it selected. The result is recorded under .ai/repo/benchmarks/economics/runs/context/ with the revision, the tokenizer and a digest of the inputs it depends on.

declared statusdeclared status: guaranteed Declared deterministic and blocking, implemented, and naming the behavioural test that is to prove it. Whether a recorded run supports it is the evidence verdict, shown beside it.

recorded evidencerecorded evidence: not run Declared guaranteed, and not supported by a recorded run: the test is named, and no passing run of the current inputs is recorded. how evidence is recorded

The measurement is of selection, not of savings. `majordomus economics measure` records it; the metric carries its own statement of what it is not.

What it means

For every issue of the repository's plan, majordomus economics measure asks the context compiler (majordomus devcontext) for the context of that work and counts, in tokens of a named and pinned tokenizer, what it judged relevant and what it selected. The result is recorded under .ai/repo/benchmarks/economics/runs/context/ with the revision, the tokenizer and a digest of the inputs it depends on.

How it works

Each seed is compiled under the compiler's default budget. Every distinct file the compiler reached is read from disk once and counted with o200k_base (tiktoken-rs, pinned to one version). A candidate is a file the compiler judged relevant: selected, or left out only because the budget ran out. Files it reached and judged irrelevant are counted separately and never divided by. The metric context_reduction_ratio is the median over seeds of 1 - selected / candidate, derived from counted values. The compiler's own bytes-over-four estimate is recorded beside the count, so how far the budget's unit is from real tokens is itself a metric (context_cost_model_error).

Evidence is current while the compiler's code, the knowledge sources and the methodology are unchanged since it was recorded, and stale the moment any of them changes.

How to see it

majordomus economics measure --dry-run          # count, write nothing
majordomus economics explain context_reduction_ratio
majordomus economics summary --format json | jq '.context'

What it does not cover

It is context selection, not total token savings. It says what the compiler put in front of a worker out of what it found relevant; it does not say what a session consumed, and a session remains free to read anything. The tokenizer is not the tokenizer of every model. The metric states both in its own not field and warnings, on every surface.

Why it exists

A budget measured in bytes over four is a guess about tokens. Counting with a named tokenizer, recording the count with its revision, and marking it stale when the mechanism changes turns the compiler's selection into a measurement that can be checked and reproduced.

Detail rendered from docs/claims/context-selection-counted.md.

From the statement to the proof

  1. 1 · the public statement

    What the context compiler selects, out of what it judged relevant, is counted in tokens of a named tokenizer and recorded, never estimated

    Made on Economics, Projection.

  2. 2 · the canonical claim

    context-selection-counteddeclared status: guaranteed in docs/CLAIMS.yaml

    Defined in read it on this site · docs/ECONOMICS.md

  3. 3 · the implementation

    apps/majordomus-cli/src/economics/context.rs

  4. 4 · the test and the scenarios

    Test: test/cases/430_economics.sh

  5. 5 · the recorded runs

    recorded evidence: not run how evidence is recorded

Verify it yourself

The test runs in a disposable temporary repository and asserts the behaviour, not a string in the source.

from a clone of the repository
bash test/run.sh 430_economics

Where this claim is used

responsibilities it covers

Searches the titles and descriptions of every page this site publishes.