lowfat is a lightweight CLI tool that reduces AI token costs by filtering CLI output and file content before it reaches your agent. Core focus Lightweight — Small core single binary, extensible via plugins. Local-first — No telemetry; you should own your data. Composable — UNIX-style pipes, mix built-ins and your own custom filters. User-owned — lowfat history shows what you ran most and use it as token saving…
lowfat is a lightweight CLI tool that reduces AI token costs by filtering CLI output and file content before it reaches your agent.
Core focus
Lightweight — Small core single binary, extensible via plugins.
Local-first — No telemetry; you should own your data.
Composable — UNIX-style pipes, mix built-ins and your own custom filters.
User-owned — lowfat history shows what you ran most and use it as token saving tuning per your usecase.
Before / after
git status at the full level — same signal, less noise.
Before — raw git status:
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: crates/lowfat-cli/src/commands/plugin.rs
modified: crates/lowfat-cli/src/main.rs
Untracked files:
(use "git add <file>..." to include in what will be committed)
plugins/git/git-compact/samples/
no changes added to commit (use "git add" and/or "git commit -a")
After — lowfat git status:
On branch main
Changes not staged for commit:
modified: crates/lowfat-cli/src/commands/plugin.rs
modified: crates/lowfat-cli/src/main.rs
Untracked files:
plugins/git/git-compact/samples/
Reduction of raw command output, measured on the bundled samples
(crates/lowfat-plugin/embedded/*/samples/). Reproduce with
cat <sample> | lowfat filter <plugin>/filter.lf --sub=<sub> --level=<level>:
command
lite
full
ultra
git diff
-16%
-38%
-96%
git log
-53%
-80%
-91%
git status
-62%
-62%
-74%
docker ps
-38%
-38%
-85%
docker images
-48%
-58%
-86%
ls -la
-2%
-75%
-87%
These percentages are the reduction of a single command’s output, not your end-to-end agent token usage.
savings depend on how much of your context is command output
and how lossy a level you pick — higher levels drop more, so verify your agent still has what it needs.
treat the table as a ceiling on the output slice, not a promise on the total.
Install
cargo install lowfat
# or
brew install zdk/tools/lowfat
Installs the plugin matching your OpenCode version (detected via opencode --version); the v2 variant is required because 2.0.x changed the plugin API and the
v1 shape loads but silently does nothing there. Restart OpenCode; commands are
rewritten transparently before they run. Uninstall with lowfat opencode uninstall
(removes whichever variant(s) are present).
Claude Code agent summaries — opt-in. Claude Code resends each background agent’s
transcript every 30 s for a 3-word status line
(#86879: ~18% of a subagent-heavy session).
lowfat claude agent-summary off # Bun preload skips that timer; shell-init exports BUN_OPTIONS
claude daemon stop --any # restart, then open a new shell
lowfat claude agent-summary on # undo
Unofficial: a Claude Code update can silently re-enable it, and it may conflict with your service terms.
No hack needed if you don’t use fork subagents: "env": {"CLAUDE_CODE_FORK_SUBAGENT": "0"} in settings.json.
Usage highlights
# See what's configured and how loud each filter is being
lowfat info # status badge + active filters
lowfat info git # pipeline for `git`
lowfat info --config # full resolved config
# See what lowfat has saved you
lowfat stats # lifetime token savings
lowfat stats --audit # recent plugin executions
lowfat history # rank commands by potential savings
# Dial the aggressiveness
lowfat level ultra # max compression
LOWFAT_LEVEL=lite lowfat git log # one-off override
# Write a plugin
lowfat plugin new terraform # scaffold ~/.lowfat/plugins/terraform/
lowfat plugin doctor # check plugins (and pre-install any Python deps)
# Test a plugin against a sample without installing it
cat samples/git-diff-full.txt | lowfat filter --explain ./filter.lf --sub=diff --level=ultra
File content compression (post-read)
When Claude reads files, lowfat post-read compresses the content before it enters the context:
Same commands, same repo, same cwd, run through both tools. Output tokens
counted with tiktoken (cl100k_base); savings are vs the raw command output:
command
raw tokens
lowfat full
lowfat ultra
rtk
git status
81
-91%
-91%
-79%
git diff
1241
-15%
-97%
-9%
git log
3350
-93%
-97%
-56%
ls -la
153
-77%
-89%
-86%
find
535
-0%
-58%
-66%
Honest read: lowfat compresses git harder; rtk edges out find; ls is close.
find only engages at lowfat’s ultra level. rtk’s --ultra-compact gave
near-identical numbers to its default here, so the default is shown. This is a
single small run on one repo — directional, not a benchmark; measure on your own
workload before trusting any of it.
评论