# Create a package (https://docs.neuralisapp.com/package-system/create-a-package)

In Neuralis every capability is a package, and the `PackageDefinition` is
**identical** whichever way it ships; you only pick **where it lives**. An
installed node package runs in-process; a project package (a drop in
`_packages/`, or a package folder listed on a source, which loads the same way)
runs WASM-sandboxed; a source package is markdown discovered in a synced source
with no install step. Author the same manifest, `tools/*.json` and
`skills/<name>/SKILL.md`; the platform treats it by the path it arrived through
([four ways](https://docs.neuralisapp.com/package-system.md#four-ways-a-package-reaches-the-platform)).

## The parity matrix [#the-parity-matrix]

| | installed node `@scope/*` | project `_packages/` (WASM) | source markdown |
| --- | --- | --- | --- |
| **Install** | while the host runs: `neuralis package install` + an approval + a restart; or into the image: `neuralis pkg add` + rebuild → `node_modules/<name>` (any scope) | drop a folder in `_packages/` (or list a source folder in `packageFolders`) | none — discovered in a synced source |
| **Discovery** | deps-scan (the `neuralis` block) | `ProjectPackageScanner` | source vector-index |
| **Trust** | native (host-assigned) | `untrusted` → `trusted` | inherits the source trust |
| **Runtime code** | in-process node | WASM sandbox (`neuralis-build` generates dispatch) | none — context-only |
| **Tools + handlers** | ✅ | ✅ generated dispatch | ❌ |
| **Routes** | ✅ direct | ✅ host-gated (`dist/routes.json`) | ❌ |
| **UI** | direct React (a prebuilt module built with `neuralis-build ui`) | iframe only | ❌ |
| **State** | live | stateless (lazy-init, `ctx.data`) | ❌ |
| **Hooks** | `callback` executes; `script` / `http` are declared but have no executor | declared only — nothing fires today | ❌ |
| **skills / rules / instructions / agents / docs** | ✅ | ✅ | ✅ (whole surface) |

## The 3 irreducible differences [#the-3-irreducible-differences]

Between an installed node package and a project WASM package, only three things
genuinely differ — everything else is the same contract:

1. **UI: direct React vs iframe.** A native package's widgets and cards are
   React components in the workspace, shipped as a prebuilt UI module
   ([`app.module`](https://docs.neuralisapp.com/package-system/app-surfaces.md)); a project package's UI loads
   in a sandboxed iframe.
2. **State: live vs stateless.** A node package holds live in-process state; a
   WASM package is stateless across calls (`init(ctx)` runs lazily once) and
   persists through `ctx.data`.
3. **Hooks: in-process callbacks vs nothing that fires.** `callback`, `script`
   and `http` handlers are all validated at load, but only a node package's
   `callback` executes; a `script` or `http` hook fails at dispatch with *no
   executor configured*. Do not build a capability whose only trigger is a hook
   ([Hooks](https://docs.neuralisapp.com/package-system/hooks.md)).

A **source** package carries **no code at all**: the markdown surface only, no
tools, routes, UI, state or hooks.

## Which layer does this value belong in? [#which-layer-does-this-value-belong-in]

Three stores, not interchangeable; pick by what the value *is*:

| The value is… | Goes in | Read with |
| --- | --- | --- |
| a **secret** — an API key, token, or client secret | manifest `credentials[]` | `ctx.credentials.resolveCredential(id, scope)` |
| a **tunable** — a cap, timeout, TTL, interval, threshold, model or URL default | manifest `configSettings[]` | the injected config provider, read per call |
| **boot-critical infrastructure** — a database URL, an auth secret, a topology address needed before anything is decryptable | `.env` | the host, at boot |

Two rules follow from the table and are enforced:

- **A secret is never a config key:** config values are admin-visible
  plaintext in the Config tab.
- **Declare only what something resolves:** a credential or config row no code
  reads makes the operator believe a feature is configured while it stays dark.
- **A connector has no `credentialFields`** and its factory context no
  credentials map: its secrets are ordinary `credentials[]` declarations
  ([Credentials](https://docs.neuralisapp.com/package-system/credentials.md), [Config settings](https://docs.neuralisapp.com/package-system/config-settings.md)).

## Start from an example [#start-from-an-example]

One official example per way a package reaches the platform, each readable
element by element from the package registry:

| Your package will… | Example | Read it |
| --- | --- | --- |
| be admin-installed as an npm dependency | `@neuralis/example-builtin` | `neuralweb read '@neuralis/example-builtin#docs/docs.create-package'` |
| be dropped into a project's `_packages/` | `@example/project-package` | `neuralweb read '@example/project-package#docs/<id>'` |
| be markdown in a synced source | `@neuralis-examples/example-source` | `neuralweb read '@neuralis-examples/example-source#skill/<id>'` |

Markdown elements read as **plain text** (`--path` for a multi-file element,
`--line-start`/`--line-end` for a window); tool, connector, credential and
config-setting contracts read as JSON (`neuralweb info '<identity>#tool/<id>'`).
What the examples promise: [Contract examples](https://docs.neuralisapp.com/package-system/reference-package.md);
the registry: [Marketplace](https://docs.neuralisapp.com/package-system/marketplace.md).

## Where to go for depth [#where-to-go-for-depth]

[Manifest](https://docs.neuralisapp.com/package-system/manifest.md) · [Tools](https://docs.neuralisapp.com/package-system/tools.md) ·
[Lifecycle](https://docs.neuralisapp.com/package-system/lifecycle.md) · [Routes](https://docs.neuralisapp.com/package-system/routes.md) ·
[WASM build](https://docs.neuralisapp.com/package-system/wasm-build.md) ·
[Source packages](https://docs.neuralisapp.com/package-system/source-packages.md).