RTK Saves 60% of Tokens. I Made It Save 90%.

Published: (March 19, 2026 at 08:07 AM EDT)
5 min read
Source: Dev.to

Source: Dev.to

RTK is one of the best tools in the Claude Code ecosystem—28 k GitHub stars, 60‑90 % token savings on git, test, and ls output, and 34 command modules with TOML‑based filters. If you use Claude Code and don’t have RTK installed, go install it now.

Blind spots of RTK

  • No compression of error stack traces.
  • No handling of npm install warnings.
  • Docker build logs pass through unchanged.
  • ANSI escape codes (spinners, progress bars, color codes) flow straight into your context window.

I forked RTK and built ContextZip to fill those gaps. Below is a direct comparison.

What RTK Does vs. What ContextZip Adds

CategoryRTKContextZip
git diff/log/status✅ (inherited)
ls/find/tree✅ (inherited)
Test output (Jest, pytest)✅ (inherited)
Cargo/Rustc output✅ (inherited)
Error stacktraces✅ — 5 languages
ANSI/spinner cleanup✅ — preprocessor
npm/pip install noise✅ — keeps security
Docker build logs✅ — 88 % avg savings
Build error grouping✅ — deduplicates
Web page extraction✅ — article only

ContextZip inherits all 34 of RTK’s command modules and 60+ TOML filters unchanged. Everything RTK compresses, ContextZip compresses identically. The six new filters run on output that RTK passes through untouched.

The 6 New Filters

Error stacktrace compression

Supports Node.js, Python, Rust, Go, and Java. Strips framework/library frames, keeping only your code frames and the error message. Example: a 30‑line Express stack trace becomes 3 lines.
Savings: 93 % (Node.js), 80 % (Rust), 58.7 % average across all languages.

ANSI preprocessor

Runs before all other filters. Removes escape codes, cursor movement sequences, spinner characters (⠋⠙⠹⠸), progress bars, and decorative lines while preserving error markers, timestamps, and warning prefixes.
Savings: 82.5 % average.

Package install compression

Deletes npm warn deprecated spam, pip download progress, and Yarn resolution noise. Keeps the install summary, security audit results, and any vulnerability warnings.
Savings: 95 % on npm, with zero security information lost.

Docker build compression

  • Success: Collapses all layer hashes and pull progress into a single summary line with stage count and duration.
  • Failure: Preserves the failing step, error output, and surrounding context.
    Savings: 88.2 % average, up to 97 % on large multi‑stage builds.

Build error grouping

Identical errors (e.g., TS2322: Type 'string' is not assignable to type 'number') are grouped; the message appears once with a compact list of file:line references.
Savings: 55.6 % average.

Web page extraction

contextzip web fetches a page and strips navigation, footer, sidebar, cookie banners, ads, and script tags. Returns the main content with code blocks and tables preserved—ideal for pulling documentation into context without the surrounding chrome.

102‑Test Benchmark: The Honest Numbers

CategoryCasesAvg SavingsBestWorst
Docker build1088.2 %97 %77 %
ANSI/spinners1582.5 %98 %41 %
Error stacktraces2058.7 %97 %2 %
Build errors1555.6 %90 %-10 %
Package install1272.3 %95 %15 %
Web extraction1068.4 %89 %34 %

Weighted total: 102 cases, 61.1 % average savings.

The worst cases are real: Rust panics with short traces (2 % savings) and single build errors can yield a -10 % net change (formatting overhead exceeds noise removed). These edge cases trigger a threshold passthrough—if compression ratio drops below 10 %, the original output is emitted unchanged.

Combined with RTK’s inherited filters, total savings on a typical debugging session run 70‑90 %.

Safety Guarantees

ContextZip is aggressive on noise but conservative on signal. Three rules are never broken:

  1. Error messages are never removed. The actual error text (TypeError, ENOENT, panic!, segfault) always passes through.
  2. Security warnings are never removed. npm audit vulnerabilities, CVE references, and authentication failures are preserved.
  3. Test failure details are never removed. Expected vs. actual values, assertion messages, and failing test names all pass through.

If a filter cannot confidently classify something as noise, it passes it through unchanged.

Migrating from RTK

# Uninstall RTK (optional — they don't conflict)
# Install ContextZip
curl -fsSL https://raw.githubusercontent.com/jee599/contextzip/main/install.sh | bash

The install script sets up the Claude Code hook automatically. Restart Claude Code and you’re done. If you had RTK’s hook configured, ContextZip replaces it—same hook mechanism, same binary location pattern.

Your existing workflow doesn’t change. Every command you run in Claude Code is compressed automatically. The only visible difference: the savings line now says contextzip instead of rtk, and the numbers are higher on error‑heavy sessions.

0 views
Back to Blog

Related posts

Read more »