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.

On Windows, x64 or arm64, in PowerShell:

irm https://astracode.io/install.ps1 | iex

It puts astracode-agent.exe in %USERPROFILE%\.local\bin, checks the download's checksum, and adds that folder to your user PATH. It needs no administrator rights. $env:ASTRACODE_VERSION pins a version and $env:ASTRACODE_BIN_DIR picks another folder; the macOS and Linux installer reads the same two variables.

Or, with Homebrew on macOS or Linux:

brew install astracode-io/tap/astracode-agent

Or, anywhere 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 and what its commands did.
/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.

A `-p` run trusts the folder it runs in, as Claude Code's -p does: you chose the folder, and --permissions decides what the run may do. The project's rules, hooks, skills, commands and agents all load. A conversation, acp and review are different: there a folder is untrusted until you say otherwise, and in an untrusted folder the agent reads and answers but changes no file, runs no command and loads nothing the project carries, so a repository you just cloned cannot run a hook by being opened. Trust it with --trust for one session, with ASTRACODE_TRUST=1, or for good: the full-screen conversation asks on its first run in a folder, and /trust remembers it. review stays untrusted unless told, because a fork's pull request reaches it.

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, durationMs, and runId when the run changed something.

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.

Undo a run

astracode-agent undo              # the last run in this folder
astracode-agent undo --list       # recent runs, newest first
astracode-agent undo <run>        # that one

Every run that may change files, in a conversation, with -p or over acp, takes a checkpoint before each edit and each command, kept outside the project. undo puts back what the run changed, including what its commands generated, deleted or rewrote, and leaves alone, and lists, any file that has changed again since. It prints the --restore <id> that takes the undo back. review, read-only and plan runs change nothing, so they have nothing to undo. Checkpoints need git on your PATH.

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.

Reporting progress

--report-to <url> posts the run's progress to <url>/events as it goes, one small JSON event at a time with the run's key as the bearer: started, each step, each tool by name, the final report, and ended with the outcome. Never a tool's input or output, a file, a path or a command. Delivery is retried briefly and never slows or fails the run. It is how a remote agent reports to its card in the editor.

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