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: expand and restructure the developer gitbook
Steven Enamakelfcd87b770511
diff --git a/docs/gitbooks/en/SUMMARY.md b/docs/gitbooks/en/SUMMARY.mdindex 9a8645ad1b..137b68cd20 100644--- a/docs/gitbooks/en/SUMMARY.md+++ b/docs/gitbooks/en/SUMMARY.md@@ -78,6 +78,8 @@- [Storage](developing/architecture/storage.md)- [Flows on TinyAgents](developing/architecture/flows-on-tinyagents.md)- [Memory](developing/architecture/memory.md)+ - [Storage](developing/architecture/storage.md)+ - [Process state in shared cores](developing/architecture/process-state.md)- [MCP Registry](developing/architecture/mcp-registry.md)- [Security](developing/architecture/security.md)- [Frontend](developing/architecture/frontend.md)@@ -86,6 +88,7 @@- [Loadable modules](developing/loadable-modules.md)- [Performance and footprint](developing/performance.md)- [Pluggable engines](developing/engines.md)+- [Components](developing/components.md)- [Jev](developing/jev.md)- [Embedding](developing/embed/README.md)- [Installation](developing/embed/installation.md)diff --git a/docs/gitbooks/en/developing/README.md b/docs/gitbooks/en/developing/README.mdindex a3fd3e92c1..7be02b16d7 100644--- a/docs/gitbooks/en/developing/README.md+++ b/docs/gitbooks/en/developing/README.md@@ -48,6 +48,7 @@ If this is your first time in the repo:- [Pluggable engines](engines.md): how config chooses the LLM, embeddings, memory and web search layers, and what is available for each.- [Jev](jev.md): the fast probability model behind tool selection and routine browser decisions.- [Embedding OpenHuman](embedding.md) (see also [`crates/openhuman-embed`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-embed)): using `openhuman-embed` to run the core, and any number of agents on it, inside another Rust product. The [Rust quickstart](quickstart.md) walks through it.+- [SaaS profiles](saas-profiles.md): running the core as a multi-user service behind a gateway, one profile per user, on one node or a cluster with leased profiles.- [One TinyHumans API key](tinyhumans-api-key.md): what a single key unlocks, including managed inference, embeddings, web search, media, integrations, voice and Jev.---diff --git a/docs/gitbooks/en/developing/architecture.md b/docs/gitbooks/en/developing/architecture.mdindex caf65b4b42..74c665a1cd 100644--- a/docs/gitbooks/en/developing/architecture.md+++ b/docs/gitbooks/en/developing/architecture.md@@ -9,7 +9,7 @@ icon: code-branchOpenHuman is a personal AI assistant built on Rust. It has a persistent memory, stored in CortexDB (hosted by TinyHumans or your own), and an agent harness that can act across your connected services.-OpenHuman is a Rust core that runs agent turns, keeps a pluggable memory engine, and runs tools against memory, channels, integrations and (for users who opt in) a wallet. A single React and Rust (Tauri) codebase wraps it. The stack also includes a managed Node.js runtime for tool-capable skills, persistent Rust-native WebSocket infrastructure to the backend, a native Rust tool-dispatch path, and a Model Context Protocol (MCP) server for external clients.+OpenHuman is a Rust core that runs agent turns, keeps a pluggable memory engine, and runs tools against memory, channels, integrations and (for users who opt in) a wallet. A single React and Rust (Tauri) codebase wraps it. Node.js and Python commands use the host toolchain on `PATH`. The stack also includes persistent Rust-native WebSocket infrastructure to the backend, a native Rust tool-dispatch path, and a Model Context Protocol (MCP) server for external clients.OpenHuman ships for desktop only: Windows, macOS and Linux. Web is not a supported target. Android and iOS exist as experimental clients with their own build and publish workflows (`android-compile.yml`, `ios-appstore.yml`). They are not part of the shipped desktop host and are not product-ready.@@ -20,21 +20,62 @@ OpenHuman ships for desktop only: Windows, macOS and Linux. Web is not a support| Path | Contents || --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ || `app/` | pnpm workspace `openhuman-app`: Vite/React UI (`app/src/`), Vitest and WDIO tests. The Tauri shell itself is the Rust crate `crates/openhuman-app/` (below). |-| `crates/openhuman-app/` | Thin Tauri v2 desktop host (Cargo package `openhuman-app`). Built from its own manifest and lockfile, excluded from the root workspace; hosts the core as an in-process tokio task (`src/core_process.rs`). |+| `crates/openhuman-app/` | Thin Tauri v2 desktop host (Cargo package `openhuman-app`). Built from its own manifest and lockfile, excluded from the root workspace; depends on `openhuman-rpc` only and hosts the core as an in-process tokio task (`src/core_process.rs`, `openhuman_rpc::host::desktop`). || `crates/openhuman-core/` | Cargo package `openhuman`, library `openhuman_core`, with no `tinyhumans-sdk` dependency. The hosted backend is reached through the `backend::transport::BackendTransport` port, except hosted memory, which `vendor/tinymemory`'s own HTTP client calls (see `memory/engine.rs`). Flat domain modules directly under `src/` (`agent`, `backend`, `channels`, `config`, `cron`, `desktop`, `flows`, `hooks`, `hosting`, `inference`, `integrations`, `mcp`, `media`, `memory`, `modules`, `platform`, `runtime`, `sandbox`, `search`, `security`, `skills`, `threads`, `tools`, `util`, `voice`, `web3`, `web_chat`, …). `src/core/` holds the CLI (`cli.rs`), dispatch, controller registry (`all.rs`), event bus (`bus.rs`), `runtime/` (`CoreBuilder`/`CoreRuntime`) and `subsystem/`. |-| `crates/openhuman-rpc/` | Shared JSON-RPC contracts: `RpcOutcome`, `unwrap_rpc`, `apply_log_envelope`, `StructuredRpcError`. The `http-client` feature (default on; off for root-workspace consumers) adds `post_json_rpc`, `bearer_header`, `redact_url_for_log`, `HttpRpcResponse`. Used by the Tauri shell (`core_rpc.rs` → `relay_http_rpc`) and the TUI (envelope decoding). The core does not depend on this crate and does not re-export it: the controller contract (`Outcome`, `ControllerSchema`, `StructuredRpcError`, params rules, in-process dispatch) lives in `crates/openhuman-core/src/core/`, and this crate sits above it. Behind `server` it also owns the `http_host` static-directory file server and registers its controllers as a core extension. |-| `crates/openhuman-embed/` | Typed library facade (`openhuman_embed::{Harness, Core, CoreBuilder, DomainSet, ServiceSet, HostKind}`) for embedding the core in another product; forwards the core's feature gates. Installs no backend transport itself. |-| `crates/openhuman-tinyhumans/` | The TinyHumans layer above embed: `SdkBackendTransport` (the only crate that depends on the vendored `tinyhumans-sdk`), `install()` for hosts that boot the core themselves, a `RuntimeBuilder` that boots an embed runtime connected, the hosted RPC proxies (`hosted/`, all on the SDK's typed clients through one `hosted::client::HostedClient`: billing, team and usage, referral, announcements, webhook tunnels, managed Telegram/Discord linking, and backend-brokered OAuth), registered into the core's controller registry as an extension, some sharing the core's `auth` / `channels` / `webhooks` namespaces), and the host-side login/session owner (`session/`). A user without a TinyHumans account gets the core's `BACKEND_UNAVAILABLE:` sentinel from these without a request. |-| `crates/openhuman-cli/` | The `openhuman-core` binary (installs the tinyhumans transport, then `run_core_from_args`), the developer/benchmark bins, and every root `tests/*.rs` / `examples/*.rs` target. |-| `crates/openhuman-tui/` | Standalone ratatui terminal frontend. Boots the core in-process via `CoreBuilder` (`DomainSet::full()`, `ServiceSet::none()`), no HTTP. |+| `crates/openhuman-rpc/` | Top of the library chain (depends on `openhuman-tinyhumans`): JSON-RPC 2.0 envelopes, the server (router, Socket.IO, listener, `run_server*`), and the shared host boot `host::{cli, desktop, tui}` the three hosts call; re-exports `embed` and `tinyhumans` as their curated facade. The `http-client` feature (default on; off for root-workspace consumers) adds `post_json_rpc`, `bearer_header`, `redact_url_for_log`, `HttpRpcResponse`. Used by the Tauri shell (`core_rpc.rs` → `relay_http_rpc`) and the TUI (envelope decoding). The core does not depend on this crate and does not re-export it: the controller contract (`Outcome`, `ControllerSchema`, `StructuredRpcError`, params rules, in-process dispatch) lives in `crates/openhuman-core/src/core/`, and this crate sits above it. Behind `server` it also owns the `http_host` static-directory file server and registers its controllers as a core extension. |+| `crates/openhuman-embed/` | Typed library facade (`Runtime`/`RuntimeBuilder` → `Agent`, host presets, `embed::process`, and the `config` / `artifacts` / `chat_surface` / `modules` facades) for embedding the core in another product; forwards the core's feature gates. Installs no backend transport itself. |+| `crates/openhuman-tinyhumans/` | The TinyHumans layer above embed: `SdkBackendTransport` (the only crate that depends on the vendored `tinyhumans-sdk`), `install()` for hosts that boot the core themselves, a `RuntimeBuilder` that boots an embed runtime connected, the hosted RPC proxies (`hosted/`, all on the SDK's typed clients through one `hosted::client::HostedClient`: billing, team and usage, referral, announcements, webhook tunnels, managed Telegram/Discord linking, and backend-brokered OAuth; registered into the core's controller registry as an extension, some sharing the core's `auth` / `channels` / `webhooks` namespaces), and the host-side login/session owner (`session/`). A user without a TinyHumans account gets the core's `BACKEND_UNAVAILABLE:` sentinel from these without a request. |+| `crates/openhuman-cli/` | The `openhuman-core` binary (`openhuman_rpc::host::cli`), the ops bins, and every root `tests/*.rs` / `examples/*.rs` target (which reach the core through dev-dependencies). The benchmark bins live in [openhuman-benchmarks](https://github.com/tinyhumansai/openhuman-benchmarks). |+| `crates/openhuman-tui/` | Standalone ratatui terminal frontend. Boots the core in-process via `openhuman_rpc::host::tui` (every domain, no background services), no HTTP. || `Cargo.toml` (root) | Virtual workspace for `openhuman-core`, `openhuman-embed`, `openhuman-rpc`, `openhuman-tinyhumans`, `openhuman-cli`, and `openhuman-tui` (`cargo build -p openhuman-cli --bin openhuman-core` builds the standalone CLI/server); `vendor/`, `worktrees/`, `crates/openhuman-app`, `app/src-tauri-mobile`, and `packages/tauri-plugin-ptt` are excluded. Holds the `[patch]` tables for vendored crates. There is no sidecar: the desktop bundle links the core in-process. |-| `crates/openhuman-core/src/skills/` | Skill metadata and run orchestration (`ops_create`, `ops_discover`, `ops_install`, `ops_parse`, `catalog/`, `registry`, `runtime/`, `schemas/`, `types`, `bundled/`, `webhooks/`). Skills contribute metadata and tool descriptors that are injected into agent prompts. Tool execution flows through native Rust handlers and Node-backed helpers via `runtime::node` (Cargo feature `runtime-node`). |+| `crates/openhuman-core/src/skills/` | Skill metadata and run orchestration (`ops_create`, `ops_discover`, `ops_install`, `ops_parse`, `catalog/`, `registry`, `runtime/`, `schemas/`, `types`, `bundled/`, `webhooks/`). Skills contribute metadata and tool descriptors that are injected into agent prompts. Tool execution flows through native Rust handlers and the shell tool for host commands such as Node.js and Python. || `gitbooks/` | This book (public product and contributor documentation). || `docs/` | Internal maintainer documentation (test-coverage matrix, release smoke checklist, library benchmarking notes). |-| `vendor/` | Recursive git submodules for the `tiny*` crate family (`tinyagents`, `tinyflows`, `tinychannels`, `tinyjuice`, `tinymemory`, `tinymcp`, `tinybus`, `tinybox`, `tinycomputer`, `tinyruntime`, `tinydocs`, `tinysearch`, `tinyskills`, `tinyvoice`, `tinywallet`, `tinyhosts`, `tinyconnectors`, `tinyhumans-sdk`). |+| `vendor/` | Recursive git submodules for the `tiny*` crate family (`tinyagents`, `tinyflows`, `tinychannels`, `tinyjuice`, `tinymemory`, `tinymcp`, `tinybus`, `tinybox`, `tinycomputer`, `tinydocs`, `tinysearch`, `tinyskills`, `tinyvoice`, `tinywallet`, `tinyhosts`, `tinyconnectors`, `tinyhumans-sdk`). |The desktop app's webview loads the UI from `app/`. RPC, agents and skills run in the `openhuman_core` core, hosted in-process as a tokio task by the Tauri shell (`crates/openhuman-app/src/core_process.rs`, `openhuman_rpc::host::desktop`) and reachable over loopback HTTP. The renderer's `coreRpcClient` `fetch()`es `http://127.0.0.1:<port>/rpc` directly. The `relay_http_rpc` Tauri command (backed by `openhuman_rpc::post_json_rpc`) is only the fallback for non-loopback plain-`http://` runtimes that the webview would block as mixed content. The standalone `openhuman-core serve` binary is the CLI/debug path.+### Crate layering++The Rust crates form a strict chain. Each crate's normal dependencies name only+the layer directly below it, and the three hosts name `openhuman-rpc` alone:++```text+ openhuman-app openhuman-cli openhuman-tui+ (desktop shell) (openhuman-core) (terminal UI)+ \ | /+ +-------------------+-------------------++ |+ v+ openhuman-rpc host::{desktop, cli, tui},+ | JSON-RPC server + client,+ | session store+ v+ openhuman-tinyhumans SDK transport, hosted+ | proxies, session owner+ v+ openhuman-embed Runtime/RuntimeBuilder,+ | process helpers, facades+ v+ openhuman-core domains, registry, ports+```++- **Hosts boot through `openhuman_rpc::host`.** `host::desktop` is the shell's+ embedded server, `host::cli` the `openhuman-core` binary (and the shell's+ `core` / `mcp` subcommands), `host::tui` the terminal UI's runtime. Each one+ connects the TinyHumans layer and builds an embed `Runtime`; there is one per+ process.+- **Hosts reach the core only through the curated facade** rpc re-exports+ (`openhuman_rpc::embed`, `openhuman_rpc::tinyhumans`). The layers above embed+ use embed's doc-hidden `__host` list for the server and transport internals;+ hosts never do.+- **Enforced in CI.** `scripts/ci/check-crate-chain.mjs` (part of+ `pnpm rust:layout`) fails on any other normal-dependency edge and on a host+ `src/` naming `__host`, `core_host` or `openhuman_core::`.+ `scripts/ci/check-feature-forwarding.mjs` checks that every gate travels the+ same chain. Dev-dependencies are exempt, so the root tests still reach into+ the core.+---## Platform reach@@ -94,7 +135,7 @@ Tauri v2 compiles the Rust core into native binaries per platform, embedding theThe frontend talks to the Rust core in two ways. Tauri IPC carries shell commands (windows, hotkeys, and the `relay_http_rpc` HTTP relay used only for non-loopback plain-`http://` runtimes). HTTP JSON-RPC over loopback carries business logic and tools. The core also serves a Socket.IO bridge for live events such as chat streaming and notifications.-The core owns the outbound persistent connection to the TinyHumans backend, the memory engine binding (memory items are stored in CortexDB, not on the device) and tool execution. Agent turns run through the `tinyagents` harness. Tools dispatch as native Rust handlers, plus Node-backed helpers via `runtime::node`, gated by the `security/` sandbox policy. Skills do not execute in-process. The `crates/openhuman-core/src/skills/` domain contributes metadata and tool descriptors that get injected into agent prompts. External MCP clients (Claude Desktop, Cursor, Zed) reach the same tool surface over a separate stdio MCP server. See [MCP server](mcp-server.md).+The core owns the outbound persistent connection to the TinyHumans backend, the memory engine binding (memory items are stored in CortexDB, not on the device) and tool execution. Agent turns run through the `tinyagents` harness. Tools dispatch through native Rust handlers and the shell tool, which runs host commands such as Node.js and Python under the `security/` sandbox policy. Skills do not execute in-process. The `crates/openhuman-core/src/skills/` domain contributes metadata and tool descriptors that get injected into agent prompts. External MCP clients (Claude Desktop, Cursor, Zed) reach the same tool surface over a separate stdio MCP server. See [MCP server](mcp-server.md).---@@ -105,7 +146,7 @@ OpenHuman uses Tauri and Rust instead of Electron for performance and security.| Metric | OpenHuman (Tauri + Rust) | Typical Electron App || ------------------------- | -------------------------------------------------------------------------- | ---------------------------------------- || Binary size | Feature-dependent (native Wry webview; no bundled Chromium) | ~150 MB+ |-| Memory per tool execution | Native Rust (no per-tool VM); shared managed Node runtime for helper calls | ~150 MB+ (Chromium renderer per process) |+| Memory per tool execution | Native Rust (no per-tool VM); host Node.js and Python are available through shell | ~150 MB+ (Chromium renderer per process) || Cold startup | Sub-500ms | 2-5 seconds || Garbage collection pauses | None (Rust ownership model) | V8 GC pauses || Memory safety | Compile-time guaranteed | Runtime exceptions |@@ -167,7 +208,7 @@ Skill discovery uses `SKILL.md` plus optional bundled resources:| `allowed-tools` | Tool allowlist guidance || bundled resources | scripts, references, assets |-Script-backed skills run through shared runtime domains rather than embedded VMs. `runtime::node` (Cargo feature `runtime-node`) resolves a compatible system `node` or installs a managed distribution (SHA-256-verified) into the OpenHuman cache, and `runtime::python` does the same for Python. Execution is gated by the `security/` sandbox policy like any other tool.+Script-backed skills run through the shell tool and use the host `node` and `python3` executables on `PATH`. Execution is gated by the `security/` sandbox policy like any other tool.Recurring work belongs to the `cron` domain (with `scheduler_gate`), not to skills. There is no per-skill cron handler.@@ -175,9 +216,9 @@ Recurring work belongs to the `cron` domain (with `scheduler_gate`), not to skil## AI and tool protocol (MCP)-OpenHuman implements the Model Context Protocol on both sides of the connection. As a client, the core browses Smithery and the official MCP registry, connects servers a user declares in `mcp.json`, and surfaces their tools to agents through the same tool registry native tools use; see [MCP registry](architecture/mcp-registry.md). As a server, `openhuman-core mcp` exposes OpenHuman's own tools over stdio or HTTP so external MCP hosts such as Claude Desktop, Cursor, and Zed can call them; see [MCP server](mcp-server.md).+OpenHuman implements the Model Context Protocol on both sides of the connection. As a client, the core browses registries, connects servers declared in `mcp.json`, and offers their tools through the native tool registry; see [MCP registry](architecture/mcp-registry.md). As a server, `openhuman-core mcp` exposes OpenHuman's curated tools over stdio or Streamable HTTP; see [MCP server](mcp-server.md).-Every remote tool definition, whether coming in through a connected server or served out to a host, passes a prompt-injection scan before it reaches a model. Tool execution itself runs through the same Tool Registry as native tools: native Rust handlers or Node helpers via `runtime::node`, gated by `SecurityPolicy` and the active sandbox backend.+MCP protocol, transport, registry, and server-session behavior run inside the TinyMCP TinyBus module. OpenHuman links the `tinymcp-bus` contract and keeps product configuration, credentials, proxy policy, approvals, prompt-injection admission, and typed host callbacks. Its configured module client keeps object paths private and retains lifecycle receipts across cancellation or lost replies. For HTTP DELETE, the host drains and joins an in-flight callback only after the module accepts the close; a rejected DELETE leaves the session available. This keeps product policy in the host while protocol state and transport behavior remain module-owned.## Memory@@ -187,6 +228,10 @@ Conversation state is separate from memory: each thread's transcript is a JSONL---+## Storage++Durable state sits on the ports of `tinystoragedrivers` (documents, streams, blobs, search, secrets), vendored through `vendor/tinyagents/vendor/tinystoragedrivers`. One URL picks the backend for the process: `OPENHUMAN_STORAGE_URL`, else `[storage] url`, else nothing, which keeps the classic per-domain files on desktop. The drivers are Cargo features (`storage-sqlite`, `storage-file`, `storage-mongodb`; `memory` is always there), and a URL for a driver the build lacks fails at boot. Records live in a scope: the tenant's profile when work runs for one, else the acting agent's id, else `local` for the operator in single-user mode. In SaaS mode a call with no profile is refused. The host side is `crates/openhuman-core/src/storage/`. See [Storage](architecture/storage.md).+## Security architecture```text@@ -231,7 +276,7 @@ Model decides to call a tool (e.g., send a Telegram message)Tool Registry routes to the registered handler|v-Handler executes: native Rust, or a Node helper via `runtime::node`+Handler executes: native Rust, or a shell command using the host toolchain|vHandler runs through `SecurityPolicy` and the active sandbox backenddiff --git a/docs/gitbooks/en/developing/architecture/README.md b/docs/gitbooks/en/developing/architecture/README.mdindex 6eff1df319..d172c32a8e 100644--- a/docs/gitbooks/en/developing/architecture/README.md+++ b/docs/gitbooks/en/developing/architecture/README.md@@ -97,3 +97,22 @@ The code is at [github.com/tinyhumansai/openhuman](https://github.com/tinyhumans- [Frontend](frontend.md) and [Tauri shell](tauri-shell.md) for the two outer layers.- [Loadable modules](../loadable-modules.md) and [Pluggable engines](../engines.md) for what plugs into the core.- [`AGENTS.md`](https://github.com/tinyhumansai/openhuman/blob/main/AGENTS.md) for the repo-wide rules, including which `vendor/` submodule owns what.++## Loadable component dependency boundary++Hosts execute loadable component behavior through compiled TinyBus modules and+link only the components' minimal `*-bus` vocabulary. Contract crates contain+serialized types, errors, identifiers, versions, schemas and tool declarations;+providers, parsers, cryptography, storage, native resources and execution+algorithms belong inside modules. OpenHuman retains policy, credentials,+approvals, cancellation and product orchestration. Stateful resources cross+the bus as opaque handles with explicit cleanup operations.++This boundary is still being migrated. The+[module boundary inventory](../../../docs/module-boundary-inventory.md) names+existing exceptions and required upstream work. `pnpm rust:module-boundaries`+checks host normal/build dependency graphs and independently resolved contract+graphs. Its transitional pass does not certify completion;+`pnpm rust:module-boundaries:complete` requires an empty exception list and no+pending contracts. Host adapters switch after compatible module artifacts are+released and pinned, preserving lazy loading and cached resolution.diff --git a/docs/gitbooks/en/developing/architecture/agent-harness.md b/docs/gitbooks/en/developing/architecture/agent-harness.mdindex aca74654f5..2d096d0993 100644--- a/docs/gitbooks/en/developing/architecture/agent-harness.md+++ b/docs/gitbooks/en/developing/architecture/agent-harness.md@@ -254,6 +254,59 @@ Canonical `tinytools_agent::dialect::ToolDialect` implementations provide transcEvery text dialect shares one parser: a `<tool_call>` body is tried as P-Format, then as a code call, then as JSON, so a model that mixes forms is still understood. Persisted session histories can contain suffixes in any of these shapes, so the session shell keeps the dispatcher around to parse and replay them faithfully when a transcript is resumed.+### Tool rules: allow, deny, hide, approve++You can restrict which tools an agent sees and calls with pattern rules. The+rule language is `tinytools::ToolRules`, and the tinyagents loop enforces it+through `RunPolicy::tool_rules`. One rule set decides all three surfaces: the+tool schemas on the request, `tool_search` and the deferred catalogue, and+every call, nested calls included. A tool a rule removes therefore cannot be+found through search or called by a guessed name.++Rules come from three places and stack as layers. Every layer must admit a+tool:++1. **`[tool_rules]` in `config.toml`.** The operator's layer, applied to every+ agent, sub-agents included.+2. **Agent definitions.**+ - `disallowed_tools` and `tool_rules` in the definition TOML.+ - `tool_rules` on the agent registry entry, which `agent.registry`+ patches can set.+ - `AgentDefinitionSpec::tool_rules` for an embedder.+3. **Sub-agents.** A child inherits the operator's layers but not its parent+ agent's own restrictions, because an orchestrator usually disallows+ exactly the tools it delegates. It then adds its own definition's layer.++```toml+[[tool_rules.rules]]+id = "only-github-mcp"+effect = "deny" # allow | deny | hide | require_approval | auto_approve+match = { name = "mcp_*" } # name / family / tags globs, category, exposure,+except = { family = "github" } # permission bounds, side_effects, arg+reason = "Only the GitHub MCP server is approved."++[[tool_rules.rules]]+effect = "deny"+match = { name = "shell" }+when = { channel = "telegram" } # context: channel, agent+```++How rules behave:++- **Precedence.** `deny` wins inside a layer. `hide` keeps a tool callable but+ unlisted. `require_approval` defers a call exactly like a tool that declares+ `approval_required`; `auto_approve` waives that declaration.+- **Patterns.** Globs support `*` and `?` and ignore ASCII case, so `gmail_*`+ matches `GMAIL_SEND_EMAIL`. Name lists on a definition (`disallowed_tools`)+ use the same grammar through `tools::rules::glob_list_matches`. That+ function is now the only implementation of the matcher.+- **Refusals.** A refused call is answered with the rule's id, layer and+ reason.++Code: `crates/openhuman-core/src/tools/rules/`. Each session composes its layers+once (`session_rule_set`); each turn evaluates them in its own context+(`OpenHumanRunContext::tool_rules`).+### Context management mid-loopLong tool-calling chains can blow past the context window. Two layers handle that:@@ -265,7 +318,9 @@ Long tool-calling chains can blow past the context window. Two layers handle thaSome tool calls return enormous payloads: a Composio action dumping 200 KB of JSON, a web scrape returning 50 KB of markdown, a `file_read` over a multi-thousand-line log. Hard-truncating mid-payload drops whatever happens to land past the cut.-When a tool result exceeds the summarizer's threshold (`summarizer_payload_threshold_tokens`, default 4 000), TinyJuice's summary stage summarizes it before it enters the parent's history. The parent agent sees only the summary. There is one summarizer, and TinyJuice owns it: it decides when a summary is worth writing, writes the extraction prompt (identifiers and key facts first), caches identical summaries, trips a per-thread breaker after three failures, and offloads the original to CCR so the `juice_retrieve` footer can recover it exactly. The model call itself belongs to the host. `ToolOutputMiddleware` binds a unary child of the current turn through `PayloadSummarizer::prepare`, registers the capped model on a one-off harness (`tinyagents/payload_summarizer.rs`), and the module calls back through `MlHost.Generate`. Only the orchestrator carries a summary model, and it always sees `juice_retrieve`, even with the compaction router off, because a summary's footer names it. A result that qualified for a summary and did not get one is labelled as unsummarized, whether the module or the host failed, so the model does not re-run the tool for one. Summary reuse and the breaker are scoped to the thread, or to the run when there is no thread. Hard truncation remains the downstream backstop when summarization fails, or when the payload is so large that an LLM call on it makes no economic sense.+When a tool result exceeds the summarizer's threshold (`summarizer_payload_threshold_tokens`, default 4 000), the compiled TinyJuice module decides whether to summarize it before it enters the parent's history. The module owns the extraction prompt, summary cache and per-thread failure breaker, and stores the original in its CCR store so `juice_retrieve` can recover it. The host owns the model call because it knows the model and turn context. `ToolOutputMiddleware` binds a unary child of the current turn through `PayloadSummarizer::prepare`, registers the capped model on a one-off harness (`tinyagents/payload_summarizer.rs`), and the module calls back through the typed `tinyjuice-bus` `MlHost.Generate` contract. Only the orchestrator carries a summary model, and it always sees `juice_retrieve`, even with the compaction router off, because a summary's footer names it. A result that qualified for a summary and did not get one is labelled as unsummarized, whether the module or the host failed, so the model does not re-run the tool for one. Summary reuse and the breaker are scoped to the thread, or to the run when there is no thread. Hard truncation remains the downstream backstop when summarization fails, or when the payload is so large that an LLM call on it makes no economic sense.++Compression, CCR storage and recovery, content queries, HTML extraction, and the static tool declarations and wire DTOs belong to TinyJuice and `tinyjuice-bus`. OpenHuman's tools are adapters: they pass typed requests to the module and keep filesystem authorization on the host side. A handle query runs against the module's CCR store; an artifact query sends authorized content, never a path, to the same module operation. The host has no parallel CCR store or local algorithm fallback. If the module is unavailable, required queries and extraction report that operation as unavailable; optional tool-output compaction keeps its documented pass-through behavior. A resumed thread also keeps its recorded Juice declarations and schemas even when current settings no longer create new handles; current policy and module availability still govern execution.Caller focus. A tool can opt in to an optional `summary_focus` argument by adding `tokenjuice::focus::summary_focus_property()` to its schema; `web_fetch` and `web_search_tool` do. The model uses it to say what it needs from the result, for example "the rate limits". `before_tool` removes the argument from the call before validation, so the tool never sees it. Only a tool whose schema carries that exact property loses it; any other tool with a parameter of the same name keeps it. It reaches TinyJuice with the result, where it steers the summary, keys its cache, and ranks text for the deterministic compressors. A tool that caps its own output, such as `web_fetch`, is normally left to cap-and-spill. When the caller gives a focus, it is summarized as well, because paging the raw page cannot answer a question.@@ -308,7 +363,7 @@ Writes log `[artifact] wrote worker artifact under action_dir`; each path a hand### TokenJuice: content-aware tool-output compaction-Before a fresh tool result enters history (and ahead of the byte-budget backstop), it passes through the TokenJuice content router in the vendored TinyJuice crate (`vendor/tinyjuice`), with OpenHuman adapters in `crates/openhuman-core/src/inference/tokenjuice/`. Inspired by Headroom, the router _detects the content kind_ (JSON, code, log, search, diff, HTML, plain text) from the bytes and/or a hint derived from the tool name and arguments, then dispatches to a specialised compressor:+Before a fresh tool result enters history (and ahead of the byte-budget backstop), it passes through the TokenJuice content router inside the compiled TinyJuice module, with OpenHuman adapters in `crates/openhuman-core/src/inference/tokenjuice/`. Inspired by Headroom, the router _detects the content kind_ (JSON, code, log, search, diff, HTML, plain text) from the bytes and/or a hint derived from the tool name and arguments, then dispatches to a specialised compressor:- JSON → SmartCrusher: array-of-objects → table (each key once), preserving rows that carry errors or numeric outliers.- Code → tree-sitter (Rust/TS/JS/Python) signature keeper that collapses function bodies; brace-depth heuristic fallback.@@ -389,7 +444,7 @@ neutral TinyAgents lifecycle:`wait_subagent` and `steer_subagent` accept either the durable `subagent_session_id` or the transient `task_id`; durable ids are preferred across turns. `list_subagents` shows reusable children for the current parent thread, and `close_subagent` marks a worker non-reusable and cancels it if it is still running. Inline blocking is explicit via `blocking: true`.-The synthesized archetype delegations (`delegate_*`, `build_workflow`, and the other `delegate_name` tools) follow the same contract: they route through the durable async path by default, returning an `[async_subagent_ref]` (with `subagent_session_id` + `task_id`) immediately, and the finished result is inserted into the parent chat as a new system turn via `background_completions`/`background_delivery`. The delivery turn persists its own closing message, `sender: "agent"`, id `agent:<run_id>`, `extraMetadata.requestId = run_id`, before it emits `chat_done` as `client_id: "system"`; the frontend reuses that id, so its usual `chat_done` append collapses onto the same row (the conversation store is idempotent for these deterministic `agent:`-prefixed ids; every other id is UUID-fresh and keeps the constant-time append path) instead of persisting the delivered result a second time. Interactive turns follow the same contract: `web_chat::presentation::deliver_response` stores the reply under `agent:<request_id>` before publishing `chat_done`, so an answer the core produced exists on disk whether or not a client is there to receive the announcement, a dropped socket or a reloaded webview costs a repaint, not the reply. The exception is a segmented delivery, where the client owns one row per segment and the core stores none; the frontend keeps generated ids there for exactly that reason. They fall back to inline blocking automatically when there is no parent agent turn or no chat thread to deliver into (cron/CLI), or when `blocking: true` is passed. Cross-turn continuity comes from three pieces: the per-turn `[active_subagents]` roster merges the live in-memory registry with the durable `subagent_sessions` store (so a cold-booted orchestrator still sees earlier workers); `continue_subagent` falls back from pause checkpoints to the durable store, resuming an idle worker with its persisted history; and a `workflow_proposal` payload found in a finished child's history is persisted as a parent-thread message (`extraMetadata.scope = "workflow_proposal"`) that the frontend rehydrates into the proposal card on thread load.+The synthesized archetype delegations (`delegate_*`, `build_workflow`, and the other `delegate_name` tools) follow the same contract: they route through the durable async path by default, returning an `[async_subagent_ref]` (with `subagent_session_id` + `task_id`) immediately, and the finished result is inserted into the parent chat as a new system turn via `background_completions`/`background_delivery`. The queue behind that is the harness `tinyagents_tasks::CompletionRouter` over a per-workspace `JsonlCompletionStore` (`.openhuman/background_completions.jsonl`, keyed by chat thread): it dedupes by task id, holds the tombstones for results the parent collected inline or that a Stop/delete cancelled, counts delivery attempts and hands back the records that gave up. A record stays leased until the delivery turn lands (`mark_delivered`), so a result that finished but was never delivered is redelivered after a restart. The host keeps the `<background_agent_*>` wording (a `CompletionFormatter`), the 3s idle debounce, the system turn and its web_chat events, and the writer that persists a given-up result into the thread. The delivery turn persists its own closing message, `sender: "agent"`, id `agent:<run_id>`, `extraMetadata.requestId = run_id`, before it emits `chat_done` as `client_id: "system"`; the frontend reuses that id, so its usual `chat_done` append collapses onto the same row (the conversation store is idempotent for these deterministic `agent:`-prefixed ids; every other id is UUID-fresh and keeps the constant-time append path) instead of persisting the delivered result a second time. Interactive turns follow the same contract: `web_chat::presentation::deliver_response` stores the reply under `agent:<request_id>` before publishing `chat_done`, so an answer the core produced exists on disk whether or not a client is there to receive the announcement, a dropped socket or a reloaded webview costs a repaint, not the reply. The exception is a segmented delivery, where the client owns one row per segment and the core stores none; the frontend keeps generated ids there for exactly that reason. They fall back to inline blocking automatically when there is no parent agent turn or no chat thread to deliver into (cron/CLI), or when `blocking: true` is passed. Cross-turn continuity comes from three pieces: the per-turn `[active_subagents]` roster merges the live in-memory registry with the durable `subagent_sessions` store (so a cold-booted orchestrator still sees earlier workers); `continue_subagent` falls back from pause checkpoints to the durable store, resuming an idle worker with its persisted history; and a `workflow_proposal` payload found in a finished child's history is persisted as a parent-thread message (`extraMetadata.scope = "workflow_proposal"`) that the frontend rehydrates into the proposal card on thread load.### Spawn hierarchy and tiers@@ -517,6 +572,7 @@ New RPCs:- `agent.set_run_mode { thread_id, mode }` / `agent.get_run_mode { thread_id }`, read/flip a thread's Plan/Build `RunModeHandle`. `channel.web_chat` also accepts an optional `run_mode: "plan" | "build"` param (mirroring the socket `chat:start` payload) so a turn can start with the thread already in the requested mode instead of racing a separate RPC call; unrecognized values are logged and ignored.- `threads.token_usage { thread_id }`: returns persisted thread spend totals plus `last_turn_context_tokens`, the root agent's final-call input plus output used by the context-window gauge. Older turns without per-call usage fall back to their summed input plus output.- `threads.goal_get` / `threads.todos_get`: read a thread's current goal/todo state directly .+- `threads.token_usage { thread_id }`: returns persisted thread spend totals plus `last_turn_context_tokens`, the root agent's final-call input plus output used by the context-window gauge. Older turns without per-call usage fall back to their summed input plus output.- `threads.edit_message { thread_id, message_id, content, client_id? }` / `threads.regenerate { thread_id, message_id?, client_id? }`, both return `{ request_id }`. They cancel the thread's in-flight turn, fork the session transcript at a cut point via `TranscriptLocator::truncate_into_next_generation` (the sealed generation the fork was cut from is never touched, same "compaction never erases" guarantee), truncate the conversation-store message log and the turn-state snapshots for every dropped turn, then restart the turn with the edited content (`edit_message`) or the original prompt (`regenerate`). See `threads::ops::edit`'s module doc for the full UI-message-id -> transcript-cut-point mapping.- `channel.web_queue_remove { client_id, thread_id, item_id }`, remove one specific queued item from a thread's run queue.- `agent.context_breakdown { agent_id?, thread_id? }`, a UI-friendly view over the agent's rendered prompt size (system/tools/history split) for the composer's context-usage indicator.diff --git a/docs/gitbooks/en/developing/architecture/flows-on-tinyagents.md b/docs/gitbooks/en/developing/architecture/flows-on-tinyagents.mdindex e27a66ff3b..fe4da4e83f 100644--- a/docs/gitbooks/en/developing/architecture/flows-on-tinyagents.md+++ b/docs/gitbooks/en/developing/architecture/flows-on-tinyagents.md@@ -16,12 +16,12 @@ This page is the flows counterpart to [Agent harness](agent-harness.md). That pa## Two crates, one engine-| Crate | Role | Where |-| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |-| `tinyflows` | Host-agnostic workflow model + validate + compile + run. Never hard-codes a vendor; every outside-world effect goes through a capability trait. | [`vendor/tinyflows/`](https://github.com/tinyhumansai/tinyflows) |+| Crate | Role | Where |+| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `tinyflows` | Host-agnostic workflow model + validate + compile + run. Never hard-codes a vendor; every outside-world effect goes through a capability trait. | [`vendor/tinyflows/`](https://github.com/tinyhumansai/tinyflows) || `tinyagents` | The published state-graph + agent-loop harness both runtimes lower onto. | crate; OpenHuman seam in [`crates/openhuman-core/src/agent/tinyagents/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/agent/tinyagents) || `openhuman::flows` | The host: CRUD/run/resume RPCs, SQLite store, triggers, the builder/scout agents. | [`crates/openhuman-core/src/flows/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/flows) |-| `openhuman::flows::tinyflows` | The capability seam: adapters implementing the `tinyflows` traits over real OpenHuman services. | [`crates/openhuman-core/src/flows/tinyflows/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/flows/tinyflows) |+| `openhuman::flows::tinyflows` | The capability seam: adapters implementing the `tinyflows` traits over real OpenHuman services. | [`crates/openhuman-core/src/flows/tinyflows/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/flows/tinyflows) |`tinyflows` is published to crates.io and is deliberately persistence-free andvendor-free (see its [`CLAUDE.md`](https://github.com/tinyhumansai/tinyflows/blob/main/CLAUDE.md)); OpenHuman@@ -83,14 +83,20 @@ The entire run's working memory is a single `serde_json::Value` laid out as```json{"run": {- "trigger": {/* the trigger payload seeded at start */}+ "trigger": {+ /* the trigger payload seeded at start */+ }},"nodes": {"planner": {- "items": [/* … */]+ "items": [+ /* … */+ ]},"drafter": {- "items": [/* … */]+ "items": [+ /* … */+ ]}}}@@ -117,10 +123,10 @@ Node config is resolved through jq/jaq `=`-expressions([`vendor/tinyflows/crates/tinyflows/src/expr.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/expr.rs)) against aper-node scope with four bindings:-| Binding | What it holds |-| ------- | ------------------------------------------------------------------------------------------- |-| `item` | the first input item's `json` (the direct predecessor's output) |-| `items` | every input item's `json`, in edge order |+| Binding | What it holds |+| ------- | --------------------------------------------------------------------------------------- |+| `item` | the first input item's `json` (the direct predecessor's output) |+| `items` | every input item's `json`, in edge order || `run` | run metadata and the trigger payload (`run.trigger`) || `nodes` | every completed node's output, keyed by id: `{ "<id>": { "item": …, "items": [ … ] } }` |@@ -140,16 +146,16 @@ implements ([`vendor/tinyflows/crates/tinyflows/src/caps/mod.rs`](https://github`Capabilities` bundle per run by `build_capabilities`([`caps/`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs)):-| tinyflows trait | Node(s) it backs | OpenHuman adapter | Wraps |-| ------------------ | ------------------------------- | --------------------------- | ------------------------------------------------ |-| `LlmProvider` | `agent` (bare), `output_parser` | `OpenHumanLlm` | `inference/provider` (`create_chat_provider`) |-| `AgentRunner` | `agent` (with `agent_ref`) | `OpenHumanAgentRunner` | the agent registry + harness `Agent` |-| `ToolInvoker` | `tool_call` | `OpenHumanTools` | Composio + native `oh:` tools |-| `HttpClient` | `http_request` | `OpenHumanHttp` | `HttpRequestTool` (allowlist + DNS-rebind guard) |-| `CodeRunner` | `code` | `OpenHumanCode` | the sandbox (`execute_in_sandbox`) |-| `StateStore` | resumable/stateful runs | `FlowState` (`FlowStateDocuments`) | namespaced documents in the catalog |-| `WorkflowResolver` | `sub_workflow` by id | `OpenHumanWorkflowResolver` | the saved-flow store (`load_flow_graph`) |-| `MemoryProvider` | `memory` | `OpenHumanMemory` | the memory store (`tinyflows/memory_adapter.rs`) |+| tinyflows trait | Node(s) it backs | OpenHuman adapter | Wraps |+| ------------------ | ------------------------------- | ---------------------------------- | ------------------------------------------------ |+| `LlmProvider` | `agent` (bare), `output_parser` | `OpenHumanLlm` | `inference/provider` (`create_chat_provider`) |+| `AgentRunner` | `agent` (with `agent_ref`) | `OpenHumanAgentRunner` | the agent registry + harness `Agent` |+| `ToolInvoker` | `tool_call` | `OpenHumanTools` | Composio + native `oh:` tools |+| `HttpClient` | `http_request` | `OpenHumanHttp` | `HttpRequestTool` (allowlist + DNS-rebind guard) |+| `CodeRunner` | `code` | `OpenHumanCode` | the sandbox (`execute_in_sandbox`) |+| `StateStore` | resumable/stateful runs | `FlowState` (`FlowStateDocuments`) | namespaced documents in the catalog |+| `WorkflowResolver` | `sub_workflow` by id | `OpenHumanWorkflowResolver` | the saved-flow store (`load_flow_graph`) |+| `MemoryProvider` | `memory` | `OpenHumanMemory` | the memory store (`tinyflows/memory_adapter.rs`) |`AgentRunner` is optional in the crate (`Capabilities::agent` is`Option`): a host without an agent registry leaves it `None` and `agent` nodes@@ -288,11 +294,11 @@ The three agents that touch flows all run on the shared agent harness:`Agent::from_config_for_agent` → `run_single` under a scoped origin, the samepattern the flow's own `agent` nodes use:-| Agent | Registry id | Entry point | Tool belt |-| --------------------- | -------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| Builder (copilot) | `workflow_builder` | `flows_build` ([`ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/ops.rs)) | `propose_workflow` / `revise_workflow` (validate-only), `dry_run_workflow` (compile + run vs. mocks), `save_workflow`, `run_workflow`, authoring tools from `tinyflows_copilot::tools`, bound by ([`builder_host.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/builder_host.rs)); Composio catalog/connection reads ([`builder_tools.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/builder_tools.rs)) |-| Scout (discovery) | `flow_discovery` | `flows_discover` ([`ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/ops.rs)) | `suggest_workflows` (`tinyflows_copilot::tools`, bound by [`builder_host.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/builder_host.rs)) |-| Executor | (the engine) | `flows_run` / `flows_resume` | the capability seam above |+| Agent | Registry id | Entry point | Tool belt |+| ----------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| Builder (copilot) | `workflow_builder` | `flows_build` ([`ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/ops.rs)) | `propose_workflow` / `revise_workflow` (validate-only), `dry_run_workflow` (compile + run vs. mocks), `save_workflow`, `run_workflow`, authoring tools from `tinyflows_copilot::tools`, bound by ([`builder_host.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/builder_host.rs)); Composio catalog/connection reads ([`builder_tools.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/builder_tools.rs)) |+| Scout (discovery) | `flow_discovery` | `flows_discover` ([`ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/ops.rs)) | `suggest_workflows` (`tinyflows_copilot::tools`, bound by [`builder_host.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/builder_host.rs)) |+| Executor | (the engine) | `flows_run` / `flows_resume` | the capability seam above |Both agents live under[`crates/openhuman-core/src/flows/agents/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/flows/agents) as@@ -325,15 +331,15 @@ sequenceDiagram## Where to look in the code-| Path | What lives there |-| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |-| [`vendor/tinyflows/crates/tinyflows/src/`](https://github.com/tinyhumansai/tinyflows/tree/main/crates/tinyflows/src) | The engine: `model/`, `validate.rs`, `compiler.rs`, `engine.rs`, `expr.rs`, `caps/`, `nodes/`. |-| [`vendor/tinyflows/crates/tinyflows/src/caps/mod.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/caps/mod.rs) | The capability traits + `Capabilities` bundle. |+| Path | What lives there |+| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |+| [`vendor/tinyflows/crates/tinyflows/src/`](https://github.com/tinyhumansai/tinyflows/tree/main/crates/tinyflows/src) | The engine: `model/`, `validate.rs`, `compiler.rs`, `engine.rs`, `expr.rs`, `caps/`, `nodes/`. |+| [`vendor/tinyflows/crates/tinyflows/src/caps/mod.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/caps/mod.rs) | The capability traits + `Capabilities` bundle. || [`crates/openhuman-core/src/flows/tinyflows/caps/`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs) | The host adapters, `build_capabilities`, `open_flow_checkpointer`, the two-layer gate helpers. || [`crates/openhuman-core/src/flows/ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/ops.rs) | `flows_run` / `flows_resume` / `flows_build` / `flows_discover` and CRUD. |-| [`crates/openhuman-core/src/flows/bus.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/bus.rs) | `FlowTriggerSubscriber`: the host-side multi-trigger bridge. |+| [`crates/openhuman-core/src/flows/bus.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/bus.rs) | `FlowTriggerSubscriber`: the host-side multi-trigger bridge. || [`crates/openhuman-core/src/flows/builder_tools.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/builder_tools.rs) | The Composio-bound builder reads; the authoring tools are `tinyflows_copilot::tools`, bound by `flows/builder_host.rs`. |-| [`crates/openhuman-core/src/flows/agents/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/flows/agents) | `workflow_builder` + `flow_discovery` agent definitions. |+| [`crates/openhuman-core/src/flows/agents/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/flows/agents) | `workflow_builder` + `flow_discovery` agent definitions. || [`crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs) | Post-run export of the durable graph observations. |## See alsodiff --git a/docs/gitbooks/en/developing/architecture/frontend.md b/docs/gitbooks/en/developing/architecture/frontend.mdindex 0db4f639d1..5c54ba462c 100644--- a/docs/gitbooks/en/developing/architecture/frontend.md+++ b/docs/gitbooks/en/developing/architecture/frontend.md@@ -409,6 +409,37 @@ agents) and `toolPhrases.ts` (phrases, served asapp's logo. The server's `tool_display_label` is used only for tools theregistry cannot describe.+### assistant-ui composition++The conversation UI uses `@assistant-ui/react` for interaction and runtime+state, `@assistant-ui/react-lexical` for the rich composer, and+`@assistant-ui/react-markdown` for message rendering. The visual components+under `components/assistant-ui/` are assistant-ui registry source installed+through the app's shadcn configuration (`base-nova`), with OpenHuman tokens,+translations and product slots. Registry components are editable source; they+are not separately exported components from the npm runtime package.++| Surface | assistant-ui owner | OpenHuman adapter |+| ---------------------------------------------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |+| Message list, scrolling and scroll-anchor pill | `ThreadPrimitive.Viewport`, `Messages`, `ScrollToBottom` | Real thread identity through `adapters.threadList.threadId`; run-start jumps disabled to preserve readers in history |+| Main composer, send and cancel | `ComposerPrimitive`, `LexicalComposerInput` | Draft persistence, model selection, product voice mode and core-backed file ingestion |+| Message editing | Message-scoped `ComposerPrimitive.Root`, `Input`, `Send`, `Cancel` | Edit RPC and translated warning about subsequent turns |+| Message actions and branches | `ActionBarPrimitive`, `BranchPickerPrimitive` | Adapter capability gates and core-backed regeneration, speech and feedback |+| Queued follow-ups | `ComposerPrimitive.Queue`, `QueueItemPrimitive.Text`, `Remove` | Core run-queue adapter and translated registry row captions |+| Markdown, code and citations | `MarkdownTextPrimitive` and registry elements | Source projection, app links, math and artifact access |+| Reasoning and tool groups | `MessagePrimitive.GroupedParts`, registry tool-group/reasoning elements | Core timing and grouping interleaved reasoning with calls |+| Tasks and subagents | Registry task-card/subagent-list, `ReadonlyThreadProvider` | Delegation state, awaiting-user replies and worktree actions |+| Approvals, questions and plans | Registry approval-card, elicitation-form and agent-plan | Core decision RPCs, security policy and plan/workflow lifecycle |+| Todos and goals | Registry todo-list and agent-status | Durable harness progress and remembered disclosure state |+| Images, documents and tool results | Registry image, artifact-card, web-search, terminal-block, code-diff and web-preview | Core artifact and tool-result projection |+| Sources, conversation map and context | Registry sources, conversation-map and context elements | Core sources, search, token usage and context breakdown RPC |++Keep runtime behavior in the library. New product functionality should use a+runtime adapter or component slot rather than a second scroll controller,+message store, editor or queue implementation. Presentation-only registry+components can remain local; OpenHuman owns the meaning and execution of its+RPC-backed controls.+Rendering uses assistant-ui's elements, vendored under`app/src/components/assistant-ui/elements/` (tool-call, tool-timeline,web-search, terminal-block, code-diff, web-preview) with the `tw-shimmer`diff --git a/docs/gitbooks/en/developing/architecture/mcp-registry.md b/docs/gitbooks/en/developing/architecture/mcp-registry.mdindex 5a36f40137..1865271341 100644--- a/docs/gitbooks/en/developing/architecture/mcp-registry.md+++ b/docs/gitbooks/en/developing/architecture/mcp-registry.md@@ -1,111 +1,95 @@---description: >-- How OpenHuman browses MCP registries, connects the servers you declare in- mcp.json, and gives their tools to agents.+ How OpenHuman connects MCP servers, applies product policy, and exposes their+ tools to agents through TinyBus modules.icon: plug---# MCP registry-`crates/openhuman-core/src/mcp/registry/` is the host half of OpenHuman's Model Context Protocol (MCP) client support. It browses the supported upstream registries (Smithery and the official modelcontextprotocol registry) and reconciles the install store against your `mcp.json` document. For servers launched as local subprocesses or HTTP-remote endpoints, it also supervises the connection. The tools of installed servers reach agents through the unified tool registry (`crate::tools::registry`).+`crates/openhuman-core/src/mcp/registry/` is OpenHuman's host adapter for the+Model Context Protocol (MCP) client. It preserves the `mcp_clients` RPC and+agent-tool surfaces while the TinyMCP module owns registry and connection+behavior. The module is loaded through TinyBus; OpenHuman uses the published+`tinymcp-bus` vocabulary and does not link the TinyMCP implementation into its+normal dependency graph.-There is no install-from-catalog RPC and no setup agent. In the Registry tab, a hosted server that needs no setup (one http(s) endpoint, no required or secret inputs) is added in one click: the app declares it in mcp.json through `config_get` / `config_set`, then connects it or opens the sign-in dialog. For any other server you open its own page, read the install instructions there, and declare the server in the mcp.json tab: `{ "mcpServers": { name: { command, args, env } | { url, headers } } }`. The document's contract and its reconciliation live in `tinymcp::registry::config_doc`. `config_ops.rs` here is the RPC envelope over them (`mcp_clients_config_get` and `mcp_clients_config_set`).+The Registry tab browses the supported catalogs and adds servers through the+user's `mcp.json` document. There is no install-from-catalog RPC or agent+install tool. A simple hosted server can be declared in one click; other+servers are declared from their own setup instructions. The existing+`mcp_clients.*` RPC names and persisted `mcp_clients` name remain stable.-The client half lives in the vendored `tinymcp` crate (`vendor/tinymcp`): both transports, the Smithery and official catalogs, the SQLite store, the live connection map, the subprocess supervisor, browser sign-in and the write-audit log. This directory holds only what belongs to the application:--- `host.rs` (one level up, `crates/openhuman-core/src/mcp/host.rs`) holds the one `tinymcp` service this process runs per workspace, and converts config to `tinymcp` types.-- `registry/` holds the `mcp_clients` RPC surface, the agent-facing tools and the prompt-injection scan applied to remote tool definitions.-- `audit/` (next to `registry/`) is the RPC surface over `tinymcp`'s write-audit log.-- `server/` (next to `registry/`) is the `openhuman-core mcp` stdio and HTTP server that exposes this application's own tools to external MCP hosts. See [MCP server](../mcp-server.md). That is the server side, a separate thing from this client code.--The Rust module path is `crate::mcp::registry`, but the RPC namespace and the on-disk SQLite filename are `mcp_clients`. They stay that way so existing frontend code and stored user state keep working. Search for both names when you trace call sites.--All payload types (`InstalledServer`, `McpTool`, `ConnStatus` and the Smithery and official-registry DTOs) come from `tinymcp_bus` and are re-exported under `registry::types`, not redefined here. Types for the static, config-declared server set (`[[mcp_client.servers]]` in `config.toml`) and the shared HTTP/stdio transport primitives are re-exported from `crate::mcp::config_servers` and `crate::mcp::http_client` (thin `pub use tinymcp::...` modules in `mcp/mod.rs`, not directories).+## Ownership and request flow```text- ┌────────────────────────────────────────────────┐- Registries ───► tinymcp (catalogs, store, supervisor) │- └────────────────────┬───────────────────────────┘- │ browse / declare- ▼- ┌──────────────────────┐- Frontend (Skills UI) ─►│ ops.rs / schemas.rs │ RPC controllers (mcp_clients_*)- └──────────┬───────────┘- │ delegates to- ▼- ┌──────────────────────┐- │ host::for_config │ the tinymcp service this- │ / host::try_service │ workspace's host holds- └──────────┬───────────┘- │ tools_safe_for_agent (prompt-injection scan)- ▼- tool_registry (agents)-- supervisor_events.rs ── reconnect-supervisor ticks → DomainEvent+Frontend / agent tools+ │ mcp_clients RPCs and MCP tool calls+ ▼+OpenHuman host adapters+ product config, credentials, proxy policy, approvals,+ prompt-injection admission, RPC outcomes and domain events+ │ typed TinyBus calls+ ▼+TinyMCP module+ catalogs, mcp.json reconciliation, stores, connections,+ OAuth protocol, tool preparation, transports and supervisor```-## Server transport model--An `InstalledServer` (from `tinymcp_bus`, re-exported as `registry::types::InstalledServer`) carries a `Transport` discriminator with stdio and HTTP-remote variants: a local subprocess (`npx`, `uvx`, or a direct binary) speaking stdio JSON-RPC, or a hosted server (the majority of what Smithery lists) dialled over streamable HTTP. A declaration in `mcp.json` becomes such a row directly (`tinymcp::registry::config_doc`): `command`/`args` → stdio, `url` → HTTP-remote, `env`/`headers` → the credential table. `tinymcp` dials whatever the row says; this domain only decides what the row says.--## Boot-time spawn and the reconnect supervisor--Installed servers are connected as the core comes up, and `mcp::registry::supervisor` (see `crates/openhuman-core/src/mcp/registry/mod.rs`) runs `tinymcp::Supervisor::tick` on an interval against every open workspace host, turning each tick's report into `supervisor_events::publish` calls. Errors never block boot. A broken MCP install should not stop the desktop app from starting. Non-nominal ticks (stays-down, restored, parked) become `DomainEvent`s that reach the Event Log and the desktop notification bridge.--## Layout--| Path | Role |-| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `mod.rs` | Module docs, `types`/`connections` re-export shims over `tinymcp_bus`/`super::host`, the reconnect-supervisor loop, the OAuth-callback completion helper, and `tools_safe_for_agent` (the prompt-injection scan applied to every remote tool definition). |-| `host.rs` (parent `mcp/`) | One `tinymcp` service per workspace, opened on first use; proxy resolution for MCP traffic (`proxy_for_mcp`). |-| `helpers.rs` | Shared RPC-handler plumbing: `Outcome` encoding, identifier guards, workspace-service resolution, credential-name injection. |-| `ops.rs` | `mcp_clients_*` RPC handler implementations (uninstall, list, browse, connect/disconnect, tool call, `update_env`, registry settings). One-to-one with `schemas.rs` handlers; publishes `DomainEvent`s `tinymcp` does not. |-| `config_ops.rs` | `mcp_clients_config_get` / `config_set`: the `Outcome` envelope, domain events and background connects over `tinymcp`'s `McpRegistry::render_config_doc` / `apply_config_doc`. The `mcp.json` shape, its refusals and the reconciliation (add, rewrite in place under the same `server_id`, or uninstall, merging write-only credentials) live in `tinymcp::registry::config_doc`. |-| `action_tool.rs` | One deferred agent tool per action on a connected server, built from `tinymcp_bus::agent_tools::action_tool_specs` with `tools_safe_for_agent` as the admission filter. Execution goes through `InstalledServerInvoker::invoke`, which re-checks the live safe-tool list and then calls `service.dynamic().invoke(...)` on the `tinymcp` service, rather than back through `ops.rs`. |-| `schemas/` (`mod.rs`, `registry.rs`, `handlers.rs`, `params.rs`) | Controller schemas + handler dispatch. Re-exported from `mod.rs` as `all_mcp_registry_controller_schemas` / `all_mcp_registry_registered_controllers`. |-| `bus.rs` | `DomainEvent` subscriber (`McpClientEventSubscriber`) that logs `McpServer*` / `McpClientToolExecuted` lifecycle events. |-| `supervisor_events.rs` | Turns a `tinymcp::Supervisor` tick report into this domain's `DomainEvent`s, stamped with the workspace whose host was ticked. |-| `tools.rs` | Agent-facing `mcp_registry_*` tools (search catalog, inspect/list/connect/disconnect/call), thin shims over `ops.rs`. The one mutator (`mcp_registry_uninstall`) ships default-OFF behind the `mcp_manage` toggle; there is no install tool. Distinct from the generic `mcp_list_servers`/`mcp_call_tool` bridge tools. |-| `stub.rs` | The disabled facade compiled when the `mcp` feature is off. |--## Public surface--The exports from `mod.rs` are narrow on purpose:--```rust-pub use schemas::{- all_controller_schemas as all_mcp_registry_controller_schemas,- all_registered_controllers as all_mcp_registry_registered_controllers,- schemas as mcp_registry_schemas,-};--pub use types::{ConnStatus, InstalledServer, McpTool};-```--`types` and `connections` are thin `pub mod`s. They re-export the `tinymcp_bus` wire vocabulary and the `super::host`-backed lookups. This domain does not define its own copies. Everything else (`bus`, `ops`, `action_tool`, `supervisor_events`, `tools`) is `pub mod` for in-crate callers but not re-exported from `mod.rs`.--## Calls into--- `crate::mcp::host`: resolves the `tinymcp` service for a workspace (`host::for_config`, `host::try_service`, `host::all_hosts`).-- `tinymcp` / `tinymcp_bus`: the catalogs, store, connection map, supervisor, OAuth flow, and wire types.-- `crate::security::prompt_injection::scan_tool_definition`: the scan `tools_safe_for_agent` applies before a remote tool reaches the model.-- `crate::tools::registry`: installed servers' tools land here so agents see them alongside native tools.-- `crate::core::bus::BUS`: publishes `DomainEvent`s (`McpToolRejected`, lifecycle events, supervisor observations).--## Called by--- Core startup, via `mcp::host::init` and the reconnect-supervisor loop.-- The frontend Connections UI. The MCP Servers page (`McpServersTab`) has three tabs over the `openhuman.mcp_clients_*` RPC namespace: Servers (rows, status and the credential form: connect, disconnect, `update_env`, sign-in), mcp.json (`config_get` and `config_set`, the only way to add or remove a server) and Registry (`registry_search` and `registry_get`; a hosted server that needs no setup is declared into mcp.json in one click, any other row opens the server's own page in the browser). `registry_settings_get` / `registry_settings_set` hold the Smithery / official-registry credentials (secret values are write-only). Agents use connected servers directly. The orchestrator finds a connected server's tool through `tool_search`, or loads the `mcp` skill (`use_skill`, guide in `crates/openhuman-core/src/tools/toolpacks/guides/mcp.md`) for the `mcp_registry_*` status, list-tools and tool-call fallback. Agents do not install servers.--## Tests--Focused `*_tests.rs` siblings cover each file: `bus_tests.rs`, `ops_tests.rs`, `schemas_tests.rs`, `action_tool_tests.rs`, `supervisor_events_tests.rs`, `tools_tests.rs`.--## Related--- [`mcp/registry/mod.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/mcp/registry/mod.rs) and [`mcp/mod.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/mcp/mod.rs): the rustdoc this page mirrors.-- `crate::mcp::config_servers` / `crate::mcp::http_client` (`mcp/mod.rs`): re-export modules for the static config-declared server set and the shared transport primitives, both implemented in `tinymcp`.-- `crates/openhuman-core/src/mcp/audit/`: the RPC surface over `tinymcp`'s write-audit log.-- [MCP server](../mcp-server.md): the `openhuman-core mcp` stdio and HTTP server side.-- [Agent harness](agent-harness.md): how the agent ends up calling MCP tools through `tool_registry`.-- [Architecture](../architecture.md): where this fits in the wider system.+`mcp::host` converts OpenHuman configuration to `McpClientConfig` and applies+the product proxy and endpoint credential policy. `mcp::module_client` owns+the configured module object for each workspace, serializes access to its+private object path, and retains open/close transition receipts so a retry can+finish lifecycle work after cancellation or a lost reply. Configuration sent+to the module uses confidential TinyBus delivery.++The registry controllers keep the public `mcp_clients_*` RPC contract,+translate module results into OpenHuman outcomes, and publish OpenHuman domain+events. The host also owns product permission and exposure mapping and the+prompt-injection scan applied before remote tools are offered to an agent. The+module prepares stable tool names, schemas, and metadata; execution and+protocol handling stay inside the module.++## Server transports++An installed server's typed `Transport` is either a local subprocess speaking+stdio JSON-RPC or an HTTP-remote endpoint. TinyMCP owns transport startup,+protocol, connection state, and cleanup. OpenHuman decides which server+configuration and credentials are approved and passes them over the bus.++The same ownership split applies when OpenHuman acts as an MCP server. The+TinyMCP module owns protocol sessions, stdio framing, Streamable HTTP+admission, and response metadata. OpenHuman keeps the curated tool catalog,+security policy, RPC dispatch, and typed host callbacks. For HTTP DELETE, the+host retires its local session and aborts and joins any running callback only+after the module accepts the request; a rejected DELETE leaves the session+usable. Session close and process shutdown drain callback work before+releasing its local handle.++## Host layout++| Path | Responsibility |+| --- | --- |+| `crates/openhuman-core/src/mcp/host.rs` | Product configuration conversion, proxy selection, and OAuth redirect URL. |+| `crates/openhuman-core/src/mcp/module_client.rs` | Workspace-scoped configured object lifecycle and typed/confidential bus calls. |+| `registry/ops.rs`, `config_ops.rs`, `schemas/` | Stable RPC handlers, `mcp.json` adapter, and controller schemas. |+| `registry/action_tool.rs`, `registry/tools.rs` | Deferred host tool adapters, product admission, and execution event mapping. |+| `registry/supervisor_events.rs`, `registry/bus.rs` | Convert module reports and lifecycle events to OpenHuman domain events. |+| `audit/` | OpenHuman RPC surface over module-owned MCP write-audit records. |+| `server/` | OpenHuman's tool catalog, security policy, and typed callbacks for the local MCP server. |++## Security and compatibility++- Keep credentials in OpenHuman's configuration and credential stores. Use+ confidential bus methods whenever calls carry credentials or other sensitive+ tool data; ordinary module calls must not carry secrets.+- Preserve the existing `mcp_clients.*` RPC names and user-visible server+ names. Bus DTOs and member names come from `tinymcp-bus`; do not define local+ wire copies.+- Keep product policy in OpenHuman and generic MCP protocol, transport,+ catalog, persistence, and tool-preparation behavior in `vendor/tinymcp`.+- Do not put user data, credentials, provider responses, or raw tool arguments+ in analytics or logs. Use the shared endpoint redactor for endpoint logging.++For implementation details, see the [MCP server](../mcp-server.md) and+[`crates/openhuman-core/src/mcp/README.md`](../../../crates/openhuman-core/src/mcp/README.md).diff --git a/docs/gitbooks/en/developing/architecture/memory.md b/docs/gitbooks/en/developing/architecture/memory.mdindex b6e9085df4..3bb1d0caba 100644--- a/docs/gitbooks/en/developing/architecture/memory.md+++ b/docs/gitbooks/en/developing/architecture/memory.md@@ -7,7 +7,7 @@ icon: diagram-project# Memory-`crates/openhuman-core/src/memory/` is the host layer over TinyMemory. It runs the agent memory lifecycle around every turn. A memory pack is recalled before the model runs, the turn is logged on both sides, memory is recalled into compaction checkpoints, and belief builds run in the background.+`crates/openhuman-core/src/memory/` is the host layer over TinyMemory. It runs the agent memory lifecycle around every turn. The prelude takes completed cached context immediately and queues user logging and refresh; committed replies are logged in the background. Compaction uses completed context and queues its own refresh without delaying the authoritative summarizer. Belief builds also run in the background.The behavior is specified in [`docs/specs/memory-v2.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/specs/memory-v2.md). The user-facing feature is [Memory](../../features/memory.md).@@ -26,7 +26,8 @@ The behavior is specified in [`docs/specs/memory-v2.md`](https://github.com/tiny| `engine` | Binds `[memory] engine`: `tinyhumans` over the host's backend credential (resolved per request) with the transport's attribution headers, or `cortexdb` with the key stored as `memory-cortexdb`. Off when neither is usable. || `guard` | `ScrubbingEngine`: every write is scrubbed under the host policy, whichever path makes it. || `scope` | `MemoryIdentity` scoped around every turn, resolved to a layout root and a memory agent id (host binding, definition pin, team, default). |-| `lifecycle::hooks` | `pre_turn`, `post_turn`, `compaction`: bounded, never fail a turn. |+| `lifecycle::prefetch` | Scoped, bounded in-memory cache and background workers for automatic turn and compaction recall. |+| `lifecycle::hooks` | Lifecycle primitives; explicit/manual `pre_turn` and `compaction` retain configured deadlines. || `lifecycle::jobs` | The persisted background queue and the `memory_background` cron job. || `lifecycle::views` | Policy, pack preview, agents list, job views for the RPCs. || `brain` | Brain source mapping for synced items and the `memory_brain_*` ops. |@@ -34,7 +35,7 @@ The behavior is specified in [`docs/specs/memory-v2.md`](https://github.com/tiny| `channels` | Which channel each logged thread arrived on, for forgetting a channel. || `backfill` | Consent-gated storing of past chats in the lifecycle's shape. || `import` | Consent-gated, resumable v1 import. |-| `tools` | The single `memory` agent tool (`recall`, `fetch`, `learn`, `forget`), confined to the identity's layout. |+| `tools`, `tool_budget`, `tool_writes` | The scoped agent tool: bounded explicit reads and durable local admission of `learn`/`forget`, followed by background delivery. || `ops`, `explore` | Engine selection, recall, fetch, learn, forget, listing, the explorer. || `bus` | The cron subscriber (`memory_sources_sync`, `memory_background`). || `schemas` | The `openhuman.memory_*` controllers. |@@ -44,10 +45,16 @@ The behavior is specified in [`docs/specs/memory-v2.md`](https://github.com/tiny| Hook | File || --- | --- |-| Pre-turn (log + recall), first turn after a compaction also `start_session` | `agent/session_host/runtime_session/memory_ingest.rs`, from `before_turn` in `runtime_session.rs` |+| Pre-turn (take cached pack, queue logging and refresh) | `agent/session_host/runtime_session/memory_ingest.rs`, from `before_turn` in `runtime_session.rs` || Pack injection, ephemeral, every model request of the turn | `agent/tinyagents/middleware/memory_pack.rs` || Post-turn (log the reply, queue builds), after the durable commit | `memory_ingest.rs`, from `finalize_after_durable_commit` |-| Compaction recall into the checkpoint | `agent/tinyagents/memory_summarizer.rs`, wrapped around the summarizer in `harness_context_ladder.rs` |+| Compaction enrichment from completed cache, with background refresh | `agent/tinyagents/memory_summarizer.rs`, wrapped around the summarizer in `harness_context_ladder.rs` |++Automatic packs are keyed by CoreContext, workspace, config fingerprint, resolved memory identity and thread. They expire after 60 seconds. The cache holds at most 64 entries per context and 64 KiB per pack; eight workers globally process bounded queues of at most 16 pending operations per entry, with a 120-second deadline per operation. Saturation skips best-effort automatic work rather than waiting. Packs identify themselves as results of an earlier lookup, not authoritative answers to the current question.++Successful content changes clear cached packs and advance a revision, preserving queued conversation logs while rejecting older in-flight results. Engine or credential invalidation clears the caches and pending refreshes. Scoped background tasks retain both CoreContext and memory identity.++The agent tool allows 15 seconds per call, 30 seconds of aggregate reserved time and eight attempts per retained run record. The tracker keeps 128 records; idle eviction under churn can reset the budget for that run, while outstanding reservations cannot be evicted. `learn`/`forget` acknowledge durable local admission, not remote completion. Their scrubbed outbox entries contain trusted scope rather than credentials, and retry under the matching owner on background/auth ticks. Direct RPC, UI and import/deletion workflows keep their explicit behavior.The turn's `MemoryTurn` (config, identity, thread, pack) rides`OpenHumanRunContext::memory_turn`; a child run has its own.diff --git a/docs/gitbooks/en/developing/architecture/process-state.md b/docs/gitbooks/en/developing/architecture/process-state.mdnew file mode 100644index 0000000000..1a268a2908--- /dev/null+++ b/docs/gitbooks/en/developing/architecture/process-state.md@@ -0,0 +1,71 @@+---+description: Process state, tenant ownership and routing requirements for shared cores.+icon: layers+---++# Process state in shared cores++This inventory tracks the named singleton candidates in [#7433](https://github.com/tinyhumansai/openhuman/issues/7433), under the [cloud-storage epic](https://github.com/tinyhumansai/openhuman/issues/7419). It records source review at `3dbdd07e5f07d917dabbbc93fb0a9dd2a24a4347`, with the MCP cleanup reservation added at `d1efa8bd58417a0715d3c93655985ccfa9c9759c`. PR evidence below was checked on October 12, 2026. It does not cover every static in the core or certify a cloud deployment.++## Classification++The categories describe the required ownership boundary. A row can require more than one:++- **A — process:** bootstrap settings, local execution handles or process capabilities.+- **B — scoped:** state must retain its tenant, agent, session or connection owner.+- **C — durable:** records need a backend document, stream, blob or claim.+- **D — routing:** requests must reach the process that owns a live handle, or use an explicit executor-routing protocol.++“Pending” means the boundary still needs a regression or implementation. A process-local table cannot provide a distributed claim just because a related record is durable.++### Configuration and identity++Paths in the table are relative to `crates/openhuman-core/src/`.++| State | Class | Current boundary and remaining work |+| ----------------------------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `security/credentials/identity.rs` `CURRENT_USER` | B | One process slot supplies prompt and tracing identity. Pending: trace authenticated profile admission and test interleaved identities before treating it as profile-owned state. |+| `config/schema/load/active_workspace.rs` `ACTIVE_WORKSPACE` | A | Process bootstrap cache. Pending: verify profile operations cannot select another workspace through this fallback. |+| `core/runtime/context.rs` `DEFAULT_CONTEXT` | A | Bootstrap context. SaaS tenant resolution uses the actual scoped context and refuses missing task context; the default is not a tenant authority. |+| `agent/multimodal.rs` `ATTACHMENTS_DIR` | B, C | First-initialized local attachment directory. Attachment bytes and indexes need scoped blob ownership and an import path; see #7425. |+| `threads/store/bus.rs` `CONVERSATION_PERSISTENCE_WORKSPACE` | A | Desktop subscriber installation explicitly refuses SaaS. This supplies no shared-core persistence or routing. |+| `mcp/host.rs` `DEFAULT_CONFIG` | A, B | Replaces the issue's former `DEFAULT_WORKSPACE` name. Scoped clients capture configuration; missing SaaS context currently falls through to the process default. Pending refusal regression and fix. |+| `core/logging.rs` `LOG_DIR` | A | Process logging destination. Cloud logging should use process output or a collector; directory state is not a tenant store. |+| `config/schema/proxy.rs` proxy settings and clients | A, B | Process proxy policy and cached HTTP clients. Pending: establish operator-only mutation or capture profile policy; tenant configuration must not silently change another caller's routing. |+| `config/schema/cli_overrides/ops.rs` `CLI_INFERENCE_STATE` | A | Launch overrides; persisted configuration is restored separately. This is process configuration, not durable tenant inference state. |+| `agent/tinyagents/discovery` `SETTINGS` | B | Session construction overwrites one process policy, and turn assembly reads that slot. Pending interleaved-session regression; discovery policy needs a captured session owner. |+| `storage/secrets.rs` `KEYS` | A | Caches the master provider. Native secret operations capture scope and derive scoped data keys. Pending production `current()` isolation controls; changing the master source requires restarting the process. Legacy adoption needs separate source-ownership admission. |+| Connected-integration cache | B | Credential-only snapshots and global invalidation are corrected in [PR #7513](https://github.com/tinyhumansai/openhuman/pull/7513). Eight scope, diagnostic and epoch-reclamation controls, 363 Composio tests and five scoped-spawn controls pass. This is a pending PR, not released behavior. |++### Live execution and delivery++| State | Class | Current boundary and remaining work |+| ---------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `agent/orchestration/busy_guard.rs` | B, D | Profile-keyed live-turn guards with exact guard cleanup. A second core cannot observe these guards; live turns need owner routing or durable claims. |+| `agent/orchestration/completion_owners.rs` | B, D | Bounded IDs map to recorded profiles; delivery reopens trusted profile contexts. Restart or eviction can lose routing triggers. |+| `agent/orchestration/background_completions.rs` | B, C, D | Workspace routers and profile-keyed gates; completion records still use workspace JSONL with a memory fallback. Shared delivery requires durable records and claims. |+| `agent/orchestration/background_delivery.rs` | B, D | Profile-keyed local slots and scoped delivery tasks. Multiple executors need a shared delivery claim before publishing the same completion. |+| `agent/orchestration/running_subagents` | B, C, D | [PR #7517](https://github.com/tinyhumansai/openhuman/pull/7517) captures tenant ownership in live registry keys and public controls. Seven host controls passed after six baseline failures. Review follow-ups remain: prove actual SaaS RPC admission and refuse missing-scope spawns before durable writes. Live handles still need executor routing. |+| `agent/orchestration/workflow_runs/engine/cancel.rs` | A, D | UUID run IDs index generation-protected local signals. Public stop loads a scoped durable record first. Remote stop needs routing to the executing process; a durable row does not carry the signal. |+| `threads/store/bus.rs` `CLAIMED_TURNS` | A | Bounded desktop channel/message deduplication; registration and claims are disabled in SaaS. No distributed or SaaS turn claim is provided. |++### Capabilities and module connections++| State | Class | Current boundary and remaining work |+| -------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `core/event_bind_tokens.rs` `STORE` | A, D | Random one-shot client-bound capabilities with expiry. SaaS SSE rejects desktop tokens or missing profiles before consumption and filters events by the captured profile. Route consumption to the minting process; do not copy token tables into tenant documents. |+| `desktop/control/confirmation.rs` `TABLE` | B, D | Thread-bound local confirmations; SaaS excludes this domain. Pending tests for two embedded actors sharing a thread and for cancellation after module replacement. Ownership must include the original module instance. |+| `security/approval/gate.rs` `GLOBAL_GATE` | B, C, D | Routes already include tenant/agent scope; waiters retain original document handles. Pending missing-policy fallback controls. Normal profile hosts supply their own policy; cross-core waiter delivery still needs routing. |+| `composio/trigger_history.rs` | B, C | Process lifecycle owner of an opaque module archive lease. Workspace changes release the old captured client before opening another. The module owns durable history; native archive consumption and trustworthy event-profile propagation remain owner/host integration work. |+| `mcp/module_client.rs` `CLIENTS`, `CLEANUP_RESERVATIONS` | B, D | Agent-directory keys reserve retiring clients and pending cleanup callbacks. These are process-local admission fences. Pending: retain the admitted module owner through close and receipt polling; prove workspace retention and path admission after failed cleanup. They do not provide a distributed lease. |+| Browser `THREAD_SESSIONS` | B, D | Keys include scope directory and thread; sessions retain their original browser client. Normal profiles have distinct workspaces. Pending explicit same-workspace/different-profile collision test; route live browser handles to their owner. |+| RPC HTTP host `REGISTRY` | A, D | UUID listener handles capture task and auth state; list/get/stop lack tenant ownership. SaaS excludes the Platform surface. Pin that exclusion; exposing listeners to tenants would require an explicit owner capability. |+| Voice `IN_FLIGHT_CORRELATIONS` | B, D | Global correlation IDs and deferred replies through the current socket manager. SaaS headless services disable Socket.IO. Pending desktop reconnect/identity-switch controls: old work must retain its connection or refuse delivery. |++## Deployment constraints++A load balancer must preserve the owner of live streams, approvals, workers, browser sessions and local capabilities. Reconnecting to another core requires an explicit handoff or typed refusal. Shared storage alone does not transfer an in-memory task, socket, cancellation signal or module handle.++Desktop-only surfaces excluded by the SaaS preset must remain excluded until their ownership tests pass. Removing an exclusion is a capability change, even when its store has moved to a shared backend.++Outstanding acceptance includes reproducing each leak candidate, shrinking the storage-bypass baseline, driver-matrix verification, and regression-tested desktop import. [PR #7519](https://github.com/tinyhumansai/openhuman/pull/7519) adds a declaration guard for new core statics and retains existing ownership records; 68 guard, lane and crate-chain tests pass. It does not expand macros or certify existing globals. The guard remains a pending PR. Prepared tests and source review do not satisfy the remaining execution requirements.diff --git a/docs/gitbooks/en/developing/architecture/storage.md b/docs/gitbooks/en/developing/architecture/storage.mdindex 1ab02be65d..7058527fd8 100644--- a/docs/gitbooks/en/developing/architecture/storage.md+++ b/docs/gitbooks/en/developing/architecture/storage.md@@ -9,7 +9,7 @@ icon: databaseOpenHuman keeps durable state on the ports of [`tinystoragedrivers`](https://github.com/tinyhumansai/tinystoragedrivers), vendored through `vendor/tinyagents/vendor/tinystoragedrivers`. One URL picks the backend for the whole process. The host adapter is `crates/openhuman-core/src/storage/`. It resolves the URL, opens the backend, holds it in a process slot and decides which scope a call runs in. The ports, the drivers and their conformance suites belong to `tinystoragedrivers`, and the typed records stay with the domain that owns them.-With no URL configured, which is the desktop default, nothing here is opened and every domain keeps its classic on-disk layout under the workspace. Setting a URL switches the domains that have moved onto the ports. The rest still use their files.+With no URL configured, which is the desktop default, the host opens `sqlite:<workspace>/storage` and installs it. The URL decides where the whole process keeps its state, and there is no second layout: older installs' per-domain databases, transcripts and turn-state files are imported once, read-only, when the backend is installed. The files that remain outside the ports are listed under "What is not on the ports yet" below.## The ports@@ -31,7 +31,9 @@ The storage URL is the first of these that is set. Blank values count as unset.1. `OPENHUMAN_STORAGE_URL`2. `[storage] url` in `config.toml`-3. Nothing: the classic layout+3. The default, `sqlite:<workspace>/storage` (one database per workspace)++The retired `classic` opt-out value is read as unset, with a warning.`[storage]` is bootstrap configuration. It is always read from the environment or the file and never from storage itself.@@ -62,6 +64,31 @@ In SaaS mode a call with no profile is refused instead of falling into a bucketA backend decides how it enforces the scope. SQLite and the file driver keep each scope's data apart, and `local` is the scope a single-user install uses. MongoDB injects a scope key into every filter and every index prefix.+### Process state++The [process-state inventory](process-state.md) classifies the named shared-core+singleton candidates and records their tenant, durability and routing boundaries.+It also identifies pending regressions and implementation work.++### Process caches++The connected-integration catalog belongs to the calling profile, or to the+operator in single-user mode. Agents using that operator's same configuration+and credentials share it. Its cache key+also binds the configuration, backend endpoint and credential identity, using+digests rather than storing those secrets in the key. Identical service+credentials do not make two profiles share a snapshot.++| Cache | Isolation and lifetime |+| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `INTEGRATIONS_CACHE` | Per-process snapshots keyed by profile/operator scope and credential identity. Invalidation and connection reconciliation affect only the calling scope. Entries are reconstructed from the backend; they are not durable records. |+| `CACHE_GENERATIONS` | Per-process epochs for the same profile/operator scopes. Invalidation fences that scope's in-flight fetches without rejecting another profile's completed fetch. |+| Storage `KEYS` | The process master-key provider. Each secret operation derives its data key from the captured native storage scope; the cached value is not a tenant data key. Changing the master source requires a new process. |++SaaS work without a profile cannot read, populate, reconcile or invalidate the+integration cache. The Settings connection poll keeps its calling context when+it starts a background refresh with `spawn_scoped`.+### Background workBackground work runs under the process default context, which names no agent, and on its own would only see `local`. `storage::agents` closes the gap. Agents are known when they are live (`AgentContextRegistry`) or when an earlier process recorded their id in the `local` scope (`storage_agents`). `for_each_scope` runs a step once for `local` and once under each known agent. The cron scheduler's agent pass (`cron::scheduler::tick_live_agents`, driven in tests through the public `cron::scheduler::run_live_agent_pass`) runs each live agent's due jobs under that agent's own context, so their results are recorded in the agent's own scope. A recorded agent that is not live waits until it is live again, because its jobs need its host tools and prompt.@@ -78,7 +105,27 @@ On a shared backend (MongoDB) other processes may write the same records, so boo| `file:<dir>` | `<dir>/scopes/<scope>/docs/<collection>/<id>.json` for documents, with collection metadata in `<dir>/_meta/collections/<collection>.json`. Streams are JSONL and blobs are raw files under the same scope directory. || `mongodb://…/<db>` | One database. Each named database is a collection prefix, and every record carries its scope. |-Without a URL, the classic layout holds for the other domains: per-domain SQLite databases (`approval/approval.db`, `devices/devices.db`, `notifications/notifications.db`, `task_sources/sources.db`, `graph_checkpoints.db`), JSON and JSONL files, and the OS keyring or `secrets.enc`. Cron jobs and the flow catalog are the exception: they live in the document databases `cron/schedule.db` and `flows/catalog.db`, beside the retained legacy `cron/jobs.db`, `flows/flows.db` and `flows/checkpoints.db`, which are no longer read after the one-time import. Records written to a configured backend are not copied back to those files. The domain stores do not import their files either, with one exception: credentials. On first read with a backend installed, the auth-profile and HTTP-credential stores copy the records in their files into the backend, and the keyring adopts a secret it finds in the process backend. The source files are left untouched.+### The default follows the workspace++The default URL is rooted at the workspace, so a different workspace is a different database. The desktop rebinds its workspace when a different user signs in. `storage::rebind` then re-resolves the URL for the new workspace, opens its backend, points the session store (`ReboundSessionStores`) and the process slot at it together, and runs the legacy importers over it. This happens before any other store is rebound, and a failed reopen is an error that leaves the previous backend installed rather than continuing on it. An explicit URL names one backend for every user and is never replaced.++A SaaS core with no URL keeps one default database per profile workspace, and its profiles never share a scope.++### What is not on the ports yet++The keyring or `secrets.enc`, the path-bound artifacts and media, and a few stores that keep a file next to a document fallback (cost tracking, the Composio file store, sub-agent sessions, agent artifacts) still use files when no backend is installed. The vault watcher's mtime table stays a per-machine SQLite file on purpose, because its rows are absolute paths on one host. On first read with a backend installed, the auth-profile and HTTP-credential stores copy the records in their files into the backend, and the keyring adopts a secret it finds in the process backend. The source files are left untouched.++### Importing the legacy small stores++When the backend is installed, the core runs a one-time import at boot (`storage::import`, before any domain store opens). It covers the four small stores that keep one SQLite file each: approvals (`approval/approval.db`), devices (`devices/devices.db`), notifications (`notifications/notifications.db`) and task sources (`task_sources/sources.db`). The import is read-only. It copies the file, with its `-wal` and `-shm` companions, into a scratch directory and reads the copy, so the legacy reader's schema migration and the SQLite driver's table declaration never touch the real file. Both on-disk shapes are read: the original tables, and the driver document tables an earlier default wrote into the same file (those records win an id clash, being newer). Notifications for the core are re-filed under the real workspace's key.++Every record is written with an absent-only precondition, so an existing record is never overwritten. When a domain's records are written, a marker document (`storage_import/<domain>@<workspace digest>`, local scope) is stored, and a later boot does nothing. A deleted record is therefore not brought back from the untouched file. A failed import leaves no marker and is retried at the next boot; boot continues either way. SaaS processes have no workspace files and import nothing.++The tinyflows stores are imported the same way with TinyFlows' own reader (`tinyflows-import`): cron jobs with their runs and policies (`cron/jobs.db`, and each agent's `agents/<id>/cron/jobs.db`, filed under that agent's scope), and the flow catalog with its drafts and checkpoints (`flows/flows.db`, `flows/drafts/*.json`, `flows/checkpoints.db`). Records keep their ids, markers are `cron`, `cron/<agent>` and `flows`, and a build without the `flows` gate imports no cron jobs.++TinyFlows has no storage backend of its own any more, so these stores are on the ports whatever the URL says, and the legacy files are never modified or written again.++Sessions are imported through TinyAgents' `legacy` reader, which owns those formats (`storage::import::sessions`): `session_db/sessions.db` (copied with `VACUUM INTO` first, because the reader refuses a database with a WAL sidecar) fills the run ledger of the default agent, each `session_raw` transcript lands in the scope of the agent its stem names (matched against the known agent definitions, else the default agent), and the turn-state JSON goes to the default agent. The marker is `sessions`; a run that skipped records leaves no marker and is retried.Secrets with a backend installed are encrypted documents in the current storage scope: the acting agent's scope on a desktop or CLI host, and the profile's scope under SaaS, where every agent in one profile shares the profile's credentials and data key. Each scope's data key is derived with HKDF-SHA256 from the keyring master key (`OPENHUMAN_KEYRING_MASTER_KEY` or `_FILE`, else the OS keychain), and with no master key they fail closed. The config encryption key stays on the process keyring because `config.toml` is loaded before any agent acts.diff --git a/docs/gitbooks/en/developing/architecture/tauri-shell.md b/docs/gitbooks/en/developing/architecture/tauri-shell.mdindex c459e5d39d..27f8d4045c 100644--- a/docs/gitbooks/en/developing/architecture/tauri-shell.md+++ b/docs/gitbooks/en/developing/architecture/tauri-shell.md@@ -9,6 +9,44 @@ icon: desktop`crates/openhuman-app/` is the desktop host for OpenHuman. It provides the Tauri v2 webview, IPC commands and window management, and bridges to the embedded `openhuman-core` Rust runtime over core JSON-RPC. It does not duplicate the domain stack. That lives in `crates/openhuman-core` (library `openhuman_core`; the `openhuman-core` binary is `crates/openhuman-cli/src/main.rs`).+### Where the shell sits++The shell is one of three hosts on top of a strict crate chain, and+`openhuman-rpc` is the only OpenHuman crate in its `Cargo.toml`:++```text+ openhuman-app (this crate)+ | [dependencies] openhuman-rpc (http-client, server, jev + the product gates)+ v+ openhuman-rpc ----------> host::desktop / host::cli, server, client+ | re-exports `embed` and `tinyhumans`+ v+ openhuman-tinyhumans ---> SDK transport, session owner (`session/` uses it)+ |+ v+ openhuman-embed --------> Runtime, process helpers (tokio runtime, logging,+ | Sentry options), config/artifacts/modules facades+ v+ openhuman-core+```++| Shell code | Goes through |+| --- | --- |+| Embedded server (`core_process.rs`) | `openhuman_rpc::host::desktop(DesktopOptions { port, rpc_token, .. }, shutdown, ready_tx)` |+| `OpenHuman core …` / `mcp` subcommands (`lib.rs::run_core_from_args`) | `openhuman_rpc::host::cli(args)` |+| Tauri async runtime sizing (`lib.rs::run`) | `openhuman_rpc::embed::process::tokio_runtime()` |+| Sentry client (`lib.rs::run`) | `openhuman_rpc::embed::process::sentry::client_options` (the shared `before_send` chain; fallback user id from `session::peek_user_id`) |+| File logging (`file_logging.rs`), data reset log handle | `openhuman_rpc::embed::process::{init_for_embedded, log_directory, shutdown_file_guard}` |+| Config / workspace paths, artifacts, bundled modules | `openhuman_rpc::embed::{config, artifacts, modules}` |+| Session owner (`session/`) | `openhuman_rpc::tinyhumans` |+| Compile-time asserts | `openhuman_rpc::embed::{VOICE_COMPILED_IN, HTTP_SERVER_COMPILED_IN}` |++`scripts/ci/check-crate-chain.mjs` fails if the shell's manifest names+another OpenHuman crate or its `src/` names `__host`, `core_host` or+`openhuman_core::`. One embed runtime exists per process: when the shell+restarts its embedded server, `CoreProcessHandle` waits for the old task (and+the runtime it owns) to drop before it spawns the next one.+## Responsibilities1. Web UI. Load the Vite build from `app/dist` (or dev server on port 1420).@@ -159,8 +197,8 @@ install's data, and *this* machine's audio, so routing them to a remote gatewaywrong rather than incomplete.Gated by the shell-local `gateways` Cargo feature (default on). That gate is unrelated to-the feature-forwarding rules in `AGENTS.md`, which govern which `openhuman_core` gates the-shell forwards; nothing here belongs in `scripts/ci/product-features.txt`.+the feature-forwarding rules in `AGENTS.md`, which govern which core gates the shell+forwards on its `openhuman-rpc` dependency; nothing here belongs in `scripts/ci/product-features.txt`.Frontend: `app/src/services/gatewayService.ts`, surfaced in Settings → Core connection(`components/settings/panels/core/GatewaySection.tsx`).@@ -301,7 +339,7 @@ The Tauri crate does not embed a duplicate Socket.io server or Telegram client;### `CoreProcessHandle` (`core_process.rs`)-- Runs the core's HTTP/JSON-RPC server as a tokio task inside the Tauri host via `openhuman_rpc::host::desktop`: no sidecar binary.+- Runs the core's HTTP/JSON-RPC server as a tokio task inside the Tauri host via `openhuman_rpc::host::desktop`: no sidecar binary. The runtime the task builds is dropped when the task ends; `shutdown` and the startup-timeout abort wait for that before a respawn, because a process holds one embed runtime at a time.- Generates a per-launch 256-bit hex bearer token (`generate_rpc_token`) and hands it to the embedded server; the renderer reads it via the `core_rpc_token` command.- Stale-listener policy: if the core port is already occupied, probes whether the listener is an old OpenHuman core (terminate + respawn) or something foreign (surface the conflict). `OPENHUMAN_CORE_REUSE_EXISTING=1` opts back into attach-to-existing for debugging.- Managed as Tauri state in `lib.rs` (`app.manage(core_handle)`).diff --git a/docs/gitbooks/en/developing/components.md b/docs/gitbooks/en/developing/components.mdnew file mode 100644index 0000000000..9aad18c4cf--- /dev/null+++ b/docs/gitbooks/en/developing/components.md@@ -0,0 +1,83 @@+---+description: >-+ The [components] config table: one switch per tiny dependency, how it narrows+ a host, and how legacy flags migrate.+icon: toggle-on+---++# Components++`config.toml` has a `[components]` table with one boolean per tiny dependency. All default to `true`.++```toml+[components]+flows = true # tinyflows: saved workflows+memes = true # tinymemes+documents = true # tinydocs+search = true # tinysearch+mcp = true # tinymcp+connectors = true # tinyconnectors (Composio)+hosting = true # tinyhosts+juice = true # tinyjuice+memory = true # tinymemory+wallet = true # tinywallet (web3, x402)+computer = true # tinycomputer+sandbox = true # tinybox+channels = true # tinychannels+skills = true # tinyskills+voice = true # tinyvoice+```++Each switch also reads `OPENHUMAN_COMPONENT_<NAME>=0|1` (for example `OPENHUMAN_COMPONENT_VOICE=0`); the environment wins over the file.++## What a switch does++The switches only narrow. The core resolves them into a component set and computes `effective = host choice ∩ components` for the domain families, background services and tool groups. A host preset (`harness`, `kernel`, `saas`, ...) decides what may exist; a switch can remove something from it, never add something back.++A method whose component is off answers `COMPONENT_DISABLED:<name>` (JSON-RPC `error.message`, with `error.data = {"kind": "component_disabled", "component": "<name>"}`) instead of `unknown method`, so the UI and CLI can explain why. A method that the host simply left out still looks unregistered.++Loadable modules follow the same switches. A module whose component is off is never downloaded, mapped or registered: `modules.list` reports its state as `disabled`, boot skips it (including a matching artifact on the module search path), and loading it returns `COMPONENT_DISABLED:<name>`. `about_app` marks capabilities backed by a disabled component with status `disabled`.++A flag change takes effect on the next core start. There is no hot toggling.++Each component's domain wires itself to its switch (tools, services and RPC) in its own change; until then a switch removes only the families, services and tool groups listed in the core's component set.++## Not toggleable++The kernel dependencies (tinyagents, tinytools, tinyinference, tinybus) are always on. `[modules] enabled` remains the global kill switch for loadable native modules.++## Legacy flags++The first load of an older config moves these once into `[components]`, and the next save writes the result:++| Legacy setting | Becomes |+| --- | --- |+| `[hosting] enabled = false` | `components.hosting = false` |+| `[search] enabled = false` | `components.search = false` |+| `[mcp_client] enabled = false` | `components.mcp = false` |+| `[memory] engine = "none"` | `components.memory = false` (`engine` is kept) |+| `OPENHUMAN_TINYMEMES` set to an off value | `components.memes = false` |+| `OPENHUMAN_DISABLE_CHANNEL_LISTENERS=1` | `components.channels = false` at load (env override, kept for one release; `OPENHUMAN_COMPONENT_CHANNELS` wins) |+| `[dictation] enabled`, `[voice_server] auto_start` and `always_on_enabled` all explicitly `false` | `components.voice = false` (any other mix keeps voice on) |+| `[sandbox] enabled = false` (or `[security.sandbox] enabled = false`) | `components.sandbox = false` (`enabled = true` or unset keeps it on; the old key is kept) |+| `[composio] enabled` | dropped; it was never read |++A `components.*` key already present in the file always wins over its legacy flag, so the migration is idempotent and turning a component back on sticks.++## Memes++`components.memes` is the master switch: off means no remix and no module load, and the A/B arm is ignored. When on, `OPENHUMAN_TINYMEMES` (`off`, `on`, `ab`, `ab:NN`; build-time default `OPENHUMAN_TINYMEMES_DEFAULT`) picks the threads that are remixed. The `[memes]` section tunes it: `timeout_ms` (default 20000) and `meme_cooldown` (default 3). `OPENHUMAN_TINYMEMES_TIMEOUT_MS` and `OPENHUMAN_TINYMEMES_MEME_COOLDOWN` override them when set.++The module reads its own `TINYMEMES_*` overrides from the process environment, so credentials never cross the bus: `TINYMEMES_OPENROUTER_KEY` (and `TINYMEMES_MODEL`) route the rewrite model and slang research through OpenRouter, `TINYMEMES_JEV` (`auto`, `typesafe`, `openrouter`, `openjev`, `llm`) with `TINYMEMES_TYPESAFE_KEY` / `TINYMEMES_OPENJEV_KEY` picks the Jev route. Without any override the module asks OpenHuman for Jev; when OpenHuman has none (signed out, offline session) the chat model answers Jev's questions instead. After the reply is delivered the module may run slang and meme research in the background through OpenHuman web search. Learned slang, memes and the remixed-message ring are documents on the storage port (older `<workspace>/tinymemes/*.json` files are adopted once and renamed `*.migrated`).++## Wallet++`wallet = false` removes the `web3` domain family and tool group, so `wallet.*`, `web3.*` and `x402.*` answer `COMPONENT_DISABLED:wallet`. The x402 payment hook behind `http_request` declines before any quote or signing (the 402 response comes back unpaid), and `tinywallet` is never downloaded, attested or loaded. Keychain material, spending limits (`OPENHUMAN_X402_*_MAX`) and RPC endpoints (`OPENHUMAN_WALLET_RPC_*`) are left as they are, so setting `wallet = true` again restores the wallet on the next core start.++## Voice++`voice = false` removes the `voice` domain family, so `voice.*` answers `COMPONENT_DISABLED:voice`. The embedded voice server, the dictation hotkey listener and always-on listening do not start whatever `[dictation] enabled`, `[voice_server] auto_start` and `always_on_enabled` say, and `tinyvoice` is never downloaded, attested or loaded. `about_app` and `modules.list` report voice as disabled. The Cargo `voice` feature is unchanged.++## Sandbox++`sandbox = false` means the TinyBox module is never downloaded, attested, loaded or initialised, and `sandbox.*` answers `COMPONENT_DISABLED:sandbox`. Sandboxed execution takes the documented fallback, the same as `[sandbox] enabled = false` or `OPENHUMAN_SANDBOX=off`: the command runs unjailed and the Rust path checks, the always-forbidden credential floor and the security policy still apply. TinyBox registers no tools and starts no background services. `modules.list` reports `tinybox` as `disabled`, `about_app` marks the sandbox capability as disabled, and the host `DomainSet` still wins. A SaaS core still requires the per-user container path, so with the module disabled it fails closed instead of running unsandboxed.diff --git a/docs/gitbooks/en/developing/hooks.md b/docs/gitbooks/en/developing/hooks.mdindex 5442df6331..a4c5447701 100644--- a/docs/gitbooks/en/developing/hooks.md+++ b/docs/gitbooks/en/developing/hooks.md@@ -102,7 +102,7 @@ Every field is optional. Each event honors the subset it defines:| `preToolUse` | before any tool | `permission`, `updated_input`, `agent_message` || `postToolUse` | after a tool succeeded | `additional_context` || `postToolUseFailure` | after a tool failed | - |-| `beforeShellExecution` | before `shell` / `node_exec` / ... | `permission`, `agent_message` |+| `beforeShellExecution` | before `shell` | `permission`, `agent_message` || `afterShellExecution` | after one completed | - || `beforeReadFile` | before `file_read` / `read_diff` | `permission` || `afterFileEdit` | after `file_write` / `edit` / `apply_patch` | - |diff --git a/docs/gitbooks/en/developing/loadable-modules.md b/docs/gitbooks/en/developing/loadable-modules.mdindex eb78b585b7..44048b99df 100644--- a/docs/gitbooks/en/developing/loadable-modules.md+++ b/docs/gitbooks/en/developing/loadable-modules.md@@ -11,9 +11,28 @@ Feature gates decide what compiles into the binary. Modules decide what the runnThe 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.+`crates/openhuman-core/src/modules/registry/` compiles eleven records. Only this registry may select an artifact. Nothing reads a module name from config and goes looking for it.| Module | Provides || --- | --- |@@ -23,14 +42,13 @@ The trade is explicit. A module shares the core's address space and crash domain| `tinywallet` | Key derivation and transaction signing || `tinyjuice` | Tool-output compression and recovery || `tinyvoice` | Audio framing, VAD, wake-word gating, hallucination detection |-| `tinyruntime` + `tinyruntime-nodejs` + `tinyruntime-python` | Runtime discovery and warm interpreter pools || `tinymcp` | The MCP client and registry || `tinyconnectors` | OAuth connector actions and triggers |-| `tinybox` | Sandbox capability discovery |+| `tinybox` | Sandbox/resource lifecycle, bounded and supervised execution, jail and Docker operations, shell execution, file transfer and port forwarding || `tinychannels` | Messaging channel transports || `tinyhosts` | Hosting provider operations |-Each record carries a version, the release it came from, and one `PlatformAsset` per supported build. Thirteen of the fourteen publish eleven builds: `ubuntu-24.04` and `ubuntu-22.04` on `x86_64` and `arm64`, `macos-26` and `macos-15` on `arm64` and `x86_64`, `windows-2025-x86_64`, `windows-2022-x86_64` and `windows-11-arm64`. `tinycomputer` publishes seven because it has no Linux backend.+Each record carries a version, the release it came from, and one `PlatformAsset` per supported build. Seven records publish eleven builds: `ubuntu-24.04` and `ubuntu-22.04` on `x86_64` and `arm64`, `macos-26` and `macos-15` on `arm64` and `x86_64`, `windows-2025-x86_64`, `windows-2022-x86_64` and `windows-11-arm64`. TinyComputer publishes sixteen assets; TinyBox, TinyMCP and TinyWallet each publish seventeen, adding Arch Linux and Fedora builds. Asset availability is module-specific, so a release's count should not be inferred from another module's matrix.Every asset carries a SHA-256 copied verbatim from the published release's own checksum file. Do not compute a replacement pin from a local build. The digest must describe the artifact the release workflow signed, not the one on your machine.@@ -39,7 +57,7 @@ Every asset carries a SHA-256 copied verbatim from the published release's own cEach step avoids the cost of the next:1. Already serving on the host's broker.-2. An operator override: a path in `[modules].overrides`, or a source mode (`[modules] source` / `OPENHUMAN_MODULE_SOURCE`, local development only; CI uses `release`). `linked` serves a module compiled into the running `openhuman-core` (build it with `--features linked-modules`, which links `crates/openhuman-modules-linked`; no product build or other host can reach that crate).+2. An operator override: a path in `[modules].overrides`, or a source mode (`[modules] source` / `OPENHUMAN_MODULE_SOURCE`, local development only; CI uses `release`). `linked` serves a module compiled into the running `openhuman-core` (build it with `--features linked-modules`, which links `crates/openhuman-modules-linked`; no product build or other host can reach that crate). `source` serves a library built from the module's vendored gitlink by `node scripts/modules/build.mjs <id|all>` (it writes `target/module-sources/<id>/` with an operator-trust `modules.toml`; set `OPENHUMAN_MODULE_SOURCE_DIR` to that directory). Local digests are never registry pins. `node scripts/modules/pin-status.mjs` reports whether each gitlink is in sync with, ahead of or behind its registry pin (ahead means you are running a locally compiled module that CI will refuse), and `node scripts/modules/release-and-repin.mjs <id>` publishes a release and re-pins from its `checksum.toml`. The strict `check-module-pins.mjs` is unchanged.3. The module search path: `OPENHUMAN_MODULE_PATH`, then the platform data directories.4. Bundled releases staged into the app at build time.5. The release cache, downloading only if `[modules].allow_download` is true.diff --git a/docs/gitbooks/en/developing/performance.md b/docs/gitbooks/en/developing/performance.mdindex c407bd491c..81037bb291 100644--- a/docs/gitbooks/en/developing/performance.md+++ b/docs/gitbooks/en/developing/performance.md@@ -64,7 +64,7 @@ Note that the smallest figure here, 15.2 MiB, is private memory in a slim runninCargo features (`media`, `skills`, `flows`, `mcp`, `channels`, `http-server`, `scheduler-gate`, `file-logging`, `modules` and more) decide what compiles in. Beyond that, several domains ship as loadable native `cdylib` modules that are not linked into the core binary at all.-The compiled registry pins fourteen records across twelve module names, because `tinyruntime` ships as a router plus two language providers. The modules are `tinycomputer`, `tinysearch`, `tinydocs`, `tinywallet`, `tinyjuice`, `tinyvoice`, `tinyruntime` (with its Node and Python providers), `tinymcp`, `tinyconnectors`, `tinybox`, `tinychannels` and `tinyhosts`. Each sits behind a small `*-bus` contract crate. A module loads into the same process and shares its privileges, so the admission checks (ABI, manifest, dependency, digest) matter more than for an ordinary dependency. See [Loadable modules](loadable-modules.md).+The compiled registry pins eleven module names: `tinycomputer`, `tinysearch`, `tinydocs`, `tinywallet`, `tinyjuice`, `tinyvoice`, `tinymcp`, `tinyconnectors`, `tinybox`, `tinychannels` and `tinyhosts`. Each sits behind a small `*-bus` contract crate. A module loads into the same process and shares its privileges, so the admission checks (ABI, manifest, dependency, digest) matter more than for an ordinary dependency. See [Loadable modules](loadable-modules.md).## The dependency-floor ratchetdiff --git a/docs/gitbooks/en/developing/saas-profiles.md b/docs/gitbooks/en/developing/saas-profiles.mdindex 02d6c66014..c6636bbc73 100644--- a/docs/gitbooks/en/developing/saas-profiles.md+++ b/docs/gitbooks/en/developing/saas-profiles.md@@ -36,10 +36,10 @@ The internals are inunknown method.- **Their own events.** `GET /events?client_id=` streams only that user'schat progress, final replies and relayed `channel_outbound` replies.-- **Closed tools by default.** No shell or file tool reaches the host unless- the operator opts users into `host_files` or `host_shell`; `host_shell`- runs every command in a locked-down Docker container whose only writable- mount is the user's `sandbox/`.+- **Closed host tools.** The standalone SaaS CLI exposes no file or shell+ tools, even when `host_files` or `host_shell` is in `tool_allowlist`.+ Embedding hosts can supply profile tool adapters; the allowlist limits+ which host tool groups those adapters may expose.## Operator config@@ -57,7 +57,7 @@ max_profiles_open = 256 # profiles open at once on this nodeidle_evict_secs = 1800 # close a profile idle this longprofile_ids = "raw" # or "hashed"require_user_signature = true # X-OpenHuman-User-Sig on every user request-tool_allowlist = [] # "host_files", "host_shell"+tool_allowlist = [] # admission only; CLI has no host-tool adaptershared_backend_api_key = true # let every user ride OPENHUMAN_BACKEND_API_KEYcustom_definitions = false@@ -68,13 +68,20 @@ custom_definitions = false# lease_ttl_secs = 30# operator_dir = "/var/lib/openhuman/node-a" # default <root>/operator-[sandbox] # only used with host_shell+[sandbox] # policy for host_shell supplied by an embedding hostimage = "alpine:3.20"network = "none"memory_limit_mb = 512cpu_limit = 1.0```+`tool_allowlist` is an admission policy, not a tool installer. Its recognized+groups are `host_files` and `host_shell`. To expose those tools, use an+embedding host with profile tool adapters and a permission callback. Adding+either group to the standalone CLI configuration does not make those tools+available. The `host_shell` Docker boot check still applies when that group is+allowlisted.+Unknown keys are refused. The boot guard refuses to start, listing everyproblem at once, when the root is relative, missing, world-writable or inside`~/.openhuman`; when the service token is missing, readable by others ordiff --git a/docs/gitbooks/en/developing/testing-strategy.md b/docs/gitbooks/en/developing/testing-strategy.mdindex 11444341cf..6cc75d9c21 100644--- a/docs/gitbooks/en/developing/testing-strategy.md+++ b/docs/gitbooks/en/developing/testing-strategy.md@@ -53,6 +53,14 @@ A spec that asserts only the happy path is incomplete.---+## Property-test regressions++Core proptests set `failure_persistence: None` in their `ProptestConfig`; they do not write seed files. When a property fails, preserve the minimized input shown in the failure report to reproduce it, then promote that input to a named unit test beside the property test. Confirm that the explicit case fails against the faulty implementation and passes with the fix before shipping it.++For example, the lease model retains the expired-holder reacquisition case as `reacquiring_at_expiry_advances_epoch_and_marks_previous_holder_unclean`, with two nodes and the steps `Acquire(0), Advance(1000), Acquire(0)`.++---+## Mock policy- Use no real network in unit, integration or E2E tests. Use the shared mock backend (`scripts/mock-api-core.mjs`, `scripts/mock-api-server.mjs`, `app/test/e2e/mock-server.ts`).@@ -196,7 +204,7 @@ ls vendor/<module> | wc -l # 0 = empty, whatever status says`cargo test -p openhuman --lib` on default features builds a smaller product than CI does, and the difference changes test outcomes, not just which tests exist. A feature flag can gate a tool's registration. A test can compare a static allowlist with what it finds by inspecting the built binary. The flag then moves the result silently, and the failure names a product concept, such as "agents that carry tools but whose prompt names none of them", with no mention of a feature.-In one comparison, `openhuman --lib` failed 5 tests on default features and 3 under CI's set. The two that differed were profile artifacts: `every_prompt_names_at_least_one_tool_it_can_call` needs `runtime-node`, and `the_withheld_block_renders_for_a_renamed_session_with_a_filter` needs `documents`. Reproduce CI exactly before you assert anything:+In one comparison, `openhuman --lib` failed 5 tests on default features and 3 under CI's set. The two that differed were profile artifacts: `every_prompt_names_at_least_one_tool_it_can_call` depends on its default registry, and `the_withheld_block_renders_for_a_renamed_session_with_a_filter` needs `documents`. Reproduce CI exactly before you assert anything:```bashRUST_MIN_STACK=67108864 cargo test -p openhuman --lib \diff --git a/docs/gitbooks/en/features/hosting.md b/docs/gitbooks/en/features/hosting.mdindex 6a2b88dd19..bdc4f7fcc0 100644--- a/docs/gitbooks/en/features/hosting.md+++ b/docs/gitbooks/en/features/hosting.md@@ -48,7 +48,7 @@ team = "" # blank means your personal accountWith `api_key` blank, the credential comes from `TINYHOSTS_VERCEL_TOKEN`, then `VERCEL_TOKEN`. A team account also reads `TINYHOSTS_VERCEL_TEAM_ID` or `VERCEL_TEAM_ID`.-`[components] hosting` is `true` by default and is the only on/off switch; a legacy `[hosting] enabled = false` is migrated once to `[components] hosting = false`. When it is off, or when no credential can be found, the ten tools are not registered at all. A tool that is present but cannot work is worse than a missing one, because the model keeps retrying it.+`[components] hosting` is `true` by default and is the only on/off switch; a legacy `[hosting] enabled = false` is migrated once to `[components] hosting = false` (see [Components](../developing/components.md)). When it is off, or when no credential can be found, the ten tools are not registered at all. A tool that is present but cannot work is worse than a missing one, because the model keeps retrying it.A misconfigured section is logged as an error and not skipped silently. That means an unknown provider name, or a key that is blank after trimming. Leaving `api_key = ""` is the supported way to defer to the provider's environment variable and is not a misconfiguration.diff --git a/docs/gitbooks/en/features/integrations/mcp-and-skills.md b/docs/gitbooks/en/features/integrations/mcp-and-skills.mdindex 3a2b39636c..5d0948a03b 100644--- a/docs/gitbooks/en/features/integrations/mcp-and-skills.md+++ b/docs/gitbooks/en/features/integrations/mcp-and-skills.md@@ -28,7 +28,9 @@ It also works the other way. `openhuman-core mcp` exposes OpenHuman over stdio aSkills are a large, browsable catalog of `SKILL.md` capability bundles, gathered from several public sources such as HermesHub, ClawHub and LobeHub.- **One catalog.** It comes from HermesHub, and you can point to another source with `OPENHUMAN_SKILL_REGISTRY_CATALOG_URL`. It holds roughly 90,000 entries. Each entry has an id, name, description, source, author, version, tags, platforms, a download URL and a license.-- **Cached.** The catalog loads in the background at startup without blocking it. It is cached at `~/.openhuman/skill-registry/cache.json` for about an hour and refreshed while stale entries are still served. A single download runs at a time.+- **Paged and cached.** The `tinyskills` skill registry serves the catalog. The app asks for one page at a time (25 rows, filtered and ranked by the core), and opening an entry loads its full detail. The catalog loads in the background at startup without blocking it, and is saved at `~/.openhuman/skill-registry/hermes.json` (`OPENHUMAN_SKILL_REGISTRY_CACHE_DIR` moves it). While a refresh runs, or when the registry cannot be reached, the tab keeps showing the saved catalog, says so, and offers Retry. After a failed refresh the registry waits 45 seconds (longer if the upstream asks) before trying again, so a Retry inside that window shows the saved catalog without a new download.+- **Guarded downloads.** Installs fetch `SKILL.md` over HTTPS only, refuse non-public addresses and re-check every redirect. Entries without a `SKILL.md` (LobeHub agents, portal pages) show "Not installable" with a link to their source page. `OPENHUMAN_SKILL_REGISTRY_DOWNLOAD_BASE_URL` serves every `SKILL.md` from a mirror, and `OPENHUMAN_SKILL_INSTALL_ALLOW_LOCAL_HTTP=1` allows a loopback `http` mirror for local fixtures.+- **Security scan before install.** Every downloaded `SKILL.md`, from the catalog or a pasted URL, is scanned for supply-chain red flags such as invisible characters and hard-coded credentials. If the scan blocks it, or the download fails, OpenHuman fetches and scans it once more. If it still blocks, nothing is installed and the app shows the findings with two choices: **Block install** (the default) or **Install anyway**. Install anyway installs exactly the document you reviewed: if it changed in the meantime, it is scanned again and you are asked again. Only you can choose Install anyway. An agent that tries to install a blocked skill is told to ask you to do it from the Skills page.- **Metadata first.** Skills are a catalog you browse and install from the **Connections > Skills** tab. They are not code running inside the app. Availability varies by entry: some offer a direct `SKILL.md` download, and others point to external hosting.## See alsodiff --git a/docs/gitbooks/en/features/memory.md b/docs/gitbooks/en/features/memory.mdindex 3c0fd42912..9755482e09 100644--- a/docs/gitbooks/en/features/memory.md+++ b/docs/gitbooks/en/features/memory.md@@ -1,7 +1,7 @@---description: >-Memory: a pluggable engine that stores your documents, conversations and- learnings, recalls what matters before every turn, and answers questions+ learnings, refreshes context in the background, and answers questionswith citations.icon: brain---@@ -16,9 +16,9 @@ Open it from **Connections > Memory**. It has eight tabs: Engine, Ask, Explorer,Memory works around every turn, and the agent does not have to ask for it.-- **Before the model answers**, OpenHuman logs what you said and recalls a short *memory pack* for the turn, sized to a token budget. The pack holds relevant learnings (and beliefs the engine built from them), documents from your brain, this agent's earlier conversations and, briefly, other agents' conversations. The pack is added to the model request for that turn only. It is never written into the chat, so your conversation stays exactly as you had it.-- **After the answer**, the reply is logged with a one-line result for each tool it used.-- **When a long chat is compacted**, OpenHuman recalls what the folded-away turns covered and adds it to the summary that replaces them.+- **Before the model answers**, OpenHuman takes a completed *memory pack* from its short-lived cache, when one is available, and starts logging your message and refreshing memory in the background. The first turn can have no pack. A cached pack can hold learnings, beliefs, documents and earlier conversations from a previous lookup; it is labelled as cached context, so the agent can use explicit recall when it needs a current answer. The pack is added to requests for that turn only and never written into the chat.+- **After the answer**, the reply is logged in the background with a one-line result for each tool it used.+- **When a long chat is compacted**, OpenHuman can add completed cached memory to the summary and starts refreshing recall of the folded-away turns. Memory reads never hold up the summary.- **In the background**, every few minutes, the engine builds beliefs from what was stored, such as "the user prefers short answers" or "deploys happen on Fridays".Memory chips on an answer show which stored items the pack cited. To see what a turn would get, open **Ask > Pack preview**.@@ -32,7 +32,7 @@ An engine stores your memory and answers questions about it. There are two.| TinyHumans | Hosted CortexDB run by TinyHumans, reached through the TinyHumans backend | You are signed in, or the host supplies a TinyHumans API key (headless and library hosts) || CortexDB | Your own CortexDB, called directly (managed `api-v1.cortexdb.ai` or self-hosted) | A CortexDB API key (kept in the OS keychain), and an endpoint if it is not the managed one |-With either engine your memory items live in CortexDB, not on your computer. OpenHuman keeps only bookkeeping locally, such as queued jobs and sync progress. See [Where your memory is stored](privacy-and-security.md#where-your-memory-is-stored).+With either engine, committed memory items live in CortexDB. OpenHuman also keeps scrubbed pending agent writes in a private local queue until they are delivered, plus job and sync bookkeeping. Cached packs stay in process memory for a short time. See [Where your memory is stored](privacy-and-security.md#where-your-memory-is-stored).Pick an engine on the **Engine** tab. If you are signed out and have neither a CortexDB key nor a host-supplied TinyHumans API key, memory is off. The agent has no memory tool, nothing is stored, and the Memory page tells you why.@@ -62,11 +62,11 @@ Sources sync when you press sync and on a schedule you set for each source. An u### Conversations-Every turn is logged as it happens: your message before the model runs, and the reply after. Each agent's turns are kept apart. Tool calls are stored by name and id with a one-line result, never their arguments. You can switch turn logging off on the **Conversations** tab, which also lists each agent's stored turns.+Turn logging runs in the background: your message is queued before the model runs, and the reply after it commits. A slow or unavailable memory engine does not delay the answer. Each agent's turns are kept apart. Tool calls are stored by name and id with a one-line result, never their arguments. You can switch turn logging off on the **Conversations** tab, which also lists each agent's stored turns.### Learnings-A learning is one lasting statement: a preference, fact, procedure or correction. The agent saves them with its `memory` tool (the `learn` action), and you can add or delete them on the **Learnings** tab. Beliefs the engine built are listed there too, marked "Built belief".+A learning is one lasting statement: a preference, fact, procedure or correction. The agent queues them with its `memory` tool (the `learn` action), and you can add or delete them on the **Learnings** tab. A tool acknowledgement saying "queued; not yet saved to memory" confirms local acceptance, not a completed save by the engine. Beliefs the engine built are listed there too, marked "Built belief".Everything is scrubbed for secrets and personal identifiers before it leaves your machine.@@ -94,7 +94,7 @@ A host that runs OpenHuman agents as part of something larger, such as an AI com## The agent's memory tool-The agent has one tool, `memory`, with four actions: `recall`, `fetch`, `learn` and `forget`. OpenHuman's own [MCP server](../developing/mcp-server.md) offers the same abilities to other apps as `memory.recall`, `memory.fetch`, `memory.list`, `memory.learn` and `memory.forget`.+The agent has one tool, `memory`, with four actions: `recall`, `fetch`, `learn` and `forget`. Explicit reads have a deadline and a shared budget for the current run; when memory is too slow, the agent gets an error and continues without retrying it in that run. Agent `learn` and `forget` requests are queued locally and delivered in the background, so their acknowledgements do not confirm a remote save or deletion. OpenHuman's own [MCP server](../developing/mcp-server.md) offers the same abilities to other apps as `memory.recall`, `memory.fetch`, `memory.list`, `memory.learn` and `memory.forget`.## Settings and background workdiff --git a/docs/gitbooks/en/features/model-routing/local-and-byok-models.md b/docs/gitbooks/en/features/model-routing/local-and-byok-models.mdindex 8e76ec15d4..5bcecc9214 100644--- a/docs/gitbooks/en/features/model-routing/local-and-byok-models.md+++ b/docs/gitbooks/en/features/model-routing/local-and-byok-models.md@@ -130,6 +130,8 @@ Add your key in the desktop app under the LLM settings. It is stored in the OS kAnything else that speaks the OpenAI-compatible API also works. Register it with your own slug and endpoint, and it routes the same way.+For an HTTPS endpoint signed by a private or corporate CA, upload its PEM CA certificate in the custom provider editor. OpenHuman trusts that certificate for this provider's model listing and inference requests. You can also install the CA in the operating system's trust store; on macOS and Linux, `SSL_CERT_FILE` supplies a PEM bundle to the core process.+On a headless core (`openhuman-core serve`), custom cloud providers are built only when a backend session or TinyHumans API key is present. If you run the core with no account, set the endpoint up as the `local-openai` runtime instead: set `LOCAL_OPENAI_URL`, put the key in `local_ai.api_key`, and pin workloads to `local-openai:<model>`. See [Headless without a TinyHumans account](../cloud-deploy.md#headless-without-a-tinyhumans-account).### 2. Route workloads to itdiff --git a/docs/gitbooks/en/features/native-tools/coder.md b/docs/gitbooks/en/features/native-tools/coder.mdindex 1de3519181..5cc62ebf09 100644--- a/docs/gitbooks/en/features/native-tools/coder.md+++ b/docs/gitbooks/en/features/native-tools/coder.md@@ -43,5 +43,5 @@ With the autonomy policy on, `workspace_only` confines the tools to the working## See also-- [System and utilities](system-and-utilities.md): `shell`, `node_exec`, `npm_exec` and `python_exec` for the rest of the dev loop.+- [System and utilities](system-and-utilities.md): `shell` for the rest of the dev loop, including Node.js, npm and Python commands available on the host's `PATH`.- [Agent coordination](agent-coordination.md): `todo` and `spawn_subagent` for larger refactors.diff --git a/docs/gitbooks/en/features/native-tools/documents.md b/docs/gitbooks/en/features/native-tools/documents.mdindex c8b7106880..fab356d907 100644--- a/docs/gitbooks/en/features/native-tools/documents.md+++ b/docs/gitbooks/en/features/native-tools/documents.md@@ -55,7 +55,7 @@ Nothing is written to disk during extraction, no office application is launched,## Where it runs-Document work happens in the `tinydocs` module. It is a signed native library that downloads on first use and is checked against a SHA-256 pinned in OpenHuman. The document writers and the PDF reader are not part of the app's own code in any build. With the `documents` feature off, the two tools are simply missing from the agent's list instead of failing, and a PDF attachment becomes a file reference instead of extracted text.+Document work happens in the `tinydocs` module. It is a signed native library that downloads on first use and is checked against a SHA-256 pinned in OpenHuman. The document writers, PDF and Office readers, and image inspection are not part of the app's own code in any build. With the `documents` feature off, the generation tools are absent and PDF/Office extraction and image inspection are unavailable.## See alsodiff --git a/docs/gitbooks/en/features/native-tools/memory-tools.md b/docs/gitbooks/en/features/native-tools/memory-tools.mdindex 7fe5326cc3..b35535060c 100644--- a/docs/gitbooks/en/features/native-tools/memory-tools.md+++ b/docs/gitbooks/en/features/native-tools/memory-tools.md@@ -11,16 +11,24 @@ icon: brain| --- | --- || `recall` | Ask a question. Returns an answer and the citations it rests on. || `fetch` | Raw hybrid search over stored items, optionally filtered by metadata. Returns hits. |-| `learn` | Save one durable learning: a preference, fact, procedure or correction. |-| `forget` | Remove items by id. |+| `learn` | Queue one durable learning: a preference, fact, procedure or correction. |+| `forget` | Queue removal of items by id. |The tool is registered only when a memory engine is usable. With none selected, memory is off and the agent never sees the tool. Every learning is shared with all agents under the same memory root. It is tagged with the workspace, thread, agent and tool call that produced it.## The tool and the per-turn pack-Every turn already arrives with a small [memory pack](../memory.md#how-the-agent-uses-memory) (`<memory-context>`). It holds the learnings, documents and history most relevant to what you just said.+A turn can receive a completed cached [memory pack](../memory.md#how-the-agent-uses-memory) (`<memory-context>`). A cold cache supplies none. The pack is labelled as context from an earlier background lookup and can be incomplete or unrelated to the current question. Automatic refresh and turn logging never wait on the remote engine before the model runs.-Use the tool to go further than the pack. The agent can ask a question the pack does not cover ("what do I know about the Stripe webhook?"), search with metadata filters, or save something worth remembering next time.+Use explicit `recall` or `fetch` when a current answer is needed, or to go further than the pack. The agent can ask a question the pack does not cover ("what do I know about the Stripe webhook?"), search with metadata filters, or save something worth remembering next time.++## Deadlines and queued writes++Agent memory calls have a 15-second per-call deadline, a shared 30-second budget and at most eight attempts per tracked run. Concurrent calls reserve from the same budget. If a read times out or the budget is exhausted, the tool tells the agent to continue without memory and not retry it in that run. A new run has a fresh budget.++`learn` and `forget` persist a validated, scrubbed request in a private local outbox and start background delivery. The statuses "queued; not yet saved to memory" and "queued; not yet removed from memory" confirm local acceptance only. The agent must not describe them as completed remote saves or deletions, or repeat them to force indexing. Pending delivery can resume after a restart, sign-in or background tick. Queue admission can fail when its limits are reached.++These agent-tool limits do not replace the behavior of explicit Memory-page or RPC workflows.External MCP clients get the same abilities from OpenHuman's [MCP server](../../developing/mcp-server.md) as `memory.recall`, `memory.fetch`, `memory.list`, `memory.learn` and `memory.forget`.diff --git a/docs/gitbooks/en/features/native-tools/system-and-utilities.md b/docs/gitbooks/en/features/native-tools/system-and-utilities.mdindex ee92304160..88d339c54d 100644--- a/docs/gitbooks/en/features/native-tools/system-and-utilities.md+++ b/docs/gitbooks/en/features/native-tools/system-and-utilities.md@@ -7,14 +7,13 @@ icon: gearThese are small tools the agent uses to finish a task.+Use the `shell` tool for Node.js, npm, and Python commands. OpenHuman uses the host's `node` and `python3` executables on `PATH`; install them with the platform package manager when needed.+## Tools in the family| Tool | What it does || --- | --- || `shell` | Run a shell command. Output is bounded and the exit code is captured. |-| `node_exec` | Run a Node.js snippet, useful for one-off scripting. |-| `npm_exec` | Run an `npm`, `pnpm` or `yarn` script. |-| `python_exec` | Run a Python 3 snippet or `.py` script. || `current_time` | Get the current time in any timezone, with formatting options. || `schedule` | Do something once at a given time. For recurring jobs see [Cron](cron.md). || `pushover` | Send a push notification to your devices. |diff --git a/docs/gitbooks/en/features/os-keyring-and-secret-storage.md b/docs/gitbooks/en/features/os-keyring-and-secret-storage.mdindex 69f8f5631d..a09b27e57c 100644--- a/docs/gitbooks/en/features/os-keyring-and-secret-storage.md+++ b/docs/gitbooks/en/features/os-keyring-and-secret-storage.md@@ -7,7 +7,7 @@ icon: key# OS keyring and secret storage-OpenHuman uses your operating system's secure credential store to protect the secrets that must live on your device:+The OpenHuman desktop app uses your operating system's secure credential store to protect the master key for local secrets:- **macOS:** Keychain- **Windows:** Credential Manager@@ -19,7 +19,7 @@ This is the root of trust for local secrets. OpenHuman does not keep user credenThe keyring holds two kinds of secret.-**Credential entries.** When a feature needs a local credential slot, OpenHuman stores it in the platform keyring instead of a normal config file. Examples are locally stored provider API keys, session and bearer tokens that must stay on the device, and wallet secret material where applicable. Entries sit under OpenHuman's own key namespace, so they do not collide with other apps.+**Credential entries.** In the desktop app, locally stored provider API keys, session and bearer tokens, and wallet secret material use user-scoped credential slots. By default, these slots live in the encrypted `secrets.enc` file, protected by the master key in the OS keyring. The explicit `OPENHUMAN_KEYRING_BACKEND=os` setting stores the slots directly in the platform keyring, under OpenHuman's own namespace.**The master encryption key.** Some sensitive values must live inside local files, because the app's configuration is file-based. OpenHuman splits the storage. The secret value is stored on disk as encrypted ciphertext. The master key that decrypts it lives in the OS keyring. Your config and state files can hold encrypted values without the decryption key sitting next to them.@@ -75,9 +75,52 @@ Auth profiles, config secrets, the wallet mnemonic and the `secrets.enc` backend| `ConsentRequired` | The keyring is unavailable and there is no consent yet. Block and prompt. || `Declined` | You refused local storage. Skip the secret operation. |-## Platform note--This page describes the desktop app (Tauri) on macOS, Windows and Linux. Development and test environments may use test-specific overrides so automated runs do not need an interactive keychain. That is a developer convenience, not the end-user security model.+## Embedded and server hosts++Desktop, CLI and TUI hosts install the OS keychain providers through+`openhuman-rpc`'s `os-keyring` feature before starting the core. The service+name (`openhuman`) and master-key account (`app:master_key`) are unchanged,+so existing desktop workspaces continue to decrypt with the same key.++The core owns the platform-independent `security::secret_storage` module:+user-scoped secret access, encrypted files, and master-key resolution. RPC owns+`keyring`, the native OS providers, and installs them through core's `SecretBackend`+and `MasterKeySource` contracts.++The core and embedded library default to `MemoryBackend`: a thread-safe,+unencrypted map held only in the process. It needs no OS keychain, master key,+or secrets file. Secrets disappear when the process exits. Use it for ephemeral+library runtimes; choose persistent storage when credentials must survive a restart.++Embedders can install a provider before boot through+`openhuman_embed::secret_storage::install_secret_backend(Arc::new(provider))`.+The same facade exposes `MemoryBackend`, `EncryptedFileBackend`, `SecretBackend`+and `SecretStorageError`. The provider is process-wide, matching the one-runtime+contract; install it before building the runtime.++CLI, desktop and TUI hosts explicitly retain encrypted-file storage by default.+With native support enabled, its master key stays in the OS keychain. A host+without that support creates `{workspace}/keyring/master.key` instead (Unix mode+`0600`). Back up that key with the workspace.++`OPENHUMAN_KEYRING_BACKEND=memory` selects the basic volatile backend explicitly;+`file` selects the plaintext debug file, `encrypted_file` selects persistent+encrypted storage, and `os` requires RPC's native provider. Installed providers+win over environment selection.++For encrypted storage, an operator can supply `OPENHUMAN_KEYRING_MASTER_KEY`+(64 hex characters) or `OPENHUMAN_KEYRING_MASTER_KEY_FILE`. Set exactly one.+Environment keys take precedence over a host source, then the workspace key file.+An inaccessible host key never falls back to a newly created file key.++### Moving a desktop workspace to a server++A desktop workspace encrypted with an OS keychain key needs that same key+when opened by a host without OS keychain support. Supply it through the+master-key environment or file option before boot. A newly generated+workspace key cannot decrypt the desktop ciphertext. Unreadable+`secrets.enc` files are quarantined as `secrets.enc.corrupt.<timestamp>`+for recovery rather than overwritten; keep the original key and backups.## See alsodiff --git a/docs/gitbooks/en/features/privacy-and-security.md b/docs/gitbooks/en/features/privacy-and-security.mdindex f7b7d4100e..9a3381b7d4 100644--- a/docs/gitbooks/en/features/privacy-and-security.md+++ b/docs/gitbooks/en/features/privacy-and-security.md@@ -25,8 +25,8 @@ Your workspace files, settings and audio buffers stay on your machine. Your memo| Item | Where it lives || --- | --- |-| Memory items | Not local with hosted memory. They are stored in CortexDB by your selected engine (see below). A CortexDB you host on your own machine keeps them there. |-| Memory bookkeeping | Local: the job queue and sync, backfill and import progress under `<workspace>/memory/`, the sources list in `config.toml`, and a CortexDB key in the OS keychain. No memory content. |+| Committed memory items | Stored in CortexDB by your selected engine (see below). A CortexDB you host on your own machine keeps them there. Pending agent writes are held locally until delivery. |+| Memory bookkeeping and pending writes | Local: scrubbed agent `learn`/`forget` requests await delivery in a private outbox under `<workspace>/memory/`, alongside job queues and sync, backfill and import progress. Sources are listed in `config.toml`; the CortexDB key is kept in the OS keychain. Automatic context packs stay in process memory briefly. || Audio capture buffers | Local. Discarded after speech-to-text. || Local model state | Local. |diff --git a/docs/gitbooks/en/features/token-compression.md b/docs/gitbooks/en/features/token-compression.mdindex 8c1a1b8dc4..9ae26e57bf 100644--- a/docs/gitbooks/en/features/token-compression.md+++ b/docs/gitbooks/en/features/token-compression.md@@ -9,11 +9,11 @@ icon: file-zipperLLM tokens cost money, and verbose tool output wastes most of them. A `git status` in a busy repo, a `cargo build` log, a 600-message email thread and a `docker ps -a` against a real cluster can each fill a context window for almost no information.-OpenHuman ships with TokenJuice, a compression router built into the agent's tool-execution path. Before a tool result reaches a model, TokenJuice classifies it, sends it to a specialized compressor, optionally stores the full original in a recoverable cache, and records how many tokens and dollars it saved. The compression engine is the TinyJuice library, vendored in OpenHuman. The command and log rules come from [vincentkoc/tokenjuice](https://github.com/vincentkoc/tokenjuice).+OpenHuman ships with TokenJuice, a compression router in the agent's tool-execution path. Before a tool result reaches a model, the compiled TinyJuice module classifies it, selects a compressor, stores recoverable originals in its CCR cache when needed, and returns the compacted result. The module owns compression, CCR retrieval and querying, HTML extraction, and the schemas and request/result types in `tinyjuice-bus`. OpenHuman supplies configuration, filesystem authorization, turn-bound model calls, and savings attribution. The command and log rules come from [vincentkoc/tokenjuice](https://github.com/vincentkoc/tokenjuice).## The pipeline-Every tool result takes the same path through the TinyJuice router (`vendor/tinyjuice/src/compress.rs`):+Every tool result takes the same path through the TinyJuice module's router:```textraw tool result@@ -70,7 +70,7 @@ Multi-byte text (CJK, emoji, combining marks) is handled grapheme by grapheme an## Handle preview and the juice tools (default)-Compaction is on by default. For a result of at least `ccr_min_tokens`, the router does not compress to one blob. It stores the original in the CCR cache and shows the model a small preview instead:+Compaction is on by default. For a result of at least `ccr_min_tokens`, the module stores the original in its CCR cache and shows the model a small preview instead of compressing to one blob:- a one-line stats description of the shape (estimated tokens, bytes, lines, JSON keys or a Markdown outline, never values),- the first 500 characters,@@ -85,15 +85,17 @@ The model then queries the stored original with three read-only tools, none of w| `juice_extract` | Links or headings from HTML or Markdown output. || `juice_summarize` | Size, outline or JSON shape, then head and tail, or the parts most relevant to a `hint`. |-Answers are size-capped, and an unknown or evicted handle is an error. `juice_retrieve` still returns the whole original. A handle preview is built without a model call, so it also replaces the LLM summary for results big enough to get one. A slow summarizer cannot stall the turn. The three tools are registered (about 1.5 KB of schema) only while this mode is on.+Answers are size-capped, and an unknown or evicted handle is an error. `juice_retrieve` still returns the whole original. A handle preview is built without a model call, so it also replaces the LLM summary for results big enough to get one. A slow summarizer cannot stall the turn. The three read-only tools are declared by `tinyjuice-bus` and registered for new sessions while this mode is on; resumed sessions keep the declarations recorded in their transcript. Their host adapters send typed queries to the module; they do not read the module cache or repeat its query algorithms locally. For an artifact path, OpenHuman first applies its normal path and size checks, then sends the authorized content to the module without sending the path.++The model's tool catalogue is recorded with each conversation and stays frozen when that thread resumes. If the transcript contains Juice tools, OpenHuman restores their recorded names and schemas even when current settings would not create new handles. The restored tools still use current host path authorization and module policy. A disabled or unavailable module returns an explicit unavailable result for a query; OpenHuman does not substitute a local CCR store or query implementation. Optional output compaction keeps its existing fail-open behavior and returns the unmodified result when the module cannot compact it.To turn off the whole feature, set `context.compaction_enabled = false` or `OPENHUMAN_COMPACTION=0`. To keep compaction but go back to one-blob compression and `juice_retrieve`, set `tokenjuice.repl_handle_enabled = false` (`OPENHUMAN_TOKENJUICE_REPL_HANDLE_ENABLED=0`). Set `tokenjuice.repl_save_enabled = true` to also write each stored original to `<workspace>/.tokenjuice/repl/<handle>.txt` (mode 0600) so an agent can script over it. That puts raw tool output on disk, and nothing prunes it.## Nothing is lost: the CCR cache-Lossy compression normally throws data away. TokenJuice instead stores the full original in the CCR store and leaves a breadcrumb (`vendor/tinyjuice/src/cache/`).+Lossy compression normally throws data away. TinyJuice instead stores the full original in the module-owned CCR store and leaves a breadcrumb.-- **In-memory tier** (always on): a process-wide store keyed by SHA-256 hash, bounded by entry count (`max_cache_entries`, default 256) and total bytes (`max_cache_bytes`, default 64 MiB), with FIFO eviction.+- **In-memory tier** (always on): the module's store is keyed by SHA-256 hash and bounded by entry count (`max_cache_entries`, default 256) and total bytes (`max_cache_bytes`, default 64 MiB), with FIFO eviction.- **On-disk tier** (optional): `<workspace>/.tokenjuice/ccr/`, enabled with `ccr_disk_enabled`. It survives memory eviction. Set an optional TTL with `ccr_ttl_secs`.- **The marker:** compacted output ends with a footer like `[compacted tool output: PARTIAL view; full original available via juice_retrieve with token "…"]` carrying the `⟦tj:<hash>⟧` token.- **Retrieval tool:** the agent calls the read-only `juice_retrieve` tool with that token (optionally a byte or line `range`) to get the full original or a slice. The token is an unguessable SHA-256 digest.diff --git a/vendor/tinyconnectors b/vendor/tinyconnectorsindex 14fa2a783a..b8ef2343de 160000--- a/vendor/tinyconnectors+++ b/vendor/tinyconnectors@@ -1 +1 @@-Subproject commit 14fa2a783aa8714cade5069ba55ee745045bf9a0+Subproject commit b8ef2343defb9f3784d2b5a280e29fc1388b31b0diff --git a/vendor/tinydocs b/vendor/tinydocsindex 7618cfbfbd..6b238d6ea7 160000--- a/vendor/tinydocs+++ b/vendor/tinydocs@@ -1 +1 @@-Subproject commit 7618cfbfbdb26772035e16ff40e9c4b149c487af+Subproject commit 6b238d6ea7cb9af77c1e413fb953a2c4e69d8a48diff --git a/vendor/tinyflows b/vendor/tinyflowsindex 4c6afb78bc..64476125ae 160000--- a/vendor/tinyflows+++ b/vendor/tinyflows@@ -1 +1 @@-Subproject commit 4c6afb78bc6cdbb2fb6d6b38fbdf75d5f842b519+Subproject commit 64476125ae506886a9febb0df3b3c2c250d2a689diff --git a/vendor/tinyhosts b/vendor/tinyhostsindex 9500310c14..6fdf49b78c 160000--- a/vendor/tinyhosts+++ b/vendor/tinyhosts@@ -1 +1 @@-Subproject commit 9500310c1493e6b5819efc12169425a091813299+Subproject commit 6fdf49b78c41f0d8c4fe43dd7f6ed1077ee3f1aadiff --git a/vendor/tinyhumans-sdk b/vendor/tinyhumans-sdkindex 590ee32c18..4f516fa9a7 160000--- a/vendor/tinyhumans-sdk+++ b/vendor/tinyhumans-sdk@@ -1 +1 @@-Subproject commit 590ee32c18fb4f7199d22ce0b9278ccdba09e52b+Subproject commit 4f516fa9a75a01f7091fe3b75d0a2abe7bd3e5eediff --git a/vendor/tinyjuice b/vendor/tinyjuiceindex 7c74c0f39c..3e2e829f50 160000--- a/vendor/tinyjuice+++ b/vendor/tinyjuice@@ -1 +1 @@-Subproject commit 7c74c0f39ccfd8b7914bde016e3e06afb1df7289+Subproject commit 3e2e829f5011a0dfd1eabd6ffd0696e9bd087f0e