rtk (Rust Token Killer) M4 Mac mini Benchmark: Up to 87.3% CLI Token Reduction
- Measuring
rtk 1.2.1on Apple M4 Mac mini showed -87.3% byte reduction on passingpytestruns (726 B → 92 B) and -39.3% ongit log -n 20(5,704 B → 3,460 B). - Compression gains vary steeply by command: a working tree with 30+ untracked files saw only -6.5% on
git status, and custom Astro formatter output onnpm run builddropped just -1.7%. - Because compaction can strip long commit bodies or debugging clues, leave global
rtk inithooks off initially and invokertk test/rtk git logexplicitly where ROI is clear.
1. Why CLI Stdout Bloat Hurts Coding Agents
Autonomous coding agents feed command stdout straight back into the prompt window on every iteration. Test progress dots and verbose commit headers accumulate turn over turn, inflating prompt-cache footprints and eating through weekly cloud quotas. We benchmarked rtk 1.2.1 (installed via Homebrew, global hooks disabled) across real repositories on an Apple M4 Mac mini to measure real savings versus information loss.
2. Raw vs Compressed Benchmark Results
Estimated tokens are calculated uniformly as ceil(len(text) / 4) across both raw and compressed outputs.
Figure 1: Measured Byte Reduction by Command (rtk 1.2.1 on M4 Mac mini)
| Command | Raw Output (bytes / lines / est. tok) | rtk Output (bytes / lines / est. tok) | Byte Reduction | Wall Time (Raw → rtk) |
|---|---|---|---|---|
rtk test .venv/bin/pytest | 726 B / 13 lines / 182 tok | 92 B / 2 lines / 23 tok | -87.3% | 0.28s → 0.17s |
rtk git log -n 20 | 5,704 B / 154 lines / 1,400 tok | 3,460 B / 37 lines / 839 tok | -39.3% | 0.01s → 0.01s |
rtk git status | 2,078 B / 40 lines / 520 tok | 1,943 B / 34 lines / 486 tok | -6.5% | 0.01s → 0.03s |
rtk npm run build | 2,082 B / 42 lines / 504 tok | 2,046 B / 37 lines / 495 tok | -1.7% | 1.47s → 0.91s |
3. Compaction Behavior & Information-Loss Audit
rtk test .venv/bin/pytest(-87.3%): Stripsplatform darwinbanners and dot-progress lines, leaving only the 2-line summary (pass count and duration). Note thatrtk pytestis not a valid top-level subcommand inrtk 1.2.1; usertk test ....rtk git log -n 20(-39.3%): CollapsesAuthor:,Date:, and blank lines into single-line summaries (<hash> <subject> (<relative time>) <author>). Great for quick scanning, though rawgit log --statis still needed when inspecting multi-line commit bodies.rtk git status(-6.5%): Strips instructional hints while retaining porcelain-style branch and??untracked paths; savings were modest when >30 untracked files existed.rtk npm run build(-1.7%): Removes npm wrapper banners, while custom Astro/Vite build lines pass straight through unchanged.
# Install via Homebrew (global rtk init hooks kept disabled)
brew install rtk
rtk --version # rtk 1.2.1
# Call rtk explicitly where compression ROI is highest
rtk test .venv/bin/pytest
rtk git log -n 20
rtk git status 4. Honest Trade-offs: Why Global Hooks Stay Disabled
- Debugging context loss risk: Enabling global
rtk inithooks rewrites outputs indiscriminately across tool calls, which can hide subtle build warnings or multi-line commit context during incident debugging. - Wrapper ergonomics: Subcommands differ slightly from raw binaries (such as
rtk testinstead ofrtk pytest), so explicit invocation in scripts or targeted agent calls is safer and more predictable.
5. Frequently Asked Questions (FAQ)
Does rtk (Rust Token Killer) reduce every CLI command output by 80% or more?
No. In our M4 Mac mini (rtk 1.2.1) benchmark, pytest via rtk test dropped by 87.3% (726 B to 92 B) and git log -n 20 by 39.3% (5,704 B to 3,460 B), while git status with 30+ untracked files dropped 6.5% and Astro npm run build dropped only 1.7%.
Can I invoke rtk pytest directly as a subcommand?
No. rtk 1.2.1 has no standalone rtk pytest top-level subcommand; wrap pytest through rtk test .venv/bin/pytest and check rtk --help for supported wrappers.
Should coding agents enable global rtk init hooks on day one?
We advise against blanket global hooks during active debugging. Compaction can omit multi-line commit bodies, change stats, or subtle compiler/build warnings. Explicit calls for rtk test and rtk git log preserve safety while cutting recurring token bloat.
Does rtk add noticeable latency to local tests or builds?
As a native Rust binary, overhead is minimal: git status went 0.01s to 0.03s, git log -n 20 stayed 0.01s to 0.01s, pytest measured 0.28s to 0.17s, and npm run build measured 1.47s to 0.91s.
How does rtk complement a local M4 Mac mini LLM pipeline?
Compressing verbose test/git stdout via rtk cuts frontier prompt-cache consumption, while offloading repetitive extraction and classification to a local 27B Q2_0 node keeps daily marginal API spend near zero.
- Interactive Apple Silicon LLM Memory & USD Cost Calculator
- M4 Mac mini (16GB) Hybrid Local LLM Guide (+57.4% Speed & -90.1% Heap)
- Setting Up External NVMe Storage for Local LLMs on M4 Mac mini
- Running a Home M4 Mac mini 24/7: Power, Sleep & launchd Design
- Original Japanese Article(rtk M4 Mac mini 実測ベンチマーク)