Expand description
Pure builders for prefire two-pass compaction.
Pass1 summarizes ~95% of history (by estimated-token weight) -> NOTE₁.
Pass2 rewrites NOTE₁ + the ~5% tail into the successor-visible NOTE₂.
Sampling lives in super; this module has no I/O.
Structs§
- TwoPass
Split - Result of splitting a conversation for two-pass compaction.
Constants§
- TWO_
PASS_ DEFAULT_ SPLIT_ FRACTION - Default history fraction covered by pass1; the remainder is the blocking pass2 tail, so keep it small (prod pass2 latency is dominated by tail prefill).
Functions§
- build_
two_ pass_ pass1_ history - Pass1 sample history:
prefix+ compaction instruction user turn. - build_
two_ pass_ pass2_ history - Pass2 sample history: system (from prefix) + NOTE₁ carrier + tail + special turn.
- fingerprint_
prefix - Cheap fingerprint of a conversation prefix for prefire NOTE₁ validity. A mismatch means the prefix changed (edit / rewind / branch) since pass-1, so the cached NOTE₁ no longer summarizes the current prefix.
- note_
for_ two_ pass_ pass2 - Prefer a substantive
<summary>inner for NOTE₁; otherwise the full pass1 response. - split_
conversation_ for_ two_ pass - Split
conversationinto pass1 prefix / pass2 tail by estimated-token weight.