# brain-core (https://docs.neuralisapp.com/brain-core)

<Callout title="Maturity: stable (90 %)">
**Brain core.** One URI-addressed filesystem over every project source, kept searchable in a scoped vector index, with every read and write governed per path.

- Git remote operations use HTTPS only; SSH remotes are not supported.
- There is no clone or force-push through the governed git routes.
- One vector collection serves every project; switching the embedding model is an explicit rebuild that temporarily doubles storage.
- Embedding credentials are platform-wide; members cannot bring their own embedding key.

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

`@neuralis/brain-core` is the platform's brain. It gives every project one
URI-addressed view over all of its data — local directories, the vector
memory, package contents, machine sandboxes — and keeps that view searchable
by syncing connector content into a Qdrant-backed vector index: chunked,
embedded, scoped per project, user, and agent, and governed per path by URI
policies. Any system you can write a connector for joins the same virtual
tree, and a synced source pays back twice — its content becomes searchable
memory **and** its markdown becomes
[source packages](https://docs.neuralisapp.com/package-system/source-packages.md). Agents read, write,
list, and search through four `fs_*` tools; users browse the same data
through the Files widget in the workspace.

## Responsibilities [#responsibilities]

- Read, create, modify, list, and search files across every registered source
  through one URI vocabulary (`data://notes/todo.md`, `brain://insights/...`).
- Manage project-, user-, and agent-scoped sources, and host the connector
  registry other packages plug new [source kinds](https://docs.neuralisapp.com/package-system/connectors.md) into.
- Index connector content without an embedding model; add optional semantic
  vectors and keep the index healthy (orphan repair, garbage collection,
  duplicates report).
- Serve the governed `git/*` routes over git-backed sources — status, diff,
  history, staging, commit, branch, and fetch / pull / push to a connected
  remote — under the same per-path URI policy as every other read and write,
  with a server-side rescue point recorded before a destructive operation wherever
  a revert baseline can be taken (a file the caller cannot resolve to one is removed raw, and the tool says so).
- Render the workspace **Files** widget and the filesystem-change card that
  appears in chat after every `fs_write` call.

## Folder map [#folder-map]

The pages in this section mirror what brain-core's manifest and package
folders ship:

| Package element | Doc page | Cross-reference |
| --- | --- | --- |
| `tools/` (the four `fs_*` tools) | [Tools](https://docs.neuralisapp.com/brain-core/tools.md) | [package-system tools](https://docs.neuralisapp.com/package-system/tools.md) |
| `skills/` (9 skills, incl. the `create-package` authoring router) | [Skills](https://docs.neuralisapp.com/brain-core/skills.md) | [package-system skills](https://docs.neuralisapp.com/package-system/skills.md) |
| connector kinds (`host`, `brain`) and the URI vocabulary | [Connectors](https://docs.neuralisapp.com/brain-core/connectors.md) | [package-system connectors](https://docs.neuralisapp.com/package-system/connectors.md) |
| declared sources, sync and indexing | [Sources](https://docs.neuralisapp.com/brain-core/sources.md) | [package-system sources](https://docs.neuralisapp.com/package-system/sources.md) |
| `uriPolicies` baselines | [URI policies](https://docs.neuralisapp.com/brain-core/uri-policies.md) | [package-system URI policies](https://docs.neuralisapp.com/package-system/uri-policies.md) |
| `workflows/` (one template) | [Workflows](https://docs.neuralisapp.com/brain-core/workflows.md) | [package-system workflows](https://docs.neuralisapp.com/package-system/workflows.md) |
| `src/routes/` (the HTTP surface) | [Routes](https://docs.neuralisapp.com/brain-core/routes.md) | [package-system routes](https://docs.neuralisapp.com/package-system/routes.md) |
| `app/` (Files widget, dock, change card) | [App surfaces](https://docs.neuralisapp.com/brain-core/app-surfaces.md) | [package-system App surfaces](https://docs.neuralisapp.com/package-system/app-surfaces.md) |
| `events` (notification inbox) | [Events](https://docs.neuralisapp.com/brain-core/events.md) | [package-system events](https://docs.neuralisapp.com/package-system/events.md) |
| `configSettings` | [Config settings](https://docs.neuralisapp.com/brain-core/config-settings.md) | [package-system config settings](https://docs.neuralisapp.com/package-system/config-settings.md) |
| `credentials` (embedding keys) | [Credentials](https://docs.neuralisapp.com/brain-core/credentials.md) | [package-system credentials](https://docs.neuralisapp.com/package-system/credentials.md) |

## Features provided [#features-provided]

brain-core declares its permission vocabulary in the manifest; roles receive
defaults that admins can change per project (see
[roles and features](https://docs.neuralisapp.com/enterprise/roles.md)).

| Feature | Grants | Default roles |
| --- | --- | --- |
| `files.read` | Read, list and search files | viewer and above |
| `files.write` | Create, modify, upload, approve | manager and above |
| `sources.manage` | Create, update, delete and sync sources; browse and discover roots to attach | manager and above |
| `sources.privileged` | Attach, see, or browse high-blast-radius roots — the platform app zone, the Neuralis source tree, the whole host | owner, admin — grantable per role |
| `files.readOthers` | Read other users' and agents' scoped sources; also lets you start a virtual desktop someone else left behind (a kept container or profile) | owner, admin — grantable per role |
| `files.writeOthers` | Modify other users' scoped sources | owner, admin — grantable per role |
| `sources.policy` | Edit per-source URI path policies | owner, admin — grantable per role |
| `packages.registry` | Be shown the package-registry skill (search / read / audit / download against the registry the operator points at) | member and above |
| `platform.vector` | Collection-level vector maintenance and the embedding-model rebuild — one collection serves every project | owner only — grantable per role |

The seeded `owner` role holds the `'*'` wildcard, so it holds every feature —
including ones no package grants. The seeded `admin` role does NOT: it holds an
enumerated list derived from the native manifests, so a feature that reaches
`admin` does so because a manifest declared the grant. Most skills and other contributions shipped by
brain-core carry `requiredFeatures` frontmatter and are hidden entirely from
callers who lack the grant. The `create-package` authoring skill is the
deliberate exception — it is ungated so any caller can read the contract, while
every capability it describes stays gated at the write, the build, and the
diagnostics call.

## Security and scope [#security-and-scope]

Every route extracts the caller's identity from the verified
[session](https://docs.neuralisapp.com/package-system/sessions.md) — never from the request body — and
rejects mismatched project ids. Source visibility is evaluated per scope:
project-scoped sources are visible to all members, while user- and
agent-scoped sources require ownership or an `observeScoped` grant. The
`brain://` memory source is additionally isolated **per agent** inside a
project: semantic queries filter by the calling agent unless sibling access is
explicitly requested. Per-path access on every source is governed by
[URI policies](https://docs.neuralisapp.com/package-system/uri-policies.md).

## In this section [#in-this-section]

<Cards>
<Card title="Tools" href="https://docs.neuralisapp.com/brain-core/tools.md" description="The four fs_* tools: read, list, search, and write the URI filesystem." />

<Card title="Skills" href="https://docs.neuralisapp.com/brain-core/skills.md" description="Source, file, git and policy skills — plus the package-authoring skill." />

<Card title="Connectors" href="https://docs.neuralisapp.com/brain-core/connectors.md" description="The four-tuple coordinate, the URI vocabulary, and the connector kinds brain-core ships." />

<Card title="Sources" href="https://docs.neuralisapp.com/brain-core/sources.md" description="Declared sources, scope, the enabled toggle, sync triggers, indexing, and deleting a source." />

<Card title="URI policies" href="https://docs.neuralisapp.com/brain-core/uri-policies.md" description="The path rules brain-core's manifest seeds into its own data and package areas." />

<Card title="Workflows" href="https://docs.neuralisapp.com/brain-core/workflows.md" description="The Sources digest workflow template." />

<Card title="Routes" href="https://docs.neuralisapp.com/brain-core/routes.md" description="The HTTP routes under /api/packages/brain-core and their feature gates." />

<Card title="App surfaces" href="https://docs.neuralisapp.com/brain-core/app-surfaces.md" description="The Files widget: tree, search, Git Control, the editor, Changes review, and the Sources and Vector Health panels." />

<Card title="Events" href="https://docs.neuralisapp.com/brain-core/events.md" description="The sync, review and vector-maintenance notifications brain-core declares." />

<Card title="Config settings" href="https://docs.neuralisapp.com/brain-core/config-settings.md" description="The platform settings for embedding, sync, search, listing, vector maintenance and git." />

<Card title="Credentials" href="https://docs.neuralisapp.com/brain-core/credentials.md" description="The four embedding-provider keys and keyed embedding endpoints." />
</Cards>