diff --git a/agent/context_compressor.py b/agent/context_compressor.py index a0ca0c99..b2dff9c8 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -28,7 +28,7 @@ class ContextCompressor: def __init__( self, model: str, - threshold_percent: float = 0.85, + threshold_percent: float = 0.50, protect_first_n: int = 3, protect_last_n: int = 4, summary_target_tokens: int = 2500, diff --git a/cli.py b/cli.py index 1e418177..04794230 100755 --- a/cli.py +++ b/cli.py @@ -175,7 +175,7 @@ def load_cli_config() -> Dict[str, Any]: }, "compression": { "enabled": True, # Auto-compress when approaching context limit - "threshold": 0.85, # Compress at 85% of model's context limit + "threshold": 0.50, # Compress at 50% of model's context limit "summary_model": "google/gemini-3-flash-preview", # Fast/cheap model for summaries }, "agent": { diff --git a/gateway/run.py b/gateway/run.py index 8c068559..07490b77 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -1057,7 +1057,7 @@ class GatewayRunner: # Read model + compression config from config.yaml — same # source of truth the agent itself uses. _hyg_model = "anthropic/claude-sonnet-4.6" - _hyg_threshold_pct = 0.85 + _hyg_threshold_pct = 0.50 _hyg_compression_enabled = True try: _hyg_cfg_path = _hermes_home / "config.yaml" diff --git a/hermes_cli/config.py b/hermes_cli/config.py index 39501e93..c05ebd5a 100644 --- a/hermes_cli/config.py +++ b/hermes_cli/config.py @@ -121,7 +121,7 @@ DEFAULT_CONFIG = { "compression": { "enabled": True, - "threshold": 0.85, + "threshold": 0.50, "summary_model": "google/gemini-3-flash-preview", "summary_provider": "auto", }, @@ -1119,7 +1119,7 @@ def show_config(): enabled = compression.get('enabled', True) print(f" Enabled: {'yes' if enabled else 'no'}") if enabled: - print(f" Threshold: {compression.get('threshold', 0.85) * 100:.0f}%") + print(f" Threshold: {compression.get('threshold', 0.50) * 100:.0f}%") print(f" Model: {compression.get('summary_model', 'google/gemini-3-flash-preview')}") comp_provider = compression.get('summary_provider', 'auto') if comp_provider != 'auto': diff --git a/run_agent.py b/run_agent.py index a07cc472..2f082571 100644 --- a/run_agent.py +++ b/run_agent.py @@ -664,7 +664,7 @@ class AIAgent: # Initialize context compressor for automatic context management # Compresses conversation when approaching model's context limit # Configuration via config.yaml (compression section) or environment variables - compression_threshold = float(os.getenv("CONTEXT_COMPRESSION_THRESHOLD", "0.85")) + compression_threshold = float(os.getenv("CONTEXT_COMPRESSION_THRESHOLD", "0.50")) compression_enabled = os.getenv("CONTEXT_COMPRESSION_ENABLED", "true").lower() in ("true", "1", "yes") compression_summary_model = os.getenv("CONTEXT_COMPRESSION_MODEL") or None