Module context

Module context 

Source
Expand description

Context window management defaults

Constantsยง

AGGRESSIVE_PRESERVE_RECENT_TURNS
Maximum number of recent turns to keep when aggressively reducing context
CHAR_PER_TOKEN_APPROX
Approximate character count per token when estimating context size
CONTEXT_ERROR_RETRY_LIMIT
Maximum number of retry attempts when the provider signals context overflow
DEFAULT_MAX_TOKENS
Default maximum context window (in approximate tokens)
DEFAULT_PRESERVE_RECENT_TURNS
Default number of recent turns to preserve verbatim
DEFAULT_TRIM_TO_PERCENT
Trim target as a percentage of the maximum token budget
MAX_TRIM_RATIO_PERCENT
Maximum allowed trim percentage (prevents minimal trimming)
MIN_PRESERVE_RECENT_TURNS
Minimum number of recent turns that must remain after trimming
MIN_TRIM_RATIO_PERCENT
Minimum allowed trim percentage (prevents overly aggressive retention)