Skip to main content

Module context

Module context 

Source

Structs§

ByteCounter
ContextBudget
ContextPacket

Traits§

TokenCounter
Inject the selected model’s real tokenizer for token-denominated budgets. The built-in ByteCounter is deliberately BYTE-denominated, not chars/4.

Functions§

compile_context
Whole-entry packing. Checks the actual escaped envelope, including overhead. No entry is cut mid-negation or mid-JSON. This packet belongs in append-only tool/history context, never a rewritten system prompt on every turn.