# Sources (https://docs.neuralisapp.com/machine-core/sources)

The manifest declares one source on the [webtop connector](https://docs.neuralisapp.com/machine-core/connectors.md):
`machine`, at user scope, offered as discoverable. Attaching it creates a source
under its own slug — for example `machine-ops`, listed as `machine-ops://`. Once
the machine session is live, agents use the standard `fs_*` tools against that
scheme:

```text
fs_list  machine-ops:///config/                        # the user's home inside the machine
fs_read  machine-ops:///config/Downloads/report.pdf
fs_write machine-ops:///config/tmp/script.sh
```

The container root (`/`) is the URI root, so `machine-ops:///etc/hosts` addresses
the container's `/etc/hosts`.

## Who can read a machine source [#who-can-read-a-machine-source]

The connector declares a default permission matrix, from which the attach form takes
the new source's initial `read` / `write` / `exec` triple. What is **enforced**
afterwards is the persisted source config, editable per source like any other
[URI policy](https://docs.neuralisapp.com/package-system/uri-policies.md).

- A source created outside project scope — the machine default is **user** scope —
  is seeded `default: read=false` plus a `read`-only grant for the `owner` and
  `admin` roles. At **user** scope the working grant goes to the person who attached
  the source (read/write/exec); at **agent** scope it goes to that **agent** (read and
  write, no exec) and no user grant is written, so the human reaches the desktop only
  through that agent. Any other principal gets nothing from that source, and an owner
  or admin can read someone's desktop but not write to it.
- The declared per-path **allow** rows are a baseline for the kind and are not copied
  into a new source, so read a source's effective policy from the source itself. The
  restrict-only rows below are the exception: they are copied, and cannot be removed.

### Secret paths under `/config` are a hard limit [#secret-paths-under-config-are-a-hard-limit]

The desktop's `/config` volume holds the browser profile — cookies, session tokens,
saved logins — plus the TLS key the container generates for itself and the usual
dotfile credentials. Those paths carry an **immutable** policy: `fs_read`, `fs_list`
and `fs_search` answer `403 uri_policy_denied` for every caller, including the person
who attached the source. It is applied after every other layer, so no role grant and
no `override` rule re-opens it, and no in-app surface can remove it — the policy
route answers `409 immutable_policy_floor` and the next boot restores anything that
went missing.

Covered: the Chromium, Chrome and Firefox profiles **and their HTTP caches**,
`/config/ssl` (the self-signed key nginx writes on first boot), the NSS certificate
and private-key store (`.local/share/pki`, plus the legacy `.pki` spelling), `.ssh`,
`.gnupg`, `.vnc`, the login keyrings, `.aws`, `.azure`, `.kube`, `.docker`, `.netrc`,
`.git-credentials`, `.npmrc`, `.pypirc`, and the `gcloud` / `gh` / `rclone` config
trees. The desktop **session material** is covered on the same grounds: the D-Bus
session addresses (`.dbus`, `.XDG/dbus-1`), the accessibility bus (`.XDG/at-spi`),
both `dconf` settings stores, the PulseAudio directory, Thunar's custom-action file,
and both `ICEauthority` files.

Each covered directory is declared twice — the folder itself and its contents — so
listing the parent does not reveal the folder name. Matching happens on the
**canonical** URI (slash runs collapsed, `.` and `..` resolved), so every spelling of
one path reaches the same verdict.

<Callout type="warn">
This is permanent and it applies to your own desktop. If you deliberately want an
agent to read a key file out of a sandbox you own, the filesystem tools are not the
path. Webtop shell through `execute` is outside the filesystem URI-policy gate;
credential-handling constraints still apply. The restriction closes the route that
reaches other users' listings and the vector index.
</Callout>

### What gets indexed [#what-gets-indexed]

- **Sync excludes** — a preference. The attach form pre-fills the system trees
  (`/bin`, `/proc`, `/usr`, …), the caches and `/config/.logs/`. They are editable per
  source and were not applied retroactively to sources attached before a pattern
  shipped. An excluded file is still visible to `fs_list` and simply never embedded.
- **The secret paths above** — security. *What cannot be read cannot be embedded*:
  every denied path is never newly embedded, on every machine source including ones
  attached before the restriction shipped, and no `include` rule re-opens it.

Neither deletes history: content embedded earlier stays stored but is filtered out of
every read and search for every caller. To drop it from storage, re-create the source.

## Live state and the auto toggle [#live-state-and-the-auto-toggle]

A machine source is only readable while its Webtop session is running. machine-core
registers a liveness probe with brain-core, which powers two things:

- **`enabled: 'auto'`** resolves against the live session — a stopped machine reads as
  disabled (`code: 'source_disabled'` from `fs_*` tools) and comes back by itself when
  the session starts.
- **The health route** reports a `perSource` map of `{ isRunning, status? }` per slug,
  which the sources panel renders as `On / Off / Auto · Live / Auto · Stopped`.

## Exchanging files with the sandbox [#exchanging-files-with-the-sandbox]

- **Into the machine** — `fs_write machine-ops:///config/...` writes a file the desktop
  user (and any desktop app) can open immediately; a typical pattern is writing a script
  there and running it with `execute`, using `cwd: "machine-ops:///config"` and a
  relative script path.
- **Out of the machine** — anything the user downloads or saves lands under `/config/`
  and is readable with `fs_read machine-ops:///config/Downloads/...`. Reads preserve
  original bytes; text gets a strict UTF-8 preview, binary files keep their URI and
  native media blocks or an honest marker.
- **Recordings** — `machine_use action=record` writes into a recordings directory
  bind-mounted to the project data zone, addressable as
  `data://machine-core/recordings/<file>` even after the machine stops.

<Callout type="info" title="Prefer fs_* over shell file access">
`execute({ command: "cat foo.md", cwd: "machine-ops:///config" })` works, but
`fs_read machine-ops:///config/foo.md` is the right call: it is policy-gated per path
and role, audit-logged as a filesystem access, and indexed. Reserve the shell for
actual command execution.
</Callout>