Shrinking a Noisy Test Run Before Claude Ever Sees It
Your npm test output floods the context with thousands of lines of
passing-test noise on every run.
What mechanism lets you filter that output down to just the failures before it ever reaches Claude's context?
The correct answer is "A PreToolUse hook that filters output
before Claude sees it."
A PreToolUse hook can rewrite the command itself — for example,
piping npm test through grep -E 'FAIL|ERROR' | head -100 — so the
tens of thousands of tokens of passing-test noise never make it into
the conversation at all. Asking Claude to "only look at the failures"
still means the full output was already read into context first;
/effort changes reasoning depth, not what a tool call returns; and
sandboxing restricts what commands can touch, not what they print.
Share this question