Context-Efficient Backpressure for Coding Agents
Techniques for reducing context window waste in AI coding agents by suppressing verbose output from tests and builds, showing full details only on failure.
The Problem
Test, build, and lint output consumes excessive tokens without providing useful information to AI agents. A single passing test generates dozens of lines the agent must parse, wasting context for minimal signal.
The Smart Zone
Claude models perform optimally within a ~75k token range. Every redundant line diminishes agent performance and moves closer to context exhaustion.
The run_silent() Solution
A bash wrapper that:
- Suppresses successful command output (shows only checkmark)
- Displays full output only on failure
- Provides deterministic control over what reaches the agent
Practical Techniques
- Fail-fast modes: Use
pytest -xorjest --bailto surface one failure at a time - Filter output: Remove unnecessary stack frames and timing info
- Framework-specific parsing: Extract only meaningful data
Key Insight
"Every token you use is diminishing the results and moves you closer to needing to clear or compact to get back to the smart zone."
Deterministic pre-filtering beats reactive truncation. Design intentional backpressure rather than letting models waste tokens on defensive output handling.
Related
Companion to writing-a-good-claude-md—both focus on optimizing Claude Code workflows.