-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Problem (one or two sentences)
CLI commands executed by the LLM (like cargo test, git status, npm install) produce verbose output that floods the context window with noise — passing tests, progress bars, redundant formatting. This wastes massive amounts of tokens (up to 89% according to real-world measurements) and degrades reasoning quality.
Context (who is affected and when)
Every user who relies on terminal commands during AI-assisted coding sessions is affected. It's especially painful in projects with large test suites, monorepos, or frequent git/build/package-manager operations — the LLM receives hundreds of irrelevant lines per command, burning tokens and pushing useful context out of the window.
Desired behavior (conceptual, not technical)
Command output should be automatically filtered and compressed before reaching the LLM context. For example, instead of 155 lines of test output, the model should see a compact summary like "47 passed, 2 failed" with only the failure details. This should work out-of-the-box for common tools (git, npm, cargo, pip, test runners) with sensible defaults, be toggleable per session, and allow users to define custom filtering rules for their own commands. Inspired by the RTK project (https://github.com/rtk-ai/rtk) which demonstrated ~10M tokens saved (89% reduction) over two weeks.
Constraints / preferences (optional)
Feature Request: Built-in CLI output filtering/compression to reduce token usage (inspired by RTK)
Hey team! 👋
I recently came across an interesting project called [RTK (Rust Token Killer)](https://github.com/rtk-ai/rtk) — a CLI proxy that filters and compresses command output before it reaches the LLM context. The author shared their results on [Reddit](https://www.reddit.com/r/ClaudeAI/comments/1r2tt7q/i_saved_10m_tokens_89_on_my_claude_code_sessions/), and the numbers are impressive:
cargo test: 155 lines → 3 lines (98% reduction)git status: 119 chars → 28 chars (76% reduction)git log: compact summaries instead of full output- Total savings over 2 weeks: ~10M tokens (89%)
The core idea is simple: most CLI output sent to the LLM is noise — passing tests, verbose logs, progress bars, redundant formatting. Stripping that out before it hits the context window saves a massive amount of tokens without losing any useful information.
Why this would be valuable as a built-in feature in your project:
- Users wouldn't need to install and configure a separate tool
- Filtering rules could be context-aware and tightly integrated with your existing command execution pipeline
- It directly reduces costs and improves response quality (less noise = better reasoning)
- It could be opt-in with sensible defaults
Possible implementation scope:
- Configurable output filters for common commands (
git,npm,cargo,pip, test runners, etc.) - Smart truncation with summary (e.g., "47 tests passed, 2 failed" instead of full test output)
- User-defined rules for custom commands
- Toggle on/off per session or globally
I think this kind of optimization would be a huge quality-of-life improvement for users and a natural fit for your tool. Would love to hear your thoughts on whether this is something you'd consider exploring!
References:
- RTK repo: https://github.com/rtk-ai/rtk
- RTK site: https://www.rtk-ai.app
- Reddit discussion: https://www.reddit.com/r/ClaudeAI/comments/1r2tt7q/
Request checklist
- I've searched existing Issues and Discussions for duplicates
- This describes a specific problem with clear context and impact
Roo Code Task Links (optional)
No response
Acceptance criteria (optional)
No response
Proposed approach (optional)
No response
Trade-offs / risks (optional)
No response