# Filtering Build Output Reduced AI Coding Agent Token Consumption by Up to 30%

DevFeed: [Filtering Build Output Reduced AI Coding Agent Token Consumption by Up to 30%](<https://devfeed.tech/articles/the-souffle-problem-one-regex-30-fewer-tokens-23715.md>)

Original publisher: [Read original article](<https://medium.com/whatnot-engineering/the-souffl%C3%A9-problem-one-regex-30-fewer-tokens-5026e6841cf4?source=rss----162aeca881b0---4>)

Author: Bartek Lipinski

Published: 2026-06-23T16:01:03Z

Content type: tutorial

Language: en

Sources: [Whatnot Engineering](<https://devfeed.tech/sources/whatnot-engineering.md>)

Topics: [AI-assisted coding](<https://devfeed.tech/topics/ai-assisted-coding.md>), [AI Agent](<https://devfeed.tech/topics/ai-agent.md>), [context window](<https://devfeed.tech/topics/context-window.md>), [context](<https://devfeed.tech/topics/context.md>), [Tool](<https://devfeed.tech/topics/tool.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [agentic-ai](<https://devfeed.tech/tags/agentic-ai.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-agent](<https://devfeed.tech/tags/ai-agent.md>), [ai-coding-agents](<https://devfeed.tech/tags/ai-coding-agents.md>), [bash](<https://devfeed.tech/tags/bash.md>), [build](<https://devfeed.tech/tags/build.md>), [commands](<https://devfeed.tech/tags/commands.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [context-window](<https://devfeed.tech/tags/context-window.md>), [llms](<https://devfeed.tech/tags/llms.md>), [token](<https://devfeed.tech/tags/token.md>), [token-efficiency](<https://devfeed.tech/tags/token-efficiency.md>), [tool](<https://devfeed.tech/tags/tool.md>)

## AI overview

The article explains how filtering irrelevant build output with a regex can reduce token consumption for AI coding agents by up to 30%. It describes how noisy logs fill the context window, causing repeated costs and unnecessary tool calls, and presents filtering as a way to make agent behavior more predictable.

## Source excerpt

Our AI agent was burning tokens on every turn by processing build noise that provided no signal. Context windows clogged with irrelevant logs, forcing the agent to waste cycles and thrash through unnecessary tool calls. We solved this with one line of regex; a filter that cut token consumption by up to 30% and, more importantly, stopped the agent from flailing. It's not just a cost-saving trick; it makes the agent's behavior more predictable, spending its budget on the fix instead of the hunt. To grok this, imagine a chef tasked with making a soufflé with ingredients but no recipe. An expert chef, using school-honed skills, might succeed immediately or through a few refined attempts. Success is inevitable because they possess the competence to iterate. A mediocre chef eventually succeeds too, but wastes far more food in the process. AI coding agents operate similarly when facing unknowns. They iterate, try, and fail before reaching an answer. They are capable enough to succeed, but they waste significant compute and tokens during the process. The solution isn't rocket science, but just really good filtering that is specific to tasks that can be token-heavy. Here's an example of that below. For the rest of the post we will do a deep dive into what we did, how it works, and you can ultimately use the recipe for your coding agents. The asymmetry Coding agents with capable LLMs are good at knowing which tool to call. They pick the right command as they work towards their objective. But they are bad at predicting what the output will look like and where in that output to focus. The agent fires off a build command. Hundreds of lines of build output land in its context window. The relevant compiler error is buried somewhere in the middle. Reading through a log is second nature to you; you scan the text without a second thought. You scroll. Your eye snags on red text, stack traces, the word FAILED. You find what matters in seconds, and the rest of the output costs you nothi