Skip to content

Architecture

The runtime is a kernel and the plugins it reaches over MCP. The kernel owns what has to be in one place: who is acting and in which workspace, the doors requests come through, the agent loop, tool routing, time, and the rules applied to every call. Conversations, scheduled tasks and files each live in a system plugin, a separate MCP server that stores its own records. The kernel reaches each one only through a published, versioned contract.

npx nimblebrain runs the kernel with the three default system plugins and the local filesystem behind them, with nothing to configure. An operator can turn any of them off, or replace one with another implementation of the same contract, written in any language.

web shell (browser) MCP clients, app iframes connector webhooks
│ │ │
▼ ▼ ▼
┌──────────────────────────────── kernel ─────────────────────────────────┐
│ doors REST /v1 · chat stream · /mcp/<workspace> · inbound hooks │
│ identity and workspaces: who is calling, and which one workspace │
│ run door ──► engine (agent loop) ──► tool router │
│ plugin binding: contract documents, host context, supervision │
│ scheduler (kernel jobs) · run worker · providers (work queue) │
│ kernel-owned data │
└──────┬─────────────────┬─────────────────┬──────────────────┬───────────┘
│ MCP (stdio) │ MCP (stdio) │ MCP (stdio) │ MCP (HTTP)
▼ ▼ ▼ ▼
conversations tasks files connectors
plugin plugin plugin (remote MCP servers)

Every request enters through a door. A door takes the workspace from the URL the request was sent to and the identity from the sign-in, checks that the identity is a member of that workspace, and only then runs anything.

Door Who uses it What it carries
REST, /v1/… the web shell Workspace routes under /v1/workspaces/<id>/…: tool calls, resource reads, uploads, file downloads. Identity routes with no workspace: /v1/bootstrap, the /v1/events stream.
Chat stream the web shell POST /v1/workspaces/<id>/chat/start starts a turn; GET /v1/workspaces/<id>/conversations/<id>/events streams it as server-sent events. These routes answer only while a conversations plugin is bound.
/mcp/<workspace> MCP clients (Claude, Claude Code, Cursor, another NimbleBrain), and app iframes through the shell’s bridge A Streamable HTTP MCP server for one workspace. It lists that workspace’s tools and the caller’s own tools, and nothing from another workspace. The kernel refuses bare /mcp. See MCP Endpoint Reference.
Web people The shell is a browser app served beside the API. It uses the REST and chat doors, and renders each plugin’s screens in sandboxed iframes, which reach tools only through /mcp/<workspace>.
Inbound hooks a connector’s vendor Webhook deliveries addressed to a declared hook. See Inbound Webhooks.

The operator chooses one identity provider in instance.json (dev, OIDC or WorkOS); the runtime never picks one for itself. A workspace is the boundary: its members, its connectors, its routes. A session reaches exactly one workspace, the one its URL names, plus the caller’s own tools and connections. No tool name, header or body field can name another workspace, so a caller has no way to write a request that reaches one. See Workspaces.

Every agent run passes one door, whether a person typed a message or a scheduled task fired. The door decides the run: its workspace, who it acts as, its tools and skills, its model, its limits and spend accounts, and which agent runtime executes it. The engine then runs the agent loop described in Core Concepts: call the model, run the tools it asked for, repeat until it answers. The built-in runtime runs the loop in the kernel. For an external agent runtime, the kernel hands the same decided run to a worker over the network.

An unattended run takes a run slot before it starts (runs.maxConcurrentRuns, see runs). The kernel gives a freed slot to the workspace holding the fewest, so one busy workspace cannot starve the others. A chat turn takes no slot, since a person is waiting on its answer.

The model sees one flat list of tools. The router decides where each call goes from the shape of its name alone:

Kind Name Where it comes from Scope
Kernel tools nb__*, and the kernel’s own in-process apps (skills__*, usage__*, notifications__*, compose__*, hooks) The kernel The session’s workspace, or the caller where a tool needs no workspace
Connector tools <connector>__<tool>; a personal connector’s are my_<connector>__<tool> The remote MCP servers installed in the workspace, or the caller’s own, granted there The session’s workspace
Contract tools conversations__*, tasks__*, files__* The public tools of the plugin bound to each contract The caller: owned by the person, outside any workspace’s registry, and walled by the plugin to the workspace and owner in each call

The kernel chooses each contract’s tool prefix. Whichever plugin implements the tasks contract, its tools are tasks__*.

For each contract it consumes, the kernel finds the enabled plugin whose manifest says it implements that contract. It checks the version (same major, minor at least the kernel’s) and, for a contract that allows one implementation, that exactly one plugin implements it. It then starts the plugin’s server from its mcp.json over stdio, with a minimal environment and its own data directory, <work directory>/plugin-data/<plugin>. Agents, the /mcp door, the app bridge and the kernel’s own calls all share one MCP connection to that server.

The kernel reads how to treat each tool from the contract document, never from a list of its own:

  • The kernel hides private tools. It leaves them out of every tool listing and refuses a call to one before it reaches the server. The boundary is the server’s own refusal of any caller but the host; hiding them keeps the listings clean.
  • The kernel refuses some tools unattended. It never offers a scheduled run a public tool the document marks unattended: "refused", and refuses the call if a run makes it anyway. A private tool carries no unattended marking, since no run reaches one.
  • Some tools record run consent. After a person’s successful call to a tool with a consent marking, the kernel records which tools that person stated for the work the call saved (see How a scheduled task is defined).
  • The kernel announces writes. After a successful call to a public tool that writes (readOnlyHint: false), it tells the caller’s open views to refresh.

The kernel holds every answer to the document. When the kernel calls a plugin itself, it checks the answer’s structuredContent against that tool’s output schema in the document the binding was made under. An answer outside it fails the call (answer_invalid); the kernel logs the contract, the tool and the first schema error, never the answer. The same document binds a server in any language, whoever wrote it.

The kernel stamps the host context on every call. Every request to a plugin server carries params._meta["ai.nimblebrain/context"]: the principal (host for the kernel’s own code, person for everyone else), the workspace, the owner, the conversation or run the call is made inside, the kernel’s clock (now), the version of the contract the kernel binds the server under (contractVersion), and, inside a run, the unattended flag. The kernel writes it in one place, the connection’s send, and overwrites any value a caller supplied. The rule is contracts/host-context/CONTEXT.md.

The kernel supervises plugin processes. It starts the bound servers together at boot and refuses the boot if one does not start, naming the contract and plugin. When a server exits, the kernel restarts it after a delay that starts at half a second and doubles to 30 seconds, up to eight times in a row; the count resets once a connection has stayed up for a minute. The next call that needs the server restarts it sooner. The kernel does not retry a call that was in flight when the server exited. Every new connection after the first, whatever made it, raises a reconnect signal, and the kernel then watches the plugin’s change hints again and asks it what it missed.

The scheduler is the one owner of time in a runtime process. Periodic work the kernel does on its own is a kernel job: it declares how often it runs, how long a run may take, whether it runs once per key (per workspace, say), and whether it must run in only one process, and the scheduler enforces all of it. A job paces itself by naming its next run, and its interval serves as the backstop. The jobs, and what each talks to:

Job What it does When it runs Talks to Registered
connectors.health Checks each connector connection and restarts one whose transport dropped Every 30 s The connectors’ MCP servers Always
connections.revalidate Re-checks brokered connections whose upstream account can lapse without an error, and marks stale ones for reconnect Every 5 min; one process only The connector brokers (Composio, Smithery) When a broker is configured
gateway.providers Asks the model gateway which model providers it serves At boot, then each minute, backing off from 2 s to 5 min after a failure The model gateway When a gateway is configured
workspace.purge Removes deleted workspaces whose retention window has passed: calls delete_workspace on each bound plugin, tears down connectors, deletes secrets, run consents and the workspace’s records At boot, then hourly; one process only The bound plugins, the credential store, kernel data Always
tasks.due Asks the tasks plugin what is due in a workspace and puts each occurrence on the work queue Per workspace: when it is first served, on the plugin’s change hint and on the plugin’s reconnect; then 15 minutes before the next time the plugin forecasts (nextAt); 30 s after a failed call; at least every 10 min The tasks plugin’s due and its change hint, the work queue When a tasks plugin is bound
work.claim Claims queue items while a run slot is free and starts each run At start, on an enqueue, when a run slot frees, at each item’s due or retry time; at least every 5 s The work queue, run admission, the tasks plugin’s begin_run When a tasks plugin is bound
runs.retention Deletes the runs that ended longer ago than runs.retentionDays, with one cutoff per pass Per workspace, 10 to 20 min after boot, then every 24 h; one workspace at a time, one process only The tasks plugin’s delete_runs When a tasks plugin is bound
plugins.required Keeps every workspace’s items from required catalogs installed and current Per workspace, at boot and when the workspace is created, then every 5 min, four workspaces at a time; one process only The catalogs, workspace records When a required catalog is attached

Two loops keep timers of their own: the notification poller, which reads connectors’ outboxes into each workspace’s inbox, and the retry of notification route deliveries.

Operators see the jobs as metrics on /metrics, labelled by job name and never by workspace: nb_job_runs_total{job,outcome}, nb_job_duration_seconds{job}, nb_job_last_success_timestamp{job} and nb_job_next_run_timestamp{job} (see Observability). An org admin reads each workspace’s slot (its last run, outcome, failures and next run) through nb__status with scope jobs. No endpoint lists jobs without sign-in.

The run worker runs what the bound tasks plugin says is owed. Two kernel jobs set its timing: tasks.due asks the plugin what is due in each workspace and puts each occurrence on the work queue; work.claim claims items when a run slot is free, asks the plugin for the run, runs it through the run door, and reports how it ended. The worker keeps timers only for a single run: its lease renewal, its maximum duration, and the retry of its end_run. With no tasks plugin bound, there is no worker and nothing polls. How a scheduled task fires has the whole flow.

A provider is infrastructure the kernel uses and no agent calls: a kernel interface with no tools and no screen, which nothing reaches over MCP. Its doc comments are its contract, and every implementation passes its conformance suite.

There are two:

  • The work queue. A caller enqueues an item with a key, so a repeat stays one item, and a not-before time. A worker claims it under a lease and receives an attempt number and a fencing token; it extends the lease while it works and settles the item when done. Delivery is at least once and fenced: a worker that stops leaves the item to be claimed again with a higher token, and a store that keeps the highest token it has seen refuses the stale worker’s writes. The runtime ships a filesystem implementation at <work directory>/queue.
  • Run consents. The kernel’s record of the tools a person stated for work that runs as them later, keyed by contract, workspace, owner and subject. The plugin transport writes one after a person’s successful consent-marked call, the run worker reads it before every run, and the workspace purge deletes a workspace’s records. The runtime ships a filesystem implementation at <work directory>/consent.

Each shipped implementation serves one process and says so (multiProcess: false).

Bytes need no provider. The files plugin owns its storage and moves bytes to and from the kernel by short-lived URLs it issues.

The kernel stores its own data under the work directory (~/.nimblebrain by default, NB_WORK_DIR):

Data Where
Configuration nimblebrain.json, and instance.json for identity
Workspaces: members, connectors, installed-plugin records, notification routes, hooks workspaces/<id>/workspace.json, and a deleted.json tombstone for a deleted one
Each workspace’s notification inbox under the workspace’s directory
People: personal connectors, their skills, their per-workspace switches users/<id>/
Skills at the organization tier skills/
Credentials: connector tokens, API keys the credential store (see Secrets)
The usage ledger: every model call and what it cost usage/<YYYY-MM>/
The work queue queue/
Run consents: the tools each owner stated for each task consent/

The kernel stores no conversation, task, run or file. Each plugin keeps its data in plugin-data/<plugin>/, which belongs to the plugin; the kernel never reads it.

Plugin Contract What it owns Its screen
conversations ai.nimblebrain.conversations Chat history: every conversation’s stored events, from which its messages, title and token usage are read Conversations
tasks ai.nimblebrain.tasks Unattended work: task definitions, schedules, runs and their results, batches Scheduled
files ai.nimblebrain.files Files: their bytes, records, folders, tags and extracted text Files

Each plugin is one MCP server with two kinds of tool. People, agents, apps and MCP clients use the public tools, as person. The kernel uses the private tools, as host, to save and read what it depends on; the server refuses them to anyone else with forbidden and changes nothing. The contract decides which tools are private, and a plugin cannot change that. Every contract’s private tools follow two rules: their inputs are closed, so the server refuses a field the contract does not define (invalid_input) instead of ignoring it, and they carry no unattended marking.

Who calls what:

Caller Plugin Tools
People, agents, apps, MCP clients (as person) conversations list, get, search, update°, stats, export
tasks create°‡, update°‡, delete°, list, status, run°‡, run_result, runs, cancel°, upcoming, stats, run_batch°‡, batch, batches, batch_control°
files list, search, info, read, create, tag, move, delete, create_folder, update_folder, delete_folder
Run door and conversation routes: each chat turn’s history conversations create† (a new conversation with its first events, in one step), append_events† (each append names the expectedSeq it was built on, so it lands at most once), events†, get, list, update, delete†
File intake: chat attachments, uploads files begin_upload†, complete_upload†, delete
File serving: downloads, files:// reads, a run’s prompt, connectors’ host resources files resolve†, read, list
Run worker tasks due†, begin_run†, end_run†, and the change hint tasks://due/<workspace>
Notification routes that name a task tasks offer_event†
runs.retention job tasks delete_runs({ endedBefore })†, at most 1000 runs a call, until it answers no more
workspace.purge job conversations, tasks, files delete_workspace({})†, which answers how many records of each kind it removed

† A private tool: listed nowhere, and refused to anyone but the kernel. The kernel also calls some public tools as host, walled to one owner, and the plugin answers as if that owner had made the call. ° Refused inside an unattended run. ‡ Records run consent after a person’s successful call (run and run_batch only when the call gives an inline definition).

A plugin declares what it implements in its manifest, under extensions["ai.nimblebrain"]:

"implements": [
{ "contract": "ai.nimblebrain.tasks", "version": "1.0", "server": "tasks" }
]

The kernel asks for the binding of ai.nimblebrain.tasks and gets whichever enabled plugin declared it. No kernel code names the built-in plugin, its directory or its server key. What the kernel offers follows from what is bound: chat is on exactly when a conversations plugin is bound, scheduled work when a tasks plugin is, files and attachments when a files plugin is.

The operator decides which plugins run, in the plugins block of nimblebrain.json. Each contract allows one implementation, so turn the built-in one off beside yours:

{
"plugins": {
"tasks": false,
"my-tasks": { "source": "./plugins/my-tasks", "system": true }
}
}
  • source is a directory in the Agent Plugins format: plugin.json with the implements declaration, and mcp.json with the server the runtime starts.
  • Only this block sets system: true; no manifest can make itself a system plugin, because a system plugin holds records the kernel relies on.
  • The runtime starts a system plugin’s servers over stdio. It refuses a contract’s server that points at a url until the kernel holds a credential to present to it.
  • "tasks": false alone turns scheduled work off. Chat, files, apps and /mcp keep working.

To implement a contract, in any language, read its documents in the repository:

Contract Rules Document Conformance runner
conversations contracts/conversations/CONTRACT.md schemas/contracts/conversations/v1/contract.json contracts/conversations/runner/conformance.ts
tasks contracts/tasks/CONTRACT.md schemas/contracts/tasks/v1/contract.json contracts/tasks/runner/conformance.ts
files contracts/files/CONTRACT.md schemas/contracts/files/v1/contract.json contracts/files/runner/conformance.ts
  • The document is the contract: one JSON Schema 2020-12 file per version, published at its $id (https://schemas.nimblebrain.ai/contracts/<name>/v1/contract.json). It holds every tool with its visibility, unattended and consent markings, annotations, input and output schemas, and the closed list of errors. Generate types for your language from its $defs. The kernel checks every answer to its own calls against it.
  • The host context every call carries is one shared spec, contracts/host-context/CONTEXT.md, with readers in the TypeScript and Python server SDKs. It also states what every contract’s private tools share: closed inputs, and one workspace purge, delete_workspace({}), answering { removed: { <kind>: <count> } }.
  • Versions follow one rule for every contract, contracts/VERSIONING.md: major.minor, a minor only adds, anything else is a new major. 1.0 is the first published version of each contract, from v0.88.0.
  • An implementation is valid when it passes the runner. The runner speaks only MCP over Streamable HTTP and reads only the document, so it checks a server written in any language:
Terminal window
bun --no-env-file contracts/tasks/runner/conformance.ts --server http://127.0.0.1:8080/mcp \
--carriage meta --workspace ws_test --owner user_test --scratch-workspace ws_scratch

--scratch-workspace names a disposable workspace for the cases that exercise the run flow; without it, the runner skips them. --public-only checks a host’s agent-facing door instead: that it serves the public tools, and that no private tool is listed or answers.

A person or an agent defines a task through the tasks plugin’s public tools; the Scheduled page calls the same tools.

  1. The call. tasks__create with a definition: a manifest (name, schedule, allowed tools, limits, budget) and a body, the prompt. tasks__update changes one.
  2. The kernel stamps it. The call carries the host context: the person, the workspace, the kernel’s now.
  3. The plugin stores it. It checks the definition, stores it with its owner (the caller), answers the saved task, and sends its change hint for the workspace.
  4. The kernel records the person’s consent. create and update carry a consent marking, so after the call succeeds the kernel records (contract, workspace, owner, task) → tools: the task’s id from the answer, and the tools the person stated in the call (manifest.allowedTools), never the tools the answer names. It writes the record before it releases the answer. If that write fails, the save still stands: the kernel logs the failure and releases the answer, and the task’s runs use the consent recorded before, or end consent_missing if there was none. A later save that states the tools replaces the record; a save that states none (a rename) leaves it as it was. The record is the kernel’s own, in the run consents provider, and nothing about it crosses the contract.
  5. The kernel keeps no copy of the task. Besides the consent record, its only trace of a task is a queue item once an occurrence is due: its key, its time and an opaque reference.

A run cannot define work. The kernel refuses create, update, delete, run, cancel, run_batch and batch_control inside a run, so a run that reads untrusted content cannot rewrite or multiply work that outlives it, and no run records consent. See Scheduled tasks for the definition’s fields.

tasks plugin kernel
──────────── ──────
◄─── due(until) ───── tasks.due, per workspace: on the change
hint, else 15 min before nextAt,
at least every 10 min
occurrences, runs ────────────────────► enqueue each one on the work queue,
to cancel, nextAt under its key, not before its time
│
work.claim: its time passes and a
run slot is free
▼
claim the item: lease, attempt, token
◄─── begin_run ──────
skip, or ─────────────────────────────► look up the owner's run consent for
{ runId, taskId, the task; the owner must still be
ownerId, work } a member
▼
run door: tools in both the consent
and the work, skills, model, limits,
spend accounts; the engine runs the
agent as the owner, unattended
◄─── end_run ────────
notices ──────────────────────────────► deliver notices to the workspace inbox,
settle the queue item
  1. Due. For each workspace it serves, the kernel job tasks.due calls the private tool due as host with an until 15 minutes ahead of the kernel’s clock. due answers the occurrences owed in the workspace up to until (each a key, an opaque reference and a not-before time), the runs to cancel, and nextAt, the plugin’s forecast of the next occurrence it owes after until. The job then sleeps until 15 minutes before nextAt, so it sees an occurrence before the occurrence is due, and calls again at least every 10 minutes either way. The plugin’s change hint wakes it at once: a subscription to tasks://due/<workspace>, which the plugin signals on every write that owes work sooner (a definition saved, a run asked for or cancelled, an event accepted, a batch moved). A lost hint delays work until the backstop and no longer. The job retries a failed call after 30 seconds. When the plugin’s server restarts, the job watches the hint again and calls due for every workspace at once.
  2. Enqueue. The kernel puts each occurrence on the work queue under its key, so an occurrence that every due lists until it begins stays one item. A new item wakes work.claim, at once or at its not-before time.
  3. Claim. When the occurrence’s time has passed and a run slot is free, the kernel job work.claim claims the item under a lease and keeps extending it while the run lasts. A worker that loses its claim stops the run.
  4. Begin. The kernel calls begin_run with the claim’s fencing token. The plugin answers skip (the task changed, was disabled or deleted, or its budget is spent) or the run: a run id, the task’s id, the owner it stored for the task, and the work spec (prompt, input, allowed tools, skills, limits, model, spend accounts, output schema). The plugin fences by token, so it refuses a stale claim, and it hands a run out at most once. If a worker died after begin_run, the next claim learns the run was interrupted, and the run is recorded, never run again, since a second run could repeat what the first already sent or wrote. The kernel refuses an answer outside the document’s schema, and a run that answer named ends as not started.
  5. Check consent. The kernel looks up the run consent for this contract, this workspace, the answer’s owner and the answer’s task. With none, the run ends as not started (consent_missing). The owner must be a member of the workspace now (membership_revoked if not); the run acts as that owner, with no org role. Either refusal turns the task off at once, with a notice; the owner’s next save that states the tools records consent again.
  6. Run. The run reaches a tool only when the tool matches a glob in the consent record and a glob in the work’s allowed tools, so the plugin can narrow what its owner consented to and never widen it. The kernel’s own discovery tools (nb__search, nb__manage_tools, nb__call_tool, nb__use_skill) are outside both lists. A tool reached through nb__call_tool is checked against both lists by its own name. The run door renders the work (the input and notes as data, never instructions; the output-schema instruction), lowers each limit to the operator’s ceiling, enforces the work’s spend accounts beside the operator’s own, and runs the agent as the owner, walled to the workspace. Every call the run makes carries unattended: true.
  7. End. The kernel calls end_run with how the run ended: its output, stop reason, usage, cost, each tool call’s name and result (never its input or output), and the files it wrote. The plugin records the run, works out its label and verdict, decides the next occurrence, and answers the notices to deliver. The kernel delivers each one to the workspace inbox once, then settles the queue item.

The plugin carries cancellations on due: the kernel stops each run listed under cancel, and the run ends cancelled.

Who owns what:

The tasks plugin The kernel
Decides What a task is, when each occurrence is due and when the next one is (nextAt), whether a claimed one runs or is skipped, which owner and task a run is, retries and backoff, failure streaks, budget balances, how long run data is kept When to ask, when a run starts (the queue, run slots, fair share), whether the owner consented and is still a member, which tools (within the consent), skills, model and limits a run gets
Stores Definitions and their owners, runs and results, batches Run consents; queue items
Does Answers due, begin_run, end_run; sends the change hint Runs the agent; enforces limits and spend; meters usage; delivers notices
Clock Reads none; it takes every decision on the now the kernel stamps on the call Its own, stamped on every call
Kernel job Scheduled task
What it is Periodic work the kernel does for itself: a health check, a purge, a reconcile Work a person or agent set up: a prompt, a schedule, the tools it may use
Defined by Kernel code A call to tasks__create
Stored in Nowhere; the runtime registers it at start The tasks plugin
Runs on The scheduler The run worker (whose timing is the kernel jobs tasks.due and work.claim), through the work queue and the run door
One execution is A job run A run, with a runId, a result and a label

An MCP task, the protocol’s way of following a long tool call with tasks/get, is a third thing, unrelated to both.

What the scheduler promises a kernel job:

  • No overlap. A job (or one key of a keyed job) never runs twice at once. A request for a run while one is in progress causes at most one more run after it.
  • No catching up. However long a run took or the process slept, missed times cause one run, not one per time missed.
  • A backstop. A job may ask for its next run sooner, which is how it backs off; whatever it asks, it runs at least once per its declared interval.
  • Deadlines. The scheduler tells a run past its deadline to stop, and its slot stays taken until it does.
  • Failures are counted. The scheduler logs and counts a run that throws, and the job runs again at its backstop.
  • A clean stop. At shutdown the scheduler stops first: no new run starts, and runs in flight get a grace period while the services they use still run.
  • Metrics. nb_job_runs_total{job,outcome}, nb_job_duration_seconds{job}, nb_job_last_success_timestamp{job} and nb_job_next_run_timestamp{job}, labelled by job name only (see Observability).
  • Ownership. A job may declare it must run in only one process (workspace.purge, connections.revalidate, plugins.required do). With one process, that process owns every such job.
  • The kernel reaches a plugin only through its contract’s tools. It never reads a plugin’s files or database. Whatever crosses the boundary is what the contract’s schemas allow, so no path, handle or query can leak through it.
  • The kernel never names a plugin. It binds by contract id, and the prefix agents see is the kernel’s, per contract. The shipped plugins are defaults in configuration, with no special case in code.
  • The host context is the only source of who, where and when. No contract tool takes a workspace, owner, principal or clock as input. The kernel stamps the context on every call from facts it verified, and overwrites any a caller supplied, so no agent or app can claim to be the kernel or act in another scope. A server believes the context only from a transport the host holds: stdio, which only the process that started the server can write to.
  • Plugins answer; the kernel acts. The tasks plugin decides what is due and records how runs ended; it never starts a run, calls a model or sends a notice. The files plugin decides who may see a file; the kernel serves the bytes. The conversations plugin assigns each event its order; the kernel decides what a turn writes.
  • Swapping is by interface. An operator replaces a plugin with another implementation of its contract that passes the contract’s runner, and a provider with another implementation of its interface that passes its conformance suite. Nothing else in the runtime changes.

The runtime runs as one process. A second process on the same work directory fails at boot, because the work queue locks its directory to one process. The runtime does not support several replicas; Scaling to multiple replicas lists what would go wrong.

A shared implementation would plug in at these seams. Each states its one-process limit today:

Seam What it is today
Work queue An interface with claims, leases and fencing tokens. The shipped implementation is the filesystem one, which declares multiProcess: false.
Run consents An interface keyed by contract, workspace, owner and subject. The shipped filesystem implementation declares multiProcess: false and relies on the work queue’s lock. A run racing the save that created its task waits for that save’s record, which the one process tracks in memory.
Leases The scheduler’s exclusive flag and a task’s exclusiveKey name work that must happen once. The one process holds them in memory; there is no leases provider.
Signals Change hints and view refreshes reach the process that holds the connection, and so do the chat stream and /v1/events. There is no cross-process pub/sub provider.
Binding a plugin by URL plugins.<name>.servers.<key>.url names where a server runs, but the kernel refuses to bind a contract’s server at a URL until it holds a credential to present to it. The kernel starts every system plugin over stdio.

Other state is per process too: locks on workspace records, caches, OAuth flows in progress, and rate limiters.