Repolode
hystax

hystax/optscale-kompressor

A Rust binary that deterministically compresses coding-agent prompts and tool output, with removed content retrievable on demand.

Stars
21
Forks
6
Open issues
13
Last commit
17 hours ago

What is it?

OptScale Kompressor reduces the size of the working history that coding agents such as Codex, Claude Code and Aider re-send to a model on every step, mainly long build logs, compiler output and listings. It is built around determinism: the same input produces the same bytes on every turn, so provider prompt caches keep hitting. Each removed fragment is stored behind a content-addressed handle that the model can fetch back through a retrieve tool.

The project ships as one binary that works as a CLI, HTTP API, MCP server and LLM proxy for OpenAI Chat Completions, OpenAI Responses and Anthropic Messages. The command `kompressor wrap codex` starts the proxy, points the agent at it and cleans up on exit. Compression runs locally with no model download, using ordered content detection and tree-sitter grammars for source code. Three modes are available: aggressive (lossy), lossless, and recoverable (the default).

The repository reports a 22.7% cost reduction against no compression on a 89-task Terminal-Bench 2.1 run, measured on provider bills including prompt-cache discounts.

Key features

  • 01Deterministic output, so prompt-cache hits are preserved across turns.
  • 02Removed content is retrievable through handles and a built-in retrieve tool.
  • 03Wraps Codex, Claude, Aider, OpenCode and Cursor, or runs as a proxy for any client.
  • 04Runs locally with no model download, using rule-based detection and tree-sitter for code.
  • 05Exposes CLI, HTTP API, MCP server and Rust library from the same binary.

Use cases

  • Cutting token costs for long-running coding-agent sessions with verbose build or test output.
  • Routing a team's LLM traffic through a shared local proxy that compresses tool results.
  • Adding MCP-based compression and retrieval to an agent that supports MCP servers.

Quick start

  1. 1

    Install with Cargo (Rust 1.90 or newer)

    cargo install --locked --git https://github.com/hystax/optscale-kompressor kompressor-cli
  2. 2

    Run Codex through the compressor proxy

    kompressor wrap codex

Things to know

  • Automatic wrapping is only supported for Codex; Claude Code is passed through without compression.
  • Cursor-agent is refused because the proxy cannot read its protocol.
  • Benchmark results are self-reported by the project's vendor, OptScale AI.

Topics

FAQ

What is optscale-kompressor?
A Rust binary that deterministically compresses coding-agent prompts and tool output, with removed content retrievable on demand. OptScale Kompressor reduces the size of the working history that coding agents such as Codex, Claude Code and Aider re-send to a model on every step, mainly long build logs, compiler output and listings. It is built around determinism: the same input produces the same bytes on every turn, so provider prompt caches keep hitting. Each removed fragment is stored behind a content-addressed handle that the model can fetch back through a retrieve tool.
Is optscale-kompressor free to use? What license does it have?
optscale-kompressor is open source under the MIT license. Check the license terms before using it in commercial products.
Is optscale-kompressor still maintained?
Actively maintained. The last commit to optscale-kompressor was on Oct 20, 2026.
What can I use optscale-kompressor for?
Cutting token costs for long-running coding-agent sessions with verbose build or test output. Routing a team's LLM traffic through a shared local proxy that compresses tool results. Adding MCP-based compression and retrieval to an agent that supports MCP servers.
How do I install optscale-kompressor?
Install with Cargo (Rust 1.90 or newer): cargo install --locked --git https://github.com/hystax/optscale-kompressor kompressor-cli Run Codex through the compressor proxy: kompressor wrap codex
Where can I get optscale-kompressor?
The source code and installation instructions are on GitHub: https://github.com/hystax/optscale-kompressor

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects