pub mod agent_prompts;
pub mod counter;
pub mod dictionaries;
pub mod engine;
pub mod mcp_compress;
pub mod pipeline;
pub mod quality;
pub mod residual;
pub mod rules_inject;
pub mod scoring;
#[derive(Debug, Clone)]
pub struct TerseResult {
pub output: String,
pub tokens_before: u32,
pub tokens_after: u32,
pub savings_pct: f32,
pub layers_applied: Vec<&'static str>,
pub pattern_savings: u32,
pub terse_savings: u32,
pub quality_passed: bool,
}
impl TerseResult {
pub fn passthrough(text: String, tokens: u32) -> Self {
Self {
output: text,
tokens_before: tokens,
tokens_after: tokens,
savings_pct: 0.0,
layers_applied: Vec::new(),
pattern_savings: 0,
terse_savings: 0,
quality_passed: true,
}
}
pub fn format_footer(&self) -> String {
if self.savings_pct < 1.0 {
return String::new();
}
format!(
"[lean-ctx: {}→{} tok, pattern:-{} terse:-{}, -{:.0}%]",
self.tokens_before,
self.tokens_after,
self.pattern_savings,
self.terse_savings,
self.savings_pct,
)
}
}