Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(runtime): document single-user and saas operating modes

Steven Enamakel756bdbd44461
diff --git a/crates/openhuman-core/src/core/runtime/README.md b/crates/openhuman-core/src/core/runtime/README.md
index 3421868a8b..afcfe8dd48 100644
--- a/crates/openhuman-core/src/core/runtime/README.md
+++ b/crates/openhuman-core/src/core/runtime/README.md
@@ -134,6 +134,42 @@ by `CoreRuntime::invoke`); `CoreContext::current` falls back to a
process-wide default context when no scope is active, which is what lets
existing single-tenant call sites keep working unmodified.
+## Operating mode: `SingleUser` and `Saas`
+
+`runtime/mode.rs` holds the process mode. `SingleUser` is today's
+behaviour and the default: the desktop app, the CLI and embedders. `Saas`
+serves many users from one process, one agent per user, behind a trusted
+gateway that authenticates them. The mode belongs to the process, not to any
+user's `Config`. The first SaaS boot locks it (`lock_mode`), and from then on
+`CoreContext::init_with_config` refuses every non-SaaS core. Code asks
+`is_saas()`, which reads an unset slot as `SingleUser`.
+
+`openhuman-core run --mode saas --saas-config <file>` (or
+`OPENHUMAN_MODE=saas`, which can raise the mode but never lower it) boots
+through `runtime/saas.rs`:
+
+- `SaasConfig` is the **operator's** file. It sets `root`,
+ `service_token_file` (defaults to `<root>/service.token`), `tool_allowlist`,
+ `rpc_allowlist_extra`, `max_agents_open`, `idle_evict_secs`,
+ `shared_backend_api_key` and `custom_definitions`. Unknown keys are refused.
+- `runtime/boot_guard.rs` refuses the boot, listing every problem at once,
+ when:
+ - the host kind is not `Saas`;
+ - services or domains go beyond `ServiceSet::saas()` / `DomainSet::saas()`;
+ - single-user or back-door environment variables are set
+ (`OPENHUMAN_WORKSPACE`, `OPENHUMAN_DEV_CONNECT`, backend tokens,
+ `OPENHUMAN_CORE_TOKEN`, approval gate or sandbox switched off);
+ - an allowlist is non-empty before its isolation has shipped;
+ - the root is relative, missing, world-writable or inside `~/.openhuman`;
+ - the service token is missing, readable by others, or shorter than 32 bytes.
+- The operator plane boots with its own config under `<root>/operator/`, so
+ it never resolves `~/.openhuman` or an `active_user.toml`. The gateway
+ bearer is the RPC token.
+
+The SaaS presets are closed. `DomainSet::saas()` enables no domain family, so
+a SaaS core answers only its built-ins (`core.*`, `/health`, `/schema`) until
+each family's per-user isolation lands.
+
## Shared tokio tuning constants
`runtime/mod.rs` declares two constants every multi-thread runtime that may