vtcode_core/core/agent/config.rs
1//! Intelligent compaction system for threads and context
2//!
3//! This module implements Research-preview compaction strategies to optimize memory usage
4//! and performance by intelligently compressing conversation threads and semantic context.
5
6use serde::{Deserialize, Serialize};
7
8/// Compaction strategy configuration
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct CompactionConfig {
11 /// Maximum number of messages to keep in uncompressed form
12 pub max_uncompressed_messages: usize,
13 /// Maximum age of messages before compaction (in seconds)
14 pub max_message_age_seconds: u64,
15 /// Maximum memory usage before triggering compaction (in MB)
16 pub max_memory_mb: usize,
17 /// Compaction interval (in seconds)
18 pub compaction_interval_seconds: u64,
19 /// Minimum confidence threshold for keeping context data
20 pub min_context_confidence: f64,
21 /// Maximum age of context data before compaction (in seconds)
22 pub max_context_age_seconds: u64,
23 /// Whether to enable automatic compaction
24 pub auto_compaction_enabled: bool,
25}
26
27impl Default for CompactionConfig {
28 fn default() -> Self {
29 Self {
30 max_uncompressed_messages: 50,
31 max_message_age_seconds: 3600, // 1 hour
32 max_memory_mb: 100,
33 compaction_interval_seconds: 300, // 5 minutes
34 min_context_confidence: 0.3,
35 max_context_age_seconds: 7200, // 2 hours
36 auto_compaction_enabled: true,
37 }
38 }
39}