From 6cb39a94dd6c05a6bdd9620c106da6a671fa637b Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 29 Oct 2026 17:34:34 -0700 Subject: [PATCH] cli-73: added more aggressive auto compaction, potential token savings must be greater than or equal to %50 of the tokens over the limit, OR the compatctable tokens makes up greather than 15% of all tokens --- cecli/coders/base_coder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cecli/coders/base_coder.py b/cecli/coders/base_coder.py index e9d6db300b7..1fb8b75dddc 100755 --- a/cecli/coders/base_coder.py +++ b/cecli/coders/base_coder.py @@ -2297,13 +2297,13 @@ async def compact_context_if_needed(self, force=False, message=""): is_min_size = all_tokens >= self.context_compaction_max_tokens # Condition 2: Percentage check (is chat history a significant part of the context?) - is_worth_by_percentage = all_tokens > 0 and (compactable_tokens / all_tokens) >= 0.20 + is_worth_by_percentage = all_tokens > 0 and (compactable_tokens / all_tokens) >= 0.15 # Condition 3: Absolute savings check (would compacting save enough tokens to fit?) tokens_over_limit = all_tokens - (self.context_compaction_max_tokens or all_tokens) potential_savings = compactable_tokens * 0.90 is_worth_by_absolute_savings = ( - tokens_over_limit > 0 and potential_savings >= tokens_over_limit + tokens_over_limit > 0 and potential_savings >= (tokens_over_limit * 0.50) ) if not force: