# Neuralis CLI (https://docs.neuralisapp.com/getting-started/cli)

<Callout title="Maturity: stable (90 %)">
**Neuralis CLI.** The neuralis command signs a person in from their own machine, calls package routes as that person, bridges MCP clients, exports or launches a plugin with an agent's skills, and pairs the machine as a device.

- On macOS the device service and the OS sandbox are built but not yet run on hardware; on Windows the sandbox is measured on one Windows 11 machine; until the sandbox proves itself on a machine, its device serves its owner alone.
- Device commands run on the machine itself and need Node.js 22.22 or newer there.

[How maturity is measured](https://docs.neuralisapp.com/getting-started/maturity.md)
</Callout>

`neuralis` is the command-line client for a Neuralis host. It talks to one host
as one user, in one project, as one agent — and every call it makes is checked
on the server against that identity: the same roles, features and path policies
the member has in the workspace. Nothing it does grants more than the account
already holds.

The same command runs in two places:

- **On your own machine**, signed in with `neuralis login` (OAuth, one browser
  consent).
- **Inside the platform**, where an activated skill's shell already carries the
  stream's session ticket — the native skills teach their route calls as
  `neuralis request` lines, so one call line works in both places.

## Install [#install]

```bash
npm install -g @neuralis/cli    # Node.js 22.22 or newer
neuralis --help
```

The platform image ships the same CLI on its `PATH` for skill shells.

The operator verbs (`neuralis setup`, `update`, `upgrade`, `backup`, …) are
handed to an install's own host command unchanged — `neuralis update` after the
CLI has moved itself to the newest release (`neuralis update --cli` moves only
the CLI and a device service; [updating](https://docs.neuralisapp.com/getting-started/updating.md#the-neuralis-command-a-device-and-the-desktop-app)). The install is the folder you
are in (or above), the one `--install <folder>` names, or else the one setup
recorded in the data home — with several recorded, the CLI lists them and asks
for `--install`. In an image-only Docker folder (no `package.json`) each verb
runs in a one-shot container of the folder's own image release, so that machine
needs only Docker — no Node.js; `rebuild`, `sync`, `pkg` and `convert` refuse
there by name, and a package joins such a host with
[`neuralis package install`](#packages-on-your-host) instead. The [Docker installer](https://docs.neuralisapp.com/getting-started/installation.md#2-docker-image-recommended-for-teams)
installs this CLI, or on a machine where npm cannot install it globally a small
script at `~/.local/bin/neuralis` that runs it from the image — every verb but
`device`, whose broker runs on the machine itself and needs the CLI from npm.

## This machine as a device [#this-machine-as-a-device]

`neuralis device` turns the machine it runs on into a **device** the app can
reach — its folders as sources, its shell for the `execute` tool and the
terminal — through a broker that dials out to the app. Pairing, folder grants
per host and per account, other members' commands and leaving a host are on
[devices](https://docs.neuralisapp.com/getting-started/devices.md).

## Sign in [#sign-in]

```bash
neuralis login --host https://neuralis.example.com --project PROJECT_ID --agent AGENT_ID
neuralis whoami      # the identity the SERVER sees — trust this, not local state
neuralis logout      # revokes this machine's grants on the host and forgets them
```

Login opens the browser once. That one consent names both accesses, the host's
package-route API and its MCP server, and yields two OAuth 2.1 grants, each bound
to its own resource (see [External MCP access](https://docs.neuralisapp.com/enterprise/mcp-access.md)). If either
grant cannot be completed, the CLI asks the host to revoke the other and saves
nothing. The project and agent you name are a request, not authority — the
consent screen and the server decide, and `whoami` reports the result.
`--no-browser` prints the URL instead.

Without `--host`, login takes the host from `NEURALIS_HOST`, then from your
previous sign-in; with several earlier hosts it lists them and asks. On a
terminal with no other source it asks for the URL, and suggests
`http://localhost:3100` only when a Neuralis host answers there. Every choice is
printed with its source. In a script with no source it stops with exit code 2
and sends nothing.

The grants are stored in the user's own configuration directory
(`$XDG_CONFIG_HOME/neuralis` or `~/.config/neuralis`; macOS
`~/Library/Application Support/neuralis`; Windows `%APPDATA%\neuralis`;
`NEURALIS_CLI_HOME` overrides it), readable only by that user, and bound to the
host they were issued by — a stored token is never sent anywhere else. Access
tokens renew themselves when used; several `neuralis` processes share one
renewal. `logout` revokes the refresh grant on the host; an access token already
issued stays valid until it expires, at most one hour.

## Call a route [#call-a-route]

```bash
neuralis request GET @neuralis/admin/audit -f last=20
neuralis request POST @neuralis/agent-core/conversations -f agentId=AGENT_ID -f title=Triage
neuralis request GET @neuralis/brain-core/sources --jq '.[].source'
```

`<package>/<route>` is the path after `/api/packages/`; a scoped package takes
two segments. A full URL, a scheme, `//`, `..` or a `#` fragment is refused
before anything is sent.

| Flag | Meaning |
| --- | --- |
| `-f key=value` | A string field: a query parameter on `GET`, a JSON body key otherwise; `key[]=value` appends to an array, `key[a][b]=value` nests objects (`{"key":{"a":{"b":"value"}}}`) so a nested body needs no JSON in the command line (on `GET` the key is sent as written) |
| `-F key=value` | A typed field: `true`, `false`, `null` and integers become JSON values; `key=@file` or `key=@-` sends the file's (or stdin's) content as a string, so a secret never sits in the command line |
| `--input file\|-` | The raw request body (an object body, a binary); one leading byte-order mark on stdin (PowerShell 5.1 can add one to a pipe) is dropped, as for `-F key=@-` |
| `--form key=value\|key=@file` | A `multipart/form-data` body, for file uploads |
| `--jq expr` | Filter a successful JSON answer (jq 1.8 is built in) |
| `-H 'Name: value'` | An extra header — never `Authorization`, `Cookie` or `Host` |
| `-i` | Print the status line and headers first |
| `--max-time s` | The client deadline (inside a skill shell it defaults to the shell's own budget minus ten seconds) |

`-f`/`-F`, `--input` and `--form` are mutually exclusive. A mutation with none
of them sends no body.

A successful answer (`202` and `207` included) prints the body on stdout, byte
for byte, and exits `0`. Anything else prints `HTTP <code>` and the server's own
error body on **stderr**, leaves stdout empty and exits `1` — so a `--jq` filter
or a pipe never mistakes an error for data. Exit codes:

| Code | Meaning |
| --- | --- |
| `0` | Success |
| `1` | A non-2xx answer, or another failure |
| `2` | A usage error — nothing was sent |
| `3` | No usable credential (not signed in, or the renewal was refused) |
| `4` | No answer at all (connection, DNS, TLS), or a redirect — a credential is never forwarded |
| `28` | The client deadline passed; the host may still finish the request |

A mutation is never retried for you: check the state before running it again.
`plugin export` and `launch` use the same exit codes.

A few operations stay with a person at the workspace, whoever asks — connecting a provider
account or storing a secret, for example. The CLI is an agent-class caller, so those routes
answer `403 human_only`; do them in the browser.

## Access rules [#access-rules]

`neuralis policy` reads and edits a source's access rules (its
[URI policy](https://docs.neuralisapp.com/package-system/uri-policies.md)) without writing JSON:

```bash
neuralis policy check notes://plans/q3.md                  # may you read, write, run there — and which rule decided
neuralis policy check notes://plans/q3.md --user Ben        # the same question about another member
neuralis policy rules notes                                 # the source's stored rules, numbered
neuralis policy allow 'notes://plans/**' read --role member # add a rule that grants
neuralis policy deny 'notes://plans/hr/**' read,write       # add a rule that refuses
neuralis policy remove 'notes://plans/hr/**'                # remove the rule with that pattern
neuralis policy scope notes project                         # list whom its rules grant read; nothing changes yet
neuralis policy scope notes project --yes                   # share the folder with the project
```

`check` answers for you through your agent; a path an agent owns (its
conversations, rules written with `$self`) needs `--agent` with that agent's
id. `--user` takes a name or an id — an ambiguous name is refused with the
candidates' ids, never the first match. Asking about someone else and every
edit need `sources.policy`, or the source being a folder on your own device.
`allow` names one subject (`--role`, `--priority` or `--user`) and assigns the
bits it lists, so it applies even under an earlier deny; `deny` takes only
`--role`. `remove` lists what goes, and asks for `--all` when several rules
share the pattern. Quote a pattern with `*` so your shell passes it as written. `scope` switches a folder source between private to its
creator (`user`) and the project; only the scope is written, and sharing needs
`--yes`. `check` and `rules` take `--json`.

## Packages on your host [#packages-on-your-host]

```bash
neuralis package list                          # every package: where it came from, its status, how it changes
neuralis package install @acme/tool@1.2.0      # or ./acme-tool-1.2.0.tgz — the host stages it and prints a summary
neuralis package approve REQUEST_ID            # or answer the prompt; --yes on install approves at once
neuralis package restart                       # the change applies when the host starts again
neuralis package update @acme/tool             # a newer version; `remove` takes it out; `dismiss REQUEST_ID` drops an ask
```

A project's own packages — dropped into the project or a source's package folder —
are changed by a package manager (`packages.manage`) of that project:

```bash
neuralis package project                       # the project's packages: origin, trust, state, access feature
neuralis package trust packages://demo trusted # or untrusted, or default to drop the pin
neuralis package build packages://demo         # compile a WASM package's src/ and reload it
neuralis package access packages://demo labs.access   # only roles holding labs.access see it; none clears it
```

`install` asks: the host fetches the package without running any of its code
and prints what it brings — its features and the roles they are granted to by
default, routes, tools, config keys and credentials, the sha512 of the bytes it
will install, and its build source: attested when the registry holds an npm
provenance attestation for that version, otherwise "no verified build source".
On a terminal the CLI then asks whether to approve; a script or an agent adds
`--yes`. The package is a native package — it runs inside the host on every
project, like the platform's own packages — so approving it is held apart from
asking: asking needs `platform.packages`, approving and restarting need
`platform.packages.approve` as well (see
[Features and routes](https://docs.neuralisapp.com/admin/features.md)). The host checks those
features on every call, whoever makes it — a person, an agent whose role grants
them, or this CLI. The same requests appear in the Admin widget's **Packages**
tab. The host's operator may limit which packages can be asked for at all with
an allow-list file on the server (`packages/allow-list.json` in the data folder:
a JSON list of scopes and exact names).

The change applies at the next start: `restart` stops the host through its drain
and its supervisor starts it again — running chat turns and workflows resume,
shells running on the host end. Packages the host itself ships update with the
host; packages its operator built into the image change with
[`neuralis pkg`](https://docs.neuralisapp.com/enterprise/deployment.md#your-own-packages) and a rebuild —
`package list` names the way for each one. On an `npm create neuralis` folder those built-in packages reach the
container through one derived image, which `neuralis rebuild` rebuilds only when
the set or the release changes; a source checkout installs them from its
lockfile, which must carry the exact version. An image-only folder, and a public
clone run with Docker, cannot carry them: use `neuralis package install`, or run
the clone natively.

## Skills [#skills]

```bash
neuralis skill list                # the skills this agent may use
neuralis skill read SKILL_ID       # the SKILL.md text, byte for byte
```

The list is the same per-caller catalog the workspace uses, so a skill that is
hidden from you or switched off for the agent is absent here too.

## Run a host on this computer [#run-a-host-on-this-computer]

From a native install (a clone run without Docker, or the desktop app's own
host), the operator verbs `up`, `down` and `status` start, stop and report the
host — the app, its vector store and the sandbox origin — on this computer:

```bash
neuralis up                # start it and keep it running; it restarts itself after a package restart
neuralis status --json     # stopped, starting, ready, restarting or failed
neuralis down              # stop it
```

## The desktop app [#the-desktop-app]

The desktop app carries this CLI, runs its own host and pairs its computer from
its **Neuralis** page — the [desktop app](https://docs.neuralisapp.com/getting-started/desktop-app.md) page has it, and
[platforms](https://docs.neuralisapp.com/getting-started/platforms.md) what differs per OS:

| | Linux | macOS | Windows |
| --- | --- | --- | --- |
| CLI configuration | `$XDG_CONFIG_HOME/neuralis` or `~/.config/neuralis` | `~/Library/Application Support/neuralis` | `%APPDATA%\neuralis` |
| `device install` runs the broker as | a systemd user service | a launchd agent | a Startup entry |
| Device sandbox | Landlock and seccomp | Seatbelt (`sandbox-exec`) | Microsoft process containers (Windows 11) |
| Native host (`up` · `down` · `status`) | yes | yes (preview) | yes |
| Packages installed while the host runs | yes | yes | yes |

On every OS a device whose sandbox does not prove on the machine runs only its
owner's own foreground commands and terminals started without the sandbox, on a
pairing the owner approved there (`neuralis device grant --unconfined --device <id>`);
background runs, MCP servers and another member's commands do not start.

## Tools over MCP [#tools-over-mcp]

```bash
neuralis mcp
```

`neuralis mcp` is a stdio MCP server for an agent client's MCP configuration: it
forwards every message to the host's MCP endpoint with your MCP grant, so the
host stays the only authority over which tools exist and who may call them. A
request lost to a dropped connection is reported, never replayed: the call answers that it
was not re-sent, and you repeat it. While the host is down a call answers that Neuralis
is not answering, and the bridge stays open. After a host restart the bridge re-opens its
upstream session by itself, so the next call works without reconnecting the client; a
request the host refused for the lost session is retried once. Some clients
keep MCP tools behind a tool search instead of listing them up front.

### From a client's plugin marketplace [#from-a-clients-plugin-marketplace]

Claude Code and Codex can install the CLI as a plugin from the
`neuralisapp/neuralis` marketplace. The plugin carries the bootstrap skill and
the `neuralis mcp` server, which it starts from your `PATH`: install the CLI
globally (see [Install](#install)) and sign in with `neuralis login` first.

```bash
# Claude Code
/plugin marketplace add neuralisapp/neuralis
/plugin install neuralis@neuralis
```

In Codex, add the marketplace `neuralisapp/neuralis` from `/plugins` and install
the `neuralis` plugin.

## Export a plugin [#export-a-plugin]

```bash
neuralis plugin export --for claude --out ./my-agent-plugin
```

Writes the agent's active skills — byte for byte, with their scripts and
references — as a plugin for `claude`, `codex`, `cursor` or a plain `agents`
skill tree, with an MCP configuration that starts `neuralis mcp`. The export is
refused whole rather than cut: past the host's file, byte or entry limits, on a
file that cannot be read in full, or on a source the host cannot list
completely. A file from a source on a paired device can be at most
1 000 000 bytes. An existing target folder is never overwritten. Exported files
stay on that machine after access is withdrawn; every later call is checked
again.

## Start Claude Code or Codex with your agent [#start-claude-code-or-codex-with-your-agent]

```bash
neuralis launch claude --project PROJECT_ID --agent AGENT_ID
neuralis launch codex  --project PROJECT_ID --agent AGENT_ID
neuralis launch claude --conversation CONVERSATION_ID      # that conversation's own toggles
neuralis launch claude --new                                # a new conversation for this launch
```

`launch` asks the host what this agent may use right now — its skills, its
packages overview and runtime summary (no rule or instruction text, no container
paths) — writes it once as a content-addressed set under `~/.neuralis/launch`,
and starts the client with it: the skills as a session plugin (Claude Code), the
summary appended to the system prompt, and the tools through `neuralis mcp`
under the server id `neuralis_launch`. An unchanged set is reused without
writing anything; sets no running client or conversation still points at are
removed by the next launch. No token is ever written into a set.

Three layer modes decide how this meets your own client setup:

| Mode | What the client loads |
| --- | --- |
| `merged` (default) | Your own client configuration **plus** the agent's skills, tools and context |
| `governed` | **Only** the capabilities set in Neuralis. Your own client deny rules and hooks are not loaded either — use `merged` if you rely on them. Claude Code only |
| `native` | Your client exactly as it is, with no Neuralis layer |

Codex has no session-plugin folder: it receives the summary and a pointer to the
agent's skills in its developer instructions, and reads a skill with
`neuralis skill read` when the task needs it. Codex is not started in
`governed` mode.

Everything after `--` is passed to the client, except the flags that would
replace the layer `launch` sets up; those are refused by name.