Skip to main content

Module context

Module context 

Source

Structs§

ContextFootprint
PruningConfig
PruningResult

Enums§

CompactionStage
Progressive compaction stages, ordered from least to most aggressive.
ComplexityLevel

Functions§

build_compaction_prompt
Build a summarization prompt from trimmed messages.
build_context
Assembles context messages within the token budget for the given complexity level.
build_context_with_budget
Like build_context but uses the supplied budget configuration.
build_context_with_budget_footprint
Like build_context_with_budget but also returns token/depth accounting.
classify_context_snapshot
Classify token allocation from finalized messages.
compact_to_stage
Apply progressive compaction to a slice of messages at the requested stage.
compress_context
Compress assembled context messages using the PromptCompressor.
count_tokens
determine_level
determine_level_with_minimum
Determine complexity level with an enforced minimum floor. Channel-sourced messages use this to avoid L0 budgets that cause personality degradation with large FIRMWARE.toml files.
estimate_tokens
Rough estimate: ~4 characters per token.
extract_trimmable
Extract messages that would be trimmed (for summarization).
inject_instruction_reminder
Inject an instruction anti-fade micro-reminder into the message list.
insert_compaction_summary
Insert a compaction summary as a system message after the original system messages.
needs_hard_clear
needs_pruning
soft_trim
Soft trim: remove oldest non-system messages while preserving the most recent N.
token_budget
token_budget_with_config