Principles for agent-native CLIs
TL;DR Highlight
10 principles for CLIs agents can use well; HN pushes back that it's just good CLI design
Who Should Read
Backend or DevRel developers building CLIs that coding agents like Claude Code will invoke
Core Mechanics
- Ten principles in two tiers
- Tier 1, Table Stakes, has five basics that keep agents from breaking.
- Tier 2, Compounding, has five that make the CLI better the more it's used.
- A prompt means a hang
- A background process spawned by a subagent has nobody to answer a confirmation.
- Every command needs --no-input, --yes or --force style bypasses.
- -json out, valid values in errors
- Data goes to stdout, diagnostics to stderr, and exit codes signal failure class.
- For invalid enum values, the error should list the valid set so one retry fixes it.
- Safe retries and bounded output
- Creates use idempotency tokens or natural keys, and destructive commands get --dry-run.
- Lists have a bounded default page and return truncated plus a hint on how to narrow.
- Cloudflare's Code Mode MCP serves about 3,000 operations in under 1,000 tokens.
- Make vocabulary consistent across CLIs
- Cloudflare's rules: get not info, list not ls, --force not --skip-confirmations, --json not --format=json.
- Manual review is Swiss cheese, so enforce it mechanically at the schema or codegen layer.
- Three-layer introspection
- Layer 1 is --help, layer 2 is versioned JSON via agent-context with schema_version, layer 3 is SKILL.md for workflows.
- All three should be generated and synced with the implementation.
- Async, profiles, two-way I/O
- --wait runs the polling inside the CLI and a local job ledger like ~/.<cli>/jobs.jsonl lets retries find in-flight jobs.
- Profile precedence is explicit flag > env var > profile > default.
- --deliver routes artifacts to stdout, files or webhooks (the source text is cut off here).
Community Reactions
- Opinion that JSON is overrated
- One commenter said plain text is almost always better than JSON for small outputs.
- They agreed machine-readable output only makes sense for large data that scripts will process.
- Benchmarking TOON found JSON won, one commenter reported
- TOON cut tokens as claimed but did worse than JSON and human-readable output in real use cases.
- They attributed JSON's edge to the LLM knowing tools like jq, awk and sort.
- Agent-first redesign also improved the human experience, one commenter reported
- They said agent tool-call logs acted like hundreds of usability tests.
- They also argued these principles match good CLI design from Heroku days.
- Opinion that --force is the wrong bypass flag
- --force means making a failing action happen, so --yes is a better name for skipping confirmation.
- Point that humans watching still need an interactive mode
- A commenter noted pure non-interactive breaks an 'orchestrated interactive' mode where a human steps in.
- Pushback that ledgers and profiles add state problems
- Critics said they create state that agents forget or that conflicts between multiple agents.
How to Apply
- Audit your CLI for prompts and errors today
- Run `cmd < /dev/null` on your CLI and find commands that hang on confirmation.
- Add --yes or --force to them and put valid values in enum errors.
- Enforce naming rules in CI
- Document the standard verbs get/list/create/update/delete and --json.
- Fail CI via static check on banned names like ls, info and --skip-*.
- Bound list output by default
- Set a default --limit around 20 and return truncated and hint fields.
- Check MCP tool descriptions against a token budget at build time.
- Add --wait and a job ledger to async commands
- Run backoff polling inside the CLI and record job state in a local jsonl file.
- Build jobs list/get/prune so a rerun finds the existing job.
Try It
# Paste into Claude Code or ChatGPT (CLI audit prompt based on the article's principles)
Below is the --help output of our CLI. Audit how agent-friendly it is using these criteria.
1. Commands that could hang on a confirmation prompt (is there --yes/--force/--no-input?)
2. --json support, stdout/stderr separation, exit codes
3. Whether invalid enum errors list the valid values
4. Idempotency of creates and --dry-run on destructive commands
5. Default limits and pagination on list commands
6. Vocabulary consistency (get/list vs info/ls, --force vs --skip-*)
7. --wait and a way to inspect jobs for long-running commands
Rate each criterion as blocker/friction/good, and give a table of commands to fix with concrete changes.
{{CLI --help output}}Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques
Related Resources
- https://twitter.com/trevin/status/2051316002730991795
- https://trevinsays.com/p/10-principles-for-agent-native-clis
- https://github.com/toon-format/toon
- https://github.com/mvanhorn/cli-printing-press
- https://printingpress.dev
- https://github.com/pseudosavant/confluence-fetch
- https://github.com/pseudosavant/azwi
- https://github.com/pseudosavant/sql-agent-cli