Skip to main content

Module context_policy

Module context_policy 

Source
Expand description

Pure, task-aware context pressure policy. No I/O, clocks, prompts, or tools.

Pressure is preparation, not a percentage-based stop. Existing execution can continue through the warning band, but a new task or execution after a plan should start in fresh context. At rollover only a bounded Plan/WrapUp extension is allowed; provider capacity always takes precedence.

The host owns token accounting and safe session replacement. Assess before each model round, then persist assessment.next_state at that admission checkpoint (not for UI-only polling). It charges one round for each bounded extension. Keep that state across phase reports and mode changes; reset it only after successful context replacement. Neither phase reports nor these decisions authorize tools, disclosures, or mutations of session history.

Structs§

ContextAssessment
ContextBudget
Host-supplied, conservative accounting for the next request.
ContextState
Per-context state. Private counters prevent phase reports from replenishing the allowance. The host must preserve this state across model rounds.
ContextThresholds

Enums§

ContextAction
ContextBand
ContextReason
WorkPhase
Advisory task phase. A report is not evidence of authorization or capacity.

Functions§

assess_context
Pure assessment, independent of UI, model prose, and tool authority. Hard capacity wins even in Off mode. Invalid programmatic configuration fails closed; config-file validation normally catches it before this call.