A suite with a thousand tests can spend more context describing successes than explaining one failure. PAO, a library created by Nuno Maduro, targets that problem. It detects when PHPUnit, Pest, or ParaTest runs inside a coding agent and replaces the presentation made for people with compact JSON. In the project's published example, 11,125 output tokens fall to about 20, a 99.8% reduction.
The figure attracts attention, while the mechanism remains deliberately small. The package enters through Composer, recognizes environments such as Claude Code, Cursor, Devin, and Gemini CLI, and changes the output format. It needs no Laravel service provider or dedicated configuration. It also works with Symfony, Laminas, and framework-free PHP when the testing tool version is compatible.
That simplicity exposes a problem hidden when only people read terminals: much development output communicates visual state rather than operational information.
Repeated success still has a cost
Progress bars, dots, colors, banners, and one line per test help a person see that a process is alive. For an agent, thousands of confirmations carry nearly one meaning: nothing failed. Every character still enters the context window, competes with code, and may be sent again in later interactions.
The waste grows in a counterintuitive way. A healthy suite with many passing tests may create more noise than a small broken suite. As a team invests in coverage, the output an agent must cross before finding actionable information becomes larger.
Compact JSON changes the reading unit. Instead of recreating the terminal experience, it provides status, counts, and failure details. When everything passes, the response can remain almost constant regardless of suite size. When something breaks, the payload grows only where diagnosis exists.
Context optimization starts before the model
Teams try to save tokens by choosing smaller models, summarizing prompts, or reducing documentation. Those measures affect agent reasoning. Filtering redundant output acts earlier by removing information that should never have occupied the conversation.
The distinction matters because context is more than an invoice line. A crowded window can push out instructions, previous decisions, and relevant files. The agent repeats searches or loses a constraint that was clear at the start. Shorter output lowers cost while preserving space for the task.
The same principle applies outside testing. Linters with thousands of repeated warnings, builds that print every copied file, and infrastructure commands that dump complete responses can offer a machine mode. The best interface is not always a natural-language summary. A stable structured format proportional to errors is often more useful.
Before installing another layer, check whether the tool already has --json, --quiet, or a compact reporter. PAO is useful because it collects this adaptation for PHP testing tools and changes behavior according to the consumer without forcing people to abandon familiar output.
Automatic detection needs an escape route
Autoloader magic removes setup but should remain observable. A developer investigating a failure may want full human output even inside an environment recognized as an agent. A CI integration may depend on the previous format. Supported versions and override behavior belong in the review before broad adoption.
Teams should validate failures, not only the green case. A reporter that excels when everything passes may omit a stack trace, dataset, or comparison when a test fails. A useful check is small: trigger a known failure and confirm that the agent receives file, line, expected value, observed value, and the correct exit code.
The reported token reduction describes one scenario. Actual cost varies by runner, plugins, test count, and model tokenizer. The decision does not require reproducing exactly 99.8%. If output grows with repeated success, there is a measurable opportunity.
A better metric for agent tools
Development tools usually measure execution time. With agents, two more measures matter: bytes produced and information required for the next decision. A fast command that emits a wall of text can delay the flow more than a few additional seconds of processing.
A practical evaluation records output from a green suite and three representative failures before and after the change. It compares tokens, diagnostic ability, and format stability. If the agent must rerun every error with different flags, some savings disappear.
PAO suggests a pattern other tools can copy without knowing any model: human output by default, structured output for a machine consumer, and detail proportional to the exception. It is a narrow intervention. That is why it can reduce cost without redesigning the suite, prompt, or review process.
If your company is weighing something similar, reach me on LinkedIn or WhatsApp.