The problem Agentic coding sessions are expensive because of bloated context. Every turn in a conversation accumulates: Repeated tool schemas (the same function definitions sent every time) Pretty-printed JSON (indented with whitespace that costs tokens) Duplicate system prompts across turns Old conversation history that's no longer relevant With Claude Opus at $15/1M input tokens, this adds up fast. What Context Optimize does All transforms are lossless. Zero semantic degradation. The LLM receives the same information, just compacted: | Transform | What it does | |-----------|-------------| | JSON minification | Removes whitespace, newlines from JSON values | | Tool schema dedup | Replaces repeated tool definitions with references | | System prompt dedup | Removes duplicated instructions across turns | | Whitespace normalization | Collapses blanks, preserves code indentation | | Chat history trimming | Keeps system + first + last N turns | Benchmark results (Claude Opus) | Scenario | Before (tokens) | After | Saved | $/1K requests | |----------|---------------:|------:|------:|---------------:| | Agentic coding (8 turns, 5 tools) | 3,657 | 1,573 | 57.0% | $31.26 | | RAG pipeline (6 chunks) | 544 | 386 | 29.0% | $2.37 | | API response analysis (nested JSON) | 1,634 | 616 | 62.3% | $15.27 | | Long debug session (50 turns) | 3,856 | 1,414 | 63.3% | $36.63 | | OpenAPI spec context (5 endpoints) | 2,649 | 762 | 71.2% | $28.30 | | Total | 12,340 | 4,751 | 61.5% | $113.84 | The biggest wins come from agentic sessions with repeated tool schemas and long debug sessions with JSON logs. How to enable it Context Optimize runs in safe mode by default. Add it to your API key config or enable it globally: layers: optimize: safe # lossless transforms only The aggressive mode (semantic dedup, embedding-based redundancy removal) is available on the Pro plan.