The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs: add README documentation for core modules
Steven Enamakel5fc6af1ffcea
diff --git a/crates/openhuman-core/src/agent/README.md b/crates/openhuman-core/src/agent/README.mdindex 3db556d220..4dc20afe68 100644--- a/crates/openhuman-core/src/agent/README.md+++ b/crates/openhuman-core/src/agent/README.md@@ -40,10 +40,11 @@ Multi-agent orchestration domain. Owns the LLM tool-calling loop, sub-agent disp| `session_import/` | One-time import of legacy OpenHuman session JSONL/Markdown into TinyAgents stores ([README](session_import/README.md)) || `subagent_host/` | OpenHuman planner, executor and persistence adapters for `tinyagents-orchestration::subagent`; policy, provider/model selection, tool narrowing, progress, artifacts and durable product projection live here || `tinyagents/` | Integration with the vendored `tinyagents` loop/replay crate: `TurnModelSource`, middleware, journal, `replay/schemas.rs` ([README](tinyagents/README.md)) |-| `tools/` | Agent-loop control tools (`ask_clarification`, `delegate`, `plan_exit`, `remember_preference`, `save_preference`, `run_workflow`, `todo`), re-exported through `crate::tools` |+| `todos/` | Session-scoped todo list adapters around the TinyAgents todo store; falls back to an in-memory scratch list outside a chat session ([README](todos/README.md)) |+| `tools/` | Agent-loop control tools (`ask_clarification`, `delegate`, `plan_exit`, `remember_preference`, `save_preference`, `run_workflow`, `todo`), re-exported through `crate::tools` ([README](tools/README.md)) || `triage/` | Classifies external `TriggerEnvelope`s and escalates to sub-agents ([README](triage/README.md)) |-Flat files: `bus.rs` (`agent.run_turn` native request handler), `cost.rs` (`pub(crate)`, per-turn token/cost accounting), `error.rs` (typed retryable/permanent loop errors), `hooks.rs` (post-turn self-learning hooks), `host_runtime.rs` (native shell execution backend), `message_convert.rs` (`pub(crate)`, transcript/provider conversion), `messages.rs` (transcript types), `multimodal.rs` (attachment handling), `platform_shell.rs` (cross-platform shell selection shared with `host_runtime` and `sandbox::ops`), `progress.rs` (`AgentProgress` channel), `progress_sink.rs` (task-local progress sink for in-process embedders), `stop_hooks.rs` (mid-turn policy halts), `tool_policy.rs` (pre-execution tool-call policy hook), `turn_origin.rs` (task-local trust/routing label read by the approval gate), `turn_workspace.rs` (task-local per-turn filesystem root).+Flat files: `bus.rs` (`agent.run_turn` native request handler), `context_breakdown.rs` (RPC `agent.context_breakdown`, a UI-facing system/tools/history breakdown of prompt size, cached per agent), `cost.rs` (`pub(crate)`, per-turn token/cost accounting), `error.rs` (typed retryable/permanent loop errors), `hooks.rs` (post-turn self-learning hooks), `host_runtime.rs` (native shell execution backend), `message_convert.rs` (`pub(crate)`, transcript/provider conversion), `messages.rs` (transcript types), `multimodal.rs` (attachment handling), `platform_shell.rs` (cross-platform shell selection shared with `host_runtime` and `sandbox::ops`), `progress.rs` (`AgentProgress` channel), `progress_sink.rs` (task-local progress sink for in-process embedders), `queued_turn.rs` (host-owned payload for a message queued while a turn is active; TinyAgents' `RunQueue` owns the queue mechanics), `stop_hooks.rs` (mid-turn policy halts), `tool_policy.rs` (pre-execution tool-call policy hook), `turn_origin.rs` (task-local trust/routing label read by the approval gate), `turn_workspace.rs` (task-local per-turn filesystem root).## RPC namespaces owned by this treediff --git a/crates/openhuman-core/src/config/README.md b/crates/openhuman-core/src/config/README.mdindex 2aae17f362..8e5eb0aa7b 100644--- a/crates/openhuman-core/src/config/README.md+++ b/crates/openhuman-core/src/config/README.md@@ -1,46 +1,46 @@# Config-Authoritative TOML-backed configuration layer. Owns the `Config` schema (every domain section: agent, channels, memory, autonomy, voice, scheduler, observability, etc.), env-variable overrides, the per-user openhuman directory layout, runtime proxy settings, the daemon descriptor, and the settings CLI. ~870 files under `crates/openhuman-core/src/` reference `crate::config` — almost every other domain reads `Config` here.+Authoritative TOML-backed configuration layer. Owns the `Config` schema (every domain section: agent, channels, memory, autonomy, voice, scheduler, observability, etc.), env-variable overrides, the per-user openhuman directory layout, runtime proxy settings, the daemon descriptor, and the settings CLI. About 870 files under `crates/openhuman-core/src/` reference `crate::config`; almost every other domain reads `Config` here.## Layout| Path | Purpose || --- | --- |-| `schema/` | The `Config` struct, every section type, loading/saving, env overrides, migrations trigger point — see [schema/README.md](schema/README.md) |-| `ops/` | RPC/CLI mutation surface (`config::rpc`) built on the schema — see [ops/README.md](ops/README.md) |-| `schemas/` | Controller schemas + thin RPC handlers for the `config` namespace (`controllers.rs` with submodules `controllers/{agent,inference,integrations,registry,voice,workspace}.rs`, `helpers.rs`, `schema_defs.rs` with submodules `schema_defs/{agent,inference,integrations,voice,workspace}.rs`); the method list is in the `//!` header of `schemas/mod.rs` |-| `migrations/` | Automatic, schema-version-gated startup data migrations — see [migrations/README.md](migrations/README.md) |-| `migration_helpers/` | User-triggered `migrate.{openclaw,hermes}` RPCs importing memory from other assistants — see [migration_helpers/README.md](migration_helpers/README.md) |-| `workspace/` | Workspace bootstrap + editable Persona Pack (`SOUL.md`/`IDENTITY.md`) file RPCs — see [workspace/README.md](workspace/README.md) |-| `daemon.rs` | `DaemonConfig` — Tauri-supervisor bundle of `data_dir`/`workspace_dir` plus `autonomy`/`security`/`reliability`/`secrets`/`audit` sections (`from_app_data_dir`) |+| `schema/` | The `Config` struct, every section type, loading/saving, env overrides, migrations trigger point. See [schema/README.md](schema/README.md) |+| `ops/` | RPC/CLI mutation surface (`config::rpc`) built on the schema. See [ops/README.md](ops/README.md) |+| `schemas/` | Controller schemas plus thin RPC handlers for the `config` namespace (`controllers.rs` with submodules `controllers/{agent,inference,integrations,registry,voice,workspace}.rs`, `helpers.rs`, `schema_defs.rs` with submodules `schema_defs/{agent,inference,integrations,voice,workspace}.rs`); the method list is in the `//!` header of `schemas/mod.rs` |+| `migrations/` | Automatic, schema-version-gated startup data migrations. See [migrations/README.md](migrations/README.md) |+| `migration_helpers/` | User-triggered `migrate.{openclaw,hermes}` RPCs that import memory from other assistants. See [migration_helpers/README.md](migration_helpers/README.md) |+| `workspace/` | Workspace bootstrap plus editable Persona Pack (`SOUL.md`/`IDENTITY.md`) file RPCs. See [workspace/README.md](workspace/README.md) |+| `daemon.rs` | `DaemonConfig`: Tauri-supervisor bundle of `data_dir`/`workspace_dir` plus `autonomy`/`security`/`reliability`/`secrets`/`audit` sections (`from_app_data_dir`) || `settings_cli.rs` | `openhuman settings ...` CLI section-slicing helper || `tools.rs` | Read-only LLM-callable wrappers over config (snapshot, autonomy, search, runtime flags, data paths) || `workspace_handle.rs` | Opaque, stable digest identity for a workspace directory, used on the wire (Event Log, notification broadcast) so paths never leak |## Public surface-- `pub struct Config` — `schema/types.rs` (re-exported from `mod.rs`) — top-level user settings.-- Per-domain config structs and enums — re-exported from `mod.rs`; see [schema/README.md](schema/README.md) for the full section → struct table.+- `pub struct Config` in `schema/types.rs` (re-exported from `mod.rs`): top-level user settings.+- Per-domain config structs and enums, re-exported from `mod.rs`. See [schema/README.md](schema/README.md) for the full section-to-struct table.- Model constants: `DEFAULT_MODEL`, `MODEL_AGENTIC_V1`, `MODEL_CODING_V1`, `MODEL_REASONING_V1`, and others in `schema/types/model_ids.rs`.-- `pub struct DaemonConfig` — `daemon.rs` — Tauri-supervisor config wrapper (see Layout).-- `pub fn apply_runtime_proxy_to_builder` / `pub fn build_runtime_proxy_client` / `pub fn build_runtime_proxy_client_with_timeouts` / `pub fn runtime_proxy_config` / `pub fn set_runtime_proxy_config` — `schema/proxy.rs`.-- Workspace identity helpers: `pub fn clear_active_user`, `default_root_openhuman_dir`, `pre_login_user_dir`, `read_active_user_id`, `user_openhuman_dir`, `write_active_user_id`, `PRE_LOGIN_USER_ID` — `schema/load/dirs.rs`.-- `pub mod ops` (re-exported as `rpc`) — `ops/` — RPC handlers and settings mutation; see [ops/README.md](ops/README.md).-- `pub mod settings_cli` — `settings_cli.rs` — `openhuman settings ...` CLI surface.-- RPC namespace `config` — 42 methods (`get_config`, `update_model_settings`, `update_autonomy_settings`, `set_privacy_mode`, `reset_local_data`, ...) — `schemas/`; the full list is the `//!` header of `schemas/mod.rs` and `all_controller_schemas()` in `schemas/controllers/registry.rs`.+- `pub struct DaemonConfig` in `daemon.rs`: Tauri-supervisor config wrapper (see Layout).+- `pub fn apply_runtime_proxy_to_builder` / `pub fn build_runtime_proxy_client` / `pub fn build_runtime_proxy_client_with_timeouts` / `pub fn runtime_proxy_config` / `pub fn set_runtime_proxy_config` in `schema/proxy.rs`.+- Workspace identity helpers in `schema/load/dirs.rs`: `pub fn clear_active_user`, `default_root_openhuman_dir`, `pre_login_user_dir`, `read_active_user_id`, `user_openhuman_dir`, `write_active_user_id`, `PRE_LOGIN_USER_ID`.+- `pub mod ops` (re-exported as `rpc`) in `ops/`: RPC handlers and settings mutation. See [ops/README.md](ops/README.md).+- `pub mod settings_cli` in `settings_cli.rs`: the `openhuman settings ...` CLI surface.+- RPC namespace `config`, 42 methods (`get_config`, `update_model_settings`, `update_autonomy_settings`, `set_privacy_mode`, `reset_local_data`, and others) defined in `schemas/`; the full list is the `//!` header of `schemas/mod.rs` and `all_controller_schemas()` in `schemas/controllers/registry.rs`.## Calls into-- Std + serde TOML for serialization.-- `crates/openhuman-core/src/security/keyring/` indirectly when secrets sections need at-rest crypto (`schema/load/secrets.rs`).+- Std plus serde TOML for serialization.+- `crates/openhuman-core/src/security/keyring/` indirectly, when secrets sections need at-rest crypto (`schema/load/secrets.rs`).- Filesystem under `~/.openhuman/<user-id>/` via `schema/load/dirs.rs`.## Called by-- ~870 files under `crates/openhuman-core/src/` pull `Config` for their slice.-- Hot consumers: `crates/openhuman-core/src/agent/` (model + autonomy), `crates/openhuman-core/src/channels/` (provider tokens), `crates/openhuman-core/src/memory/` (storage paths), `crates/openhuman-core/src/cron/` (scheduler poll), `crates/openhuman-core/src/inference/local/` (Ollama / device routing), `crates/openhuman-core/src/security/` (sandbox backend, autonomy policy), `crates/openhuman-core/src/voice/`, `crates/openhuman-core/src/desktop/notifications/`, `crates/openhuman-core/src/tools/`.-- `crates/openhuman-core/src/core/all.rs` — registers `all_config_registered_controllers()` under `DomainGroup::Config`.-- `crates/openhuman-core/src/tools/mod.rs` — `pub use crate::config::tools::*` re-exports the read-only config tools.+- About 870 files under `crates/openhuman-core/src/` pull `Config` for their slice.+- Hot consumers: `crates/openhuman-core/src/agent/` (model and autonomy), `crates/openhuman-core/src/channels/` (provider tokens), `crates/openhuman-core/src/memory/` (storage paths), `crates/openhuman-core/src/cron/` (scheduler poll), `crates/openhuman-core/src/inference/local/` (Ollama and device routing), `crates/openhuman-core/src/security/` (sandbox backend, autonomy policy), `crates/openhuman-core/src/voice/`, `crates/openhuman-core/src/desktop/notifications/`, `crates/openhuman-core/src/tools/`.+- `crates/openhuman-core/src/core/all.rs` registers `all_config_registered_controllers()` under `DomainGroup::Config`.+- `crates/openhuman-core/src/tools/mod.rs` re-exports the read-only config tools with `pub use crate::config::tools::*`.## Testsdiff --git a/crates/openhuman-core/src/core/README.md b/crates/openhuman-core/src/core/README.mdindex a21cccdecc..a40d3584f4 100644--- a/crates/openhuman-core/src/core/README.md+++ b/crates/openhuman-core/src/core/README.md@@ -27,33 +27,33 @@ logic. Every controller it exposes is implemented by a domain module under| File | Role || --- | --- |-| `mod.rs` | `ControllerSchema`/`FieldSchema`/`TypeSchema` — the controller contract; module declarations. |+| `mod.rs` | `ControllerSchema`/`FieldSchema`/`TypeSchema`: the controller contract; module declarations. || `all.rs` | The controller registry: `RegisteredController`, `RegisteredCliAdapter`, `DomainGroup`, `all_registered_controllers()`, `all_controller_schemas()`, `rpc_method_name()`, `validate_params()`, `all_http_method_schemas()`. |-| `dispatch.rs` | `dispatch()` — the 4-tier RPC router. |+| `dispatch.rs` | `dispatch()`: the 4-tier RPC router. || `bus.rs` | The `BUS: OnceBus<DomainEvent>` singleton, `EVENTS_ROOT`/`EVENTS_INTERFACE`/`EVENTS_VERSION`, `init`/`init_over_socket`. |-| `events.rs` | `DomainEvent` — the full event catalog, `domain()` routing. |+| `events.rs` | `DomainEvent`: the full event catalog, `domain()` routing. || `jsonrpc.rs` | Axum router (`/rpc`, `/health`, `/schema`, `/events`, …), `invoke_method`, `run_server*` shims, `bootstrap_core_runtime`. || `socketio.rs` | Socket.IO live-event bridge to the desktop shell. || `auth.rs` | Per-process RPC bearer token: init paths, `get_rpc_token`, `rpc_auth_middleware`. || `event_bind_tokens.rs` | Single-shot bind tokens for the `/events` SSE stream. || `cli.rs`, `agent_cli.rs`, `memory_cli.rs`, `subsystems_cli.rs`, `cli_capability.rs` | CLI argument parsing and dispatch, routed through the same registry as RPC. || `types.rs` | `AppState`, `HostKind`, `RpcRequest`/`RpcSuccess`/`RpcFailure`, `InvocationResult`, `approval_gate_boot_decision`. |-| `legacy_aliases.rs` | `resolve_legacy` — rewrites retired method names before dispatch; mirrors `app/src/services/rpcMethods.ts`'s `LEGACY_METHOD_ALIASES`. |+| `legacy_aliases.rs` | `resolve_legacy`: rewrites retired method names before dispatch; mirrors `app/src/services/rpcMethods.ts`'s `LEGACY_METHOD_ALIASES`. || `observability.rs` | `report_error` + Sentry `before_send` filters that drop deterministic provider/updater noise. |-| `log_redaction.rs` | `scrub_secrets` — regex secret scrubbing shared by the Sentry path and always-on log path. |+| `log_redaction.rs` | `scrub_secrets`: regex secret scrubbing shared by the Sentry path and always-on log path. || `rpc_log.rs` | `redact_params_for_log` (key-name redaction for the `[rpc:dispatch]` trace log in `dispatch.rs`) plus `format_request_id` / `summarize_rpc_result` / `redact_result_for_trace` helpers with no caller yet. |-| `logging.rs` | `init_for_cli_run` / `init_for_embedded` — logger setup for each host kind. |+| `logging.rs` | `init_for_cli_run` / `init_for_embedded`: logger setup for each host kind. || `shutdown.rs` | Graceful shutdown signal plumbing. || `sentry_transport.rs` | Sentry client setup, gated by the `crash-reporting` feature. |-| `http_server_status.rs` | `HTTP_SERVER_COMPILED_IN` — ungated compile-time marker so a listener-less core fails the build instead of shipping silently. |-| `bus_testing.rs` | `isolated_bus()` — a private bus for tests that must observe events without racing the process-global singleton. |-| `runtime/` | `CoreBuilder` → `CoreRuntime` composition API — see [runtime/README.md](runtime/README.md). |+| `http_server_status.rs` | `HTTP_SERVER_COMPILED_IN`: ungated compile-time marker so a listener-less core fails the build instead of shipping silently. |+| `bus_testing.rs` | `isolated_bus()`: a private bus for tests that must observe events without racing the process-global singleton. |+| `runtime/` | `CoreBuilder` → `CoreRuntime` composition API: see [runtime/README.md](runtime/README.md). || `subsystem/` | The subsystem driver registry (`SubsystemRegistry`, `DriverClass`, `DriverHealth`) and the `subsystems` RPC namespace. |## Controller registration and `DomainGroup`Every controller is registered exactly once, in `all.rs`, tagged with a-`DomainGroup` — the coarse family (`Agent`, `Memory`, `Security`, `Flows`,+`DomainGroup`: the coarse family (`Agent`, `Memory`, `Security`, `Flows`,`Inference`, `Platform`, …) it belongs to. `DomainGroup` variants track the`crates/openhuman-core/src/` family directories 1:1. The live surface(schema dump, dispatch, agent tools, stores, subscribers) is filtered by@@ -61,7 +61,7 @@ whether the active `runtime::context::CoreContext`'s `DomainSet` allows thatgroup; `DomainSet::full()` allows every group, so registration staysbyte-identical to a build with no runtime narrowing. Adding a new familydirectory means adding the matching `DomainGroup` variant, a `DomainSet`-field, an arm in `DomainSet::allows()`, and an entry in each preset — the+field, an arm in `DomainSet::allows()`, and an entry in each preset: thecompiler enforces all four.`rpc_method_name(schema)` turns a controller's dotted key (`memory.doc_put`)@@ -72,7 +72,7 @@ declared `TypeSchema` before a handler ever runs. `all_http_method_schemas()`adds the two Tier-1 internal methods (`core.ping`, `core.version`) to theregistered set for `/schema`.-Wire controllers only through this registry — do not add namespace branches+Wire controllers only through this registry: do not add namespace branchesto `cli.rs` or `jsonrpc.rs`. RPC namespace strings are wire contracts and donot follow directory renames.@@ -82,21 +82,21 @@ not follow directory renames.Socket.IO, the CLI, `CoreRuntime::invoke`) calls through. It resolves in fourtiers:-1. **Tier 0 — legacy alias rewrite.** `legacy_aliases::resolve_legacy`+1. **Tier 0: legacy alias rewrite.** `legacy_aliases::resolve_legacy`rewrites a retired method name to its canonical form before any lookup,symmetric with the frontend's `normalizeRpcMethod`.-2. **Tier 1 — internal core methods.** `core.ping`, `core.version`, and+2. **Tier 1: internal core methods.** `core.ping`, `core.version`, and`core.events_subscribe_token` (mints a bind token for `/events`) arehandled directly, with no controller registration.-3. **Tier 2 — registered controllers.** Looked up by RPC method name in the+3. **Tier 2: registered controllers.** Looked up by RPC method name in the`all.rs` registry, validated with `validate_params`, and invoked.-4. **Tier 3 — unknown method.** Always a method-not-found error; only the+4. **Tier 3: unknown method.** Always a method-not-found error; only theSentry severity differs by whether the method is a known non-actionableprobe (`is_known_probe_method`).## Event bus-`bus.rs` declares the process-wide `BUS: OnceBus<DomainEvent>` — the one+`bus.rs` declares the process-wide `BUS: OnceBus<DomainEvent>`: the onething a generic bus crate (`tinybus`) cannot own, since it is generic overthe event type. `events.rs` is the vocabulary half: `DomainEvent`, a`#[non_exhaustive]` enum whose `domain()` method is the routing key appended@@ -116,7 +116,7 @@ Two surfaces, pick by what the call needs to carry:Adding an event requires four steps: add the variant to `DomainEvent`,extend the `domain()` match, register its subscriber at startup, and bump`EVENTS_VERSION` in `bus.rs`. Native request/response types must be-`Send + 'static` and never need serialization — they are the sanctioned+`Send + 'static` and never need serialization: they are the sanctionedescape hatch for values (live channels, `Arc<dyn Tool>`) that cannot cross aserialized transport.@@ -142,7 +142,7 @@ shell's webviews. The socketioxide/axum transportbodies are gated on `http-server`, but the payload types(`WebChannelEvent`, `TurnUsagePayload`, `SubagentUsagePayload`,`SubagentProgressDetail`) stay compiled in every build because roughly ten-always-on domains construct them — a type carve-out, not a full gate. `pub+always-on domains construct them: a type carve-out, not a full gate. `pubmod socketio;` in `mod.rs` is deliberately ungated for the same reason.`COMPANION_STATE_BUS` is a broadcast channel for shell-originated companionlifecycle events that still need to reach the native macOS notch WKWebView,@@ -153,8 +153,8 @@ initiating client's room and the `thread:<id>` room, not broadcast),dictation hotkeys and transcription results (`voice::dictation_listener`),overlay attention bubbles (`desktop::overlay::subscribe_attention_events`,see `desktop/overlay/README.md`), core notifications-(`desktop::notifications`), companion state, and — read off `BUS` as-`DomainEvent`s — session expiry, MCP setup secret requests, memory sync and+(`desktop::notifications`), companion state, and: read off `BUS` as+`DomainEvent`s: session expiry, MCP setup secret requests, memory sync andtree-build progress, channel listener health, and active-workspace changes.Everything except web-chat is broadcast to every connected client, most underboth a colon- and an underscore-separated event name.@@ -190,7 +190,7 @@ answer "everything allowed".## `runtime/` and `subsystem/`-`runtime/` is the embeddable composition API — `CoreBuilder` builds a+`runtime/` is the embeddable composition API: `CoreBuilder` builds a`CoreRuntime` in two phases (initialization, then serve); see[runtime/README.md](runtime/README.md) for the full builder reference.`AGENT_WORKER_STACK_BYTES` (16 MiB) and `MAX_BLOCKING_THREADS` (64) live in@@ -227,7 +227,7 @@ layer pushes the compiler's `Send` auto-trait solver past the default depth.## Notes / gotchas- `bus::init()` binds the in-process broker's tokio tasks to whatever- runtime calls it first — a trap under `cargo test`, where every+ runtime calls it first: a trap under `cargo test`, where every`#[tokio::test]` builds its own runtime. Tests that need to observe eventsshould use `bus_testing::isolated_bus()` instead of the shared singleton.- `HostKind::TauriShell` always installs the approval gate at boot and@@ -236,7 +236,7 @@ layer pushes the compiler's `Send` auto-trait solver past the default depth.- `KNOWN_PROBE_METHODS` in `dispatch.rs` silences recurring but harmlessunknown-method noise (generic RPC probes, retired calls) from Sentry.`openhuman.harness_init_status` is on that list for client/core surface- skew only — it is a live, registered method, and a dedicated test pins+ skew only: it is a live, registered method, and a dedicated test pinsthat fact so a real regression cannot go silent behind the allow-list.- `http_server_status::HTTP_SERVER_COMPILED_IN` exists so a build without the`http-server` feature fails loudly at compile time if the desktop shelldiff --git a/crates/openhuman-core/src/core/runtime/README.md b/crates/openhuman-core/src/core/runtime/README.mdindex da6f90a883..7857c66f6e 100644--- a/crates/openhuman-core/src/core/runtime/README.md+++ b/crates/openhuman-core/src/core/runtime/README.md@@ -7,37 +7,37 @@ binary both build on to host the core without duplicating## Two-phase model-1. **`CoreBuilder::build()` — initialization only.** Registers controllers,+1. **`CoreBuilder::build()`: initialization only.** Registers controllers,loads the master key, seeds the RPC bearer, initializes theworkspace-bound stores, and runs the pure-registration part of`bootstrap_core_runtime`. No port is bound. After `build()` returns,`CoreRuntime::invoke` can dispatch any RPC method in-process and agent- turns can run — a harness-only embedder using `ServiceSet::none()` needs+ turns can run: a harness-only embedder using `ServiceSet::none()` needsnothing more.-2. **`CoreRuntime::serve()` — transport + background services.** Binds the+2. **`CoreRuntime::serve()`: transport + background services.** Binds theHTTP listener (when `ServiceSet::rpc_http` is set), mounts the router,fires the readiness signal, spawns the selected background services, andserves until shutdown. When `rpc_http` is unset it just spawns the- selected background services and returns immediately — the caller owns+ selected background services and returns immediately: the caller ownsthe process lifetime. In a build compiled without the `http-server`feature, requesting `rpc_http` returns an `Err` rather than silentlybinding nothing.`CoreRuntime::invoke(method, params)` dispatches an RPC method in-process-through `jsonrpc::invoke_method` — the same path the HTTP `/rpc` handler and+through `jsonrpc::invoke_method`: the same path the HTTP `/rpc` handler andthe CLI use, wrapped in `CoreContext::scope` so the ambient context resolvescorrectly. `openhuman_embed::Harness` goes through this call, never throughdomain operations directly.-## `ServiceSet` — which background services and transports run+## `ServiceSet`: which background services and transports runEach flag is independent. Presets:| Preset | Shape || --- | --- |-| `ServiceSet::desktop()` | Everything on — the Tauri shell and standalone `openhuman-core run`. |-| `ServiceSet::headless_api()` | HTTP JSON-RPC only (`rpc_http`) — no Socket.IO, cron, channels, or heartbeat; a single-core cloud/server deployment. |-| `ServiceSet::none()` | No transport, no background services — a library/harness embedder driving only `CoreRuntime::invoke`. |+| `ServiceSet::desktop()` | Everything on: the Tauri shell and standalone `openhuman-core run`. |+| `ServiceSet::headless_api()` | HTTP JSON-RPC only (`rpc_http`): no Socket.IO, cron, channels, or heartbeat; a single-core cloud/server deployment. |+| `ServiceSet::none()` | No transport, no background services: a library/harness embedder driving only `CoreRuntime::invoke`. || `ServiceSet::embedded()` | No transport (`rpc_http: false`), but the background work a long-lived embedded session expects: cron, heartbeat, memory queue, harness init, skill catalog refresh, memory sync. `socketio`/`channels` stay off because such a host reads state through the facade and owns its own networking. |Individual services still honor their own runtime gates inside@@ -49,7 +49,7 @@ Individual services still honor their own runtime gates insidesession exists on disk. `ServiceSet` picks *whether a service is spawned atall*; the gate picks *whether it runs for this user*.-## `DomainSet` — which domain families exist at runtime+## `DomainSet`: which domain families exist at runtimeSibling of `ServiceSet`: where `ServiceSet` selects background services andtransports, `DomainSet` selects which controller/tool/store/subscriber@@ -60,18 +60,18 @@ registry filters on.| Preset | Shape || --- | --- |-| `DomainSet::full()` | Every family on — today's default, byte-identical to registration with no runtime narrowing. |+| `DomainSet::full()` | Every family on: today's default, byte-identical to registration with no runtime narrowing. || `DomainSet::harness()` | `agent` + `memory` + `threads` + `config` + `security` only; every gate family and `platform` off. The embeddable agent core (`examples/embed_headless.rs`). |-| `DomainSet::embedded()` | The harness families plus `flows` (boot reconciliation keys off `ctx.domains().flows`), `skills`, `channels` (`channel.web_chat` is tagged `Channels` and is how an embedded host drives chat turns), `inference`, `integrations`, `automation`, `runtimes`, and `platform`. `mcp`/`web3`/`voice`/`media`/`desktop`/`hosted`/`modules` stay off — an embedded host supplies its own routing and presentation. |-| `DomainSet::kernel()` | The floor: `threads` + `config` + `security` only. Distinct from `none()` — this is "opt a subsystem back in from nothing," so `agent` and `memory` (the two largest, most replaceable subsystems) are deliberately off. See `examples/embed_kernel.rs`. |+| `DomainSet::embedded()` | The harness families plus `flows` (boot reconciliation keys off `ctx.domains().flows`), `skills`, `channels` (`channel.web_chat` is tagged `Channels` and is how an embedded host drives chat turns), `inference`, `integrations`, `automation`, `runtimes`, and `platform`. `mcp`/`web3`/`voice`/`media`/`desktop`/`hosted`/`modules` stay off: an embedded host supplies its own routing and presentation. |+| `DomainSet::kernel()` | The floor: `threads` + `config` + `security` only. Distinct from `none()`: this is "opt a subsystem back in from nothing," so `agent` and `memory` (the two largest, most replaceable subsystems) are deliberately off. See `examples/embed_kernel.rs`. || `DomainSet::none()` | Every family off. |-## `TokenSource` — how the RPC bearer is seeded+## `TokenSource`: how the RPC bearer is seeded-- `TokenSource::Fixed(Arc<String>)` — an in-memory bearer supplied by the+- `TokenSource::Fixed(Arc<String>)`: an in-memory bearer supplied by theembedder (the Tauri shell's `CoreProcessHandle.rpc_token`), seeded via`auth::init_rpc_token_with_value`; never crosses the process environment.-- `TokenSource::EnvOrFile` — the standalone fallback: read+- `TokenSource::EnvOrFile`: the standalone fallback: read`OPENHUMAN_CORE_TOKEN` from the environment if present, otherwise generatea fresh token and write `{root}/core.token` (0o600 on Unix).@@ -80,25 +80,25 @@ registry filters on.`CoreBuilder::new(host_kind)` defaults to `TokenSource::EnvOrFile`,`ServiceSet::desktop()`, `DomainSet::full()`, and `ToolGroups::default()`(every group withheld behind `use_skill`, the desktop app's shape). The-three capability axes only narrow — a group set to `Advertised` whose tools+three capability axes only narrow: a group set to `Advertised` whose toolsare compiled out, or whose `DomainGroup` is off, stays absent.- `.services(ServiceSet)`, `.domains(DomainSet)`, `.tool_groups(ToolGroups)`- — the three independent narrowing axes: which services run, which domain+ : the three independent narrowing axes: which services run, which domainfamilies exist, and how the tools of the families that do exist aredisclosed (advertised on the wire, withheld behind the pack proxy, or notregistered at all).- `.token(TokenSource)`, `.host(impl Into<String>)`, `.port(u16)`.-- `.config(Config)` — supply the config outright instead of letting+- `.config(Config)`: supply the config outright instead of letting`build()` discover one from `config.toml` + environment; used verbatim, noenv overlay applied automatically.-- `.workspace(dir)` — sugar over `.config()`: roots `workspace_dir` at `dir`+- `.workspace(dir)`: sugar over `.config()`: roots `workspace_dir` at `dir`and sets `config_path` to `dir/config.toml` so credentials and sessionsresolve beside the workspace rather than a previous config root.-- `.action_dir(dir)` — sugar over `.config()` for the agent's read/write+- `.action_dir(dir)`: sugar over `.config()` for the agent's read/writeroot.- `.backend_url(url)`.-- `.backend_transport(Arc<dyn BackendTransport>)` — bind the transport this+- `.backend_transport(Arc<dyn BackendTransport>)`: bind the transport thiscore's handlers reach the hosted backend through (`api::transport`). Thecontext carries it and every `derive_with` child inherits it. Optional:without it the core resolves the process-global transport@@ -111,22 +111,22 @@ are compiled out, or whose `DomainGroup` is off, stays absent.*order*: register controllers, load the master key, seed the RPC bearer,initialize the workspace-bound stores, and run the pure-registration part of`bootstrap_core_runtime`. `init_stores` gates each store on its owning-`DomainGroup` via `StoreInitPlan` — the memory driver binding (`Memory`), the+`DomainGroup` via `StoreInitPlan`: the memory driver binding (`Memory`), theimage-attachment sidecar dir (`Agent`), and the legacy-workflow prune-(`Skills`) — while the keyring-path log and the boot-time Sentry user bind run+(`Skills`): while the keyring-path log and the boot-time Sentry user bind rununguarded for every `DomainSet`. The WhatsApp store moved to the Taurishell and the people store is owned by the bound memory driver, so neitheris seeded here. It alsoholds the `DomainSet` for its scope and, when supplied, the embedder's-`Config` — RPC handlers otherwise re-resolve config independently per+`Config`: RPC handlers otherwise re-resolve config independently perdispatch, so an embedder-supplied config would be silently ignored withoutthis seam.The "wrong-workspace guard" (Sentry OPENHUMAN-CORE-48 / TAURI-RUST-8NM)lives in `CoreContext::init_with_config`: when no config was supplied and`Config::load_or_init()` fails, it logs an error and skips `init_stores`-entirely — memory stays explicitly uninitialised for the run and callers get-a "memory client not ready" error — rather than falling back to+entirely: memory stays explicitly uninitialised for the run and callers get+a "memory client not ready" error: rather than falling back to`Config::default()` and seeding stores against the wrong workspace.`CoreContext::scope(ctx, fut)` establishes the ambient context for the@@ -140,11 +140,11 @@ existing single-tenant call sites keep working unmodified.`runtime/mod.rs` declares two constants every multi-thread runtime that mayhost an agent turn must set:-- `AGENT_WORKER_STACK_BYTES` (16 MiB) — a single agent turn is a very large+- `AGENT_WORKER_STACK_BYTES` (16 MiB): a single agent turn is a very largeasync state machine (system prompt + hundreds of tool specs + the nestedprovider/tool loop), and delegating to a sub-agent nests another one. Thatoverflows tokio's default 2 MiB worker stack and aborts the process.-- `MAX_BLOCKING_THREADS` (64) — tokio defaults this to 512, which combined+- `MAX_BLOCKING_THREADS` (64): tokio defaults this to 512, which combinedwith the raised stack size could pin up to `512 × 16 MiB` of idle stack.`spawn_blocking` on these runtimes backs SQLite, filesystem grep/glob,document parsing, and URL guarding: bounded, bursty concurrency, so 64@@ -152,5 +152,5 @@ host an agent turn must set:## Related docs-- [../README.md](../README.md) — the rest of `core/`: dispatch, registry,+- [../README.md](../README.md): the rest of `core/`: dispatch, registry,event bus, transport, CLI.diff --git a/crates/openhuman-tinyhumans/src/transport/README.md b/crates/openhuman-tinyhumans/src/transport/README.mdnew file mode 100644index 0000000000..aec5e7895b--- /dev/null+++ b/crates/openhuman-tinyhumans/src/transport/README.md@@ -0,0 +1,49 @@+# transport++The SDK-backed `BackendTransport` implementation: every hosted-backend+request the core makes rides the vendored `tinyhumans-sdk`'s HTTP primitive,+which owns route policy (its unexposed-route registry) and the credential+header shapes the backend expects.++## Contents++- `mod.rs` — `SdkBackendTransport`. It holds one `reqwest::Client` per+ `TransportProfile` (`Api`, `Integrations`), each built from the core's+ `api::headers::build_backend_client` so TLS, timeouts and the attribution+ headers (`x-core-version`, `x-tauri-version`, `x-sdk-name`) match exactly+ what the core specifies. `send_json` and `send_multipart` build a+ `TinyHumansClient` per request, attach the resolved credential+ (`BackendCredential::Session` as a bearer token, `BackendCredential::ApiKey`+ as `x-api-key`), and forward to the SDK's `raw()` client. `name()` returns+ `"tinyhumans-sdk"`.+- `error.rs` — `map_sdk_error`, translating `tinyhumans_sdk::Error` into the+ core's `BackendTransportError` variants.++## Installing it++`SdkBackendTransport::shared()` returns an `Arc<dyn BackendTransport>` ready+for `openhuman_core::api::transport::install_backend_transport`.+`openhuman_tinyhumans::install()` does this for every host that boots a core+connected to TinyHumans (the Tauri shell, the TUI, the CLI); a core with no+transport installed still runs agents, memory, tools and RPC, and answers+any backend-touching call with `BackendApiError::BackendUnavailable` /+`BACKEND_UNAVAILABLE:` instead.++## Why this lives outside the core++The core does not depend on `tinyhumans-sdk`; the port it programs against+(`BackendTransport`, `BackendRequest`, `BackendTransportError`) lives in+`crates/openhuman-core/src/api/transport/`. This crate is the only one+allowed to depend on the SDK (`cargo tree -p openhuman -i tinyhumans-sdk`+must stay empty). A missing backend route belongs in the vendored SDK's+route registry, named from the core; this transport should never grow a+route implementation of its own.++## Where to look next++- `AGENTS.md`, "Backend API" — the full port/adapter boundary and the header+ rules every authenticated request must follow.+- [`../session/README.md`](../session/README.md) — where the credential this+ transport attaches comes from.+- [`../hosted/README.md`](../hosted/README.md) — the RPC proxy domains built+ on top of this transport.