You need to rewrite your CLI for AI agents

(justin.poehnelt.com)

54 points | by justinwp 11 hours ago

15 comments

  • sheept 25 minutes ago
    This feels completely speculative: there's no measure of whether this approach is actually effective.

    Personally, I'm skeptical:

    - Having the agent look up the JSON schemas and skills to use the CLI still dumps a lot of tokens into its context.

    - Designing for AI agents over humans doesn't seem very future proof. Much of the world is still designed for humans, so the developers of agents are incentivized to make agents increasingly tolerate human design.

    - This design is novel and may be fairly unfamiliar in the LLM's training data, so I'd imagine the agent would spend more tokens figuring this CLI out compared to a more traditional, human-centered CLI.

    • gck1 17 minutes ago
      Yeah, people seem to forget one of the L's in LLM stands for Language, and human language is likely the largest chunk in training data.

      A cli that is well designed for humans is well designed for agents too. The only difference is that you shouldn't dump pages of content that can pollute context needlessly. But then again, you probably shouldn't be dumping pages of content for humans either.

    • magospietato 7 minutes ago
      Surely the skill for a cli tool is a couple of lines describing common usage, and a description of the help system?
  • Lio 2 minutes ago
    “Need”?

    Why would I need to do that?

    Someone else might ”want” me to do that but it’s not a ‘”need” I have.

  • jeppeb 1 hour ago
    The article states that agents work better with JSON than documented flags - that seems counterintuitive . How is this assumption validated?
  • jsunderland323 27 minutes ago
    I'm working on a CLI now.

    The pattern I used was this:

    1) made a docs command that printed out the path of the available docs

    $ my-cli docs

    - README.md

    - DOC1.md

    - dir2/DOC2.md

    2) added a --path flag to print out a specific doc (tried to keep each doc less than 400 lines).

    $ my-cli docs --path dir2/DOC2.md

    # Contents of DOC2.md

    3) added embeddings so I could do semantic search

    $ my-cli search "how do I install x?"

    [1] DOC1.md

    "You can install x by ..."

    [2] dir2/DOC2.md

    "after you install..."

    You then just need a simple skill to tell the agent about the docs and search command.

    I actually love this as a pattern, it work really well. I got it to work with i18n too.

  • inkdust2021 5 minutes ago
    There are so many diffierent CLI, why not use them or basic on them to rewrite?
  • rsanheim 27 minutes ago
    No. Nope. Agents do just fine with all sorts of CLIs. Old standards, new custom stuff, whatever.

    The CLIs I’ve seen agents struggle with are those that wrap an enormous, unwieldy, poorly designed API under one namespace. All of Google Workspace apis, for example.

  • smy20011 1 hour ago
    Are we reinventing RPC again? Calling CLI program with JSON sounds like RPC call. The schema feels likes something LSP can provided for such function.

    Maybe asking agent to write/execute code that wraps CLI is a better solution.

  • jauntywundrkind 9 minutes ago
    And for more persistent services, worth considering using varlink, for your agents sake and just if you need two cli thinks to chat. https://varlink.org/

    The systemd universe is moving this way from dbus, and there doesn't seem to be a ton of protest against giving up dbus for json over unix sockets. There's really not that many protocols that are super pleasant for conversing with across sockets.

  • computerfriend 57 minutes ago
    > Humans rarely typo a traversal.

    I don't think this is true?

    • MattGaiser 40 minutes ago
      The typos are a bit different, but that’s one reason I hate the command line as a human.

      You want me to hand type a file name? I’ll flip a letter or skip one!

      • bewuethr 23 minutes ago
        I like to let tab completion write my filenames for me whenever possible.
      • esseph 7 minutes ago
        [delayed]
  • justinwp 11 hours ago
    Title is a little clickbait, but not really! :)

    ---

    Human DX optimizes for discoverability and forgiveness. Agent DX optimizes for predictability and defense-in-depth. These are different enough that retrofitting a human-first CLI for agents is a losing bet.

  • devmor 41 minutes ago
    This is a very silly premise to begin with.

    If AI agents are so underdeveloped and useless that they can’t parse out CLI flags, then the answer is not to rewrite the CLI.

    You either give the agents an API layer or you don’t use them because they’re not mature enough for the problem space.

  • dang 1 hour ago
    Related ongoing thread:

    Google Workspace CLI - https://news.ycombinator.com/item?id=47255881 - March 2026 (136 comments)

  • lejalv 1 hour ago
    > The real question: what does it actually look like to build for this?

    What was the not-so-real question? Or the surreal question?

    I know it's becoming tiresome complaining of slop in HN. But folks! Put a bit of care in your writing! It is starting to look as if people had one more agent skill "write blogpost", with predictable results, as we are not a Python interpreter putting up with meh-to-disgusting code but actual humans with real lives and a sense of taste in communication

    • vasco 20 minutes ago
      The content is good, who cares. What gets more tiresome is complaints like this. The post was upvoted so people like it.
    • redanddead 1 hour ago
      blogslop
  • lynx97 38 minutes ago
    I love how AI gave the command-line and TUI interfaces a kind of Second Renaissance. It is not just AI that loves CLIs. It is especially blind people like me, who still use a lot of text-mode tools for their implicit accessibility. I gave codex a whirl recently, and hey! No accessibility problems at all. Just works. A few years back, that would have been released as a GUI-only program and would have locked me out completely[1]. A blessing that text oriented interaction is becoming important again!!!

    1: Strictly speaking, there are ways to access some GUI programs on Linux with a screen reader. However, frankly, most are not really a joy to use. The speed of interaction I get from a TUI is simply unmatched. Whenever I work with a true GUI, no matter if Windows, Mac or Linux, it feels like I am trying to run away from a monster in a dream. I try to run, but all I manage to do is wobble about...

  • scuff3d 1 hour ago
    [flagged]