Output Filtering

Cite this page

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. 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 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.

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