pub struct PostCompactStats {
pub total_messages: usize,
pub estimated_tokens: u64,
pub tokens_saved: u64,
pub percent_saved: u8,
}Expand description
Conversation statistics captured after compaction.
A summary of the conversation’s shape after compaction completes, together
with how much the pass reclaimed. Captured by
ContextManager::build_telemetry
and bundled into CompactTelemetry::post_compact.
Fields§
§total_messages: usizeTotal number of messages after compaction.
The size of the compacted message list. Smaller than the pre-compaction
total_messages when compaction
removed or summarized messages; equal when it made no change.
estimated_tokens: u64Estimated token count after compaction.
The post-compaction token estimate, comparable to
estimated_tokens from the
pre-compaction snapshot. The difference is tokens_saved.
tokens_saved: u64Tokens removed by compaction.
How many tokens the pass reclaimed: the pre-compaction estimate minus the post-compaction estimate. Saturates at zero, so it never goes negative even if a summary injection made the conversation larger.
percent_saved: u8Percentage of tokens saved (0–100).
tokens_saved as a share of the pre-compaction
estimate, expressed as a whole-number percentage. Clamped to 0..=100;
0 when nothing was saved or when the pre-compaction estimate was zero.
Trait Implementations§
Source§impl Clone for PostCompactStats
impl Clone for PostCompactStats
Source§fn clone(&self) -> PostCompactStats
fn clone(&self) -> PostCompactStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more