AI Cost Optimization

OptScale Kompressor: Twice the Savings of Headroom on Coding-Agent Traffic

October 13, 2026

~ 10 min

On this page
    Cut agent token costs without breaking the cache
    Book a Demo

    Deterministic, cache-safe context compression for LLM coding agents: why we built it, how it works, and how it compares with Headroom.

    2×the savings of Headroom
    −22.7%cost vs no compression
    −25%prompt traffic, ~100 MB per run
    15×fewer requests over 200K tokens

    Every step a coding agent takes, it re-sends its entire working history to the model: every apt-get log, every compiler warning, every progress bar. On a long task the model re-reads the same build output dozens of times, and you pay for every read. OptScale Kompressor removes that redundancy in flight. It runs inside OptScale AI and rewrites machine-generated tool output into a shorter, fully labelled and retrievable form, without touching the agent, its prompts or its results. Its engine is the open-source project optscale-kompressor: a single deterministic Rust binary.

    ‍

    Preface: why build our own?

    Headroom is an established open-source (Apache-2.0) context compressor, and OptScale Kompressor started as a port of its algorithmic compressors. So why not just run Headroom? Because Headroom grew from a compressor into a platform, and we needed a compressor.

    ‍

    What Headroom has become

    We audited Headroom v0.40.0 (main branch, October 10, 2026) against optscale-kompressor 0.13. Raw lines were counted the same way for both projects, excluding tests.

    Content Formats What Kompressor does
    Build and package output apt, dpkg, pip, npm, make, compile and link steps Folds repeated lines into one line plus [×N], with timestamps, IDs and numbers normalised
    Logs Timestamped, level-tagged logs and stack traces Same fold; long logs keep errors with context, first-seen warnings, summaries and the tail
    Compiler diagnostics file:line:col: error: from gcc/clang, TypeScript, Python Keeps every diagnostic, drops echoed source and carets when smaller
    Terminal redraws \r progress bars, download meters, training loops; one-template line streams Keeps only the final frame; collapses template streams
    JSON Objects and arrays, including content nested in strings Samples long arrays, always keeping errors, outliers and change-points
    Tables CSV, TSV, Markdown Samples rows, keeps the header
    Search results grep -n, ripgrep Groups by file, keeps the top files, counts the rest
    Diffs Unified and git diff Narrows hunks to the lines around each change
    Listings and dumps find, ls -l, ps, df, docker ps; objdump, readelf, nm, xxd Keeps a verbatim head and tail sample
    Source code Python, JavaScript, TypeScript, Go, Rust, Java, C#, C, C++ Elides long function bodies, keeps signatures; the result must re-parse
    Config YAML, TOML, INI Drops comments and blank lines; folds repeated generated blocks
    Mixed Prose with embedded blocks Compresses the blocks, leaves the prose byte-identical
    HTML Web pages and markup Detected separately and folded like plain text; no article extraction
    Plain text Everything else Folds duplicate lines; documents are never template-folded

    Compression is one of many Headroom jobs. The same codebase ships:

    • agent memory;
    • a learning loop that rewrites CLAUDE.md;
    • output shaping and a model router;
    • a semantic cache and image compression;
    • subscription tracking;
    • wrappers for 18 coding agents and IDEs.

    That breadth suits a per-developer desktop optimiser. It is not the component we needed.

    Why that mattered

    1. A component, not a platform. Kompressor serves many teams and agents at once inside OptScale AI. Headroom's open-source proxy is single-user: state lives in ~/.headroom, and identity is accepted only from loopback. Hundreds of settings would also have to be pinned and kept pinned.
    2. Determinism decides the cache, and the cache decides the bill. Most of an agent's input is billed as cache reads (section 1). If the same tool output compresses differently on the next turn, the whole conversation is re-priced. Headroom feeds the user's latest message to its compressors, and its ML model runs under a time budget, so its output can depend on the question and on machine load. Ours depends only on its input: no clock, no randomness, no query.
    3. Remove redundancy, not meaning. Summarisation looks great on compression ratio. When we ported Headroom's prose compressor, it removed 6.2 points more but lost 12.9 points of the details agents went on to reuse. Kompressor is rule-based, every elision is labelled and retrievable, and its behaviour is auditable line by line.
    4. One process, one path. Compression and retrieval live in one binary. The proxy injects the retrieve tool and executes it itself, so they can never disagree about mode, tenant or state.

    We kept Headroom's best ideas: compress-and-retrieve, the core JSON, log, search and diff compressors, and its findings about Claude Code and Codex behind a proxy. We dropped everything that made output depend on anything but the input, and everything that was not compression.

    TL;DR

    • Measured on the real bill, task by task, on Terminal-Bench 2.1 with the prompt-cache discount included (setup in section 4).
    • 22.7% lower cost than no compression, 25% fewer input tokens, and no significant change in solve rate.
    • About 2× Headroom's savings. Against the same baseline, Headroom saved 8.2% with its defaults and 11.6% at its most aggressive. Head to head, Kompressor is 15.8% cheaper and sends 24% fewer input tokens. Its solve rate is statistically the same (81.1% vs 81.6%).
    • 2.8× more compression than Headroom with its ML model on, and 8.6× more than without it. Kompressor removes 62.8% of 34.2M characters of real tool output, against 22.6% and 7.3%, in about 1/440 of the time Headroom's model needs. Every removed detail stays retrievable.
    • Best fit: ML training, source builds and data pipelines. There 55–81% of tool output is removed and 26–37% comes off the bill.
    • Smaller requests: requests over 200K tokens become 15× rarer, keeping agents clear of the context window.

    1. The problem

    A coding agent runs a command, reads the output, thinks and runs the next one, and every turn it sends the whole conversation back to the model. Three facts follow:

    1. Most of the prompt is tool output. It is about half of all prompt bytes in our traces. Almost all the rest is encrypted reasoning, which cannot be compressed.
    2. Tool output is highly redundant. Progress bars redraw, package managers repeat themselves, and test runners print near-identical lines.
    3. Prompt caching changes the economics. About 93% of input tokens are cache reads at a tenth of the price. A compressor that breaks the cache can cost more than it saves.

    ‍

    2. How it works

    agent → OptScale AI ──→ Kompressor ──→ model provider
                  │               │
                  │               └─→ reference store (short-lived, per organisation)
                  │
                  └─ model calls kompressor_retrieve(ref) → original content returned
    • Deterministic and rule-based. No ML, no LLM calls. Same input, same bytes, every turn.
    • Labelled and recoverable. Every elision becomes a marker such as [×37 ref:k_Qm9v…] or [... 412 log lines omitted [ref:k_…]; 3 ERROR, 1 WARN]. The ID is a hash of the removed content, and the model can fetch it back for an hour.
    • Never worse, fails open. A result that is not smaller is discarded, and any error sends the request through unchanged.
    • Only machine output. System, developer and assistant messages, outputs under ~512 characters, and blocks carrying cache breakpoints are never touched.
    • Small and fast. One static binary of ~33K lines of Rust, about 0.2 ms per KB of tool output. It uses SQLite storage and is packaged for Linux, macOS and containers.

    Each tool output is classified and sent to a compressor built for its format:

    Content Formats What Kompressor does
    Build and package output apt, dpkg, pip, npm, make, compile and link steps Folds repeated lines into one line plus [×N], with timestamps, IDs and numbers normalised
    Logs Timestamped, level-tagged logs and stack traces Same fold; long logs keep errors with context, first-seen warnings, summaries and the tail
    Compiler diagnostics file:line:col: error: from gcc/clang, TypeScript, Python Keeps every diagnostic, drops echoed source and carets when smaller
    Terminal redraws \r progress bars, download meters, training loops; one-template line streams Keeps only the final frame; collapses template streams
    JSON Objects and arrays, including content nested in strings Samples long arrays, always keeping errors, outliers and change-points
    Tables CSV, TSV, Markdown Samples rows, keeps the header
    Search results grep -n, ripgrep Groups by file, keeps the top files, counts the rest
    Diffs Unified and git diff Narrows hunks to the lines around each change
    Listings and dumps find, ls -l, ps, df, docker ps; objdump, readelf, nm, xxd Keeps a verbatim head and tail sample
    Source code Python, JavaScript, TypeScript, Go, Rust, Java, C#, C, C++ Elides long function bodies, keeps signatures; the result must re-parse
    Config YAML, TOML, INI Drops comments and blank lines; folds repeated generated blocks
    Mixed Prose with embedded blocks Compresses the blocks, leaves the prose byte-identical
    HTML Web pages and markup Detected separately and folded like plain text; no article extraction
    Plain text Everything else Folds duplicate lines; documents are never template-folded

    The workhorse is de-duplication, not summarisation: the model always keeps at least one real instance of every distinct line, and always knows what was removed and how to get it back.

    ‍

    3. What we improved over Headroom

    OptScale Kompressor's engine started from Headroom's algorithmic compressors. The first two lists compare the deterministic layers. The replay that follows also measures Headroom with its ML model on: Magika detection, and a ModernBERT model for plain text and code. We leave ML out by design.

    New: formats Headroom has no rule for

    The first five rows are compressors from the table in section 2; the rest are new mechanisms.

    Content Effect
    Terminal redraws A 30,807-character training stream became 274 characters
    Compiler diagnostics with echoed source (Headroom reads them as grep hits) In one gcc output, 1,873 of 2,334 characters were echo and carets
    Binary and disassembly dumps, addresses never normalised An 880-line readelf table became ~1,000 characters
    One-template line streams +2.3 points of coverage
    Package installs, every Setting up <package> (<version>) line kept A 27.6K apt log went from 15% to 97% removed
    Line-number gutters (cat -n, sed -n, grep -n): numbers lifted off, body compressed by type, numbers put back 33 payloads went from 0% to 54% removed
    Agent harness framing (Codex Chunk ID, Wall time, exit code): split off and re-attached verbatim A Codex Python result went from 0% to 87% removed
    Logs or code inside JSON strings, compressed by that format's own compressor —
    Ranged retrieval: fetch an elided fragment by lines, characters, JSON pointer or grep —

    Improved: things both do

    Where both engines handle the same content, ours goes further on:

    • repeated lines, folded even when they are not adjacent;
    • plain text, compressed without ML;
    • mixed prose-and-data payloads;
    • truncated and C/C++ source;
    • generated config files.

    The measured effect is in the replay below. Kompressor also stays query-blind and deterministic, checks every compressor's output centrally, and estimates tokens more accurately.

    Measured: the same traffic through both, with and without Headroom's ML

    We replayed the same 6,255 real tool outputs (34.2M characters) through three engines, all at default settings:

    • optscale-kompressor 0.13;
    • Headroom 0.40 with its ML model off;
    • Headroom 0.40 with its ML model on: Magika detection plus its ModernBERT model (the 274 MB int8 ONNX build), on ONNX Runtime.
    Content type Share of traffic Kompressor Headroom, ML on Headroom, ML off
    Listings and dumps 27.8% 81.8% 22.6% 7.0%
    Plain text 25.3% 41.0% 20.6% 5.2%
    Build output and logs 19.3% 75.4% 17.1% 4.2%
    Source code 13.8% 35.0% 31.9% 0.0%
    Search results 11.1% 82.7% 25.5% 25.4%
    Diffs, config, HTML, JSON 2.7% 40.9% 19.8% 12.5%
    All eligible tool output 100% 62.8% 22.6% 7.3%
    Time per KB of tool output 0.2 ms 87 ms 1.5 ms

    The ML model triples Headroom's compression, and Kompressor still removes 2.8× as much, at about 1/440 of the time. Headroom's model reached 5,273 of the 6,255 outputs but compressed only 3,090 of them. It needed a median of 0.3 s per output and up to 6.8 s, while busy on about five cores. Source code is the one type where the two come close: 32% against our 35%.

    What the model does. Headroom's model keeps an ordered subset of the input words and drops the rest, with one retrieval marker appended at the end. Whitespace and indentation collapse, and lines with no kept words disappear. Some examples from the replay:

    Input Headroom ML output
    from __future__ import annotations / import asyncio / import functools __future__ annotations / asyncio / functools
    self.pre_approved = invitation or pre_approved self.pre_approved or
    43a020: andi $7, $3, 255 <z_zone.c+0xff> $7, $3, 255 <z_zone.c+0xff>
    Process exited with code 0 Process exited code 0

    Python imports lose their keywords, assignments lose their right-hand side, and disassembly loses its addresses and instructions. Kompressor never rewrites a line it keeps. Lines are either kept verbatim or replaced by a labelled marker.

    Determinism. On re-runs, idle and under heavy CPU load, the model produced byte-identical output. With ONNX limited to one thread, though, 3 of 400 outputs hit Headroom's 20-second time budget and came back uncompressed. So Headroom's output still depends on how fast the machine is. Kompressor has no time budget to hit.

    Retention of what agents reuse. For each output, we took the concrete tokens (file paths, identifiers, versions) the agent went on to use in its next actions. We then checked whether each token is still visible in the compressed text:

    Kompressor Headroom, ML on Headroom, ML off
    Characters removed 21.5M 7.7M 2.5M
    Reused tokens still visible 86.9% 96.2% 98.3%
    Reused tokens hidden, per million characters removed 34 28 39
    Hidden tokens recoverable through retrieval 100% 69% 30%

    Headroom shows more of these tokens inline mainly because it removes far less. Per character removed, all three engines hide them at a similar rate. The difference is what happens next. Every token Kompressor hides sits inside a fragment named by a reference in its output, one retrieval away. Some of Headroom's hidden tokens are split by its lossless directory folding (./src/Makefile becomes ./src/ and Makefile). The rest are behind its retrieval marker, or are gone.

    Our take on ML in Headroom

    Adding a model was a reasonable move for Headroom. Its rules leave most agent traffic untouched: 7% removed. ML is the cheapest way to cover what rules do not handle. The replay shows it works: ML triples Headroom's compression. It also finds savings where our rules deliberately stop, removing 28% of the source code and 12% of the plain text that Kompressor leaves whole. The model is also more stable than we expected: idle or under heavy load, the same input gave the same output.

    We still keep ML out of the request path, for five reasons that come from the same measurements:

    1. Rules leave less for ML to do. Most of what Headroom's model recovers is ground its own rules leave on the table. Our rules alone remove 62.8% of the same traffic, against 22.6% for Headroom's rules and model together. ML is a much larger lever on a 7% baseline than on a 63% one.
    2. Latency lands on every agent turn. Compute cost is not the issue: about 4.3 CPU-hours for all 34.2M characters is small next to the LLM bill. Time is. The model added a median of 0.3 s per tool output and up to 6.8 s, while busy on five cores, and a request usually carries several outputs. Our engine takes 0.2 ms per KB. On Codex's 5-second WebSocket timeout, half of the slowest outputs were cut off and sent uncompressed.
    3. A time budget is a hidden source of nondeterminism. The model is deterministic, but Headroom's 20-second budget is not. On a slower or busier machine an output that compressed yesterday passes through today, and the prompt cache is re-priced. Every request shares the budget, so contention makes this more likely in production than in our replay.
    4. Dropping words is not the same as removing redundancy. Headroom's model keeps a subset of the words and appends a single marker at the end. The model cannot tell where words went missing. Syntax goes too: 2,241 of 2,441 compressed outputs with indented code lost all their indentation. Assignments lose their right-hand sides, and the agent's own harness line "Process exited with code 0" becomes "Process exited code 0". Compared with Headroom's rules alone, the model hides 118 more of the tokens agents go on to reuse. Kompressor keeps every line it shows verbatim and marks every elision where it happened.
    5. Operational weight. Shipping the model means:
      • a 274 MB download at runtime, or bundling it;
      • an ONNX Runtime per process;
      • a startup canary and an inference queue;
      • time budgets and circuit breakers, which are themselves a cause of point 3.
      That is much of the platform growth described in the preface.

    Our conclusion is not "no ML, ever". A model could earn a place as an opt-in pass over the prose and code bodies that our rules leave whole, the one area where it measurably adds savings. To get there it would have to meet the same invariants as the rest of the engine:

    • output that does not depend on time;
    • every elision marked where it happened;
    • every elision retrievable;
    • a kept line never rewritten.

    Today's word-dropping models meet none of them, so the deterministic engine comes first.

    Where Headroom still does more

    • HTML: Headroom extracts article text; we fold HTML as text.
    • Gaps we have not closed yet:
      • stack-frame collapsing;
      • pytest summaries;
      • lossless CSV compaction;
      • a PHP grammar;
      • re-reads with shifted line numbers.
    • File reads: Headroom protects them by default. We compress them, because every elision is retrievable.

    ‍

    4. How we measure

    Live benchmark Terminal-Bench 2.1, 89 tasks; Codex CLI on GPT-5.5 ($5.00 / $0.50 / $30.00 per M uncached / cached / output tokens); Harbor, 3 concurrent trials
    Arms No compression · Headroom, default settings with its ML model · Headroom, most aggressive setting (retrieval off, 120-token size floor, at most 8 array items) · OptScale Kompressor via OptScale AI
    Metric Provider-billed cost and tokens per trial
    Analysis Per-task means, paired across arms over the 87 tasks every arm completed; differences tested for statistical significance. Per-cohort and per-task percentages are computed from unrounded data, so they can differ by a point from figures recomputed from rounded table values.
    Exclusions Trials that failed agent setup for external reasons (expired package-repository metadata, a failed download), and 7 Kompressor trials hit by one known streaming-integration defect
    Replay 6,255 tool outputs of at least 512 characters (34.2M characters) from our Terminal-Bench traces; optscale-kompressor 0.13 and Headroom 0.40 with its ML model off and on

    Every saving here is the difference between real bills, with the cache discount included. Self-reported savings, which price removed tokens at the uncached list rate, are not used.

    Before any change to Kompressor ships, it is replayed against two corpora. The first is our own Terminal-Bench 2.1 traces. The second is a separate set of 715M characters of tool output from public Terminal-Bench 4.0 leaderboard runs, covering ten agent and model combinations. Each replay checks coverage, determinism, cache stability, and that the details agents reuse survive.

    ‍

    5. Results

    All figures are per full run over the 87 tasks every arm completed.

    Per full run No compression Headroom Kompressor
    Cost $107.89 $99.04 $83.40
    Input tokens 96.1M 95.5M 72.2M
    Uncached input tokens 6.68M 5.16M 4.46M
    Tasks solved 82.2% 81.6% 81.1%
    Median trial time 4.8 min 5.3 min 4.5 min

    5.1 Twice the savings

    Against no compression Cost Solved
    Kompressor −22.7% 81.1%
    Headroom, most aggressive setting −11.6% 85.1%
    Headroom, default −8.2% 81.6%

    Kompressor's saving is 2.0× Headroom's most aggressive setting and 2.8× its default. Its cost and token savings are statistically significant; the solve-rate differences are not.

    5.2 Head to head with Headroom

    Kompressor vs Headroom Change
    Cost −15.8%
    Input tokens −24.4%
    Uncached input tokens −13.6%
    Solve rate −0.5 pt (81.1% vs 81.6%, not significant)

    Kompressor was cheaper on 54 of 87 tasks. The gap is concentrated in long, log-heavy tasks: ML training, cross-compilation and statistical modelling. On short tasks neither tool has much to remove.

    5.3 By task cohort

    Task cohort Tool output per task Removed Bill vs no compression
    ML training, sampling and evaluation (17 tasks) 598K chars 81% −26%
    Reverse engineering and security (12) 310K chars 69% −5%
    Building software from source (10) 1,178K chars 64% −28%
    Service configuration and git (10) 262K chars 58% −14%
    Data pipelines and media (9) 288K chars 55% −37%
    Text, documents and sequences (7) 120K chars 51% −23%
    Algorithms, maths and puzzles (22) 99K chars 48% −8%

    ML, source builds and data pipelines produce 83% of the total saving. The appendix breaks every cohort down task by task. They generate the most tool output and cost the most to run. Compression is weakest where outputs are tiny (algorithmic tasks), and where they are prose that should not be folded.

    5.4 Smaller requests

    A cached token is cheap, but it is still sent and still fills the context window.

    No compression Headroom Kompressor
    Prompt sent per run 96.1M tokens · ~418 MB 95.5M · ~415 MB 72.2M · ~314 MB
    90th-percentile request 106.9K tokens · ~465 KB 110.5K · ~481 KB 66.5K · ~289 KB
    Requests over 100K tokens 11.2% 12.0% 3.2%
    Requests over 200K tokens 1.9% 0.6% 0.13%

    Byte figures are estimated at 4.35 bytes of request JSON per token, measured on the no-compression runs.

    • Context window. Without compression, 1.9% of requests passed 200K of GPT-5.5's 258K window, and two trials had to compact their context. With Kompressor it was 0.13%, and one trial compacted.
    • Peak context in heavy tasks. mcmc-sampling-stan peaked at 60K tokens instead of 165K; caffe-cifar-10 at 68K instead of 152K.
    • No prompt caching. Where a provider or tier does not cache, the 25% traffic cut goes straight to the bill.

    ‍

    6. Conclusion

    Deterministic rules, done properly, beat a bigger platform with an ML model on top. On Terminal-Bench 2.1, OptScale Kompressor takes 22.7% off the real bill, about twice Headroom's savings, with no measurable change in task success. On the same traffic it removes 2.8× as much as Headroom with its ML model, in a fraction of the time, and every removed detail stays one retrieval away. It pays most where agents produce the most machine output: ML training, source builds and data pipelines.

    Try it:

    ‍

    Appendix: task-by-task results

    • Removed is the billing-weighted share of each task's eligible tool output taken out in the replay. Eligible means outputs of at least 512 characters.
    • Headroom in that column ran with its ML model on, as in the live runs.
    • Cost and Solved come from the live runs.
    • Two tasks, qemu-startup and qemu-alpine-ssh, failed agent setup in every compressed run and are not listed.

    ML training, sampling and evaluation

    Removed 81% (Headroom 21%) · bill −26% (Headroom +10%) · solved 84% (Headroom 84%, none 88%). The strongest cohort. Training loops and samplers print progress and metrics by the thousand, and per-trial cost halved on mcmc-sampling-stan, caffe-cifar-10 and mteb-leaderboard. The outlier is train-fasttext: 96% removed, but cheaper context let the agent poll a long training run for longer. It still cost far less than with Headroom.

    Task Tool output Removed: Kompressor · Headroom Cost per trial: none · Headroom · Kompressor Solved: none · Headroom · Kompressor
    train-fasttext 2,807K 96% · 21% $3.16 · $8.85 · $5.12 1/2 · 1/3 · 2/3
    mcmc-sampling-stan 2,089K 74% · 17% $3.69 · $3.19 · $1.15 2/2 · 2/3 · 3/3
    caffe-cifar-10 1,727K 72% · 20% $4.79 · $3.04 · $2.30 2/2 · 3/3 · 3/3
    mteb-leaderboard 940K 46% · 40% $2.15 · $2.52 · $1.04 1/2 · 3/3 · 3/3
    rstan-to-pystan 585K 64% · 24% $1.37 · $1.47 · $1.08 2/2 · 3/3 · 3/3
    adaptive-rejection-sampler 512K 71% · 21% $1.22 · $0.80 · $0.84 2/2 · 3/3 · 3/3
    llm-inference-batching-scheduler 241K 50% · 30% $0.68 · $0.76 · $0.66 2/2 · 3/3 · 1/2
    sam-cell-seg 203K 37% · 34% $1.13 · $0.77 · $0.83 2/2 · 3/3 · 3/3
    pytorch-model-cli 198K 51% · 18% $0.76 · $0.79 · $0.72 2/2 · 3/3 · 3/3
    torch-pipeline-parallelism 174K 50% · 38% $0.74 · $0.62 · $0.75 2/2 · 2/3 · 3/3
    reshard-c4-data 168K 75% · 19% $0.99 · $0.88 · $1.00 2/2 · 3/3 · 3/3
    count-dataset-tokens 141K 20% · 23% $0.42 · $0.39 · $0.36 2/2 · 3/3 · 3/3
    mteb-retrieve 125K 41% · 26% $0.42 · $0.36 · $0.24 2/2 · 3/3 · 3/3
    gpt2-codegolf 125K 42% · 8% $2.43 · $1.96 · $1.26 1/2 · 2/3 · 2/3
    pytorch-model-recovery 63K 62% · 9% $0.44 · $0.41 · $0.43 1/2 · 0/3 · 0/3
    torch-tensor-parallelism 53K 54% · 37% $0.44 · $0.53 · $0.50 2/2 · 3/3 · 2/3
    hf-model-inference 20K 6% · 21% $0.47 · $0.40 · $0.44 2/2 · 3/3 · 2/3

    Reverse engineering and security

    Removed 69% (Headroom 27%) · bill −5% (Headroom −16%) · solved 76% (Headroom 86%, none 83%). Disassembly, symbol tables and wordlists compress very well. But these tasks are short and cheap, so their cost swings more with the agent's path than with the context. This is the one cohort where Headroom came out clearly ahead.

    Task Tool output Removed: Kompressor · Headroom Cost per trial: none · Headroom · Kompressor Solved: none · Headroom · Kompressor
    path-tracing-reverse 1,032K 76% · 35% $1.34 · $1.49 · $1.54 2/2 · 3/3 · 2/3
    fix-code-vulnerability 718K 77% · 29% $0.43 · $0.37 · $0.50 2/2 · 3/3 · 3/3
    path-tracing 687K 66% · 21% $3.30 · $0.95 · $2.22 2/2 · 3/3 · 3/3
    crack-7z-hash 563K 69% · 19% $0.76 · $1.16 · $1.35 2/2 · 3/3 · 3/3
    vulnerable-secret 157K 59% · 25% $0.19 · $0.21 · $0.39 2/2 · 3/3 · 3/3
    extract-elf 135K 41% · 30% $0.60 · $0.53 · $0.47 1/2 · 1/3 · 1/3
    password-recovery 119K 38% · 10% $0.41 · $0.28 · $0.52 2/2 · 3/3 · 3/3
    break-filter-js-from-html 103K 41% · 20% $0.50 · $0.56 · $0.27 2/2 · 3/3 · 0/1
    feal-linear-cryptanalysis 66K 38% · 24% $0.61 · $0.71 · $0.51 2/2 · 3/3 · 3/3
    filter-js-from-html 56K 25% · 32% $0.53 · $0.66 · $0.63 0/2 · 0/3 · 0/3
    model-extraction-relu-logits 52K 11% · 3% $0.44 · $0.56 · $0.41 1/2 · 3/3 · 2/3
    feal-differential-cryptanalysis 34K 27% · 18% $0.56 · $0.68 · $0.40 2/2 · 3/3 · 3/3

    Building software from source

    Removed 64% (Headroom 26%) · bill −28% (Headroom −6%) · solved 80% (Headroom 83%, none 80%). The most tool output of any cohort, about 1.2M characters per task: package installs, configure checks, compiler lines and diagnostics. make-mips-interpreter, build-pmars and build-pov-ray roughly halved in cost. This is where the gap to Headroom is clearest.

    Task Tool output Removed: Kompressor · Headroom Cost per trial: none · Headroom · Kompressor Solved: none · Headroom · Kompressor
    make-doom-for-mips 3,177K 65% · 28% $10.28 · $8.85 · $6.80 0/2 · 0/3 · 0/3
    fix-ocaml-gc 1,701K 67% · 24% $2.27 · $2.48 · $1.74 2/2 · 3/3 · 3/3
    make-mips-interpreter 1,538K 69% · 34% $2.75 · $4.17 · $1.42 0/2 · 2/3 · 1/3
    compile-compcert 1,483K 62% · 22% $3.74 · $2.81 · $3.18 2/2 · 3/3 · 3/3
    build-pov-ray 925K 64% · 22% $1.95 · $1.33 · $0.98 2/2 · 2/3 · 3/3
    build-cython-ext 801K 46% · 27% $1.43 · $1.97 · $1.86 2/2 · 3/3 · 3/3
    custom-memory-heap-crash 715K 63% · 20% $0.96 · $0.88 · $0.58 2/2 · 3/3 · 3/3
    build-pmars 683K 72% · 18% $1.02 · $0.81 · $0.52 2/2 · 3/3 · 3/3
    sqlite-with-gcov 403K 67% · 20% $0.63 · $0.48 · $0.44 2/2 · 3/3 · 3/3
    install-windows-3.11 357K 38% · 8% $1.97 · $1.65 · $2.03 2/2 · 3/3 · 2/3

    Service configuration and git

    Removed 58% (Headroom 15%) · bill −14% (Headroom 0%) · solved 69% (Headroom 60%, none 85%). Service installs and large repository scans compress well (sanitize-git-repo, 79%). Short git commands and small diffs pass through almost untouched, by design. kv-store-grpc and pypi-server failed in every compressed trial with both tools.

    Task Tool output Removed: Kompressor · Headroom Cost per trial: none · Headroom · Kompressor Solved: none · Headroom · Kompressor
    sanitize-git-repo 1,256K 79% · 3% $1.74 · $1.32 · $1.58 2/2 · 1/3 · 2/3
    mailman 916K 45% · 26% $2.14 · $1.69 · $1.79 2/2 · 2/3 · 2/2
    configure-git-webserver 141K 67% · 20% $0.79 · $1.08 · $0.65 1/2 · 1/3 · 1/3
    fix-git 96K 1% · 8% $0.36 · $0.82 · $0.36 2/2 · 2/3 · 3/3
    git-multibranch 79K 18% · 10% $0.92 · $1.01 · $0.67 2/2 · 3/3 · 3/3
    nginx-request-logging 67K 28% · 4% $0.31 · $0.35 · $0.26 2/2 · 3/3 · 3/3
    kv-store-grpc 34K 12% · 21% $0.48 · $0.36 · $0.31 1/2 · 0/3 · 0/3
    pypi-server 20K 20% · 9% $0.31 · $0.39 · $0.32 1/2 · 0/3 · 0/3
    git-leak-recovery 10K 2% · 7% $0.24 · $0.24 · $0.30 2/2 · 3/3 · 3/3
    openssl-selfsigned-cert 4K 4% · 0% $0.10 · $0.13 · $0.08 2/2 · 3/3 · 3/3

    Data pipelines and media

    Removed 55% (Headroom 15%) · bill −37% (Headroom −38%) · solved 78% (Headroom 81%, none 72%). Both tools cut the bill by about the same amount; Headroom came out marginally ahead on cost and solved slightly more. Most of the saving is extract-moves-from-video, where both agents took a much cheaper path than the uncompressed one. Where content decides, Kompressor pulls ahead: financial-document-processor fell from $1.23 to $0.37 per trial.

    Task Tool output Removed: Kompressor · Headroom Cost per trial: none · Headroom · Kompressor Solved: none · Headroom · Kompressor
    extract-moves-from-video 1,012K 59% · 14% $10.83 · $4.75 · $5.89 2/2 · 3/3 · 3/3
    db-wal-recovery 650K 48% · 20% $0.96 · $1.45 · $1.21 0/2 · 1/3 · 1/3
    financial-document-processor 351K 54% · 20% $1.23 · $1.32 · $0.37 1/2 · 3/3 · 3/3
    sparql-university 260K 36% · 34% $0.67 · $0.39 · $0.68 2/2 · 3/3 · 3/3
    video-processing 194K 55% · 3% $1.79 · $1.26 · $1.23 0/2 · 0/3 · 0/3
    query-optimize 76K 9% · 4% $1.10 · $0.81 · $0.78 2/2 · 3/3 · 2/3
    log-summary-date-ranges 22K 77% · 39% $0.15 · $0.14 · $0.11 2/2 · 3/3 · 3/3
    sqlite-db-truncate 20K 7% · 12% $0.19 · $0.20 · $0.23 2/2 · 3/3 · 3/3
    multi-source-data-merger 10K 17% · 17% $0.18 · $0.20 · $0.22 2/2 · 3/3 · 3/3

    Text, documents and sequences

    Removed 51% (Headroom 32%) · bill −23% (Headroom +3%) · solved 62% (Headroom 57%, none 43%). Machine-generated documents compress well: G-code in gcode-to-text (76%) and protein structure files in protein-assembly (61%). Prose does not, by design: LaTeX in overfull-hbox is 18%. On dna-assembly, Headroom compresses more than we do.

    Task Tool output Removed: Kompressor · Headroom Cost per trial: none · Headroom · Kompressor Solved: none · Headroom · Kompressor
    protein-assembly 297K 61% · 27% $1.17 · $1.42 · $1.26 0/2 · 2/3 · 2/3
    overfull-hbox 161K 18% · 16% $0.58 · $0.74 · $0.48 1/2 · 3/3 · 1/3
    dna-assembly 156K 37% · 58% $1.23 · $1.20 · $0.94 1/2 · 0/3 · 3/3
    gcode-to-text 128K 76% · 28% $1.30 · $1.55 · $0.75 0/2 · 1/3 · 1/3
    dna-insert 93K 53% · 48% $0.53 · $0.44 · $0.41 0/2 · 0/3 · 0/3
    large-scale-text-editing 3K 0% · 6% $0.72 · $0.46 · $0.49 2/2 · 3/3 · 3/3
    regex-log <1K — · — $0.34 · $0.21 · $0.22 2/2 · 3/3 · 3/3

    Algorithms, maths and puzzles

    Removed 48% (Headroom 25%) · bill −8% (Headroom −11%) · solved 95% (Headroom 94%, none 93%). Mostly reasoning, with small outputs: the median is 270 characters, under the compression floor. The whole cohort costs about $15 per run, so there is little to save, and the two tools land within noise of each other.

    Task Tool output Removed: Kompressor · Headroom Cost per trial: none · Headroom · Kompressor Solved: none · Headroom · Kompressor
    schemelike-metacircular-eval 485K 65% · 31% $1.29 · $1.18 · $1.37 2/2 · 3/3 · 3/3
    winning-avg-corewars 338K 37% · 24% $1.45 · $1.84 · $1.14 2/2 · 3/3 · 3/3
    merge-diff-arc-agi-task 156K 55% · 14% $0.84 · $0.81 · $0.69 2/2 · 3/3 · 3/3
    tune-mjcf 151K 20% · 18% $1.12 · $0.93 · $0.47 2/2 · 3/3 · 3/3
    cobol-modernization 140K 45% · 35% $0.99 · $0.72 · $1.20 2/2 · 3/3 · 3/3
    portfolio-optimization 136K 53% · 28% $0.43 · $0.49 · $0.36 2/2 · 3/3 · 3/3
    raman-fitting 132K 46% · 6% $1.72 · $0.71 · $1.44 0/2 · 0/3 · 0/3
    regex-chess 130K 28% · 30% $2.31 · $1.33 · $2.04 1/2 · 2/3 · 2/2
    circuit-fibsqrt 104K 60% · 41% $0.81 · $0.78 · $0.90 2/2 · 3/3 · 1/1
    largest-eigenval 81K 36% · 18% $0.70 · $0.94 · $0.84 2/2 · 3/3 · 3/3
    write-compressor 65K 23% · 8% $0.74 · $0.72 · $0.53 2/2 · 3/3 · 3/3
    chess-best-move 52K 66% · 66% $0.36 · $0.31 · $0.36 2/2 · 3/3 · 3/3
    headless-terminal 46K 73% · 30% $0.42 · $0.37 · $0.45 2/2 · 3/3 · 3/3
    modernize-scientific-stack 40K 50% · 26% $0.18 · $0.21 · $0.16 2/2 · 3/3 · 3/3
    bn-fit-modify 35K 6% · 23% $0.29 · $0.34 · $0.35 2/2 · 3/3 · 3/3
    constraints-scheduling 25K 52% · 0% $0.16 · $0.16 · $0.15 2/2 · 3/3 · 3/3
    distribution-search 23K 42% · 3% $0.20 · $0.27 · $0.24 2/2 · 3/3 · 3/3
    polyglot-rust-c 15K 36% · 32% $0.71 · $0.52 · $0.72 2/2 · 3/3 · 3/3
    polyglot-c-py 7K 35% · 16% $0.48 · $0.69 · $0.48 2/2 · 3/3 · 3/3
    cancel-async-tasks 5K 76% · 22% $0.16 · $0.23 · $0.20 2/2 · 3/3 · 3/3
    code-from-image 2K 0% · 0% $0.13 · $0.13 · $0.12 2/2 · 3/3 · 3/3
    prove-plus-comm 1K 0% · 2% $0.09 · $0.09 · $0.12 2/2 · 3/3 · 3/3

    See what Kompressor saves on your own traffic

    Route your AI agents through OptScale AI and Kompressor shrinks their tool output in flight, with no code changes and every saving measured on the real bill. Try it on your own traffic, or see it in the live demo

    Frequently asked questions

    Do we need to change our agents, prompts, or code to use Kompressor?

    No. Kompressor runs inline inside the OptScale AI gateway as a proxy — you point your agents at the gateway and compression applies to every request automatically, without touching the agent, its prompts, or its results. There is no SDK migration or per-agent instrumentation, and it adds about 0.2 ms per KB of tool output.

    Will compression break prompt caching, or ever make a request cost more?

    No. Kompressor is deterministic: the same tool output compresses to the same bytes every turn, with no clock, randomness, or dependence on the user's question, so provider cache reads — about 93% of input tokens, billed at roughly a tenth of the price — stay valid. It also fails open, so any result that is not smaller is discarded and any error passes the request through unchanged.

    Can Kompressor drop something the model actually needs?

    It de-duplicates rather than summarises, so the model keeps at least one real copy of every distinct line, and every elision is labelled and retrievable — the model can pull the original back for an hour through a retrieve call the gateway runs for it. It only touches machine-generated tool output over about 512 characters, never system, developer, or assistant messages. In the benchmark, solve rate was statistically unchanged (81.1% versus 82.2% with no compression).

    Which workloads benefit most from Kompressor?

    Savings depend on the workload. The largest gains are in ML training, builds from source, and data pipelines, where 55–81% of tool output is removed and roughly a quarter to a third comes off the bill. Short, reasoning-heavy tasks and plain prose have little to remove by design, so expect little saving there.

    How do we confirm the savings on our own traffic?

    Every benchmark figure is the difference between real provider bills with the cache discount already included, not tokens priced at the uncached list rate. On your own traffic you can hold out a slice as an unshaped control group and compare tokens billed side by side, labelled measured versus estimated. Where a provider or tier does not cache at all, the roughly 25% cut in prompt traffic goes straight to the bill.