# Output Filtering

> Output filtering compacts noisy command and tool output — logs, builds, test runs — down to its signal before it reaches the model, cutting tokens with no loss of meaning.

Source: https://tokenade.net/en/glossary/output-filtering · Updated: 2026-10-07

## What is output filtering?

Output filtering is the practice of compacting the output of commands and tools before it enters a model's [context window](https://tokenade.net/en/glossary/context-window). When an agent runs `git status`, a build, a test suite or `kubectl get`, the raw result is verbose and mostly boilerplate — progress bars, repeated warnings, unchanged-file lines, decorative tables. Output filtering strips that down to what actually matters: what changed, what failed, what the agent needs to act on.

It's a safe optimisation because the discarded content is genuinely low-signal. Terser command formats (like `git status --porcelain` or `kubectl get -o name`) achieve the same thing at the source.

## Why output filtering matters in 2026

It matters because command output is one of the largest sources of wasted [tokens](https://tokenade.net/en/glossary/token) in agentic coding. A single noisy build log can run to tens of thousands of tokens, and because the agent re-reads its transcript each turn, that noise is paid for repeatedly. Filtering it is often the highest-yield, lowest-risk way to cut an agent's bill — more than any prompt tweak. It's a core lever in [reducing token usage](https://tokenade.net/en/articles/reduce-ai-coding-agent-token-usage).

Two 2026 developments make it more relevant, not less. First, Anthropic's docs note that Claude 4.7 and later models use a tokenizer that produces roughly 30% more tokens for the same text, so the same build log now costs more to carry. Second, the Claude API added context editing, which can clear old tool results from the history by rule. That is useful, but it acts after the noisy output has already been sent at least once; filtering at the source means the bloated version never enters the transcript in the first place.

## When output filtering can hurt

- **When you need the raw output verbatim** — debugging a specific log line means you want it unfiltered.
- **Over-aggressive rules** — filtering that drops the actual error along with the noise is worse than no filtering.

## See also

- [Glossary: Context window](https://tokenade.net/en/glossary/context-window)
- [Glossary: Context compression](https://tokenade.net/en/glossary/context-compression)
- [Article: Reduce Claude Code token usage](https://tokenade.net/en/articles/reduce-claude-code-token-usage)
