Skip to main content

select

Function select 

Source
pub fn select(
    messages: &[MessageRecord],
    tail_turns: usize,
    keep_tokens: usize,
) -> SelectionResult
Expand description

Selects which messages to compact and which to retain.

§Arguments

  • messages - The full session message history, in chronological order.
  • tail_turns - Number of recent turns to preserve intact (default 2).
  • keep_tokens - Token budget for the retained tail.

§Returns

A SelectionResult with head (to compact), tail (to retain), and tail_start_id (first retained message ID).