pub struct FormatMetadata {Show 19 fields
pub raw_chars: usize,
pub output_chars: usize,
pub pre_trim_chars: usize,
pub estimated_tokens: usize,
pub compression_ratio: f32,
pub format: String,
pub truncated: bool,
pub total_items: Option<usize>,
pub included_items: usize,
pub chunked: bool,
pub total_chunks: usize,
pub chunk_number: usize,
pub provider_pagination: Option<Pagination>,
pub provider_sort: Option<SortInfo>,
pub dedup_savings_pct: f32,
pub encoder_savings_pct: f32,
pub combined_savings_pct: f32,
pub baseline: String,
pub tokenizer: String,
}Expand description
Metadata about formatting result — compression stats, token estimates.
Per Paper 2 §Savings Accounting, every quoted savings number must
distinguish three orthogonal sources and name the baseline/tokenizer
against which the percentages are taken. The split fields below
(dedup_savings_pct, encoder_savings_pct, combined_savings_pct,
baseline, tokenizer) encode that contract on the live response.
For typed-domain transforms (issues / merge_requests / …), the
encoder runs without an L0 dedup hop, so dedup_savings_pct == 0.0
and combined == encoder. The cross-turn dedup contribution is
reported separately by devboy-mcp::layered::SessionPipeline via the
telemetry sink.
Fields§
§raw_chars: usizeSize of raw JSON input (UTF-8 bytes)
output_chars: usizeSize of formatted output (UTF-8 bytes)
pre_trim_chars: usizeSize of TOON/JSON output BEFORE budget trimming (UTF-8 bytes). If no trimming occurred, equals output_chars. toon_saved = raw_chars - pre_trim_chars trimmed_chars = pre_trim_chars - output_chars
estimated_tokens: usizeEstimated token count under the active tokenizer.
compression_ratio: f32Compression ratio: output_chars / raw_chars (< 1.0 = savings)
format: String§truncated: boolWhether output was truncated by budget trimming
total_items: Option<usize>Total items before truncation (e.g., 50 issues)
included_items: usizeItems included after truncation (e.g., 20 issues)
chunked: boolWhether response was split into chunks (budget exceeded)
total_chunks: usizeNumber of chunks generated (1 = no chunking, >1 = chunked)
chunk_number: usizeWhich chunk was requested (1 = first/default, >1 = navigation)
provider_pagination: Option<Pagination>Pagination metadata from the provider (offset, limit, total, has_more)
provider_sort: Option<SortInfo>Sort metadata from the provider (current sort, available sorts)
dedup_savings_pct: f32L0 dedup savings as a fraction of baseline tokens (0.0 = no
dedup hit on this response). Always 0.0 on the typed-domain
path; populated by the MCP-server’s layered pipeline when a
hint is emitted.
encoder_savings_pct: f32L1/L2 encoder savings as a fraction of baseline tokens, computed
over the L0-miss portion of the response. Equals
1.0 - encoded_tokens / baseline_tokens for the typed-domain
path.
combined_savings_pct: f32Multiplicative combination of dedup and encoder savings, per
the §Savings Accounting reporting rule: combined = dedup + (1 - dedup) * encoder.
baseline: StringBaseline against which the percentages are taken
(e.g. "json_pretty", "json_compact", "toon"). Required by
the reporting rule — savings without a named baseline are not
comparable across systems.
tokenizer: StringTokenizer used to compute estimated_tokens and the savings
percentages above (e.g. "o200k_base", "cl100k_base",
"heuristic").
Trait Implementations§
Source§impl Clone for FormatMetadata
impl Clone for FormatMetadata
Source§fn clone(&self) -> FormatMetadata
fn clone(&self) -> FormatMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more