Skip to main content

Module control

Module control 

Source
Expand description

Context control ledger.

Pure typed model of the context working set: candidate/selected items, model context limits, token budgets, and diagnostics.

Structs§

ContextBudget
Token budget derived from ModelContextLimits.
ContextCounts
Visibility counts for a ContextLedger.
ContextDiagnostic
A diagnostic about context or model-limit state.
ContextItem
A single context source considered for the working set.
ContextLedger
The context ledger: all candidate/selected items, the budget, and diagnostics for a turn.
LiveModelMetadata
Live provider metadata translated into the neutral limits shape at the adapter boundary.
ModelContextLimits
Provider-neutral model context limits.
ModelLimitOverride
User-supplied model limit override parsed from [model_limits."provider/model-id"].

Enums§

ContextItemKind
Kind of context a ContextItem represents.
ContextVisibility
Inclusion status of a ContextItem in the current working set.
DiagnosticSeverity
Severity of a ContextDiagnostic.
ModelLimitConfidence
Confidence in a ModelContextLimits value.
ModelLimitSource
Provenance of a ModelContextLimits value.

Constants§

AUTO_COMPACTION_RATIO
Fraction of the available input budget above which auto-compaction may trigger after normal eviction and summary candidates.
FALLBACK_CONTEXT_WINDOW
Conservative fallback context window when no model metadata is available.
FALLBACK_MAX_COMPLETION_TOKENS
Conservative fallback max completion tokens when no metadata is available.
FALLBACK_RECOMMENDED_COMPLETION_TOKENS
Conservative fallback recommended completion tokens when no metadata is available.
PROVIDER_OVERHEAD_TOKENS
Reserved provider overhead (tokens) subtracted from the input budget.
TARGET_BUDGET_RATIO
Fraction of the available input budget that selection targets.
TOKEN_BYTES_DIVISOR
Conservative bytes-per-token divisor used until provider tokenizers exist.
TOKEN_ITEM_OVERHEAD
Fixed overhead added to every item’s token estimate.

Functions§

estimate_tokens
Conservative token estimate: ceil(utf8_bytes / 3) + 16.
item_id_for_path
Generate a stable context item id for a file-backed source.
item_id_for_session_range
Generate a stable context item id for a transcript/session source range.
render_ledger_summary
Render a compact user-visible ledger summary line.
render_model_dashboard
Render a compact model-visible context dashboard.