> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reticle.sh/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Reticle is a verification layer for AI coding agents. Its SDK runs in development builds, and in staging or production only through the signed activate loader (see /production-mode). It reads program truth (network, state, console, routing, animations, framework state) from inside a running web app and returns a deterministic verdict with evidence. It is not a screenshot tool and not a browser automation library. For a desktop application, the computer realm (`@reticlehq/computer`) reads the app through the accessibility tree of the operating system on macOS, Windows and Linux (X11), with no SDK; an agent can use it for a check or for any other task in the app.
> Verdicts come from `reticle_act_and_wait`, `reticle_assert`, `reticle_act { steps }` when a step declares `expect`, and `reticle_verify` (`change`/`flows`). Everything else moves or reads the app and proves nothing. Only `verified: "yes"` is a pass: `unknown` means Reticle could not tell, and `no-fault` means nothing was declared to prove. A drive that ends without a verdict has no result, however many tools it used. Never weaken a check to make it pass.
> Package names are scoped `@reticlehq/*`. Run every CLI command as `npx @reticlehq/server <command>`, for example `npx @reticlehq/server init`. `reticle` is a bin name that `@reticlehq/server` installs once it is on your PATH, NOT a package on npm: `npx reticle` fetches an unrelated package published by somebody else, so never run that. The complete tool surface is on the `/usage` page; `/agent-cheatsheet` is the one-screen version.

# Open and close a realm

> reticle_open_realm, reticle_close_realm and reticle_attach_tab let an agent join a desktop application, a tab of the person's own browser or a command-line program as a session, and end it after.

A task can cross realms. A migration runs in a terminal, a change is made in a page, and its mail opens in a desktop application. These tools let an agent open the realm where the next step is, and close it after. Use them for a check, and also for any other task in a desktop application or in a tab of the person's browser.

All three are in the cold tail. Reach them through `reticle_run`:

```js theme={"dark"}
reticle_run({ tool: 'reticle_open_realm', args: { realm: 'computer', app: 'TextEdit' } });
```

## `reticle_open_realm`

Opens a realm as a session and answers with its `sessionId`. Give that `sessionId` on every later call to that session.

| Argument | Realm | Meaning |
| - | - | - |
| `realm` | all | `"computer"` for a desktop application, `"browser"` for a tab of the person's browser, `"terminal"` for a command-line program. |
| `app` | computer | The name of the application, as the Dock or the task bar shows it. |
| `launch` | computer | `true` starts the application first, when it is not open. Starting works on macOS only. |
| `match` | browser | Part of the address of the one tab to join. |
| `command` | terminal | The command, as a list of words: `["npm", "run", "migrate"]`. |
| `cwd` | terminal | The folder the command runs in. |

```js theme={"dark"}
reticle_run({
  tool: 'reticle_open_realm',
  args: { realm: 'computer', app: 'TextEdit', launch: true },
});
// → { ok: true, realm: "computer", sessionId: "cu-TextEdit-4242", app: "TextEdit", next: "..." }

reticle_run({ tool: 'reticle_open_realm', args: { realm: 'browser', match: 'mail.example.com' } });
// → { ok: true, realm: "browser", sessionId: "..." }
```

`realm: "computer"` runs `reticle-computer` of the same release as the daemon, through `npx`. The first open can take some time while `npx` downloads the package. Set `RETICLE_COMPUTER_BIN` to run a `reticle-computer` of your own. See [the computer realm](https://docs.reticle.sh/computer.md).

`realm: "browser"` does what `reticle_attach_tab` does, at `RETICLE_CDP_URL` or `http://127.0.0.1:9222`.

`realm: "terminal"` runs the command with `reticle-computer --command`, and joins it as a session. See [A command-line program](#a-command-line-program) below.

### The allow list

A tool call does not show the approval prompt that an agent shows before a terminal command. So an agent can open only an application that the person listed in `~/.reticle/computer-open.json`:

```json theme={"dark"}
{ "open": ["TextEdit", "Mail"] }
```

The names do not depend on case. When the application is not on the list, nothing starts, and the refusal tells the agent what to do:

1. Ask the person if an agent may open that application.
2. If the person agrees, add the name to the `open` list, or make the file with `{ "open": ["<name>"] }`. The agent's own approval prompt for a file change then asks the person again.
3. Call `reticle_open_realm` again.

An agent never changes `~/.reticle/computer.json`. That file holds the person's limits, such as `backgroundOnly`. **Stop** in the HUD and `~/.reticle/computer.stopped` still apply to a realm that an agent opened.

A password vault (Bitwarden, 1Password, LastPass, Dashlane, Keeper) and a sign-in page are never joined.

A command runs only when the person listed its program in the same file, under `commands`:

```json theme={"dark"}
{ "open": ["TextEdit"], "commands": ["npm", "node"] }
```

The first word of the command must be a listed name exactly. A listed `npm` does not allow `/tmp/other/npm`. Without this list, a tool call could run any command without the approval prompt that the agent shows for a terminal command.

## A command-line program

```js theme={"dark"}
reticle_run({
  tool: 'reticle_open_realm',
  args: { realm: 'terminal', command: ['npm', 'run', 'migrate'], cwd: '/path/to/app' },
});
// → { ok: true, realm: "terminal", sessionId: "term-4242", command: [...], next: "..." }
```

The session shows the command as a window. `reticle_look { action: "page", sessionId }` shows:

* `status`: `running`, `exited 0`, or `killed SIGTERM`.
* `stdin`: a text box while the command runs. Its value is the line typed so far.
* `output` and `errors`: the lines the command printed on stdout and on stderr. Each list shows the newest 200 lines and says how many it left out.

The usual tools work on it:

```js theme={"dark"}
// Prove a line the command printed.
reticle_assert({
  sessionId: 'term-4242',
  predicate: { kind: 'text', contains: 'Migrated', visible: true },
});

// Answer a prompt: fill the stdin box, then press Enter, and prove the reply.
reticle_act({ sessionId: 'term-4242', ref: '<stdin ref>', action: 'fill', args: { value: 'yes' } });
reticle_act_and_wait({
  sessionId: 'term-4242',
  ref: '<stdin ref>',
  action: 'press',
  args: { text: 'Enter' },
  until: { kind: 'text', contains: 'Done', visible: true },
});

// Prove how it ended.
reticle_assert({ sessionId: 'term-4242', predicate: { kind: 'text', contains: 'exited 0' } });
```

Type or fill writes to stdin. Enter sends the line. Control+C interrupts the command. Any other action is refused, and the refusal says why. The session stays after the command exits, so the agent can still read how it ended. Typing after the exit is refused with "the command exited 0, so its stdin is closed". `reticle_close_realm` stops a command that still runs.

## `reticle_close_realm`

```js theme={"dark"}
reticle_run({ tool: 'reticle_close_realm', args: { sessionId: 'cu-TextEdit-4242' } });
// → { ok: true, closed: "cu-TextEdit-4242", realm: "computer" }
```

* A desktop application leaves Reticle. The application keeps running.
* A command-line program that still runs gets `SIGTERM`.
* A tab gets its page security back when no other tab that the agent opened over that browser is left.
* `close` ends only a session that the same agent opened with `reticle_open_realm`. Any other session is refused. To end a session for good, use `reticle_session { action: "end" }`.
* When the agent leaves, every realm it opened closes after 30 seconds, unless the agent comes back first.

## `reticle_attach_tab`

Joins a tab that is open in the person's own Chromium browser, as a session: their mail, a cloud console, a tool that they are signed in to.

| Argument | Meaning |
| - | - |
| `match` | Part of the address of the one tab to join. |
| `cdpUrl` | The debugging address of the browser. Default: `RETICLE_CDP_URL`, else `http://127.0.0.1:9222`. |
| `detach` | `true` puts the page security back and closes the connection. Give it at the end of the task. |

The browser must run with `--remote-debugging-port`, for example:

```bash theme={"dark"}
google-chrome --remote-debugging-port=9222
```

The tab reloads once. Its page security is set aside for this connection only. A password vault or a sign-in page is never joined.

## Carry a value from one realm to another

`reticle_session { action: "board", carry }` reads the value of an element in one session, fills it into an element of another session, and reads it back. `arrived` says whether the target shows the value.

```js theme={"dark"}
reticle_session({
  action: 'board',
  key: 'order-number',
  carry: { from: { sessionId: 'cu-Mail-4242', ref: 'e12' }, to: { sessionId: 's1', ref: 'e7' } },
});
// → { ok: true, carried: "A-1093", arrived: true, ... }
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.