> Every Taji docs page as Markdown: https://docs.taji.is/llms.txt

# The plugin platform

Every extension of the kernel, compiled in or a separate process, enters through one seam and lands in one registry, so the wire, the tree, your agent's tools and the laid skill all read one table. This page shows you how that registry is built, how a process plugin is hosted and confined, and how a plugin installs while Taji runs. To write a plugin, start at [the plugin guide](https://docs.taji.is/plugins.md); the contract, table by table, is [the manifest](https://docs.taji.is/plugins/manifest.md), [the process protocol](https://docs.taji.is/plugins/protocol.md) and [a plugin's window half](https://docs.taji.is/plugins/window.md).

```mermaid
flowchart LR
  built["Compiled-in plugins"] -->|"add"| reg["Registry"]
  dev["TAJI_PLUGINS"] -->|"admit"| reg
  signed["Signed registry"] -->|"seat"| reg
  reg --> wire["Wire and tree"]
  reg --> tools["Agent tools and skill"]
  reg --> host["Host"]
  host -->|"stdio"| proc["Process plugin"]
  proc -->|"CONNECT, relay"| proxy["Its own proxy"]
```

Read it from the left. A plugin reaches the registry one of three ways: compiled into the kernel binary, found in the `TAJI_PLUGINS` directory at boot, or installed from a registry Taji signs. The wire, the tree, the tools your agent derives and the skill it reads are all built from the registry. A process plugin's row is backed by the host, which runs the program in the OS sandbox and speaks to it over stdio; the program's only way out is its own proxy.

## How does a plugin reach the kernel?

A compiled-in plugin is a crate under `plugins/` built on `taji-plugin` alone (`engine/crates/taji-plugin/src/lib.rs`). A binary composes it by its constructor: `taji::Kernel::new().add(P::default).run()`. The kernel with every compiled-in plugin is `taji_open::kernel()`; a binary that adds a plugin starts from it, or it lacks every vendor. The kernel itself never names a plugin.

The registry (`engine/crates/taji/src/plugin.rs`) is one route table, one dispatch point and one listing: `plugin::Registry`, `Registry::dispatch` and `GET /read/plugins`. It is built at boot and changed after boot only by `Registry::seat` and `Registry::unseat`, the install path. A process plugin is one more row. One refused at admission is still a row, with `enabled: false` and its `reason`; it is never a boot error.

A plugin declares itself in a file, `taji-plugin.toml`, so a process plugin, the window and the consent sheet read the same declaration. A compiled-in plugin that disagrees with its manifest (`Build::agrees`) ends the boot, because that is a build defect, not a runtime state.

A plugin's kernel half is its manifest's tables: `[[kernel.verbs]]`, `[[kernel.nodes]]`, `[[kernel.fields]]` and `[[kernel.indicators]]`. An indicator row is a script registered with `Build::script`, or a native definition registered with `Build::indicator`. The kernel computes both. A kernel composed without `plugins/indicators` has an empty indicator catalog.

Entitlement is one check, in the dispatcher: while a plugin's `enabled()` is an error, each of its verbs answers `403 plugin_disabled` with the reason. Its nodes still read. A chart binding of a disabled plugin's indicator faults with the sentence `<plugin> is disabled: <reason>`.

## What separates the two tiers?

| | Tier 1, compiled in | Tier 2, process |
|---|---|---|
| What it is | a Rust crate under `plugins/`, built with the kernel | a program in any language, speaking `taji-plugin/1` over stdio |
| Built on | `taji-plugin` | `taji-sdk` (Rust), the `taji` Python package, or the protocol directly |
| Runs | inside the kernel's process | as its own process, in the OS sandbox |
| Its grants | a type discipline, not a sandbox | enforced by the sandbox, the proxy and the ask gate |
| Its promise | none: a kernel change that breaks one is a compile error | `schema/taji.json`, version `taji_plugin::API` |
| Venues and channels | yes | no |

`engine/crates/taji-plugin/tests/boundaries.rs` holds the dependency rule: a compiled-in plugin crate depends on `taji-plugin` alone, a Rust process plugin on `taji-sdk` alone, and neither on the kernel or another plugin ([0003](https://github.com/TajiAI/Taji/blob/main/docs/decisions/0003-plugin-on-sdk-alone.md)). A library crate under `plugins/` with no manifest is held to the same rule, and a plugin may name it.

A compiled-in plugin has one more door, `taji::native::Native`, reached through `Build::native`. It is for work that must run inside the kernel's own timing: the `SeatSource` the trading root parks and seats around a reboot, the hub's read plane, desk events, and the `busy` reads Quit consults. A route cannot carry these, because a park must end before the root drops. Only a compiled-in plugin built on the `taji` crate can name the door; no `plugins/*` crate may, and a process plugin is never handed it. The door has no stability promise: a kernel change that breaks a caller is fixed in the same commit.

A process plugin's promise is `schema/taji.json`: its manifest and every protocol message are `$defs` there, and nothing else is promised. Its manifest's `taji` range must match `taji_plugin::API` at admission. `API` versions the schema, never the Rust crate (`engine/crates/taji-plugin/tests/schema.rs`), and a breaking schema change raises it ([compatibility](https://docs.taji.is/reference/compatibility.md)). So a manifest written for a later schema is refused by its range before it can fail on a key this kernel does not know.

## How is a process plugin admitted?

`engine/crates/taji-host` turns each directory in `TAJI_PLUGINS` whose manifest has `[process]` into a `taji_plugin::Plugin`, so the registry lists it, dispatches its verbs and derives its tools on the same path as a compiled-in one. Each verb is a call to its process; each node reads the value the process last `set`; each indicator row is a script read off its directory for the kernel to run.

Admission (`Registry::admit`) runs every check a compiled-in plugin gets, plus a process plugin's own:

- Its `taji` range holds `taji_plugin::API`.
- Its id is not a first-party provider's.
- Each source id is its plugin's id or `<id>-<word>`.
- Each `[grants] reads` word is a data product, never an account read such as `positions`.
- A `[[link]]` step opens `https://` only.
- No verb route under `{desk}`, and no node bound to a path.

The full list of what a process plugin cannot declare or serve is the author's, in [the plugin guide](https://docs.taji.is/plugins.md). A plugin that breaks one rule is listed refused with the sentence, and the rest of the kernel boots.

## What keeps a process plugin running?

A process starts at its first call; concurrent first calls share one start. Its first line must be the hello, within 30 s, or it is off until the next boot. After that, the host supervises it:

- A call unanswered in `call_timeout_s` answers `504 timeout`, and the process keeps running.
- An exit answers every call in flight `502 plugin_exited`. The next call restarts it after 1, 2, 4, then 8 s.
- The fifth exit in 10 minutes turns it off until the next boot.
- Ten non-JSON lines in a row, a line over 16 MiB, or a `ping` unanswered while it streams each count as an exit.

So one broken plugin never takes the kernel down with it. Each event and its answer is a row of [the process table](https://docs.taji.is/plugins/protocol.md#the-process). The process's stderr, and each line about it, goes to `<state dir>/plugins/<id>/log`, rotated at 10 MiB.

## How does a process plugin read market data?

Through one door: an `ask`, which the kernel answers as it answers `GET /get/<product>?<query>`. The process holds no token and never dials the wire.

The kernel checks each ask before the read runs (`engine/crates/taji-host/src/lib.rs`). The product must be one the plugin's own `[[sources]]` declare or its `[grants] reads` lists, never one matched by an id's prefix. A `provider=` in the query may name only the plugin's own source, and `refresh`, `wait` and `first` are refused, because the kernel paces its vendors. Any refusal is `403 not_granted` with a sentence naming the line to add.

Asks in flight are bounded: each holds one of 8 places until its answer is written to the process (`ASKS` in `engine/crates/taji-host/src/process.rs`). An ask with no place free is dropped unanswered, and the ninth dropped in a row counts as an exit, so a process that never reads its answers cannot grow the kernel's memory.

## How does a process plugin reach the network?

Only through one `127.0.0.1` port that its sandbox reaches, so the port is the plugin's identity. The sandbox (`engine/crates/taji-host/src/sandbox.rs`) lets it read what its policy names, write its own `data` and `tmp`, see only the environment the host sets, and reach no network but that port.

The port serves two things:

- **Its proxy** (`engine/crates/taji-host/src/proxy.rs`) answers `CONNECT` to the hosts in `[grants] net.hosts` alone. TLS passes through untouched. A name is resolved once, every address must be public and none this machine's own, and the tunnel dials those addresses, never the name again. A literal `ip:port` reaches exactly its address, and only a public one for a plugin installed from the registry. No `CONNECT` reaches a port Taji listens on, or a compiled-in venue's local order endpoint, whatever the manifest declares.
- **Its relay** (`engine/crates/taji-host/src/relay.rs`), for a plugin that declares `[sign_in]`, sends `<METHOD> /http/<host>[:port]/<path>` and opens `GET /ws/<host>[:port]/<path>` toward its `[sign_in] hosts` alone. The process holds markers, never secrets; the relay swaps each marker for its value through the plugin's login and redacts every answer ([0005](https://github.com/TajiAI/Taji/blob/main/docs/decisions/0005-no-key-reaches-a-client.md)). The protocol's side is [Sign-in and the relay](https://docs.taji.is/plugins/protocol.md#sign-in-and-the-relay).

Each refusal is a `403` naming the line to add, and one line in the plugin's log.

The sandbox is real or nothing runs. Before any process plugin starts, the kernel runs its own binary under a plugin's policy, behind a proxy declaring no host, as a canary; if the sandbox lets any of the canary's attempts through, no process starts. Only a debug build under `TAJI_UNSANDBOXED=1` runs a plugin unconfined. The sandbox and what it holds back across Taji is [Security](https://docs.taji.is/architecture/security.md)'s.

## How does a Python plugin run?

On Taji's own CPython 3.15, never one off `PATH`: `TAJI_PYTHON`, else the package's `python/` beside the kernel's binary, else a debug build's `.python` (`engine/crates/taji/src/python.rs`). A lock's environment is named by its bytes. It is carried in the runtime's `envs/`, else laid once in `<state dir>/python/envs/` by `uv`, under the sandbox, behind a proxy admitting PyPI alone (`engine/crates/taji-host/src/python.rs`). A lay that fails is a start that fails.

Yahoo Finance and SEC EDGAR are compiled-in plugins whose vendor code is Python. Each runs it as the same kind of confined process, a worker its Rust calls (`taji_python::Worker`); the kernel links no Python.

## Who may call a plugin's verb?

A caller is one of four scopes by the token it holds: `local`, `agent`, `page` or `sheet` ([Security](https://docs.taji.is/architecture/security.md)). The dispatcher admits every verb by scope before any handler runs. A core verb's scopes are its row in `engine/crates/taji/src/wire/routes.rs`; a plugin verb's are its manifest's `scopes`, `local` and `page` when absent. So your agent reaches a plugin's verb only where its manifest names `agent`, and the bridge derives a tool only for a verb with a `name`. No plugin verb may name `sheet`, and a venue arm's verbs are closed to `agent`.

The sheet is where you type a secret and consent to an install, out of reach of the page and its plugin frames. A link form is a declaration, `[[link]]`, which the kernel serves at `GET /read/link/forms` and the sheet draws. A local process that can read the state dir holds the `local` token, so it is you.

## How does a plugin install while Taji runs?

From a local registry Taji signs (`engine/crates/taji/src/install.rs`). The registry is a directory the setting `taji.plugins.registry` names as a `file://` URL. Its `index.json` is checked against an ed25519 signature under the build's registry key before it is read. Each entry carries its manifest's text and every file consent shows, and the artifact is held to it byte for byte. The author's side is [Pack and install a plugin](https://docs.taji.is/plugins/publish.md).

Consent is one sentence per grant, which the kernel derives from the manifest, bound with the artifact's sha256 in one digest. `POST /verb/plugins/install` proceeds only for that digest; any other answers `409 consent` with the lines and the digest to agree to. Install, enable, disable and uninstall are `local` and `sheet` verbs: neither your agent nor the page can call them.

What this kernel would not seat is refused before any file is written or any process runs. An installed plugin then takes the same checks as one found at boot, through `Registry::seat`, with no relaunch:

| Step | What happens |
|---|---|
| Install | Files go to `<state dir>/plugins/<id>/package-<12 hex of its sha256>/`; `<state dir>/plugins.json` records what you agreed to; its process starts once |
| Update | The offer opens `Updates <name> from <old> to <new>.` and marks the lines you have not agreed to before; the old version serves until the new one is seated |
| Another publisher | The offer names both publishers and asks every line again; the old link is forgotten before the new process starts |
| Disable | Out of the registry: its verbs answer `unknown_route`, its nodes, link forms and skill section are gone, its process stops |
| Enable | Seated again as a launch does, if its lines still match the record; else `409 consent`: install it again |
| Uninstall | Its link is forgotten first, then its process stops and its record and directory are removed |

At every boot and every enable, the kernel compares what the package says with what you agreed to, and seats it only while they match. A plugin with no `[process]` brings only its skill, link forms and scripts. An installed data source is swapped into every running hub and joins automatic reads after every other source.

## See also

- [Plugins](https://docs.taji.is/plugins.md): which kind of plugin you need, and echo answering a call.
- [The manifest](https://docs.taji.is/plugins/manifest.md), [the process protocol](https://docs.taji.is/plugins/protocol.md) and [a plugin's window half](https://docs.taji.is/plugins/window.md): the contract, table by table.
- [Pack and install a plugin](https://docs.taji.is/plugins/publish.md): the author's side of a signed registry.
- [Security](https://docs.taji.is/architecture/security.md): tokens, the vault and the sandbox across Taji.
- [0003](https://github.com/TajiAI/Taji/blob/main/docs/decisions/0003-plugin-on-sdk-alone.md) and [0004](https://github.com/TajiAI/Taji/blob/main/docs/decisions/0004-capabilities-through-the-hub.md): why a plugin depends on its SDK alone, and why no vendor shape reaches a client.
