There's a post making the rounds on Hacker News right now that hit a nerve: "You need to rewrite your CLI for AI agents." The title sounds dramatic, but the author is right about the core problem.
Most command-line tools were built for humans sitting at a terminal. They output colorful tables, show spinning progress bars, ask interactive questions, and format things to look nice on a screen. That's great for humans. It's terrible for AI agents.
I've been building and deploying AI agent setups for months now, and CLI compatibility is one of the most common friction points. Not because agents can't run commands — they can. But because the output they get back is a mess of ANSI escape codes, ASCII art, and formatting that the AI model has to decode instead of just reading structured data.
The problem in practice
Here's a real example. I had a client whose agent needed to check their Docker containers. The docker ps command returns a nicely formatted table for humans:
CONTAINER ID IMAGE STATUS PORTS NAMES
a1b2c3d4e5f6 postgres:16 Up 2 hours 0.0.0.0:5432->5432 my-db
f6e5d4c3b2a1 redis:7 Up 2 hours 0.0.0.0:6379->6379 my-cache
The agent sees this and has to parse column-aligned text, figure out where one field ends and another begins, and hope the formatting doesn't shift when a container name is longer than expected. It works most of the time. "Most of the time" isn't good enough for automation.
The fix? docker ps --format json. Same data, structured output:
{"ID":"a1b2c3d4e5f6","Image":"postgres:16","Status":"Up 2 hours","Names":"my-cache"}
Now the agent reads it perfectly every time. No parsing ambiguity. No broken automation when someone names a container "my-very-long-descriptive-name-for-this-service."
What good CLI design looks like for agents
After deploying dozens of agent setups, I've noticed patterns in which tools work well and which cause headaches. The good ones share a few traits:
JSON output mode
This is the big one. If your CLI has a --json or --output json flag, the agent can read it reliably. The GitHub CLI (gh) is excellent at this. Every command supports --json with field selection. gh pr list --json number,title,state gives you exactly what you need, nothing you don't.
Non-interactive mode
Interactive prompts kill automation. "Are you sure? (y/n)" hanging forever because no human is watching. Good tools have --yes or --non-interactive flags. Or better yet, they detect when stdin isn't a terminal and skip prompts automatically.
Predictable error format
When something fails, the agent needs to understand what went wrong. "Error: connection refused" is useful. A stack trace with 47 lines of internal function calls is noise. Structured error output — error code, message, and suggested fix — lets the agent recover intelligently.
Stdin-friendly input
Some tools only accept input through interactive editors or multi-step wizards. Agents work much better with tools that accept input via stdin, command-line arguments, or config files. Pipe in data, get results out.
How OpenClaw handles the messy reality
The world isn't going to rewrite every CLI overnight. In the meantime, agents need to work with tools as they exist. This is where OpenClaw's skill system earns its keep.
Skills act as structured wrappers around CLI tools. A skill defines what inputs a tool expects, what outputs to look for, how to handle errors, and what flags to use for machine-readable output. The agent reads the skill definition and knows how to use the tool correctly without trial and error.
For example, instead of letting the agent figure out Docker's output format on its own, a Docker skill specifies: use --format json, parse these specific fields, handle these error cases. The agent gets reliability. You get automation that doesn't break on Tuesday because someone updated the container naming convention.
This is one of the reasons I recommend self-hosted agents over cloud alternatives for serious automation. When you control the environment, you can set up skills and tooling that match your exact infrastructure. Cloud agent platforms give you their integrations. Self-hosted gives you yours.
The tools that get it right
Some CLI tools are already agent-friendly. Here's my short list of tools that work beautifully with AI agents:
GitHub CLI (gh): JSON output on every command, structured errors, non-interactive mode. The gold standard.
jq: Built for this. Takes JSON in, outputs JSON. The agent loves it.
curl: Verbose when you need it, quiet when you don't. Structured exit codes. Perfect for API work.
ripgrep (rg): JSON output mode, reasonable defaults, fast enough that the agent doesn't hang waiting.
systemctl: Structured output available, predictable behavior, good exit codes.
And some that cause headaches:
Most npm scripts: Output is a mix of build logs, warnings, progress bars, and actual results. Good luck parsing that.
Interactive database CLIs: psql, mysql, redis-cli — great for humans, challenging for agents without wrapper scripts.
Cloud provider CLIs (sometimes): AWS CLI is mostly good with --output json. Azure CLI is decent. GCP's gcloud is inconsistent.
What you can do today
If you're running an AI agent and hitting CLI friction, here are practical fixes:
1. Audit your agent's tools. Look at which commands your agent runs most often. Check if they have JSON output modes. Enable them.
2. Write thin wrapper scripts. For tools without JSON output, a simple bash script that parses the output into JSON can save hours of agent confusion. Five minutes of scripting now prevents five hours of debugging later.
3. Use OpenClaw skills. If you're running OpenClaw, create custom skills for your most-used tools. Skills tell the agent exactly how to use each tool, including which flags to use and how to parse output.
4. Test with your agent. Run the command yourself, then look at the raw output — not in your terminal, but piped to cat -v so you see the escape codes. That's what your agent sees. If it's ugly, fix it.
The bigger picture
We're at an interesting inflection point. AI agents are capable enough to use command-line tools, but most tools weren't designed with AI consumers in mind. The gap between "technically works" and "reliably works" is where most automation breaks.
The developers who add --json flags and non-interactive modes to their CLI tools are going to see a massive adoption boost. Their tools become first-class citizens in the agent ecosystem. The ones who don't will get wrapped, forked, or replaced.
For now, the practical approach is to work with what exists. Pick an agent framework that handles the messiness for you — OpenClaw's skill system does this well — and build up your tool integrations incrementally.
If you want an AI agent setup where the CLI integrations actually work reliably, that's exactly what we configure during setup. Every tool, every output format, every edge case — tested and working before we hand it over. Book a free 15-minute call and we'll map out which tools your agent needs and how to make them work together.
The future is AI agents that use your existing tools as well as you do. We're not there yet, but we're getting close.