# RBAi CLI

RBAi is a research assistant for the life sciences. The RBAi CLI brings it to your terminal: a full-screen chat, a command line for scripts and CI, and tools that let the AI agent in your IDE (Claude Code, Cursor, VS Code, Kiro, Codex) work in your RBAi account.

It is the same RBAi as the web app at [rbai.thedreamlabinnovations.com](https://rbai.thedreamlabinnovations.com): the same assistant and biomedical tools, your projects, literature reviews, Galaxy, Structure Studio, slides and Report Writer pages. A conversation started in the terminal is in the web app too, and the other way round. Started in a folder, it also works with your files and programs on your computer, asking before every change.

```sh
curl -fsSL https://cli.thedreamlabinnovations.com/install.sh | sh     # macOS, Linux: no Node.js needed
irm https://cli.thedreamlabinnovations.com/install.ps1 | iex          # Windows: in Terminal (PowerShell)
npm install -g rbai-cli                                               # or with Node.js 22 or later
rbai
```

## Contents

- [What's new in 1.6](#whats-new-in-16)
- [What's new in 1.5](#whats-new-in-15)
- [What's new in 1.4](#whats-new-in-14)
- [What's new in 1.3](#whats-new-in-13)
- [What's new in 1.2](#whats-new-in-12)
- [Install](#install)
- [Sign in](#sign-in)
- [The chat](#the-chat)
- [Work in a folder](#work-in-a-folder)
- [One question at a time: rbai ask](#one-question-at-a-time-rbai-ask)
- [Life-science work from the terminal](#life-science-work-from-the-terminal)
- [AI agents in your IDE](#ai-agents-in-your-ide)
- [Documentation for AI agents](#documentation-for-ai-agents)
- [Output, --query and scripting](#output---query-and-scripting)
- [Exit codes](#exit-codes)
- [Environment variables](#environment-variables)
- [Networks and proxies](#networks-and-proxies)
- [Updates](#updates)
- [Uninstall](#uninstall)
- [Troubleshooting](#troubleshooting)
- [Privacy](#privacy)
- [Support](#support)

## What's new in 1.6

- **Background specialists**: when RBAi hands work to a specialist that runs in the background, the chat shows its end (or its question, or its request for more credits) and RBAi's reply as they come. `/specialists` (and `rbai specialist`) shows each one's state and report, answers it, sends it a message and stops it. See [Background work](#background-work-specialists-and-jobs).
- **Replies to background work**: a background job's end, or a specialist's, wakes RBAi in the chat, and its reply shows there. After `rbai ask`, `rbai session wait <id>` waits for that reply and prints it.
- **Type while RBAi answers**: Enter sends your message to the running answer, which reads it at its next step. A message to a chat whose answer runs in another window joins that answer.
- **Files from the answer**: Word and Excel files RBAi builds, files of the code sandbox, and files and folders on a project's computer are links you can open, and `/download <n>` or `rbai session save <link>` saves them (large files with the copy's progress). Images an answer places show with their credit and are in `/files`.
- **Your memory folder**: `rbai memory files` and `rbai memory read <path>` show what every new chat reads (`profile.md`, `notes.md`, a project's `facts.md`). `rbai project computer <id>` shows a project's cloud computer.
- The line under an answer says "not charged" for a failed answer whose credits were given back, and `rbai ask` prints its credits on stderr.
- 1.6.1: `rbai researcher labs` waits up to 80 seconds, since a search for a term Europe PMC has not seen recently can take about a minute. A Galaxy job RBAi cannot read on its server shows "not checked" with the reason (`rbai galaxy jobs` has a Note column), and `rbai job watch` keeps waiting instead of calling it failed.

## What's new in 1.5

- **Your own tools**: list MCP tool servers in a folder's `.mcp.json` (Claude Code's format) or in your own `mcp.json`, and RBAi uses their tools in chats in that folder, asking before each call. See [Your own tools: tool servers](#your-own-tools-tool-servers).

## What's new in 1.4

- **Background jobs**: RBAi can start a long command (an alignment, a Nextflow pipeline, a large download) as a background job that keeps running after you close rbai and its terminal. Ask about it in a later chat ("is my job finished?"), or use `rbai jobs`. See [Background jobs](#background-jobs).

## What's new in 1.3

- **Your folder from the website**: `rbai bridge` lets a chat on the website work in a folder of this computer (or of a lab's Linux server), with every change approved in your browser. See [From the website: rbai bridge](#from-the-website-rbai-bridge).

## What's new in 1.2

- **RBAi works in your folder**: it reads, searches and edits your files and runs your programs on your computer, asking before every change. See [Work in a folder](#work-in-a-folder).
- An approval box before each change, command and upload; four modes on Shift+Tab, including the new plan mode; `/undo`, `/rewind`, `/local log` and `/local rules`.
- PDFs and pictures in the folder are read, large files are read in pieces, and files up to 25 MB go to the cloud sandbox when you say yes.
- One shell for the whole chat: a `cd` carries over, and later commands start at once.
- `RBAI.md` keeps notes about the folder for RBAi, and `/init` writes one.
- `rbai ask --local` with `--allow`, for scripts and AI agents.

Every change is in CHANGELOG.md, in this package.

## Install

**With the installer (no Node.js needed).** It downloads the build for your computer from `cli.thedreamlabinnovations.com`, checks its SHA-256 and that it starts, and installs it for you only (no administrator rights).

```sh
# macOS and Linux (also WSL and Alpine)
curl -fsSL https://cli.thedreamlabinnovations.com/install.sh | sh
# without curl (Alpine, busybox)
wget -qO- https://cli.thedreamlabinnovations.com/install.sh | sh
```

```powershell
# Windows (PowerShell, not as administrator)
irm https://cli.thedreamlabinnovations.com/install.ps1 | iex
```

On Windows, use **Terminal** (open the Start menu and type Terminal). Windows PowerShell's older window works too, but shows a plain box without the RBAi logo, and the welcome says "For colours and the RBAi logo, open this in Terminal."

It goes to `~/.rbai/bin/rbai` on macOS and Linux (with one line ending in `# rbai` added to your shell's startup file) and to `%LOCALAPPDATA%\Programs\rbai\rbai.exe` on Windows (added to your user Path). Open a new terminal, then `rbai login`. Running the same command again updates it, as does `rbai update`.

| To | Do |
| --- | --- |
| Install a given version | `curl -fsSL https://cli.thedreamlabinnovations.com/install.sh \| RBAI_VERSION=1.0.0 sh`, or in PowerShell `$env:RBAI_VERSION = '1.0.0'; irm https://cli.thedreamlabinnovations.com/install.ps1 \| iex` |
| Install into another folder | `RBAI_INSTALL_DIR="$HOME/tools/rbai"` (PowerShell: `$env:RBAI_INSTALL_DIR = 'D:\Tools\rbai'`) before the same command |
| Leave your PATH alone | `RBAI_NO_MODIFY_PATH=1` |

**With npm.** You need [Node.js](https://nodejs.org/en/download) 22 or later (`node --version`).

```sh
npm install -g rbai-cli      # or: pnpm add -g rbai-cli
rbai --version
```

On Windows, run it in Terminal. On an older Node, `rbai` says which version it needs and how to get it.

Install it one way only: with both npm and the installer, two copies are on your computer and the one found first runs, which may be the older one ([Troubleshooting](#troubleshooting)).

## Sign in

```sh
rbai auth login
```

This opens RBAi in your browser. Check that the code shown there matches the one in your terminal, and approve. The CLI then gets its own API key, named after your computer, which you can see and revoke in **Settings → API & MCP → API keys**.

| Situation | Command |
| --- | --- |
| Over SSH, or no browser on this machine | `rbai auth login --no-browser` (open the printed link on any device) |
| You already have an API key | `rbai auth login --paste`, or `rbai auth login --with-token < key.txt` |
| CI or a container | set `RBAI_API_KEY` (a key from Settings → API & MCP → API keys); no login needed |
| Check who you are | `rbai auth status` |
| Sign out | `rbai auth logout` |

`rbai auth logout` revokes the key that the browser sign-in created, so that sign-in ends everywhere. A key you pasted is only removed from this computer, unless you add `--revoke`. Keys are stored in your user config folder, readable only by you; they are never accepted as a command-line flag.

## The chat

```sh
rbai            # open the chat
rbai -c         # continue your newest conversation
rbai -r         # choose a conversation to continue
```

Type a question and press Enter. RBAi shows what it is doing (its tools, with their results) and streams the answer, with tables, code and links. Under each answer: what it cost in credits and how long it took.

- `@` attaches a file from this folder, or tags a tool, skill or database for the next message.
- `Esc` stops an answer (the server stops it too). `Ctrl-O` shows reasoning and tool details. `Ctrl-D` leaves.
- `/help` lists every slash command. A few of them:

| Command | What it does |
| --- | --- |
| `/review <question> [--level low\|medium\|high\|max]` | Start a literature review and follow it while you keep chatting |
| `/galaxy`, `/connect`, `/rbai` | Switch to the Galaxy agent, Connect, or back to the RBAi assistant |
| `/structure` | Open Structure Studio on a structure this chat showed |
| `/files`, `/download <n>` | List and download the files an answer produced or links to (Word and Excel files, sandbox and computer files, images) |
| `/specialists` | The chat's background specialists: state, reports, answers, messages, Stop |
| `/tools <need>`, `/skills`, `/memory` | Find a tool, list skills, see what RBAi remembers |
| `/project`, `/link` | Answer within a project; link this folder to it |
| `/model`, `/theme`, `/doctor`, `/logout` | Settings and checks |

A long answer (a docking run, a multi-step analysis) can go on on the server after its first part; the chat follows it to the end. `rbai chat --plain` is a line-based chat for screen readers.

While RBAi answers, type a message and press Enter: it goes to the running answer, which reads it at its next step (the chat says "RBAi read your message during the answer"). One answer runs at a time in a chat, so a message sent from a second window joins the answer that runs there. A very long chat is summarized before an answer ("Summarizing the earlier part of this long conversation"); RBAi can still open earlier results.

### Background work: specialists and jobs

RBAi can hand work to a **background specialist**, with a budget and a deadline it tells you, and start long commands as **background jobs** on the server. Its answer ends; when the work ends, RBAi is woken in the chat and replies on its own. The chat shows that as it happens:

```
LYZ UniProt Lookup finished · 8.1 credits · 25 s
The specialist reports that human LYZ is reviewed UniProtKB entry P61626, 148 amino acids …
```

A specialist that is stuck or needs more credits or time asks. RBAi answers from your chat when it can; otherwise the chat shows the request, and you answer with `/specialists` (pick Allow, Write the report now or Stop) or in your own words in the chat. `/specialists` lists the chat's specialists with their state and credits; `/specialists <n>` shows one's task and report; `/specialists <n> message <text>` steers it; `/specialists <n> stop` stops it (it writes its report from what it has). From a script: `rbai specialist list <chat>`, `show`, `answer`, `message` and `stop`. You are never charged more than the budget you agreed to.

The colours follow your terminal; `rbai config set theme dark|light|auto|mono` picks them, and `rbai config set notify bell` (or `osc`) rings the bell or shows a desktop notification when an answer that took more than 30 seconds is ready.

## Work in a folder

Started in a folder, `rbai` works with the files there, on your computer: it reads and searches them, edits scripts and runs your own programs (`python qc.py`, `samtools flagstat`, your conda environment), asking before every change. Every RBAi cloud tool stays available too: databases, papers, the cloud sandbox, Galaxy and structures.

```sh
cd ~/data/kidney-atlas     # Windows: cd ~\data\kidney-atlas
rbai
```

The first time in a folder, RBAi asks **Let RBAi work in this folder?**: **1 Yes** (read and search freely, ask before each change and command), **2 Read only**, **3 No**. The answer is remembered for that folder, in rbai's settings on your computer; `/local on`, `/local read` and `/local off` change it. In your home folder or at the top of a drive, the question warns you and Enter means No (elsewhere Enter means Yes). `rbai --no-local` or `rbai chat --no-local` starts once without the folder, and `rbai chat --dir <folder>` works in another one.

### What it asks first

| What RBAi does | Asks first? |
| --- | --- |
| Reads, lists and searches files in the folder, PDFs and pictures included | No |
| Edits or writes a file in the folder, or saves one from the cloud sandbox | Yes, unless the mode is "edits without asking" or you said "don't ask again" for edits |
| Runs a command | Yes, unless you said "don't ask again" for it |
| Sends a file to the cloud sandbox | Yes, wherever the file is, unless you said "don't ask again" for uploads |
| Reads or changes anything outside the folder | Yes, every time (read only and plan change nothing) |

The box shows exactly what will happen: the command and the folder it runs in, the file and its changed lines (red −, green +), or the file for the cloud sandbox and its size. **1** Yes. **2** Yes, and don't ask again: for a command, a rule for this folder, kept until you remove it, made of the program and the word after it (`python qc.py`); for edits or uploads, until you leave rbai. **3** No, and type what RBAi should do instead. **Esc** No. A command with `;` `&` `|` `<` `>`, a backtick or `$(` never gets option 2, because those signs add more commands: `python qc.py; rm counts.csv` starts like an allowed command but deletes a file too. RBAi checks where a file really is (links are followed), and every check is made by `rbai` on your computer, never by the AI.

### Modes

**Shift+Tab** moves to the next mode; `/mode` picks one by name and `rbai chat --mode <mode>` starts in one.

| Mode | What RBAi may do |
| --- | --- |
| asks before changes (`ask`, the default) | Read and search freely; ask before each change, command and upload |
| edits without asking (`edit`) | Also edit, write and save files in the folder; commands and uploads still ask |
| plan first, no changes (`plan`) | Read, then reply with a numbered plan; **Go ahead with this plan?** 1 carries it out in ask mode, 2 keeps planning |
| read only (`read`) | Read and search only |

Whenever changes are allowed, a change outside the folder, or one that can't be undone (a file over 50 MB), asks first.

### Undo, the log and saved rules

`/undo` puts back the file RBAi changed last; `/rewind` lists every change since rbai started, so you can put a file back as it was before one. Both work until you leave rbai, for files up to 50 MB, and put back files, not the conversation. `/local log` shows the last 20 things RBAi did, `/local rules` lists the commands you allowed with "don't ask again", and `/local rules remove <n>` deletes one. The log and the rules are kept in rbai's own folders, never in your project folder.

### RBAI.md

An `RBAI.md` at the top of the folder tells RBAi about the project: the data, how the files are laid out, how to run the analyses and what must never change. RBAi reads it with every message (else `AGENTS.md`; the first 20,000 characters). `/init` has RBAi write one, and its write asks first.

### Large files, PDFs and pictures

RBAi reads up to 2,000 lines at a time from any line, so a FASTQ of many GB is read in pieces, and `.gz` text is unpacked as it reads (the last 8 lines of a 383 MB FASTQ took about 8 seconds in our test). Files that aren't text, such as a BAM or an Excel file, go through a program (`samtools view`) or the cloud sandbox. A PDF or picture in the folder is sent with your message, as `@` would send it, up to 25 MB: PNG, JPEG, WebP and GIF are read; TIFF and BMP need converting first, which RBAi asks to do. The cloud sandbox, your chat's own computer in RBAi's cloud (Python, R, samtools, DESeq2, scanpy and more), takes files up to 25 MB.

### Commands

Commands run in your folder with your own programs: PowerShell on Windows (PowerShell 7 if installed), your bash or zsh on macOS and Linux. They get the programs of the window you started rbai in, so activate a conda environment first; your PowerShell profile and `.bashrc` are not read. One shell stays open for the chat, so a `cd` or a variable carries over to the next command. The first command waits a few seconds while the shell starts; later ones start at once. A command stops after 2 minutes (up to 10 when RBAi asks for longer), or when you press Esc. Longer work runs as a background job.

### Background jobs

For a command that takes longer than a few minutes, RBAi starts a background job. It asks first, as for any command, and the box says that the command keeps running in the background after this chat. The job goes on after you close rbai and after you close the terminal window; its output goes to a log file. RBAi tells you the job's id (four letters and digits, such as `q7mk`) and finishes its answer instead of waiting.

Later, in the same folder or another one, ask RBAi: "is my job finished? show the end of its log", or "stop job q7mk" (it asks before stopping). Or use the commands, which need no sign-in:

```sh
rbai jobs                 # this folder's jobs: running, or finished with their exit code
rbai jobs --all           # every folder's
rbai jobs log q7mk        # the last 200 lines of its log (--lines 50, or --offset 1 for the start)
rbai jobs stop q7mk       # stop it and every program it started
rbai jobs clean           # remove jobs that ended more than 7 days ago, and their logs (asks first)
```

- Nothing is deleted on its own. The logs are in rbai's state folder (`%LOCALAPPDATA%\rbai\jobs` on Windows, `~/.local/state/rbai/jobs` on Linux and macOS).
- A job pauses while the computer sleeps, and goes on when it wakes. A restart ends it; Windows updates can restart the computer on their own, so keep it awake and plugged in for long work. A job that ended this way shows as "ended, exit code unknown".
- In `rbai ask --local`, starting or stopping a job needs `--allow run` (or a matching `--allow "run:..."`), as any command does.
- `/jobs` in the chat lists the running jobs of this computer and the server's.

> Until 1.3, `rbai jobs` was another name for `rbai job`, the server's jobs. That command is still `rbai job`.

### Your own tools: tool servers

RBAi can already use any program on your computer through commands (samtools, R, a conda environment, your lab's scripts); it checks that a program is installed before relying on it. For tools that come as **MCP servers** (your lab's LIMS, an internal database, a vendor's instrument API), list them in the folder's `.mcp.json`, in the format Claude Code uses, so one file works for both:

```json
{
  "mcpServers": {
    "lims": { "command": "python", "args": ["lims_server.py"], "env": { "LIMS_TOKEN": "${LIMS_TOKEN}" } },
    "atlas": { "type": "http", "url": "https://atlas.example.org/mcp", "headers": { "Authorization": "Bearer ${ATLAS_TOKEN}" } }
  }
}
```

Servers you want in every folder go in your own `mcp.json` in rbai's config folder (`%APPDATA%\rbai\mcp.json` on Windows, `~/.config/rbai/mcp.json` on Linux and macOS), same format.

- **Trust first.** A folder's servers start only after you trust its `.mcp.json` once: the chat asks before your first message (or run `rbai tools trust`). If the file changes, it asks again. Your own `mcp.json` needs no trust.
- **RBAi asks before each call**, showing the server, the tool and its arguments. "Yes, and don't ask again" keeps that tool for the folder; `/tools allow <server>` (or `<server>/<tool>`) allows it until rbai ends, and with `--folder` for this folder. In plan and read-only modes RBAi uses only the tools their server marks read-only.
- **Secrets stay here.** `${VAR}` and `${VAR:-default}` are read from your environment when rbai starts the server. Only the tools' names, descriptions and input schemas go to RBAi, and what a tool returns when RBAi calls it.
- **Big results** (over 25,000 characters) and images are saved in rbai's state folder (`tool-results`, kept 7 days), and RBAi reads them from there in parts.
- `rbai tools` lists the servers, their state and their tools (`-o json` too); `rbai tools trust` trusts this folder's `.mcp.json`; `rbai tools forget` forgets the trust and the allowed tools. In a chat, `/tools` shows the same, live.
- In `rbai ask --local`, tool servers start only with `--allow tools` (for that run, trusted or not), and their tools then run without asking.
- `rbai bridge` asks about the folder's `.mcp.json` in its window, and website chats in the folder get the same tools; the approval in the browser names the tool server.
- stdio servers run in the folder with your environment, and stop when rbai stops. HTTP servers take headers; sign-in flows (OAuth) are not supported yet.

> Until 1.4, `rbai tools` was another name for `rbai tool`, RBAi's own tool catalogue. That command is still `rbai tool`.

### In scripts: rbai ask --local

```sh
rbai ask "Which samples in counts.csv have fewer than 1,000 reads?" --local
rbai ask "Find the bug in qc.py, fix it and run it" --local --allow edit --allow "run:python qc.py"
```

`rbai ask --local` (the current folder, or `--local <folder>`) never asks; put the question first. Without `--allow` it reads, lists and searches. `--allow edit` lets it change files in the folder, `--allow upload` send them to the cloud sandbox, `--allow "run:<program> <first argument>"` run those commands (repeat it for each), `--allow run` run any command, and `--allow tools` start the tool servers and use their tools. Everything else is refused, and RBAi is told which flag would allow it; if it then asks you a question, the run ends with exit code 8. stream-json adds `local-call` and `local-result` events.

### From the website: rbai bridge

```sh
cd ~/data/kidney-atlas
rbai bridge                    # or: rbai bridge <folder> --mode read
```

`rbai bridge` lets a chat on the website work in this folder, the way `rbai` does in a terminal. Leave it running, open the website, start a chat, and choose **Work in a folder on my computer**. The first time, link your browser: in the website go to Settings, **Your computers**, **Link this browser**; the website shows a key of four groups, and `rbai bridge` asks `Allow? [y/N]` with the same key. Type `y` only when they match.

- Reads and searches inside the folder run without asking. Every change, command and upload waits for your answer in the browser, and runs only if the answer is signed by a browser you linked here: RBAi's server passes your answers on and cannot make one up.
- `--mode` sets the most RBAi may do here (`ask`, the default; `edit`; `read`); the website can ask for less, never more.
- In its window: `/mode`, `/undo`, `/rewind`, `/local log`, `/local rules` and `/exit`. Ctrl-C stops it, after asking if a command is still running. `rbai bridge --forget-browsers` unlinks your browsers from this computer and stops.
- It works the same on a lab's Linux server: run it there, and the website uses that server's folder and processors.
- Background jobs work here too: the approval in the browser says that the command keeps running after the chat, and the job goes on after `rbai bridge` stops.
- While it runs, anyone signed in to your RBAi account can have RBAi read this folder; changes still need your linked browser.

### What is sent where

- Your files stay on your computer: rbai doesn't copy or sync the folder. What does leave your computer is listed here.
- What RBAi reads goes to the AI model, hosted on Microsoft Azure, to answer you, and is saved with the chat on RBAi's servers until you delete the chat: the lines it reads, the file names it lists, what its searches find, each command's output, and the whole of a PDF or picture it reads. Reads inside the folder don't ask first.
- Each message also carries the folder's path, your system and shell, the git branch and the number of changed files, and RBAI.md.
- A whole file goes to the cloud sandbox only when you say yes (in scripts, `--allow upload`), and stays in the chat's sandbox until you delete the chat.
- The rules are checked by `rbai` on your computer, never by the AI.

### Costs

Messages cost credits as in any chat, and each answer shows its credits. A short message in a folder typically costs 5 to 8 credits (measured on 6 November 2026); a long task costs more, because what RBAi reads counts toward it. Commands on your own computer use no Code sandbox time; work in the cloud sandbox does.

## One question at a time: rbai ask

```sh
rbai ask "What is known about TP53 R175H in Li-Fraumeni syndrome?"
rbai -p "Summarise the function of BRCA1 in two sentences"        # the same
rbai ask --continue "And BRCA2?"                                   # the same conversation
rbai ask "Summarise these results" --attach results.csv
```

The answer goes to stdout; progress goes to stderr. For programs:

```sh
rbai ask "List the known PD-L1 inhibitors" --output-format json
rbai ask "Compare AlphaFold models of KRAS G12C and G12D" --output-format stream-json
```

`stream-json` prints one JSON event per line as the answer streams: `session`, `text-delta`, `reasoning-delta`, `tool-call`, `tool-result`, `local-call` and `local-result` (with `--local`), `file`, `status`, `ask-user`, `turn-continues`, `error` and `done`. When RBAi needs to ask you something, `rbai ask` exits with code 8 and the question in the `ask-user` event; answer with `rbai ask --session <id> "<answer>"`. Answers use your RBAi credits; in text format the last line on stderr gives the answer's credits, as the web shows them under an answer.

The files an answer links to (a Word or Excel file RBAi built, a file of the code sandbox, a file or folder on a project's computer) are listed on stderr with the command that saves each, and in the JSON output as `links` and `files`:

```sh
rbai session save "/api/chat-files/stored/<chat>/<sha256>.docx/report.docx"
rbai session save "/api/chat-files/computer/<chat>?path=/mnt/data/run"    # a folder: lists its files
```

When the answer started background work (a specialist with its own budget, a background job), stderr says so and the JSON output has `background`. Its reply comes in the chat after `rbai ask` ends:

```sh
rbai session wait <id>              # waits for RBAi's reply to that work and prints it
rbai specialist list <id>           # the chat's specialists, their state and credits
```

If RBAi is already writing a reply in the conversation (in another window, or to background work), `rbai ask --session <id>` sends your message to that reply and prints it, or waits for it to end and then sends yours.

## Life-science work from the terminal

**Literature reviews**

```sh
rbai review create "CRISPR off-target effects in primary human T cells" --level medium --wait
rbai review list
rbai review export <id> --dest review.md
rbai review ask <id> "Which papers used primary human T cells?"
```

**Galaxy**

```sh
rbai galaxy key set --server https://usegalaxy.eu    # once: your Galaxy API key, saved encrypted in your account
rbai galaxy ask "Run FastQC on the two FASTQ files in my newest history"
rbai galaxy jobs
rbai galaxy download <history id> <dataset id> --dest reads_fastqc.html
```

**Structure Studio**

```sh
rbai structure show <session id> <tool call id>
rbai structure ask <session id> <tool call id> "Colour the residues within 5 Å of the peptide and render a figure"
rbai structure download <session id> <tool call id> 2 --dest model.pdb
```

A studio belongs to a structure a chat showed, once it was opened in the web app's 3D viewer.

**Projects, sources and files**

```sh
rbai project create "MDM2 inhibitors"
rbai link <project id>                                  # commands in this folder use that project
rbai source add <project id> --paper 10.1038/nature12373
rbai source add <project id> --file paper.pdf --wait
rbai ask "What do my sources say about nutlin-3a resistance?"
rbai session file <session id> results.csv              # a file the chat's code sandbox saved
```

**Slides, figures, Report Writer, Connect**

```sh
rbai slides create "A 5-slide talk on base editing" --wait
rbai slides download <id> --dest talk.pptx
rbai figure create --source-type review --source <review id> --preset nature --wait
rbai coauthor ask <page id> "Draft the methods section" --mode suggest
rbai connect ask "Who distributes a validated anti-GPX4 antibody for mouse tissue?"
```

Connect never sends anything from the terminal: an email it drafts is reviewed and sent by you in the web app.

Every command has `--help` with examples. `rbai commands` lists all of them; `rbai api <path>` calls any RBAi API route with your sign-in (`rbai api /usage/quota`).

## AI agents in your IDE

An AI agent in your editor can drive the whole CLI: every command, with JSON output and stable exit codes. Two ways to set it up, which work together:

**1. The agent skill.** A skill teaches the agent how to use `rbai`: signing in, `-o json`, what to do on each exit code, asking the assistant, credits, and recipes for reviews, Galaxy, structures, Connect, files and projects. It is SKILL.md with a `references/` folder (the full command reference and the recipes) that the agent reads only when it needs them. It is generated from your installed version, so it matches its commands.

```sh
rbai agent-skill                                # print SKILL.md
rbai agent-skill --client claude-code --print   # every file --write would create, with its path
rbai agent-skill --client claude-code --write   # ~/.claude/skills/rbai/
rbai agent-skill --client cursor --write        # ~/.cursor/skills/rbai/
rbai agent-skill --client vscode --write        # ~/.copilot/skills/rbai/ (GitHub Copilot)
rbai agent-skill --client kiro --write          # ~/.kiro/skills/rbai/
rbai agent-skill --client codex --write         # ~/.agents/skills/rbai/
rbai agent-skill --client gemini --write        # ~/.gemini/extensions/rbai/ (a Gemini CLI extension, with the MCP server)
```

Add `--project` to write it into the current folder instead (for example `.claude/skills/rbai/`). It asks before writing, never replaces an existing file without `--force`, and touches nothing else. After an update, run it again with `--force`.

`rbai agent-skill --kit <folder>` writes the whole agent kit: the skill, a Claude Code plugin and marketplace, a Kiro power, a Gemini CLI extension, `AGENTS.md` for Codex, Cursor and GitHub Copilot rules, and the MCP Registry entry. Kiro can import that folder as a power (Powers panel → Add Custom Power → Import power from a folder).

**2. MCP tools.** `rbai mcp serve` is an MCP server. `rbai mcp config` prints the snippet to paste into your client's MCP settings; it never edits them.

```sh
rbai mcp config --client claude-code     # also: cursor, vscode, kiro, codex, claude-desktop
rbai mcp tools                           # the tool groups
rbai mcp config --client cursor --tools review,project,source,galaxy
```

By default the server offers a small set of tools and `rbai_agent_chat` (the RBAi assistant itself), which keeps your agent's context small. `--tools <group,...>` adds whole command groups, or `--tools all`; their delete commands only with `--allow-destructive`, and your client asks you before each one. Signing in, API keys and local settings are never tools. The server uses the key from `rbai auth login`, so no key goes into your IDE's settings.

## Documentation for AI agents

An agent that has never seen RBAi can learn all of it from these, without a browser:

| What | Where |
| --- | --- |
| The guide for agents: sign-in, JSON output, exit codes, `rbai ask` and its events, credits, safety, recipes | `rbai help agents`, or https://rbai.thedreamlabinnovations.com/docs/cli/agents.md |
| Every command, flag, default, exit code and environment variable | `rbai help reference` (REFERENCE.md in this package), or https://rbai.thedreamlabinnovations.com/docs/cli/reference.md |
| The same as JSON | `rbai commands --json` |
| This page | https://rbai.thedreamlabinnovations.com/docs/cli/index.md |

The three pages on the website are plain Markdown files, the same text the installed `rbai` prints.

## Output, --query and scripting

```sh
rbai project list                          # a table on a terminal
rbai project list -o json                  # the API's objects, unchanged; also yaml, tsv
rbai project list --query "[].{id: id, title: title}" -o table
rbai review show <id> -o json --query status
```

Data goes to stdout and everything else (progress, hints, errors) to stderr, so pipes stay clean. `--query` takes a [JMESPath](https://jmespath.org) expression. `--no-input` makes sure nothing waits for a keyboard (it is the default in CI); a delete then needs `--yes`. Long work returns an id at once; add `--wait` to block until it finishes. `rbai commands --json` describes every command, argument and flag for programs. `rbai completion bash|zsh|fish|powershell` prints a shell completion script.

## Exit codes

| Code | Meaning |
| --- | --- |
| 0 | Success |
| 1 | Something else went wrong (the message says what) |
| 2 | Usage: an unknown command or flag, a missing argument, or no terminal for a prompt |
| 3 | Not signed in, or the key was refused |
| 4 | Not found |
| 5 | Out of credits, or rate limited |
| 6 | Network: the server could not be reached, or did not answer in time |
| 7 | A server error |
| 8 | RBAi asked you a question (`rbai ask`): answer with `--session <id>` |
| 130 | Interrupted (Ctrl-C) |

`rbai help exit-codes` prints the same table.

## Environment variables

| Variable | Meaning |
| --- | --- |
| `RBAI_API_KEY` | An API key to use instead of the saved one (CI, containers) |
| `RBAI_PROFILE` | The profile to use (like `--profile`); profiles hold separate accounts or servers |
| `RBAI_OUTPUT` | The default output format: `table`, `json`, `yaml` or `tsv` |
| `RBAI_CONFIG_DIR`, `RBAI_STATE_DIR` | Where settings and keys, and history and state, are kept |
| `RBAI_THEME` | `auto`, `dark`, `light` or `mono` (or `rbai config set theme …`) |
| `RBAI_REDUCED_MOTION=1` | A still spinner |
| `RBAI_ASCII=1` | ASCII symbols only, for consoles without Unicode |
| `RBAI_SCREEN_READER=1` | The chat as plain lines (like `rbai chat --plain`) |
| `RBAI_NO_UPDATE_CHECK=1` | No daily check for a newer version |
| `GALAXY_API_KEY` | A Galaxy API key for `rbai galaxy` (else the one saved with `rbai galaxy key set`) |
| `HTTPS_PROXY`, `HTTP_PROXY`, `NO_PROXY` | Proxies: see below |
| `NODE_EXTRA_CA_CERTS` | Extra CA certificates (a PEM file) for networks that re-sign TLS |
| `NO_COLOR` | No colour ([no-color.org](https://no-color.org)); `FORCE_COLOR` forces it |
| `CI` | When set: no prompts, no animation, no browser |

`rbai help environment` lists them with the config file locations.

## Networks and proxies

University and company networks often need a proxy. `rbai` uses the usual variables for every request it makes (the RBAi API, file uploads and downloads, and the update check):

```sh
export HTTPS_PROXY=http://proxy.example.org:8080           # PowerShell: $env:HTTPS_PROXY = "http://proxy.example.org:8080"
export NO_PROXY=localhost,.example.org
```

`HTTPS_PROXY` is used for HTTPS (with `HTTP_PROXY` as the fallback when it is not set), and hosts in `NO_PROXY` go direct. A user name and password can be part of the proxy URL. If your network inspects TLS with its own certificate authority, point `NODE_EXTRA_CA_CERTS` at that CA's PEM file. `rbai doctor` shows the proxy in use and checks that the RBAi API can be reached.

## Updates

Once a day, when you use `rbai` in a terminal, it checks for a newer version (where you installed it from: the npm registry or the installer's host) and prints one line when there is one. The check runs in the background and never slows a command; it is off in CI, and `RBAI_NO_UPDATE_CHECK=1` turns it off.

```sh
rbai update          # shows the command for how you installed rbai, and runs it if you say yes
rbai update --check  # only report
```

Installed with the installer, `rbai update` checks `cli.thedreamlabinnovations.com` for the newest version and runs the installer again for the same folder; installed with npm, it checks the npm registry and runs npm.

## Uninstall

```sh
rbai auth logout             # first: revokes the key the browser sign-in made
npm uninstall -g rbai-cli    # installed with npm (or: pnpm remove -g rbai-cli)
```

Installed with the installer: on macOS and Linux run `rm -rf ~/.rbai/bin` and delete the line ending in `# rbai` from your shell's startup file; on Windows delete `%LOCALAPPDATA%\Programs\rbai` and remove it from your user Path (Settings → System → About → Advanced system settings → Environment Variables).

Then delete the settings folder if you like: `%APPDATA%\rbai` and `%LOCALAPPDATA%\rbai` on Windows; `~/.config/rbai` and `~/.local/state/rbai` on macOS and Linux (or the `XDG_CONFIG_HOME` and `XDG_STATE_HOME` equivalents).

## Troubleshooting

| Problem | What to do |
| --- | --- |
| A plain box without the RBAi logo (Windows) | You are in Windows PowerShell's older window. Open **Terminal** from the Start menu and start `rbai` there. |
| An old version starts, or there are two copies | npm and the installer each put an `rbai` on your computer, and the one found first runs. `rbai --version` shows which version runs; `Get-Command rbai -All` (PowerShell) or `which -a rbai` (macOS, Linux) lists every copy. Keep one: `npm uninstall -g rbai-cli`, or delete the installer's folder (see [Uninstall](#uninstall)). |
| RBAi says it can't see your files | Look at the welcome's Folder line. Update an rbai older than 1.2 (`rbai update`); start without `--no-local`; type `/local on` if you answered No to the folder question; type `/rbai` after `/galaxy` or `/connect`. |
| A program isn't found | It isn't installed on your computer, or its conda environment wasn't active when you started rbai. Install it, or ask RBAi to use the cloud sandbox. |
| The first command takes a few seconds (Windows) | PowerShell is starting; the next commands start at once. |
| A folder name with `[` or `]` (Windows) | Some PowerShell commands read the brackets as a pattern and don't find the file. RBAi usually tries another way; if not, rename the folder. |

## Privacy

The CLI has no telemetry. It talks to the RBAi API you sign in to, to the storage links the API gives it for your files, and once a day to look for a newer version: the npm registry for an npm install, `cli.thedreamlabinnovations.com/latest.json` for an installer install (an ordinary request for the latest version; turn it off with `RBAI_NO_UPDATE_CHECK=1`). In a folder, what goes to RBAi is listed under [What is sent where](#what-is-sent-where). What RBAi does with your account's data is described in the [Privacy Policy](https://rbai.thedreamlabinnovations.com/privacy).

## Support

- Documentation: [rbai.thedreamlabinnovations.com/docs/cli-access](https://rbai.thedreamlabinnovations.com/docs/cli-access)
- `rbai doctor` checks Node, your settings, the network and your sign-in, and says how to fix what fails.
- Email: [hari@thedreamlabinnovations.com](mailto:hari@thedreamlabinnovations.com)

## Licence

Copyright (c) 2026 The Dream Lab Innovations. All rights reserved. The RBAi CLI is proprietary software, free to install and use with an RBAi account under the [RBAi Terms of Service](https://rbai.thedreamlabinnovations.com/terms); see LICENSE. It includes open-source components, listed with their licences in THIRD-PARTY-NOTICES.
