Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

lowfat

> AI 编程
Open source

lowfat - slim your command output. strips noise, saves tokens.

564 stars0 likes3 views
WebsiteGitHub

About

lowfat - slim your command output. strips noise, saves tokens.

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 single binary, small core; but extensible.
  • Local-first — No telemetry; you own your data.
  • Composable — UNIX-style pipes, mix built-ins and your own filters; not magic.
  • User-owned — lowfat history shows what you run most; allow you to customize for 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 ..." to update what will be committed)
  (use "git restore ..." 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 ..." 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 | lowfat filter /filter.lf --sub= --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

bash
cargo install lowfat
# or
brew install zdk/tools/lowfat

Pre-built binaries on GitHub Releases.

Setup

Pick one of:

Claude Code hook — add to .claude/settings.json:

json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [{ "type": "command", "command": "lowfat hook" }]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Read",
        "hooks": [{ "type": "command", "command": "lowfat post-read" }]
      }
    ]
  }
}

PreToolUse rewrites Bash commands through lowfat filters. PostToolUse compresses file content after Read — strips comments, collapses function bodies, summarizes lock files.

The filtering pattern Anthropic recommends, but via lowfat.

Shell integration — auto-activates inside agent environments (CLAUDECODE=1, CODEX_ENV), or set LOWFAT_ENABLE=1 to force it on any shell:

bash
echo 'eval "$(lowfat shell-init zsh)"' >> ~/.zshrc   # or ~/.bashrc

OpenCode plugin — one command, no config editing:

bash
lowfat opencode install   # writes ~/.config/opencode/plugins/lowfat.ts

Restart OpenCode; commands are rewritten transparently before they run. Uninstall with lowfat opencode uninstall.

Direct usage — prefix any command:

bash
lowfat git status
lowfat docker ps
lowfat ls -la

Pi agent — in ~/.pi/agent/settings.json:

json
{ "shellCommandPrefix": "eval \"$(lowfat shell-init zsh)\"; " }

Usage highlights

…

File content compression (post-read)

When Claude reads files, lowfat post-read compresses the content before it enters the context:

Content type What it does
Source code (Rust, Python, Go, Elixir, JS/TS, Java, Ruby, C/C++, Shell) Strip comments, normalize blanks; at ultra: collapse function bodies to signatures
Markdown Strip badges, HTML comments; truncate code blocks and tables
HTML / Vue / Svelte Strip , , class attributes; at ultra: text extraction only
JSON / JSONC Truncate large arrays, collapse deep nesting
Lock files (Cargo.lock, package-lock.json, yarn.lock, ...) Replace with summary: package count + top deps
Unknown Head + tail with line count

Compression level follows LOWFAT_LEVEL (lite/full/ultra). Files with

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustagentic-coding-toolclicost-reductiondeveloper-tools

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.