Your CLI's next user is an AI agent. Design for it.
Originally published on the flypod blog. Most of the people installing our CLI aren't people. We make flypod, a small command that puts whatever you made online as a link someone else can open: a website, a Markdown do
Originally published on the flypod blog.
Most of the people installing our CLI aren't people.
We make flypod, a small command that puts whatever you made online as a link someone else can open: a website, a Markdown doc, a slide deck, a page of charts. We built it for developers at a terminal. Then we looked at who was actually running it. Over the last month, more than nine in ten new installs came from a coding agent. In almost every one of those projects, nothing mentioned flypod: no rules file, no AGENTS.md, no Agent Skill. The agent found the tool, ran it, read the output, and handed a link to a person.
That changes who you are designing for. Our most frequent user can't see a spinner, doesn't read the docs first, and will never open an issue. When the CLI confuses it, it doesn't complain. It guesses, and then tells a person something wrong with total confidence.
So we started designing for the agent first. Here are the seven changes that came out of it, each with the failure it fixes. None of them needs a framework, and most fit in an afternoon.
The seven, in short:
- Treat
--jsonoutput as an API: one line on stdout, nothing else, even on a crash. - Give every failure a fixed
code, and make the exit code follow it. - Put the next command in the error, as
fix. - Start every warning by saying the command worked.
- When a credential is refused, fail. Never fall back.
- Read which agent is calling from its environment, as one word.
- Give the agent a way to remember your tool next session.
1. The output is an API, so treat it like one
Every command takes --json. Under it, success and failure are both one line of JSON on stdout and nothing on stderr. No spinners, no colours, no "Uploading..." line for an agent to strip.
None of this is new advice. The Command Line Interface Guidelines already say "Display output as formatted JSON if --json is passed" and "If stdout is not an interactive terminal, donβt display any animations." For a person those are good manners. For an agent they decide whether it can read your answer at all.
A real failure, from an empty folder:
{"ok":false,"code":"no_build_dir","error":"No build output folder found.","fix":"Looked for dist, build, out, β¦ (each must contain an index.html). Pass the folder explicitly, e.g. `npx flypod ./dist`."}
The rule we hold ourselves to: no command may print prose to stdout under --json, ever, including when it crashes. Tests run every verb with a mistyped flag and expect a clean unknown_flag failure, not a crash. An agent that gets half JSON and half stack trace guesses, and agents guess badly and confidently.
2. Agents branch on a code, not on a message
error is for the person reading the transcript. code is for the agent: a fixed word like no_build_dir, token_rejected or quota_exceeded. We can reword every message without breaking a single agent, because nothing should ever match on the wording.
The exit code follows the error code, never the place it was raised:
| Exit | Means | What the agent should do |
|---|---|---|
| 0 | worked | carry on |
| 1 | a problem it can act on | read fix
|
| 2 | the command line is wrong | change the command |
| 3 | auth | ask the person to sign in |
| 4 | retryable | wait and run it again |
That last row matters most. An agent that sees 4 retries. An agent that sees 1 for a rate limit "fixes" something that was never broken.
3. Every error carries its fix
fix is the next command, written out. no_build_dir lists the folders it looked in and tells you to pass yours. An unknown flag names the closest real one. And when a command needs a sign-in, flypod login --json prints the sign-in URL and code as JSON, so the agent hands the link to the person instead of hanging on a browser it does not have.
The test we apply: could an agent recover from this error with no documentation, using only the JSON? If not, the error is not finished.
4. Warnings say "don't redo this"
Agents are eager. Tell one "warning: X" and it often runs the whole thing again to make the warning go away.
So every note on a successful deploy starts by saying the deploy worked. For example, an update to a temporary site in its last three days now returns:
link-expiring: This deploy worked; do not redo it. This is a temporary site and updates do not extend it: the link stops working in 2 days (2026-11-27 UTC). Tell the person. To keep it, run `flypod login` (free): the site becomes theirs and never expires.
We added that one this week, from a number: of the installs that pushed an update into a site's final three days last month, only about one in eight signed in to keep it. The person usually found out when the link died. The agent knew the expiry date the whole time; it just had no reason to mention it.
5. Never downgrade silently
If a command is sent with a credential and the credential is refused, it fails with token_rejected. It does not quietly fall back to deploying anonymously.
A person would notice the difference. An agent would not: it would get a perfectly good link to a temporary site that nobody owns, report success, and the site would expire two weeks later. A loud failure costs one retry. A silent fallback costs the person's work.
6. Know which agent is calling (without spying on it)
Most coding agents announce themselves in the environment of the commands they run: Claude Code sets CLAUDECODE, Cursor's agent sets CURSOR_AGENT, Codex sets CODEX_SANDBOX, Gemini CLI sets GEMINI_CLI, and newer tools use the AI_AGENT convention. We read those and reduce them to one word, claude_code, cursor, codex, and so on. The value itself is never sent.
We deliberately ignore variables that are set in every terminal of an editor, like TERM_PROGRAM. Otherwise a person typing in the editor's terminal reads as an agent, and the numbers lie.
That one word is how we know the nine-in-ten figure above. It is also how we found that one agent finds flypod constantly and others almost never, which told us where to spend the next month.
7. Help the agent remember you
An agent that found your tool today starts tomorrow's session with no memory of it. So the first deploy from a new machine, run by an agent, in a project where nothing names flypod, gets one optional note:
remember-flypod: Optional: ask the person whether to run `npx flypod install skill --yes`, which adds flypod's skill to this project so the next session starts with it. Nothing needs redoing.
It is shown once per install, never to a person typing, and it asks the agent to ask the person, because it adds files to their project.
What should a CLI do for AI agents?
Assume an agent will run it before a person does. Then:
-
--jsoneverywhere, one line, stdout only, including on crash. - A stable
codeon every failure, and exit codes that follow it. - A
fixthat is the literal next command. - Notes that say "this worked" before they say anything else.
- Fail loudly instead of falling back.
None of this makes the human experience worse. The default output is still a short, readable receipt. The agent just gets its own door.
This article was created with the help of AI. Every number, quote and code sample in it was checked against flypod's code, its real command output and its own analytics before publishing.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.