# The command line

> rxr, the Reactor command line — write a loop in a file, try the draft, test it, publish it and run it from a terminal, as a person or as an AI agent

`rxr` is Reactor from a terminal. You write a loop in a file, save it as a draft, try it, test
it, publish it and run it, with no page open. An AI agent that works in a terminal can do the
same: every command has an output made for a program.

`rxr` works in your account as you, and only as far as your role allows. It reaches plutonium.io
through the same server an AI tool connects to ([Connect an AI tool](/docs/guide/connect-an-ai-tool.md)),
so the two can do the same things.

## Install

```
curl -fsSL https://plutonium.io/install.sh | sh
```

This puts one file, `rxr`, in `~/.local/bin`. It runs on macOS and Linux, on arm64 and x86-64,
and it needs nothing else installed. The installer checks the download against a SHA-256 it
carries, and installs nothing when they differ. Set `RXR_INSTALL_DIR` to install somewhere else.

## Sign in

```
rxr login
```

`rxr` opens plutonium.io in your browser. Sign in, and a page asks whether to connect `rxr`, with
what it could do. Press **Allow**, and the terminal says it is connected. You paste no key.

When the terminal is on another machine than your browser, run `rxr login --no-browser`: open
the address it prints, press **Allow**, and paste the address the browser ends on.

**Settings** lists the connection under **Connected AI tools**, as "rxr on" and the machine's
name. **Disconnect** there ends it at once. `rxr logout` forgets the sign-in on one machine.

## Your first loop

```
rxr new support_desk
rxr push support_desk.loop.yml
rxr run support_desk "Where is my order?" --draft
rxr publish support_desk
rxr run support_desk "Where is my order?"
```

1. `rxr new` writes `support_desk.loop.yml`, a small loop that saves as it is. Open the file and
   change its name, its description and its `entry`, the instruction the loop follows.
   [Building a Loop](/docs/guide/building-a-loop.md) explains every key.
2. `rxr push` saves the file as the loop's **draft**. A draft serves nobody. When the document
   has a problem, the answer names each one and where it is.
3. `rxr run --draft` runs the draft as you, and prints what the run does and then its reply.
   Change the file, push, and run again until it does what you want.
4. `rxr publish` makes the draft the version that runs use. It asks you first.

`rxr chat support_desk --draft` is a conversation: each line you type is your next message.
With no command at all, `rxr` lists your loops to choose from.

To change a loop you have, `rxr pull support_desk` writes its document to a file, and says which
version number the changed copy must carry.

## Test cases

A loop document can declare test cases: example conversations that must pass before a version
publishes ([Testing a Loop](/docs/guide/testing-a-loop.md)).

```
rxr test support_desk
```

This runs each case against the draft and prints a verdict for each, with the reason when one
fails. Each case is a run that costs money, so `rxr` asks before it starts them. A case run acts
on nothing live.

## Runs

| Command | What it does |
| --- | --- |
| `rxr run <loop> "<message>"` | Starts a run and follows it to its reply. `--draft` runs the draft. |
| `rxr say <run> "<message>"` | Sends your next message to the same run. |
| `rxr watch <run>` | Follows a run that is working. |
| `rxr show <run> --events` | Reads a run now, with each thing it did. |
| `rxr approve <run> <approval>` | Allows a step the run waits for. `--decline` refuses it. |
| `rxr stop <run>` | Asks a run to stop. |
| `rxr runs` | Lists recent runs. |

When a run waits for your approval, `rxr` shows what it asks and waits for your answer. A run
costs what any run costs, wherever it was started.

## For an AI agent

An agent that drives `rxr` reads `rxr guide`: the whole of this page for a program, with the
order of the commands and what each exit status means.

- **`--json`** on any command prints one JSON document on standard output, and nothing else.
- **No question is asked** when there is no terminal. A step that publishes, or that spends
  money on test cases, then needs `--yes`: the agent asks you, and passes it when you agree.
- **The exit status says what happened**, so a program need not read sentences:

| Status | Meaning |
| --- | --- |
| 0 | Done. |
| 1 | plutonium.io refused the request. The message says why, and names the fix. |
| 2 | The command line is wrong, or `--yes` is missing. |
| 3 | Not signed in. |
| 4 | A run waits for an approval. |
| 5 | A run ended without success, or a test case failed. |
| 6 | plutonium.io could not be reached. |
| 7 | The wait ran out and the run is still working. |

An AI tool that speaks MCP needs no `rxr`: it connects to the same server.
`rxr mcp` prints the lines that add it to Claude Code, Cursor or another tool.
