Public declaration syntax from forge-rs/crates/forge-agent/src/context_manager.rs Original source SHA-256: fffd8cfc51712e9c21f0c9fdfe862e616c5374cc18fe8c99acac5e32fe4e6f83 Function bodies and constant values are omitted. This is not the complete implementation. Source line 22 #[derive(Debug, Clone, Copy)] pub enum PruningStrategy { /// Remove the oldest non-system messages first. RemoveOldest, /// Keep system prompt + the last N messages (sliding window). SlidingWindow { /// Maximum number of recent messages to keep (in addition to system). keep_last: usize, }, /// Summarize older messages into a single system message. /// (Future: will use the model to generate a summary.) Summarize, } Source line 37 #[derive(Debug, Clone)] pub struct ContextWindowConfig { /// Maximum number of tokens the model supports. pub max_context_tokens: u64, /// Threshold ratio (0.0–1.0) at which to start pruning. /// Default: 0.85 (prune when 85% of context is used). pub threshold_ratio: f64, /// Estimated tokens per message for the simple estimator. /// Default: 4 (roughly 4 tokens per word, ~100 words per message = 400). pub tokens_per_char: f64, /// Pruning strategy to use when threshold is exceeded. pub strategy: PruningStrategy } Source line 80 pub struct ContextWindowManager { } Source line 86 pub fn new(config: ContextWindowConfig) -> Self; Source line 91 pub fn for_context_size(max_tokens: u64) -> Self; Source line 102 pub fn estimate_tokens(&self, messages: &[ModelMessage]) -> u64; Source line 116 pub fn threshold_tokens(&self) -> u64;