Wrapping CLIs for agent consumption: the art of output parsing

Most command-line tools weren’t designed with AI agents in mind. They were built for humans who can squint at irregular output, infer meaning from context, and forgive the occasional formatting inconsistency. When you hand these tools to an agent, that forgiveness evaporates. What looks like helpful verbose logging to a developer becomes an unparseable wall of noise to an LLM trying to extract a single boolean success indicator. The gap between human-friendly and agent-friendly output is wider than it appears. A CLI that prints colorful status updates, progress bars, and helpful warnings is doing exactly what it should for interactive use. But those ANSI escape codes, those dynamically updating lines, those context-dependent messages—they turn into parsing nightmares the moment you try to wrap them in a script that needs to make decisions based on the results. The Twelve-Factor App methodology has something to say about this: treat logs as event streams, not formatted output. That wisdom applies doubly when your consumer is an agent. ...