CLI output eats your AI context window. ContextZip compresses it 40-97% (61% avg across 102 tests).
npx contextzip
For: Claude Code / Cursor / Copilot CLI users hitting token limits.
Not for: projects where you need raw command output (use contextzip proxy <cmd> instead).
🌐 Languages
한국어 • 日本語 • 中文 • Español • Português • हिन्दी • Français • Deutsch • Русский • Türkçe • Tiếng Việt
npx contextzipRestart Claude Code. Every command is now compressed. Zero config. macOS · Linux · Windows
Tip
Need raw output? Use contextzip proxy <command> to bypass all filters.
Missing jq? Install it: brew install jq (macOS) or apt install jq (Linux). Required for the Claude Code hook.
Other install methods
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/jee599/contextzip/main/install.sh | bash
brew install jee599/tap/contextzip
# Windows (PowerShell)
npx contextzip
# Rust developers
cargo install --git https://github.com/jee599/contextzip|
❌ Before |
✅ After |
|
❌ Before |
✅ After |
|
❌ Before |
✅ After |
Note
Currently supports legacy Docker builder output (Step N/M format). Docker BuildKit format passes through uncompressed.
|
❌ Before |
✅ After |
Live stdout compression is table stakes. The bigger problem: your past Claude Code session JSONL under ~/.claude/projects/ accumulates 85.8% tool inputs/results (measured across 6,850 messages). ContextZip is the first tool to compact that archive.
|
Before — 55 MB session, 2,475 records |
After — |
contextzip compact <session-id> # writes a reversible .compressed sidecar
contextzip apply <session-id> # atomic swap; original kept as .bak
contextzip expand <session-id> # roll back; sidecar preservedMore examples: Rust panic, Python, Web page, ANSI, Docker failure, Java/Go
🐍 Python Traceback (72% saved) — Framework frames (flask, importlib) hidden, your code + error message kept.
🦀 Rust Panic (2-7% saved) — std::panicking, tokio::runtime frames hidden, your crate frames kept.
🌐 Web Page (73% saved) — Nav, footer, sidebar, cookie banner, social links stripped. <main>/<article> content kept.
🎨 ANSI/Spinners (83% saved) — Escape codes, spinner frames, intermediate progress bars removed. Final states kept.
🐳 Docker failure — Failed step + 2 prior steps + error message + exit code always preserved.
☕ Java — Removes java.lang.reflect, sun.reflect, org.springframework, org.apache frames.
🐹 Go — Removes runtime/, runtime.gopanic, runtime.main frames.
102 real-world tests. No cherry-picking.
| Category | Tests | Avg Savings | 🏆 Best | 💀 Worst |
|---|---|---|---|---|
| 🐳 Docker build | 10 | 88% | 97% | 77% |
| 🎨 ANSI/spinners | 15 | 83% | 98% | 0% |
| 💥 Error traces | 20 | 59% | 97% | -12% |
| 🔨 Build errors | 15 | 56% | 90% | -10% |
| 🌐 Web pages | 15 | 43% | 64% | 5% |
| 💻 CLI commands | 12 | 42% | 99% | -56% |
| 📦 Package install | 15 | 39% | 99% | 2% |
Weighted total: 61% savings → 326K chars in, 127K chars out
Why some rows show negative savings
Negative = output grew. Happens on tiny inputs where the filter's metadata costs more than it saves. We put the worst numbers in the table because hiding them would be dishonest. Full benchmark →
Built on RTK (28k⭐). All 34 RTK commands included. Plus:
| RTK | ContextZip | |
|---|---|---|
| CLI compression (git, test, ls) | ✅ | ✅ |
| Error stacktraces (Node/Python/Rust/Go/Java) | ❌ | ✅ |
| Web page content extraction | ❌ | ✅ |
| ANSI / spinner / decoration removal | 🟡 | ✅ |
| Build error grouping (tsc/eslint/cargo) | 🟡 | ✅ |
| Package install noise (npm/pip/cargo) | ❌ | ✅ |
| Docker build compression | 🟡 | ✅ |
| Per-command savings display | ❌ | ✅ |
| Session-history compression (planned) | ❌ | 🚧 |
| 2026 toolchain coverage (uv/helm/biome/tf, planned) | ❌ | 🚧 |
The session-history compressor (compact / apply / expand) shipped in v0.2 — see the demo above. Other in-flight tracks: AWS 8→25 subcommand expansion, more compact axes (WritePlaceholder, EditDelta), DSL polish.
Full design: docs/superpowers/specs/2026-04-17-contextzip-advancement-design.md. Short version: ROADMAP.md.
Other v0.2 tracks (full design here):
- Upstream catch-up — rtk v0.31~0.36 fixes (git/aws/clippy/runner)
- New filters —
uv(Python),gradle/mvn(JVM),mise,helm,terraform,biome - Stability — test coverage for
env_cmd/verify_cmd/wget_cmd - DSL polish — env var substitution + per-platform filters
Short version in ROADMAP.md.
| 🔴 Error messages | ALWAYS preserved |
| 📍 File:line in build errors | NEVER removed |
| 🔒 Security warnings (CVE, GHSA) | ALWAYS kept |
| 🐳 Docker failure context | ALWAYS preserved |
| ⏎ Exit codes | ALWAYS propagated |
Important
ContextZip only removes confirmed noise. When in doubt → passthrough.
🏎️ How It Works
┌─────────────────────────────────────────────┐
│ Claude Code runs: git status │
│ ↓ │
│ Hook rewrites → contextzip git status │
│ ↓ │
│ ┌──────────────────────────────────────┐ │
│ │ [1] ANSI preprocessor strip junk │ │
│ │ [2] Command router 40+ filters │ │
│ │ [3] Error post-proc compress stack │ │
│ │ [4] SQLite tracker record savings │ │
│ └──────────────────────────────────────┘ │
│ ↓ │
│ Compressed output → Claude's context │
│ 💾 contextzip: 200 → 40 tokens (80%) │
└─────────────────────────────────────────────┘
🔧 Commands
# Automatic (hook rewrites — no prefix needed):
git status npm install cargo test docker build .
# Manual:
contextzip web https://docs.example.com # page → content only
contextzip err node server.js # error-focused output
# Analytics:
contextzip gain # dashboard
contextzip gain --by-feature # per-filter stats
contextzip gain --graph # daily chart
# Manage:
contextzip init --show contextzip update contextzip uninstall📈 Track Everything
$ contextzip gain
📊 ContextZip Token Savings
════════════════════════════════════════
Total commands: 2,927
Tokens saved: 10.3M (89.2%)
$ contextzip gain --by-feature
Feature Commands Saved Avg%
cli (RTK) 2,100 6.8M 78%
error 89 1.2M 93%
web 43 0.9M 73%
build 112 0.4M 81%git clone https://github.com/jee599/contextzip.git && cd contextzip
cargo test # 1,112 tests
cargo clippy # lintWorking on a track from the roadmap? Open an issue first so we can confirm scope and avoid double work.
ContextZip collects anonymous usage statistics (command count, savings percentage) to improve the tool. No personal data or command content is transmitted.
Disable: export CONTEXTZIP_TELEMETRY_DISABLED=1
MIT — Fork of RTK by rtk-ai.
⚡ Less noise. More code. Ship faster.
