Skip to content

The agent that grows with you

docs(plugins): plugin host isolation mode and its invariants

teknium117a7a9cb6b7d
diff --git a/plugins/AGENTS.md b/plugins/AGENTS.md
index 1f0d14f959b..ba82474634b 100644
--- a/plugins/AGENTS.md
+++ b/plugins/AGENTS.md
@@ -88,6 +88,30 @@ or the worker runs with no scope and fails closed (or writes into the launch pro
Platform plugins never mutate `os.environ`: YAML goes to `PlatformConfig.extra` through
`_shared.apply_yaml_bridge`, gates through `platform_gate_env` (`gateway/AGENTS.md`).
+## Plugin host boundary (`plugins.isolation: host`)
+
+`in_process` (default) imports user plugins into Hermes. `host` runs every non-bundled plugin in a
+per-profile host process (`hermes_cli/plugin_host.py` parent side, `plugin_host_child.py` child,
+`plugin_host_wire.py` framed JSON protocol). The child hands plugins a `RemotePluginContext`; Hermes
+registers proxies (tools, hooks, commands, provider objects as subclasses of the ABC it checks).
+Invariants:
+
+- **Every user-code import path routes to the host or refuses** — general plugins
+ (`plugins_loader`), memory / context engine / cron providers (`load_instance`), model-provider
+ profiles (`plugin_host_profiles.py`: credential-free extraction cached by file fingerprint, because
+ discovery runs while `hermes_cli.config`/`auth` import; overrides run by name in the host), dashboard
+ APIs (ASGI bridge). `plugins/plugin_loader.load_plugin_module` refuses any other synthetic-namespace
+ import. A new user-code loader MUST do the same.
+- **What cannot cross is one table:** `plugin_isolation.HOST_UNSUPPORTED_CTX_METHODS` (live gateway /
+ adapter objects). The runtime refusal and the static audit (`plugin_isolation_audit.py`, shown by
+ `hermes plugins validate/show`) both read it; `evals/plugin_isolation/audit_catalog.py` re-measures
+ the catalog.
+- **A host never spawns a host** (`HERMES_PLUGIN_HOST_PROCESS=1` makes `isolation_mode()` in-process
+ there) and must not start while a module import holds its lock (model-provider discovery is the
+ known case).
+- Plugins stay tenant-unaware: no new API, same `ctx`. Per-profile env comes from
+ `served_profile_child_env`, so a host sees only its own profile's secrets.
+
## Native plugin compatibility contract (summary — canonical text in the docs page)
Compatibility is a **behavior contract**, not a monolithic `PLUGIN_API_VERSION`, a manifest-wide
diff --git a/website/docs/user-guide/features/plugins.md b/website/docs/user-guide/features/plugins.md
index e8623a0c7c0..1d6c1ced46c 100644
--- a/website/docs/user-guide/features/plugins.md
+++ b/website/docs/user-guide/features/plugins.md
@@ -788,6 +788,41 @@ plugins:
scan_on_install: false
```
+### Running plugins out of process (`plugins.isolation`)
+
+By default third-party Python plugins are imported into the Hermes process, as they always have been.
+Setting `plugins.isolation: host` moves them into a **plugin host**: one separate Python process per
+profile, started on demand, that imports the profile's user-installed plugins and talks to Hermes over a
+private pipe.
+
+```yaml
+plugins:
+ isolation: host # default: in_process
+ host:
+ launcher: [] # optional argv prefix for the host, e.g. a sandbox runner
+```
+
+Plugins do not change. They receive the same `ctx` and register tools, hooks, slash commands, skills and
+provider objects (image/video generation, web search, browser, TTS/STT, memory, context engines,
+model-provider profiles) exactly as before; Hermes registers matching entries on its side that call into
+the host. Dashboard plugin APIs are served by the host too. Bundled plugins keep running in-process.
+
+What changes in `host` mode:
+
+- **No shared interpreter.** A plugin's module never enters the Hermes process, so it cannot read
+ another profile's data from memory or patch Hermes internals. Under the multiplex gateway every
+ profile gets its own host, started with only that profile's environment and secrets.
+- **Crashes stay contained.** A plugin that crashes or exits kills its host, not Hermes; the call in
+ flight returns a tool error and Hermes restarts the host and reloads its plugins (bounded retries).
+- **A few surfaces need in-process code** and fail that plugin with a clear reason instead of loading:
+ gateway platform adapters (`register_platform`), approval transports, Telegram/platform handlers,
+ model-provider profiles that build their own SDK client (`create_client`), streaming dashboard
+ endpoints, and plugins that monkeypatch Hermes modules. Run those with `isolation: in_process`.
+
+`hermes plugins validate <dir>` and `hermes plugins show <name>` report whether a plugin runs in the host
+and, if not, why. Across the plugin catalog at the time of writing, 299 of 348 entries run in the host
+unchanged.
+
### Interactive UI
Running `hermes plugins` with no arguments opens a composite interactive screen: