Show HN: Lowfat – pluggable CLI filter that saved 91.8% of my LLM tokens
TL;DR Highlight
Filtering CLI output cut git log output by up to 91-97% in bundled samples
Who Should Read
Developers using Claude Code who run many git and docker commands and worry about context size and token cost
Core Mechanics
- It shrinks command output before the agent sees it
- lowfat is a single Rust binary that filters CLI output and file content before it reaches the agent.
- It runs locally with no telemetry.
- Compression has three levels: lite, full, ultra
- On the bundled samples, git log dropped 53% at lite, 80% at full, and 91% at ultra.
- git diff dropped 16% at lite, 38% at full, and 96% at ultra.
- These numbers are not end-to-end token savings
- The README says the percentages are reductions of a single command's output.
- It tells you to treat them as a ceiling on the output slice, not on total usage.
- It plugs in as Claude Code hooks
- A PreToolUse hook rewrites Bash commands through lowfat filters.
- A PostToolUse hook compresses file content after Read.
- File reads get compressed too
- Source code loses comments, and at ultra function bodies collapse to signatures.
- Lock files become a summary of package count and top dependencies.
- Files with under 10% savings pass through unchanged.
- Head-to-head with rtk favors lowfat on git
- Measured with tiktoken (cl100k_base) against raw output, git log at 3350 tokens dropped 97% with lowfat ultra versus 56% with rtk.
- rtk won on find, 66% versus lowfat ultra's 58%.
- The author calls it a single small run on one repo, directional only.
Community Reactions
- Opinion that the 91.8% headline is overstated
- A commenter said it was 91% of raw CLI output tokens in one user's case, not 91% of all tokens.
- They argued Amdahl's law means overall savings must be much smaller.
- Experience that such filters confuse agents
- One commenter tried rtx and lean-ctx, and the agent worked around the tool and made more calls, erasing savings.
- They found subagents better for keeping the top-level context clean.
- Several worried about stripping needed info like stack traces
- Commenters feared cutting what the agent needs would create more work.
- Others questioned whether output unlike the full-length text seen in training hurts reasoning.
- Tip: tell the LLM where the full output lives
- One commenter found that noting the full text is in a /tmp file lets the LLM read more with built-in tools.
- Another said teaching agents to ask narrow questions, like jsonpath instead of kubectl get -o yaml, is better.
How to Apply
- Measure your own output reduction first
- Run cargo install lowfat, then save outputs of your frequent commands as sample files.
- Pipe each through lowfat filter and compare sizes at lite, full, and ultra.
- Start the Claude Code hooks at lite level
- Add PreToolUse (Bash) and PostToolUse (Read) hooks to .claude/settings.json.
- Set LOWFAT_LEVEL=lite and check whether the agent still sees what it needs.
- Use lowfat history to pick what to compress
- After a week, check lowfat history and lowfat stats for the best savings candidates.
- Apply higher levels only to high-impact commands and verify error logs aren't cut.
Try It
# Paste into your terminal (install and measure commands from the README)
cargo install lowfat
git log -n 50 > /tmp/gitlog.txt
wc -c /tmp/gitlog.txt
for lv in lite full ultra; do
echo "== $lv"
LOWFAT_LEVEL=$lv lowfat git log -n 50 | wc -c
done
lowfat stats
lowfat historyTerminology
Related Papers
A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth
Install Unsloth Desktop, load a quantized Qwen model, and share a private ChatGPT-like AI on your home LAN.
Muru – AI-assisted Rust server for Python apps by mod_WSGI's creator
mod_wsgi's creator is building Muru, an AI-assisted Rust ASGI/WSGI server, documenting it in public
87% of the Anthropic power will come from gas and 11% from coal in 2028
Analysis of Anthropic's contracted data centers: 87% gas, 11% coal power in 2028
Anthropic’s Nasdaq debut
Anthropic listed on Nasdaq and closed its first day below its opening price.
OpenAI still has a WebRTC Problem
WebRTC drops late audio, hurting voice AI; MoQ retransmits and buffers instead
Gemini 4 Neon
Gemini 4 Neon cuts cost per task 32% versus Carbon, at $3 input and $15 output per million tokens
AI is killing All About Berlin
After Google AI Overviews, a Berlin guide site lost 70-75% of its traffic.
Not Everything Needs an LLM
PostHog used small decision models to skip 98.7% of expensive LLM calls