Skip to main content

resolve_keep_indices

Function resolve_keep_indices 

Source
pub fn resolve_keep_indices(
    msgs: &[ChatMessage],
    tokens: &[String],
    keep_last: usize,
) -> Vec<usize>
Expand description

Resolve the full keep-set (SPEC.md TR-9 dev/01/dev/03): user-named addresses/paths (tokens) PLUS the deterministic always-keeps — the leading system prompt (if any) and the last keep_last messages — closed under tool-call/tool-result pairing so a kept call never dangles without its result (or vice versa). Pure function of msgs alone; canonical (sidecar) indices throughout.