← all repositories
ojuschugh1/sqz

A token compressor that sits between your agent and its shell

It intercepts shell output before it reaches the LLM, turning repetitive file reads into 13-token references to stop context bloat.

503 stars Rust LLMOps · Eval
sqz
Collecting fresh signals — velocity needs a few days of history.
collecting data…
star history

What it does

sqz is a Rust binary that injects PreToolUse hooks into popular AI coding assistants — Claude Code, Cursor, Windsurf, and others — so that every bash command’s output gets compressed before the LLM sees it. It recognizes specific output formats (git status, pytest, JSON, logs) and applies tailored shrinkers: collapsing repeated lines, stripping JSON nulls, or showing only test failures. The real savings come from session-level deduplication: once a file or response is sent to the model, subsequent reads are replaced with a 13-token reference, which the README claims can cut token counts by up to 92% on repetitive tasks.

The interesting bit

Most token-optimizers focus on prompts or retrieval; sqz treats the agent’s own shell traffic as the problem. It’s essentially a lossy codec for stdout, with a built-in cache that remembers what the model has already seen. The README is admirably honest about the limits: prose and docs barely shrink (2%), stack traces are passed through untouched (0%), and your mileage depends heavily on how repetitive your session is.

Key highlights

  • Transparent hooks for Claude Code, Cursor, Windsurf, Cline, Gemini CLI, Kiro, and OpenCode; also VS Code, JetBrains, and browser extensions.
  • 40+ per-command formatters for shell tools like git, cargo, pytest, docker, kubectl, and grep.
  • Safe mode routes stack traces, errors, and secrets through with 0% compression so nothing sensitive is mangled.
  • Ships as a single Rust binary with prebuilt releases across multiple package registries.
  • Real-world stats from the project: 24.7% average reduction across 3,003 compressions, with up to 92% saved on repeated file reads.

Caveats

  • The automated sqz init command strips comments from JSON-with-comments config files (like OpenCode’s opencode.jsonc), so you’ll need to install manually if you care about your annotations.
  • Single-command compression is modest for some formats — prose and docs see only ~2% shrinkage, and stack traces are deliberately left alone.
  • The README truncates mid-CLI reference, so full command surface beyond compress, expand, and gain is unclear.

Verdict

Worth a look if you run agentic coding sessions that hammer the same files, logs, or test output all day and you’re paying per token. Skip it if your workflow is mostly one-off prompts on unique prose or you’re already on an unlimited context model.

Frequently asked

What is ojuschugh1/sqz?
It intercepts shell output before it reaches the LLM, turning repetitive file reads into 13-token references to stop context bloat.
Is sqz open source?
Yes — ojuschugh1/sqz is an open-source project tracked on heatdrop.
What language is sqz written in?
ojuschugh1/sqz is primarily written in Rust.
How popular is sqz?
ojuschugh1/sqz has 503 stars on GitHub.
Where can I find sqz?
ojuschugh1/sqz is on GitHub at https://github.com/ojuschugh1/sqz.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.