# Source packages (https://docs.neuralisapp.com/package-system/source-packages)

<Callout title="Maturity: stable (85 %)">
**Ecosystem import.** Skills, rules, agents and instruction files in the Claude Code, Cursor, Codex, Gemini and Copilot conventions load straight from any synced source, without an install step and under the same scope as every other package.

- Imported content is markdown only: hooks and MCP server definitions in a foreign layout are not loaded.
- Rules are always on; glob-scoped rules are not supported.
- Skill arguments and per-skill model preferences from other ecosystems are accepted but not applied.

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

A **source package** comes from a synced source (a mounted repository, the
agent data tree, a machine sandbox) rather than an install: once the source is
in the [vector index](https://docs.neuralisapp.com/brain-core/sources.md), markdown matching the contribution
layout groups into packages. No `package.json`, no install step, no code —
**markdown contributions only**. It is the import path for existing agent
configuration: a repository's `.claude/`, `.cursor/` or `.github/` folder
contributes as-is, and skills written for other platforms
[load unchanged](https://docs.neuralisapp.com/package-system/skills.md).

## Sync is the prerequisite [#sync-is-the-prerequisite]

Discovery reads only the vector index, never the live tree, so an unsynced
source contributes nothing (the Sources panel says *"Never synced — run a sync
to index this source and load its packages"*). Sync triggers:
[brain-core sources](https://docs.neuralisapp.com/brain-core/sources.md).

Indexing also records a whitelisted frontmatter set (`name`, `title`,
`description`, `requiredFeatures`, `credentials`, the `metadata` vendor map —
recorded, never enforced; nested keys and OpenClaw's one-line JSON form both
survive — and `allowed-tools`, advisory on a skill but enforced on an
`agents/*.md` persona), a usability flag for manifests and a privacy marker for
agent-private subtrees. A skill whose `metadata.openclaw.requires` names
programs (`bins`, `anyBins`) gets one activation line on checking for them. A
later-added field reaches indexed files by a payload-only refresh on the next
sync, without re-embedding.

### How current the answer is [#how-current-the-answer-is]

Discovery reads a shared per-project inventory of RAW index entries (never an
answer filtered for a caller), invalidated at the start and end of every write
that could move a package candidate, failed or timed-out writes included;
other writes cost nothing. Access is never reused: each request re-reads the
source's persisted configuration and re-evaluates enablement, scope and every
URI-policy rule, so a revocation applies to the next request, even one in
flight.

## What is recognized [#what-is-recognized]

The indexer assigns contribution categories by path — the vocabulary packages
use everywhere — and admits a markdown as a contribution by the installed-package
rule (*Admission*, below the table):

| Path pattern | Category |
| --- | --- |
| `SKILL.md` (any directory) | `skill` |
| `commands/*.md` (legacy single-file command form) | `skill` |
| `instructions/**/*.md` | `instruction` |
| `AGENTS.md`, `AGENTS.local.md`, `AGENT.md`, `CLAUDE.md`, `CLAUDE.local.md`, `GEMINI.md`, `.github/copilot-instructions.md` | `instruction` (identity form, opt-in) |
| `rules/**/*.md`, `.cursor/rules/*.mdc`, `.cursorrules`, `.windsurfrules` | `rule` (opt-in) |
| `agents/**/*.md`, `*.agent.md` | `agent` |
| `docs/**/*.md` (READMEs and templates excluded) | `docs` (read on demand) |

The patterns match inside the **marker directories** `.claude`, `.agents`,
`.cursor`, `.codex`, `.gemini`, `.windsurf`, `.devin`, `.github`, `.opencode`,
`.kilo` and `.roo` too; their non-contribution content (settings, themes) is
indexed for search but never becomes a contribution.

**Admission.** The path decides the *category*; the file decides whether it
*is* a contribution. A markdown under `agents/`, `rules/`, `instructions/` or
`docs/`, and any `*.agent.md`, counts only when its frontmatter carries `id` or
`name` (`title:` or `description:` alone never promotes it); otherwise it is a
plain searchable file. Filename-is-identity forms are exempt (`SKILL.md`,
`commands/*.md`, the identity basenames, `.cursorrules`, `.windsurfrules`,
`.cursor/rules/*.mdc`) — the same rule as
[package discovery](https://docs.neuralisapp.com/package-system/directory-contract.md).

Four manifest filenames are package-anchor candidates: `package.json` (only with
a `neuralis` block), `neuralis.package.json`, `gemini-extension.json`, and a
`plugin.json` directly inside `.claude-plugin/`, `.cursor-plugin/` or
`.codex-plugin/`. `.mcp.json` / `mcp.json` and `hooks.json` are indexed and
categorized but **not** loaded as runtime contributions — connectors and hooks
never come from a source.

## How files group into packages [#how-files-group-into-packages]

Recognized files group into package roots by precedence — the strongest
matching rule wins for a directory, and every contribution binds to the
**deepest** detected root enclosing it:

1. **Usable manifest** — a directory holding a recognized manifest (a
   `package.json` only with a `neuralis` block) anchors one package; a plain
   application `package.json` binds nothing.
2. **Marker directory** — a `.claude/`, `.cursor/`, `.github/` or other marker
   dot-dir becomes one package named after it: "import your existing tool
   folder".
3. **Category directories** — a directory holding `skills/`, `instructions/`,
   `rules/`, `agents/`, `docs/` or `commands/` becomes a package named after
   that directory.
4. **Bare skill** — a free-standing `SKILL.md` folder enclosed by no other
   root becomes a one-skill package.
5. **Source root (restricted)** — the source root binds only root-level
   identity files, a root `SKILL.md` and files under root-level category
   directories. Docs never bind to the implicit source-root package, and nested
   stray files claimed by no rule above stay unloaded, so a large multi-project
   source never collapses into one giant package.

A folder-per-skill layout (`skills/a/SKILL.md`, …) stays one package.

```text
repo://
  .claude/                     → package ".claude" (rule 2)
    skills/review/SKILL.md
    rules/style.md
  packages/helper/
    package.json               → package "helper" (rule 1, neuralis block)
    skills/deploy/SKILL.md
  AGENTS.md                    → source-root package (rule 5, opt-in)
```

A source package is listed in the agent's `<packages>` overview after the
installed ones, behaves like any package in the editors, and passes the same
two gates: package enable state and the caller's
[grants](https://docs.neuralisapp.com/package-system/features.md).

## Defaults and per-file control [#defaults-and-per-file-control]

Syncing a repository must never silently change agent behavior:

| Category | Default |
| --- | --- |
| Skills, instructions, agents | On |
| Rules and identity files (`AGENTS.md`, `CLAUDE.md`, …) | **Opt-in** — never injected until explicitly enabled per file |
| Docs | Listed, **never auto-injected** — read on demand like a skill body |

The docs posture is server-pinned: frontmatter in a synced file cannot
escalate a doc into the system prompt.

Every file toggles per **agent** (the packages editor) and per
**conversation** (the composer's package selector, opt-in files badged). One
predicate decides: a disabled package turns all off; an agent-level per-file
**off is final**; a conversation-level off wins next; an opt-in file needs an
explicit enable. Delegate runs inherit the parent
conversation's overrides.

### The worked example [#the-worked-example]

`example-source` (a [contract example](https://docs.neuralisapp.com/package-system/reference-package.md)) is
this path in full — **no `package.json`**, the layout is the declaration. Its `skills/`, `instructions/`, `rules/`, `docs/` and root
`AGENTS.md` show both defaults: `defaultEnabled: false` applies to **`rule` and
identity files only**, and `docs` are pinned to `activation.invocation:
"manual"`, not disabled. (Its `agent` category lives in `example-builtin`.)

## Skills from sources [#skills-from-sources]

A source skill activates exactly like a package skill — through
`execute action="skill"` ([Skills](https://docs.neuralisapp.com/package-system/skills.md)) — with
source-specific mechanics:

- **Identity.** The activation id and the display title are the frontmatter
  `id`, then `name`, then the skill's directory name — never the literal
  `SKILL.md`.
- **Content loads at activation.** Discovery carries metadata only; the body is
  read through the source's connector at activation, and a vanished file fails
  closed with the same not-found as a skill that never existed.
- **Bundles.** `scripts/`, `references/` and `assets/` siblings enter the
  skill's `files[]` (the overview's `[files: …]` suffix, the editor's file
  mini-tree), as for installed packages.
- **Collisions are namespaced.** A built-in skill id always wins. A colliding
  source skill stays activatable as `<id>.<sourceSlug>`, and when two
  packages of the same source collide, as `<id>.<sourceSlug>.<packageKey>`.
- **Machine sandboxes.** A machine-source skill runs its scripts on that
  machine: the activation envelope prints the directory URI for `execute`; the
  platform shell never reaches it.
- **No double loading.** A subtree of an installed package contributes nothing.

Prompt-injected categories (rules, instructions, agents) hydrate per stream
under a strict budget, only for files that passed every gate — a disabled or
feature-gated file is never read.

## Security model [#security-model]

Source packages sit behind the same deny-by-default boundary:

- **URI policy, per root and per file.** The source's persisted
  [URI policy](https://docs.neuralisapp.com/package-system/uri-policies.md) is evaluated for every package
  root **and** every member file against the caller's real identity. A denied
  subtree's package is simply absent — no placeholder, no leaked file names. A
  source without a persisted policy contributes nothing.
- **Per-agent privacy.** An agent's private data subtree is visible only to
  that agent — to no other, not even by name.
- **Caller identity is required.** Without a verified caller role discovery
  fails closed to empty; one caller's view is never served to another.
- **Markdown only.** Tools, hooks, connectors, routes, lifecycle code and team
  definitions never load from a source; anything executable in a synced
  repository is searchable content, nothing more.
- **Standard gates apply unchanged.** A `requiredFeatures` frontmatter
  declaration gates a source file for non-holders exactly like a package
  contribution — hidden entirely, never rendered as locked.

## What is deliberately not loaded [#what-is-deliberately-not-loaded]

- Code surfaces (see *Markdown only* above). **Exception, opt-in:** a `host` source that lists
  `packageFolders` ALSO becomes a runtime package source, its packages' code
  running in the sandbox and advertised by the source's own scope — and only
  with the files the caller may read under that source's URI policies; additive,
  with a dedup. See
  [Hot-reload & package sources](https://docs.neuralisapp.com/package-system/lifecycle.md#hot-reload--package-sources).
- **Workflow templates.** Nothing under `workflows/` is a source contribution;
  templates arrive only through package discovery and its strict validator.
- `README*` files, anything under `template(s)/`, non-contribution files in
  marker directories, and contribution-shaped files no grouping rule claims —
  all indexed for search, never loaded (no junk package).
- Agent runtime data (conversation logs, usage data) — never package content.

<Callout type="info" title="Authoring for agents, not just importing">
The agent data tree is a Neuralis-native `.claude` folder: what an agent writes
into its own data source becomes a source package on the next sync, private
subtrees staying private.
</Callout>