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
feat(cli): add IntelligentContext CLI arguments
chopratejasd57673d745e9
diff --git a/README.md b/README.mdindex 77f865d40..15ce7cb41 100644--- a/README.md+++ b/README.md@@ -146,7 +146,7 @@ flowchart TBsubgraph Pipeline["Transform Pipeline"]CA["Cache Aligner<br/><i>Stabilizes dynamic tokens</i>"]SC["Smart Crusher<br/><i>Removes redundant tool output</i>"]- CM["Context Manager<br/><i>Fits token budget</i>"]+ CM["Intelligent Context<br/><i>Score-based token fitting</i>"]CA --> SC --> CMend@@ -278,7 +278,7 @@ See the full [Agno Integration Guide](docs/agno.md) for hooks, multi-provider su| **Universal Compression** | ML-based content detection + structure-preserving compression | [Compression](docs/compression.md) || **SmartCrusher** | Compresses JSON tool outputs statistically | [Transforms](docs/transforms.md) || **CacheAligner** | Stabilizes prefixes for provider caching | [Transforms](docs/transforms.md) |-| **RollingWindow** | Manages context limits without breaking tools | [Transforms](docs/transforms.md) |+| **IntelligentContext** | Score-based context dropping with TOIN-learned importance | [Transforms](docs/transforms.md) || **CCR** | Reversible compression with automatic retrieval | [CCR Guide](docs/ccr.md) || **LangChain** | Memory, retrievers, agents, streaming | [LangChain](docs/langchain.md) || **Agno** | Agent framework integration with hooks | [Agno](docs/agno.md) |diff --git a/headroom/cli.py b/headroom/cli.pyindex 44d5e0e80..e2f1b5194 100644--- a/headroom/cli.py+++ b/headroom/cli.py@@ -67,6 +67,10 @@ def cmd_proxy(args: argparse.Namespace) -> int:llmlingua_target_rate=args.llmlingua_rate,# Code-aware: ON by default (use --no-code-aware to disable)code_aware_enabled=not args.no_code_aware,+ # Intelligent Context: ON by default (use --no-intelligent-context to disable)+ intelligent_context=not args.no_intelligent_context,+ intelligent_context_scoring=not args.no_intelligent_scoring,+ intelligent_context_compress_first=not args.no_compress_first,# Memory Systemmemory_enabled=args.memory,memory_backend=args.memory_backend,@@ -491,6 +495,22 @@ Documentation: https://github.com/headroom-sdk/headroomaction="store_true",help="Disable AST-based code compression",)+ # Intelligent Context Management (ON by default)+ proxy_parser.add_argument(+ "--no-intelligent-context",+ action="store_true",+ help="Disable IntelligentContextManager (fall back to RollingWindow)",+ )+ proxy_parser.add_argument(+ "--no-intelligent-scoring",+ action="store_true",+ help="Disable multi-factor importance scoring (use position-based)",+ )+ proxy_parser.add_argument(+ "--no-compress-first",+ action="store_true",+ help="Disable trying deeper compression before dropping messages",+ )# Memory Systemproxy_parser.add_argument("--memory",