Tokf
CLI tool that filters command output to save LLM tokens
Tokf is a practical, free tool for developers using CLI-based AI assistants who want to cut token costs and improve response quality. It's open-source, privacy-first, and does one thing well. If you use Claude Code or Copilot daily, tokf is worth the minimal setup.
- Developers using Claude Code or Copilot for daily coding
- Teams wanting to reduce LLM token costs from CLI output
- Users of task runners (make, just, mise) who integrate LLM assistants
- Privacy-conscious developers needing offline AI tooling
- Non-developers or those not using CLI-based AI assistants
- Users who do not work with LLMs or AI coding tools
- Teams needing a GUI or web interface
We scan live Reddit threads, YouTube comments, X posts, G2 reviews and other communities — and hand you an honest verdict in under a minute.
- Honest verdict, not marketing
- Real pros & cons from real users
- Attributed quotes with receipts
3 free scans · no card needed
In short
Tokf — CLI tool that filters command output to save LLM tokens. Best for Developers using Claude Code or Copilot for daily coding, Teams wanting to reduce LLM token costs from CLI output, Users of task runners (make, just, mise) who integrate LLM assistants. Free to use.
What's new in Tokf
Checked 11 days agoAcross the latest 5 updates: 2 feature updates and 3 changelog entries.
v0.2.50: unwrap local environment wrappers (nix develop -c)
New feature to unwrap local environment wrappers like nix develop -c.
v0.2.49: correct multibyte UTF-8 compound rewrites
Bug fix for correct handling of multibyte UTF-8 compound rewrites.
v0.2.48: preserve newline after operator in nested-list segments
Bug fix to preserve newline after operator in nested-list segments.
v0.2.47: passthrough gh pr/issue filters when user supplies --json/-q/--jq
Bug fix: passthrough gh pr/issue filters when user supplies --json/-q/--jq.
v0.2.46: add Codex PreToolUse integration
New feature: Codex PreToolUse integration added.
Viability Score
How likely is Tokf to still be operational in 12 months? Based on 4 signals — momentum (how recently it shipped), wrapper dependency, revenue model, and web presence.
Last calculated: July 2026
How we score →Key Features
- TOML-based filter configuration
- Automatic git hook integration
- Transparent wrapper for make, just, mise task runners
- 63 built-in command pattern filters (cargo, git, docker, npm, etc.)
- Luau scripting escape hatch for complex logic
- JSONPath (RFC 9535) extraction
- Cloud sync for team filter sharing (opt-in)
- Full offline and air-gapped operation
- Tokf doctor subcommand to detect problematic filters
- Tokf discover to find missed token savings
- Reduction statistics and compression indicator
- Telemetry status subcommand
- OpenTelemetry OTLP metrics exporter
- Codex PreToolUse integration (v0.2.46)
- Multibyte UTF-8 compound rewrite support
About Tokf
Tokf is an open-source CLI tool written in Rust that intercepts terminal command output and applies user-defined TOML filters before it reaches an LLM coding assistant. It solves the problem of noisy, verbose command output wasting token budgets in AI tools like Claude Code, Copilot, Cursor, and Aider. By filtering irrelevant lines, compressing repetitive patterns, and restructuring output, tokf can reduce payload size by over 98%. The tool is designed for developers who use LLM-based coding assistants regularly and want to maximize useful information per token. It integrates with git hooks, task runners (make, just, mise), and IDE shells so filtering happens transparently. Users define filters in simple TOML files, and tokf ships with 63 built-in patterns for popular tools like cargo, git, docker, npm, and kubectl. Tokf runs 100% locally with no telemetry or network calls by default. Optional cloud sync is available for sharing filters across a team, but it is completely inert until the user explicitly runs `tokf auth login`. The project emphasizes privacy and offline capability. Advanced users can embed sandboxed Luau scripts for complex conditional logic, and the tool supports JSONPath extraction, RTK filter format compatibility, and a `tokf doctor` subcommand to detect filters causing agent confusion. Recent updates (v0.2.49) fix multibyte UTF-8 compound rewrites, and v0.2.46 adds Codex PreToolUse integration. What makes tokf distinctive is its approach of compressing command output at the source (the terminal) rather than post-processing in the LLM context. This preserves the integrity of the original command output while eliminating noise. Compared to alternatives like prompt compression libraries, tokf operates before the data ever enters the AI context, making it a first-line defense against token waste.
Behind the Verdict
Tokf fills a narrow but painful gap in the AI coding workflow: the flood of irrelevant terminal output that burns through your token budget before the LLM sees anything useful. Unlike prompt compression libraries that work on the LLM side, tokf filters at the source — your shell — so the model receives only the signal from command output. The setup is minimal: install via Homebrew or Cargo, drop a TOML filter file, and tokf wraps git hooks and task runners automatically. The built-in library covers 63 patterns for tools like cargo, git, docker, npm, pnpm, kubectl, and Next.js. We'd reach for this when using Claude Code or Copilot on a codebase with long test suites or verbose build logs — tokf commonly reduces output by 98%, keeping only test summaries and error messages. Where it bites: tokf only helps if you work from the CLI. Developers who rely on IDE-only assistants like Copilot Chat in VS Code might not see direct benefit unless they also use the terminal. The TOML filter syntax is straightforward but still a learning curve for non-Rust users. And if your commands already produce minimal output (e.g., simple echo or lint passes), the savings are negligible. Compared to Aider's built-in output compression, tokf is more flexible and runs transparently across any tool — it isn't tied to a single AI assistant. But Aider users may find the native integration sufficient. For teams on Claude Code or Cursor, tokf's per-command filtering and git hook automation offer a cleaner separation of concerns. Real-world caveat: while tokf is fully local by default, the optional cloud sync is easy to skip. The tool is actively maintained with frequent bug fixes (latest v0.2.49). For anyone paying per token on an coding LLM, tokf can pay for itself in savings within a few
Researching Tokf? Get your full AI stack in 60 seconds.
Free, no signup — tell us your goal and get tools matched to your budget & existing stack.
Use Cases
- Reduce token usage by compressing cargo build output before sending to Claude Code
- Automatically strip noise from git diff output when using Copilot inline chat
- Set up git hooks to filter output from every commit and push command
- Wrap make targets so that build logs are condensed before reaching an LLM
- Use tokf doctor to identify filters that confuse AI agents
- Share custom filter sets across a team via optional cloud sync
Limitations
- Tokf is a CLI-only tool with no GUI or web interface, which limits its audience to developers comfortable with terminals.
- The cloud sync feature is optional but requires explicit login.
- Some advanced filter logic may require Lua scripting knowledge for complex patterns.
12-month cost
Project the real annual outlay, including the implied monthly cost when only an annual tier is published.
Vendor list price only. Add-on usage, seat overages, and contract minimums are surfaced under Hidden costs & gotchas.
Integrations
Resources & Guides
Official links
Tools that pair well with Tokf
Common stack mates teams adopt alongside Tokf, with the specific reason each pairing earns its keep.
Featured Head-to-Head Comparisons
Alternatives to Tokf
View allFrequently Asked Questions
Best-of guides
Used Tokf? Help shape our editorial sentiment research.