> Index of all Nori docs pages for agents: https://docs.noriagentic.com/llms.txt · Ask a question: https://noriagentic.com/ask

# Connect editors and scripts with nori host

Available on the `next` release channel.

`nori host` is a standard [ACP](https://docs.noriagentic.com/cli/concepts/acp/) v1 agent. Any ACP client, such as an editor, a script, or another tool, can start, list, load, and prompt sessions on it. The host runs every agent Nori knows, and each session keeps Nori’s transcripts, approvals, and MCP servers. For the terminal side of the host (`nori host new`, `nori host ls`), see [multiple sessions](https://docs.noriagentic.com/cli/guides/multi-session/); for `nori attach`, see [join from another terminal](https://docs.noriagentic.com/cli/guides/attach/).

## Pick a transport

| Use       | Command                                                | Who it suits                                                         |
| --------- | ------------------------------------------------------ | -------------------------------------------------------------------- |
| stdio     | `nori host --stdio` (or `nori exec --acp`)             | an editor or tool that launches its agent as a subprocess            |
| WebSocket | `nori host`, then connect to `ws://127.0.0.1:7420/acp` | several clients at once, or clients that connect to a running server |

Both serve the same methods. One host can run any number of sessions on one connection.

## Connect over stdio

Set your client’s agent command to:

```sh
nori host --stdio
```

The client speaks newline-delimited JSON-RPC on stdin and stdout. Stdout carries only ACP messages; logs go to stderr.

- **Joins your running host.** When a background `nori host` runs in the same `NORI_HOME` and gives the client control, the stdio process relays to it. Sessions are then shared with every other client and keep running after the editor closes.
- **Otherwise runs a private host.** With `--agent`, `-c`, `--add-dir`, or the bypass flag, or when another client controls the running host, the process runs its own host for this one client. It writes no discovery files and stops its sessions when stdin closes. Transcripts remain, so a later client can load them.

`nori exec --acp` is the same command.

## Connect over WebSocket

```sh
nori host            # background host on 127.0.0.1:7420
nori host --port 0   # pick a free port
```

The endpoint is `ws://127.0.0.1:<port>/acp` (`/sessions` also works). Every connection needs `Authorization: Bearer <token>`. The endpoint and token are in `$NORI_HOME/host/host.json`, which only you can read. The token changes each time the host starts.

- The host listens on loopback only. To reach it from another machine, put a TLS-terminating proxy or tunnel in front of it and connect with `wss://`. Never expose the plain port: the token would travel in clear text.
- `[host] max_clients` (default 16) limits connections at once, counting `nori attach` terminals and joined stdio clients. One more gets HTTP 503. A missing or wrong token gets HTTP 401.
- Disconnecting never stops a session. Reconnect, then `session/load` to get history and live updates, or `session/resume` for live updates only.

## Work with sessions

| Method           | What it does                                                                                                                                                   |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `session/new`    | start a session in an absolute, existing `cwd`; that folder’s config applies. Accepts stdio and HTTP `mcpServers`. Set `_meta["nori/agent"]` to pick the agent |
| `session/list`   | live sessions first, then sessions saved on disk, newest first, 50 per page. Filter with `cwd`. Each row’s `_meta` has `nori/agent` and `nori/session.live`    |
| `session/load`   | attach and replay history, then stream live. A saved or failed session restarts under the same ID                                                              |
| `session/resume` | attach without history                                                                                                                                         |
| `session/prompt` | run one turn; replies with the agent’s `stopReason`. A prompt while a turn runs is refused as busy (`-32015`), not queued                                      |
| `session/cancel` | cancel the running turn                                                                                                                                        |
| `session/close`  | stop the agent; the session stays listed and can be loaded again                                                                                               |
| `session/delete` | close the session and delete its transcript under `$NORI_HOME`                                                                                                 |

## Choose the agent, model, and permission mode

Every session reports `configOptions` and ACP `modes`:

- `agent` lists every agent the host can start, marked `Installed` or with an install hint. You can change it until the first prompt.
- The agent’s own options, such as `model`, pass through. Choices survive a restart of the session or the host.
- `mode` is the permission mode. `session/set_mode` and the `mode` option do the same thing.

| Mode          | Behavior                                                                     |
| ------------- | ---------------------------------------------------------------------------- |
| `ask`         | the agent asks before every edit and every command that can change something |
| `agent`       | the agent decides what to ask about (the default)                            |
| `approve-all` | Nori approves every permission request itself                                |

`ask` is offered for Claude Code and Codex only. Nori puts Claude Code in its `default` mode and Codex in `read-only`. Reads, searches, and commands those agents treat as read-only still run without asking. Other agents have no mode that asks every time, so a session that would start in `ask` continues in `agent`. Under `agent`, Nori puts Claude Code in `acceptEdits` and Codex in `workspace-write`, even if your own agent settings choose another default.

Set the starting mode for sessions that clients create:

```toml
[host]
default_mode = "ask"   # ask | agent | approve-all; unset keeps each folder's approval_policy
```

## Who can prompt

One connection controls the host at a time. The controller can prompt, cancel, change settings, and answer permission requests. Other connections watch: they see every update, and changing calls fail with `-32016`. A stdio client on a private host is always the controller. Permission requests go only to the controller and are asked again after a reconnect.

## One-shot nori exec uses the host

`nori exec "prompt"` and `nori -p` run through the host too. When your background host is running, nobody else controls it, and you pass no `-c` or `--add-dir`, the prompt runs there. Otherwise exec runs a private host for the one prompt. Output and exit codes are the same either way.

- On the running host, the agent sees the host’s environment, not your shell’s. An API key set only on the `nori exec` command line does not reach it.
- Exec runs in the `agent` mode, so Claude Code accepts edits and Codex writes in the workspace without asking. Any permission request is rejected, and exec then exits non-zero.
- On the running host, the finished session stays listed as closed.

## Check compatibility

`initialize` returns `agentInfo` like `{"name": "nori-host", "version": "0.30.0-next.5+contract.1.0.0"}`. The part after `+contract.` is the host contract version, also in `host.json` as `contract`. A host serves clients built for the same major contract version and an equal or older minor.

If an incompatible host already runs in your `NORI_HOME`, `nori host` exits and names both contracts. Stop it with `nori host stop`, or run a second host in another home with `NORI_HOME=<dir> nori host`. A different `--port` alone is not enough: there is one host per home.

## Common questions

**Can I use `--remote` or `/remote-control`?** Not on `next`. They are replaced by the host’s `/acp` endpoint, which needs a token. On stable, see [remote control](https://docs.noriagentic.com/cli/guides/remote-control/).

**Can a stdio client and a background host share a transcript?** Only when the stdio client joined the host. A private stdio host lists the background host’s live sessions as saved. Do not load the same session in both.

**Does the host support sign-in over ACP?** No. `authMethods` is empty. A session whose agent needs sign-in fails with `-32000` and the agent’s sign-in hint. Sign in with the agent’s own login, or see [sign-in and API keys](https://docs.noriagentic.com/cli/guides/auth-and-connections/).
