Skip to main content

truncate_transcript_to_turn

Function truncate_transcript_to_turn 

Source
pub fn truncate_transcript_to_turn(
    session_dir: &Path,
    cutoff_turn: usize,
) -> Result<TruncateStats>
Expand description

Truncate transcript.jsonl (and the session’s .meta.json message_count) so that only the messages from turns 0..cutoff_turn survive.

“Turn N” is defined as the N-th non-system, non-tool user message in the transcript (0-indexed). The system prompt (if any) and any seed messages preceding the first user turn are always preserved.

Used by recursive sessions rewind --to-turn N to keep transcript state in sync with the workspace state restored from a checkpoint.