banish.shdocs
HomeGitHub
Guides / Compact go test output
View as Markdown

Compact go test output

go test ./... on a real module prints a result line for every package and, on failure, the full test output - which an agent can pull into context in a single read and spend most of its token budget on. banish compacts that output before it reaches Claude Code, Cursor, or any MCP agent, keeping the failures and dropping the wall of passing packages.

The problem - go test output is repetitive

A passing run is dozens of ok package/path lines that all say the same thing. A failing run buries the one --- FAIL the agent needs under those same passing lines plus the surrounding noise. Reading it verbatim spends tokens on packages that did exactly what was expected.

Before and after with banish

banish runs the real command and pipes the output through the go filter:

CommandRaw tokensCompactedSaved
go test ./... (1 fail)3304188 percent

The filter keeps every failure verbatim and collapses the passing packages into a count, so the agent sees what broke without paging through what did not. See the full spread across commands on the benchmarks page, reproducible with banish bench.

How the go filter works

The go filter ships with banish and compacts go test, go build, and go vet. It keeps the failures and error lines and collapses the passing packages; when the kept output is very long it caps the length and marks how many more lines were dropped, so nothing is removed silently. If a filter fails, banish returns the raw output rather than swallowing it. See built-in filters for the full set.

Write your own for another command

The same approach works for any noisy command. The .bsh language lets you define a filter in about ten lines - no recompile. To start compacting go test output in your own agent, set up an agent.

Compact go test output for LLM coding agents - fewer tokens - banish