Skip to main content

worth_repacking

Function worth_repacking 

Source
pub fn worth_repacking(
    system: Option<&Value>,
    messages: &[Value],
    cached: usize,
) -> bool
Expand description

Live repack gate (pre-compression). A cold-prefix repack only pays when the cacheable prefix (system + cached messages) is large enough that the provider will actually cache the re-seeded version; below MIN_CACHEABLE_TOKENS the repack just churns the conversation’s cache key. Applied as an extra AND-condition on the existing repack decision, so the policy can only make repacking more conservative — never trigger a rewrite that would not have happened.