> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rightbrain.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rightbrain.ai/_mcp/server.

# Rightbrain CLI

> Use the Rightbrain command-line interface for browser login, environment management, Task configuration and execution, model discovery, access tokens, and SDK type generation.

The Rightbrain CLI is published as the `rightbrain` npm package and runs without a global installation through `npx rightbrain@latest <command>`.

## Authentication and context

| Command          | Purpose                                                                  |
| ---------------- | ------------------------------------------------------------------------ |
| `login`          | Complete browser-based OAuth, then select an Organization and Project.   |
| `logout`         | Clear the stored credentials for the active environment.                 |
| `whoami`         | Show the current user, Organization, and Project.                        |
| `switch-project` | Select a different Organization and Project.                             |
| `token`          | Return a valid access token, refreshing an expired stored session first. |

When `token` output is captured, stdout contains only the token. `token --json` returns the token with its dashboard URL, environment name, Organization ID, Project ID, and expiry time. The API base URL is the returned `dashboard_url` plus `/api/v1`.

> **Warning**
>
> Treat CLI tokens as credentials. Do not commit captured token output or place it in client-side code.

## Environments

Named environments keep separate deployment URLs and login sessions. Every command accepts `--env <name>`. `RB_CLI_ENV` selects an environment when the flag is absent, and `env use` sets the default.

`env list` shows configured environments and the active selection. Its `--json` form returns environment names and dashboard URLs without exposing session state.

## Project setup and generated types

`init` creates `rightbrain.json`, updates the configured environment file, installs `@rightbrain/sdk` when needed, selects or creates an API key, and generates types for selected Tasks.

`generate` reads the Task IDs from `rightbrain.json` and writes TypeScript interfaces to `generatedTaskTypePath`. It requires `@rightbrain/sdk` version 0.3.0 or later.

The configuration supports either an API key or OAuth client credentials. Credential values can use environment-variable interpolation.

## Resource commands

| Command             | Purpose                                                                                               |
| ------------------- | ----------------------------------------------------------------------------------------------------- |
| `organization list` | List Organizations visible to the current user.                                                       |
| `project list`      | List Projects in the selected Organization.                                                           |
| `task list`         | List Tasks in the selected Project.                                                                   |
| `task get`          | Read a Task and its active revision.                                                                  |
| `task create`       | Create a Task interactively or from YAML.                                                             |
| `task update`       | Create a Task revision from YAML, with optional immediate activation.                                 |
| `task run`          | Run a Task with structured and file inputs, optionally against a specific revision or fallback model. |
| `model list`        | List available models, with optional provider filtering.                                              |

The deprecated `create-task`, `run-task`, and `list-models` commands remain available temporarily. Use `task create`, `task run`, and `model list`.

## Automation output

Commands that support `--json` return machine-readable output. When stdout is piped, the CLI routes prompts to stderr, suppresses spinners, and returns JSON for supported resource commands.

## Related

#### [Rightbrain Agent Skill](/docs/api/agent-skill)

Let compatible coding agents operate Rightbrain through live API contracts.

#### [Authentication](/docs/api/authentication)

Select an authentication method for direct API requests.

#### [TypeScript SDK](/docs/api/sdk)

Use generated Task types with the Rightbrain SDK.

#### [Run tasks via the API](/docs/api/run-tasks)

Read the Task run request and response contract.

#### [API Reference](/api-reference/api-reference/tasks)

Browse the complete Task endpoint reference.