Skip to content

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.

Merge pull request #411 from manorit2001/wip

Tejas Chopra2f982ade0ecb
diff --cc headroom/cli/proxy.py
index 93ee7d1e8,c38a0762f..3222e7c7c
--- a/headroom/cli/proxy.py
+++ b/headroom/cli/proxy.py
@@@ -543,19 -530,9 +559,20 @@@ def proxy
log_full_messages=log_messages
or os.environ.get("HEADROOM_LOG_MESSAGES", "").lower() in ("true", "1", "yes", "on"),
budget_limit_usd=budget,
+ # 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.
+ code_aware_enabled=(
+ bool(code_aware_flag)
+ if code_aware_flag is not None
+ else os.environ.get("HEADROOM_CODE_AWARE_ENABLED", "").strip().lower()
+ in ("true", "1", "yes", "on")
+ ),
# Code graph: live file watcher for incremental reindexing
code_graph_watcher=code_graph,
+ code_aware_enabled=code_aware or _get_env_bool("HEADROOM_CODE_AWARE_ENABLED", False),
# Read lifecycle: ON by default (use --no-read-lifecycle to disable)
read_lifecycle=not no_read_lifecycle,
# Memory System (Multi-Provider with auto-detection)