@@ -8,6 +8,12 @@ pub struct SofosConfig {
88 pub max_file_size : usize ,
99 #[ allow( dead_code) ]
1010 pub max_bash_output : usize ,
11+ /// Auto-compact when token usage exceeds this ratio of max_context_tokens
12+ pub compaction_trigger_ratio : f64 ,
13+ /// Number of recent messages to preserve during compaction
14+ pub compaction_preserve_recent : usize ,
15+ /// Truncate tool results longer than this (chars) during compaction
16+ pub tool_result_truncate_threshold : usize ,
1117}
1218
1319impl Default for SofosConfig {
@@ -18,6 +24,9 @@ impl Default for SofosConfig {
1824 max_tool_iterations : 200 ,
1925 max_file_size : 10 * 1024 * 1024 ,
2026 max_bash_output : 50 * 1024 * 1024 ,
27+ compaction_trigger_ratio : 0.80 ,
28+ compaction_preserve_recent : 20 ,
29+ tool_result_truncate_threshold : 2000 ,
2130 }
2231 }
2332}
@@ -77,5 +86,8 @@ mod tests {
7786 assert_eq ! ( config. max_tool_iterations, 200 ) ;
7887 assert_eq ! ( config. max_file_size, 10 * 1024 * 1024 ) ;
7988 assert_eq ! ( config. max_bash_output, 50 * 1024 * 1024 ) ;
89+ assert ! ( ( config. compaction_trigger_ratio - 0.80 ) . abs( ) < f64 :: EPSILON ) ;
90+ assert_eq ! ( config. compaction_preserve_recent, 20 ) ;
91+ assert_eq ! ( config. tool_result_truncate_threshold, 2000 ) ;
8092 }
8193}
0 commit comments