Docs › CLI

AstraCode CLI

Install astracode-agent, sign in, and use the AstraCode agent in a terminal, a CI job, or Zed and JetBrains.

astracode-agent is the AstraCode agent without the editor. On its own it opens a conversation in the current folder. With -p it runs one task and exits, for scripts and CI. It runs the same agent as the editor, with AstraOne's model routing and the same approval rules, on the same account.

The command is astracode-agent because astracode already opens the editor.

Install

On macOS or Linux, arm64 or x64:

curl -fsSL https://astracode.io/install | sh

It puts a standalone binary in ~/.local/bin with Node built in. It checks the download's checksum, and on a Mac that AstraCode signed it. Nothing needs sudo.

Or, with Homebrew:

brew install astracode-io/tap/astracode-agent

Or, with Node 20 or later:

npm install -g astracode-agent

The CLI tells you when a newer version is out. If you used the installer, astracode-agent update installs it. A Homebrew or npm copy is theirs to update, and the CLI names the command: brew upgrade astracode-agent or npm install -g astracode-agent@latest.

Sign in

The first time you run it, it checks it can reach AstraCode, asks which colour theme suits your terminal, signs you in, and asks once per folder whether you trust what is in it.

A conversation

astracode-agent
astracode-agent "why does the login test fail?"
astracode-agent --continue    # this folder's last conversation
astracode-agent --resume      # choose an earlier one
CommandWhat it does
/clear, /resumeStart a new conversation, or go back to one.
/undo, /rewindTake back the last message, or go back to before an earlier one, restoring its edits too.
/compact, /contextSummarise the conversation to free context, or see how much is used.
/modelAstraOne: balanced, most capable, or lowest cost.
/planSwitch to plan mode.
/memoryWhat it remembers about the project.
/initWrite an AGENTS.md for the project.
/review, /diffReview this branch, or see the uncommitted changes.
/tasks, /mcpBackground commands, and MCP servers.
/export, /status, /helpSave the conversation, account and model details, and every key.

Your own commands and skills from .astracode/commands and .astracode/skills appear in the / menu. MCP servers go under mcp.servers in ~/.config/astracode/settings.json. That file is read from your home directory only, never from the project: mcp.servers names commands that run on start, and a settings file inside a repository you cloned could otherwise run anything.

One task, from a script or CI

astracode-agent -p "fix the failing test in tests/test_billing.py" --permissions auto
OptionWhat it does
-p, --print <prompt>The task. - reads it from stdin.
--mode agent|planagent (the default) makes the change. plan only writes a plan.
--permissions read-only|auto|fullWhat the agent may do. See below.
--output-format text|json|stream-jsonThe final answer, one result object, or one event per line.
--max-steps <n>Step limit for the run. The default is 150.
--cwd <dir>The workspace. The default is the current directory.
-v, --verboseThe agent's own log, on stderr.

Nobody is there to approve anything, so this is decided up front:

Every refused action is listed in the result, so a CI log says why nothing changed. With --output-format json the result is one object with ok, end, summary, filesChanged, denied, steps and durationMs.

Exit codeMeaning
0The agent finished.
1It did not finish (the step limit, a loop, an error), or the gateway refused.
2A usage error, or not signed in.
130Interrupted.

A run that stopped short fails the job. It does not report success with an apology in the summary.

Review a branch

astracode-agent review --base main --output-format json

Reviews this branch's changes against --base, which defaults to its upstream, then the remote's default branch, then main. It is read-only, and reports only findings it can describe a concrete failure for, at most eight. With --output-format json it prints { ok, base, files, findings, ... } for a script to act on.

In Zed or a JetBrains IDE

astracode-agent acp speaks the Agent Client Protocol, so an editor that runs external agents can use AstraCode as its agent. The editor starts it; you do not run it yourself. Sign in the same way as on the command line.

Zed: add this to settings.json, then pick AstraCode in the agent panel.

{
  "agent_servers": {
    "AstraCode": {
      "type": "custom",
      "command": "astracode-agent",
      "args": ["acp"]
    }
  }
}

JetBrains: in the AI Chat tool window choose Add Custom Agent, and put this in the ~/.jetbrains/acp.json it opens. Use the full path that which astracode-agent prints.

{
  "agent_servers": {
    "AstraCode": {
      "command": "/Users/you/.local/bin/astracode-agent",
      "args": ["acp"]
    }
  }
}

The editor shows each edit as a diff and asks before the agent changes a file or runs a command. Risky commands and requests to other machines are asked about every time.

In GitHub Actions

- run: curl -fsSL https://astracode.io/install | sh
- run: ~/.local/bin/astracode-agent -p "Fix the failing test in tests/test_billing.py" --permissions auto --output-format json
  env:
    ASTRACODE_API_KEY: ${{ secrets.ASTRACODE_API_KEY }}

Let the agent make the edits, and let the workflow's own steps commit, push and comment. The agent refuses git push under auto for exactly that reason.

What needs the editor

Language-server lookups, live diagnostics and the code index need the editor, in every way of running the CLI. MCP servers, memories and rewinding a turn are part of the conversation. Content search uses rg from your PATH, so install ripgrep; GitHub's runners already have it.

All documentation

Get started

Agent

Context

Workspaces

Connectors

Extending AstraCode

CLI

Reference