Skip to content

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

docs: clarify contract vocabulary and pre-core module access

Steven Enamakel1123a3dd7551
diff --git a/AGENTS.md b/AGENTS.md
index ac4dc6ef5b..81339cfe60 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -596,7 +596,8 @@ Rules:
- Never redeclare a contract type in OpenHuman.
- Call members through contract constants, not string literals.
- Contract crates stay synchronous and free of I/O and runtime dependencies.
-- Shared wire behavior belongs in the contract. Runtime, config, and security
+- Shared wire vocabulary belongs in the contract. Component algorithms execute
+ in the compiled module. Runtime, config, and security
policy stay in the host.
- Test the handwritten registry metadata against each contract's bus name and
object path.
diff --git a/crates/openhuman-core/src/modules/README.md b/crates/openhuman-core/src/modules/README.md
index d752358560..a7be0d212f 100644
--- a/crates/openhuman-core/src/modules/README.md
+++ b/crates/openhuman-core/src/modules/README.md
@@ -254,6 +254,20 @@ no host file in this folder.
- `ops::set_bundled_releases_dir` (`ops.rs`) is called by the desktop host
before the core starts.
+## Calls before core startup
+
+Hosts obtain `ModuleClient` through `openhuman_rpc::embed::modules`. Construct
+it with explicit configuration, and set bundled-artifact discovery before the
+first call. Construction starts nothing; calls use the same process-wide lazy
+loader as the core and require neither a core runtime nor a signed-in session.
+The client preserves argument tuple arity and offers confidential calls that
+require recipient attestation. A failed load or call returns a sanitized
+`ModuleCallError` and never executes an implementation library as a fallback.
+
+Stateful adapters must call the module's close, cancellation and shutdown
+members to release its resources. Keeping a native library mapped does not
+remove that obligation.
+
## RPC surface
All methods are in the `modules` namespace ([`schemas.rs`](./schemas.rs)), wired into the
@@ -315,8 +329,10 @@ loadable:
Never redeclare a contract type here, and call members through the
contract's constants rather than string literals. Contract crates stay
- synchronous and free of I/O. Shared wire behavior belongs in the contract;
- runtime, configuration and security policy stay in this host.
+ synchronous and free of I/O. Serialized types, errors, identifiers, versions,
+ schemas and static tool declarations belong in the contract. Component
+ algorithms execute inside the compiled module; configuration, execution
+ policy and approvals stay in this host.
- Policy stays here even where the work moved into a module. For connectors
that means egress policy (`crate::security::egress`, applied before
`Execute`), route selection, and webhook delivery; scope enforcement belongs
@@ -337,9 +353,12 @@ loadable:
## Gotchas
-- `lib.rs` gates the whole folder on the `modules` feature, which is in both
- the contributor default set and the shipped product set. `documents`,
- `voice` and `web3` each imply `modules` and turn on their host file here.
+- The registry, configuration types and shared `ModuleClient` are available
+ without the `modules` feature. The loader and capability adapters are gated
+ on `modules`, which is in both the contributor default set and the shipped
+ product set. A client compiled without the loader returns an explicit
+ unavailable error on a call. `documents`, `voice` and `web3` each imply
+ `modules` and turn on their host file here.
Never enable `modules` directly on the unconditional `tinybus` dependency;
it is forwarded from this crate's own feature (`modules =
["tinybus/modules", ...]`), so a build without `modules` does not pull in
diff --git a/gitbooks/developing/loadable-modules.md b/gitbooks/developing/loadable-modules.md
index 0bbe97332c..e2a064b6e1 100644
--- a/gitbooks/developing/loadable-modules.md
+++ b/gitbooks/developing/loadable-modules.md
@@ -11,6 +11,25 @@ Feature gates decide what compiles into the binary. Modules decide what the runn
The trade is explicit. A module shares the core's address space and crash domain, so it is trusted code and the admission checks matter. In return, a user who never generates a document never pays for the document writer in download size, memory or dependencies.
+## Host access and contracts
+
+Hosts reach module clients through the `openhuman-rpc` facade chain. The shared
+`openhuman_rpc::embed::modules::ModuleClient` accepts explicit configuration
+and uses the process-wide lazy loader before or after core startup. Constructing
+a client starts nothing and requires no signed-in session. Set bundled-artifact
+discovery before its first call. Without the loader, a call returns an explicit
+unavailable error.
+
+A `*-bus` crate contains serialized vocabulary, errors, identifiers, versions,
+schemas and static tool declarations. Parsing, provider dispatch, cryptography,
+processes and device access execute inside the compiled module. Hosts retain
+configuration, credentials, approvals and execution policy. They never link an
+implementation fallback when a module is unavailable. Stateful adapters release
+module-owned resources through explicit close, cancellation and shutdown calls.
+
+The remaining migration work and temporary dependency exceptions are tracked
+in [the module-boundary inventory](../../docs/module-boundary-inventory.md).
+
## The registry
`crates/openhuman-core/src/modules/registry/` compiles in fourteen records. Only this registry may select an artifact. Nothing reads a module name from config and goes looking for it.