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
Add transforms_summary to TransformResult and /v1/compress response
chopratejase2d1baf250fe
diff --git a/headroom/config.py b/headroom/config.pyindex f76d634e2..4eaf3197b 100644--- a/headroom/config.py+++ b/headroom/config.py@@ -728,6 +728,13 @@ class TransformResult:timing: dict[str, float] = field(default_factory=dict) # transform_name → mswaste_signals: WasteSignals | None = None # Detected waste in original messages+ @property+ def transforms_summary(self) -> dict[str, int]:+ """Counted summary of transforms_applied (e.g. {'router:tool_result:text': 4})."""+ from collections import Counter++ return dict(Counter(self.transforms_applied))+@dataclassclass TransformDiff:diff --git a/headroom/proxy/server.py b/headroom/proxy/server.pyindex 6d16439bd..0ede904d2 100644--- a/headroom/proxy/server.py+++ b/headroom/proxy/server.py@@ -2354,6 +2354,7 @@ class HeadroomProxy:else 1.0),"transforms_applied": result.transforms_applied,+ "transforms_summary": result.transforms_summary,"ccr_hashes": result.markers_inserted,})