CLI for coding agents
Updated 2026-09-28
Install the Ghosty skill (npx skills add https://www.ghosty.studio) and use the CLI (npx -y @ghostystudio/cli) to configure my agent per https://www.ghosty.studio/en/docs/cli/coding-agents.md.
The CLI is built for your coding agent to drive. It costs little context (the agent learns it from --help), composes with other tools, and its output is stable.
The recipe
- Install the skill that teaches your agent to use Ghosty:
- Ask for what you want in plain words: "change my sales agent's prompt so it quotes in dollars, and test it".
The ghosty-agent skill tells it which commands to use and in what order; the CLI does the work.
The agent drives the login
You don't have to open a terminal:
- The agent runs
ghosty login --json. - The first line out is
{"event":"login_url","url":"…"}. The agent hands you that link in the chat. - You open the link and sign in. If you already have a session on ghosty.studio, opening it is enough.
- The CLI receives the session, prints
{"event":"logged_in","email":"…"}and the agent carries on.
The session is stored on your computer and renews itself. Later commands ask for nothing.
Machine output
With --json, stdout carries only JSON and notices go to stderr, so the agent can read the result without cleaning it up.
ghosty chat --json emits one line per event: chunk, tool, and finally done with the full text and token usage (usage). If the turn fails, instead of done you get the error in the format below and exit code 1.
Exit codes
Errors with --json look like: {"error":"Not logged in.","code":3,"hint":"Run: ghosty login"}.
The agent runs on another machine
If the agent works in a box, in CI or over SSH (away from your browser), ghosty login notices and uses a device code:
The agent hands you the link; you open it on your phone or computer, check that the code matches and authorize. The CLI picks it up and carries on. To force it from any machine: ghosty login --device.
Only authorize codes you or your agent just asked for: if someone else sends you an /activar link, reject it.
No browser: agent token
For CI or a remote machine with no browser, use the agent's token (gat_…, generated on the agent's page → Generate token):
That token reaches only its agent. To list agents or use chat, sign in with ghosty login.