PAO by Nuno Maduro is a dev tool that detects when your tests are running inside an AI agent — Claude Code, Cursor, Devin, Gemini CLI — and replaces the normal test runner output with compact JSON. The result is a fraction of the token count, with no change to how you run your tests.
How It Works
PAO hooks into PHP's autoloader. Once installed, it automatically detects AI agent environments and switches from the test runner's default human-readable output to a minimal JSON format:
{ "result": "passed", "tests": 1002, "passed": 1002, "duration_ms": 321}
That output is constant at roughly 20 tokens regardless of how large your test suite is.
Token Reduction
The benchmarks from a 1,000-test suite show a significant difference:
| Runner | Without PAO | With PAO | Reduction |
|---|---|---|---|
| PHPUnit | 336 tokens | 20 tokens | 94% |
| Pest | 10,123 tokens | 20 tokens | 99.8% |
| Pest (parallel) | 11,125 tokens | 20 tokens | 99.8% |
Beyond the per-run savings, the bigger benefit in longer agentic sessions is context window preservation. Test output that would otherwise accumulate over dozens of runs no longer competes with code and conversation history.
Framework and Runner Support
PAO works with PHPUnit 12–13, Pest 4–5, and Paratest. It's not Laravel-specific — any PHP project using one of those runners (Laravel, Symfony, Laminas, vanilla PHP) gets the same behavior.
Installation
PAO requires PHP 8.3 or higher. No config file, no service provider, no additional setup — activation happens through Composer's autoloader automatically.
composer require nunomaduro/pao:0.x-dev --dev
Note that the package is a work in progress under active development.
You can find the source on GitHub.