PROJECT · TOK0 / FIELD COMPRESSION UNIT
SERIAL NO. 0.1.18 · BUILT IN RUST · MIT
OPEN SOURCE — SHELL OUTPUT COMPRESSION PROXY TOK0 · DOCS >>> START

Introduction

tok0 compresses verbose shell output before it reaches an LLM. Native Rust, single binary, ~80% savings on the commands your agent runs most.

tok0 sits between your AI agent and the shell. When the agent runs git diff, cargo build, or kubectl get pods, tok0 captures the output, drops the noise, and forwards what’s left. The agent sees only lines that matter; you stop paying for tokens that read “Compiling 142 of 1500 crates…”.

It’s a single static Rust binary, ~8 MB. No runtime, no daemon, no account.

Why

Coding agents spend tokens on shell output that is mostly noise: progress bars, ANSI codes, repeated banners, dependency trees, vendor warnings. A typical npm install is 2–5 KB of useful text wrapped in 30–50 KB of formatting. Compressing that before the model is the cheapest win available.

tok0 cuts real output by 60–90% across ~250 commands. Each rule has a CI-asserted minimum baked into its tests.

How

agent → shell command → tok0 → model context

tok0 init finds the AI tools on your machine (Claude Code, Cursor, Gemini CLI, etc.) and wires up a hook for each. The hook intercepts a shell call, runs the command, runs the output through the matching compressor, and returns the result. Exit codes pass through. If a filter errors, you get the raw output.

Tip

Run tok0 init once. Every supported command compresses from then on. No prompt changes, no workflow changes.

What’s inside

SubsystemWhat it doesSource
Compression pipelineEight stages: strip ANSI, pattern replace, output match, line select, truncate, head/tail window, hard cap, empty fallback.apps/cli/src/engine/compressor.rs
TOML rule engine120+ declarative rules across git, cargo, npm, docker, kubectl, terraform, pytest, brew, apt, and more. Each ships with a minimum-savings floor checked in CI.apps/cli/src/rules/*.toml
Native compressors52 hand-tuned Rust modules for commands that need real parsing (JSON reshaping, AST-aware filtering).apps/cli/src/compressors/
AI tool bridgesAuto-installs into Claude Code, Cursor, Gemini CLI, Windsurf, Cline, Amp, OpenCode, Codex, Kimi Code.apps/cli/src/bridge/setup.rs
Local meterSQLite token counter at ~/.config/tok0/meter.db. Stays on your machine unless you opt into telemetry with --features cloud.apps/cli/src/engine/meter.rs

Next

Install tok0, run tok0 init, watch the next session compress.Homebrew, shell script, Cargo, Scoop, Snap, Chocolatey, source.Eight pure stages. Same input, same output, every time.Declarative filters with CI-checked savings floors. No Rust required.
BUILT IN RUST · SINGLE STATIC BINARY · 8 MB v0.1.18 / MIT GITHUB.COM/PRXM-LABS/TOK0