Skip to main content

default_compact_threshold_chars

Function default_compact_threshold_chars 

Source
pub fn default_compact_threshold_chars(model: &str) -> usize
Expand description

Compute the default compaction character-count threshold for a model.

Strategy (mirrors fake-cc getAutoCompactThreshold):

  1. Start from the model’s context window in tokens.
  2. Reserve 20 000 tokens for the compaction summary output.
  3. Take 80 % of the remainder as the trigger point (leaves a comfortable 20 % buffer before the hard limit is hit).
  4. Convert tokens → characters using a conservative 4 chars/token ratio.