How Loopers-OSS Saves 76% of Input Tokens and 68% of LLM Spend Loopers-OSS released an open-source, wire-level AI firewall built on a Dual-Regime Architecture that it says cuts input tokens by 76% and LLM spend by 68% by compressing historical tool outputs in multi-turn agent conversations. In benchmark testing across 60 production-grade agent turns executing enterprise tool operations, the project measured savings against the quadratic context expansion that occurs when agent frameworks re-send megabytes of prior tool results on every API request. The system pairs inline context acceleration and fast-tier arbitrage for normal operations with deterministic circuit breakers, OPA policy gating and hard budgets for runaway loops and tool-execution storms. Autonomous AI agents are transforming enterprise operations, from automated code generation and incident remediation to business intelligence. However, as organizations transition these agents from simple prototypes to production workflows, they encounter an unexpected financial hurdle: the multi-turn context baggage tax . When an agent executes a multi-step task involving tools such as querying a database, searching logs, or inspecting files , every piece of data returned by a tool is appended to the agent conversation history. Over a 10 to 20 turn trajectory, those historical tool outputs are re-sent to frontier Large Language Models LLMs on every single API request. What began as a lightweight prompt expands into a multi-megabyte payload. To address this challenge, Loopers-OSS introduces an open-source, wire-level AI firewall built on a Dual-Regime Architecture : In empirical benchmark testing across 60 production-grade agent turns executing enterprise tool operations, Loopers demonstrated: This article details the mechanics behind these results, the experimental methodology used to measure them, the architectural components that make it possible, and the practical caveats enterprises must evaluate before deployment. To understand how Loopers works, it is helpful to look at how enterprise teams experience AI agents on two very different kinds of days. ┌──────────────────────────────────────────────────────────────────────────┐ │ THE DUAL-REGIME REALITY │ ├────────────────────────────────────┬─────────────────────────────────────┤ │ BAD DAYS Security Events │ GOOD DAYS Normal Operations │ ├────────────────────────────────────┼─────────────────────────────────────┤ │ • Runaway recursive loops │ • Silent context bloat │ │ • Tool-execution storms │ • Re-sending megabytes of old tools │ │ • Semantic drift and hallucinations│ • Quadratic token cost escalation │ │ • Unexpected budget spikes │ • 60%+ wasted cloud spend │ │ │ │ │ Loopers Action: │ Loopers Action: │ │ Deterministic Circuit Breakers, │ Inline Context Acceleration, │ │ OPA Policy Gating, Hard Budgets │ Ghost Tokens, Fast-Tier Arbitrage │ └────────────────────────────────────┴─────────────────────────────────────┘ Every engineering leader deploying autonomous agents worries about "the bad day": To guard against these bad days, the industry created AI security gateways. These tools act like insurance policies: they monitor traffic, enforce rate limits, and block requests when anomalous behavior occurs. However, pure security gateways suffer from a major adoption barrier: they only provide value on bad days . On normal days, they feel like an added tax, introducing latency and infrastructure overhead without saving a dollar. Now consider "good days." The agent is behaving exactly as designed. It is not looping, it is not hallucinating, and no attacker is injecting prompts. Yet at the end of the month, the cloud bill arrives at five times the projected budget. Why does this happen? In multi-turn autonomous agents, the interaction pattern looks like this: Notice what happens to the network payload on Turn 12: the 30 KB log dump from Turn 2 and the 20 KB database dump from Turn 3 are still included in the prompt , along with every other turn in the conversation. This is quadratic context expansion . The model does not need the complete raw text of the Turn 2 logs to decide which tool to call on Turn 8; it only needed to know that the logs showed a connection timeout error. Yet because standard agent frameworks append everything to the message array, the customer pays for those identical 12,500 input tokens on Turn 4, Turn 5, Turn 6, all the way to the end. On good days, enterprises are not losing money to rogue loops; they are losing money to context baggage . Loopers-OSS is deployed as a drop-in reverse proxy between your agent application and your LLM and MCP providers. It requires zero changes to your agent codebase . You simply configure your agent to route HTTP requests through the Loopers proxy endpoint. ┌─────────────────┐ HTTP / JSON-RPC ┌──────────────────────────────────────────┐ │ │ ────────────────────────── │ LOOPERS-OSS │ │ Autonomous │ │ │ │ Agent Runtime │ │ ┌────────────────────────────────────┐ │ │ Cursor, Claude,│ <────────────────────────── │ │ 1. Schema Minifier & Read Memoizer │ │ │ ZeroClaw, etc. │ Accelerated Wire │ ├────────────────────────────────────┤ │ └─────────────────┘ │ │ 2. Ghost Token Engine Redis/AES │ │ │ ├────────────────────────────────────┤ │ │ │ 3. Prefix Canonicalization │ │ │ ├────────────────────────────────────┤ │ │ │ 4. Smart Fast-Tier Model Router │ │ │ └────────────────────────────────────┘ │ └────────────────────┬─────────────────────┘ │ ┌───────────────────────┴───────────────────────┐ ▼ ▼ ┌─────────────────────────────┐ ┌─────────────────────────────┐ │ Upstream LLM Provider │ │ Upstream MCP Servers │ │ Anthropic, OpenAI, DeepSeek│ │ Databases, Git, Filesystem,│ │ OpenRouter, etc. │ │ Cloud APIs, etc. │ └─────────────────────────────┘ └─────────────────────────────┘ The system operates across four coordinated architectural pillars matching the diagram above: internal/mcp/ When an agent starts a session, it queries registered MCP servers tools/list to discover available functions and then dispatches tool calls tools/call . internal/mcp/sanitizer.go : $schema metadata, title tags, and formatting examples . Loopers truncates tool descriptions to their first sentence, strips non-functional JSON Schema metadata keys, and sorts tools alphabetically. In our benchmark, this compressed MCP schema definitions by 3,200 tokens down to 680 tokens per turn while preserving 100% tool-selection accuracy. internal/mcp/handler.go : blastradius.Calculate <= 15 , confirming pure read-only verbs with zero mutation signals and caches the sanitized response in Redis loopers:mcp:memo:{keyHash}:{sessionID}:{callHash} . Repeat read requests are served directly from Redis in internal/proxy/ghost.go This is the core mechanism for eliminating multi-turn context baggage. 8 KB in production, or 4 KB in our benchmark , Loopers intercepts the response before it enters the agent's conversation history. Authorization: Bearer lp-... and session ID DeriveGhostKey , encrypts the payload with AES-256-GCM, and stores the ciphertext in Redis loopers:blob:{keyHash}:{sessionID}:{blobID} with an automatic TTL default 30 minutes . Because the raw proxy key is never persisted in Redis, a Redis snapshot cannot decrypt offloaded tool outputs. loopers ref , structural metadata row count and sorted keys , and a truncated preview: { " loopers ref": "loopers:blob:9f8e7d6c5b4a3210", "tool": "read audit log", "original bytes": 24800, "est tokens saved": 6200, "structure": {"keys": "binary", "pid", "status", "user" , "rows": 142}, "preview": {"binary": "/bin/sh", "pid": 4102, "status": "elevated", "user": "root"} } isSimpleTurn , HydratePromptTail fetches the referenced blob from Redis, decrypts it in memory, and appends it to the