Skip to main content

Module context

Module context 

Source
Expand description

Resident context as paged memory (PSP-10 Definition 6, system 24).

The conversation projection is the backing store, not the prompt. Pages are immutable and content-addressed; the mandatory dependency closure is pinned; optional synopsis frames are chosen by deterministic greedy weighted coverage (submodular, so greedy earns the 1 - 1/e factor on the declared labels — a claim about labels, never about sufficiency). An infeasible mandatory closure makes no model call.

Structs§

ContextBudget
Definition 6’s reserves over one route’s context window.
ContextPage
One immutable, content-addressed context page.
DependencyEnv
The live state pages are validated against.
ResidentContext
The resident pages of one request, in their ledgered order.

Enums§

ResidentOutcome
The assembled resident set for one model request, or the recorded refusal when the mandatory closure cannot fit.
StateDependency
The explicit state a page depends on. The assembler checks it against the current branch before making the page resident; a state change invalidates the page, it never silently rewrites it.

Functions§

assemble_resident
Assemble the resident context per Definition 6.
mandatory_closure
Compute the mandatory dependency closure over pages starting from the mandatory ids, following depends_on transitively. Order: the input page order, restricted to closure members (deterministic).
resident_page_digest
The canonical digest over a resident page-id sequence — the single rule shared by assembly and any post-assembly refit, so a fitted set and an assembled set with the same pages carry the same digest.
select_working_set
Deterministic greedy weighted-coverage selection of at most slots synopsis frames. Ties break by page id (the content hash), so identical inputs select identically.