Skip to main content

Module compression

Module compression 

Source

Structs§

AutoCompactor
rho > auto_threshold: collapse history entirely except last K turns, updating compression log.
CollapseCompactor
rho > collapse_threshold: drop oldest messages until within target. Selection via plan_drop_oldest; this executor only drains the chosen count.
CompressResult
Compression result returned by every compactor.
CompressionPipeline
Compression pipeline — operates on history partition but can reference full partitions.
MicroCompactor
rho > micro_threshold: replace tool results with a compact excerpt. Selection via [excerptable_tool_result_indices]; this executor only applies the excerpt.
SnipCompactor
rho > snip_threshold: cap each oversized message at per_msg_tokens.

Enums§

CompactionStep
A fully-specified compaction step the cache-aware planner emits; the executor applies it mechanically (all selection already done by the planner via the pure helpers above).

Traits§

Compressor
Compression strategy interface.

Functions§

plan_cache_cost
The prompt-cache-invalidation index of a whole plan = the earliest break across its steps (an earlier break invalidates everything after it, so the minimum dominates the cost). None means the plan is entirely prefix-safe and preserves the prompt cache — the cache-aware planner’s goal whenever the safe steps can free enough.
plan_drop_oldest
Pure selection (W1-1 collapse): how many of the oldest history messages to drop to bring the partition under target_tokens, never crossing the preserve-recent floor (keep messages). Returns (count, tokens_saved); the executor just drains count from the front. This is the decision the cache-aware planner reuses to “batch one big drop to target” rather than re-deriving the count inside the compactor.