Skip to main content

Module model_context

Module model_context 

Source
Expand description

Typed incremental ModelContext / WorldState fragments.

CodeWhale already assembles prompts most-static → most-volatile for prefix caching (prompts.rs). This module adds the missing identity layer: each volatile concern is a capped, marked fragment with render_diff so an environment or agent-topology change does not rebuild unrelated material.

The constitution / mode base stays outside WorldState and remains the cache-stable prefix. WorldState owns only the mutable mid-session layers.

Structs§

ModelContextFragment
One capped WorldState section with a stable marker and content hash.
WorldState
Mutable mid-session context layer living below the constitution prefix.
WorldStateSnapshot
Constitution (cache-stable) + WorldState (volatile) assembly point.

Enums§

FragmentId
Stable identity for a WorldState concern. Markers are public contract — do not rename without a migration note (prefix-cache + tests pin them).
FragmentRender
Result of comparing a fragment against its previous render.
FragmentRole
Explicit role of a fragment relative to the cache-stable constitution.

Constants§

DEFAULT_FRAGMENT_MAX_BYTES
Re-export the core hard caps — single source of truth.