pub struct CompactedContext {
pub tokens_before: u64,
pub tokens_after: u64,
pub tokens_saved: u64,
}Expand description
Context for LoopObserver::on_compaction.
Reports the estimated token counts before and after compaction and the number of tokens saved.
Fields§
§tokens_before: u64Estimated token count before compaction.
The payload estimate before the compactor ran — the history plus
the per-request overhead (system prompt, tool schemas) —
reconstructed from tokens_after + tokens_saved.
tokens_after: u64Estimated token count after compaction.
The payload estimate of the compacted history plus the same overhead. Transient context (contributors, retrieved memories) is not part of it — a retried turn regenerates its own, so this number does not predict the next request’s size when transients ride it.
tokens_saved: u64Estimated tokens saved by compaction.
tokens_before - tokens_after, the net reduction achieved by
the compactor.
Trait Implementations§
Source§impl Clone for CompactedContext
impl Clone for CompactedContext
Source§fn clone(&self) -> CompactedContext
fn clone(&self) -> CompactedContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more