Stop Wasting 89% of Your AI Agent's Tokens on CLI Noise
AI coding agents - Claude Code, Cursor, GitHub Copilot, Windsurf - run your CLI tools and feed the output back into the LLM context window. The problem: most CLI tools were built for humans staring at terminals, not for machines parsing results.
Progress bars, color codes, box-drawing borders, ASCII art banners - all meaningless noise for an LLM. And you're paying for every token of it.
The numbers #
Over ~2,900 CLI commands measured by rtk-ai, 11.6M input tokens were consumed, of which 10.3M (89.2%) were noise. A typical 2-hour AI coding session generates ~210K tokens of raw CLI output - enough to overflow a 200K context window with mostly garbage.
A team of 10 developers wastes approximately $1,750/month on noise tokens alone.
A real-world example #
Here's default PHPUnit output for a test suite with 500 tests, 1 failure:
PHPUnit 12.5.14 by Sebastian Bergmann and contributors.
Runtime: PHP 8.4.19
Configuration: /var/www/html/phpunit.xml
............................................................... 63 / 500 ( 12%)
............................................................... 126 / 500 ( 25%)
............................................................... 189 / 500 ( 37%)
..................................F.............................. 252 / 500 ( 50%)
............................................................... 315 / 500 ( 63%)
............................................................... 378 / 500 ( 75%)
............................................................... 441 / 500 ( 87%)
.......................................................... 500 / 500 (100%)
Time: 00:12.345, Memory: 256.00 MB
There was 1 failure:
1) Tests\Unit\AppHelperTest::get_morph_class_accepts_model_instance
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'App\Models\Role'
+'App\Models\Role---error'
/var/www/html/tests/Unit/AppHelperTest.php:20
FAILURES!
Tests: 500, Assertions: 1200, Failures: 1.
~250 tokens. The progress lines, banner, timing, and memory stats account for most of it. The actual failure information is only ~60 tokens.
Now the same result with --no-progress --colors=never:
PHPUnit 12.5.14 by Sebastian Bergmann and contributors.
Runtime: PHP 8.4.19
Configuration: /var/www/html/phpunit.xml
Time: 00:12.345, Memory: 256.00 MB
There was 1 failure:
1) Tests\Unit\AppHelperTest::get_morph_class_accepts_model_instance
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'App\Models\Role'
+'App\Models\Role---error'
/var/www/html/tests/Unit/AppHelperTest.php:20
FAILURES!
Tests: 500, Assertions: 1200, Failures: 1.
~140 tokens. Same failure details. The banner and footer are still there (PHPUnit doesn't let you suppress them), but the 500 progress dots are gone. ~45% reduction - and on a 5,000-test suite, the savings are even larger.
What wastes the most tokens #
| Token waster | Impact |
|---|---|
Progress bars (████, dots) |
500-2000 tokens per run |
ANSI color codes (\x1b[31m) |
~5-10 extra tokens per colored word |
Box-drawing borders (+---+) |
2-5x more tokens than plain text |
| ASCII art banners | 50-200 tokens per logo |
| Repeated dots (PHPUnit) | ~1 token per dot, hundreds per suite |
The fix: one flag per tool #
Every PHP quality tool has flags to disable the noise. Here's the cheat sheet:
# PHPUnit / ParaTest
--no-progress --colors=never
# PHPStan - use raw format (file:line:message, one per line)
--no-progress --no-ansi --error-format=raw
# Psalm - use text format (file:line:col:severity, one per line)
--no-progress --monochrome --show-snippet=false --no-suggestions --output-format=text
# phpcs - use emacs format (file:line:col:severity, one per line)
--report=emacs -q --no-colors
# PHP-CS-Fixer
--show-progress=none --no-ansi -n
# Rector
--no-progress-bar --no-ansi
# Pint - use agent format (auto-detected in Claude Code/OpenCode)
./vendor/bin/pint --test --format agent
# Composer
composer install -q
Where to put these flags #
Don't memorize them. Put them in your CLAUDE.md or AGENTS.md file - this is read by Claude Code, Cursor, Gemini CLI, OpenCode, and others:
## Running Tools
Always use these flags when running CLI tools:
- Tests: `vendor/bin/phpunit --no-progress --colors=never`
- PHPStan: `vendor/bin/phpstan analyse --no-progress --no-ansi --error-format=raw`
- Psalm: `vendor/bin/psalm --no-progress --monochrome --show-snippet=false --output-format=text`
- phpcs: `vendor/bin/phpcs --report=emacs -q --no-colors`
- PHP-CS-Fixer: `vendor/bin/php-cs-fixer fix --show-progress=none --no-ansi -n`
- Rector: `vendor/bin/rector process --no-progress-bar --no-ansi`
The pattern #
Across all tools, the pattern is the same:
- Disable progress bars - the #1 token waster
- Disable colors - ANSI escape codes are garbage for LLMs
- Use one-line-per-error format -
raw,text,emacs- nottableorcompact(Psalm ≤6) - Don't switch to JSON - it has ~40% overhead from key repetition. Plain text is more token-efficient for error lists
Do this once, save thousands of tokens per session, and stop feeding your AI agent junk.
This article covers PHP. I've collected the same flags for Node, Python, Go, Rust, Ruby, Java, Kotlin, Swift, and .NET in one repo: awesome-ai-friendly-cli.
- Previous: First hour of a new Laravel project