메뉴
HN
Hacker News 54일 전

로우팻(Lowfat): LLM 토큰 91.8% 절약 CLI 필터

IMP
7/10
핵심 요약

로우팻(Lowfat)은 불필요한 CLI 출력을 사전에 필터링하여 AI 에이전트의 토큰 비용을 최대 91.8%까지 절약해 주는 가벼운 오픈소스 CLI 도구입니다. 가볍고 확장 가능한 구조로, Claude Code, OpenCode 등 다양한 AI 코딩 에이전트 환경과 쉽게 연동됩니다. 유닉스 철학을 따르며 원하는 대로 압축 수준을 조절하고 직접 플러그인을 작성할 수도 있습니다.

번역된 본문

Lowfat은 불필요한 CLI 출력을 AI 에이전트에 전달하기 전에 필터링하여 토큰 비용을 줄여주는 가벼운 CLI 도구입니다.

핵심 특징

  • 가벼움(Lightweight) — 작은 단일 바이너리와 작은 코어, 하지만 확장 가능합니다.
  • 로컬 우선(Local-first) — 원격 측정(telemetry) 없이 데이터는 사용자가 직접 소유합니다.
  • 조합 가능(Composable) — 유닉스 스타일 파이프, 내장 필터와 직접 만든 필터를 자유롭게 조합합니다. 마법은 없습니다.
  • 사용자 중심(User-owned) — 실행 이력을 보여주어, 사용자의 사용 사례에 맞게 최적화할 수 있습니다.

설치

cargo install lowfat
# 또는
brew install zdk/tools/lowfat

GitHub Releases에서 사전 빌드된 바이너리도 제공됩니다.

설정 방법 (다음 중 하나 선택)

  • Claude Code 훅.claude/settings.json에 추가:
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "lowfat hook"
          }
        ]
      }
    ]
  }
}
  • 셸 연동 — 에이전트 환경(CLAUDECODE=1, CODEX_ENV)에서 자동 활성화되거나, LOWFAT_ENABLE=1을 설정하여 아무 셸에서나 강제 활성화:
echo 'eval "$(lowfat shell-init zsh)"' >> ~/.zshrc  # 또는 ~/.bashrc
  • OpenCode 플러그인 — 설정 파일 수정 없이 명령어 하나로 설치:
lowfat opencode install  # ~/.config/opencode/plugins/lowfat.ts에 기록됩니다.

OpenCode를 재시작하면 명령어가 실행 전에 투명하게 재작성됩니다. 언제든지 lowfat opencode uninstall로 제거할 수 있습니다.

  • 직접 사용 — 명령어 앞에 접두어를 붙여 사용:
lowfat git status
lowfat docker ps
lowfat ls -la
  • Pi 에이전트~/.pi/agent/settings.json에 추가:
{
  "shellCommandPrefix": "eval \"$(lowfat shell-init zsh)\"; "
}

주요 사용법

# 설정된 내용과 각 필터의 적용 강도 확인
lowfat info                 # 상태 배지 + 활성 필터
lowfat info git             # `git`에 대한 파이프라인
lowfat info --config        # 전체 해석된 설정

# lowfat이 절약해 준 토큰 확인
lowfat stats                # 누적 토큰 절약량
lowfat stats --audit        # 최근 플러그인 실행 내역
lowfat history              # 잠재적 절약량 기준 명령어 순위

# 압축 강도 조절
lowfat level ultra          # 최대 압축
LOWFAT_LEVEL=lite lowfat git log  # 일회성 오버라이드

# 플러그인 작성
lowfat plugin new terraform # ~/.lowfat/plugins/terraform/ 스캐폴드 생성
lowfat plugin doctor        # 플러그인 검사 (Python 의존성 사전 설치 포함)

# 설치 없이 샘플 데이터로 플러그인 테스트
cat samples/git-diff-full.txt | lowfat filter --explain ./filter.lf --sub=diff --level=ultra

더 알아보기

  • docs/ARCHITECTURE.md — 고수준 다이어그램: CLI, Runner, Plugins, Builtins
  • docs/CONFIG.md.lowfat 파일, 환경 변수, 파이프라인 DSL, 내장 프로세서, 이력 순위
  • docs/PLUGINS.md — lf-filter(.lf 플러그인 DSL), 셸 이스케이프 해치, PEP 723 + uv, AI 에이전트 프롬프트

대안 프로젝트: rtk, context-mode, lean-ctx, tokf, tamp, ecotokens, token-enhancer

라이선스: Apache-2.0

AI 고지: 이 프로젝트에는 여러 AI 도구가 사용되었습니다.

원문 보기
원문 보기 (영어)
lowfat is a lightweight CLI tool that reduces AI token costs by filtering unnecessary CLI output 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. Install 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 : { "hooks" : { "PreToolUse" : [ { "matcher" : " Bash " , "hooks" : [{ "type" : " command " , "command" : " lowfat hook " }] } ] } } Shell integration — auto-activates inside agent environments ( CLAUDECODE=1 , CODEX_ENV ), or set LOWFAT_ENABLE=1 to force it on any shell: echo ' eval "$(lowfat shell-init zsh)" ' >> ~ /.zshrc # or ~/.bashrc OpenCode plugin — one command, no config editing: lowfat opencode install # writes ~/.config/opencode/plugins/lowfat.ts Restart OpenCode; commands are rewritten transparently before they run. Remove it anytime with lowfat opencode uninstall . Direct usage — prefix any command: lowfat git status lowfat docker ps lowfat ls -la Pi agent — in ~/.pi/agent/settings.json : { "shellCommandPrefix" : " eval \" $(lowfat shell-init zsh) \" ; " } 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 Learn more docs/ARCHITECTURE.md — high-level diagram: CLI, Runner, Plugins, Builtins docs/CONFIG.md — .lowfat file, env vars, pipeline DSL, built-in processors, the history ranking docs/PLUGINS.md — lf-filter (the .lf plugin DSL), shell escape hatches, PEP 723 + uv, AI agent prompt Alternatives rtk context-mode lean-ctx tokf tamp ecotokens token-enhancer License Apache-2.0 AI notice Multiple AI tools were used for this project