Skip to main content

trim_to_recent_turns_with_crumb

Function trim_to_recent_turns_with_crumb 

pub fn trim_to_recent_turns_with_crumb(
    history: Vec<ChatMessage>,
    budget_tokens: usize,
    crumb_present: bool,
) -> TrimResult
Expand description

Crumb-aware variant of trim_to_recent_turns: when crumb_present is true the population is assumed to carry the synthetic breadcrumb immediately after the leading system messages. That breadcrumb is never counted as a turn boundary, never dropped, and never double-counted in dropped_messages. The owner flag decides, not message text.