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
style(proxy): format anthropic compression lambda
JerrettDavise164f4f1d9bd
diff --git a/headroom/proxy/handlers/anthropic.py b/headroom/proxy/handlers/anthropic.pyindex 74ce5bb7d..a6b0f5fb4 100644--- a/headroom/proxy/handlers/anthropic.py+++ b/headroom/proxy/handlers/anthropic.py@@ -3434,10 +3434,7 @@ class AnthropicHandlerMixin:# blocks every other request for the duration; a timeout# here is caught below and passes the item through.result = await self._run_compression_in_executor(- lambda messages=messages,- model=model,- context_limit=context_limit,- frozen_message_count=frozen_message_count: (+ lambda messages=messages, model=model, context_limit=context_limit, frozen_message_count=frozen_message_count: (self.anthropic_pipeline.apply(messages=messages,model=model,