← Context From First Principles

The Complete Context System

The whole chain from available information to behavioural evaluation, what each part decides, what the project has shown about each, and where the difficult work now lies.

The book began with a developer’s eleven words and the organisation of information behind them, and asked how anyone would know whether changing the context had mattered. The answer it can now give is a system, and this chapter draws it once.

    flowchart TD
    A["Available information"] --> B["Candidate builder<br/>representations, eligibility judgements,<br/>requirements, floors"]
    B --> C["Context Compiler"]
    R["Request and policy<br/>budget, active scope"] --> C
    C --> D["ContextBundle + DecisionTrace<br/>or CompileFailure"]
    D --> E["Render"]
    E --> F["Runtime adapter<br/>injects one block"]
    F --> G["Model"]
    F --> H["Observer<br/>reads the assembled context"]
    G --> I["Behaviour"]
    H --> J["Reconciliation"]
    D --> J
    I --> K["Behavioural evaluation"]
    J --> K
    B:::open
    classDef open stroke-dasharray: 5 4
  

The dashed box is the part of the system that the book has argued for and not built. Everything else on the page exists, and has been checked to a stated degree. Where the checking stops is the subject of most of what follows.

Separations the book has earned

Each arrow above replaced a conflation that ordinary practice makes without noticing.

Information is not context: what a system could reach is not what a computation receives. Information is not a candidate: a candidate is one representation of it, with a cost, eligibility judgements and dependencies, and one content may have several. A candidate is not admitted: eligibility, requirements, budget and dependencies decide. What is admitted is not ordered, and what is ordered is not rendered, because the render adds a header, separators and labels that the candidates never declared. What is rendered is not transported: an envelope is added, and the injection can fail, duplicate or conflict. What is transported is not observed until something independent has seen it. And what was observed to arrive is not shown to be useful until behaviour has been compared.

Several smaller separations carry the same weight, and they are worth listing because prose collapses them so easily. A retention class says what may be done to an item under pressure; a requirement says whether this computation must include it. A token count is declared, estimated or reported by a provider. A reference costs what it costs to write, and its dependency-closed cost includes whatever resolves it. Creating a representation is a different act from selecting one. And an eligibility judgement that was supplied is different from one that was discovered.

What decides

The Context Compiler decides membership, representation and order for one computation, under explicit constraints. It takes a request, a list of candidates and a policy, and returns either a bundle with a trace of every decision or a named refusal. It removes candidates that are out of scope, out of date or unauthorised, and those whose form falls below their floor. It admits what must be present first, prices a candidate with what it depends on, keeps groups whole, chooses one form per content, stops when nothing earns admission, orders by role, renders exactly and checks the rendered cost.

It does not do the things that sit around it, and the boundary needs saying without softening. It does not discover scope, freshness or authority. It receives each as a yes or no with a reason and enforces it. It does not generate representations, summarise, expand or normalise content. It does not know what the model will find easy to read. It does not adapt to a provider’s cache, count tokens exactly, or optimise. And it does not judge whether an answer was useful.

Its role in a larger system is small on purpose. The measured architecture is a small deterministic core: candidate identity and provenance, explicit hard eligibility, explicit task requirements, legal representation constraints, dependency and group closure where declared, a finite budget, deterministic assembly, ordering and rendering, post-render validation, explicit failure and a trace. Everything else the book discussed is a conditional pass. Pruning, compaction, progressive fidelity, externalisation, recall, cache-aware rewriting, richer representation choice and coverage optimisation each activate only when their measured failure exists and their own experiment earns them. None of them has been shown to be unnecessary, and none has yet been earned. The absence of an experiment is a gap and not a negative result.

What can be shown before a model runs

Structural evidence is evidence about the bundle as an artefact, and it is the strongest the project has.

On the compiler’s own synthetic cases, fourteen of them at three budgets, the compiler gives the correct outcome on all forty-two: thirty-four bundles and eight explicit refusals. Simpler ways of building a bundle never refuse, so on the eight requests with no legal answer they produce one anyway. The gates account for the difference in legality. The same run shows the compiler still admitting a few distractors and two items a hidden ledger labels harmful, because legality was never a promise of usefulness. The compiler is deterministic, the same inputs give the same bundle and trace, and a separate checker recomputes legality from the inputs. A second implementation, in another language, reproduces the first’s outputs on all forty-two cases.

Two things keep that from being overclaimed. Parity is not correctness: the port reproduced two defects in the trace and ignored a policy setting, exactly as its reference did, and it took reading the trace as an auditor would to find them. The repair changed the meaning of two fields and enforced the setting, left selection alone, left the historical outputs alone, and moved the trace to a new schema. And structural evidence is silent about whether the judgements it was given were right. It shows that under supplied eligibility no illegal candidate was admitted. It does not show the supply was sound.

What can be shown about delivery

Transport evidence answers a different question: did the intended representation reach the runtime’s model-context boundary? Three sets of bytes travel, and they are not equal by design. The compiler’s render is embedded unchanged inside a transport block, which adds an envelope. The block is injected once. An observer that the injector does not control read the assembled context back, and a pure comparison found the block in it exactly once, with the compiler’s render recovered unchanged, in the right session, for the model that was asked for.

That claim was demonstrated on one trivial synthetic bundle, on one model, at one place. It stops at the host’s model-context hook. It does not reach the provider wire, provider-side rewriting, cache decisions or the model’s internal representation. It is qualified live evidence, and it is a precondition for behavioural evidence and not a part of it. The behavioural wave that ran without it produced twenty-four runs and no valid observation, which is the best evidence in the book that an instrument has to be shown alive in the run and not assumed from its installation.

What can be shown about usefulness

Behavioural evidence is where the book stops being able to claim much, and it is right that it should. On six synthetic tasks, with one reader recorded only by a moving name and one budget, changing only the bundle changed the reader’s parsed action on every task and its action name on four. The score improved on two tasks, worsened on one and was unchanged on three. Between the compiler’s bundle and a hard-gated greedy bundle, no decided action and no score changed. Between the compiler’s and the oracle’s, none changed either. One task, the qualification trap, failed under every supplied bundle, including the compiler’s and the oracle’s, while the reader with no context did not. The negative control failed.

Context can change behaviour without reliably improving it. That is the finding, and it is the counterweight to the structural result. The compiler’s extra machinery beyond the gates has earned construction-level reliability. It has not yet earned behavioural utility over a simpler rival. Those runs supplied the bundle as the reader’s prompt; they did not go through the live runtime, so the transport evidence does not cover them.

The four kinds of evidence, side by side

Kind The question What the project has Strength
Structural Was the bundle legal under the stated rules? 42-case conformance, six-strategy comparison, determinism, independent validation, cross-language parity substantial, synthetic, eligibility supplied
Transport Did the intended representation reach the observed runtime boundary? one live compile, inject, observe qualification; two earlier runtime qualifications, one failed and one passed, before the compiler was involved; one wave that shows what happens without qualification qualified, one trivial case, one boundary
Behavioural Did receiving it change the action or outcome, and for the better? a six-task matched run and a transfer probe that does not isolate reader dependence limited, one reader, one budget
Ecological Do these mechanisms and failures matter often in real use? none; the corpus of real sessions is empty open

The asymmetry is the honest final position. The kinds do not stand in for one another, and the strongest evidence is about the part of the system that matters least to a user: the artefact, not the effect.

The part that is still open

The compiler is now relatively well defined. The boundary in front of it is much less so.

AVAILABLE INFORMATION
        ↓
    ???  candidate builder  ???
        ↓
    ContextCandidates
        ↓
a well-specified compiler

Nearly every hard question left in the book sits in that gap. What information gets considered at all? Who judges scope, and from what? Who assesses freshness, against which source and which version? Who establishes authority, and how does that survive a summary that strips its provenance? Who generates the compact, anchor and reference forms, and how is a floor chosen for each content? How reliable are those judgements, and what happens to a bundle when one is wrong? Chapters 19 to 21 argue for what deriving authority, freshness and scope would need. None of it has been tested as a derivation, and no repository derives any of them. The compiler enforces whatever it is handed.

Behind that sits the question of policy. The compiler’s ranking within its lower classes puts relevance first and cost second, its threshold for what earns admission is a number in a policy file, and its choice of the cheapest legal form is fixed. Nothing shows any of these to be the best choice, and no universal policy has been shown to exist. Whether a reader does as well on the cheapest legal form of a required item as on a richer one is untested. And the middle chapters’ mechanisms, pruning, compaction, fading, externalisation and recall, are argued from the literature and unbuilt as passes.

What is and is not established

Established, to the degrees above: deterministic structural compilation; explicit failure with named reasons; budget compliance in the units the candidates declare; dependency and group handling; representation selection under a floor; conformance of the compiler to its own frozen cases; parity with the historical implementation, and the limits of parity; real injection into a live runtime; independent observation at the hook boundary; reconciliation of render, block and observed context; and a small matched demonstration that context can change behaviour without reliably improving it.

Not established: optimal context; a universal policy; behavioural benefit on every task, or on any real one; provider-wire identity; the best way to build candidates; that eligibility can be derived reliably; that the middle mechanisms are needed, or that they are not; and that any of the failures the synthetic cases were built to show occurs at any frequency in real work.

What a reader can build

The book was written so that its ideas do not depend on any one system, and a reader can use most of it without the software.

Capture what your own system sends, read-only, at the last point before the model, and count the request by source. State which kind of count each number is. Write down what your observer cannot see. Build candidates as representations with their own costs, eligibility judgements and dependencies, and put the judgement of scope, freshness and authority in one place where it can be argued with. Let a deterministic step decide membership, and let it refuse. Keep a trace. Deliver the result through something that can be independently observed, and prove that observer alive in every run that matters. Then, and only then, compare behaviour with the bundle as the one thing that changes.

Each of those is a small piece of engineering. None is a framework.

Where this leaves the argument

Context engineering is not primarily the problem of putting more information near a model. It is the problem of constructing the right bounded representation of available information for one computation, delivering that representation reliably, and measuring whether it helped. The book has separated those three problems and worked on each to a stated depth: the construction under explicit rules, the delivery to an observable boundary, and the measurement of effect on a small scale.

The difficult work that remains has become easier to see because it has been separated. It is constructing trustworthy candidates. It is establishing eligibility without pretending it can be derived by the mechanism that enforces it. It is learning policies that generalise beyond a handful of synthetic cases. And it is showing that any of this matters on real workloads, which needs a corpus the project does not yet have. Those are the questions the first principles lead to, and they are where the work goes next.

References

  • Project Context evidence register (companion repository, evidence/README.md). Every measured result cited in this chapter, by its short name: Compiler construction, Implementation parity, Live compile-to-observe qualification, Earlier runtime qualifications, Instrumentation failure, Matched behaviour and Reader-transfer probe. Identifiers, code revisions and artefact digests are held there and not in the text.
  • Project Context Compiler, Project Context OpenCode and Project Context. Source repositories, Apache-2.0 licence, first-party code by this book’s author: the deterministic compiler, the runtime adapter with its observer and reconciliation, and the research and evaluation repository. https://github.com/ernanhughes/project-context-compiler, https://github.com/ernanhughes/project-context-opencode, https://github.com/ernanhughes/project-context