Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
fix(cli): document that code-aware compression is enabled by default (#4616)
Ryrenzaffd17c5fde1
diff --git a/headroom/cli/install.py b/headroom/cli/install.pyindex 64ca1c662..154fb407c 100644--- a/headroom/cli/install.py+++ b/headroom/cli/install.py@@ -908,7 +908,7 @@ def _echo_installed(manifest: DeploymentManifest, *, prefix: str = "Installed pehelp=("Enable/disable AST-based code compression in the persistent runtime. ""Requires the optional tree-sitter dependency: pip install headroom-ai[code]. "- "Default: disabled, matching `headroom proxy`."+ "Default: enabled, matching `headroom proxy`."),)@click.option(diff --git a/headroom/cli/proxy.py b/headroom/cli/proxy.pyindex 801ef8499..b49702456 100644--- a/headroom/cli/proxy.py+++ b/headroom/cli/proxy.py@@ -800,7 +800,8 @@ def dashboard(port: int, no_open: bool) -> None:help=("Enable/disable AST-based code compression. Requires the optional ""tree-sitter dependency: pip install headroom-ai[code]. "- "Default: disabled. Env: HEADROOM_CODE_AWARE_ENABLED=1 to enable."+ "Default: enabled. Disable with --no-code-aware or "+ "HEADROOM_CODE_AWARE_ENABLED=0."),)@click.option(@@ -1569,10 +1570,9 @@ def proxy(# Code-aware compression resolution:# 1. Explicit --code-aware / --no-code-aware always wins.# 2. Otherwise read HEADROOM_CODE_AWARE_ENABLED (truthy = on).- # 3. Otherwise default off — matches the prior cli/proxy.py behavior so- # existing users see no change unless they opt in.- # Default ON (coding posture; consistent with the argparse server path).- # Degrades gracefully to a no-op when tree-sitter isn't installed.+ # 3. Otherwise default ON (coding posture; consistent with the argparse+ # server path). Degrades gracefully to a no-op when tree-sitter+ # isn't installed.code_aware_enabled=(bool(code_aware_flag)if code_aware_flag is not Nonediff --git a/tests/test_cli_proxy_env.py b/tests/test_cli_proxy_env.pyindex ec0754290..c47497ec0 100644--- a/tests/test_cli_proxy_env.py+++ b/tests/test_cli_proxy_env.py@@ -564,6 +564,17 @@ class TestCLIProxyEnvVars:assert result.exit_code == 0, result.outputassert captured_config["config"].code_aware_enabled is True+ @pytest.mark.parametrize("path", [["proxy"], ["install", "apply"]])+ def test_code_aware_help_documents_enabled_default(self, path):+ """--code-aware help must describe the default it resolves to (ON)."""+ cmd = main+ for name in path:+ cmd = cmd.commands[name]+ option = next(p for p in cmd.params if "--code-aware" in p.opts)++ assert "Default: enabled" in option.help+ assert "Default: disabled" not in option.help+def test_code_aware_enabled_from_cli_flag(self, runner):"""--code-aware should enable code-aware compression in the wrapper."""captured_config = {}