A practical rubric for evaluating and building CLIs that work well for agent consumers, not just humans. Sourced from Seven Principles for Agent-Friendly CLI Design (Every Inc.), which fills the gap between generic CLI design guides (written for humans) and Anthropic’s tool-design guidance (not CLI-specific).

The framing: the question is not “does this technically work?” but “does this work well?” — agents can often limp through bad CLIs, but at the cost of tokens, retries, and failure modes that didn’t need to exist.

Why CLI Over MCP

For day-to-day developer tools, a well-designed CLI beats an MCP server on three dimensions:

  • Token cost: An MCP server can burn tens of thousands of tokens loading tool definitions before a single question gets asked. A CLI README is loaded on demand.
  • Speed: No protocol overhead. Text in, text out.
  • Reliability: LLMs already know common CLI tools from training data. Zero schema to maintain.

MCP earns its complexity when you need per-user auth, structured governance, or a maintained community server already exists. For custom tools, CLI wins. See CLI Tools Pattern for the full comparison.

The Severity Rubric

Each finding maps to one of three levels:

LevelMeaning
BlockerPrevents reliable agent use. Command hangs, requires human intervention, or produces output an agent can’t recover from.
FrictionAgents can use it but inefficiently: more retries, wasted tokens, brittle parsing, extra tool calls.
OptimizationWorks fine, but could be faster, cheaper, or more reliable.

Severity depends on command type. Idempotence is critical for mutating commands but irrelevant for a streaming log tail. Structured output is a Blocker for read/query commands but less critical for a one-off bootstrap wizard. Evaluate by what the command does.


The Seven Principles

1. Non-interactive by default

Any command an agent might automate should run without prompts. When a skill spawns a background subagent, there is no way to surface an interactive prompt back through the chain. The command hangs.

If stdin isn’t a TTY, the command must not prompt.

What to implement:

  • --no-input or --non-interactive global flag
  • Detect TTY and suppress prompts automatically when stdin is not interactive
  • --yes / --force for confirmation bypass
  • Accept all inputs via flags, files, or stdin

Test: detach stdin with subprocess.DEVNULL and enforce a 10-second timeout. A hanging command is a Blocker.


2. Structured, parseable output

Commands that return data need a stable machine-readable format. A nicely aligned table with ANSI colors is useless to an agent trying to extract an ID.

What to implement:

  • --json on all data-bearing commands
  • Exit code 0 for success, non-zero for failure (always)
  • Result data to stdout; diagnostics to stderr
  • Suppress color, spinners, and decorative output when not attached to a TTY

The easy-to-miss case: many CLIs detect TTY correctly for prompts but still blast ANSI escape codes into piped output. An agent parsing \x1b[32m✓ Published\x1b[0m is burning tokens on noise.

No structured output at all is a Blocker. --json coverage with clean stdout/stderr separation is the target.


3. Fail fast with actionable errors

When a command fails, the error should teach the agent how to succeed on the next attempt. Agents can’t infer what went wrong from a vague message the way humans can.

A good error does four things:

  1. Names the specific problem
  2. Shows the correct invocation shape
  3. Suggests valid values
  4. Includes an example

An agent that gets a complete error message can self-correct in one retry. An agent that gets “missing required arguments” has to guess, burning extra calls and risking another failure.

What to implement: validate early before side effects; include correct syntax in error output; suggest valid values when validation fails; prefer actionable text over raw tracebacks.


4. Safe retries and explicit mutation boundaries

Agents retry, resume, and sometimes replay commands. A human running a command twice will notice the duplicate. An agent in a retry loop won’t — unless the CLI tells it.

For create/update/deploy commands: make duplicate application a no-op or clearly detectable, and return an identifier in success output. For append/send/trigger commands: make mutation boundaries explicit.

What to implement:

  • --dry-run for consequential mutations
  • Explicit destructive flags for dangerous operations (e.g. --confirm on delete)
  • Return enough state in success output to verify what happened

Retrying a mutating command that silently duplicates state is a Blocker.


5. Progressive help discovery

Agents don’t read full documentation up front. They probe: top-level help first, then the specific subcommand, then examples. The goal is to go from “what can this tool do” to “how do I invoke this specific command” in two calls.

Each subcommand’s --help should include:

  • A one-line purpose
  • A concrete invocation pattern
  • Required arguments and flags
  • The most important modifiers and safety flags
  • At least 2-3 examples

Examples matter more than they seem. Concrete examples improve how well agents use tools (Anthropic’s own tool-design guidance confirms this). A help page with no examples forces the agent to synthesize invocation from descriptions alone — wasted tokens, higher error rate.


6. Composable and predictable structure

Agents chain commands. They’re less tolerant of inconsistency than humans because they pattern-match on structure rather than reading docs and making judgment calls.

What to implement:

  • Accept input via flags, files, or stdin where it helps automation
  • Support - as a stdin/stdout alias when file paths are involved
  • Consistent naming across related subcommands (--limit not --max-results in one place and --count in another)
  • Consistent flag coverage (--json available everywhere that returns data, not just in some subcommands)

Inconsistency means the agent has to learn exceptions rather than apply patterns. Exceptions cost tokens and create failure modes.


7. Bounded, high-signal responses

Agents pay a real cost for every extra line of output. A human scrolls past 500 lines visually. An agent consumes all 500 lines into its context window, paying for every token, then has to find the relevant lines.

When the CLI truncates, it should teach the agent how to narrow the query:

“Showing 25 of 312 posts. To narrow: blog-cli posts list --status published --since 7d --limit 10”

That gives the agent a next step. Dumping all 312 posts gives it a parsing problem.

What to implement:

  • Default limits on large result sets (25-50 is a reasonable default)
  • Filtering and pagination flags
  • Truncation messages that suggest the narrowing query
  • Summaries and identifiers before raw detail

Quick Evaluation Checklist

PrincipleBlocker conditionOptimization target
Non-interactiveHangs on detached stdinGlobal --non-interactive flag, TTY detection
Structured outputNo machine-readable format--json everywhere, clean stdout/stderr split
Actionable errorsSilent or vague failuresError names problem + shows fix + gives example
Safe retriesMutating command silently duplicates--dry-run, idempotent creates, explicit destructive flags
Help discoveryNo --help or missing subcommand helpLayered help with examples at every level
Composable structureCan’t accept stdin or pipe outputConsistent naming, stdin support, predictable patterns
Bounded responsesUnbounded dumps by defaultDefault limits with truncation-aware narrowing hints

The Core Insight

Agents have gotten more forgiving with every model release. But “well enough” costs tokens, burns retries, and introduces failure modes that don’t need to exist. Designing for agents as a first-class consumer removes that tax — and the CLI ends up better for humans in the process.

Every principle here also makes CLIs better for humans. Structured output, actionable errors, bounded responses, automation-ready paths — these have been inconsistently applied because humans are forgiving enough to work around the gaps. Agents are not.


See Also