Skip to main content

build_handoff

Function build_handoff 

Source
pub fn build_handoff(
    msgs: &[ChatMessage],
    keep_tokens: &[String],
    keep_last: usize,
    objective: Option<&str>,
    draft_objective: bool,
    summarizer: Option<&dyn SpanSummarizer>,
) -> Result<HandoffResult>
Expand description

Build a handoff projection over msgs (the canonical, full-fidelity session messages — e.g. sidecar.messages). SPEC.md TR-9: produces a new PROJECTED continuation — banner + objective + curated keep-set, with every other turn covered by one TurnsCleared span per gap between kept turns — over the SAME sidecar (this function never touches a sidecar or disk at all; persisting HandoffResult::log/view is the caller’s job, e.g. supercode handoff’s CLI handler).

keep_tokens are --keep selectors (addresses, address ranges, or file paths/substrings); keep_last is the deterministic always-keep tail length (SPEC.md dev/03, alongside the always-kept leading system prompt). objective/draft_objective/summarizer implement SPEC.md dev/05 (see resolve_objective).