Skip to content

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

docs(gitbooks): clean up the GitBook pages and mirror them into docs/gitbooks/en

Steven Enamakela424e94f0d94
diff --git a/docs/gitbooks/en/.gitbook/assets/benchmarks/swe-x86-1-dark.png b/docs/gitbooks/en/.gitbook/assets/benchmarks/swe-x86-1-dark.png
new file mode 100644
index 0000000000..7e12cb720c
Binary files /dev/null and b/docs/gitbooks/en/.gitbook/assets/benchmarks/swe-x86-1-dark.png differ
diff --git a/docs/gitbooks/en/.gitbook/assets/benchmarks/swe-x86-1.png b/docs/gitbooks/en/.gitbook/assets/benchmarks/swe-x86-1.png
new file mode 100644
index 0000000000..5668907d73
Binary files /dev/null and b/docs/gitbooks/en/.gitbook/assets/benchmarks/swe-x86-1.png differ
diff --git a/docs/gitbooks/en/README.md b/docs/gitbooks/en/README.md
index 807de16705..4b16f884c3 100644
--- a/docs/gitbooks/en/README.md
+++ b/docs/gitbooks/en/README.md
@@ -1,8 +1,7 @@
---
description: >-
- Personal AI super intelligence for your desktop: a brain that builds a
- persistent memory of your life, an orchestrator of agent fleets and workflows,
- and a deep researcher across the services you conn
+ An open-source AI assistant for your desktop with a persistent memory of your
+ life, agent fleets and workflows, and a Rust core small enough to embed.
icon: diamond
---
@@ -10,29 +9,31 @@ icon: diamond
<figure><img src=".gitbook/assets/demo.png" alt=""><figcaption></figcaption></figure>
-OpenHuman is an open-source AI assistant built to be three things most assistants aren't: **a brain** (a persistent, local, readable memory of your world); **an orchestrator** (durable agent graphs, visual workflows, sub-agent fleets, and [end-to-end encrypted agent-to-agent sessions](features/orchestration.md)); and **a deep researcher** (it sweeps your data and the web before you finish asking). It's built on a Rust core wrapped in a Tauri desktop shell, and licensed under GNU GPL3. The source is at [github.com/tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman).
+OpenHuman is an open-source AI assistant for your desktop. It is built to be three things most assistants are not. It is a brain, with a persistent, local, readable memory of your world. It is an orchestrator, with durable agent graphs, visual workflows, sub-agent fleets and [end-to-end encrypted agent-to-agent sessions](features/orchestration.md). And it is a deep researcher, sweeping your data and the web before you finish asking.
-Every model in the world, all 200+ of them, shares the same fundamental limitation: they are stateless. You type a prompt, get a response, and the context evaporates. Even the ones with "memory" store a few bullet points. A few bullet points is a sticky note, not intelligence.
+It runs on a Rust core inside a Tauri desktop shell and is licensed under GNU GPL3. The source is at [github.com/tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman).
-OpenHuman solves this with a stack that's calmly, deliberately different:
+Most language models are stateless. You send a prompt, get a reply, and the context is gone. Even assistants with "memory" keep a few bullet points, which is a sticky note and not understanding. OpenHuman takes a different approach.
-* [**Memory you choose and can inspect**](features/memory.md)**.** Documents (folders, files, links, GitHub, RSS, connected apps), conversations and learnings are stored in a memory engine, either hosted TinyHumans or your own CortexDB. The agent asks it questions with citations, and a short brief about you opens every new chat. You can see and delete everything stored.
-* [**Third-party integrations**](features/integrations/)**.** One-click OAuth into Gmail, GitHub, Slack, Notion, Stripe, Calendar, Drive, Linear, Jira and more, across the 119 managed-auth toolkits the app knows about, with no API keys to wire by hand and no plugin marketplace to navigate.
-* **An agent built for big data.** [Smart token compression (TokenJuice)](features/token-compression.md) compacts verbose tool output before it ever enters the model's context, so sweeping through your last six months of email costs single-digit dollars. [Automatic model routing](features/model-routing/) sends each task to the right model, `hint:reasoning` to a frontier model, `hint:fast` to a cheap one, vision to vision, all under one subscription and one TinyHumans API key. Optional [local AI via Ollama or LM Studio](features/model-routing/local-ai.md) keeps supported workloads on-device, and every LLM, embedding, memory, and web search engine underneath is swappable through config rather than code.
-* **Fast, cheap decisions.** Before an agent burns a full model call choosing which of dozens of tools to use, a small classifier called Jev scores the options and answers in about 150 milliseconds instead of generating text. It shortlists tools, decides whether a tool is needed at all, and drives routine browser steps, so the expensive model gets called for the things that actually need it.
-* [**Batteries included**](features/native-tools/)**.** A complete agent toolbelt is wired in by default: [web search](features/native-tools/web-search.md), a [web-fetch scraper](features/native-tools/web-scraper.md), a full [coder toolset](features/native-tools/coder.md) (filesystem, git, lint, test, grep), [browser & computer control](features/native-tools/browser-and-computer.md), [cron & scheduling](features/native-tools/cron.md), [memory tools](features/native-tools/memory-tools.md), [agent coordination](features/native-tools/agent-coordination.md) for spawning sub-agents, and [native voice](features/native-tools/voice.md), STT in, TTS out, mascot lip-sync, and a live voice agent you can interrupt mid-sentence. No "install a plugin to read files" friction.
-* [**Workflows**](features/workflows.md)**.** Durable, visual automations on the open-source tinyflows engine. Describe the automation in chat, the agent proposes a workflow graph, you review it on a canvas and save it. Flows fire on schedules or live app events, pause at approval gates, and resume exactly where they stopped, with full step-by-step run history.
-* [**A harness that finishes the job**](developing/architecture/agent-harness.md)**.** Every turn runs on the open-source tinyagents graph engine: durable checkpointing (sub-agents pause for your input and resume, instead of dying), a no-progress circuit breaker that stops identical-call loops and hands back a root-cause summary, classified tool failures rendered as actionable timeline cards, and durable, replayable run journals with per-call token and cost accounting.
-* **Light enough to run in-process.** The Rust core that powers all of this runs in the same process as the desktop app rather than as a bag of background services: we've measured 500 agents alive in one process at about 1.77 MiB of marginal memory each, and thousands of agents on a single box is the direction it's heading. The same core ships as a library ([`crates/openhuman-embed`](../../../../../crates/openhuman-embed/), with a [one-key setup](developing/tinyhumans-api-key.md)), so another product can boot a runtime and add agents to it in a few lines of Rust. See [Performance](developing/performance.md) (with the public [benchmarks repo](https://github.com/tinyhumansai/openhuman-benchmarks)), [Pluggable engines](developing/engines.md), and [Embedding OpenHuman](developing/embedding.md) if you're building on top of it.
-* [**Privacy Mode**](features/privacy-and-security/privacy-mode.md)**.** One switch, enforced in the Rust core: local-only mode structurally blocks every cloud model call and permits only on-device runtimes (Ollama, LM Studio, MLX, local OpenAI-compatible).
-* **Simple, UI-first.** A clean desktop experience and short onboarding paths take you from install to a working agent in a few clicks, no config-first setup, no terminal required. The agent has [a face](features/mascot.md): a desktop mascot that speaks, reacts to its surroundings, remembers you across weeks, and keeps thinking in the background even when you've stopped typing.
+## What you get
-Together, these turn OpenHuman into something fundamentally different from a chatbot. It is an AI agent that consumes large amounts of personal data at low cost, maintains a persistent and evolving understanding of your world, and takes proactive actions on your behalf.
+- [**Memory you can inspect.**](features/memory.md) Documents (folders, files, links, GitHub, RSS, connected apps), conversations and learnings go into a memory engine, either hosted by TinyHumans or your own CortexDB. The agent answers from it with citations, and a short brief about you opens every new chat. You can see and delete everything stored.
+- [**Third-party integrations.**](features/integrations/README.md) One-click OAuth into Gmail, GitHub, Slack, Notion, Stripe, Calendar, Drive, Linear, Jira and more, across 119 managed toolkits. You do not wire API keys by hand.
+- **An agent built for big data.** [Token compression](features/token-compression.md) shrinks verbose tool output before it reaches the model, so sweeping through six months of email costs single-digit dollars. [Automatic model routing](features/model-routing/README.md) sends each task to the right model under one subscription and one TinyHumans API key. Optional [local AI through Ollama or LM Studio](features/model-routing/local-ai.md) keeps supported work on your device. Every model, embedding, memory and web-search engine is swappable through config.
+- **Fast, cheap decisions.** Before an agent spends a full model call choosing between dozens of tools, a small classifier called Jev scores the options in about 150 milliseconds. It shortlists tools, decides whether any tool is needed, and drives routine browser steps. The expensive model runs only when a task needs it.
+- [**Batteries included.**](features/native-tools/README.md) The default toolbelt has [web search](features/native-tools/web-search.md), a [web scraper](features/native-tools/web-scraper.md), a [coder toolset](features/native-tools/coder.md) (filesystem, git, lint, test, grep), [browser and computer control](features/native-tools/browser-and-computer.md), [cron and scheduling](features/native-tools/cron.md), [memory tools](features/native-tools/memory-tools.md), [agent coordination](features/native-tools/agent-coordination.md) for sub-agents, and [native voice](features/native-tools/voice.md) with speech in, speech out and a live voice agent you can interrupt.
+- [**Workflows.**](features/workflows.md) Describe an automation in chat. The agent proposes a workflow graph, you review it on a canvas and save it. Flows run on schedules or app events, pause at approval gates, resume where they stopped, and keep a step-by-step run history.
+- [**A harness that finishes the job.**](developing/architecture/agent-harness.md) Every turn is checkpointed, so sub-agents pause for your input and resume instead of dying. A circuit breaker stops loops of identical calls and hands back a root-cause summary. Tool failures show up as actionable cards, and every run has a replayable journal with per-call token and cost accounting.
+- **Light enough to run in-process.** The Rust core runs inside the desktop app rather than as background services. We measured 500 agents alive in one process at about 1.77 MiB of marginal memory each. The same core ships as a library ([`crates/openhuman-embed`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-embed), with a [one-key setup](developing/tinyhumans-api-key.md)), so another product can boot a runtime and add agents in a few lines of Rust. See [Performance](developing/performance.md), the public [benchmarks repo](https://github.com/tinyhumansai/openhuman-benchmarks), [Pluggable engines](developing/engines.md) and [Embedding OpenHuman](developing/embedding.md).
+- [**Privacy Mode.**](features/privacy-mode.md) One switch, enforced in the Rust core. Local-only mode blocks every cloud model call and allows only on-device runtimes (Ollama, LM Studio, MLX, or a local OpenAI-compatible server).
+- **Simple and UI-first.** Short onboarding takes you from install to a working agent in a few clicks, with no terminal needed. The agent has [a face](features/mascot/README.md): a desktop mascot that speaks, reacts to its surroundings, remembers you across weeks and keeps thinking in the background.
+
+Together, these make OpenHuman more than a chatbot. It takes in large amounts of personal data at low cost, keeps an evolving understanding of your world, and acts on your behalf.
{% hint style="warning" %}
-OpenHuman is not AGI. But it is a meaningful architectural step closer, with better memory, better orchestration, and better tooling.
+OpenHuman is not AGI. It is a step in that direction, with better memory, orchestration and tooling.
{% endhint %}
## For developers
-Building on or contributing to OpenHuman? Start with [Getting set up](developing/getting-set-up.md), then [Building the Rust core](developing/building-rust-core.md) and the [Architecture](developing/architecture/) overview. To use the core from your own Rust product, read [Embedding OpenHuman](developing/embedding.md) and [One TinyHumans API key](developing/tinyhumans-api-key.md). [Loadable modules](developing/loadable-modules.md) covers the native module system, and [Performance and footprint](developing/performance.md) has the numbers; the benchmark rig and results are public at [tinyhumansai/openhuman-benchmarks](https://github.com/tinyhumansai/openhuman-benchmarks).
+Start with [Getting set up](developing/getting-set-up.md), then [Building the Rust core](developing/building-rust-core.md) and the [Architecture](developing/architecture/README.md) overview. To use the core from your own Rust product, read [Embedding OpenHuman](developing/embedding.md) and [One TinyHumans API key](developing/tinyhumans-api-key.md). [Loadable modules](developing/loadable-modules.md) covers the native module system, and [Performance and footprint](developing/performance.md) has the numbers. The benchmark rig and results are public at [tinyhumansai/openhuman-benchmarks](https://github.com/tinyhumansai/openhuman-benchmarks).
diff --git a/docs/gitbooks/en/SUMMARY.md b/docs/gitbooks/en/SUMMARY.md
index 15d859c595..7d0311fe27 100644
--- a/docs/gitbooks/en/SUMMARY.md
+++ b/docs/gitbooks/en/SUMMARY.md
@@ -2,104 +2,104 @@
## Overview
-* [Welcome to OpenHuman](README.md)
-* [Getting Started](overview/getting-started.md)
-* [Roadmap](overview/roadmap.md)
-* [Auto-update](overview/auto-update.md)
-* [Troubleshooting Sign-In](overview/troubleshooting-sign-in.md)
+- [Welcome to OpenHuman](README.md)
+- [Getting Started](overview/getting-started.md)
+- [Roadmap](overview/roadmap.md)
+- [Auto-update](overview/auto-update.md)
+- [Troubleshooting Sign-In](overview/troubleshooting-sign-in.md)
## Guides
-* [Guides](guides/guides/README.md)
- * [Create my personal AI assistant](guides/guides/personal-assistant.md)
- * [Use OpenHuman with a local model](guides/guides/local-model.md)
- * [Use multiple local LLM servers](guides/guides/multiple-local-llm-servers.md)
- * [Keep sensitive data private](guides/guides/privacy-sensitive-data.md)
- * [Recover from a failed installation](guides/guides/recover-failed-installation.md)
- * [Move OpenHuman to a new PC](guides/guides/move-to-new-pc.md)
- * [Organize my project folders](guides/guides/organize-project-folders.md)
- * [Create a doctor-specific assistant](guides/guides/doctor-assistant.md)
- * [Create a safe companion for a child](guides/guides/child-safe-companion.md)
+- [Guides](guides/README.md)
+ - [Create my personal AI assistant](guides/personal-assistant.md)
+ - [Use OpenHuman with a local model](guides/local-model.md)
+ - [Use multiple local LLM servers](guides/multiple-local-llm-servers.md)
+ - [Keep sensitive data private](guides/privacy-sensitive-data.md)
+ - [Recover from a failed installation](guides/recover-failed-installation.md)
+ - [Move OpenHuman to a new PC](guides/move-to-new-pc.md)
+ - [Organize my project folders](guides/organize-project-folders.md)
+ - [Create a doctor-specific assistant](guides/doctor-assistant.md)
+ - [Create a safe companion for a child](guides/child-safe-companion.md)
## Features
-* [Chat](features/chat.md)
-* [Memory](features/memory.md)
-* [Connections](features/connections.md)
-* [Settings](features/settings.md)
-* [The Mascot](features/mascot.md)
-* [Third-party Integrations](features/integrations/README.md)
- * [Triggers](features/integrations/triggers.md)
- * [MCP Servers & Skills](features/integrations/mcp-and-skills.md)
-* [The Orchestrator](features/orchestration.md)
-* [Workflows](features/workflows.md)
-* [Messaging Channels](features/channels.md)
-* [Goals & Todos](features/goals-and-todos.md)
-* [Personalization & Self-Learning](features/personalization.md)
-* [Themes & Theme Studio](features/theming.md)
-* [Smart Token Compression](features/token-compression.md)
-* [Automatic Model Routing](features/model-routing/README.md)
- * [Local models & bring your own key](features/model-routing/local-and-byok-models.md)
- * [Local AI (optional)](features/model-routing/local-ai.md)
-* [Native Tools](features/native-tools/README.md)
- * [Web Search](features/native-tools/web-search.md)
- * [Web Scraper](features/native-tools/web-scraper.md)
- * [Coder](features/native-tools/coder.md)
- * [Documents](features/native-tools/documents.md)
- * [Image Tools](features/native-tools/image-tools.md)
- * [Image & Video Generation](features/native-tools/media-generation.md)
- * [Browser & Computer Control](features/native-tools/browser-and-computer.md)
- * [Cron & Scheduling](features/native-tools/cron.md)
- * [Voice](features/native-tools/voice.md)
- * [Memory Tools](features/native-tools/memory-tools.md)
- * [Third-party Integrations](features/native-tools/integrations.md)
- * [Agent Coordination](features/native-tools/agent-coordination.md)
- * [System & Utilities](features/native-tools/system-and-utilities.md)
-* [Notifications & Activity](features/notifications-and-activity.md)
-* [Wallet](features/wallet.md)
-* [Hosting](features/hosting.md)
-* [Billing, Cost & Usage](features/billing-and-usage.md)
-* [iOS Companion](features/ios-companion.md)
-* [Approval Gate](features/approval-gate.md)
-* [Privacy & Security](features/privacy-and-security/README.md)
- * [Privacy Mode](features/privacy-and-security/privacy-mode.md)
- * [OS Keyring & Secret Storage](features/privacy-and-security/os-keyring-and-secret-storage.md)
-* [Platform & Availability](features/platform.md)
-* [Cloud Deploy](features/cloud-deploy.md)
+- [Chat](features/chat.md)
+- [Memory](features/memory.md)
+- [Connections](features/connections.md)
+- [Settings](features/settings.md)
+- [The Mascot](features/mascot/README.md)
+- [Third-party Integrations](features/integrations/README.md)
+ - [Triggers](features/integrations/triggers.md)
+ - [MCP Servers & Skills](features/integrations/mcp-and-skills.md)
+- [The Orchestrator](features/orchestration.md)
+- [Workflows](features/workflows.md)
+- [Messaging Channels](features/channels.md)
+- [Goals & Todos](features/goals-and-todos.md)
+- [Personalization & Self-Learning](features/personalization.md)
+- [Themes & Theme Studio](features/theming.md)
+- [Smart Token Compression](features/token-compression.md)
+- [Automatic Model Routing](features/model-routing/README.md)
+ - [Local models & bring your own key](features/model-routing/local-and-byok-models.md)
+ - [Local AI (optional)](features/model-routing/local-ai.md)
+- [Native Tools](features/native-tools/README.md)
+ - [Web Search](features/native-tools/web-search.md)
+ - [Web Scraper](features/native-tools/web-scraper.md)
+ - [Coder](features/native-tools/coder.md)
+ - [Documents](features/native-tools/documents.md)
+ - [Image Tools](features/native-tools/image-tools.md)
+ - [Image & Video Generation](features/native-tools/media-generation.md)
+ - [Browser & Computer Control](features/native-tools/browser-and-computer.md)
+ - [Cron & Scheduling](features/native-tools/cron.md)
+ - [Voice](features/native-tools/voice.md)
+ - [Memory Tools](features/native-tools/memory-tools.md)
+ - [Third-party Integrations](features/native-tools/integrations.md)
+ - [Agent Coordination](features/native-tools/agent-coordination.md)
+ - [System & Utilities](features/native-tools/system-and-utilities.md)
+- [Notifications & Activity](features/notifications-and-activity.md)
+- [Wallet](features/wallet.md)
+- [Hosting](features/hosting.md)
+- [Billing, Cost & Usage](features/billing-and-usage.md)
+- [iOS Companion](features/ios-companion.md)
+- [Approval Gate](features/approval-gate.md)
+- [Privacy & Security](features/privacy-and-security.md)
+ - [Privacy Mode](features/privacy-mode.md)
+ - [OS Keyring & Secret Storage](features/os-keyring-and-secret-storage.md)
+- [Platform & Availability](features/platform.md)
+- [Cloud Deploy](features/cloud-deploy.md)
## Developing
-* [Overview](developing/developing.md)
-* [Rust Quickstart](developing/quickstart.md)
-* [Getting Set Up](developing/getting-set-up.md)
-* [Architecture](developing/architecture/README.md)
- * [Deep Architecture Reference](developing/architecture/architecture.md)
- * [Agent Harness](developing/architecture/agent-harness.md)
- * [Flows on TinyAgents](developing/architecture/flows-on-tinyagents.md)
- * [Memory](developing/architecture/memory.md)
- * [MCP Registry](developing/architecture/mcp-registry.md)
- * [Security](developing/architecture/security.md)
- * [Frontend](developing/architecture/frontend.md)
- * [Tauri Shell](developing/architecture/tauri-shell.md)
-* [Building the Rust Core](developing/building-rust-core.md)
-* [Loadable modules](developing/loadable-modules.md)
-* [Performance and footprint](developing/performance.md)
-* [Pluggable engines](developing/engines.md)
-* [Jev](developing/jev.md)
-* [Embedding OpenHuman](developing/embedding.md)
-* [One TinyHumans API key](developing/tinyhumans-api-key.md)
-* [Hooks](developing/hooks.md)
-* [MCP Server](developing/mcp-server.md)
-* [Claude Code CLI provider](developing/claude-code.md)
-* [Theming (Token System)](developing/theming.md)
-* [Testing Strategy](developing/testing-strategy.md)
-* [E2E Testing](developing/e2e-testing.md)
-* [Agent Observability](developing/agent-observability.md)
-* [Release Policy](developing/release-policy.md)
-* [AgentBox marketplace deployment (historical)](developing/agentbox-deployment.md)
-* [Chromium Embedded Framework (historical)](developing/cef.md)
+- [Overview](developing/README.md)
+- [Rust Quickstart](developing/quickstart.md)
+- [Getting Set Up](developing/getting-set-up.md)
+- [Architecture](developing/architecture/README.md)
+ - [Deep Architecture Reference](developing/architecture.md)
+ - [Agent Harness](developing/architecture/agent-harness.md)
+ - [Flows on TinyAgents](developing/architecture/flows-on-tinyagents.md)
+ - [Memory](developing/architecture/memory.md)
+ - [MCP Registry](developing/architecture/mcp-registry.md)
+ - [Security](developing/architecture/security.md)
+ - [Frontend](developing/architecture/frontend.md)
+ - [Tauri Shell](developing/architecture/tauri-shell.md)
+- [Building the Rust Core](developing/building-rust-core.md)
+- [Loadable modules](developing/loadable-modules.md)
+- [Performance and footprint](developing/performance.md)
+- [Pluggable engines](developing/engines.md)
+- [Jev](developing/jev.md)
+- [Embedding OpenHuman](developing/embedding.md)
+- [One TinyHumans API key](developing/tinyhumans-api-key.md)
+- [Hooks](developing/hooks.md)
+- [MCP Server](developing/mcp-server.md)
+- [Claude Code CLI provider](developing/providers/claude-code.md)
+- [Theming (Token System)](developing/theming.md)
+- [Testing Strategy](developing/testing-strategy.md)
+- [E2E Testing](developing/e2e-testing.md)
+- [Agent Observability](developing/agent-observability.md)
+- [Release Policy](developing/release-policy.md)
+- [AgentBox marketplace deployment (historical)](developing/agentbox-deployment.md)
+- [Chromium Embedded Framework (historical)](developing/cef.md)
## Legal
-* [Terms & Conditions](legal/terms-of-use.md)
-* [Privacy Policy](legal/privacy-policy.md)
+- [Terms & Conditions](legal/terms-of-use.md)
+- [Privacy Policy](legal/privacy-policy.md)
diff --git a/docs/gitbooks/en/developing/README.md b/docs/gitbooks/en/developing/README.md
new file mode 100644
index 0000000000..a3fd3e92c1
--- /dev/null
+++ b/docs/gitbooks/en/developing/README.md
@@ -0,0 +1,91 @@
+---
+description: Build, run, test and ship OpenHuman from source.
+icon: code-branch
+---
+
+# Overview
+
+OpenHuman is open source under GPLv3 at [github.com/tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman). This section is for contributors and anyone running OpenHuman from source.
+
+If you just want to use the app, start with [Getting started](../overview/getting-started.md). If you want to read the architecture, build a feature or land a PR, you are in the right place.
+
+---
+
+## Why the harness is light
+
+The core is a Rust library, not a set of services talking over sockets. Agents run in-process, so a turn costs a function call instead of a process boundary or an RPC hop. We measured 500 agents alive at once in one process at roughly 1.77 MiB of marginal memory each. A cold agent turn takes about 100 ms, and a stripped build with only the domains you need can be as small as 51 MiB. [Performance](performance.md) has the numbers and how we got them. The rig that produces them is public at [tinyhumansai/openhuman-benchmarks](https://github.com/tinyhumansai/openhuman-benchmarks).
+
+Everything above that floor is modular. Cargo feature gates decide what compiles in, loadable native modules carry the heavier engines, and config chooses the engines themselves: model providers, embeddings, memory and search. [Pluggable engines](engines.md), [Loadable modules](loadable-modules.md) and [Jev](jev.md) cover that.
+
+## Where things live
+
+| Path | What is there |
+| ----------- | ------------- |
+| `app/` | The pnpm workspace `openhuman-app`: the Vite and React frontend ([`app/src/`](https://github.com/tinyhumansai/openhuman/tree/main/app/src)) and the Tauri desktop host ([`crates/openhuman-app/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-app)). |
+| `crates/` | Rust crates ([overview](https://github.com/tinyhumansai/openhuman/blob/main/crates/README.md)). Six are workspace members. `openhuman-core` (package `openhuman`) is the core library, with domains under `src/<domain>/` and the controller contract and in-process dispatch under `src/core/`. It has no binary and no JSON-RPC server. `openhuman-rpc` is JSON-RPC 2.0 over the core: envelopes, HTTP client and server. `openhuman-embed` is the typed library facade. `openhuman-tinyhumans` is the only crate that may depend on `tinyhumans-sdk`, and holds the backend transport, hosted RPC proxies and host-side session owner. Every host installs it first. `openhuman-cli` is the `openhuman-core` binary plus every root `tests/` and `examples/` target. `openhuman-tui` is the terminal frontend. The Tauri host, `openhuman-app`, is excluded from the root workspace and builds from its own manifest. |
+| `gitbooks/` | This site, the public docs ([source](https://github.com/tinyhumansai/openhuman/tree/main/gitbooks)). |
+| `docs/` | Internal maintainer docs: test-coverage matrix, release smoke checklist, library benchmarking and minimal-recipe notes, translated READMEs and `community/` ([`docs/`](https://github.com/tinyhumansai/openhuman/tree/main/docs)). |
+
+[`AGENTS.md`](https://github.com/tinyhumansai/openhuman/blob/main/AGENTS.md) at the repo root is the source of truth for AI agents working on the codebase. [`CLAUDE.md`](https://github.com/tinyhumansai/openhuman/blob/main/CLAUDE.md) points to it. The same rules apply to humans.
+
+---
+
+## Start here
+
+If this is your first time in the repo:
+
+1. [Getting set up](getting-set-up.md): toolchain, dependencies, the Tauri CLI and everything `pnpm dev` needs.
+2. [Building the Rust core](building-rust-core.md): setup for the Rust workspace only, with the pinned toolchain, OS packages and exact `cargo` commands.
+3. [Architecture](architecture.md) and its [overview](architecture/README.md): how the desktop app, the in-process Rust core, the JSON-RPC bridge and the dual sockets fit together. Read this before non-trivial changes.
+4. [Frontend](architecture/frontend.md) and [Tauri shell](architecture/tauri-shell.md): the React app and the desktop host that wraps it.
+5. [MCP server](mcp-server.md): the opt-in stdio MCP mode that exposes OpenHuman search, memory and sub-agent tools to local clients.
+
+---
+
+## The core in depth
+
+- [Performance](performance.md): memory per agent, cold-start timing, binary size and how the benchmarks run. The raw rigs and results are in the public [openhuman-benchmarks](https://github.com/tinyhumansai/openhuman-benchmarks) 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.
+- [One TinyHumans API key](tinyhumans-api-key.md): what a single key unlocks, including managed inference, embeddings, web search, media, integrations, voice and Jev.
+
+---
+
+## Testing
+
+OpenHuman has three test layers. Know which one your change belongs in. The Rust integration targets are described in [`tests/README.md`](https://github.com/tinyhumansai/openhuman/blob/main/tests/README.md) and the helper scripts in [`scripts/README.md`](https://github.com/tinyhumansai/openhuman/blob/main/scripts/README.md).
+
+- [Testing strategy](testing-strategy.md): when to write Vitest, cargo or WDIO tests.
+- [E2E testing](e2e-testing.md): WDIO and Appium specs, the Linux and macOS setups, and how to run a single spec locally.
+- [Agent observability](agent-observability.md): the artifact capture that makes E2E and agent runs debuggable after the fact.
+
+PRs must reach at least 80% coverage on changed lines. Add tests for new behavior, not just the happy path.
+
+---
+
+## Shipping
+
+- [Release policy](release-policy.md): versioning, release cadence, OAuth and installer rules.
+- [Cloud deploy](../features/cloud-deploy.md): deployment when a change crosses the desktop boundary.
+
+---
+
+## Going deeper
+
+- [Agent harness](architecture/agent-harness.md): the tinyagents turn loop (checkpointing, circuit breakers, sub-agent handback, journals and replay) and how to extend the tool surface.
+- [Workflows](../features/workflows.md): the tinyflows-backed `flows` domain, with triggers, trust origins, approval-gated runs and the `flows_*` RPC surface.
+- [Loadable modules](loadable-modules.md): native `cdylib` modules the core loads at runtime, and how they are admitted.
+- [Hooks](hooks.md): scripts you own that run before a tool executes, after a file edit or when a turn finishes.
+- [Chromium Embedded Framework](cef.md): design notes from the CEF era. The shell now runs on stock Tauri (Wry).
+
+---
+
+## Contributing
+
+- Open issues and PRs at [tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman). The [`vendor/`](https://github.com/tinyhumansai/openhuman/tree/main/vendor) submodules (tinyagents, tinymemory and others) have their own repos under [tinyhumansai](https://github.com/tinyhumansai).
+- PRs target `main`. Push to your fork, not upstream.
+- Follow [`CONTRIBUTING.md`](https://github.com/tinyhumansai/openhuman/blob/main/CONTRIBUTING.md) and the issue and PR templates.
+- Keep changes focused. A bug fix does not need surrounding cleanup.
+
+Building toward AGI does not have to mean shipping a kernel. Bug fixes, docs, integrations and tests all move the bar.
diff --git a/docs/gitbooks/en/developing/agent-observability.md b/docs/gitbooks/en/developing/agent-observability.md
index d90be4bcac..5cc7e850c6 100644
--- a/docs/gitbooks/en/developing/agent-observability.md
+++ b/docs/gitbooks/en/developing/agent-observability.md
@@ -1,18 +1,17 @@
---
-description: Artifact-capture layer that makes E2E tests debuggable. Logs, traces, screenshots.
+description: >-
+ How to see what the app and the agent did: E2E artifacts, the inference
+ capture proxy, and Langfuse traces.
icon: eye
---
-# Agent Observability
+# Agent observability
-This doc describes the artifact-capture layer that makes the desktop app
-inspectable by coding agents (Codex, Claude Code, Cursor) through the
-existing WDIO / tauri-driver E2E harness (see [E2E Testing](e2e-testing.md)).
+This page covers three ways to see what OpenHuman did. E2E artifacts let a coding agent (Codex, Claude Code, Cursor) inspect the desktop app through the WDIO harness (see [E2E testing](e2e-testing.md)). The capture proxy shows what the core sent to inference. Langfuse traces cover real agent runs.
-It is intentionally narrow: one canonical onboarding + privacy flow with
-on-disk screenshots, page-source dumps, and mock backend request logs.
+The E2E layer is narrow on purpose. It covers one onboarding and privacy flow and saves screenshots, page-source dumps and mock backend request logs to disk.
-## TL;DR
+## Quick start
```bash
bash app/scripts/e2e-agent-review.sh
@@ -46,7 +45,7 @@ The script prints the resolved artifact directory at the end.
| ---------------- | ---------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| Helper | `app/test/e2e/helpers/artifacts.ts` | Run dir, `captureCheckpoint`, `captureFailureArtifacts`, `saveMockRequestLog` |
| WDIO hook | `app/test/wdio.conf.ts` (`afterTest`) | Always dumps screenshot + source on any failing test |
-| Canonical spec | `app/test/e2e/specs/agent-review.spec.ts` | Welcome → onboarding → privacy panel with named checkpoints |
+| Canonical spec | `app/test/e2e/specs/agent-review.spec.ts` | Welcome, onboarding, then the privacy panel, with named checkpoints |
| Wrapper script | `app/scripts/e2e-agent-review.sh` | Build + run + print artifact dir |
| Stable selectors | `data-testid` on `OnboardingNextButton`, `Onboarding` overlay + skip button, `WelcomeStep`, `PrivacyPanel` | Agent-reliable navigation anchors |
@@ -70,11 +69,11 @@ saveMockRequestLog("after-connect-click", getRequestLog());
`captureCheckpoint` numbers captures so the run dir reads chronologically.
`captureFailureArtifacts` is wired into `wdio.conf.ts` and fires
-automatically on any failing test, specs should not call it directly.
+automatically on any failing test. Specs should not call it directly.
## Inference on the wire: the capture proxy
-Logs tell you a turn was slow; they do not tell you what the harness sent or
+Logs tell you a turn was slow. They do not tell you what the harness sent or
which endpoint answered. `scripts/debug/capture-first-inference.mjs`
(`pnpm debug capture`) is a loopback proxy between the core and its inference
backend that records both sides:
@@ -101,17 +100,19 @@ route instead of the hosted backend. Non-2xx response bodies are saved next to
the request dumps so an HTML 503 from an ingress is not lost behind a generic
"model error".
-What to look for across the turns of one thread: `cache_key` must stay
-identical (it is the harness's stable-prefix fingerprint and OpenRouter's
-sticky-routing key), `served_by` should not change, and `cached` should
-approach `prompt` from the second call on. Each of those drifting has been a
-real bug (openhuman#6434). The proxy binds loopback only and refuses a
-plaintext non-loopback upstream unless overridden, because it forwards the
-bearer verbatim; `--help` lists every `CAPTURE_*` knob.
+Across the turns of one thread, check three things. `cache_key` must stay
+identical, because it is the harness's stable-prefix fingerprint and
+OpenRouter's sticky-routing key. `served_by` should not change. `cached`
+should approach `prompt` from the second call on. A drift in any of them has
+been a real bug.
-## Production agent traces are a separate mechanism
+The proxy binds loopback only. It refuses a plaintext non-loopback upstream
+unless you override that, because it forwards the bearer token verbatim.
+`--help` lists every `CAPTURE_*` option.
-Everything above is about E2E artifacts on disk. For a real agent run, the
+## Production agent traces
+
+Everything above is about local artifacts. For a real agent run, the
core can export trace spans to Langfuse instead: when
`observability.share_usage_data` is on (the default), a completed run's spans
go to the OpenHuman backend's Langfuse ingestion proxy over the same session
@@ -123,11 +124,11 @@ metadata (names, timings, token and cost figures) but drops content. See
`crates/openhuman-core/src/agent/progress_tracing/langfuse.rs` and
`crates/openhuman-core/src/config/schema/observability.rs`.
-## What is intentionally out of scope
+## Out of scope for the E2E layer
-- Visual baselines / image diffs across every component state.
+- Visual baselines and image diffs across every component state.
- Screenshot capture on every click (too noisy).
- Live integrations (Gmail, Notion, Telegram); mock server only.
-- New test framework / reporter.
+- A new test framework or reporter.
-Widen to more flows only after this loop proves out.
+Add more flows only after this loop proves itself.
diff --git a/docs/gitbooks/en/developing/agentbox-deployment.md b/docs/gitbooks/en/developing/agentbox-deployment.md
index b88441f211..7f79fafc84 100644
--- a/docs/gitbooks/en/developing/agentbox-deployment.md
+++ b/docs/gitbooks/en/developing/agentbox-deployment.md
@@ -1,87 +1,66 @@
---
description: >-
- The removed AgentBox container deployment surface, kept as the record of
- what it was and which test pins its absence.
+ The removed AgentBox container surface, kept for anyone debugging an older
+ build.
icon: box-archive
---
-# AgentBox marketplace deployment (historical)
+# AgentBox deployment (removed)
-This page describes a container surface that no longer exists in
-`openhuman-core`. A regression test,
-`agentbox_run_and_jobs_paths_are_no_longer_public` in
-`crates/openhuman-rpc/src/server/auth_tests.rs`, asserts that `/run` and
-`/jobs/{job_id}` are gone and pins the reason in a comment: the AgentBox
-marketplace surface moved out of this codebase. `OPENHUMAN_AGENTBOX_MODE`
-has no remaining reader anywhere in `crates/openhuman-core/src` today, even
-though the Dockerfile and `.env.example` still mention it; those references
-are themselves stale and due for cleanup.
+OpenHuman once shipped a container surface for the GMI Cloud AgentBox marketplace. It is gone from `openhuman-core`. A regression test, `agentbox_run_and_jobs_paths_are_no_longer_public` in `crates/openhuman-rpc/src/server/auth_tests.rs`, checks that `/run` and `/jobs/{job_id}` no longer exist.
-If you need to run OpenHuman on GMI Cloud's AgentBox marketplace today, this
-is not the current integration path; check with the team that owns the
-GMI Cloud deployment for where that surface lives now. The rest of this page
-is kept as a historical record of how the integration worked before removal,
-in case you are debugging an older build that still has it.
+`OPENHUMAN_AGENTBOX_MODE` has no reader left in `crates/openhuman-core/src`. The Dockerfile and `.env.example` still mention it, and those mentions are stale. If you need to run OpenHuman on AgentBox today, ask the team that owns the GMI Cloud deployment where that surface lives now.
-## Container contract (as it worked before removal)
+The rest of this page describes how the old surface worked. Read it only if you are debugging an older build that still has it.
-When `OPENHUMAN_AGENTBOX_MODE=1`, the core HTTP server exposes:
+## Container contract
-- `POST /run`: accept work, return `202 { "job_id": "<uuid>" }`. Body shape:
- `{ "payload": { "message": "<string>", "thread_id": "<optional string>" } }`.
-- `GET /jobs/{job_id}`: return `{ "status": "pending|running|completed|failed", "result": ..., "error": ... }`.
-- `GET /health`: liveness.
+With `OPENHUMAN_AGENTBOX_MODE=1`, the core HTTP server exposed three routes:
-Both `/run` and `/jobs/*` are unauthenticated at the container boundary;
-AgentBox's edge handles auth before traffic reaches us.
+- `POST /run` accepts work and returns `202 { "job_id": "<uuid>" }`. The body is `{ "payload": { "message": "<string>", "thread_id": "<optional string>" } }`.
+- `GET /jobs/{job_id}` returns `{ "status": "pending|running|completed|failed", "result": ..., "error": ... }`.
+- `GET /health` is a liveness check.
-## The 4-step register wizard
+`/run` and `/jobs/*` were unauthenticated at the container boundary. AgentBox's edge handled auth before traffic reached the container.
-In the AgentBox console:
+## Registering in the AgentBox console
-1. **Basic Info**: name `OpenHuman`, description, listing identity.
-2. **Infrastructure**: Docker image source (push tagged builds to your
- chosen registry, see "Image push" below), compute tier, region. Enable the
- "GMI MaaS" toggle so the platform injects `GMI_MAAS_BASE_URL` and
- `GMI_MAAS_API_KEY` at runtime.
-3. **Env Variables**: set:
+The console has a four-step wizard.
+
+1. **Basic info.** Name it `OpenHuman` and add a description.
+2. **Infrastructure.** Pick the Docker image source, compute tier and region. Turn on the "GMI MaaS" toggle so the platform injects `GMI_MAAS_BASE_URL` and `GMI_MAAS_API_KEY` at runtime.
+3. **Env variables.** Set these:
- `OPENHUMAN_AGENTBOX_MODE=1`
- - (optional) `OPENHUMAN_AGENTBOX_JOB_TIMEOUT_SECS` (default 600)
- - `GMI_MODELS` to the marketplace-approved model id (e.g.
- `deepseek-ai/DeepSeek-V4-Pro`).
- - `OPENHUMAN_WORKSPACE` to a writable container path (e.g. `/home/openhuman/.openhuman`).
- - `RUST_LOG=info` (or `debug` while shaking out the first deploy).
-4. **Review & Register**: confirm and test from the console panel.
+ - `OPENHUMAN_AGENTBOX_JOB_TIMEOUT_SECS` (optional, default 600)
+ - `GMI_MODELS`, the marketplace-approved model id, for example `deepseek-ai/DeepSeek-V4-Pro`
+ - `OPENHUMAN_WORKSPACE`, a writable container path such as `/home/openhuman/.openhuman`
+ - `RUST_LOG=info` (use `debug` for the first deploy)
+4. **Review and register.** Confirm, then test from the console panel.
-> ⚠️ The platform API key is shown ONCE on the registration confirmation
-> screen. Save it to your secrets manager immediately. It is NOT recoverable
-> from the console after that.
+The platform API key is shown once, on the registration confirmation screen. Save it to your secrets manager right away. The console cannot show it again.
-## Image push
+## Pushing the image
-Build and push from `main` using the existing `Dockerfile`:
+Build from `main` with the existing `Dockerfile` and push to your registry:
```bash
docker build -t <registry>/openhuman-core:<tag> .
docker push <registry>/openhuman-core:<tag>
```
-First deploy takes 10 to 25 minutes to reach `running`; later deploys are faster.
+The first deploy takes 10 to 25 minutes to reach `running`. Later deploys are faster.
## Long-running requests
-AgentBox treats requests >2 min as long-running. OpenHuman handles this with
-**polling** per AgentBox's documented pattern: the agent runtime is invoked
-inside the worker task, capped by `OPENHUMAN_AGENTBOX_JOB_TIMEOUT_SECS`
-(default 10 minutes). No streaming.
+AgentBox treats requests over 2 minutes as long-running, so OpenHuman used polling. The agent ran inside a worker task, capped by `OPENHUMAN_AGENTBOX_JOB_TIMEOUT_SECS` (10 minutes by default). There was no streaming.
-Polling clients should:
+A polling client should:
-1. `POST /run` and capture `job_id`.
-2. `GET /jobs/{job_id}` every 1 to 3 seconds.
+1. Send `POST /run` and keep the `job_id`.
+2. Call `GET /jobs/{job_id}` every 1 to 3 seconds.
3. Stop when `status` is `completed` or `failed`.
-4. Note: terminal jobs are retained for 1 hour after completion, then
- garbage-collected. Long pauses between poll and read may return `404`.
+
+Finished jobs were kept for one hour, then garbage-collected. A long pause between polling and reading can return `404`.
## Local smoke test
@@ -102,17 +81,8 @@ curl http://127.0.0.1:7788/jobs/<job_id>
## Troubleshooting
-- `404 job not found` after a successful submit: retention window (1h) has
- elapsed, or the container restarted (in-memory store is not durable in v1).
-- `status: "failed"`, `error: "agentbox: agent runtime bridge not wired"`:
- the production invoker stub from before Task 9 landed; rebuild against a
- current `main`.
-- `status: "failed"`, `error: "job timeout after Ns"`: the agent invocation
- exceeded `OPENHUMAN_AGENTBOX_JOB_TIMEOUT_SECS`. Bump the env var on the
- next deploy.
-- `[agentbox::gmi] not registering GMI MaaS provider: missing/blank: GMI_MAAS_API_KEY`:
- the platform did not inject the key. Re-check the wizard's "MaaS
- integration toggle" in Step 2.
-- `[agentbox::gmi] current-thread runtime detected, skipping provider registration`:
- the core was booted in a single-threaded tokio runtime. Use the standard
- `serve` subcommand, which spawns a multi-thread runtime.
+- `404 job not found` after a successful submit: the one-hour retention window passed, or the container restarted. The job store was in memory only.
+- `status: "failed"` with `error: "agentbox: agent runtime bridge not wired"`: you are on a build from before the runtime bridge landed. Rebuild from a current `main`.
+- `status: "failed"` with `error: "job timeout after Ns"`: the agent ran past `OPENHUMAN_AGENTBOX_JOB_TIMEOUT_SECS`. Raise it on the next deploy.
+- `[agentbox::gmi] not registering GMI MaaS provider: missing/blank: GMI_MAAS_API_KEY`: the platform did not inject the key. Check the MaaS toggle in step 2 of the wizard.
+- `[agentbox::gmi] current-thread runtime detected, skipping provider registration`: the core booted in a single-threaded tokio runtime. Use the standard `serve` subcommand, which starts a multi-thread runtime.
diff --git a/docs/gitbooks/en/developing/architecture.md b/docs/gitbooks/en/developing/architecture.md
new file mode 100644
index 0000000000..90e64d2973
--- /dev/null
+++ b/docs/gitbooks/en/developing/architecture.md
@@ -0,0 +1,335 @@
+---
+description: The full architecture reference for the OpenHuman codebase: repo layout, runtime, sockets, skills, memory, security and the iOS client.
+icon: code-branch
+---
+
+# Architecture
+
+OpenHuman 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 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.
+
+---
+
+## Repository layout (monorepo)
+
+| 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-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. |
+| `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`). |
+| `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`) plus `motosan-ai-oauth`. |
+
+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`, `run_server_embedded_with_ready`) 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.
+
+---
+
+## Platform reach
+
+Supported today: desktop on Windows, macOS and Linux, with native installers.
+
+Not supported yet: Android, iOS and a standalone web client. They may exist as experimental targets in the repo, but they are not product-ready.
+
+```text
+ OpenHuman (shipping)
+ |
+ Desktop
+ / | \
+ Windows macOS Linux
+ x64 x64 x64
+ ARM64 ARM64 ARM64
+```
+
+Tauri v2 compiles the Rust core into native binaries per platform, embedding the React frontend as a lightweight WebView. Desktop builds produce `.dmg`, `.msi`, `.AppImage` and `.deb` installers. Mobile and web stay out of scope until they are documented as supported.
+
+---
+
+## High-level architecture
+
+```text
++------------------------------------------------------------------+
+| React Frontend |
+| Redux Toolkit | coreRpcClient (fetch) | Socket.IO client | UI |
++------------------------------------------------------------------+
+ | HTTP JSON-RPC (loopback) | Socket.IO (loopback)
+ | Tauri IPC (windows, hotkeys, relay_http_rpc fallback)
++------------------------------------------------------------------+
+| Rust Core (openhuman_core) |
+| |
+| +------------------+ +------------------+ +-----------------+ |
+| | Agent harness | | Socket Manager | | Memory (v2) | |
+| | (tinyagents) | | (client to | | + encryption | |
+| | + tool dispatch | | backend, WS) | | at rest | |
+| +------------------+ +------------------+ +-----------------+ |
+| |
+| +------------------+ +------------------+ +-----------------+ |
+| | Skill metadata | | Cron Scheduler | | Session & Auth | |
+| | & tool registry | | (`cron` domain) | | Management | |
+| +------------------+ +------------------+ +-----------------+ |
+| |
+| +------------------+ +------------------+ +-----------------+ |
+| | Channel | | SQLite Storage | | OS Keychain | |
+| | integrations | | (rusqlite) | | Integration | |
+| +------------------+ +------------------+ +-----------------+ |
++------------------------------------------------------------------+
+ |
+ +-----------+-----------+
+ | |
+ TinyHumans backend External APIs
+ (Socket.IO + REST) (Telegram, etc.)
+```
+
+The 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).
+
+---
+
+## Performance
+
+OpenHuman uses Tauri and Rust instead of Electron for performance and security. See [Performance](performance.md) for measured numbers (agents per process, cold start, binary size). The table below is qualitative.
+
+| 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) |
+| Cold startup | Sub-500ms | 2-5 seconds |
+| Garbage collection pauses | None (Rust ownership model) | V8 GC pauses |
+| Memory safety | Compile-time guaranteed | Runtime exceptions |
+| TLS implementation | rustls (no OpenSSL dependency) | Chromium's BoringSSL |
+
+People run OpenHuman next to other heavy apps such as browsers, IDEs and chat clients. A native binary with a fast start stays out of the way instead of competing for CPU and memory. With no GC pauses, background work such as memory writes and socket events does not stall.
+
+The Tokio async runtime drives all I/O: WebSocket connections, HTTP requests, file operations and inter-skill communication, all as non-blocking tasks on a thread pool. Thousands of concurrent operations (skill executions, cron jobs, socket events) share a small fixed set of OS threads.
+
+---
+
+## Real-time socket infrastructure
+
+OpenHuman uses two socket clients: a Rust-native WebSocket client on desktop and a JavaScript Socket.io client on web. The Rust client survives app backgrounding, works independently of the webview, and handles TLS through rustls.
+
+```text
+Desktop Mode: Web Mode:
+
++-------------+ +-------------+
+| React UI | | React UI |
++------+------+ +------+------+
+ | Tauri IPC | Direct
++------+------+ +------+------+
+| Rust Socket | | JS Socket |
+| Manager | | .io Client |
++------+------+ +------+------+
+ | tokio-tungstenite | Socket.io
+ | + rustls TLS | (websocket/polling)
++------+------+ +------+------+
+| Backend | | Backend |
++-------------+ +-------------+
+```
+
+The Rust socket manager implements Engine.IO v4 and Socket.IO v4 framing over a raw WebSocket. On handshake it connects, waits for the Engine.IO OPEN frame (which carries `sid`, `pingInterval`, `pingTimeout`), then sends the Socket.IO CONNECT with JWT auth and waits for the ACK. To keep the link alive, it answers each Engine.IO PING with a PONG. It treats the connection as dead after `pingInterval + pingTimeout + 5s` (50 seconds with the defaults). Reconnection backs off exponentially from 1 second to a 30-second cap. The delay resets to 1 second when an established connection is lost, and keeps growing if a connection was never established. Because the client is plain Rust `reqwest` rather than a browser fetch, it also sidesteps CORS.
+
+The socket connection is shared across the process rather than opened per skill or per tool, so events are routed to the right handler over async message channels instead of paying a new connection each time.
+
+---
+
+## Skills
+
+Skills are `SKILL.md` packages (metadata, instructions, and optional bundled scripts and resources) that extend the agent with reusable workflows.
+
+Three domains share the work:
+
+| Domain | Role |
+| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `crates/openhuman-core/src/skills/` | Skill metadata: create/discover/install/parse `SKILL.md` and inject descriptors into agent prompts (`ops_create`, `ops_discover`, `ops_install`, `ops_parse`, `registry`, `tools`). |
+| `crates/openhuman-core/src/skills/catalog/` | Registry of installed skills. |
+| `crates/openhuman-core/src/skills/runtime/` | Execution of installed `SKILL.md` workflows: starts/cancels runs, reads run metadata/logs, resolves language runtimes. The orchestrator runs an installed skill itself through `run_workflow`. |
+
+Skill discovery uses `SKILL.md` plus optional bundled resources:
+
+| Field | Purpose |
+| ----------------- | ------------------------------ |
+| `name` | Human-readable display name |
+| `description` | Trigger/selection summary |
+| `metadata.id` | Stable skill slug when present |
+| `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.
+
+Recurring work belongs to the `cron` domain (with `scheduler_gate`), not to skills. There is no per-skill cron handler.
+
+---
+
+## 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).
+
+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.
+
+## Memory
+
+Memory is three operations (recall, fetch, store) over a pluggable engine. The engine is either `tinyhumans` (hosted CortexDB behind the backend's `/memory/*` routes, which needs a session or TinyHumans API key) or `cortexdb` (your own endpoint and key). With neither, memory is off. Items live in CortexDB. Only bookkeeping (job queue, sync/import state) is written under `<workspace>/memory/`. The contract and engines live in `vendor/tinymemory`, which is three crates: `tinymemory-api` (the contract, no I/O), `tinymemory-tools` (the agent surface and lifecycle over any engine) and `tinymemory-integrations` (everything that touches the outside world, one Cargo feature per module). OpenHuman's `crates/openhuman-core/src/memory/` keeps the host side: engine binding, ops, the single `memory` agent tool, conversation buffering, document sources, the consent-gated v1 import and the exit flush. A per-turn memory pack supplies context to each turn. See [Memory](architecture/memory.md), [Pluggable engines](engines.md) and the [memory spec](https://github.com/tinyhumansai/openhuman/blob/main/docs/specs/memory-v2.md).
+
+Conversation state is separate from memory: each thread's transcript is a JSONL file keyed by thread and agent id (the thread store is `tinyagents_session::threads` in `vendor/tinyagents`, wrapped by `threads::store`), and compaction seals a generation rather than deleting it. The full history stays recoverable even though a resumed session reads only the latest generation.
+
+---
+
+## Security architecture
+
+```text
++-------------------------------------------------------------------+
+| Security Layers |
+| |
+| +------------------+ +------------------+ +------------------+ |
+| | OS Keychain | | Secrets at rest | | Tool sandbox | |
+| | (macOS/Win/Lin) | | ChaCha20-Poly | | (platform jail | |
+| | for credentials | | 1305 (`enc2:`) | | or Docker) | |
+| +------------------+ +------------------+ +------------------+ |
+| |
+| +------------------+ +------------------+ +------------------+ |
+| | Single-Use | | rustls TLS | | No localStorage | |
+| | Login Tokens | | for all network | | for sensitive | |
+| | (5-min TTL) | | connections | | data | |
+| +------------------+ +------------------+ +------------------+ |
++-------------------------------------------------------------------+
+```
+
+Credentials go through the OS keychain via the `keyring` crate (macOS Keychain, Windows Credential Manager, Linux Secret Service), on desktop only. Executable tools run through `SecurityPolicy` (`crates/openhuman-core/src/security/policy/`: `types.rs`, `path_checks.rs`, `command_checks.rs`, `enforcement.rs`) and a host-appropriate sandbox backend selected at runtime. One consequence deserves a plain statement. When the `Local` backend is selected on a host with no usable OS jail, `sandbox/ops.rs` logs `[sandbox:local] OS backend unavailable, using noop` and spawns through the no-op backend, so the command runs unconfined. Landlock covers Linux and Seatbelt covers macOS; the Windows AppContainer backend exists upstream but is not compiled, so Windows is the case that hits this path. Use the Docker backend where confinement has to hold. The backends live in `crates/openhuman-core/src/sandbox/`, which picks between none, the OS jail (Landlock on Linux, Seatbelt on macOS) and Docker, over the `tinybox` crates. Web-to-desktop auth handoff uses single-use login tokens with a 5-minute TTL, exchanged via the Rust HTTP client so it bypasses browser CORS. All WebSocket and HTTP connections use rustls, with no dependency on the platform's OpenSSL. Sensitive state lives in Redux (in memory) and the OS keychain (persistent); nothing sensitive goes into localStorage. User prompts are normalized, scored, and enforced server-side (`allow | review | block`) before model or tool execution; see `crates/openhuman-core/src/security/prompt_injection/`.
+
+---
+
+## End-to-end data flow
+
+One request, from user action to external service and back:
+
+```text
+User types a command in the chat UI
+ |
+ v
+Frontend sends the turn to the core over HTTP JSON-RPC
+ |
+ v
+Agent harness (tinyagents) runs the turn, sees the tool catalog
+ |
+ v
+Model decides to call a tool (e.g., send a Telegram message)
+ |
+ v
+Tool Registry routes to the registered handler
+ |
+ v
+Handler executes: native Rust, or a Node helper via `runtime::node`
+ |
+ v
+Handler runs through `SecurityPolicy` and the active sandbox backend
+ |
+ v
+External call: reqwest over rustls, a channel driver, SQLite, OS keychain, etc.
+ |
+ v
+External service responds
+ |
+ v
+Result flows back through the harness to the frontend over Socket.IO or the RPC response
+ |
+ v
+User sees the result in the chat interface
+```
+
+Every layer is async and non-blocking. The Rust core runs concurrent tool executions, cron triggers and socket events on a fixed Tokio thread pool.
+
+---
+
+## Vendored crate family
+
+Core subsystems run on `tiny*` crates, vendored as git submodules under `vendor/` (`tinyagents`, `tinyflows`, `tinychannels`, `tinyjuice`, `tinymemory` and others) so crate changes can be tested in-tree before they are published. The main ownership boundaries are:
+
+- The agent engine is `tinyagents`. Every agent turn runs through its harness via the seam in `crates/openhuman-core/src/agent/tinyagents/`. See [Agent harness](architecture/agent-harness.md).
+- Memory is `tinymemory`. The contract, CortexDB engine, sources, safety scrubbing, context compiler and v1 importer are crate-owned (`vendor/tinymemory`). OpenHuman keeps the host side under `crates/openhuman-core/src/memory/` (see [Memory](architecture/memory.md)). The chat thread store is `tinyagents_session::threads`.
+- Inference uses the crate-native `ModelRouter` and `OpenAiModel` for host workload-tier model routing and cloud provider slugs.
+
+---
+
+## Technology stack
+
+| Layer | Technology | Why |
+| -------------- | ---------------------------------- | --------------------------------------------------------- |
+| Frontend | React 19, TypeScript 5.8 | Modern component model, type safety |
+| State | Redux Toolkit + Persist | Predictable state with offline persistence |
+| Build | Vite 7 | Sub-second HMR, optimized production builds |
+| Styling | Tailwind CSS | Utility-first, consistent design system |
+| Framework | Tauri v2 | Native cross-platform with minimal overhead |
+| Language | Rust (2021 edition) | Memory safety, zero-cost abstractions |
+| Async | Tokio | High-performance async I/O runtime |
+| JS Runtime | Node.js | Managed V8 runtime for tool helpers and skill-adjacent JS |
+| Database | SQLite (rusqlite) | Embedded, zero-config, per-domain stores |
+| WebSocket | tokio-tungstenite + rustls | Persistent connections with native TLS |
+| HTTP | reqwest | Async HTTP with rustls + native-TLS support |
+| Encryption | chacha20poly1305 (secret store), aes-gcm + argon2 (`security/encryption/`) | Config-field secrets use ChaCha20-Poly1305 under a keychain-backed master key (`enc2:` prefix); the separate user-facing encryption facility uses AES-256-GCM with Argon2id |
+| Scheduling | cron crate + `cron` domain | Standard cron expressions, `scheduler_gate`-gated |
+| Telegram | `tinychannels` Bot API driver | Transport in vendored `tinychannels`; host keeps bus/approval glue |
+| Realtime | Socket.io (client) | Bidirectional event-based communication |
+| AI | MCP (JSON-RPC 2.0) | Standardized tool protocol for LLM integration |
+| Search | OpenAI embeddings + SQLite FTS5 | Hybrid semantic + keyword search |
+
+---
+
+## iOS client (experimental)
+
+The iOS client is a Tauri v2 app that shares the React and TypeScript UI codebase. It ships no Rust core on the device. All AI, RPC and domain logic stay on the desktop core, and the iOS app is a thin transport client.
+
+### Transport architecture
+
+```text
+iOS App (React + Tauri iOS shell)
+ |
+ TransportManager (app/src/services/transport/TransportManager.ts)
+ |-- LanHttpTransport direct HTTP to desktop core (same LAN)
+ |-- TunnelTransport socket.io relay; E2E encrypted
+ |-- CloudHttpTransport fallback via cloud backend API
+```
+
+Transport is selected by `ConnectionProfile` stored in secure storage. On pairing, the iOS app stores `{channelId, sessionToken, corePubkey, devicePrivkey}` after the client-side `tunnel:connect` succeeds.
+
+### Pairing flow
+
+1. Desktop: `devices_create_pairing` RPC -> backend ACKs `tunnel:register` with `{channelId, pairingToken, pairingExpiresAt}`.
+2. Desktop shows QR: `openhuman://pair?cid=<>&pt=<>&cpk=<>&rpc=<>&exp=<>`.
+3. iOS scans QR, generates X25519 keypair, connects to backend (`tunnel:connect`, `role:client`, `pairingToken`).
+4. Backend consumes `pairingToken` (single-use) and returns iOS `sessionToken`.
+5. X25519 key agreement over `tunnel:frame` -> XChaCha20-Poly1305 symmetric key.
+6. Desktop emits `DomainEvent::DevicePaired`; device appears in the Devices panel.
+
+### Key paths
+
+| Path | Purpose |
+| --------------------------------- | ------------------------------------------------------- |
+| `crates/openhuman-core/src/security/devices/` | Rust devices domain (pairing, store, crypto, event bus) |
+| `app/src/services/transport/` | TS transport strategies + manager |
+| `app/src/lib/tunnel/` | TS tunnel crypto (X25519 + XChaCha20-Poly1305) |
+| `app/src/pages/ios/` | iOS-specific screens (PairScreen, MascotScreen) |
+| `packages/tauri-plugin-ptt/` | Swift PTT plugin (AVAudioEngine + SFSpeechRecognizer) |
+| `app/src-tauri-mobile/Info.plist` | Privacy strings for the iOS Info.plist |
+
+### Security
+
+- The tunnel backend is a blind forwarder and never sees plaintext payloads.
+- `pairingToken` is single-use, has a TTL and is hashed at rest on the backend.
+- `sessionToken` is per client peer and can be revoked from the desktop Devices panel. The desktop core does not receive a session token during register.
+- Speech recognition runs on-device (Apple Speech framework); audio never leaves the device.
+- The iOS symmetric session key is held in memory, so a restart pairs again instead of resuming.
+
+### Backend dependency
+
+The `tunnel:register` / `tunnel:connect` / `tunnel:frame` Socket.IO protocol is served by the TinyHumans backend. Pairing depends on it. See [iOS companion](../features/ios-companion.md) for the user-facing state of this client.
diff --git a/docs/gitbooks/en/developing/architecture/README.md b/docs/gitbooks/en/developing/architecture/README.md
index 2cb63aa2d5..6eff1df319 100644
--- a/docs/gitbooks/en/developing/architecture/README.md
+++ b/docs/gitbooks/en/developing/architecture/README.md
@@ -1,19 +1,19 @@
---
description: >-
- High-level shape of the OpenHuman system (desktop shell, Rust core, Memory
- Tree, agent loop). Pointer to the deep developer architecture in the repo.
+ The high-level shape of OpenHuman: the desktop shell, the Rust core and the
+ frontend, plus how data flows between them.
icon: code-branch
---
# Architecture
-OpenHuman is open-sourced under GNU GPL3. This page is the high-level shape of the system; the deep developer architecture lives in [deep architecture reference](architecture.md) in the repo.
+OpenHuman is open source under GNU GPL3. This page gives the high-level shape of the system. The full developer reference is [Architecture](../architecture.md).
## The shape
-OpenHuman is a **React + Tauri v2 desktop app** with a **Rust core** doing the heavy lifting, in the same process rather than as a separate service.
+OpenHuman is a React and Tauri v2 desktop app. A Rust core does the heavy lifting, in the same process rather than as a separate service.
-```
+```text
┌──────────────────────────────────────────────────────────────────┐
│ Tauri shell (crates/openhuman-app/) │
│ • windowing, OS integration, embedded core lifecycle (tokio task)│
@@ -34,68 +34,66 @@ OpenHuman is a **React + Tauri v2 desktop app** with a **Rust core** doing the h
│ React frontend (app/src/) │
│ • Screens, navigation │
│ • Talks to core over `coreRpcClient` │
-│ • No business logic - presentation only │
+│ • No business logic, presentation only │
└──────────────────────────────────────────────────────────────────┘
```
-**Where logic lives:**
+Where logic lives:
-* **Rust core**. All business logic: Memory, integrations, model routing, tools, voice. Authoritative.
-* **Tauri shell**. Windowing, process lifecycle, IPC. A delivery vehicle, not where features live.
-* **React frontend**. UI and orchestration. Calls into core via JSON-RPC: `coreRpcClient` `fetch()`es `http://127.0.0.1:<port>/rpc` directly; only non-loopback plain-`http://` runtimes go through the shell's `relay_http_rpc` command (the `openhuman-rpc` HTTP client).
+- The Rust core holds all business logic: memory, integrations, model routing, tools and voice. It is authoritative.
+- The Tauri shell handles windowing, process lifecycle and IPC. Features do not live there.
+- The React frontend draws the UI and orchestrates it. It calls the core over JSON-RPC: `coreRpcClient` sends `fetch()` requests straight to `http://127.0.0.1:<port>/rpc`. Only non-loopback plain-`http://` runtimes go through the shell's `relay_http_rpc` command.
-Running the core in-process instead of behind a socket is also why it's cheap to run many agents at once: no per-agent OS process, no per-agent socket. See [Performance](../performance.md) for the measurements and [Embedding OpenHuman](../embedding.md) for using the same core as a library outside the desktop app.
+Running the core in-process, instead of behind a socket, is also why many agents are cheap to run at once. There is no per-agent OS process and no per-agent socket. See [Performance](../performance.md) for the measurements and [Embedding OpenHuman](../embedding.md) for using the same core as a library outside the desktop app.
## Crates
-* [`crates/openhuman-app/`](../../../../../../../crates/openhuman-app/) - Tauri v2 desktop host; excluded from the root workspace, built from its own manifest.
-* [`crates/openhuman-core/`](../../../../../../../crates/openhuman-core/) - Cargo package `openhuman`: business domains, the controller contract and in-process dispatch, `CoreBuilder`/`CoreRuntime`. It is a library: no binary, no JSON-RPC server, and no dependency on `tinyhumans-sdk`.
-* [`crates/openhuman-embed/`](../../../../../../../crates/openhuman-embed/) - typed library facade (`openhuman_embed::Runtime` / `Agent`, with `Harness` as a one-agent shorthand) for embedding the core in another product.
-* [`crates/openhuman-rpc/`](../../../../../../../crates/openhuman-rpc/) - JSON-RPC 2.0 over the core: the envelopes, the browser-origin allowlist, the HTTP client used by the app and TUI, and the whole server (axum router, auth middleware, Socket.IO, `/dev/connect`, the listener bind). The contract types themselves (`Outcome`, `ControllerSchema`, `StructuredRpcError`) live in the core.
-* [`crates/openhuman-tinyhumans/`](../../../../../../../crates/openhuman-tinyhumans/) - the TinyHumans layer: the SDK-backed backend transport, the hosted RPC proxy domains, a `RuntimeBuilder` that boots connected, and the host-side login and session owner. The only crate allowed to depend on `tinyhumans-sdk`, and the first thing every host installs.
-* [`crates/openhuman-cli/`](../../../../../../../crates/openhuman-cli/) - the `openhuman-core` binary, the developer and benchmark bins, and every root `tests/` and `examples/` target.
-* [`crates/openhuman-tui/`](../../../../../../../crates/openhuman-tui/) - standalone terminal frontend that boots the core in-process.
+- [`crates/openhuman-app/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-app) - the Tauri v2 desktop host; excluded from the root workspace, built from its own manifest.
+- [`crates/openhuman-core/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core) - Cargo package `openhuman`: business domains, the controller contract and in-process dispatch, `CoreBuilder`/`CoreRuntime`. It is a library: no binary, no JSON-RPC server, and no dependency on `tinyhumans-sdk`.
+- [`crates/openhuman-embed/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-embed) - typed library facade (`openhuman_embed::Runtime` / `Agent`, with `Harness` as a one-agent shorthand) for embedding the core in another product.
+- [`crates/openhuman-rpc/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-rpc) - JSON-RPC 2.0 over the core: the envelopes, the browser-origin allowlist, the HTTP client used by the app and TUI, and the whole server (axum router, auth middleware, Socket.IO, `/dev/connect`, the listener bind). The contract types themselves (`Outcome`, `ControllerSchema`, `StructuredRpcError`) live in the core.
+- [`crates/openhuman-tinyhumans/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-tinyhumans) - the TinyHumans layer: the SDK-backed backend transport, the hosted RPC proxy domains, a `RuntimeBuilder` that boots connected, and the host-side login and session owner. The only crate allowed to depend on `tinyhumans-sdk`, and the first thing every host installs.
+- [`crates/openhuman-cli/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-cli) - the `openhuman-core` binary, the developer and benchmark bins, and every root `tests/` and `examples/` target.
+- [`crates/openhuman-tui/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-tui) - standalone terminal frontend that boots the core in-process.
-The full table is under "Repository layout" in the [deep architecture reference](architecture.md); per-crate notes are in [`crates/README.md`](https://github.com/tinyhumansai/openhuman/blob/main/crates/README.md).
+The full table is under "Repository layout" in [Architecture](../architecture.md). Per-crate notes are in [`crates/README.md`](https://github.com/tinyhumansai/openhuman/blob/main/crates/README.md).
## Data flow
-1. **Connect**. OAuth into an [integration](../../features/integrations/). Backend stores the token; core never sees it in plaintext.
-2. **Sync**. A [memory source](../../features/memory.md) (folder, file, link, GitHub, RSS, or a connected Composio toolkit) syncs on demand and on its own schedule.
-3. **Read**. `tinymemory-sources` turns the source into documents, with an SSRF guard on links.
-4. **Scrub**. Every engine the host binds is wrapped in `memory::guard::ScrubbingEngine`, which uses the `safety` feature of `tinymemory-integrations` to strip secrets and personal identifiers before a write leaves the process. The wrap happens where the engine is resolved, so it covers the tool, the RPC surface, source sync, backfill and import; a caller holding a `BoundEngine` and reaching past it is not covered, which is why resolution is the only sanctioned way to get one.
-5. **Store**. The item goes to the selected engine (hosted TinyHumans or your CortexDB). Conversation turns are logged as they happen, learnings when the agent or you add one.
-6. **Recall / Fetch**. The agent's `memory` tool asks the engine a question (with citations) or runs a raw hybrid search.
-7. **Pack**. Before every turn, a token-budgeted memory pack is recalled and added to that turn's model request only, never to the transcript.
-8. **Forget**. Items are removed by id from the Memory page or the tool.
-9. **Compress**. Tool output and large source data go through [TokenJuice](../../features/token-compression.md) before entering LLM context.
-10. **Route**. The [router](../../features/model-routing/) picks the right provider and model for the task hint, one of several [pluggable engines](../engines.md) the core chooses at runtime.
+1. Connect. You sign in to an [integration](../../features/integrations/README.md) with OAuth. The backend stores the token, and the core never sees it in plaintext.
+2. Sync. A [memory source](../../features/memory.md) (folder, file, link, GitHub, RSS or a connected Composio toolkit) syncs on demand and on its own schedule.
+3. Read. `tinymemory-sources` turns the source into documents, with an SSRF guard on links.
+4. Scrub. Every engine the host binds is wrapped in `memory::guard::ScrubbingEngine`. It uses the `safety` feature of `tinymemory-integrations` to strip secrets and personal identifiers before a write leaves the process. The wrap happens where the engine is resolved, so it covers the tool, the RPC surface, source sync, backfill and import. A caller that holds a `BoundEngine` and reaches past it is not covered, so resolution is the only supported way to get one.
+5. Store. The item goes to the selected engine, either hosted TinyHumans or your CortexDB. Conversation turns are logged as they happen. Learnings are stored when the agent or you add one.
+6. Recall and fetch. The agent's `memory` tool asks the engine a question and gets an answer with citations, or runs a raw hybrid search.
+7. Pack. Before every turn, a token-budgeted memory pack is recalled. It goes into that turn's model request only, never into the transcript.
+8. Forget. You remove items by id from the Memory page or the tool.
+9. Compress. Tool output and large source data go through [TokenJuice](../../features/token-compression.md) before they enter the LLM context.
+10. Route. The [router](../../features/model-routing/README.md) picks the provider and model for the task hint. It is one of several [pluggable engines](../engines.md) the core chooses at runtime.
## Privacy boundary
Stays on your machine:
-* Workspace config and persona files.
-* Audio capture buffers and any local model state.
+- Workspace config and persona files
+- Audio capture buffers and any local model state
Goes through the OpenHuman backend (under one subscription, and one TinyHumans API key for embedders):
-* LLM calls (model providers).
-* Web search proxy.
-* Integration OAuth and tool proxying.
-* TTS streaming.
+- LLM calls (model providers)
+- The web search proxy
+- Integration OAuth and tool proxying
+- TTS streaming
-See [Privacy & Security](../../features/privacy-and-security/) for the full picture, and [One TinyHumans API key](../tinyhumans-api-key.md) for what that single key covers.
+See [Privacy and security](../../features/privacy-and-security.md) for the full picture, and [One TinyHumans API key](../tinyhumans-api-key.md) for what that single key covers.
## Open source
-* **Repo:** [github.com/tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman). GNU GPL3.
-* **Issues and PRs** are welcome. The project is in early beta.
-* For contributors, the canonical developer guide is [deep architecture reference](architecture.md).
+The code is at [github.com/tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman) under GNU GPL3. Issues and pull requests are welcome. The project is in early beta. Contributors should start with [Architecture](../architecture.md).
## Further reading
-* [Agent harness](agent-harness.md), [Memory](memory.md) and [Security](security.md) for the deep dives.
-* [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.
+- [Agent harness](agent-harness.md), [Memory](memory.md) and [Security](security.md) for the deep dives.
+- [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.
diff --git a/docs/gitbooks/en/developing/architecture/agent-harness.md b/docs/gitbooks/en/developing/architecture/agent-harness.md
index b3487fcf53..0f09c66ede 100644
--- a/docs/gitbooks/en/developing/architecture/agent-harness.md
+++ b/docs/gitbooks/en/developing/architecture/agent-harness.md
@@ -1,71 +1,127 @@
---
description: >-
- How an agent turn actually runs - the tool-call loop, sub-agent dispatch,
- archetypes, triage, hooks, and the cost/budget machinery around them.
+ How an agent turn runs: the tool-call loop, sub-agent dispatch,
+ archetypes, triage, hooks, and the cost and budget machinery around them.
icon: layer-group
---
-# Agent Harness
+# Agent harness
-`crates/openhuman-core/src/agent/` is the host side of an agent turn: the tool-call loop and its dialects, sub-agent dispatch and archetypes, sessions and resume, triage, hooks, interrupts and cost accounting, all wrapped around the TinyAgents harness rather than reimplementing it.
+`crates/openhuman-core/src/agent/` is the host side of an agent turn: the
+tool-call loop and its dialects, sub-agent dispatch and archetypes, sessions
+and resume, triage, hooks, interrupts and cost accounting, all wrapped around
+the TinyAgents harness rather than reimplementing it.
## Embedding OpenHuman as a library
-`openhuman_embed` exposes a two-step API. `Runtime::builder()` boots one in-process core per process, background services, registered domain families, backend URL and the TinyHumans API key, and `Runtime::agent(spec)` instantiates any number of agents on it. Each `AgentSpec` fully describes one agent: provider endpoint and model, access tier, `action_dir`, MCP servers, its own in-process tools, skill bundles, system prompt, tool scope, sandbox mode, allowlists, and a narrowed `DomainSet` / `ToolGroups`. A runtime identifies as `HostKind::Library`: inference does not depend on OpenHuman app login, including inference-readiness checks for workflow agent nodes.
+`openhuman_embed` exposes a two-step API. `Runtime::builder()` boots one
+in-process core per process, background services, registered domain
+families, backend URL and the TinyHumans API key, and `Runtime::agent(spec)`
+instantiates any number of agents on it. Each `AgentSpec` fully describes
+one agent: provider endpoint and model, access tier, `action_dir`, MCP
+servers, its own in-process tools, skill bundles, system prompt, tool scope,
+sandbox mode, allowlists, and a narrowed `DomainSet` / `ToolGroups`. A runtime identifies as
+`HostKind::Library`: inference does not depend on OpenHuman app login,
+including inference-readiness checks for workflow agent nodes.
### An embedder's own tools
-`AgentSpec::tools` takes the host's own `Box<dyn Tool>` objects, which reach the model as real tools, their own schema on the wire, called by their own name. Before it existed the only road was `AgentSpec::mcp`, and the model paid for the indirection: a discovery call to learn what a server offers, and an `mcp_call_tool` envelope whose inner `arguments` object no provider can validate or constrain decoding against.
-
-It takes a **factory**, not a belt. `Agent` is `Clone` and `Box<dyn Tool>` is not, and the session behind a spec is rebuilt from `Config` on every turn, so nothing holding a `dyn Tool` could survive in between. The closure therefore runs once per turn, which also means a host whose tools belong to something shorter-lived than the agent (one episode, one room, one assignment) can return a different belt each time instead of registering a second agent.
-
-Implement `Tool` through `openhuman_embed::Tool`, not by depending on `tinytools` directly: a second path to that crate produces incompatible Rust types, and a tool built against it cannot be handed to a session at all.
-
-One caveat on a varying belt. The prompt's tool catalogue is rendered from the same belt in the same build, so the two stay consistent on any turn that composes a prompt, but a **resumed** session reuses its persisted system messages, so a belt that moves under a long-lived thread is described by the prompt that thread opened with. Vary a belt only on turns that run on a session of their own.
-
-Per-agent isolation is a context, not a second core. `Runtime::agent` clones the runtime's base `Config`, applies the spec, and derives a child `CoreContext` (`CoreContext::derive_with`) carrying that config, the agent's domain set, tool groups and skill-root policy. Every turn is dispatched under that context (`CoreRuntime::run_in` → `agent_chat_for` with an explicit `AgentDefinition`), so the config loader, the domain gate, the tool-group filter and skill discovery all read the agent's own settings. Transcripts are keyed by agent id and a turn resumes only its own thread.
-
-Layout under a runtime-owned root: `<root>/config.toml` and the credential store; `<root>/workspace/` with the session database, `session_raw/` transcripts and each agent's `agents/<id>/skills/`; and `<root>/agents/<id>/action/` as each agent's default working root (a sibling of the workspace, never inside it).
-
-`Harness` is the one-agent shorthand: a runtime plus one agent named `harness`. Build one runtime and issue concurrent `run` or `turn(...).send()` calls on its agents; do not build one core per agent. Each call owns a distinct session unless a prior session id is supplied.
-
-Authentication in library mode is the TinyHumans API key (`RuntimeBuilder::api_key`), stored as an `api-key` auth profile beside the runtime's `config.toml`. Managed inference sends it as a bearer to the OpenAI-compatible endpoint; backend REST calls send `x-api-key`; there is no session JWT and nothing to expire. Agents that name their own `Provider` (BYOK) never touch it. The key covers every hosted feature, subject to its backend scopes: inference, embeddings, voice, search, media, Composio and the other integrations, channels and the socket. Only the session-bound `/auth/*` flows (OAuth connect, channel link tokens) still take `HarnessBuilder::session`.
-
-`Workspace::Inherit` together with `Provider::inherit()` and no API key is deliberately not library-routed inference. It borrows the installed OpenHuman configuration and therefore keeps the installed application's session checks. Supply an explicit provider or an API key when embedding without app login.
-
-Some settings remain runtime-wide for every agent (the live autonomy policy's `auto_approve*`, the approval gate switch, the sub-agent catalogue, the config sub-agents re-read); the crate README lists them under "Still runtime-wide".
-
-> **Status (issue #4249, tinyagents migration):** the agent turn no longer runs on the in-tree `run_turn_engine` loop. **All three entry points (`Agent::turn`, the channel/CLI bus path, and `run_subagent`) now drive every turn through the published** [**`tinyagents`**](https://crates.io/crates/tinyagents) **2.1 agent-loop harness** via the adapter seam in [`crates/openhuman-core/src/agent/tinyagents/`](../../../../../../../crates/openhuman-core/src/agent/tinyagents/) (`run_turn_via_tinyagents_shared`). The legacy `run_turn_engine`, the three hand-rolled loops, `turn_engine_adapter`, and the custom `agent_graph/` engine described later in this page have been **removed**; the surviving shared seam, `TurnProgress`, lives in `agent/session_host/tool_progress.rs`. The dead `token_budget.rs` (context trimming is now `MessageTrimMiddleware`) and the vestigial `interrupt.rs` fence (cancellation is the tinyagents steering channel) are gone; policy **stop hooks** (budget / thread-goal / iteration caps) now fire through a `StopHookMiddleware` ([`tinyagents/stop_hooks.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs)) that pauses the run on the first stop vote, and the channel route forwards live `AgentProgress` like the chat route.
->
-> Multi-agent **orchestration** is expressed on tinyagents' **graph layer** via `graph::parallel::map_reduce`, the `spawn_parallel_graph` scaffold, and the shared `graph::orchestration` `TaskStore` lifecycle primitives re-exported from [`orchestration/mod.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/orchestration/mod.rs):
->
-> * [`orchestration/delegation.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/orchestration/delegation.rs) is a `plan → execute ⇄ review → finalize` `CompiledGraph` (conditional routing, `RecursionPolicy`, durable `FileCheckpointer`, `CancellationToken`, `GraphTracingSink`);
-> * the **workflow phase engine** fans each phase's agents out on the graph (`with_max_concurrency`), keeping the durable `WorkflowRun` ledger as the resume source of truth;
-> * `spawn_parallel_agents` runs its fan-out through `spawn_parallel_graph` + `graph::parallel::map_reduce`;
-> * the **agent-teams** member runtime is a conditional-routing graph (`execute → complete | fail → done`, [`agent_teams/runtime.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs));
-> * the **detached-sub-agent** registry is backed by a typed `TaskStore` lifecycle ledger (Pending → Running → Completed/Failed/Cancelled).
->
-> The sections below describing a bespoke `agent_graph/` module + per-agent `GraphBlueprint`s are **historical** (the pre-migration design) and are retained only for context.
-
-## TinyAgents crate: features & compatibility
-
-OpenHuman depends on the split TinyAgents 2.1 crate family by path into the vendored git submodule `vendor/tinyagents`, `tinyagents-harness` (features `sqlite`, `multimodal`, `builtin-tools`), `tinyagents-definition`, `tinyagents-graph` (`sqlite`), `tinyagents-registry`, `tinyagents-session`, `tinyagents-runtime`, `tinyagents-orchestration` and the optional `tinyagents-live`, plus `tinyinference` from `vendor/tinyagents/vendor/tinyinference`, so SDK changes can be tested in-tree before being PR'd upstream (see [`crates/openhuman-core/Cargo.toml`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/Cargo.toml)). The rationale, so future upgrades don't silently regress it:
-
-* **Native TinyAgents model interface, OpenHuman-owned product policy.** Every live route is an `Arc<dyn ChatModel<()>>`: TinyAgents OpenAI-compatible clients cover wire-equivalent managed, local, and BYOK routes, while host `ChatModel` implementations cover Claude SDK/Code and Codex-specific transports. OpenHuman still owns credential resolution, OAuth, access gates, endpoint selection, egress disclosure, billing metadata, and error classification.
-* **`sqlite` feature enabled with one native sqlite chain.** OpenHuman's root and Tauri Cargo worlds pin `rusqlite = "=0.40.2"` (`bundled`); the pinned Rust 1.96 toolchain provides the `cfg_select!` macro its build script needs, so no local patch of `rusqlite` / `libsqlite3-sys` remains. Both worlds resolve to a single `libsqlite3-sys` chain. Durable graph checkpoints run through TinyAgents' own `SqliteCheckpointer`; the earlier OpenHuman-owned `SqlRunLedgerCheckpointer` adapter has been retired (see [`orchestration/delegation.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/orchestration/delegation.rs)).
-* **WhatsApp Web storage bridge.** `whatsapp-rust`'s Diesel-backed `sqlite-storage` feature links sqlite separately from rusqlite 0.40, so the optional `whatsapp-web` feature (now forwarded to `tinychannels/whatsapp-web`) currently builds against `wacore::store::InMemoryBackend` and logs that sessions are not durable. A rusqlite-backed durable WhatsApp store is required before treating Web sessions as persistent again.
-* **`repl`/Rhai feature dropped.** TinyAgents no longer ships a `repl`/`rlm` scripting runtime, and OpenHuman no longer depends on it; there is no `rhai_workflows` tool. Rhai still appears as a direct dependency of `tinyflows` for its own JSON-query stack, unrelated to the agent harness (see "Language workflows" below, marked historical).
-* **Ownership map:** model construction → `inference::provider::create_chat_model*`; durable graph checkpoints → TinyAgents' `SqliteCheckpointer`; generic detached executor state → `DetachedTaskRegistry`; controller-facing durability → OpenHuman SQL/JSON run ledgers (`running_subagents`, `workflow_runs`, `agent_teams`, `command_center`). The generic harness/graph/middleware/event primitives are used as-is.
-
-The agent harness is the runtime that turns a user message (or a webhook fire, or a cron tick) into a complete, tool-using LLM interaction. It owns the tool-call loop, sub-agent dispatch, the trigger-triage pipeline, and the hook surface around them. It does **not** own provider HTTP transport, tool implementations, prompt-section assembly, or memory storage - those are separate domains the harness composes.
+`AgentSpec::tools` takes the host's own `Box<dyn Tool>` objects, which reach
+the model as real tools, their own schema on the wire, called by their own
+name. Before it existed the only road was `AgentSpec::mcp`, and the model paid
+for the indirection: a discovery call to learn what a server offers, and an
+`mcp_call_tool` envelope whose inner `arguments` object no provider can
+validate or constrain decoding against.
+
+It takes a factory, not a belt. `Agent` is `Clone` and `Box<dyn Tool>` is
+not, and the session behind a spec is rebuilt from `Config` on every turn, so
+nothing holding a `dyn Tool` could survive in between. The closure therefore
+runs once per turn, which also means a host whose tools belong to something
+shorter-lived than the agent (one episode, one room, one assignment) can
+return a different belt each time instead of registering a second agent.
+
+Implement `Tool` through `openhuman_embed::Tool`, not by depending on
+`tinytools` directly: a second path to that crate produces incompatible Rust
+types, and a tool built against it cannot be handed to a session at all.
+
+One caveat on a varying belt. The prompt's tool catalogue is rendered from the
+same belt in the same build, so the two stay consistent on any turn that
+composes a prompt, but a resumed session reuses its persisted system
+messages, so a belt that moves under a long-lived thread is described by the
+prompt that thread opened with. Vary a belt only on turns that run on a
+session of their own.
+
+Per-agent isolation is a context, not a second core. `Runtime::agent` clones
+the runtime's base `Config`, applies the spec, and derives a child
+`CoreContext` (`CoreContext::derive_with`) carrying that config, the agent's
+domain set, tool groups and skill-root policy. Every turn is dispatched under
+that context (`CoreRuntime::run_in` → `agent_chat_for` with an explicit
+`AgentDefinition`), so the config loader, the domain gate,
+the tool-group filter and skill discovery all read the agent's own settings.
+Transcripts are keyed by agent id and a turn resumes only its own thread.
+
+Layout under a runtime-owned root: `<root>/config.toml` and the credential
+store; `<root>/workspace/` with the session database, `session_raw/`
+transcripts and each agent's `agents/<id>/skills/`; and
+`<root>/agents/<id>/action/` as each agent's default working root (a sibling
+of the workspace, never inside it).
+
+`Harness` is the one-agent shorthand: a runtime plus one agent named
+`harness`. Build one runtime and issue concurrent `run` or `turn(...).send()`
+calls on its agents; do not build one core per agent. Each call owns a
+distinct session unless a prior session id is supplied.
+
+Authentication in library mode is the TinyHumans API key
+(`RuntimeBuilder::api_key`), stored as an `api-key` auth profile beside the
+runtime's `config.toml`. Managed inference sends it as a bearer to the
+OpenAI-compatible endpoint; backend REST calls send `x-api-key`; there is no
+session JWT and nothing to expire. Agents that name their own `Provider`
+(BYOK) never touch it. The key covers every hosted feature, subject to its
+backend scopes: inference, embeddings, voice, search, media, Composio and the
+other integrations, channels and the socket. Only the session-bound `/auth/*`
+flows (OAuth connect, channel link tokens) still take
+`HarnessBuilder::session`.
+
+`Workspace::Inherit` together with `Provider::inherit()` and no API key is
+deliberately not library-routed inference. It borrows the installed
+OpenHuman configuration and therefore keeps the installed application's
+session checks. Supply an explicit provider or an API key when embedding
+without app login.
+
+Some settings remain runtime-wide for every agent (the live autonomy policy's
+`auto_approve*`, the approval gate switch, the sub-agent catalogue, the
+config sub-agents re-read); the crate README lists them under "Still
+runtime-wide".
+
+Every agent turn runs through the published [`tinyagents`](https://crates.io/crates/tinyagents) harness. There are three entry points: `Agent::turn`, the channel and CLI bus path, and `run_subagent`. All of them go through the adapter seam in [`crates/openhuman-core/src/agent/tinyagents/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/agent/tinyagents) (`run_turn_via_tinyagents_shared`). Context trimming is `MessageTrimMiddleware`, and cancellation is the tinyagents steering channel. Policy stop hooks (budget, thread-goal and iteration caps) fire through a `StopHookMiddleware` ([`tinyagents/stop_hooks.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs)) that pauses the run on the first stop vote. The channel route forwards live `AgentProgress` like the chat route. The shared `TurnProgress` seam lives in `agent/session_host/tool_progress.rs`.
+
+Multi-agent orchestration runs on the tinyagents graph layer, through `graph::parallel::map_reduce`, the `spawn_parallel_graph` scaffold and the shared `graph::orchestration` `TaskStore` lifecycle primitives re-exported from [`orchestration/mod.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/orchestration/mod.rs):
+
+- [`orchestration/delegation.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/orchestration/delegation.rs) is a `plan → execute ⇄ review → finalize` `CompiledGraph`. It has conditional routing, `RecursionPolicy`, a durable `FileCheckpointer`, a `CancellationToken` and a `GraphTracingSink`.
+- The workflow phase engine fans each phase's agents out on the graph (`with_max_concurrency`). The durable `WorkflowRun` ledger stays the source of truth for resume.
+- `spawn_parallel_agents` runs its fan-out through `spawn_parallel_graph` and `graph::parallel::map_reduce`.
+- The agent-teams member runtime is a conditional-routing graph (`execute → complete | fail → done`, [`agent_teams/runtime.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs)).
+- The detached-sub-agent registry is backed by a typed `TaskStore` lifecycle ledger (Pending, Running, then Completed, Failed or Cancelled).
+
+## TinyAgents crate: features and compatibility
+
+OpenHuman depends on the split TinyAgents 2.1 crate family by path into the vendored git submodule `vendor/tinyagents`, `tinyagents-harness` (features `sqlite`, `multimodal`, `builtin-tools`), `tinyagents-definition`, `tinyagents-graph` (`sqlite`), `tinyagents-registry`, `tinyagents-session`, `tinyagents-runtime`, `tinyagents-orchestration` and the optional `tinyagents-live`, plus `tinyinference` from `vendor/tinyagents/vendor/tinyinference`, so SDK changes can be tested in-tree before they go upstream (see [`crates/openhuman-core/Cargo.toml`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/Cargo.toml)). The reasons, so future upgrades do not regress it:
+
+- Native TinyAgents model interface, OpenHuman-owned product policy. Every live route is an `Arc<dyn ChatModel<()>>`: TinyAgents OpenAI-compatible clients cover wire-equivalent managed, local, and BYOK routes, while host `ChatModel` implementations cover Claude SDK/Code and Codex-specific transports. OpenHuman still owns credential resolution, OAuth, access gates, endpoint selection, egress disclosure, billing metadata, and error classification.
+- `sqlite` feature enabled with one native sqlite chain. OpenHuman's root and Tauri Cargo worlds pin `rusqlite = "=0.40.2"` (`bundled`); the pinned Rust 1.96 toolchain provides the `cfg_select!` macro its build script needs. Both worlds resolve to a single `libsqlite3-sys` chain. Durable graph checkpoints run through TinyAgents' own `SqliteCheckpointer` (see [`orchestration/delegation.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/orchestration/delegation.rs)).
+- WhatsApp Web storage bridge. `whatsapp-rust`'s Diesel-backed `sqlite-storage` feature links sqlite separately from rusqlite 0.40, so the optional `whatsapp-web` feature (forwarded to `tinychannels/whatsapp-web`) builds against `wacore::store::InMemoryBackend` and logs that sessions are not durable. Web sessions stay non-persistent until a rusqlite-backed durable WhatsApp store exists.
+- No scripting runtime. There is no `repl` or Rhai scripting feature and no `rhai_workflows` tool. Rhai still appears as a dependency of `tinyflows` for its own JSON-query stack, unrelated to the agent harness.
+- Ownership map: model construction → `inference::provider::create_chat_model*`; durable graph checkpoints → TinyAgents' `SqliteCheckpointer`; generic detached executor state → `DetachedTaskRegistry`; controller-facing durability → OpenHuman SQL/JSON run ledgers (`running_subagents`, `workflow_runs`, `agent_teams`, `command_center`). The generic harness/graph/middleware/event primitives are used as-is.
+
+The agent harness is the runtime that turns a user message (or a webhook fire, or a cron tick) into a complete, tool-using LLM interaction. It owns the tool-call loop, sub-agent dispatch, the trigger-triage pipeline, and the hook surface around them. It does not own provider HTTP transport, tool implementations, prompt-section assembly or memory storage. Those are separate domains the harness composes.
This page walks through what happens in one turn, then zooms in on each of the moving parts.
## The shape of a turn
-Every turn - whether the user just typed a message, a Telegram webhook just fired, or a 9am cron just ticked - flows through the same lifecycle:
+Every turn goes through the same lifecycle, whether the user just typed a message, a Telegram webhook fired or a 9am cron ticked:
-```
+```text
┌─ inbound ─────────────────────────────────────────────────────────┐
│ user message · channel inbound · webhook · cron · composio event │
└──────────────────────────┬────────────────────────────────────────┘
@@ -95,7 +151,7 @@ Every turn - whether the user just typed a message, a Telegram webhook just fire
│ hooks │ buffering for memory
└─────────────────┘
-* system prompt is built only on the first turn - subsequent
+* the system prompt is built only on the first turn. Later
turns reuse the rendered prompt verbatim so the inference
backend's KV-cache prefix stays valid.
```
@@ -104,41 +160,41 @@ The rest of this page is the same diagram, expanded.
## Sessions and `Agent::turn`
-A **session** is the live conversation an `Agent` instance is running. The `Agent` struct owns:
+A session is the live conversation an `Agent` instance is running. The `Agent` struct owns:
-* The conversation history (system + user + assistant + tool messages).
-* The provider client to call (model resolved by the [model router](../../features/model-routing/)).
-* The tool registry visible to the model.
-* The `memory` tool (when a memory engine is on), through which the model recalls, fetches, learns and forgets on demand.
-* Per-turn budgets - max tool iterations, max payload size, max USD cost.
-* Local action budget - a rolling hourly cap for side-effecting tool actions, read from `config.autonomy.max_actions_per_hour`.
+- The conversation history (system + user + assistant + tool messages).
+- The provider client to call (model resolved by the [model router](../../features/model-routing/README.md)).
+- The tool registry visible to the model.
+- The `memory` tool (when a memory engine is on), through which the model recalls, fetches, learns and forgets on demand.
+- Per-turn budgets: max tool iterations, max payload size, max USD cost.
+- Local action budget: a rolling hourly cap for side-effecting tool actions, read from `config.autonomy.max_actions_per_hour`.
`Agent::turn(user_message)` is the hot path. In one turn it:
-1. **Resumes the session transcript** if this is a fresh process - re-loading the exact provider messages from disk so the inference backend's KV-cache prefix still hits.
-2. **Builds the system prompt** (only on the first turn). This pulls in identity, soul, profile, memory, connected integrations, available tools, safety preamble - assembled by the prompt section builder.
-3. **Recalls a memory pack.** TinyMemory's agent lifecycle logs the user turn and recalls a token-budgeted pack (learnings and beliefs, brain documents, this agent's history, other agents' turns), wrapped in `<memory-context>` and added to that turn's model requests ephemerally; it is never persisted in the transcript, so the prompt cache is unaffected. The model can still call the `memory` tool for a cited answer (see [Memory architecture](memory.md)).
-4. **Enters the tool-call loop** (next section).
-5. **Spawns post-turn hooks** in the background - the user gets their answer before cost logging and conversation logging finish.
+1. Resumes the session transcript if this is a fresh process, re-loading the exact provider messages from disk so the inference backend's KV-cache prefix still hits.
+2. Builds the system prompt (only on the first turn). This pulls in identity, soul, profile, memory, connected integrations, available tools, safety preamble, assembled by the prompt section builder.
+3. Recalls a memory pack. TinyMemory's agent lifecycle logs the user turn and recalls a token-budgeted pack (learnings and beliefs, brain documents, this agent's history, other agents' turns), wrapped in `<memory-context>` and added to that turn's model requests ephemerally; it is never persisted in the transcript, so the prompt cache is unaffected. The model can still call the `memory` tool for a cited answer (see [Memory architecture](memory.md)).
+4. Enters the tool-call loop (next section).
+5. Spawns post-turn hooks in the background: the user gets their answer before cost logging and conversation logging finish.
-The system prompt is **not** rebuilt on subsequent turns. Even cosmetic byte changes invalidate the KV-cache prefix and force a full re-prefill, so dynamic per-turn context (tool results, memory recall answers) is appended as user-visible message content rather than spliced into the system prompt.
+The system prompt is not rebuilt on subsequent turns. Even cosmetic byte changes invalidate the KV-cache prefix and force a full re-prefill, so dynamic per-turn context (tool results, memory recall answers) is appended as user-visible message content rather than spliced into the system prompt.
#### The cacheable prefix is wider than the system prompt
Freezing the prompt is only one third of the contract, and the other two are easier to break because nothing about them looks like caching:
-* **The tool block counts, and it comes&#x20;**_**first**_**.** Every prefix cache in production renders the tool catalogue ahead of the conversation, a chat template has to put it somewhere the model reads before the first user turn. OpenAI's automatic cache, Anthropic's `cache_control` (tools → system → messages), DeepSeek's context cache and any vLLM/SGLang radix cache all work this way. So a `tools` array that changes between turns invalidates the frozen system prompt too, and the JSON key order of the request body (which puts `messages` before `tools`) says nothing about it. The mid-session Composio reconcile is still correct, a tool surface that lies about what the model can call is worse than a cold prefill, but it must fire only on a real capability change and be byte-stable otherwise. `connected_set_hash` sorts before hashing so a reordered backend response never reaches a rebuild, and `collect_orchestrator_tools` sorts the connected-toolkit enum for the same reason.
-* **History must be append-only.** Turn N's serialization has to survive verbatim as the opening of turn N+1. `pair_tool_cycles` drops half-finished tool cycles at serialization time, so its verdict for an entry must depend only on that entry and its immediate neighbour, never on anything appended later, or an earlier message's presence flips retroactively and the prefix moves under the cache. Context compaction is the one deliberate exception; it rewrites the middle and pays for a re-prefill.
+- The tool block counts, and it comes _first_. Every prefix cache in production renders the tool catalogue ahead of the conversation, a chat template has to put it somewhere the model reads before the first user turn. OpenAI's automatic cache, Anthropic's `cache_control` (tools → system → messages), DeepSeek's context cache and any vLLM/SGLang radix cache all work this way. So a `tools` array that changes between turns invalidates the frozen system prompt too, and the JSON key order of the request body (which puts `messages` before `tools`) says nothing about it. The mid-session Composio reconcile is still correct, a tool surface that lies about what the model can call is worse than a cold prefill, but it must fire only on a real capability change and be byte-stable otherwise. `connected_set_hash` sorts before hashing so a reordered backend response never reaches a rebuild, and `collect_orchestrator_tools` sorts the connected-toolkit enum for the same reason.
+- History must be append-only. Turn N's serialization has to survive verbatim as the opening of turn N+1. `pair_tool_cycles` drops half-finished tool cycles at serialization time, so its verdict for an entry must depend only on that entry and its immediate neighbour, never on anything appended later, or an earlier message's presence flips retroactively and the prefix moves under the cache. Context compaction is the one deliberate exception; it rewrites the middle and pays for a re-prefill.
-A resumed session's replayed prefix is folded into `Agent::history` rather than spliced into one request, so the request, the following turn and the persisted transcript all read the same sequence. Splicing it cost the conversation twice: the next turn went out without it, and the transcript written afterwards (serialized from `history`) held only the new turn, which the _next_ resume then read back, truncating the thread a little further on every restart.
+A resumed session's replayed prefix is folded into `Agent::history` rather than spliced into one request, so the request, the following turn and the persisted transcript all read the same sequence. Splicing it cost the conversation twice: the next turn went out without it, and the transcript written afterwards (serialized from `history`) held only the new turn, which the *next* resume then read back, truncating the thread a little further on every restart.
#### A stable prefix only pays out when the wire says so
-Keeping the bytes stable is necessary, not sufficient: the provider still has to be _told_ to cache, and two providers need telling explicitly.
+Keeping the bytes stable is necessary, not sufficient: the provider still has to be *told* to cache, and two providers need telling explicitly.
-* **Anthropic caches nothing without `cache_control` markers, and its OpenAI-compatible endpoint cannot carry them**, Anthropic documents prompt caching as unsupported on that path and reports `prompt_tokens_details` as always empty. A `cloud_providers` entry with `auth_style = "anthropic"` is therefore built as the crate's native Messages adapter (`tinyinference_llm::providers::anthropic`), which places markers on the last tool, the last system block, and the final message so a growing tool loop reuses the previous iteration's cache rather than only the system prompt. The one exception is text mode (`native_tools = false`, prompt-guided tools), which only the Chat Completions adapter implements and which keeps the compat client, and so keeps paying full price.
-* **OpenRouter forwards markers to Anthropic and Gemini** but adds none itself; hosted OpenAI rejects unknown content-part fields. The OpenRouter slug (and any endpoint on `openrouter.ai`) enables `OpenAiModel::with_explicit_cache_control`, which marks the last system and last user message; every other Chat Completions endpoint stays unmarked.
-* **The routing hint is separate from the markers.** The harness derives a `prompt_cache_key` from the declared stable prefix and puts it in `provider_options`, so every turn of a thread, and every sub-agent sharing its system prompt and tool set, routes to the same cache shard on providers that shard (OpenAI's `prompt_cache_key`). Adapters that have no such concept drop it. The managed backend receives it as a top-level body field alongside `thread_id`.
+- Anthropic caches nothing without `cache_control` markers, and its OpenAI-compatible endpoint cannot carry them, Anthropic documents prompt caching as unsupported on that path and reports `prompt_tokens_details` as always empty. A `cloud_providers` entry with `auth_style = "anthropic"` is therefore built as the crate's native Messages adapter (`tinyinference_llm::providers::anthropic`), which places markers on the last tool, the last system block, and the final message so a growing tool loop reuses the previous iteration's cache rather than only the system prompt. The one exception is text mode (`native_tools = false`, prompt-guided tools), which only the Chat Completions adapter implements and which keeps the compat client, and so keeps paying full price.
+- OpenRouter forwards markers to Anthropic and Gemini but adds none itself; hosted OpenAI rejects unknown content-part fields. The OpenRouter slug (and any endpoint on `openrouter.ai`) enables `OpenAiModel::with_explicit_cache_control`, which marks the last system and last user message; every other Chat Completions endpoint stays unmarked.
+- The routing hint is separate from the markers. The harness derives a `prompt_cache_key` from the declared stable prefix and puts it in `provider_options`, so every turn of a thread, and every sub-agent sharing its system prompt and tool set, routes to the same cache shard on providers that shard (OpenAI's `prompt_cache_key`). Adapters that have no such concept drop it. The managed backend receives it as a top-level body field alongside `thread_id`.
All three hang off `RunPolicy::cache.protect_prompt_prefix`, which the host sets unconditionally, and off the cacheable prefix the tinyagents loop declares on every request from the session's frozen system prefix (system prompt tiers, then the tool catalogue); the host has no middleware of its own for this. Until tinyagents began stamping that effective policy onto the outgoing request, both readers consulted `request.cache_policy` alone, always `None` here, so the flag was diagnostic only and no marker or key ever reached the wire. The `[cache]` debug line on every model call now reports whether a key was injected and how many cacheable segments were declared; `cache_read_tokens` on the usage that comes back is the number that proves it worked.
@@ -146,20 +202,20 @@ Measure this rather than reasoning about it. `CAPTURE_ALL=1 node scripts/debug/c
### AGENTS.md project instructions
-Alongside identity/soul/profile/memory, the system prompt pulls in **AGENTS.md** instruction files, OpenHuman's analog of Claude Code's `CLAUDE.md` / Codex's `AGENTS.md`. Two layers are loaded **once**, at system-prompt build time (never re-read per turn, so the frozen-prefix / KV-cache contract holds):
+Alongside identity/soul/profile/memory, the system prompt pulls in AGENTS.md instruction files, OpenHuman's analog of Claude Code's `CLAUDE.md` / Codex's `AGENTS.md`. Two layers are loaded once, at system-prompt build time (never re-read per turn, so the frozen-prefix / KV-cache contract holds):
-* **Global**, `<workspace_dir>/AGENTS.md`, the user's OpenHuman workspace (where `SOUL.md` / `USER.md` live). Applies to every run.
-* **Project**, `<action_dir>/AGENTS.md`, the folder the agent is operating in. For sub-agent runs with a git-worktree override (`SubagentRunOptions.worktree_action_dir`), that override dir is the project layer instead.
+- Global, `<workspace_dir>/AGENTS.md`, the user's OpenHuman workspace (where `SOUL.md` / `USER.md` live). Applies to every run.
+- Project, `<action_dir>/AGENTS.md`, the folder the agent is operating in. For sub-agent runs with a git-worktree override (`SubagentRunOptions.worktree_action_dir`), that override dir is the project layer instead.
-The global layer renders first, the project layer second (project instructions layered after, taking precedence on conflict), under a `## Project instructions (AGENTS.md)` heading. When the two dirs resolve to the same path the file is loaded **once** (deduped). Missing / unreadable / empty files are silently skipped, and each layer is capped at `BOOTSTRAP_MAX_CHARS` (\~20 000 chars) with a `[... truncated]` marker so a large file can't crowd the prompt.
+The global layer renders first, the project layer second (project instructions layered after, taking precedence on conflict), under a `## Project instructions (AGENTS.md)` heading. When the two dirs resolve to the same path the file is loaded once (deduped). Missing / unreadable / empty files are silently skipped, and each layer is capped at `BOOTSTRAP_MAX_CHARS` (~20 000 chars) with a `[... truncated]` marker so a large file can't crowd the prompt.
-The loader is `agent::prompts::agents_md` (pure functions returning pre-loaded strings, bounded at read time so a pathological multi-MB file can't exhaust memory before the render-time cap); the strings are threaded onto `PromptContext` (`agents_md_global` / `agents_md_local`) and rendered by `AgentsInstructionsSection`, which sits after the user-files section and before the tool catalogue in the default and sub-agent builders. The **primary / orchestrator** agent and the other built-in dynamic agents (`PromptSource::Dynamic`) assemble their own body via `render_*` helpers, so the same `AgentsInstructionsSection` is injected centrally by `SystemPromptBuilder::from_dynamic`, appended after the agent's own body, before the central grounding contract, rather than by each `agents/<id>/prompt.rs` builder. The feature is gated by `agent.agents_md_enabled` (default **on**); when off, no AGENTS.md content is loaded or injected.
+The loader is `agent::prompts::agents_md` (pure functions returning pre-loaded strings, bounded at read time so a pathological multi-MB file can't exhaust memory before the render-time cap); the strings are threaded onto `PromptContext` (`agents_md_global` / `agents_md_local`) and rendered by `AgentsInstructionsSection`, which sits after the user-files section and before the tool catalogue in the default and sub-agent builders. The primary / orchestrator agent and the other built-in dynamic agents (`PromptSource::Dynamic`) assemble their own body via `render_*` helpers, so the same `AgentsInstructionsSection` is injected centrally by `SystemPromptBuilder::from_dynamic`, appended after the agent's own body, before the central grounding contract, rather than by each `agents/<id>/prompt.rs` builder. The feature is gated by `agent.agents_md_enabled` (default on); when off, no AGENTS.md content is loaded or injected.
## The tool-call loop
-Inside `Agent::turn`, the tool-call loop is the inner engine. Since issue #4249 it is the published **tinyagents** crate's `AgentHarness` loop, assembled per turn by `run_turn_via_tinyagents_shared` ([`crates/openhuman-core/src/agent/tinyagents/mod.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/tinyagents/mod.rs)). It runs up to the turn's iteration cap, resolved in `session_host/builder/iteration_cap.rs`: an explicit `[agent] max_tool_iterations_override` (or `OPENHUMAN_AGENT_MAX_TOOL_ITERATIONS`) wins, then the agent definition's cap (the orchestrator's is 200), then `max_tool_iterations` (default 10) for a turn with no definition. The model is told how many calls remain at 50% and 80% of the budget, and `inference_agent_chat` reports a capped turn with `hit_cap: true` and its `checkpoint` text:
+Inside `Agent::turn`, the tool-call loop is the inner engine. It is the published tinyagents crate's `AgentHarness` loop, assembled per turn by `run_turn_via_tinyagents_shared` ([`crates/openhuman-core/src/agent/tinyagents/mod.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/tinyagents/mod.rs)). It runs up to the turn's iteration cap, resolved in `session_host/builder/iteration_cap.rs`: an explicit `[agent] max_tool_iterations_override` (or `OPENHUMAN_AGENT_MAX_TOOL_ITERATIONS`) wins, then the agent definition's cap (the orchestrator's is 200), then `max_tool_iterations` (default 10) for a turn with no definition. The model is told how many calls remain at 50% and 80% of the budget, and `inference_agent_chat` reports a capped turn with `hit_cap: true` and its `checkpoint` text:
-```
+```text
loop {
1. context guard - if history is too big, microcompact / autocompact
2. stop-hook check - budget caps, max-iterations, custom kill switches
@@ -174,18 +230,27 @@ loop {
Every iteration emits a real-time `AgentProgress` event so the UI can render token-by-token streaming, "calling tool X" status, and per-iteration cost updates.
-**One engine, three entry points.** The loop lives in TinyAgents. OpenHuman's chat host, channel/CLI route and sub-agent host each supply product policy at the adapter seam; spawned sub-agents enter through `agent/subagent_host`, which drives the neutral `tinyagents_orchestration::subagent::SubagentDriver` rather than an OpenHuman runner. The host owns provider/model choice, tool and security narrowing, workspace/artifact handling, progress and durable product projection. The neutral driver owns lifecycle ordering, task-key coalescing and the exclusive pause-or-terminal persistence decision. This direct cutover is in progress: the removed `harness/subagent_runner` path must not return as a facade or compatibility export.
+One engine, three entry points. The loop lives in TinyAgents. OpenHuman's
+chat host, channel/CLI route and sub-agent host each supply product policy at
+the adapter seam; spawned sub-agents enter through
+`agent/subagent_host`, which drives the neutral
+`tinyagents_orchestration::subagent::SubagentDriver` rather than an OpenHuman
+runner. The host owns provider/model choice, tool and security narrowing,
+workspace/artifact handling, progress and durable product projection. The
+neutral driver owns lifecycle ordering, task-key coalescing and the exclusive
+pause-or-terminal persistence decision. There is no `harness/subagent_runner` path, and it must not return as a facade or
+compatibility export.
### Tool dispatch and tool-call dialects
-`agent.tool_dispatcher` (overridable for one launch with `OPENHUMAN_TOOL_DISPATCHER`) picks how tools are spoken to the model. `auto` (the default) uses **native tool calling**, structured tool specs through the `ChatModel` adapter and structured calls back, whenever the provider profile supports it, and falls back to JSON-in-tag for prompt-guided providers such as local Ollama. `python` and `typescript` are opt-in: they render the catalogue as code signatures and read code-style calls back, but mis-parse on some models. The session composes its prompt for the chosen dialect and pins the same dialect on the turn harness, so a text dialect keeps its schemas off the wire and the harness recovers calls with the matching grammar.
+`agent.tool_dispatcher` (overridable for one launch with `OPENHUMAN_TOOL_DISPATCHER`) picks how tools are spoken to the model. `auto` (the default) uses native tool calling, structured tool specs through the `ChatModel` adapter and structured calls back, whenever the provider profile supports it, and falls back to JSON-in-tag for prompt-guided providers such as local Ollama. `python` and `typescript` are opt-in: they render the catalogue as code signatures and read code-style calls back, but mis-parse on some models. The session composes its prompt for the chosen dialect and pins the same dialect on the turn harness, so a text dialect keeps its schemas off the wire and the harness recovers calls with the matching grammar.
Canonical `tinytools_agent::dialect::ToolDialect` implementations provide transcript-compatible parsing and rendering directly; OpenHuman converts durable/provider records only at those I/O boundaries:
-* **Native** (`native`), structured tool-call fields.
-* **XML** (`xml`), `<tool_call>{...}</tool_call>` tags in assistant text, with full JSON schemas in the prompt.
-* **P-Format** (`pformat`), compact positional `<tool_call>name[0|a|1|b]</tool_call>` with `name[0|<a>|1|<b>]` signatures in the prompt; opt-in.
-* **Code** (`python` / `typescript`), the catalogue is a list of function signatures (`def read_file(path: str, limit: int = None) -> str` or `function read_file(path: string, limit?: number): string;`) and the model writes a function call inside the tag: `read_file(path="src/main.rs", limit=20)` or `read_file({path: "src/main.rs", limit: 20})`. Compact like P-Format but a syntax small code-trained models already write; `python` is the default.
+- Native (`native`), structured tool-call fields.
+- XML (`xml`), `<tool_call>{...}</tool_call>` tags in assistant text, with full JSON schemas in the prompt.
+- P-Format (`pformat`), compact positional `<tool_call>name[0|a|1|b]</tool_call>` with `name[0|<a>|1|<b>]` signatures in the prompt; opt-in.
+- Code (`python` / `typescript`), the catalogue is a list of function signatures (`def read_file(path: str, limit: int = None) -> str` or `function read_file(path: string, limit?: number): string;`) and the model writes a function call inside the tag: `read_file(path="src/main.rs", limit=20)` or `read_file({path: "src/main.rs", limit: 20})`. Compact like P-Format but a syntax small code-trained models already write; `python` is the default.
Every 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.
@@ -193,20 +258,20 @@ Every text dialect shares one parser: a `<tool_call>` body is tried as P-Format,
Long tool-calling chains can blow past the context window. Two layers handle that:
-* **Tool-result budget** - every tool result is checked against a per-call byte budget, enforced as tinyagents tool middleware. Anything over is hard-truncated with an explanatory marker so the model knows it didn't see the full output.
-* **Microcompact / autocompact** - when total history is creeping toward the context window, tinyagents middleware (message trimming + the compression hooks installed in `tinyagents/middleware.rs` and `tinyagents/harness_context_ladder.rs`) compacts older turns into summaries before the next provider call. The compacted history keeps the system prompt and the most recent turns intact (KV-cache stability) and rewrites the middle.
+- Tool-result budget: every tool result is checked against a per-call byte budget, enforced as tinyagents tool middleware. Anything over is hard-truncated with an explanatory marker so the model knows it didn't see the full output.
+- Microcompact / autocompact: when total history is creeping toward the context window, tinyagents middleware (message trimming + the compression hooks installed in `tinyagents/middleware.rs` and `tinyagents/harness_context_ladder.rs`) compacts older turns into summaries before the next provider call. The compacted history keeps the system prompt and the most recent turns intact (KV-cache stability) and rewrites the middle.
-### Oversized tool results - the summarizer detour
+### Oversized tool results: the summarizer detour
-Some 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.
+Some 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.
-**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.
+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.
-### Filesystem offload - `outputs/` and `workspace/`
+### Filesystem offload: `outputs/` and `workspace/`
-Compression alone does not survive a long-horizon run. Summaries still accumulate step after step, and no amount of compressing restores the fidelity that was thrown away. So for minutes-to-hours tasks the harness moves large results **out of context and onto disk**, and hands the next step a **path**.
+Compression alone does not survive a long-horizon run. Summaries still accumulate step after step, and no amount of compressing restores the fidelity that was thrown away. So for minutes-to-hours tasks the harness moves large results out of context and onto disk, and hands the next step a path.
Two directories under the agent's existing `action_dir` at runtime (the implementation lives in `crates/openhuman-core/src/agent/harness/artifact_offload/`):
@@ -215,16 +280,16 @@ Two directories under the agent's existing `action_dir` at runtime (the implemen
| `action_dir/outputs/` | Deliverables. Meant to outlive the step that made them, handed on by path. |
| `action_dir/workspace/` | Scratch. Intermediate files a worker needs but does not hand back. |
-Note `action_dir/workspace/` is a scratch folder inside the agent's action root. It is **not** the core's internal `workspace_dir`, which agent writes may never reach.
+Note `action_dir/workspace/` is a scratch folder inside the agent's action root. It is not the core's internal `workspace_dir`, which agent writes may never reach.
Two halves enforce the convention:
-* **Prompt.** A sub-agent that actually holds `file_write` gets a Long-horizon Artifact Offload contract in its system prompt: results past roughly 2 000 tokens go to a file under `outputs/`, and the reply is that relative path plus a short abstract. The gate is deliberate, a prompt may only name tools the agent can really call, or the model emits calls that fail. Skill-filtered specialists get no contract text, and a dedicated guard asserts their prompts never mention a filesystem tool. They stay covered by the harness half below, which needs no cooperation from the model. The `planner` prompt spells out what the convention means for its own work; the planner is told to reference artifact paths across DAG nodes rather than pasting payloads forward.
-* **Harness.** `offload_oversized_result` runs on every sub-agent outcome, so an oversized result is offloaded even when the worker inlined it anyway. It fires **before** the definition's `max_result_chars` cap, so the full body lands on disk instead of being cut.
+- Prompt. A sub-agent that actually holds `file_write` gets a Long-horizon Artifact Offload contract in its system prompt: results past roughly 2 000 tokens go to a file under `outputs/`, and the reply is that relative path plus a short abstract. The gate is deliberate, a prompt may only name tools the agent can really call, or the model emits calls that fail. Skill-filtered specialists get no contract text, and a dedicated guard asserts their prompts never mention a filesystem tool. They stay covered by the harness half below, which needs no cooperation from the model. The `planner` prompt spells out what the convention means for its own work; the planner is told to reference artifact paths across DAG nodes rather than pasting payloads forward.
+- Harness. `offload_oversized_result` runs on every sub-agent outcome, so an oversized result is offloaded even when the worker inlined it anyway. It fires before the definition's `max_result_chars` cap, so the full body lands on disk instead of being cut.
What the parent receives is a pointer, not a payload:
-```
+```text
[artifact] kind=output path=outputs/presentation_agent/sub-1234-result.md bytes=52318
read_with: file_read {"path":"outputs/presentation_agent/sub-1234-result.md"}
note: The full result was written to the action workspace instead of being inlined. …
@@ -235,69 +300,69 @@ HEADLINE FINDING …
`SubagentRunOutcome.artifact_paths` carries the same paths structurally, parsed out of the `[artifact]` pointers in the output, so the handoff carries paths whether the harness offloaded the result or the worker wrote the file itself. Any path the parent takes delivery of is recoverable with an ordinary `file_read` long after the child's context is gone.
-**The summarizer is now the fallback, not the first resort.** Offload catches the common case; the summarizer detour and the `tool_result_budget_bytes` truncation above still handle everything it does not, including every failure mode here. A refused or failed offload is deliberately soft: the caller keeps its inline payload and falls through to those backstops.
+The summarizer is the fallback, not the first resort. Offload catches the common case; the summarizer detour and the `tool_result_budget_bytes` truncation above still handle everything it does not, including every failure mode here. A refused or failed offload is deliberately soft: the caller keeps its inline payload and falls through to those backstops.
-**Path hardening is fail-closed.** `resolve_artifact_path` rejects absolute paths, `..` traversal, and anything that escapes its convention root after lexical normalization. When a `SecurityPolicy` is available it also refuses anything under `workspace_dir`, both by blanket containment and via `is_workspace_internal_path`. Offload targets resolve under `action_dir`, never `workspace_dir` - including the case where someone configures `action_dir` inside the workspace root, where every offload is refused rather than quietly writing to internal state.
+Path hardening is fail-closed. `resolve_artifact_path` rejects absolute paths, `..` traversal, and anything that escapes its convention root after lexical normalization. When a `SecurityPolicy` is available it also refuses anything under `workspace_dir`, both by blanket containment and via `is_workspace_internal_path`. Offload targets resolve under `action_dir`, never `workspace_dir`, including the case where someone configures `action_dir` inside the workspace root, where every offload is refused rather than quietly writing to internal state.
Writes log `[artifact] wrote worker artifact under action_dir`; each path a handoff carries logs `[artifact] handoff carried an artifact path to the parent`, on both the producing and the consuming side, so a run journal shows both ends of every pointer.
-### TokenJuice - content-aware tool-output compaction (Stage 1a)
+### 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 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:
-* **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.
-* **Log** → the 100-rule engine for _command_ output (git/cargo/npm/…), signal-based keep-failures otherwise.
-* **Search** → relevance-ranked top-K matches per file with a `+N more` tally.
-* **Diff** → keep changed hunks, collapse unchanged context, summarise lockfile hunks.
-* **HTML** → strip markup to readable text.
-* **Plain text** → the opt-in Python/ML "Kompress" compressor (ModernBERT), or pass-through.
+- 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.
+- Log → the 100-rule engine for _command_ output (git/cargo/npm/…), signal-based keep-failures otherwise.
+- Search → relevance-ranked top-K matches per file with a `+N more` tally.
+- Diff → keep changed hunks, collapse unchanged context, summarise lockfile hunks.
+- HTML → strip markup to readable text.
+- Plain text → the opt-in Python/ML "Kompress" compressor (ModernBERT), or pass-through.
-Every lossy compression offloads the original to the **CCR (Compress-Cache-Retrieve)** store behind a `⟦tj:<hash>⟧` marker, so compaction is effectively lossless: the agent calls `juice_retrieve` (token + optional byte/line range) to fetch the full original on demand. The same engine is exposed as a universal `compress_content(content, hint, opts)` for any large payload (file reads, web fetches), and as read-only `tokenjuice.*` debug RPCs. Compaction is on by default (`context.compaction_enabled`; `OPENHUMAN_COMPACTION=0` opts out). A large result is stored and replaced by a stats line, a 500-character head and a handle that the read-only `juice_find` / `juice_extract` / `juice_summarize` tools query (`tokenjuice.repl_handle_enabled`), so the LLM summary stage is skipped for results that get a handle. Configured via the `[tokenjuice]` block / `OPENHUMAN_TOKENJUICE_*` env. Agent definitions can override tool-result compression with `tokenjuice_compression = "auto" | "full" | "light" | "off"`; `auto` resolves coding-model agents (`[model] hint = "coding"`) to `light`, which disables CCR-backed lossy compression so coding agents keep raw build/test/diff/search text unless a reduction is truly lossless. Other agents default to `full`. The ML (Kompress) path runs as a `kompress` backend of the shared [`runtime_python_server`](../../../../../../../crates/openhuman-core/src/runtime/python_server/) (torch + ModernBERT pip-installed at runtime), gated by the `ml_compression_enabled` flag and degrading gracefully to a native compressor when the Python runtime is unavailable.
+Every lossy compression offloads the original to the CCR (Compress-Cache-Retrieve) store behind a `⟦tj:<hash>⟧` marker, so compaction is effectively lossless: the agent calls `juice_retrieve` (token + optional byte/line range) to fetch the full original on demand. The same engine is exposed as a universal `compress_content(content, hint, opts)` for any large payload (file reads, web fetches), and as read-only `tokenjuice.*` debug RPCs. Compaction is on by default (`context.compaction_enabled`; `OPENHUMAN_COMPACTION=0` opts out). A large result is stored and replaced by a stats line, a 500-character head and a handle that the read-only `juice_find` / `juice_extract` / `juice_summarize` tools query (`tokenjuice.repl_handle_enabled`), so the LLM summary stage is skipped for results that get a handle. Configured via the `[tokenjuice]` block / `OPENHUMAN_TOKENJUICE_*` env. Agent definitions can override tool-result compression with `tokenjuice_compression = "auto" | "full" | "light" | "off"`; `auto` resolves coding-model agents (`[model] hint = "coding"`) to `light`, which disables CCR-backed lossy compression so coding agents keep raw build/test/diff/search text unless a reduction is truly lossless. Other agents default to `full`. The ML (Kompress) path runs as a `kompress` backend of the shared [`runtime_python_server`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/runtime/python_server) (torch + ModernBERT pip-installed at runtime), gated by the `ml_compression_enabled` flag and degrading gracefully to a native compressor when the Python runtime is unavailable.
### Missing capabilities
-There is no self-healing archetype. The old automatic "command not found → spawn ToolMaker → retry" interceptor was removed with the in-house loop, and the `tool_maker` archetype that could be spawned explicitly was removed with the other single-belt specialists. A missing host command is reported back to the user rather than polyfilled.
+There is no self-healing archetype. A missing host command is reported back to the user rather than polyfilled.
-## Sub-agents - the orchestrator pattern
+## Sub-agents: the orchestrator pattern
-OpenHuman is **multi-agent**. The agent the user is chatting with is the **Master Agent** (stable internal id: `orchestrator`) - a capable default agent that answers and completes ordinary work directly, including the inspect → edit → verify coding loop. It spawns specialist sub-agents when parallelism, deeper reasoning, or a specialised capability materially helps.
+OpenHuman is multi-agent. The agent the user is chatting with is the Master Agent (stable internal id: `orchestrator`), a capable default agent that answers and completes ordinary work directly, including the inspect → edit → verify coding loop. It spawns specialist sub-agents when parallelism, deeper reasoning, or a specialised capability materially helps.
### Why multi-agent
A single agent that knows everything also has a system prompt the size of a small book. Splitting work across specialists means:
-* Each sub-agent gets a **narrow system prompt** with only the sections it needs (identity / memory / safety preamble can be stripped).
-* Each sub-agent gets a **filtered tool registry** - the image agent doesn't need filesystem tools, the task manager doesn't need the Composio catalog.
-* Sub-agent histories never leak back to the parent - the parent sees one compact tool result, not the inner conversation.
-* Cheaper models can do the leaf work. The orchestrator is on a strong reasoning model; a research sub-agent might be on a faster, cheaper one.
+- Each sub-agent gets a narrow system prompt with only the sections it needs (identity / memory / safety preamble can be stripped).
+- Each sub-agent gets a filtered tool registry: the image agent doesn't need filesystem tools, the task manager doesn't need the Composio catalog.
+- Sub-agent histories never leak back to the parent: the parent sees one compact tool result, not the inner conversation.
+- Cheaper models can do the leaf work. The orchestrator is on a strong reasoning model; a research sub-agent might be on a faster, cheaper one.
### The built-in archetypes
Each archetype lives under `agents/<name>/` with an `agent.toml` (metadata, tool scope, model hint) and a prompt. The orchestrator's chat delegates are the ones in its `[subagents]` allowlist:
-| Archetype | When the orchestrator picks it |
-| -------------------- | --------------------------------------------------------------------------------------------- |
-| `orchestrator` | The Master Agent: top-level, direct-capable default. Never spawned by another orchestrator. |
-| `task_manager_agent` | Adding, previewing, fetching, updating or removing task sources, workflow bundles, artifacts. |
-| `vision_agent` | Anything that depends on the content of an image (describe, OCR, UI elements). |
-| `image_agent` | Generating or editing an image. |
-| `video_agent` | Generating a video or animating an image. |
-| `presentation_agent` | Building a slide deck with grounding and citations (feature `documents`). |
-| `skill_setup` | Finding, installing and managing skills from registries (`setup_skills`). |
-| `workflow_builder` | Authoring or editing a saved workflow (`build_workflow`); returns a proposal, never saves. |
-| `flow_discovery` | Suggesting workflows worth setting up (`discover_workflows`). |
+| Archetype | When the orchestrator picks it |
+| ---------------------- | ---------------------------------------------------------------------------------------------- |
+| `orchestrator` | The Master Agent: top-level, direct-capable default. Never spawned by another orchestrator. |
+| `task_manager_agent` | Adding, previewing, fetching, updating or removing task sources, workflow bundles, artifacts. |
+| `vision_agent` | Anything that depends on the content of an image (describe, OCR, UI elements). |
+| `image_agent` | Generating or editing an image. |
+| `video_agent` | Generating a video or animating an image. |
+| `presentation_agent` | Building a slide deck with grounding and citations (feature `documents`). |
+| `skill_setup` | Finding, installing and managing skills from registries (`setup_skills`). |
+| `workflow_builder` | Authoring or editing a saved workflow (`build_workflow`); returns a proposal, never saves. |
+| `flow_discovery` | Suggesting workflows worth setting up (`discover_workflows`). |
Other built-ins are never chat delegates:
-| Archetype | Who runs it |
-| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
-| `planner`, `critic` | Only the `parallel_research_cross_check` workflow-run template (decompose and research = `planner`, cross\_check = `critic`). |
-| `summarizer` | The harness, to compress oversized tool results; also the synthesize phase of that workflow-run template. |
-| `trigger_triage` / `trigger_reactor` | Classifying an incoming external event, and the lightweight reaction to one. |
-| `morning_briefing` | Cron: the daily digest, on a named read-only tool belt. |
+| Archetype | Who runs it |
+| -------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
+| `planner`, `critic` | Only the `parallel_research_cross_check` workflow-run template (decompose and research = `planner`, cross_check = `critic`). |
+| `summarizer` | The harness, to compress oversized tool results; also the synthesize phase of that workflow-run template. |
+| `trigger_triage` / `trigger_reactor` | Classifying an incoming external event, and the lightweight reaction to one. |
+| `morning_briefing` | Cron: the daily digest, on a named read-only tool belt. |
-Work that used to go to single-belt specialists (coding, crypto, settings, scheduling, product docs, MCP servers) is now done by the orchestrator itself through **inline skills**: `use_skill` loads a tool pack's guide and schemas (`coding`, `web3`, `system`, `scheduling`, `docs`, `mcp`), and the same tools are `Deferred` so `tool_search` finds any single one. Running an installed skill is the orchestrator's own `run_workflow`. See [`tools/toolpacks/README.md`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/tools/toolpacks/README.md).
+The orchestrator itself handles coding, crypto, settings, scheduling, product docs and MCP servers through inline skills: `use_skill` loads a tool pack's guide and schemas (`coding`, `web3`, `system`, `scheduling`, `docs`, `mcp`), and the same tools are `Deferred` so `tool_search` finds any single one. Running an installed skill is the orchestrator's own `run_workflow`. See [`tools/toolpacks/README.md`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/tools/toolpacks/README.md).
Custom archetypes ship as TOML files under `$OPENHUMAN_WORKSPACE/agents/*.toml` (or `~/.openhuman/agents/*.toml` for user-global specialists). Custom definitions override built-ins on id collision.
@@ -305,28 +370,32 @@ Custom archetypes ship as TOML files under `$OPENHUMAN_WORKSPACE/agents/*.toml`
When the orchestrator calls `spawn_subagent`, the default contract is durable and asynchronous. The tool builds a deterministic compatibility selector from the parent session/thread, agent id, model override, sandbox mode, action root, and normalized task key/title. It then checks `orchestration::subagent_sessions` before spawning:
-* If a compatible worker is already running, the instruction is injected through its `RunQueue` and the parent gets a quick `subagent_session_id` / `task_id` reference.
-* If a compatible worker is idle or paused with reusable history, the harness starts a new transient run for the same durable `subagent_session_id` and passes the saved child history through `SubagentRunOptions.initial_history`, with the new instruction appended as a user-visible follow-up.
-* If the shape is incompatible, the worker was closed, `fresh: true` was passed, or no session exists, the harness creates a new durable session and worker thread.
+- If a compatible worker is already running, the instruction is injected through its `RunQueue` and the parent gets a quick `subagent_session_id` / `task_id` reference.
+- If a compatible worker is idle or paused with reusable history, the harness starts a new transient run for the same durable `subagent_session_id` and passes the saved child history through `SubagentRunOptions.initial_history`, with the new instruction appended as a user-visible follow-up.
+- If the shape is incompatible, the worker was closed, `fresh: true` was passed, or no session exists, the harness creates a new durable session and worker thread.
-The child run is prepared and executed by the OpenHuman host through the neutral TinyAgents lifecycle:
+The child run is prepared and executed by the OpenHuman host through the
+neutral TinyAgents lifecycle:
1. Receives parent cancellation and workspace from its typed run context; remaining legacy provider, sandbox, and transcript inputs stay scoped until their explicit migration lands.
-2. Resolves the sub-agent's model - inline `model` override first, then config-level pins (`[orchestrator].model`, `[teams.*].lead_model`, `[teams.*].agent_model`), then the archetype hint or inherited parent model.
+2. Resolves the sub-agent's model: inline `model` override first, then config-level pins (`[orchestrator].model`, `[teams.*].lead_model`, `[teams.*].agent_model`), then the archetype hint or inherited parent model.
3. Filters the parent's tool registry per the definition's `tools`, `disallowed_tools`, and `skill_filter`. In `fork` mode, the parent's full registry is inherited verbatim.
4. Builds a narrow system prompt, omitting the sections the definition asks to strip.
-5. Passes the prepared child to `tinyagents-orchestration` for lifecycle ordering and exactly one pause-or-terminal persistence action.
-6. Persists the child history and worker thread pointer under the durable `subagent_session_id` so later turns can resume or inspect it. Pause continuation also retains its complete TinyAgents task key.
+5. Passes the prepared child to `tinyagents-orchestration` for lifecycle
+ ordering and exactly one pause-or-terminal persistence action.
+6. Persists the child history and worker thread pointer under the durable
+ `subagent_session_id` so later turns can resume or inspect it. Pause
+ continuation also retains its complete TinyAgents task key.
-`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`; it is no longer the default.
+`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 (#5933). **Interactive turns follow the same contract since #6034**: `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 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
Not every agent is allowed to spawn every other agent. The harness models a three-tier hierarchy that mirrors the cost / latency / depth-of-thought split between models:
-```
+```text
Primary (direct-capable, Master Agent on `coding` hint)
│
├─► Worker ◄─── fast path: one delegation, leaf does the work
@@ -338,51 +407,36 @@ Primary (direct-capable, Master Agent on `coding` hint)
Each `AgentDefinition` carries an `agent_tier` field (`chat` / `reasoning` / `worker`, default `worker`). The contract:
-| Tier | May spawn | Must NOT spawn | Typical members |
-| ----------- | --------------------- | ------------------------------- | --------------------------------------------- |
-| `chat` | `reasoning`, `worker` | another `chat` | `orchestrator` |
-| `reasoning` | `worker` | another `reasoning`, any `chat` | `planner` (today the canonical one) |
-| `worker` | nothing[^1] | anything | critic, image\_agent, task\_manager\_agent, … |
-
-**Why the rules.**
-
-* _Chat → chat is meaningless._ The chat tier exists for snappy UX. A chat agent spawning another chat agent just doubles TTFT and burns tokens without buying any new capability.
-* _Reasoning → reasoning blows up depth._ The reasoning tier is expensive. Chains of reasoning agents tend to re-decompose the same problem and create runaway hierarchies.
-* _Worker → anything mixes execution and orchestration._ Workers are leaves so the parent always sees one compact result, not a transcript of nested delegations.
-
-**Enforcement.** Two layers:
-
-1. **Loader-time (static).** [`agents::loader::validate_tier_hierarchy`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/registry/agents/loader.rs) runs over the merged registry (built-ins + workspace TOMLs) and refuses to boot a registry that lists a same-tier or worker-with-subagents entry. Built-in archetypes are checked at compile-test time; user-shipped TOMLs are checked at workspace load.
-2. **Runtime depth gate (dynamic).** Independent of tier, the sub-agent runner caps total spawn chain depth at `MAX_SPAWN_DEPTH = 3` via a task-local counter incremented across `run_subagent`, surfaced as a `SpawnDepthExceeded` agent error. This makes a user-shipped TOML that drops the tier annotation still unable to recurse past three hops.
-
-> **Status:** the loader-time tier check, `agent_tier` field, and runtime depth-counter task-local are live. Depth is bounded by both the static loader contract and the runtime `MAX_SPAWN_DEPTH = 3` guard.
-
-### Toolkit-specific specialists
+| Tier | May spawn | Must NOT spawn | Typical members |
+| ----------- | --------------------- | ------------------------------- | ------------------------------------------------------------------------------- |
+| `chat` | `reasoning`, `worker` | another `chat` | `orchestrator` |
+| `reasoning` | `worker` | another `reasoning`, any `chat` | `planner` (today the canonical one) |
+| `worker` | nothing[^1] | anything | critic, image_agent, task_manager_agent, … |
-For Composio toolkits with hundreds of actions (GitHub alone has 500+), loading every action into the sub-agent's tool set balloons prompt size. The harness ranks the toolkit's actions against the parent-refined task prompt with a cheap CPU-only filter (verb detection, token overlap, verb-alignment boost) and only loads the top-ranked subset into the sub-agent. No model call, pure heuristic - fast and explainable.
+[^1]: Skill-wildcard entries (`{ skills = "*" }`) are exempt because they name no agent: they expand to the connected Composio actions as `Deferred` tools the agent reaches through `tool_search`, not to a spawn.
-## Language workflows (Rhai): HISTORICAL (removed)
+Why the rules.
-> **Status:** TinyAgents dropped its `repl`/`rlm` Rhai-backed REPL feature, and the `rhai_workflows` tool and `crates/openhuman-core/src/flows/rhai/` module described below no longer exist (`grep -rli rhai crates/` finds only an unrelated `tinyflows` JSON-query dependency). The section is retained as design history.
+- _Chat → chat is meaningless._ The chat tier exists for snappy UX. A chat agent spawning another chat agent just doubles TTFT and burns tokens without buying any new capability.
+- _Reasoning → reasoning blows up depth._ The reasoning tier is expensive. Chains of reasoning agents tend to re-decompose the same problem and create runaway hierarchies.
+- _Worker → anything mixes execution and orchestration._ Workers are leaves so the parent always sees one compact result, not a transcript of nested delegations.
-The fixed delegation primitives (`spawn_subagent`, `spawn_parallel_agents`, `run_workflow`) can't express _ad-hoc control flow_, "spawn N readers, dedupe their findings, verify each survivor with 3 refuters, loop until dry". The **`rhai_workflows` tool** closed that gap: it exposed TinyAgents' Rhai-backed `.ragsh` REPL (the `repl` cargo feature) so the orchestrator could author and run its own workflow scripts.
+Enforcement. Two layers:
-**One tool call = one `eval_cell`.** The orchestrator's normal tool-call loop _was_ the CodeAct driver loop: the model wrote a Rhai cell, the cell ran against a persistent per-session namespace (top-level `let` bindings survived into the next cell via an optional `session_id`), and the structured result flowed back as the tool result. Scripts reached the host only through capability functions, `tool_call`, `agent_query`, `model_query`, their `*_batched` fan-out variants, `emit`, and `answer`.
+1. Loader-time (static). [`agents::loader::validate_tier_hierarchy`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/registry/agents/loader.rs) runs over the merged registry (built-ins + workspace TOMLs) and refuses to boot a registry that lists a same-tier or worker-with-subagents entry. Built-in archetypes are checked at compile-test time; user-shipped TOMLs are checked at workspace load.
+2. Runtime depth gate (dynamic). Independent of tier, the sub-agent runner caps total spawn chain depth at `MAX_SPAWN_DEPTH = 3` via a task-local counter incremented across `run_subagent`, surfaced as a `SpawnDepthExceeded` agent error. This makes a user-shipped TOML that drops the tier annotation still unable to recurse past three hops.
-The domain lived in `crates/openhuman-core/src/flows/rhai/`:
+> Status: the loader-time tier check, `agent_tier` field, and runtime depth-counter task-local are live. Depth is bounded by both the static loader contract and the runtime `MAX_SPAWN_DEPTH = 3` guard.
-* **`policy.rs`** mapped the autonomy tier + `tool_timeout` clamps onto a `tinyagents::ReplPolicy` (always bounded, never unbounded; `readonly` refused; `full` could raise call-count limits to a hard 2× ceiling).
-* **`bridge.rs`** built the `CapabilityRegistry`: the parent's visible tools (each re-wrapped so the **approval gate ran in the bridge**, it was _not_ on the repl path, which bypassed the harness `wrap_tool` middleware), the turn's provider model, and a sub-agent capability per `allowed_subagent_ids`. Recursion/duplication hazards (`rhai`, legacy `rlm`, `spawn_*`, workflow tools, `CliRpcOnly`-scoped tools) were excluded. Because `eval_cell` ran on `spawn_blocking` + `block_on`, the `agent_query` adapter re-installed the `PARENT_CONTEXT` task-local that `run_subagent` resolves.
-* **`sessions.rs`** was a bounded (LRU + idle-TTL) manager of persistent sessions, one cell at a time (a concurrent call on a busy session returned a typed "busy" error).
-* **`ops.rs`** ran the cell on `spawn_blocking` under a layered time bound (rhai `on_progress` deadline → `bridge_block_on` timer race → outer `tokio::timeout` backstop → harness `ToolTimeout`), wired the run-cancellation token to a fresh per-cell `ReplCancelFlag`, and mapped every failure mode to a model-consumable result.
+### Toolkit-specific specialists
-The tool was registered for the orchestrator on `supervised`/`full` tiers only, behind an `OPENHUMAN_RHAI_WORKFLOWS=0` kill switch.
+For Composio toolkits with hundreds of actions (GitHub alone has 500+), loading every action into the sub-agent's tool set balloons prompt size. The harness ranks the toolkit's actions against the parent-refined task prompt with a cheap CPU-only filter (verb detection, token overlap, verb-alignment boost) and only loads the top-ranked subset into the sub-agent. No model call, pure heuristic, fast and explainable.
-## Triage - handling external triggers
+## Triage: handling external triggers
-When a webhook fires, a cron ticks, or a Composio event arrives, the system can't just hand it straight to the orchestrator. Most triggers are noise; some warrant a notification; only a few deserve a full agent turn. The **trigger-triage pipeline** is the gate.
+When a webhook fires, a cron ticks, or a Composio event arrives, the system can't just hand it straight to the orchestrator. Most triggers are noise; some warrant a notification; only a few deserve a full agent turn. The trigger-triage pipeline is the gate.
-```
+```text
TriggerEnvelope ──► run_triage ──► TriageDecision ──► apply_decision
│ │
│ ├─► drop (noise)
@@ -393,50 +447,50 @@ TriggerEnvelope ──► run_triage ──► TriageDecision ──► apply_de
└── small local LLM (with cloud-LLM retry fallback)
```
-The evaluator is intentionally cheap - a small local model where available, falling back to a remote model on retry. The decision is cached so identical triggers don't re-classify. Only triggers that escalate to "spawn orchestrator" go through the full `Agent::turn` machinery.
+The evaluator is intentionally cheap: a small local model where available, falling back to a remote model on retry. The decision is cached so identical triggers don't re-classify. Only triggers that escalate to "spawn orchestrator" go through the full `Agent::turn` machinery.
-## Hooks - observability and policy levers
+## Hooks: observability and policy levers
Two hook surfaces wrap the loop, on opposite ends:
### Stop hooks (mid-turn)
-Stop hooks fire **between** iterations of the tool-call loop. They're the policy lever for budget caps, rate limits, and custom kill switches. Built-in hooks:
+Stop hooks fire between iterations of the tool-call loop. They're the policy lever for budget caps, rate limits, and custom kill switches. Built-in hooks:
-* **Budget stop hook** - caps cumulative turn cost in USD using the per-iteration cost accumulator.
-* **Max-iterations stop hook** - caps iteration count from outside the agent's persistent config.
-* **Action budget policy** - `SecurityPolicy` enforces `config.autonomy.max_actions_per_hour` for side-effecting tool operations. Users can tune it in Settings -> Advanced -> Agent autonomy, or operators can override it with `OPENHUMAN_MAX_ACTIONS_PER_HOUR`.
+- Budget stop hook: caps cumulative turn cost in USD using the per-iteration cost accumulator.
+- Max-iterations stop hook: caps iteration count from outside the agent's persistent config.
+- Action budget policy: `SecurityPolicy` enforces `config.autonomy.max_actions_per_hour` for side-effecting tool operations. Users can tune it in Settings, Advanced, Agent autonomy, or operators can override it with `OPENHUMAN_MAX_ACTIONS_PER_HOUR`.
A hook returning `Stop` aborts the loop with a clear reason the caller can surface to the user. Stop hooks are distinct from interrupts (next section): they're policy-driven, not user-driven.
### Post-turn hooks
-Post-turn hooks fire **after** the turn completes, in the background. They get a `TurnContext` snapshot - user message, assistant response, every tool call with arguments and outcome, total wall-clock, iteration count, session ID. Built-in consumers:
+Post-turn hooks fire after the turn completes, in the background. They get a `TurnContext` snapshot, user message, assistant response, every tool call with arguments and outcome, total wall-clock, iteration count, session ID. Built-in consumers:
-* **Cost log** - final per-turn cost line.
-* **Conversation logging** - the `memory` lifecycle logs the reply after the turn, with one-line tool results (never arguments); there is no batching or idle flush. See [Memory architecture](memory.md).
+- Cost log: final per-turn cost line.
+- Conversation logging: the `memory` lifecycle logs the reply after the turn, with one-line tool results (never arguments); there is no batching or idle flush. See [Memory architecture](memory.md).
Long-term facts are written explicitly: the agent calls the `memory` tool's `learn` action. There is no automatic archivist.
Hooks run via `tokio::spawn`, so the user gets their answer before any of them finish.
-## Interrupts - graceful cancellation
+## Interrupts: graceful cancellation
-Cancellation is the tinyagents **steering channel**. The old in-house `InterruptFence` (`harness/interrupt.rs`) is gone; when the user hits Ctrl+C or sends `/stop`, the runner forwards the request into the harness's steering/cancellation seam, which stops the loop at the same safe points the fence used to guard - before each tool execution, before each sub-agent spawn, before each provider call:
+Cancellation is the tinyagents steering channel. When the user hits Ctrl+C or sends `/stop`, the runner forwards the request into the harness's steering/cancellation seam, which stops the loop at safe points: before each tool execution, before each sub-agent spawn and before each provider call:
-* Every running sub-agent shares the cancellation scope and bails at its next checkpoint.
-* In-flight provider streams are dropped.
-* Buffered conversation turns are still stored (idle flush, or the exit flush on quit).
+- Every running sub-agent shares the cancellation scope and bails at its next checkpoint.
+- In-flight provider streams are dropped.
+- Buffered conversation turns are still stored (idle flush, or the exit flush on quit).
Interrupts are user-driven; stop hooks are policy-driven. Both enter the same harness pause/stop plumbing, but from different sides.
## Cost accounting
-Every provider response carries a `UsageInfo` block - input tokens, output tokens, cached input tokens, and an authoritative `charged_amount_usd` populated by the OpenHuman backend. `TurnCost` sums those across every provider call inside one turn so the harness can:
+Every provider response carries a `UsageInfo` block, input tokens, output tokens, cached input tokens, and an authoritative `charged_amount_usd` populated by the OpenHuman backend. `TurnCost` sums those across every provider call inside one turn so the harness can:
-* Emit per-iteration cost telemetry over the progress channel.
-* Feed the budget stop hook so a runaway turn cuts itself off mid-loop.
-* Log accurate end-of-turn cost lines.
+- Emit per-iteration cost telemetry over the progress channel.
+- Feed the budget stop hook so a runaway turn cuts itself off mid-loop.
+- Log accurate end-of-turn cost lines.
When the backend doesn't surface a charged amount (older builds, providers that don't bill through it), a small per-tier rate table provides a token-rate floor estimate. Direct cost from the backend always wins when available.
@@ -444,147 +498,138 @@ When the backend doesn't surface a charged amount (older builds, providers that
The assistant-ui-elements integration added a batch of additive `WebChannelEvent`s and RPCs so the frontend can render tool args/timing, plan/goal/queue state, and turn lifecycle without polling. `EVENTS_VERSION` (`core/bus.rs`) is `1.4.0`; every new field is optional/defaulted so an older subscriber keeps parsing what a newer publisher emits.
-**New/extended socket events** (bridged from `DomainEvent` onto `WebChannelEvent` by `web_chat::event_bus` and `openhuman_rpc::server::socketio`):
+New/extended socket events (bridged from `DomainEvent` onto `WebChannelEvent` by `web_chat::event_bus` and `openhuman_rpc::server::socketio`):
-* `ts` (epoch ms) is now stamped on every event by `publish_web_channel_event` when the producer left it unset, so the frontend can order/measure latency without guessing at receive time.
-* `chat_done.timing` - `{ first_token_ms, first_tool_ms, total_ms, tokens_per_second }`, threaded from the progress bridge's per-turn `TurnTiming` through `ProgressBridgeHandle::timing_snapshot()`. `tokens_per_second` is derived from `output_tokens / (total_ms / 1000)` when both are known and `total_ms > 0`.
-* `chat_cancelled` - `{ thread_id, client_id, request_id, cancel_reason: "user_stop" | "superseded", superseded_by }`. Emitted alongside (not instead of) the existing `chat_error{error_type:"cancelled"}` for one release, on both the unscoped/scoped stop path and the superseded-by-a-newer-request path, and on the parallel-turn cooperative-cancel path (which previously published no terminal event at all).
-* `chat_error{error_type:"guardrail"}` - carries a `guardrail: { verdict, score, reasons: [{code,message}] }` payload when `start_chat` rejects a message via `StartChatError::Guardrail` (the prompt-injection/security guardrail). Every other rejection stays `error_type:"inference"`. The RPC surface (`channel.web_chat`'s `Result<_, String>`) encodes the same structured verdict as a `GUARDRAIL:<json>` sentinel string (`web_chat::ops::start_chat::{GUARDRAIL_ERROR_PREFIX, is_guardrail_error_message}`, mirroring the existing `BACKEND_UNAVAILABLE:` pattern).
-* `turn_cost` - live per-turn cost readout from `AgentProgress::TurnCostUpdated`, throttled to at most one emission per 750ms per turn (the first update always emits immediately): `{ thread_id, client_id, request_id, round, usage: { input_tokens, output_tokens, cached_input_tokens, cost_usd, context_window, subagents } }`. `subagents` is always empty on this live event (it is the parent's cumulative rollup only); per-sub-agent attribution still only shows up on the terminal `chat_done.usage`.
-* `approval_decided` / `plan_review_decided` - bridged from `DomainEvent::ApprovalDecided` / `PlanReviewDecided`, which gained `thread_id`, `client_id`, `tool_call_id`, and `resolution` (`"expired"` on TTL/sweep, `"cancelled"` on a dropped decision channel, `None` for an ordinary user decision - carried on the wire as the existing `cancel_reason` field). Only surfaced when the original park had both `thread_id` and `client_id` (chat-routed).
-* `run_mode_changed` - `{ thread_id, client_id: "", message: "plan" | "build" }`, bridged from `DomainEvent::ThreadRunModeChanged`, published by `agent::tinyagents::run_mode::set_mode`.
-* `thread_todos_changed`, `queue_item_queued` / `queue_item_delivered` / `queue_item_removed` - `queue_item` carries `{ id, lane, text_preview }`.
-* Sub-agent correlation: `subagent_spawned`/`subagent_completed`/`subagent_failed`/`subagent_awaiting_user` carry `subagent.parent_call_id` (the spawning tool call's id - every worker of one `spawn_parallel_agents` call shares it); `subagent_completed` also carries `subagent.output` (capped final text). `tool_call.args`/`tool_result.args`+`elapsed_ms` now carry real arguments and timing instead of `null` (from tinyagents' `AgentEvent::ToolStarted.input`).
-* Artifact events (`ArtifactPending`/`ArtifactReady`/`ArtifactFailed`) carry `tool_call_id` and `turn_request_id`, the latter filled from the originating turn's `ApprovalChatContext::request_id` so the frontend can bind an artifact card to the exact turn that produced it (`None` for CLI/cron/sub-agent producers with no chat context).
+- `ts` (epoch ms) is stamped on every event by `publish_web_channel_event` when the producer left it unset, so the frontend can order/measure latency without guessing at receive time.
+- `chat_done.timing`: `{ first_token_ms, first_tool_ms, total_ms, tokens_per_second }`, threaded from the progress bridge's per-turn `TurnTiming` through `ProgressBridgeHandle::timing_snapshot()`. `tokens_per_second` is derived from `output_tokens / (total_ms / 1000)` when both are known and `total_ms > 0`.
+- `chat_cancelled`: `{ thread_id, client_id, request_id, cancel_reason: "user_stop" | "superseded", superseded_by }`. Emitted alongside (not instead of) the existing `chat_error{error_type:"cancelled"}`, on both the unscoped/scoped stop path and the superseded-by-a-newer-request path, and on the parallel-turn cooperative-cancel path (which previously published no terminal event at all).
+- `chat_error{error_type:"guardrail"}`: carries a `guardrail: { verdict, score, reasons: [{code,message}] }` payload when `start_chat` rejects a message via `StartChatError::Guardrail` (the prompt-injection/security guardrail). Every other rejection stays `error_type:"inference"`. The RPC surface (`channel.web_chat`'s `Result<_, String>`) encodes the same structured verdict as a `GUARDRAIL:<json>` sentinel string (`web_chat::ops::start_chat::{GUARDRAIL_ERROR_PREFIX, is_guardrail_error_message}`, mirroring the existing `BACKEND_UNAVAILABLE:` pattern).
+- `turn_cost`: live per-turn cost readout from `AgentProgress::TurnCostUpdated`, throttled to at most one emission per 750ms per turn (the first update always emits immediately): `{ thread_id, client_id, request_id, round, usage: { input_tokens, output_tokens, cached_input_tokens, cost_usd, context_window, subagents } }`. `subagents` is always empty on this live event (it is the parent's cumulative rollup only); per-sub-agent attribution still only shows up on the terminal `chat_done.usage`.
+- `approval_decided` / `plan_review_decided`: bridged from `DomainEvent::ApprovalDecided` / `PlanReviewDecided`, which gained `thread_id`, `client_id`, `tool_call_id`, and `resolution` (`"expired"` on TTL/sweep, `"cancelled"` on a dropped decision channel, `None` for an ordinary user decision, carried on the wire as the existing `cancel_reason` field). Only surfaced when the original park had both `thread_id` and `client_id` (chat-routed).
+- `run_mode_changed`: `{ thread_id, client_id: "", message: "plan" | "build" }`, bridged from `DomainEvent::ThreadRunModeChanged`, published by `agent::tinyagents::run_mode::set_mode`.
+- `thread_todos_changed`, `queue_item_queued` / `queue_item_delivered` / `queue_item_removed`, `queue_item` carries `{ id, lane, text_preview }`.
+- Sub-agent correlation: `subagent_spawned`/`subagent_completed`/`subagent_failed`/`subagent_awaiting_user` carry `subagent.parent_call_id` (the spawning tool call's id: every worker of one `spawn_parallel_agents` call shares it); `subagent_completed` also carries `subagent.output` (capped final text). `tool_call.args`/`tool_result.args`+`elapsed_ms` now carry real arguments and timing instead of `null` (from tinyagents' `AgentEvent::ToolStarted.input`).
+- Artifact events (`ArtifactPending`/`ArtifactReady`/`ArtifactFailed`) carry `tool_call_id` and `turn_request_id`, the latter filled from the originating turn's `ApprovalChatContext::request_id` so the frontend can bind an artifact card to the exact turn that produced it (`None` for CLI/cron/sub-agent producers with no chat context).
-**New RPCs:**
+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.goal_get` / `threads.todos_get` - read a thread's current goal/todo state directly (previously only observable via the bridged events).
-* `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.
-* `commands.list` - merges built-in commands with `skills.list` and `flows.list` into one slash-command catalog.
+- `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.goal_get` / `threads.todos_get`: read a thread's current goal/todo state directly .
+- `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.
+- `commands.list`: merges built-in commands with `skills.list` and `flows.list` into one slash-command catalog.
-`plan_exit` (the tool that flips a thread from Plan back to Build) only flips the mode when there is no plan review still parked on that thread (`agent::plan_review::gate::PlanReviewGate::parked_review_for_thread`) - a review resolves before `request_plan_review` returns control to the agent, so this only matters for a mis-timed/concurrent `plan_exit` call racing a still-pending review, which must not unlock every tool before the user has actually approved anything.
+`plan_exit` (the tool that flips a thread from Plan back to Build) only flips the mode when there is no plan review still parked on that thread (`agent::plan_review::gate::PlanReviewGate::parked_review_for_thread`), a review resolves before `request_plan_review` returns control to the agent, so this only matters for a mis-timed/concurrent `plan_exit` call racing a still-pending review, which must not unlock every tool before the user has actually approved anything.
## Explicit run context and host capabilities
-`OpenHumanRunContext` is now the live carrier at the shared chat, channel, and sub-agent turn seam. Roots snapshot their currently scoped origin, progress, stop hooks, dispatch state, thread, route slot, and workspace grant, then own or explicitly receive one cancellation token before passing the context to the runner; a recursive sub-agent forks it with `child()`, preserving shared cancellation/policy handles while isolating route observation and usage accounting. The shared runner creates `RunContext<OpenHumanRunContext>` through `into_tinyagents`, and the OpenHuman assembly and middleware registry consume that typed context directly. Route, and thread scopes still surround the drive only for legacy tool/model APIs outside the typed harness boundary. Recursive fan-out receives cancellation and workspace from its typed parent `RunContext` through `ToolDispatch`; it never reads ambient cancellation state.
-
-`OpenHumanHostBundleFactory` is the B1 host composition point. It constructs the context, definition, security, model, memory, budget, progress, tool-outcome and experience adapters from the same session/runtime inputs. OpenHuman retains all policy decisions; TinyAgents receives only the resulting canonical run context today. Wiring the complete host-capability bundle into every invocation remains a later cutover step.
+`OpenHumanRunContext` is the live carrier at the shared chat, channel, and
+sub-agent turn seam. Roots snapshot their currently scoped origin, progress,
+stop hooks, dispatch state, thread, route slot, and workspace grant, then own
+or explicitly receive one cancellation token before passing the context to the
+runner; a recursive sub-agent forks it with
+`child()`, preserving shared cancellation/policy handles while isolating route
+observation and usage accounting. The shared runner creates
+`RunContext<OpenHumanRunContext>` through `into_tinyagents`, and the OpenHuman
+assembly and middleware registry consume that typed context directly. Route,
+and thread scopes still surround the drive only for legacy tool/model APIs
+outside the typed harness boundary. Recursive fan-out receives cancellation and
+workspace from its typed parent `RunContext` through `ToolDispatch`; it never
+reads ambient cancellation state.
+
+`OpenHumanHostBundleFactory` is the B1 host composition point. It constructs
+the context, definition, security, model, memory, budget, progress,
+tool-outcome and experience adapters from the same session/runtime inputs.
+OpenHuman retains all policy decisions; TinyAgents receives only the resulting
+canonical run context today. Wiring the complete host-capability bundle into
+every invocation remains a later cutover step.
## Self-healing recap
A few small adaptive systems sit on top of the main loop:
-* **Tool-output summary circuit-breaker** - three consecutive summary failures in a thread make TinyJuice stop asking for summaries in that thread, so results fall back to compaction and truncation.
-* **Triage local-vs-remote retry** - local LLM first; remote fallback on parse failure.
-* **Unknown-tool and malformed-argument recovery** - middleware rewrites an invalid model tool call into a recoverable result instead of aborting the run.
+- Tool-output summary circuit-breaker: three consecutive summary failures in a thread make TinyJuice stop asking for summaries in that thread, so results fall back to compaction and truncation.
+- Triage local-vs-remote retry: local LLM first; remote fallback on parse failure.
+- Unknown-tool and malformed-argument recovery: middleware rewrites an invalid model tool call into a recoverable result instead of aborting the run.
-None of these change the loop's shape - they just make the common failure modes recoverable without the user having to intervene.
+None of these change the loop's shape, they just make the common failure modes recoverable without the user having to intervene.
## Where to look in the code
The harness shell lives under `crates/openhuman-core/src/agent/`, with the tinyagents adapter seam in `crates/openhuman-core/src/agent/tinyagents/` and archetype definitions in `crates/openhuman-core/src/agent/registry/`. The README in `crates/openhuman-core/src/agent/` enumerates the public surface; the most load-bearing files (paths relative to `crates/openhuman-core/src/agent/` unless prefixed) are:
-| File / dir | What lives there |
-| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `session_host/runtime_session.rs` | `Agent::turn` - the lifecycle described above; routes into the tinyagents runner via `tinyagents/turn_runner.rs`. |
-| `tinyagents/mod.rs` | `run_turn_via_tinyagents_shared` - the shared tinyagents harness assembly (the live loop). |
-| `tinyagents/middleware.rs` | The named OpenHuman middleware stack (approval/security, tool policy, recovery, budgets, circuit breaker). |
-| `harness/graph.rs` | The channel/CLI bus turn route into the tinyagents runner. |
-| `subagent_host/` | Direct OpenHuman planner/executor/persistence adapters for `tinyagents-orchestration::subagent`; product prompt/tool/model/security/artifact/progress behavior remains here. |
-| `orchestration/subagent_sessions/` | Durable reusable sub-agent identity, compatibility matching, persisted status/history. |
-| `harness/definition.rs` | `AgentDefinition` - what an archetype declares. |
-| `subagent_host/ops/runner.rs` | Integration-tool ranking and the host execution leaf; generic lifecycle stays in `tinyagents-orchestration`. |
-| `tinyagents/payload_summarizer.rs` | The model call behind TinyJuice's oversized-tool-result summary. |
-| `session_host/tool_progress.rs` | Surviving OpenHuman seam: `TurnProgress`. |
-| `message_convert.rs` | Concrete durable/provider conversion around canonical tool-call dialect APIs. |
-| `triage/` | External-trigger classification + escalation. |
-| `registry/agents/` | Built-in archetypes - one subdirectory per agent. |
-| `hooks.rs` / `stop_hooks.rs` | Post-turn and mid-turn hook surfaces. |
-| `cost.rs` | Per-turn USD/token accounting. |
-| `progress.rs` | Real-time progress events to the UI. |
-
-## Agent state graphs (`agent_graph`): HISTORICAL (removed)
-
-> **⚠️ This section describes a design that was never shipped and has been removed.** The bespoke `agent_graph/` engine, `GraphBlueprint`, and the `SqliteCheckpointer` described below **do not exist** at those paths any more. The live system runs on the published **tinyagents** crate; see the status banner at the top of this page and "Agent engine + orchestration on tinyagents (live)" below. Graphs are built with `tinyagents::graph::GraphBuilder` (`orchestration/*/graph.rs`, `orchestration/delegation.rs`), durable checkpoints use TinyAgents' own `SqliteCheckpointer` (the earlier `SqlRunLedgerCheckpointer` adapter is retired), and per-agent graph selection is `AgentGraph` (`agent/harness/agent_graph.rs`) with each agent's `registry/agents/<id>/graph.rs`. The text below is retained only as pre-migration design history.
-
-Alongside the linear tool-call loop, the harness ships a **LangGraph-style state-machine engine** under `crates/openhuman-core/src/agent_graph/` (issue #4249, referenced here only as design history, the path no longer exists). Where the loop is an implicit "prompt → tool → result → next prompt" cycle, a graph models agent execution as an explicit directed graph of **nodes** (states) and **edges** (transitions), with typed working state that survives across transitions, parallel branches, and checkpoints.
-
-```rust
-StateGraph::new(name)
- .add_node(id, node) // a unit of work: async fn(State) -> (State, Command)
- .add_edge(from, to) // static transition
- .add_conditional_edges(...) // route by inspecting state
- .add_fork(from, [a, b]) // fan out in parallel; merge via State::merge
- .set_entry_point(id) / .set_finish_point(id)
- .compile()? -> CompiledGraph // validated; .invoke(state) / .resume_with(...)
-```
-
-| Subfolder | Role |
-| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `graph/` | The engine: `GraphState` (merge reducer), `Node` trait, builder + `compile()` validation, Pregel super-step `executor` with cycle / cancel / step-cap guards, `invoke`/`resume`. |
-| `checkpoint/` | `Checkpointer` trait (type-erased JSON state) → `InMemoryCheckpointer` (tests) + `SqliteCheckpointer` at `{workspace}/.openhuman/agent_graph/checkpoints.db`. Durable pause/resume. |
-| `hitl/` | Human-in-the-loop: `approval`/`clarification` interrupt builders + `ApplyResume` (folds the human's answer into state on resume). A node returns `Command::Interrupt` to pause. |
-| `observability/` | `EventBusSink` (a `ProgressSink`) emits `tracing` spans + publishes the `GraphRun*`/`GraphNode*` `DomainEvent` family (new `agent_graph` event domain). |
-| `summarization/` | Node-boundary wrapper over `context::summarize_chat_history`. |
-| `memory/` | Pre-node wrapper for memory context. |
-| `definitions/` | Built-in graphs over a shared `ProductState`: `canonical_turn` (the agent turn as a `dispatch → parse → stop_check → tools → compact → loop / finalize` graph) and `plan_execute_review` (composes the `planner` with a worker archetype around a HITL review gate), plus a deterministic `demo_review` twin for tests. A registry (`list_definitions`/`build_definition`) + `runner` (`run_graph`/`resume_graph`) persist runs to the checkpointer and emit bus events. |
-| `blueprint/` | The per-agent chain type. Every built-in agent declares its LangGraph-compatible chain in a `graph.rs` next to `prompt.rs` (`pub fn graph() -> GraphBlueprint`), wired into `BuiltinAgent.graph_fn`. `GraphBlueprint` is serializable (typed `NodeKind`/`EdgeSpec`), structurally validated, and `compile()`s to a real `CompiledGraph`. Reusable shapes: `canonical_turn` (most agents), `single_shot`, `orchestrator`, `plan_execute_review`. Inspect via `openhuman.agent_graph_{agent_list,agent_graph}`. |
-
-### Per-agent graphs (`graph.rs`)
-
-Each agent folder under `crates/openhuman-core/src/agent/registry/agents/<name>/` (and the four agents that live in their own domains) now contains, alongside `agent.toml` + `prompt.rs`:
-
-* **`graph.rs`**: `pub fn graph() -> GraphBlueprint`. `prompt.rs` defines what the agent _says_; `graph.rs` defines how it _runs_, meaning its node/edge chain. A loader test asserts **every** built-in agent's chain validates and compiles, so a malformed chain fails CI.
-
-Most agents reuse `blueprint::canonical_turn(id)` (the standard tool-calling loop); one-pass agents use `single_shot`, the orchestrator uses the delegation chain, and the planner uses `plan_execute_review`.
-
-**RPC surface** (`schemas.rs` + `ops.rs`, registered in `crates/openhuman-core/src/core/all.rs`): `openhuman.agent_graph_definition_list`, `_run`, `_run_list`, `_run_get`, `_checkpoint_list`, `_resume`.
-
-> **Status (issue #4249, superseded by the published `tinyagents` crate):** the in-house `agent_graph` engine described in this section **no longer exists**. openhuman's agent engine + orchestration now run on the published [`tinyagents`](https://crates.io/crates/tinyagents) **2.1** crate (the same LangGraph-style harness + durable graph runtime), via the adapter seam in `crates/openhuman-core/src/agent/tinyagents/`. The sections above are retained as design history; the subsection below describes the live architecture.
-
-## Agent engine + orchestration on tinyagents (live)
-
-Every agent turn uses TinyAgents. Chat and channel/CLI callers invoke the session/turn host, while a sub-agent call enters `agent/subagent_host` and its direct `tinyagents-orchestration::subagent` lifecycle. There is no `harness/subagent_runner` compatibility path. The surrounding OpenHuman seam:
-
-| File (`crates/openhuman-core/src/agent/tinyagents/`) | Role |
-| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `mod.rs` | The runner (`run_turn_via_tinyagents_shared`): installs the native `ChatModel`, host tool adapters, and middleware on an `AgentHarness`; runs one turn; caps output through `MaxTokensModel` (`agent/tinyagents/model.rs`); mirrors progress; forwards steering; and pauses gracefully at the model-call cap. |
-| `mod.rs` / `model.rs` / `tools.rs` / `convert.rs` | `RunPolicy` / `ChatModel` / `Tool` / message adapters (incl. unknown-tool policy and out-of-band reasoning forwarding). |
-| `observability.rs` | Harness `AgentEvent` → `AgentProgress` + cost; `GraphTracingSink` for graph events. |
-| `orchestration.rs` | Re-exported `graph::orchestration` task-store types; map-reduce fanout now uses the TinyAgents SDK surface directly. |
-| `delegation.rs` | The durable `plan → execute ⇄ review → finalize` delegation graph (production worker wired in `orchestration::delegation`), checkpointed via TinyAgents 2.1's own `SqliteCheckpointer`. The earlier `SqlRunLedgerCheckpointer` adapter and its `checkpoint.rs` are retired. |
-
-**Orchestration on graphs** (`crates/openhuman-core/src/agent/orchestration/`):
-
-* **Workflow phase DAG** (`workflow_runs/engine.rs`) runs on a `dispatch ⇄ run_phase → done` conditional-routing graph; each phase fans its agents out via `graph::parallel::map_reduce`. The durable `workflow_runs` row stays the source of truth (controllers + resume read it).
-* **Team member runtime** (`agent_teams/runtime.rs`, `run_member_graph`) is a conditional-routing graph (`execute → complete|fail → done`).
-* **Multi-stage delegation** (`orchestration::delegation` + the `delegate` tool) runs `delegation.rs`, checkpointed to the session DB.
-* **Detached sub-agents** (`running_subagents.rs`) use TinyAgents `DetachedTaskRegistry` for ownership-aware snapshots, wait/timeout, steering lookup, cooperative cancellation, hard abort, and terminal cleanup. OpenHuman retains durable task-store projection, product/session metadata, RPC and delivery semantics, and the `RunQueue` compatibility fallback.
-
-**Deliberately kept off the crate's primitives** (documented engineering decisions, not gaps):
-
-* **Sub-agent host policy** (`subagent_host/`) stays OpenHuman-owned: definition resolution, archetype tool filtering, provider resolution, narrow prompt building, memory context, worker-thread mirror, handoff configuration and product checkpoint/session projection. It implements the TinyAgents planner/executor/persistence traits directly. The neutral driver, not a host-local runner, owns lifecycle sequencing and task-key coalescing.
-* **Durable run ledgers** (`workflow_runs`, `agent_teams`, `command_center`, `subagent_sessions`) stay on openhuman SQLite/JSON until their controller projections and restart semantics are mapped onto TinyAgents task/status/journal records. The `agent_teams` race-safe SQL compare-and-swap task claim remains OpenHuman-owned.
-
-> **Note:** TinyAgents 2.1 ships harness store/cache/session primitives (`harness::store` with JSONL append stores, `harness::cache`, `harness::subagent`, lineage-aware status), graph task stores, the detached runtime registry, and conformance contracts. The session shell and product-specific sub-agent build/delivery pipeline remain OpenHuman-owned.
-
-## Reliability: breakers, handback, and classified failures
+| File / dir | What lives there |
+| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
+| `session_host/runtime_session.rs` | `Agent::turn`: the lifecycle described above; routes into the tinyagents runner via `tinyagents/turn_runner.rs`. |
+| `tinyagents/mod.rs` | `run_turn_via_tinyagents_shared`: the shared tinyagents harness assembly (the live loop). |
+| `tinyagents/middleware.rs` | The named OpenHuman middleware stack (approval/security, tool policy, recovery, budgets, circuit breaker). |
+| `harness/graph.rs` | The channel/CLI bus turn route into the tinyagents runner. |
+| `subagent_host/` | Direct OpenHuman planner/executor/persistence adapters for `tinyagents-orchestration::subagent`; product prompt/tool/model/security/artifact/progress behavior remains here. |
+| `orchestration/subagent_sessions/` | Durable reusable sub-agent identity, compatibility matching, persisted status/history. |
+| `harness/definition.rs` | `AgentDefinition`: what an archetype declares. |
+| `subagent_host/ops/runner.rs` | Integration-tool ranking and the host execution leaf; generic lifecycle stays in `tinyagents-orchestration`. |
+| `tinyagents/payload_summarizer.rs` | The model call behind TinyJuice's oversized-tool-result summary. |
+| `session_host/tool_progress.rs` | Surviving OpenHuman seam: `TurnProgress`. |
+| `message_convert.rs` | Concrete durable/provider conversion around canonical tool-call dialect APIs. |
+| `triage/` | External-trigger classification + escalation. |
+| `registry/agents/` | Built-in archetypes: one subdirectory per agent. |
+| `hooks.rs` / `stop_hooks.rs` | Post-turn and mid-turn hook surfaces. |
+| `cost.rs` | Per-turn USD/token accounting. |
+| `progress.rs` | Real-time progress events to the UI. |
+
+## Agent engine and orchestration on tinyagents
+
+Every agent turn uses TinyAgents. Chat and channel/CLI callers invoke the
+session/turn host, while a sub-agent call enters `agent/subagent_host` and its
+direct `tinyagents-orchestration::subagent` lifecycle. There is no
+`harness/subagent_runner` compatibility path. The surrounding OpenHuman seam:
+
+| File (`crates/openhuman-core/src/agent/tinyagents/`) | Role |
+| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `mod.rs` | The runner (`run_turn_via_tinyagents_shared`): installs the native `ChatModel`, host tool adapters, and middleware on an `AgentHarness`; runs one turn; caps output through `MaxTokensModel` (`agent/tinyagents/model.rs`); mirrors progress; forwards steering; and pauses gracefully at the model-call cap. |
+| `mod.rs` / `model.rs` / `tools.rs` / `convert.rs` | `RunPolicy` / `ChatModel` / `Tool` / message adapters (incl. unknown-tool policy and out-of-band reasoning forwarding). |
+| `observability.rs` | Harness `AgentEvent` → `AgentProgress` + cost; `GraphTracingSink` for graph events. |
+| `orchestration.rs` | Re-exported `graph::orchestration` task-store types; map-reduce fanout uses the TinyAgents SDK surface directly. |
+| `delegation.rs` | The durable `plan → execute ⇄ review → finalize` delegation graph (production worker wired in `orchestration::delegation`), checkpointed via TinyAgents' own `SqliteCheckpointer`. |
+
+Orchestration on graphs (`crates/openhuman-core/src/agent/orchestration/`):
+
+- Workflow phase DAG (`workflow_runs/engine.rs`) runs on a `dispatch ⇄ run_phase → done` conditional-routing graph; each phase fans its agents out via `graph::parallel::map_reduce`. The durable `workflow_runs` row stays the source of truth (controllers + resume read it).
+- Team member runtime (`agent_teams/runtime.rs`, `run_member_graph`) is a conditional-routing graph (`execute → complete|fail → done`).
+- Multi-stage delegation (`orchestration::delegation` + the `delegate` tool) runs `delegation.rs`, checkpointed to the session DB.
+- Detached sub-agents (`running_subagents.rs`) use TinyAgents `DetachedTaskRegistry` for ownership-aware snapshots, wait/timeout, steering lookup, cooperative cancellation, hard abort, and terminal cleanup. OpenHuman retains durable task-store projection, product/session metadata, RPC and delivery semantics, and the `RunQueue` compatibility fallback.
+
+Deliberately kept off the crate's primitives (these are design decisions, not gaps):
+
+- Sub-agent host policy (`subagent_host/`) stays OpenHuman-owned: definition
+ resolution, archetype tool filtering, provider resolution, narrow prompt
+ building, memory context, worker-thread mirror, handoff configuration and
+ product checkpoint/session projection. It implements the TinyAgents
+ planner/executor/persistence traits directly. The neutral driver, not a
+ host-local runner, owns lifecycle sequencing and task-key coalescing.
+- Durable run ledgers (`workflow_runs`, `agent_teams`, `command_center`, `subagent_sessions`) stay on openhuman SQLite/JSON until their controller projections and restart semantics are mapped onto TinyAgents task/status/journal records. The `agent_teams` race-safe SQL compare-and-swap task claim remains OpenHuman-owned.
+
+> TinyAgents ships harness store/cache/session primitives (`harness::store` with JSONL append stores, `harness::cache`, `harness::subagent`, lineage-aware status), graph task stores, the detached runtime registry, and conformance contracts. The session shell and product-specific sub-agent build/delivery pipeline remain OpenHuman-owned.
+
+## Reliability: breakers, handback and classified failures
Three cooperating mechanisms keep runs from wandering or dying silently:
-**No-progress circuit breaker** (`RepeatedToolFailureMiddleware`, `crates/openhuman-core/src/agent/tinyagents/middleware.rs`) is a thin driver over the crate's `NoProgressTracker`. It fingerprints each tool call's arguments and feeds outcomes into an escalation ladder: `Continue` → `Nudge` (a structured "no progress since step X" corrective injected via `SteeringCommand::InjectMessage`, which is safe inside interactive turns) → `Halt` (record a root-cause summary into the `HaltSummarySlot`, pause via the steering handle). Identical arguments retried count toward the trip (threshold 3 consecutive identical failures); _recoverable_ failures (timeouts, connection resets, rate limits, 5xx) get an extended headroom ladder instead of the fixed crate thresholds.
+No-progress circuit breaker (`RepeatedToolFailureMiddleware`, `crates/openhuman-core/src/agent/tinyagents/middleware.rs`) is a thin driver over the crate's `NoProgressTracker`. It fingerprints each tool call's arguments and feeds outcomes into an escalation ladder: `Continue` → `Nudge` (a structured "no progress since step X" corrective injected via `SteeringCommand::InjectMessage`, which is safe inside interactive turns) → `Halt` (record a root-cause summary into the `HaltSummarySlot`, pause via the steering handle). Identical arguments retried count toward the trip (threshold 3 consecutive identical failures); _recoverable_ failures (timeouts, connection resets, rate limits, 5xx) get an extended headroom ladder instead of the fixed crate thresholds.
-**Sub-agent handback** (`subagent_host/`): a sub-agent run resolves to one of three statuses:
+Sub-agent handback (`subagent_host/`): a sub-agent run resolves to one of
+three statuses:
-* `Completed`: clean final response.
-* `AwaitingUser { question, options }`: the child called `ask_user_clarification`; the host projects its full checkpoint (history, question, options and overrides) under the complete TinyAgents task key `(root_run_id, parent_run_id, thread_id, task_id)`. Resume recovers that original key rather than deriving a new one from the fresh parent turn.
-* `Incomplete { reason }`: the child was halted by the breaker or hit its model-call cap. The delegating parent **relays the blocker** instead of treating a halted child as a finished answer or re-spinning the identical delegation.
+- `Completed`: clean final response.
+- `AwaitingUser { question, options }`: the child called
+ `ask_user_clarification`; the host projects its full checkpoint (history,
+ question, options and overrides) under the complete TinyAgents task key
+ `(root_run_id, parent_run_id, thread_id, task_id)`. Resume recovers that
+ original key rather than deriving a new one from the fresh parent turn.
+- `Incomplete { reason }`: the child was halted by the breaker or hit its model-call cap. The delegating parent relays the blocker instead of treating a halted child as a finished answer or re-spinning the identical delegation.
-A breaker halt at the top level is likewise never a silent finish, and the breaker's root-cause summary is not shown to the user as is either: it is worded for a model ("Report this back instead of retrying"). `hit_cap` / `breaker_halt` are surfaced on the turn result, and the chat turn closes the halted run the same way it closes a tool turn that ended without final text (`session_host/driver/grounded_close.rs`, #4093 / #6278 / #6279):
+A breaker halt at the top level is likewise never a silent finish, and the breaker's root-cause summary is not shown to the user as is either: it is worded for a model ("Report this back instead of retrying"). `hit_cap` / `breaker_halt` are surfaced on the turn result, and the chat turn closes the halted run the same way it closes a tool turn that ended without final text (`session_host/driver/grounded_close.rs`):
1. A tools-disabled wrap-up call whose instruction restates the turn's tool records, each failure's own message included, with the breaker summary passed as a stop note to explain rather than repeat.
2. A separate check call that sees only the request, the records and the candidate reply. It rejects a reply that only narrates intent, contradicts a record, or leaves out the failure that explains an unfinished request.
@@ -592,27 +637,25 @@ A breaker halt at the top level is likewise never a silent finish, and the break
Accepted text is streamed only after the check, so a rejected reply never renders.
-**Classified tool failures** (`crates/openhuman-core/src/tools/status/`): every failed tool call is classified into a transport-agnostic `ClassifiedFailure { class, category, cause_plain, next_action, recoverable }`. Classes cover `MissingPermission`, `MissingApp`, `ServiceUnavailable`, `BadCredentials`, `BlockedByPolicy`, `ModelConnection`, `Timeout`, `Denied`, `ApprovalExpired`; categories map 1:1 to UI states: _recoverable_ (safe auto-retry), _blocked by policy_ (change settings), _needs user confirmation_ (sign in / install / grant), _user declined_ (never auto-retried). The classification rides `AgentProgress::ToolCallCompleted.failure` (including for sub-agent calls) into the chat timeline.
+Classified tool failures (`crates/openhuman-core/src/tools/status/`): every failed tool call is classified into a transport-agnostic `ClassifiedFailure { class, category, cause_plain, next_action, recoverable }`. Classes cover `MissingPermission`, `MissingApp`, `ServiceUnavailable`, `BadCredentials`, `BlockedByPolicy`, `ModelConnection`, `Timeout`, `Denied`, `ApprovalExpired`; categories map 1:1 to UI states: _recoverable_ (safe auto-retry), _blocked by policy_ (change settings), _needs user confirmation_ (sign in / install / grant), _user declined_ (never auto-retried). The classification rides `AgentProgress::ToolCallCompleted.failure` (including for sub-agent calls) into the chat timeline.
-## Journals, replay, and migration shadows
+## Journals, replay and migration shadows
-Every run appends to a durable **event journal** (`tinyagents/journal.rs`): a `StoreEventJournal` over a JSONL append store at `{workspace}/tinyagents_store/journal`, composed as `FanOutSink` (live bridge + journal) → `RedactingSink` (credential masking before persistence), with restart-stable event ids (`{run_id}-evt-{offset}`). Even an unobserved background turn is reconstructable after the fact. Three read-only RPCs expose it: `agent_run_events` (paged, late-attach replay by `run_id`/`offset`/`limit`), `agent_run_status` (latest harness status), and `agent_runs_active` (active runs, filterable by thread or root run).
+Every run appends to a durable event journal (`tinyagents/journal.rs`): a `StoreEventJournal` over a JSONL append store at `{workspace}/tinyagents_store/journal`, composed as `FanOutSink` (live bridge + journal) → `RedactingSink` (credential masking before persistence), with restart-stable event ids (`{run_id}-evt-{offset}`). Even an unobserved background turn is reconstructable after the fact. Three read-only RPCs expose it: `agent_run_events` (paged, late-attach replay by `run_id`/`offset`/`limit`), `agent_run_status` (latest harness status), and `agent_runs_active` (active runs, filterable by thread or root run).
-The remaining store cutover runs on **shadow scaffolding** (product behavior unchanged; divergences logged):
+The remaining store cutover runs on shadow scaffolding. Product behavior is unchanged and divergences are logged:
-* **Session dual-write / shadow read** (`session_host/runtime_session.rs`): session messages dual-write into the TinyAgents store (default-ON flag `config.session_dual_write`); loads shadow-read for parity while the legacy file store stays authoritative.
+- Session dual-write / shadow read (`session_host/runtime_session.rs`): session messages dual-write into the TinyAgents store (default-ON flag `config.session_dual_write`); loads shadow-read for parity while the legacy file store stays authoritative.
-Goals and todos are crate-backed outright, with no shadow: thread goals live in the crate `graph.goals` KV store (`agent/goals/store.rs`), and the session todo list lives in the in-process crate `graph.todos` store (`agent/todos/ops.rs`); see [Goals & Todos](../../features/goals-and-todos.md).
+Goals and todos are crate-backed outright, with no shadow: thread goals live in the crate `graph.goals` KV store (`agent/goals/store.rs`), and the session todo list lives in the in-process crate `graph.todos` store (`agent/todos/ops.rs`); see [Goals and todos](../../features/goals-and-todos.md).
## Workload routes and the burst tier
-`tinyagents/routes.rs` is the declarative TinyAgents `ModelRouter` for the OpenHuman workload roles `chat`, `reasoning`, `agentic`, `coding`, `burst`, `summarization`, and `vision`, keyed by their `hint:*` aliases. It owns fallback chains and capability gates; `inference::provider::factory` resolves each selected role to its configured native `ChatModel`, on the managed backend, the pinned default model (`openrouter/deepseek/deepseek-v4-flash` unless changed under Settings → Routing → Default model); there are no per-role tier endpoints any more. The **`burst`** role serves low-context, high-fanout workers.
+`tinyagents/routes.rs` is the declarative TinyAgents `ModelRouter` for the OpenHuman workload roles `chat`, `reasoning`, `agentic`, `coding`, `burst`, `summarization`, and `vision`, keyed by their `hint:*` aliases. It owns fallback chains and capability gates; `inference::provider::factory` resolves each selected role to its configured native `ChatModel`, on the managed backend, the pinned default model (`openrouter/deepseek/deepseek-v4-flash` unless changed under Settings → Routing → Default model); there are no per-role tier endpoints. The `burst` role serves low-context, high-fanout workers.
## See also
-* [Architecture overview](./) - where the harness sits in the bigger picture.
-* [Memory](../../features/memory.md) and [Memory architecture](memory.md) - the `memory` tool, the per-turn memory lifecycle and conversation logging.
-* [Automatic Model Routing](../../features/model-routing/) - how `model: "hint:reasoning"` resolves to a concrete provider+model.
-* [Native Tools - Agent Coordination](../../features/native-tools/agent-coordination.md) - the user-facing surface for `spawn_subagent`, `delegate_*`, `todo`.
-
-[^1]: Skill-wildcard entries (`{ skills = "*" }`) are exempt because they name no agent: they expand to the connected Composio actions as `Deferred` tools the agent reaches through `tool_search`, not to a spawn.
+- [Architecture overview](README.md): where the harness sits in the bigger picture.
+- [Memory](../../features/memory.md) and [Memory architecture](memory.md): the `memory` tool, the per-turn memory lifecycle and conversation logging.
+- [Automatic model routing](../../features/model-routing/README.md): how `model: "hint:reasoning"` resolves to a concrete provider+model.
+- [Native tools: agent coordination](../../features/native-tools/agent-coordination.md): the user-facing surface for `spawn_subagent`, `delegate_*`, `todo`.
diff --git a/docs/gitbooks/en/developing/architecture/architecture.md b/docs/gitbooks/en/developing/architecture/architecture.md
deleted file mode 100644
index 44f52c4a12..0000000000
--- a/docs/gitbooks/en/developing/architecture/architecture.md
+++ /dev/null
@@ -1,333 +0,0 @@
----
-description: >-
- Deep architecture reference for the OpenHuman codebase - repo layout, runtime
- scope, dual-socket sync, RPC flow.
-icon: code-branch
----
-
-# Deep Architecture Reference
-
-**A personal AI assistant built on Rust, with 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 cross-platform communication and automation platform: a Rust core that runs agent turns, keeps a pluggable memory engine, and executes tools against memory, channels, integrations, and (for users who opt in) a wallet, all wrapped in a single React + Rust (Tauri) codebase that can target multiple platforms. **What we document and ship for users today is 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`) and are not part of the shipped desktop host; do not treat them as product-ready. The stack includes a managed Node.js runtime for tool-capable skills, persistent Rust-native WebSocket infrastructure to the backend, and a native Rust tool-dispatch path plus a standards-based Model Context Protocol (MCP) server for external clients.
-
-***
-
-## Repository layout (monorepo)
-
-| 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-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/`. There is no `src/rpc/` or `src/embed/` inside this crate any more. |
-| **`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. |
-| **`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 (`app/package.json` `core:stage` is a documented no-op). |
-| **`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/`). The legacy QuickJS / `rquickjs` skill execution runtime was removed; skills contribute metadata + tool descriptors that get injected into agent prompts, while tool execution flows through native Rust handlers and Node-backed helpers via `runtime::node` (Cargo feature `runtime-node`). |
-| **`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`) plus `motosan-ai-oauth`. |
-
-The desktop app **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`, `run_server_embedded_with_ready`) 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.
-
-***
-
-## Platform reach
-
-**Supported today (end users):** desktop. Windows, macOS, Linux (native installers).
-
-**Not supported yet:** Android, iOS, standalone web client (may exist as experimental targets in the repo; do not treat as product-ready).
-
-```
- OpenHuman (shipping)
- |
- Desktop
- / | \
- Windows macOS Linux
- x64 x64 x64
- ARM64 ARM64 ARM64
-```
-
-Tauri v2 compiles the Rust core into native binaries per platform, embedding the React frontend as a lightweight WebView. Desktop builds produce `.dmg`, `.msi`, `.AppImage`, and `.deb` installers. Additional targets (mobile, web) are out of scope until explicitly documented as supported.
-
-***
-
-## High-level architecture
-
-```
-+------------------------------------------------------------------+
-| React Frontend |
-| Redux Toolkit | coreRpcClient (fetch) | Socket.IO client | UI |
-+------------------------------------------------------------------+
- | HTTP JSON-RPC (loopback) | Socket.IO (loopback)
- | Tauri IPC (windows, hotkeys, relay_http_rpc fallback)
-+------------------------------------------------------------------+
-| Rust Core (openhuman_core) |
-| |
-| +------------------+ +------------------+ +-----------------+ |
-| | Agent harness | | Socket Manager | | Memory (v2) | |
-| | (tinyagents) | | (client to | | + encryption | |
-| | + tool dispatch | | backend, WS) | | at rest | |
-| +------------------+ +------------------+ +-----------------+ |
-| |
-| +------------------+ +------------------+ +-----------------+ |
-| | Skill metadata | | Cron Scheduler | | Session & Auth | |
-| | & tool registry | | (`cron` domain) | | Management | |
-| +------------------+ +------------------+ +-----------------+ |
-| |
-| +------------------+ +------------------+ +-----------------+ |
-| | Channel | | SQLite Storage | | OS Keychain | |
-| | integrations | | (rusqlite) | | Integration | |
-| +------------------+ +------------------+ +-----------------+ |
-+------------------------------------------------------------------+
- |
- +-----------+-----------+
- | |
- TinyHumans backend External APIs
- (Socket.IO + REST) (Telegram, etc.)
-```
-
-The frontend communicates with the **openhuman** Rust core in two ways: **Tauri IPC** for shell commands (windows, hotkeys, and the **`relay_http_rpc`** HTTP relay used only for non-loopback plain-`http://` runtimes) and **HTTP JSON-RPC over loopback** for business logic and tools, plus a **Socket.IO bridge served by the core itself** for live events (chat streaming, notifications). The core owns the outbound persistent connection to the TinyHumans backend, the memory engine binding (memory items themselves are stored in CortexDB, not on the device), and tool execution: agent turns run through the `tinyagents` harness, and tools dispatch as native Rust handlers, plus Node-backed helpers via `runtime::node`, gated by the `security/` sandbox policy. Skills no longer 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).
-
-***
-
-## Rust-powered performance
-
-OpenHuman chose Tauri + Rust over Electron for performance and security reasons. See [Performance](../performance.md) for measured numbers (agents-per-process density, cold start, binary size); the table below is qualitative:
-
-| 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) |
-| Cold startup | Sub-500ms | 2-5 seconds |
-| Garbage collection pauses | None (Rust ownership model) | V8 GC pauses |
-| Memory safety | Compile-time guaranteed | Runtime exceptions |
-| TLS implementation | rustls (no OpenSSL dependency) | Chromium's BoringSSL |
-
-Why this matters in practice: people run OpenHuman alongside other resource-heavy apps, browser tabs, IDEs, chat clients, dashboards. A native binary with sub-500ms startup means the app feels native and stays out of the way instead of competing for the same CPU and memory budget. No GC pauses means background work such as memory writes and socket events does not stall while a collector runs.
-
-The **Tokio async runtime** drives all I/O. WebSocket connections, HTTP requests, file operations, and inter-skill communication, as non-blocking tasks on a thread pool. Thousands of concurrent operations (skill executions, cron jobs, socket events) share a small fixed set of OS threads.
-
-***
-
-## Real-time socket infrastructure
-
-OpenHuman implements a **dual-socket architecture**: a Rust-native WebSocket client on desktop and a JavaScript Socket.io client on web. The Rust implementation survives app backgrounding, operates independently of the WebView, and handles TLS via rustls.
-
-```
-Desktop Mode: Web Mode:
-
-+-------------+ +-------------+
-| React UI | | React UI |
-+------+------+ +------+------+
- | Tauri IPC | Direct
-+------+------+ +------+------+
-| Rust Socket | | JS Socket |
-| Manager | | .io Client |
-+------+------+ +------+------+
- | tokio-tungstenite | Socket.io
- | + rustls TLS | (websocket/polling)
-+------+------+ +------+------+
-| Backend | | Backend |
-+-------------+ +-------------+
-```
-
-The Rust socket manager implements Engine.IO v4 and Socket.IO v4 framing over a raw WebSocket. On handshake it connects, waits for the Engine.IO OPEN frame (which carries `sid`, `pingInterval`, `pingTimeout`), then sends the Socket.IO CONNECT with JWT auth and waits for the ACK. For keep-alive it answers each Engine.IO PING with a PONG; the connection is considered dead after `pingInterval + pingTimeout + 5s` (50 seconds with the defaults). Reconnection backs off exponentially from 1 second up to a 30-second cap, resetting to 1s once a connection that had been established is lost, but continuing to grow if a connection was never established in the first place. Because it is plain Rust `reqwest` rather than a browser fetch, it also sidesteps CORS: outbound API calls go out directly, with no browser restrictions to work around.
-
-The socket connection is shared across the process rather than opened per skill or per tool, so events are routed to the right handler over async message channels instead of paying a new connection each time.
-
-***
-
-## Skills
-
-Skills are `SKILL.md` packages (metadata, instructions, optional bundled scripts/resources) that extend the agent with reusable workflows. The legacy model, one sandboxed QuickJS VM per skill with per-skill bridge APIs and an embedded 5-second cron tick, is gone.
-
-Responsibilities are split across three domains:
-
-| Domain | Role |
-| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `crates/openhuman-core/src/skills/` | Skill metadata: create/discover/install/parse `SKILL.md` and inject descriptors into agent prompts (`ops_create`, `ops_discover`, `ops_install`, `ops_parse`, `registry`, `tools`). |
-| `crates/openhuman-core/src/skills/catalog/` | Registry of installed skills. |
-| `crates/openhuman-core/src/skills/runtime/` | Execution of installed `SKILL.md` workflows: starts/cancels runs, reads run metadata/logs, resolves language runtimes. The orchestrator runs an installed skill itself through `run_workflow`. |
-
-**Skill discovery** uses `SKILL.md` plus optional bundled resources:
-
-| Field | Purpose |
-| ----------------- | ------------------------------ |
-| `name` | Human-readable display name |
-| `description` | Trigger/selection summary |
-| `metadata.id` | Stable skill slug when present |
-| `allowed-tools` | Tool allowlist guidance |
-| bundled resources | scripts, references, assets |
-
-**Language runtimes**: 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.
-
-**Scheduling**: recurring work is owned by the `cron` domain (with `scheduler_gate`), not by skills; there is no per-skill `onCronTrigger()` handler.
-
-***
-
-## 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](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).
-
-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.
-
-## Memory
-
-Memory v2 is three operations (Recall, Fetch, Store) over a pluggable engine: `tinyhumans` (hosted CortexDB behind the backend's `/memory/*` routes, needs a session or TinyHumans API key) or `cortexdb` (your own endpoint and key); with neither, memory is off. Items live in CortexDB; only bookkeeping (job queue, sync/import state) is written under `<workspace>/memory/`. The contract and engines live in `vendor/tinymemory`, which is three crates: `tinymemory-api` (the contract, no I/O), `tinymemory-tools` (the agent surface and lifecycle over any engine) and `tinymemory-integrations` (everything that touches the outside world, one Cargo feature per module). OpenHuman's `crates/openhuman-core/src/memory/` keeps the host side: engine binding, ops, the single `memory` agent tool, conversation buffering, document sources, the consent-gated v1 import and the exit flush. The compiled `context.md` brief it used to own is gone, replaced by the per-turn memory pack. See [Memory architecture](memory.md), [Pluggable engines](../engines.md) and the spec `docs/specs/memory-v2.md`.
-
-Conversation state is separate from memory: each thread's transcript is a JSONL file keyed by thread and agent id (the thread store is `tinyagents_session::threads` in `vendor/tinyagents`, wrapped by `threads::store`), and compaction seals a generation rather than deleting it, so the full history stays recoverable even though a resumed session only reads the latest generation.
-
-***
-
-## Security architecture
-
-```
-+-------------------------------------------------------------------+
-| Security Layers |
-| |
-| +------------------+ +------------------+ +------------------+ |
-| | OS Keychain | | Secrets at rest | | Tool sandbox | |
-| | (macOS/Win/Lin) | | ChaCha20-Poly | | (platform jail | |
-| | for credentials | | 1305 (`enc2:`) | | or Docker) | |
-| +------------------+ +------------------+ +------------------+ |
-| |
-| +------------------+ +------------------+ +------------------+ |
-| | Single-Use | | rustls TLS | | No localStorage | |
-| | Login Tokens | | for all network | | for sensitive | |
-| | (5-min TTL) | | connections | | data | |
-| +------------------+ +------------------+ +------------------+ |
-+-------------------------------------------------------------------+
-```
-
-Credentials go through the OS keychain via the `keyring` crate (macOS Keychain, Windows Credential Manager, Linux Secret Service), on desktop only. Executable tools run through `SecurityPolicy` (`crates/openhuman-core/src/security/policy/`: `types.rs`, `path_checks.rs`, `command_checks.rs`, `enforcement.rs`) and a host-appropriate sandbox backend selected at runtime. One consequence is worth stating plainly: when the `Local` backend is selected on a host with no usable OS jail, `sandbox/ops.rs` logs `[sandbox:local] OS backend unavailable, using noop` and spawns through the no-op backend, so the command runs **unconfined**. Landlock covers Linux and Seatbelt covers macOS; the Windows AppContainer backend exists upstream but is not compiled, so Windows is the case that hits this path. Use the Docker backend where confinement has to hold. The backends no longer live in `security/`: `crates/openhuman-core/src/sandbox/` picks between none, the OS jail (Landlock on Linux, Seatbelt on macOS) and Docker, over the `tinybox` crates. The legacy per-skill QuickJS memory and stack limit model is gone. Web-to-desktop auth handoff uses single-use login tokens with a 5-minute TTL, exchanged via the Rust HTTP client so it bypasses browser CORS. All WebSocket and HTTP connections use rustls, with no dependency on the platform's OpenSSL. Sensitive state lives in Redux (in memory) and the OS keychain (persistent); nothing sensitive goes into localStorage. User prompts are normalized, scored, and enforced server-side (`allow | review | block`) before model or tool execution; see `crates/openhuman-core/src/security/prompt_injection/`.
-
-***
-
-## End-to-end data flow
-
-A complete flow from user action to external service and back:
-
-```
-User types a command in the chat UI
- |
- v
-Frontend sends the turn to the core over HTTP JSON-RPC
- |
- v
-Agent harness (tinyagents) runs the turn, sees the tool catalog
- |
- v
-Model decides to call a tool (e.g., send a Telegram message)
- |
- v
-Tool Registry routes to the registered handler
- |
- v
-Handler executes: native Rust, or a Node helper via `runtime::node`
- |
- v
-Handler runs through `SecurityPolicy` and the active sandbox backend
- |
- v
-External call: reqwest over rustls, a channel driver, SQLite, OS keychain, etc.
- |
- v
-External service responds
- |
- v
-Result flows back through the harness to the frontend over Socket.IO or the RPC response
- |
- v
-User sees the result in the chat interface
-```
-
-Every layer is async and non-blocking. The Rust core runs concurrent tool executions, cron triggers, and socket events on a fixed Tokio thread pool.
-
-***
-
-## Vendored crate family & recent shifts
-
-Core subsystems run on published `tiny*` crates, vendored as git submodules under `vendor/` (`tinyagents`, `tinyflows`, `tinychannels`, `tinyjuice`, `tinymemory`, …) so crate changes can be tested in-tree before publishing. `tinymemory` no longer vendors a local engine; it holds the Memory v2 contract and the CortexDB engine. The major ownership boundaries are:
-
-* **Agent engine on tinyagents.** Every agent turn runs through the `tinyagents` crate harness via the seam in `crates/openhuman-core/src/agent/tinyagents/`; see [Agent harness](agent-harness.md).
-* **Memory on tinymemory (v2).** The contract, CortexDB engine, sources, safety scrubbing, context compiler and v1 importer are crate-owned (`vendor/tinymemory`). OpenHuman keeps the host side under `crates/openhuman-core/src/memory/` (see [Memory architecture](memory.md)). The chat thread store moved to `tinyagents_session::threads`.
-* **Inference on the crate ModelRouter.** Host workload-tier model routing and cloud provider slugs now use the crate-native `ModelRouter`/`OpenAiModel` (#4782, #4783).
-
-***
-
-## Technology stack
-
-| Layer | Technology | Why |
-| -------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **Frontend** | React 19, TypeScript 5.8 | Modern component model, type safety |
-| **State** | Redux Toolkit + Persist | Predictable state with offline persistence |
-| **Build** | Vite 7 | Sub-second HMR, optimized production builds |
-| **Styling** | Tailwind CSS | Utility-first, consistent design system |
-| **Framework** | Tauri v2 | Native cross-platform with minimal overhead |
-| **Language** | Rust (2021 edition) | Memory safety, zero-cost abstractions |
-| **Async** | Tokio | High-performance async I/O runtime |
-| **JS Runtime** | Node.js | Managed V8 runtime for tool helpers and skill-adjacent JS |
-| **Database** | SQLite (rusqlite) | Embedded, zero-config, per-domain stores |
-| **WebSocket** | tokio-tungstenite + rustls | Persistent connections with native TLS |
-| **HTTP** | reqwest | Async HTTP with rustls + native-tLS dual support |
-| **Encryption** | chacha20poly1305 (secret store), aes-gcm + argon2 (`security/encryption/`) | Config-field secrets use ChaCha20-Poly1305 under a keychain-backed master key (`enc2:` prefix); the separate user-facing encryption facility uses AES-256-GCM with Argon2id |
-| **Scheduling** | cron crate + `cron` domain | Standard cron expressions, `scheduler_gate`-gated |
-| **Telegram** | `tinychannels` Bot API driver | Transport in vendored `tinychannels`; host keeps bus/approval glue |
-| **Realtime** | Socket.io (client) | Bidirectional event-based communication |
-| **AI** | MCP (JSON-RPC 2.0) | Standardized tool protocol for LLM integration |
-| **Search** | OpenAI embeddings + SQLite FTS5 | Hybrid semantic + keyword search |
-
-***
-
-## iOS client (experimental)
-
-The iOS client is a Tauri v2 app that shares the React/TypeScript UI codebase but ships **no Rust core binary on-device**. All AI, RPC, and domain logic remain on the desktop core; the iOS app is a thin transport client.
-
-### Transport architecture
-
-```
-iOS App (React + Tauri iOS shell)
- |
- TransportManager (app/src/services/transport/TransportManager.ts)
- |-- LanHttpTransport direct HTTP to desktop core (same LAN)
- |-- TunnelTransport socket.io relay; E2E encrypted
- |-- CloudHttpTransport fallback via cloud backend API
-```
-
-Transport is selected by `ConnectionProfile` stored in secure storage. On pairing, the iOS app stores `{channelId, sessionToken, corePubkey, devicePrivkey}` after the client-side `tunnel:connect` succeeds.
-
-### Pairing flow
-
-1. Desktop: `devices_create_pairing` RPC -> backend ACKs `tunnel:register` with `{channelId, pairingToken, pairingExpiresAt}`.
-2. Desktop shows QR: `openhuman://pair?cid=<>&pt=<>&cpk=<>&rpc=<>&exp=<>`.
-3. iOS scans QR, generates X25519 keypair, connects to backend (`tunnel:connect`, `role:client`, `pairingToken`).
-4. Backend consumes `pairingToken` (single-use) and returns iOS `sessionToken`.
-5. X25519 key agreement over `tunnel:frame` -> XChaCha20-Poly1305 symmetric key.
-6. Desktop emits `DomainEvent::DevicePaired`; device appears in the Devices panel.
-
-### Key paths
-
-| Path | Purpose |
-| --------------------------------------------- | ------------------------------------------------------- |
-| `crates/openhuman-core/src/security/devices/` | Rust devices domain (pairing, store, crypto, event bus) |
-| `app/src/services/transport/` | TS transport strategies + manager |
-| `app/src/lib/tunnel/` | TS tunnel crypto (X25519 + XChaCha20-Poly1305) |
-| `app/src/pages/ios/` | iOS-specific screens (PairScreen, MascotScreen) |
-| `packages/tauri-plugin-ptt/` | Swift PTT plugin (AVAudioEngine + SFSpeechRecognizer) |
-| `app/src-tauri-mobile/Info.plist` | Privacy strings for the iOS Info.plist |
-
-### Security
-
-* Tunnel backend is a blind forwarder; it never sees plaintext payloads.
-* `pairingToken` is single-use, TTL'd, hashed at rest on backend.
-* `sessionToken` is per-client peer and revocable from the desktop Devices panel; the desktop core does not receive a session token during register.
-* Speech recognition runs on-device (Apple Speech framework); audio never leaves the device.
-* The iOS symmetric session key is held in memory, so a restart re-pairs rather than resuming.
-
-### Backend dependency
-
-The `tunnel:register` / `tunnel:connect` / `tunnel:frame` Socket.IO protocol is served by the TinyHumans backend. Pairing depends on it being deployed, which it is; see [iOS Companion](../../features/ios-companion.md) for the user-facing state of this client.
diff --git a/docs/gitbooks/en/developing/architecture/flows-on-tinyagents.md b/docs/gitbooks/en/developing/architecture/flows-on-tinyagents.md
index bdc3d15813..baf605f5e0 100644
--- a/docs/gitbooks/en/developing/architecture/flows-on-tinyagents.md
+++ b/docs/gitbooks/en/developing/architecture/flows-on-tinyagents.md
@@ -1,31 +1,40 @@
---
description: >-
- How a saved flow runs - lowering a WorkflowGraph onto tinyagents, the
- {run,nodes} run-state, the capability seam, agent-nodes-as-nested-graphs, the
- two-layer security model, and the one-trigger model.
+ How a saved flow runs: the WorkflowGraph lowered onto tinyagents, the run
+ state, the capability seam, agent nodes as nested graphs, the two-layer
+ security model and the one-trigger model.
icon: diagram-project
---
# Flows on TinyAgents
-The **flows** domain ([`crates/openhuman-core/src/flows/`](../../../../../../../crates/openhuman-core/src/flows/)) drives saved automations - the workflows a user builds in the canvas or the copilot builds for them. It does **not** contain a workflow engine. Every flow is run by the vendored, host-agnostic [`tinyflows`](https://github.com/tinyhumansai/tinyflows) crate, which **lowers each workflow onto the same** [**`tinyagents`**](https://crates.io/crates/tinyagents) **state-graph engine that the** [**agent harness**](agent-harness.md) **runs on.** So a saved flow is a tinyagents graph, and (after harness unification) each of its `agent` nodes is _itself_ a tinyagents graph - a graph within a graph.
+The flows domain ([`crates/openhuman-core/src/flows/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/flows)) runs
+saved automations: the workflows a user builds in the canvas or the copilot
+builds for them. It does not contain a workflow engine. The vendored, host-agnostic [`tinyflows`](https://github.com/tinyhumansai/tinyflows) crate runs every flow. It lowers each workflow onto the same [`tinyagents`](https://crates.io/crates/tinyagents) state-graph engine that the [agent harness](agent-harness.md) runs on. A saved flow is therefore a tinyagents graph, and each of its `agent` nodes is itself a tinyagents graph, a graph within a graph.
-This page is the flows counterpart to [Agent Harness](agent-harness.md): where that page explains how one agent _turn_ runs, this one explains how one _flow_ runs, and how the two runtimes compose.
+This page is the flows counterpart to [Agent harness](agent-harness.md). That page explains how one agent turn runs. This one explains how one flow runs, and how the two runtimes compose.
## 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) |
-| `tinyagents` | The published state-graph + agent-loop harness both runtimes lower onto. | crate; OpenHuman seam in [`crates/openhuman-core/src/agent/tinyagents/`](../../../../../../../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/`](../../../../../../../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/`](../../../../../../../crates/openhuman-core/src/flows/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) |
-`tinyflows` is published to crates.io and is deliberately persistence-free and vendor-free (see its [`CLAUDE.md`](https://github.com/tinyhumansai/tinyflows/blob/main/CLAUDE.md)); OpenHuman is the first downstream host and injects everything real through the seam.
+`tinyflows` is published to crates.io and is deliberately persistence-free and
+vendor-free (see its [`CLAUDE.md`](https://github.com/tinyhumansai/tinyflows/blob/main/CLAUDE.md)); OpenHuman
+is the first downstream host. It injects everything real through the seam.
## The run pipeline
-A flow is a [`WorkflowGraph`](https://github.com/tinyhumansai/tinyflows/tree/main/crates/tinyflows/src/model) - a directed graph of typed \[`Node`]s joined by \[`Edge`]s, JSON on the wire. Running it is a fixed four-stage pipeline ([`vendor/tinyflows/crates/tinyflows/src/lib.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/lib.rs), [`compiler.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/compiler.rs), [`engine.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/engine.rs)):
+A flow is a [`WorkflowGraph`](https://github.com/tinyhumansai/tinyflows/tree/main/crates/tinyflows/src/model), a directed
+graph of typed nodes joined by edges, as JSON on the wire. Running it is a
+fixed four-stage pipeline
+([`vendor/tinyflows/crates/tinyflows/src/lib.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/lib.rs),
+[`compiler.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/compiler.rs),
+[`engine.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/engine.rs)):
```mermaid
flowchart LR
@@ -40,16 +49,36 @@ flowchart LR
seam["openhuman::flows::tinyflows<br/>capability seam"] -. host-injected .-> run
```
-1. **validate** ([`validate.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/validate.rs)) - structural checks over the raw graph: unique node ids, that every referenced node exists, and **exactly one trigger node** (0 → `MissingTrigger`, >1 → `MultipleTriggers`). This is the single-trigger invariant the whole model rests on (see [Trigger model](flows-on-tinyagents.md#the-trigger-model)).
-2. **compile** ([`compiler.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/compiler.rs)) - runs validation, then lowers the validated graph onto a fresh `tinyagents` state graph. **Every tinyflows node becomes a tinyagents graph node**; every tinyflows edge becomes a graph edge, with conditional/parallel routing and a merge barrier expressed on the tinyagents graph layer. The graph is rebuilt per run so compilation stays independent of any host state.
-3. **run** ([`engine.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/engine.rs)) - the host calls `engine::run_with_checkpointer_journaled_observed` ([`flows/ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/ops.rs), `flows_run`), which drives the compiled graph to completion, folding each node's output into the run state and pausing at approval gates.
-4. **outcome** - a `RunOutcome { output, pending_approvals, cancelled }`; the host persists live steps through the `FlowRunObserver` and exports the durable graph observations to Langfuse ([`tinyflows/langfuse_export.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs)).
-
-Because the engine keys persisted state by a caller-supplied `thread_id`, durable **HITL resume** is `engine::resume_with_checkpointer` over the same `tinyagents::graph::SqliteCheckpointer` the agent harness uses - opened once per host at `<workspace_dir>/flows/checkpoints.db` ([`caps/ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs), `open_flow_checkpointer`).
+1. validate ([`validate.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/validate.rs)) -
+ structural checks over the raw graph: unique node ids, that every referenced
+ node exists, and exactly one trigger node (0 → `MissingTrigger`, >1 →
+ `MultipleTriggers`). The whole model rests on this single-trigger invariant (see [Trigger model](#the-trigger-model)).
+2. compile ([`compiler.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/compiler.rs)): runs
+ validation, then lowers the validated graph onto a fresh `tinyagents` state
+ graph. Every tinyflows node becomes a tinyagents graph node, and every
+ tinyflows edge becomes a graph edge, with conditional/parallel routing and a
+ merge barrier expressed on the tinyagents graph layer. The graph is rebuilt
+ per run so compilation stays independent of any host state.
+3. run ([`engine.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/engine.rs)): the host
+ calls `engine::run_with_checkpointer_journaled_observed`
+ ([`flows/ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/ops.rs), `flows_run`), which
+ drives the compiled graph to completion, folding each node's output into the
+ run state and pausing at approval gates.
+4. outcome: a `RunOutcome { output, pending_approvals, cancelled }`; the host
+ persists live steps through the `FlowRunObserver` and exports the durable
+ graph observations to Langfuse
+ ([`tinyflows/langfuse_export.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs)).
+
+Because the engine keys persisted state by a caller-supplied `thread_id`,
+durable human-in-the-loop resume is `engine::resume_with_checkpointer` over the same
+`tinyagents::graph::SqliteCheckpointer` the agent harness uses: opened once per
+host at `<workspace_dir>/flows/checkpoints.db`
+([`caps/ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs), `open_flow_checkpointer`).
## Run state: one JSON map, a merge reducer, and the `{json,text,raw}` envelope
-The entire run's working memory is a single `serde_json::Value` laid out as ([`vendor/tinyflows/crates/tinyflows/src/engine.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/engine.rs)):
+The entire run's working memory is a single `serde_json::Value` laid out as
+([`vendor/tinyflows/crates/tinyflows/src/engine.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/engine.rs)):
```json
{
@@ -67,52 +96,89 @@ The entire run's working memory is a single `serde_json::Value` laid out as ([`v
}
```
-As the graph executes, a **merge reducer** folds each node's item output into `nodes.<id>`. Because merging is additive rather than last-writer-wins, a **fan-in** node can see every predecessor's output at once, and a **fan-out** (`split_out`) node's parallel branches merge back at the barrier without clobbering one another - the same reducer pattern the tinyagents graph layer uses for its own `map_reduce` fan-out (see [Agent Harness](agent-harness.md)).
+As the graph executes, a merge reducer folds each node's item output into
+`nodes.<id>`. Because merging is additive rather than last-writer-wins, a
+fan-in node can see every predecessor's output at once, and the parallel branches of a fan-out
+(`split_out`) node merge back at the barrier without
+clobbering one another. The tinyagents graph layer uses the same reducer pattern
+for its own `map_reduce` fan-out (see [Agent harness](agent-harness.md)).
-Every **capability node** (agent / tool\_call / http\_request / code) emits its output wrapped in a stable **`{ json, text, raw }` envelope**. Downstream nodes never see the raw completion shape - they bind against the envelope:
+Every capability node (agent, tool_call, http_request and code) emits its
+output wrapped in a stable `{ json, text, raw }` envelope. Downstream nodes
+never see the raw completion shape. They bind against the envelope:
-* `=item.json.<field>` - the structured object (when the producer emitted JSON);
-* `=item.text` - the prose form;
-* `=item.raw` - the untouched producer output.
+- `=item.json.<field>` is the structured object, when the producer emitted JSON.
+- `=item.text` is the prose form.
+- `=item.raw` is the untouched producer output.
### The `=`-expression scope
-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 a per-node **scope** with four bindings:
+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 a
+per-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 |
-| `run` | run metadata and the **trigger payload** (`run.trigger`) |
-| `nodes` | **every completed node's output, keyed by id**: `{ "<id>": { "item": …, "items": [ … ] } }` |
+| `run` | run metadata and the trigger payload (`run.trigger`) |
+| `nodes` | every completed node's output, keyed by id: `{ "<id>": { "item": …, "items": [ … ] } }` |
-So a node three hops downstream can reach back to a specific ancestor by id - `"=nodes.planner.item.json.plan"` - which is exactly how the demo workflow passes the planner's structured plan into the drafter's prompt. A `"=item.text"` form is the short-hand for the immediate predecessor. Missing segments resolve to `null` rather than erroring, and a malformed jq program yields `null` rather than panicking - node wiring never crashes the run.
+So a node three hops downstream can reach back to a specific ancestor by id, for example
+`"=nodes.planner.item.json.plan"`. That is how the demo workflow passes
+the planner's structured plan into the drafter's prompt. The `"=item.text"` form is
+the shorthand for the immediate predecessor. Missing segments resolve to `null`
+rather than erroring, and a malformed jq program yields `null` rather than
+panicking: node wiring never crashes the run.
## The capability seam
-`tinyflows` touches nothing real on its own. Everything - LLM calls, tools, HTTP, code, persistence, sub-workflow lookup - is a **capability trait** the host implements ([`vendor/tinyflows/crates/tinyflows/src/caps/mod.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/caps/mod.rs)). `openhuman::flows::tinyflows::caps` supplies one adapter per trait, assembled into a `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 | `tinyflows_sqlite::flows::SqliteStateStore` | a namespaced KV table in `flows.db` |
-| `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 fall back to a bare `LlmProvider` completion. OpenHuman always wires it, so `agent` nodes get the real agent runtime described next. Of the remaining optional slots, `tasks` takes the crate's own `TokioTaskRunner`, while `shell` and `approvals` are left `None`: there is no host shell adapter yet, and approvals reuse the engine's pause-and-`flows_resume` fallback.
+`tinyflows` touches nothing real on its own. LLM calls, tools, HTTP,
+code, persistence and sub-workflow lookup are each a capability trait that the host
+implements ([`vendor/tinyflows/crates/tinyflows/src/caps/mod.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/caps/mod.rs)).
+`openhuman::flows::tinyflows::caps` supplies one adapter per trait, assembled into a
+`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 | `tinyflows_sqlite::flows::SqliteStateStore` | a namespaced KV table in `flows.db` |
+| `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
+fall back to a bare `LlmProvider` completion. OpenHuman always wires it, so
+`agent` nodes get the real agent runtime described next. Of the remaining
+optional slots, `tasks` takes the crate's own `TokioTaskRunner`, while `shell`
+and `approvals` are left `None`: there is no host shell adapter yet, and
+approvals reuse the engine's pause-and-`flows_resume` fallback.
## Agent nodes: a graph within the graph
-A flow `agent` node names a **registered agent kind** through a trusted `agent_ref` in its config (a custom specialist, …). `OpenHumanAgentRunner::run_agent` resolves that ref and routes on what it finds:
-
-* **A harness `AgentDefinition` exists** → build a full harness `Agent` (`Agent::from_config_for_agent`) and run the node's request through `run_single`. That is the _same_ entry the builder/scout and cron jobs use, and internally it drives `run_turn_via_tinyagents_shared` ([`crates/openhuman-core/src/agent/tinyagents/mod.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/tinyagents/mod.rs)) - the tinyagents `AgentHarness` tool-call loop. The definition's ToolScope, `sandbox_mode`, and `max_iterations` govern the inner turn.
-* **Only a custom `AgentRegistryEntry` exists** (no full definition) → the persona-shaping fallback: the entry's `system_prompt` (and model, when the node didn't pin one) is prepended and the request runs through `OpenHumanLlm::complete` - a single completion, no private tool loop. This keeps custom registry agents working without a regression.
-
-The consequence is the nesting the plan set out to achieve: **the flow is a tinyagents graph whose `agent` nodes each run a nested tinyagents graph (one agent turn).**
+A flow `agent` node names a registered agent kind through a trusted
+`agent_ref` in its config (a custom specialist, …).
+`OpenHumanAgentRunner::run_agent` resolves that ref and routes on what it finds:
+
+- A harness `AgentDefinition` exists: build a full harness `Agent`
+ (`Agent::from_config_for_agent`) and run the node's request through
+ `run_single`. That is the same entry the builder, scout and cron
+ jobs use, and internally it drives `run_turn_via_tinyagents_shared`
+ ([`crates/openhuman-core/src/agent/tinyagents/mod.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/agent/tinyagents/mod.rs)) -
+ the tinyagents `AgentHarness` tool-call loop. The definition's ToolScope,
+ `sandbox_mode`, and `max_iterations` govern the inner turn.
+- Only a custom `AgentRegistryEntry` exists (no full definition): use the
+ persona-shaping fallback. the entry's `system_prompt` (and model, when the node
+ didn't pin one) is prepended and the request runs through
+ `OpenHumanLlm::complete`, a single completion with no private tool loop. This
+ keeps custom registry agents working.
+
+The result is nesting: the flow is a tinyagents graph whose `agent` nodes each run a nested tinyagents graph (one agent turn).
```mermaid
flowchart TB
@@ -132,50 +198,108 @@ flowchart TB
done -.->|"{ json, text, raw } envelope"| tc
```
-Either path returns a JSON value; the `agent` node folds it into the `{ json, text, raw }` envelope (with an `output_parser` sub-port applying the node's declared schema), so a downstream node's binding is identical whether the node ran a full agent turn or a bare completion.
+Either path returns a JSON value; the `agent` node folds it into the
+`{ json, text, raw }` envelope (with an `output_parser` sub-port applying the
+node's declared schema), so a downstream node's binding is identical whether the
+node ran a full agent turn or a bare completion.
-`agent_ref` is resolved **from trusted node config only, never from model output**, so a prompt-injected upstream completion cannot pick an arbitrary agent kind. The **builder's dry-run** exercises this path too: `dry_run_workflow` compiles a draft and runs it against `tinyflows`' _mock_ capabilities wired with a `MockAgentRunner` ([`vendor/tinyflows/crates/tinyflows/src/caps/mock.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/caps/mock.rs)), so a draft whose `agent` nodes carry an `agent_ref` is self-tested end-to-end before it is ever saved.
+`agent_ref` is resolved from trusted node config only, never from model
+output, so a prompt-injected upstream completion cannot pick an arbitrary agent
+kind. The builder's dry-run exercises this path too:
+`dry_run_workflow` compiles a draft and runs it against `tinyflows`' mock
+capabilities wired with a `MockAgentRunner`
+([`vendor/tinyflows/crates/tinyflows/src/caps/mock.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/caps/mock.rs)),
+so a draft whose `agent` nodes carry an `agent_ref` is self-tested end-to-end
+before it is ever saved.
## The security model: two gates
-A flow run is guarded on **two independent layers**, an outer one owned by the flows runtime and an inner one owned by the agent harness.
-
-**Outer gate - the flow's origin + autonomy tier.** `flows_run`/`flows_resume` scope a `TrustedAutomation { source: Workflow { require_approval } }` origin around the whole engine future ([`flows/ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/ops.rs), via `with_origin`). Before an _acting_ node dispatches, the seam consults the user's `[autonomy]` tier through `SecurityPolicy::gate_decision` for that node's `CommandClass` (`http_request` → Network, `code` → Write, native `oh:` tools → their classified class) in `enforce_node_tier_gate` ([`caps/`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs)):
-
-* a `readonly` run **`Block`s** at the network/code boundary and never dispatches;
-* a `supervised` run's `Prompt` decision is escalated by `gate_call_for_tier` into a **forced `ApprovalGate` round-trip** - even when the flow's own `require_approval` is `false`, so the tier's "ask me" can't be silently defeated by a saved flow's default trust;
-* a `full` run passes through.
-
-Composio `tool_call` nodes get an extra deny-by-default **curation gate** (`is_curated_flow_tool`): a slug is allowed only if it resolves to a known, curated, in-scope, connected toolkit action - stricter than the general agent tool-call path, because a flow's slug is a free-form string the author typed rather than one the backend returned from live discovery.
-
-**Inner gate - the agent definition's ToolScope + sandbox.** When an `agent` node runs a full harness `Agent`, that turn runs under the _same_ `Workflow` origin (the engine future is already inside `with_origin`), so the autonomy tier and approval gate apply to the inner turn automatically - **no new origin wrapper**. On top of that, the agent definition's own `ToolScope`, `sandbox_mode`, and iteration cap bound what the turn can do, exactly as they do for a chat sub-agent. So an `agent` node is gated twice: the flow's outer autonomy/origin gate and the agent's inner tool/sandbox gate.
-
-`agent_ref` being trusted-config-only is the third leg: untrusted trigger or upstream data can influence _arguments_ (bounded by the curation + scope + approval checks) but never _which agent kind or tool identity_ runs.
+A flow run is guarded on two independent layers, an outer one owned by the
+flows runtime and an inner one owned by the agent harness.
+
+Outer gate: the flow's origin and autonomy tier. `flows_run`/`flows_resume`
+scope a `TrustedAutomation { source: Workflow { require_approval } }` origin
+around the whole engine future
+([`flows/ops.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/ops.rs), via
+`with_origin`). Before an _acting_ node dispatches, the seam consults the user's
+`[autonomy]` tier through `SecurityPolicy::gate_decision` for that node's
+`CommandClass` (`http_request` → Network, `code` → Write, native `oh:` tools →
+their classified class) in `enforce_node_tier_gate`
+([`caps/`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs)):
+
+- a `readonly` run is blocked at the network/code boundary and never dispatches;
+- a `supervised` run's `Prompt` decision is escalated by `gate_call_for_tier`
+ into a forced `ApprovalGate` round trip, even when the flow's own
+ `require_approval` is `false`, so the tier's "ask me" can't be silently
+ defeated by a saved flow's default trust.
+- a `full` run passes through.
+
+Composio `tool_call` nodes get an extra deny-by-default curation gate
+(`is_curated_flow_tool`): a slug is allowed only if it resolves to a known,
+curated, in-scope, connected toolkit action. This is stricter than the general agent
+tool-call path, because a flow's slug is a free-form string the author typed
+rather than one the backend returned from live discovery.
+
+Inner gate: the agent definition's ToolScope and sandbox. When an `agent`
+node runs a full harness `Agent`, that turn runs under the same `Workflow`
+origin (the engine future is already inside `with_origin`), so the autonomy tier
+and approval gate apply to the inner turn automatically, with no new origin
+wrapper. On top of that, the agent definition's own `ToolScope`,
+`sandbox_mode`, and iteration cap bound what the turn can do, exactly as they do
+for a chat sub-agent. So an `agent` node is gated twice: the flow's outer
+autonomy/origin gate and the agent's inner tool/sandbox gate.
+
+`agent_ref` being trusted-config-only is the third leg: untrusted trigger or
+upstream data can influence arguments (bounded by the curation, scope and
+approval checks) but never which agent kind or tool identity runs.
## The trigger model
-`tinyflows` enforces **exactly one trigger node per graph** at validate time ([`validate.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/validate.rs)). A workflow therefore has a single entry point, and the trigger's payload is what seeds `run.trigger` in the run state.
-
-That is a _model-level_ constraint, not a product limitation. **Multi-trigger is a host-side concern today**, handled by the flows domain rather than the engine. `FlowTriggerSubscriber` ([`flows/bus.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/bus.rs)) is the trigger → run bridge: it subscribes to the normalized domain events a saved flow's single trigger node can bind to and calls `flows::ops::flows_run` for each match:
-
-* **`DomainEvent::FlowScheduleTick`** - a `flow`-type cron job fired; the one named flow is loaded, re-checked for a still-live `schedule` trigger, and dispatched with an empty trigger payload.
-* **`DomainEvent::ComposioTriggerReceived`** - every enabled flow with an `app_event` trigger bound to that `toolkit`/`trigger_slug` is dispatched with the event payload seeded into `run.trigger`.
-
-Dispatch is deduped per `flow_id` (a trigger burst can't spawn overlapping runs for the same flow), while the interactive `flows_run` RPC is deliberately _not_ deduped - a user asking to run a flow again is always honored.
-
-So "run this flow on a schedule **and** when a Gmail message arrives" is expressed as two host subscriptions fanning into the same one-trigger graph. **Model-level multiple triggers on one graph are future work**, tracked as such; nothing in the seam or the store depends on it today.
-
-## Builder, scout, and executor: one harness
-
-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 same pattern 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`, 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` ([`discovery_tools.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/discovery_tools.rs)) |
-| **Executor** | _(n/a - the engine)_ | `flows_run` / `flows_resume` | the capability seam above |
-
-Both agents live under [`crates/openhuman-core/src/flows/agents/`](../../../../../../../crates/openhuman-core/src/flows/agents/) as first-class registry agents (`agent.toml` + `prompt.md`), on the reasoning tier with narrow, safety-reviewed tool belts. The builder is tool-assisted end-to-end: it _proposes_ graphs (validate-only), _dry-runs_ them against mock capabilities as a self-test loop, and only then _saves_ and confirm-first _test-runs_ a real flow. The full discover → build → save → run lifecycle:
+`tinyflows` enforces exactly one trigger node per graph at validate time
+([`validate.rs`](https://github.com/tinyhumansai/tinyflows/blob/main/crates/tinyflows/src/validate.rs)). A workflow therefore
+has a single entry point, and the trigger's payload is what seeds `run.trigger`
+in the run state.
+
+That is a model-level constraint, not a product limitation. Multi-trigger is
+a host-side concern today, handled by the flows domain rather than the engine.
+`FlowTriggerSubscriber` ([`flows/bus.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/bus.rs)) is
+the trigger → run bridge: it subscribes to the normalized domain events a saved
+flow's single trigger node can bind to and calls `flows::ops::flows_run` for each
+match:
+
+- `DomainEvent::FlowScheduleTick`: a `flow`-type cron job fired; the one
+ named flow is loaded, re-checked for a still-live `schedule` trigger, and
+ dispatched with an empty trigger payload.
+- `DomainEvent::ComposioTriggerReceived`: every enabled flow with an
+ `app_event` trigger bound to that `toolkit`/`trigger_slug` is dispatched with
+ the event payload seeded into `run.trigger`.
+
+Dispatch is deduped per `flow_id` (a trigger burst can't spawn overlapping runs
+for the same flow), while the interactive `flows_run` RPC is deliberately not
+deduped, so a user asking to run a flow again is always honored.
+
+So "run this flow on a schedule and when a Gmail message arrives" is
+expressed as two host subscriptions fanning into the same one-trigger graph.
+Multiple triggers on one graph are future work. Nothing in the seam or the store depends on them today.
+
+## Builder, scout and executor: one harness
+
+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 same
+pattern 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`, 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` ([`discovery_tools.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/flows/discovery_tools.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
+first-class registry agents (`agent.toml` + `prompt.md`), on the reasoning tier
+with narrow, safety-reviewed tool belts. The builder is tool-assisted
+end-to-end: it proposes graphs (validate-only), dry-runs them against mock
+capabilities as a self-test loop, and only then saves a real flow and test-runs it with confirmation first. The full discover → build → save → run lifecycle:
```mermaid
sequenceDiagram
@@ -201,19 +325,21 @@ 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 builder's `propose` / `revise` / `dry_run` / `save` / `run` tools. |
-| [`crates/openhuman-core/src/flows/agents/`](../../../../../../../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 also
-* [Agent Harness](agent-harness.md) - the tinyagents turn every `agent` node (and the builder/scout) runs on.
-* [Security (`crates/openhuman-core/src/security/`)](security.md) - the `SecurityPolicy` / autonomy tier the outer node gate consults.
-* [Architecture overview](./) - where flows sit in the bigger picture.
+- [Agent harness](agent-harness.md): the tinyagents turn every `agent` node (and
+ the builder/scout) runs on.
+- [Security (`crates/openhuman-core/src/security/`)](security.md): the `SecurityPolicy` /
+ autonomy tier the outer node gate consults.
+- [Architecture overview](README.md): where flows sit in the bigger picture.
diff --git a/docs/gitbooks/en/developing/architecture/frontend.md b/docs/gitbooks/en/developing/architecture/frontend.md
index 386b69b7d0..0db4f639d1 100644
--- a/docs/gitbooks/en/developing/architecture/frontend.md
+++ b/docs/gitbooks/en/developing/architecture/frontend.md
@@ -1,41 +1,41 @@
---
description: >-
- The React + Vite frontend (`app/src/`) - architecture, state, services,
- providers, routing, components, hooks.
+ The React and Vite frontend in app/src/: state, services, providers,
+ routing, components and hooks.
icon: browsers
---
# Frontend
-`app/src/` is the OpenHuman desktop UI: a Vite and React 19 tree in the pnpm workspace `openhuman-app`. It uses Redux Toolkit with persistence for session state, talks to the in-process Rust core over JSON-RPC (`coreRpcClient` → local HTTP, with the Tauri `relay_http_rpc` command as a fallback relay) and socket.io (`socketService`), and reaches the cloud backend via REST (`apiClient`). Heavy logic lives in the core, not here.
+`app/src/` is the OpenHuman desktop UI: a Vite and React 19 tree in the pnpm workspace `openhuman-app`. It uses Redux Toolkit with persistence for session state, talks to the in-process Rust core over JSON-RPC (`coreRpcClient` over local HTTP, with the Tauri `relay_http_rpc` command as a fallback relay) and socket.io (`socketService`), and reaches the cloud backend via REST (`apiClient`). Heavy logic lives in the core, not here.
-This is one consolidated reference. Use the table of contents above (or your reader's outline) to jump between sections.
+This page is a single reference. Use the table of contents to jump between sections.
-The tree also carries a **mobile shell**: `AppRoutesIOS.tsx`, `pages/ios/`, the `services/transport/` connection profiles and the `app/src-tauri-mobile/` host. That client is **experimental and not part of the shipped desktop host**, which targets Windows, macOS and Linux only. It appears on this page because those files sit in the same tree and share the `App.tsx` provider chain, not because the client ships. See [iOS Companion](../../features/ios-companion.md) for what it is and what still has no desktop surface.
+The tree also carries a mobile shell: `AppRoutesIOS.tsx`, `pages/ios/`, the `services/transport/` connection profiles and the `app/src-tauri-mobile/` host. That client is experimental and not part of the shipped desktop host, which targets Windows, macOS and Linux only. It appears here because those files sit in the same tree and share the `App.tsx` provider chain. See [iOS companion](../../features/ios-companion.md) for what it is and what still has no desktop surface.
## Quick reference
-| Section | Covers |
-| ------------------------------------------------- | --------------------------------------------------------------- |
-| [Architecture](frontend.md#architecture-overview) | Provider chain, build, layout, conventions |
-| [State Management](frontend.md#state-management) | Redux Toolkit slices, selectors, persistence |
-| [Services Layer](frontend.md#services-layer) | `apiClient`, `socketService`, `coreRpcClient` |
-| [Providers](frontend.md#providers) | `ThemeProvider`, `CoreState`, `Socket`, `ChatRuntime` providers |
-| [Pages & Routing](frontend.md#pages--routing) | `HashRouter`, route guards, main routes |
-| [Components](frontend.md#components) | UI / settings component patterns |
-| [Hooks & Utilities](frontend.md#hooks--utilities) | Shared hooks, helpers, config |
+| Section | Covers |
+| -------------------------------------------- | --------------------------------------------------------------- |
+| [Architecture](#architecture-overview) | Provider chain, build, layout, conventions |
+| [State management](#state-management) | Redux Toolkit slices, selectors, persistence |
+| [Services layer](#services-layer) | `apiClient`, `socketService`, `coreRpcClient` |
+| [Providers](#providers) | `ThemeProvider`, `CoreState`, `Socket`, `ChatRuntime` providers |
+| [Pages and routing](#pages-and-routing) | `HashRouter`, route guards, main routes |
+| [Components](#components) | UI / settings component patterns |
+| [Hooks and utilities](#hooks-and-utilities) | Shared hooks, helpers, config |
## Scale
-| Metric | How to read it |
-| --------------------------------------- | ----------------------------------------------------- |
-| TypeScript / TSX files under `app/src/` | `find app/src -name '*.ts' -o -name '*.tsx' \| wc -l` |
-| App-level hooks | `ls app/src/hooks/*.ts app/src/hooks/*.tsx \| wc -l` |
-| Test runner | Vitest (`app/test/vitest.config.ts`) |
+| Metric | How to read it |
+| --------------------------------------- | -------------------------------------------------------------- |
+| TypeScript / TSX files under `app/src/` | `find app/src -name '*.ts' -o -name '*.tsx' \| wc -l` |
+| App-level hooks | `ls app/src/hooks/*.ts app/src/hooks/*.tsx \| wc -l` |
+| Test runner | Vitest (`app/test/vitest.config.ts`) |
## Directory layout
-```
+```text
app/src/
├── App.tsx # Provider chain + HashRouter shell (desktop + mobile shells)
├── AppRoutes.tsx # Desktop route table (AppRoutesIOS.tsx for mobile)
@@ -56,42 +56,46 @@ app/src/
### System architecture
-OpenHuman's desktop UI is a **React 19** app (`app/src/`) that:
+OpenHuman's desktop UI is a React 19 app (`app/src/`) that:
-* Uses **Redux Toolkit** with persistence for session-related state
-* Connects to the backend with **REST** (`apiClient`) and to the local core with **Socket.io** (`socketService` → core socket endpoint)
-* Calls the **Rust core** (embedded in the Tauri host as a tokio task) over HTTP via **`coreRpcClient`** (JSON-RPC methods implemented in `crates/openhuman-core/src/`); non-loopback plain-http runtimes are relayed through the Tauri **`relay_http_rpc`** command
-* Leaves **AI prompts** to the core: bundled `crates/openhuman-core/src/agent/prompts` ship as Tauri resources (see `crates/openhuman-app/tauri.conf.json` resources) and are read core-side, not by the frontend
-* Uses a **minimal MCP-style** helper layer under `lib/mcp/` (transport, validation)
+- Uses Redux Toolkit with persistence for session-related state
+- Connects to the backend with REST (`apiClient`) and to the local core with Socket.io (`socketService` → core socket endpoint)
+- Calls the Rust core (embedded in the Tauri host as a tokio task) over HTTP via `coreRpcClient` (JSON-RPC methods implemented in `crates/openhuman-core/src/`); non-loopback plain-http runtimes are relayed through the Tauri `relay_http_rpc` command
+- Leaves AI prompts to the core: bundled `crates/openhuman-core/src/agent/prompts` ship as Tauri resources (see `crates/openhuman-app/tauri.conf.json` resources) and are read core-side, not by the frontend
+- Uses a minimal MCP-style helper layer under `lib/mcp/` (transport, validation)
### Entry points
| File | Purpose |
| ----------------------- | -------------------------------------------------------------------------------- |
| `app/src/main.tsx` | React root, polyfills, Sentry boundary, store, global styles |
-| `app/src/App.tsx` | Provider chain (see below) + desktop/mobile shells, Settings modal overlay |
+| `app/src/App.tsx` | Provider chain (see below) + desktop/mobile shells, Settings |
| `app/src/AppRoutes.tsx` | `HashRouter` routes, `ProtectedRoute` / `PublicRoute` / `DefaultRedirect` guards |
### Provider chain
+<!-- BEGIN GENERATED: provider-chain — source app/src/App.tsx via scripts/generate-architecture-docs.mjs; do not edit between markers (run `pnpm docs:generate`) -->
+
_Generated from `app/src/App.tsx` by `scripts/generate-architecture-docs.mjs`. Do not edit by hand — run `pnpm docs:generate` to refresh._
-| # | Component | Role |
-| -- | ---------------------- | --------------------------------------------------------------------------- |
-| 1 | `Sentry.ErrorBoundary` | Crash boundary; renders ErrorFallbackScreen |
-| 2 | `Provider` | Redux store; enables useAppSelector / dispatch app-wide |
-| 3 | `PersistGate` | Holds UI until persisted Redux slices rehydrate |
-| 4 | `ThemeProvider` | Theme tokens and dark-mode handling |
-| 5 | `I18nProvider` | Localization context consumed via useT |
-| 6 | `BootCheckGate` | Blocks render until the core boot snapshot resolves |
-| 7 | `CoreStateProvider` | Core app snapshot: auth, session, onboarding state |
-| 8 | `SocketProvider` | Core socket.io events; desktop only (mobile uses the TunnelTransport relay) |
-| 9 | `ChatRuntimeProvider` | Chat runtime events, tool timeline, and approvals |
-| 10 | `Router` | HashRouter navigation for all routes |
-| 11 | `CommandProvider` | Command palette context |
-| 12 | `ServiceBlockingGate` | Blocks the shell until required services are configured |
-
-**Why this order**
+| # | Component | Role |
+| --- | --- | --- |
+| 1 | `Sentry.ErrorBoundary` | Crash boundary; renders ErrorFallbackScreen |
+| 2 | `Provider` | Redux store; enables useAppSelector / dispatch app-wide |
+| 3 | `PersistGate` | Holds UI until persisted Redux slices rehydrate |
+| 4 | `ThemeProvider` | Theme tokens and dark-mode handling |
+| 5 | `I18nProvider` | Localization context consumed via useT |
+| 6 | `BootCheckGate` | Blocks render until the core boot snapshot resolves |
+| 7 | `CoreStateProvider` | Core app snapshot: auth, session, onboarding state |
+| 8 | `SocketProvider` | Core socket.io events; desktop only (mobile uses the TunnelTransport relay) |
+| 9 | `ChatRuntimeProvider` | Chat runtime events, tool timeline, and approvals |
+| 10 | `Router` | HashRouter navigation for all routes |
+| 11 | `CommandProvider` | Command palette context |
+| 12 | `ServiceBlockingGate` | Blocks the shell until required services are configured |
+
+<!-- END GENERATED: provider-chain -->
+
+Why this order
1. Redux `Provider` is outermost so `useAppSelector` / dispatch work everywhere.
2. `PersistGate` rehydrates persisted slices before children assume stable auth/session.
@@ -101,7 +105,7 @@ _Generated from `app/src/App.tsx` by `scripts/generate-architecture-docs.mjs`. D
### Module relationships (simplified)
-```
+```text
App.tsx
├─ Redux store + persistor
├─ ThemeProvider / I18nProvider - theme tokens, useT() localization
@@ -116,7 +120,7 @@ App.tsx
### Services layer (conceptual)
-```
+```text
services/
├─ apiClient → REST to a URL resolved at runtime via `services/backendUrl#getBackendUrl`
├─ backendUrl → Calls `openhuman.config_resolve_api_url`; falls back to VITE_BACKEND_URL only outside Tauri
@@ -129,9 +133,9 @@ services/
The desktop app does not bake the core RPC URL or the API host into the bundle as a hard requirement. At runtime the app resolves them in this order (highest first):
-1. **Welcome-screen RPC URL field**, saved via `utils/configPersistence` and restored on next launch. End users configure a self-hosted core address here, not by hand-editing `config.toml` or `.env` files.
-2. **Tauri `core_rpc_url` command**, the port the embedded core is listening on for this process.
-3. **`VITE_OPENHUMAN_CORE_RPC_URL`**, build-time fallback for development.
+1. Welcome-screen RPC URL field, saved via `utils/configPersistence` and restored on next launch. End users configure a self-hosted core address here, not by hand-editing `config.toml` or `.env` files.
+2. Tauri `core_rpc_url` command, the port the embedded core is listening on for this process.
+3. `VITE_OPENHUMAN_CORE_RPC_URL`, build-time fallback for development.
4. The hardcoded `http://127.0.0.1:7788/rpc` default.
Once the RPC handshake succeeds, `services/backendUrl` calls `openhuman.config_resolve_api_url` to pull `api_url` (and other safe client fields) from the loaded core `Config`. `VITE_BACKEND_URL` is only used as a web fallback when the app runs outside Tauri.
@@ -140,49 +144,49 @@ Components that need the backend URL should call `useBackendUrl()` (or `getBacke
### Related docs
-* Rust architecture: [Architecture](architecture.md)
-* Tauri shell: [Tauri Shell](tauri-shell.md)
+- Rust architecture: [Architecture](../architecture.md)
+- Tauri shell: [Tauri shell](tauri-shell.md)
-## State Management
+## State management
-The application uses Redux Toolkit with Redux-Persist. There is no single root persist config: each slice that persists wraps its own reducer with `persistReducer` in **`store/index.ts`**, whitelisting exactly the fields that should survive a restart.
+The application uses Redux Toolkit with Redux-Persist. There is no single root persist config: each slice that persists wraps its own reducer with `persistReducer` in `store/index.ts`, whitelisting exactly the fields that should survive a restart.
### Storage backends
-* `userScopedStorage` (`store/userScopedStorage.ts`) is the default storage for persisted slices. Blobs are keyed `${userId}:persist:<key>` so state never leaks across users on logout/login (#900).
-* Plain `localStorage` is used only for pre-login, device-wide slices (`coreMode`, `locale`, `theme`) that must survive user switches.
+- `userScopedStorage` (`store/userScopedStorage.ts`) is the default storage for persisted slices. Blobs are keyed `${userId}:persist:<key>` so state never leaks across users on logout or login.
+- Plain `localStorage` is used only for pre-login, device-wide slices (`coreMode`, `locale`, `theme`) that must survive user switches.
### Slices
Authoritative list = the `reducer` map in `store/index.ts`. One-line purposes:
-| Slice | Purpose | Persisted? |
-| --------------------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------- |
-| `accounts` | Connected web-app accounts + rail ordering | `accounts`, `order`, `lastActiveAccountId` (not the active id) |
-| `announcement` | Harness-init announcement banner, seen ids | `shownIds` |
-| `channelConnections` | Messaging channel connections (WhatsApp, Slack, …) | connections + migration/default-channel fields |
-| `chatRuntime` | Streaming buffers, tool timelines, inference status, artifacts | only `artifactsByThread` (ready snapshots) |
-| `connectivity` | navigator.onLine, core health, renderer to core socket, core to hosted link | no |
-| `coreMode` | Pre-login core mode selection (embedded / self-hosted / cloud) | `mode` (plain localStorage) |
-| `followupSuggestions` | Follow-up chips for each thread's latest settled turn | no (in-memory only) |
-| `githubStar` | Whether the user dismissed the in-app "Star us on GitHub" CTA | `dismissed` |
-| `layout` | Two-pane layout geometry (sidebar visibility, dragged widths) | `panels` |
-| `locale` | UI language | `current` (plain localStorage) |
-| `mascot` | Mascot appearance / voice selection | `color`, `voiceId`, `customMascotGifUrl`, `selectedMascotId` |
-| `notifications` | Notification items + preferences | `items`, `preferences` |
-| `persona` | Cosmetic persona display name + description (SOUL.md lives in the core) | `displayName`, `description` |
-| `ptt` | Push-to-talk hotkey + session prefs (`isHeld` deliberately excluded) | `shortcut`, `speakReplies`, `showOverlay` |
-| `queue` | The core's per-thread run queue plus the composer's pending follow-up messages | no (in-memory only) |
-| `runMode` | Per-thread plan/build run mode | no (in-memory only) |
-| `socket` | Per-user socket connection status / socket ids | no (reconnects on boot) |
-| `theme` | Theme mode, font size, message view mode, custom themes | plain localStorage |
-| `thread` | Chat thread list + per-thread message caches | only `selectedThreadId` |
-| `threadGoal` | Durable per-thread goal state | no (in-memory only) |
-| `threadTodos` | Live per-thread todo list | no (in-memory only) |
-| `userErrors` | User-actionable runtime errors (#3931) | no (in-memory only) |
-| `walletPreferences` | Hidden-token preferences for the wallet view | `hiddenTokenKeys` |
-
-Ephemeral chat state (streaming buffers, tool timelines) must **not** survive a restart: the UI would try to resume a turn whose live driver is gone. The one exception, agent-generated artifacts, goes through the `artifactsReadyOnlyTransform` in `store/index.ts` (pure logic in `store/artifactsPersistFilter.ts`).
+| Slice | Purpose | Persisted? |
+| --------------------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
+| `accounts` | Connected web-app accounts + rail ordering | `accounts`, `order`, `lastActiveAccountId` (not the active id) |
+| `announcement` | Harness-init announcement banner, seen ids | `shownIds` |
+| `channelConnections` | Messaging channel connections (WhatsApp, Slack, …) | connections + migration/default-channel fields |
+| `chatRuntime` | Streaming buffers, tool timelines, inference status, artifacts | only `artifactsByThread` (ready snapshots) |
+| `connectivity` | navigator.onLine, core health, renderer to core socket, core to hosted link | no |
+| `coreMode` | Pre-login core mode selection (embedded / self-hosted / cloud) | `mode` (plain localStorage) |
+| `followupSuggestions` | Follow-up chips for each thread's latest settled turn | no (in-memory only) |
+| `githubStar` | Whether the user dismissed the in-app "Star us on GitHub" CTA | `dismissed` |
+| `layout` | Two-pane layout geometry (sidebar visibility, dragged widths) | `panels` |
+| `locale` | UI language | `current` (plain localStorage) |
+| `mascot` | Mascot appearance / voice selection | `color`, `voiceId`, `customMascotGifUrl`, `selectedMascotId` |
+| `notifications` | Notification items + preferences | `items`, `preferences` |
+| `persona` | Cosmetic persona display name + description (SOUL.md lives in the core) | `displayName`, `description` |
+| `ptt` | Push-to-talk hotkey + session prefs (`isHeld` deliberately excluded) | `shortcut`, `speakReplies`, `showOverlay` |
+| `queue` | The core's per-thread run queue plus the composer's pending follow-up messages | no (in-memory only) |
+| `runMode` | Per-thread plan/build run mode | no (in-memory only) |
+| `socket` | Per-user socket connection status / socket ids | no (reconnects on boot) |
+| `theme` | Theme mode, font size, message view mode, custom themes | plain localStorage |
+| `thread` | Chat thread list + per-thread message caches | only `selectedThreadId` |
+| `threadGoal` | Durable per-thread goal state | no (in-memory only) |
+| `threadTodos` | Live per-thread todo list | no (in-memory only) |
+| `userErrors` | User-actionable runtime errors | no (in-memory only) |
+| `walletPreferences` | Hidden-token preferences for the wallet view | `hiddenTokenKeys` |
+
+Ephemeral chat state (streaming buffers, tool timelines) must not survive a restart: the UI would try to resume a turn whose live driver is gone. The one exception, agent-generated artifacts, goes through the `artifactsReadyOnlyTransform` in `store/index.ts` (pure logic in `store/artifactsPersistFilter.ts`).
### Typed hooks
@@ -202,15 +206,15 @@ export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
4. Prefer Redux over ad hoc `localStorage`. Plain localStorage is reserved for the pre-login slices noted above.
5. In dev and E2E builds the store is exposed as `window.__OPENHUMAN_STORE__` so WDIO specs can assert backing state; production bundles do not expose it.
-***
+---
-## Services Layer
+## Services layer
The application uses singleton services for external communication. This prevents connection leaks and provides consistent API access.
### Service architecture
-```
+```text
app/src/services/
├─ apiClient (HTTP REST)
│ └─ backend URL resolved at runtime (services/backendUrl)
@@ -224,7 +228,7 @@ app/src/services/
└─ services/api/* - domain API modules (~50 files, see below)
```
-### API Client (`services/apiClient.ts`)
+### API client (`services/apiClient.ts`)
Fetch-based HTTP REST client for backend communication with typed request/response handling and error handling. The backend URL is resolved at runtime (`services/backendUrl`), not baked in.
@@ -242,26 +246,26 @@ const result = await apiClient.post<LoginResponse>("/auth/login", {
\~55 domain-scoped modules, one per feature surface, each wrapping either backend REST endpoints or core RPC methods. Representative examples:
-* `authApi` / `userApi`: auth + user profile
-* `threadApi`, `threadUsageApi`: chat threads
-* `agentTeamApi`, `agentWorkApi`, `subagentApi`: agents
-* `skillsApi`, `skillRegistryApi`, `flowsApi`, `workflowRunsApi`: skills & automation
-* `channelConnectionsApi`, `mcpClientsApi`, `mcpSetupApi`, `tunnelsApi`: connections
-* `memoryApi`: Memory v2 RPC wrappers (`openhuman.memory_*`)
-* `billingApi`, `creditsApi`, `referralApi`, `inviteApi`: commerce
-* `voiceSettingsApi`, `aiSettingsApi`, `modelCouncilApi`: AI/voice config
+- `authApi` / `userApi`: auth + user profile
+- `threadApi`, `threadUsageApi`: chat threads
+- `agentTeamApi`, `agentWorkApi`, `subagentApi`: agents
+- `skillsApi`, `skillRegistryApi`, `flowsApi`, `workflowRunsApi`: skills & automation
+- `channelConnectionsApi`, `mcpClientsApi`, `mcpSetupApi`, `tunnelsApi`: connections
+- `memoryApi`: Memory v2 RPC wrappers (`openhuman.memory_*`)
+- `billingApi`, `creditsApi`, `referralApi`, `inviteApi`: commerce
+- `voiceSettingsApi`, `aiSettingsApi`, `modelCouncilApi`: AI/voice config
For the full list, `ls app/src/services/api/`. New feature surfaces get their own module here rather than growing `apiClient`.
-### Socket Service (`services/socketService.ts`)
+### Socket service (`services/socketService.ts`)
-Socket.io client singleton connected to the **local core's** socket endpoint (base URL derived from the resolved RPC URL via `coreSocket.ts`; authenticated with the core RPC token). It ingests realtime core events (connection status, channel updates) and dispatches them into Redux (`socketSlice`, `connectivitySlice`, `channelConnectionsSlice`). It also hosts the MCP-style transport (`SocketIOMCPTransportImpl` from `lib/mcp`).
+Socket.io client singleton connected to the local core's socket endpoint (base URL derived from the resolved RPC URL via `coreSocket.ts`; authenticated with the core RPC token). It ingests realtime core events (connection status, channel updates) and dispatches them into Redux (`socketSlice`, `connectivitySlice`, `channelConnectionsSlice`). It also hosts the MCP-style transport (`SocketIOMCPTransportImpl` from `lib/mcp`).
Keep `socketService` and the core socket behavior aligned (the "dual socket sync" rule in AGENTS.md). Connection lifecycle is owned by `providers/SocketProvider.tsx`; on mobile the provider is not mounted at all: events arrive through the `TunnelTransport` relay instead.
### Core RPC (`services/coreRpcClient.ts`)
-The Rust core runs **in-process** inside the Tauri host (no sidecar). The UI calls JSON-RPC methods on it over local HTTP:
+The Rust core runs in-process inside the Tauri host (no sidecar). The UI calls JSON-RPC methods on it over local HTTP:
```typescript
import { callCoreRpc } from "../services/coreRpcClient";
@@ -278,25 +282,25 @@ const result = await callCoreRpc<MyType>({
How a call flows:
-1. **URL + token resolution**: the RPC URL follows the precedence in [Runtime config precedence](frontend.md#runtime-config-precedence); the per-launch bearer token comes from the Tauri `core_rpc_token` command (or the stored token for self-hosted cores).
-2. **Direct fetch**: the webview `fetch()`es the JSON-RPC envelope straight to the core (loopback http or any https URL).
-3. **Shell relay fallback**: plain `http://` to a **non-loopback** host is active mixed content and Chromium blocks it (#3865). `rpcUrlNeedsShellRelay()` detects this and routes the call through `invoke('relay_http_rpc', { url, token, body })`, implemented in **`crates/openhuman-app/src/core_rpc.rs`** (a thin wrapper over `openhuman_rpc::post_json_rpc` from `crates/openhuman-rpc/`), which returns `{ status, body }` re-wrapped as a `Response`.
-4. **Transport override**: iOS/remote connection profiles install a `CoreTransport` (`setActiveCoreTransport`) so the same `callCoreRpc` surface rides LAN/tunnel/cloud transports.
+1. URL + token resolution: the RPC URL follows the precedence in [Runtime config precedence](#runtime-config-precedence); the per-launch bearer token comes from the Tauri `core_rpc_token` command (or the stored token for self-hosted cores).
+2. Direct fetch: the webview `fetch()`es the JSON-RPC envelope straight to the core (loopback http or any https URL).
+3. Shell relay fallback: plain `http://` to a non-loopback host is active mixed content and Chromium blocks it. `rpcUrlNeedsShellRelay()` detects this and routes the call through `invoke('relay_http_rpc', { url, token, body })`, implemented in `crates/openhuman-app/src/core_rpc.rs` (a thin wrapper over `openhuman_rpc::post_json_rpc` from `crates/openhuman-rpc/`), which returns `{ status, body }` re-wrapped as a `Response`.
+4. Transport override: iOS/remote connection profiles install a `CoreTransport` (`setActiveCoreTransport`) so the same `callCoreRpc` surface rides LAN/tunnel/cloud transports.
Errors are classified into a stable `CoreRpcError.kind` (`auth_expired`, `transport`, `timeout`, `rate_limited`, …): callers branch on `kind`, never on message regexes. An `auth_expired` classification broadcasts `core-rpc-auth-expired`, which `CoreStateProvider` turns into a session clear.
-### Best Practices
+### Best practices
1. Use singletons. Never create multiple service instances.
2. Keep Tauri IPC and RPC calls in services. Do not scatter `invoke()` or raw fetches through components.
3. Clean up on unmount by disconnecting in the `useEffect` cleanup.
4. Handle errors through `CoreRpcError.kind` and retry only transient failures.
-***
+---
## Providers
-React context providers (`app/src/providers/`) manage service lifecycle and expose core-owned state. The full nesting (including gates that live in `components/`) is the generated [provider chain](frontend.md#provider-chain) above. There is **no** `UserProvider`, `AIProvider`, or `SkillProvider`: auth/user state lives in `CoreStateProvider`, AI configuration lives in the Rust core, and skills execute in the core (the frontend QuickJS skills engine was removed).
+React context providers (`app/src/providers/`) manage service lifecycle and expose core-owned state. The full nesting (including gates that live in `components/`) is the generated [provider chain](#provider-chain) above. There is no `UserProvider`, `AIProvider` or `SkillProvider`. Auth and user state live in `CoreStateProvider`, AI configuration lives in the Rust core, and skills run in the core.
### ThemeProvider (`providers/ThemeProvider.tsx`)
@@ -304,7 +308,7 @@ Applies theme tokens and dark-mode handling from the persisted `theme` slice (mo
### CoreStateProvider (`providers/CoreStateProvider.tsx`)
-The authoritative auth/session/onboarding context. Fetches the core app snapshot (`fetchCoreAppSnapshot()` RPC), exposes it via `useCoreState()` (`{ snapshot, isBootstrapping, refresh }`), and clears the session on the global `core-rpc-auth-expired` event. It follows a **turn-boundary refetch contract**: after every agent reply completes (`chat_done` in `ChatRuntimeProvider`) it refetches the user state (debounced 750ms) and merges it into the snapshot via `patchSnapshot`: see `providers/README.md`.
+The authoritative auth/session/onboarding context. Fetches the core app snapshot (`fetchCoreAppSnapshot()` RPC), exposes it via `useCoreState()` (`{ snapshot, isBootstrapping, refresh }`), and clears the session on the global `core-rpc-auth-expired` event. It follows a turn-boundary refetch contract: after every agent reply completes (`chat_done` in `ChatRuntimeProvider`) it refetches the user state (debounced 750ms) and merges it into the snapshot via `patchSnapshot`: see `providers/README.md`.
### SocketProvider (`providers/SocketProvider.tsx`)
@@ -316,9 +320,9 @@ Subscribes to chat runtime socket events (message streaming, tool calls, subagen
### Gates and shell-level contexts (in `components/`)
-* `BootCheckGate` (`components/BootCheckGate/`) blocks render until the core boot snapshot resolves.
-* `CommandProvider` (`components/commands/`) holds the command palette context.
-* `ServiceBlockingGate` (`components/daemon/`) blocks the shell until required services are configured.
+- `BootCheckGate` (`components/BootCheckGate/`) blocks render until the core boot snapshot resolves.
+- `CommandProvider` (`components/commands/`) holds the command palette context.
+- `ServiceBlockingGate` (`components/daemon/`) blocks the shell until required services are configured.
### Context vs Redux
@@ -330,29 +334,51 @@ Subscribes to chat runtime socket events (message streaming, tool calls, subagen
Example: `SocketProvider` owns the socket instance; Redux stores connection status in `socketSlice`.
-***
+---
-## Human Mascot Surface
+## Human mascot surface
-The mascot appears on **two** surfaces, deliberately. `/human` (`app/src/features/human/HumanPage.tsx`) is the dedicated full-bleed stage with a right-rail chat. `/chat` carries the same mascot docked on its composer, where it expands into a voice stage in place. Both read one set of mascot preferences from `mascotSlice` (colour, voice, speak-replies, dismissal) so the two can never disagree about the same setting.
+The mascot appears on two surfaces, deliberately. `/human`
+(`app/src/features/human/HumanPage.tsx`) is the dedicated full-bleed stage with a
+right-rail chat. `/chat` carries the same mascot docked on its composer, where it
+expands into a voice stage in place. Both read one set of mascot preferences from
+`mascotSlice` (colour, voice, speak-replies, dismissal) so the two can never
+disagree about the same setting.
`app/src/features/human/chatMascot/` owns the chat-side surface:
| Module | Role |
| ----------------------- | --------------------------------------------------------------------------------------------------------- |
-| `ChatMascotContext.tsx` | Shared dock/stage refs and the send binding. Every value is stable: see the re-render note below. |
+| `ChatMascotContext.tsx` | Shared dock/stage refs and the send binding. Every value is stable: see the re-render note below. |
| `ChatMascotDock.tsx` | The small mascot standing on the composer's input box. An anchor + hit area; it draws nothing. |
| `ChatMascotStage.tsx` | The scaled-up voice surface: `MicComposer`, input-device selector, speak-replies switch, collapse button. |
| `ChatMascotOverlay.tsx` | The single Rive instance, moved between dock and stage with a `transform`. |
| `geometry.ts` | Pure dock ⇄ stage transform maths (`inscribedSquare`, `lerpBox`, `boxTransform`). |
-Clicking the dock expands the mascot into a right-hand stage column while the transcript and the text composer stay live in the left column, so voice and text are the same conversation. `pages/Accounts.tsx` animates the column width; `ChatMascotOverlay` re-measures both anchors per frame so the mascot stays glued to a destination that is still moving. Expanded/collapsed and the speak-replies preference are persisted in `mascotSlice`.
-
-**Two invariants worth keeping.** The mascot re-renders at \~60fps during TTS lipsync, so (a) it is rendered as a leaf with nothing beneath it, and (b) the mascot context value is deliberately non-reactive: reactive state lives in Redux or in the send-binding external store instead. A reactive context value would reconcile the whole chat tree every frame, which is the stall #5357 had to fix. And the overlay only mounts while the agent account is selected, so a fixed overlay is never left alive as an invisible canvas still burning frames under another account.
-
-The mascot face comes from `useHumanMascot`, which subscribes to chat lifecycle events for thinking, speaking, acknowledgement, and error states, plus a `listening` pose driven by `MicComposer`'s `onRecordingChange`.
-
-Sub-agent delegation is visualized by `SubMascotLayer`. It does not introduce a new socket protocol. Instead, it reads the selected or active thread's `chatRuntime.toolTimelineByThread` entries that `ChatRuntimeProvider` already builds from `subagent_spawned`, `subagent_completed`, `subagent_failed`, `subagent_iteration_start`, `subagent_tool_call`, and `subagent_tool_result`.
+Clicking the dock expands the mascot into a right-hand stage column while the
+transcript and the text composer stay live in the left column, so voice and text
+are the same conversation. `pages/Accounts.tsx` animates the column width;
+`ChatMascotOverlay` re-measures both anchors per frame so the mascot stays glued
+to a destination that is still moving. Expanded/collapsed and the speak-replies
+preference are persisted in `mascotSlice`.
+
+Two invariants matter here. The mascot re-renders at ~60fps during TTS
+lipsync, so (a) it is rendered as a leaf with nothing beneath it, and (b) the
+mascot context value is deliberately non-reactive: reactive state lives in
+Redux or in the send-binding external store instead. A reactive context value
+would reconcile the whole chat tree every frame, which stalls the UI. And the overlay only mounts while the agent account is selected, so a fixed
+overlay is never left alive as an invisible canvas still burning frames under
+another account.
+
+The mascot face comes from `useHumanMascot`, which subscribes to chat lifecycle
+events for thinking, speaking, acknowledgement, and error states, plus a
+`listening` pose driven by `MicComposer`'s `onRecordingChange`.
+
+Sub-agent delegation is visualized by `SubMascotLayer`. It does not introduce a
+new socket protocol. Instead, it reads the selected or active thread's
+`chatRuntime.toolTimelineByThread` entries that `ChatRuntimeProvider` already
+builds from `subagent_spawned`, `subagent_completed`, `subagent_failed`,
+`subagent_iteration_start`, `subagent_tool_call`, and `subagent_tool_result`.
Lifecycle mapping:
@@ -362,51 +388,81 @@ Lifecycle mapping:
| `success` | Same mascot resolves to a happy face and completion bubble |
| `error` | Same mascot resolves to a concerned face and failure bubble |
-Activity bubble text is intentionally compact: current child tool call, child iteration, the delegation prompt excerpt, or final status. The thread timeline remains the authoritative detailed view; sub-mascots are only the glanceable orchestration layer around the main mascot.
+Activity bubble text is intentionally compact: current child tool call, child
+iteration, the delegation prompt excerpt, or final status. The thread timeline
+remains the authoritative detailed view; sub-mascots are only the glanceable
+orchestration layer around the main mascot.
### Tool-call presentation
-Every surface that names a tool call (chat cards, the processing panel, the status line, the mascot) resolves it through one registry, `app/src/features/conversations/tools/toolPresentation.ts` (`describeToolCall`). It returns the icon, a translated phrase in two tenses ("Reading file" while running, "Read file" once settled), the target chip, and which rich body the call expands into. The data lives in `toolSpecs.ts` (exact names, collapsed tools that switch on an argument, prefix families, named agents) and `toolPhrases.ts` (phrases, served as `conversations.tools.<id>.active|done`). Composio action slugs (`GMAIL_SEND_EMAIL`) resolve through the toolkit catalog in `components/composio/toolkitMeta.tsx` to "Used Gmail · Send email" with the app's logo. The server's `tool_display_label` is used only for tools the registry cannot describe.
-
-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` utility. `ToolGroupRoot` / `ToolGroupTrigger` / `ToolGroupContent` wrap a run of calls in the tool timeline; `AssistantUiToolCallCard` renders each call. The adapters in `tools/ToolBodies.tsx` only map tool data onto those elements.
-
-The core's `tool_result` socket event carries `args`, `elapsed_ms`, the recomputed `tool_display_label` / `tool_display_detail`, and `structured` (the tool's `ToolResult.metadata`; web searches send `{ kind: "web_search", query, provider, results: [...] }`). `parseWebSearchResult.ts` prefers that payload and falls back to parsing the text rendering for older turns.
+Every surface that names a tool call (chat cards, the processing panel, the
+status line, the mascot) resolves it through one registry,
+`app/src/features/conversations/tools/toolPresentation.ts`
+(`describeToolCall`). It returns the icon, a translated phrase in two tenses
+("Reading file" while running, "Read file" once settled), the target chip, and
+which rich body the call expands into. The data lives in `toolSpecs.ts` (exact
+names, collapsed tools that switch on an argument, prefix families, named
+agents) and `toolPhrases.ts` (phrases, served as
+`conversations.tools.<id>.active|done`). Composio action slugs
+(`GMAIL_SEND_EMAIL`) resolve through the toolkit catalog in
+`components/composio/toolkitMeta.tsx` to "Used Gmail · Send email" with the
+app's logo. The server's `tool_display_label` is used only for tools the
+registry cannot describe.
+
+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`
+utility. `ToolGroupRoot` / `ToolGroupTrigger` / `ToolGroupContent` wrap a run of calls in the tool timeline;
+`AssistantUiToolCallCard` renders each call. The adapters in
+`tools/ToolBodies.tsx` only map tool data onto those elements.
+
+The core's `tool_result` socket event carries `args`, `elapsed_ms`, the
+recomputed `tool_display_label` / `tool_display_detail`, and `structured`
+(the tool's `ToolResult.metadata`; web searches send
+`{ kind: "web_search", query, provider, results: [...] }`).
+`parseWebSearchResult.ts` prefers that payload and falls back to parsing the
+text rendering for older turns.
+
+`tools/__fixtures__/coreToolNames.json` lists every tool the core registers.
+The Rust test `tools/ops_tests_catalog_fixture_tests.rs` keeps it in sync
+(`UPDATE_TOOL_CATALOG=1` regenerates it) and
+`toolPresentation.catalog.test.ts` fails if any listed tool falls through to
+the generic fallback, so a new core tool cannot reach the chat unlabelled.
+`/dev/tools` (dev builds only) renders every state and the whole catalog.
-`tools/__fixtures__/coreToolNames.json` lists every tool the core registers. The Rust test `tools/ops_tests_catalog_fixture_tests.rs` keeps it in sync (`UPDATE_TOOL_CATALOG=1` regenerates it) and `toolPresentation.catalog.test.ts` fails if any listed tool falls through to the generic fallback, so a new core tool cannot reach the chat unlabelled. `/dev/tools` (dev builds only) renders every state and the whole catalog.
-
-***
+---
-## Pages & Routing
+## Pages and routing
-The application uses HashRouter with protected and public route guards. Desktop routes live in **`app/src/AppRoutes.tsx`**; on mobile (iOS/Android) `AppRoutesIOS.tsx` renders a reduced Human/Chat/Settings set instead.
+The application uses HashRouter with protected and public route guards. Desktop routes live in `app/src/AppRoutes.tsx`; on mobile (iOS/Android) `AppRoutesIOS.tsx` renders a reduced Human/Chat/Settings set instead.
### Route map
`app/src/AppRoutes.tsx` is the authoritative table and is heavily commented with the rationale for each entry. The desktop routes it declares:
-| Route | Renders | Guard |
-| -------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------------------------- |
-| `/` | `Welcome` | `PublicRoute` (signed in: forwards to `/home`) |
-| `/auth` | `WebCallbackPage`, the auth callback | none |
-| `/callback/:kind`, `/callback/:kind/:status` | `WebCallbackPage`, generic OAuth and provider callbacks | none |
-| `/onboarding/*` | `Onboarding` stepper | `ProtectedRoute` |
-| `/human` | `HumanPage`, the dedicated mascot stage | `ProtectedRoute` |
-| `/chat/:threadId?` | `Accounts`, the unified chat (agent plus connected web apps) | `ProtectedRoute` |
-| `/flows` | `FlowsPage` | `ProtectedRoute` |
-| `/flows/draft` | `FlowCanvasDraftPage`, an unsaved proposed graph passed in `location.state` | `ProtectedRoute` |
-| `/flows/:id` | `FlowCanvasPage` | `ProtectedRoute` |
-| `/workflows` | `Activity`, the legacy `SKILL.md` workflow hub | `ProtectedRoute` |
-| `/workflows/run` | `WorkflowsRun`, the single-purpose Skill runner | `ProtectedRoute` |
-| `/connections` | `Skills`, the connections hub | `ProtectedRoute` |
-| `/invites` | `Invites` | `ProtectedRoute` |
-| `/notifications` | `Notifications` | `ProtectedRoute` |
-| `/settings/*` | `Settings` | `ProtectedRoute` |
-| `/ptt-overlay` | `PttOverlayPage`, the push-to-talk overlay window | none |
-| `/dev/agent-insights` | `AgentInsightsPreview` | dev only |
-| `/dev/ui` | `UiGallery`, every shared UI primitive in the active theme | dev only |
-| `/dev/tools` | `ToolCallGallery`, every tool-call state and the whole core catalog | dev only |
-| `/dev/assistant-ui` | The upstream assistant-ui demo on a mock runtime | dev only |
-| `*` | `DefaultRedirect` | none |
+| Route | Renders | Guard |
+| --- | --- | --- |
+| `/` | `Welcome` | `PublicRoute` (signed in: forwards to `/home`) |
+| `/auth` | `WebCallbackPage`, the auth callback | none |
+| `/callback/:kind`, `/callback/:kind/:status` | `WebCallbackPage`, generic OAuth and provider callbacks | none |
+| `/onboarding/*` | `Onboarding` stepper | `ProtectedRoute` |
+| `/human` | `HumanPage`, the dedicated mascot stage | `ProtectedRoute` |
+| `/chat/:threadId?` | `Accounts`, the unified chat (agent plus connected web apps) | `ProtectedRoute` |
+| `/flows` | `FlowsPage` | `ProtectedRoute` |
+| `/flows/draft` | `FlowCanvasDraftPage`, an unsaved proposed graph passed in `location.state` | `ProtectedRoute` |
+| `/flows/:id` | `FlowCanvasPage` | `ProtectedRoute` |
+| `/workflows` | `Activity`, the `SKILL.md` workflow hub | `ProtectedRoute` |
+| `/workflows/run` | `WorkflowsRun`, the single-purpose Skill runner | `ProtectedRoute` |
+| `/connections` | `Skills`, the connections hub | `ProtectedRoute` |
+| `/invites` | `Invites` | `ProtectedRoute` |
+| `/notifications` | `Notifications` | `ProtectedRoute` |
+| `/settings/*` | `Settings` | `ProtectedRoute` |
+| `/ptt-overlay` | `PttOverlayPage`, the push-to-talk overlay window | none |
+| `/dev/agent-insights` | `AgentInsightsPreview` | dev only |
+| `/dev/ui` | `UiGallery`, every shared UI primitive in the active theme | dev only |
+| `/dev/tools` | `ToolCallGallery`, every tool-call state and the whole core catalog | dev only |
+| `/dev/assistant-ui` | The upstream assistant-ui demo on a mock runtime | dev only |
+| `*` | `DefaultRedirect` | none |
The four `/dev/*` routes are registered inside an `IS_DEV` branch (`utils/config`), so `import.meta.env.DEV` is substituted at build time, the branch folds away, and their component trees leave a production bundle entirely. They are previews, never part of the shipped product.
@@ -414,34 +470,34 @@ Memory is a surface of `/connections`, not a route of its own: `?tab=brain&brain
Back-compat redirects, all `Navigate replace`. The `ForwardSearch` ones copy the query string to the destination so old deep links still land on the right sub-tab:
-| From | To |
-| --------------- | ------------------------------------------------------------------------------ |
-| `/home` | `/chat` |
-| `/accounts` | `/chat` |
-| `/brain` | `/connections?tab=brain` (`BrainRedirect` remaps the old `?tab=` to `?brain=`) |
-| `/skills` | `/connections` (`ForwardSearch`) |
-| `/channels` | `/connections?tab=messaging` |
-| `/activity` | `/settings/account` |
-| `/intelligence` | `/settings/account` |
-| `/feedback` | `/settings/feedback` |
-| `/routines` | `/flows` |
-| `/webhooks` | `/settings/integrations` (`ForwardSearch`) |
-
-There is **no** `/login` route: authentication flows through the Welcome page, the `/auth` callback, and deep links. `/agents` does not exist either, and Settings is an ordinary route rather than an overlay (see [Settings](frontend.md#settings)).
+| From | To |
+| --- | --- |
+| `/home` | `/chat` |
+| `/accounts` | `/chat` |
+| `/brain` | `/connections?tab=brain` (`BrainRedirect` remaps the old `?tab=` to `?brain=`) |
+| `/skills` | `/connections` (`ForwardSearch`) |
+| `/channels` | `/connections?tab=messaging` |
+| `/activity` | `/settings/account` |
+| `/intelligence` | `/settings/account` |
+| `/feedback` | `/settings/feedback` |
+| `/routines` | `/flows` |
+| `/webhooks` | `/settings/integrations` (`ForwardSearch`) |
+
+There is no `/login` route: authentication flows through the Welcome page, the `/auth` callback, and deep links. `/agents` does not exist either, and Settings is an ordinary route rather than an overlay (see [Settings](#settings)).
### Route guards
All three guards read `useCoreState()` (not Redux auth state) and render `RouteLoadingScreen` while bootstrapping:
-* **`ProtectedRoute`** (`components/ProtectedRoute.tsx`, `({ children, requireAuth = true, redirectTo })`): without a session token, navigates to `redirectTo || '/'`. Onboarding gating is _not_ done here; an effect in `AppShellDesktop` (App.tsx) forces non-onboarding routes back to `/onboarding` while `onboarding_completed` is false, and bounces off it once complete.
-* **`PublicRoute`** (`components/PublicRoute.tsx`): redirects signed-in users to `/home` (which forwards to `/chat`).
-* **`DefaultRedirect`** (`components/DefaultRedirect.tsx`): signed out → `/`; signed in but onboarding incomplete → `/onboarding`; otherwise → `/chat`. Waits for `snapshot.currentUser` to avoid the post-login race.
+- `ProtectedRoute` (`components/ProtectedRoute.tsx`, `({ children, requireAuth = true, redirectTo })`): without a session token, navigates to `redirectTo || '/'`. Onboarding gating is _not_ done here; an effect in `AppShellDesktop` (App.tsx) forces non-onboarding routes back to `/onboarding` while `onboarding_completed` is false, and bounces off it once complete.
+- `PublicRoute` (`components/PublicRoute.tsx`): redirects signed-in users to `/home` (which forwards to `/chat`).
+- `DefaultRedirect` (`components/DefaultRedirect.tsx`): signed out → `/`; signed in but onboarding incomplete → `/onboarding`; otherwise → `/chat`. Waits for `snapshot.currentUser` to avoid the post-login race.
-### Onboarding Flow (`pages/onboarding/`)
+### Onboarding flow (`pages/onboarding/`)
A routed stepper (`Onboarding.tsx` mounts nested routes inside `OnboardingLayout`):
-```
+```text
/onboarding/welcome → WelcomePage
/onboarding/runtime-choice → RuntimeChoicePage
├── cloud → /chat
@@ -449,17 +505,17 @@ A routed stepper (`Onboarding.tsx` mounts nested routes inside `OnboardingLayout
→ embeddings → (activity) → vault → /chat
```
-Each custom step offers **Default** (let OpenHuman manage it) vs **Configure** (inline controls, or a deep-link callout to Settings for domains not yet embedded). Pages live in `pages/onboarding/pages/`; the legacy Composio/skills/context-gathering steps (`pages/onboarding/steps/`) are retired from the default flow but remain on disk. Completion is tracked by the core's `onboarding_completed` flag, enforced by the AppShell onboarding gate. After onboarding, `AppWalkthrough` (Joyride) runs the post-onboarding tour.
+Each custom step offers Default (let OpenHuman manage it) or Configure (inline controls, or a deep-link callout to Settings for domains not yet embedded). Pages live in `pages/onboarding/pages/`; the older Composio, skills and context-gathering steps (`pages/onboarding/steps/`) are not in the default flow. Completion is tracked by the core's `onboarding_completed` flag, enforced by the AppShell onboarding gate. After onboarding, `AppWalkthrough` (Joyride) runs the post-onboarding tour.
### Settings
-Settings is a routed `/settings/*` page like every other surface, on desktop and on iOS alike. It was a desktop modal overlay that kept the page behind it rendered; that system is gone, and so are the older `SettingsPanelLayout` / `useSettingsAnimation` / `ProfilePanel` modals and the registry-derived settings search field (see [Removed](frontend.md#removed) below).
+Settings is a routed `/settings/*` page like every other surface, on desktop and on iOS alike. It is not a modal overlay. Older names such as `SettingsPanelLayout`, `useSettingsAnimation` and `ProfilePanel` are covered in [Removed names](#removed-names) below.
-* **`components/settings/settingsRouteRegistry.ts`**: single declarative source of truth for every settings destination (id and route slug, i18n keys, section, sidebar `navGroup`, `devOnly`, `searchKeywords`). Navigation menus and breadcrumbs derive from it.
-* **`components/settings/settingsRouteElements.tsx`**: maps registry entries to panel `<Route>` elements, including the redirects (`/settings/memory-engine` to the Memory `engine` chip).
-* **`components/settings/layout/`**: the two-pane chrome. `SettingsLayout` projects the settings nav into the app sidebar's dynamic region; `SettingsSidebar` groups entries by `SettingsNavGroup` (`general`, `appearance`, `agentsAutonomy`, `security`, `data`, `knowledgeMemory`, `automationIntegrations`, `diagnosticsLogs`, in `NAV_GROUP_ORDER`); `SettingsSubNav`, `SettingsIndexRedirect`, `SettingsTabbedPage` and `SettingsPanel`, the one panel template, sit beside them.
-* **`components/settings/panels/`**: leaf panels such as `AccountPanel`, `AppearancePanel`, `ThemeStudioPanel`, `AgentAccessPanel`, `AutonomyPanel`, `McpServerPanel`, `PrivacyPanel` and `DeveloperOptionsPanel`. Adding a panel means adding the component and a registry entry; navigation and breadcrumbs pick it up automatically.
-* **`components/settings/controls/`**: the shared form primitives every panel composes (`SettingsSwitch`, `SettingsRow`, `SettingsSection`, `SettingsSelect`, and the rest), so a boolean is a switch everywhere.
+- `components/settings/settingsRouteRegistry.ts`: single declarative source of truth for every settings destination (id and route slug, i18n keys, section, sidebar `navGroup`, `devOnly`, `searchKeywords`). Navigation menus and breadcrumbs derive from it.
+- `components/settings/settingsRouteElements.tsx`: maps registry entries to panel `<Route>` elements, including the redirects (`/settings/memory-engine` to the Memory `engine` chip).
+- `components/settings/layout/`: the two-pane chrome. `SettingsLayout` projects the settings nav into the app sidebar's dynamic region; `SettingsSidebar` groups entries by `SettingsNavGroup` (`general`, `appearance`, `agentsAutonomy`, `security`, `data`, `knowledgeMemory`, `automationIntegrations`, `diagnosticsLogs`, in `NAV_GROUP_ORDER`); `SettingsSubNav`, `SettingsIndexRedirect`, `SettingsTabbedPage` and `SettingsPanel`, the one panel template, sit beside them.
+- `components/settings/panels/`: leaf panels such as `AccountPanel`, `AppearancePanel`, `ThemeStudioPanel`, `AgentAccessPanel`, `AutonomyPanel`, `McpServerPanel`, `PrivacyPanel` and `DeveloperOptionsPanel`. Adding a panel means adding the component and a registry entry; navigation and breadcrumbs pick it up automatically.
+- `components/settings/controls/`: the shared form primitives every panel composes (`SettingsSwitch`, `SettingsRow`, `SettingsSection`, `SettingsSelect`, and the rest), so a boolean is a switch everywhere.
### HashRouter vs BrowserRouter
@@ -473,14 +529,14 @@ import { HashRouter } from "react-router-dom";
// Instead of: app://localhost/home
```
-**Why HashRouter:**
+Why HashRouter:
1. Tauri deep links work with hash-based URLs
2. No server configuration needed
3. Works with file:// protocol
4. Prevents 404 on direct URL access
-### Deep Link Handling
+### Deep link handling
Deep links are handled before routing:
@@ -493,18 +549,18 @@ import("./utils/desktopDeepLinkListener").then((m) => {
The listener intercepts `openhuman://` URLs (e.g. auth handoff), exchanges tokens through the Rust side (bypassing CORS), stores the session, and navigates to the right route. See `utils/desktopDeepLinkListener.ts`.
-***
+---
## Components
Shared UI lives in `app/src/components/`; feature-specific UI lives in `app/src/features/<vertical>/`. Highlights:
-```
+```text
components/
├── ProtectedRoute / PublicRoute / DefaultRedirect # Route guards
├── layout/shell/ # RootShellLayout, AppSidebar, SidebarSlot (two-pane app chrome)
├── settings/ # Settings registry, layout, panels, controls (see above)
-├── accounts/ # Connected-app provider icons (the live WebviewHost overlay was removed with the CEF provider webviews)
+├── accounts/ # Connected-app provider icons
├── BootCheckGate/, daemon/ # Boot + service gates in the provider chain
├── commands/ # CommandProvider (command palette)
├── Announcement/, upsell/, notices/, walkthrough/ # Shell-level overlays
@@ -515,26 +571,26 @@ components/
Conventions:
-* Modals render through a portal, above routed content. Settings is not one of them any more: it is a route.
-* Modals are controlled: parents own `isOpen` state and pass `onClose`.
-* All user-facing text goes through `useT()` (`lib/i18n/I18nContext`); CI enforces locale parity.
-* Production `app/src` code uses only static `import` / `import type`, never dynamic imports.
+- Modals render through a portal, above routed content. Settings is not one of them any more: it is a route.
+- Modals are controlled: parents own `isOpen` state and pass `onClose`.
+- All user-facing text goes through `useT()` (`lib/i18n/I18nContext`); CI enforces locale parity.
+- Production `app/src` code uses only static `import` / `import type`, never dynamic imports.
-***
+---
-## Hooks & Utilities
+## Hooks and utilities
-### Custom Hooks (`hooks/`)
+### Custom hooks (`hooks/`)
-`app/src/hooks/` holds the app-level hooks (the [Scale](frontend.md#scale) table names the command that counts them). Representative examples:
+`app/src/hooks/` holds the app-level hooks (the [Scale](#scale) table names the command that counts them). Representative examples:
-* `useUser` is a thin wrapper over `useCoreState()`; it returns `{ user: snapshot.currentUser, isLoading, error, refetch }`. There is no standalone user store.
-* `useBackendUrl` resolves the backend URL at runtime (see [Runtime config precedence](frontend.md#runtime-config-precedence)).
-* `useThreadQueries` fetches chat threads.
-* `useDaemonHealth` / `useDaemonLifecycle` track core service health.
-* `useDictationHotkey` / `usePttHotkey` manage global hotkeys.
-* `useDeveloperMode`, `useMediaQuery`, `useEscapeKey` are general UI utilities.
-* Feature hooks: `useFlowRunProgress`, `useWorkflowBuilderChat`, `useConsciousItems`, `useIntelligenceStats`, `useCostDashboard`, ….
+- `useUser` is a thin wrapper over `useCoreState()`; it returns `{ user: snapshot.currentUser, isLoading, error, refetch }`. There is no standalone user store.
+- `useBackendUrl` resolves the backend URL at runtime (see [Runtime config precedence](#runtime-config-precedence)).
+- `useThreadQueries` fetches chat threads.
+- `useDaemonHealth` / `useDaemonLifecycle` track core service health.
+- `useDictationHotkey` / `usePttHotkey` manage global hotkeys.
+- `useDeveloperMode`, `useMediaQuery`, `useEscapeKey` are general UI utilities.
+- Feature hooks: `useFlowRunProgress`, `useWorkflowBuilderChat`, `useConsciousItems`, `useIntelligenceStats`, `useCostDashboard`, ….
Feature-local hooks live next to their feature under `features/*/`.
@@ -542,7 +598,7 @@ Feature-local hooks live next to their feature under `features/*/`.
#### Configuration (`utils/config.ts`)
-Centralized build-time environment variable access: **never read `import.meta.env` directly elsewhere**. These constants only carry the value baked into the bundle; for the **runtime** URL the app actually talks to, see `services/backendUrl` and `hooks/useBackendUrl`.
+Centralized build-time environment variable access: never read `import.meta.env` directly elsewhere. These constants only carry the value baked into the bundle; for the runtime URL the app actually talks to, see `services/backendUrl` and `hooks/useBackendUrl`.
```typescript
// Build-time fallback only (used outside Tauri).
@@ -553,7 +609,7 @@ export const CORE_RPC_URL = /* VITE_OPENHUMAN_CORE_RPC_URL || 'http://127.0.0.1:
export const DEV_FORCE_ONBOARDING = /* dev-only VITE_DEV_FORCE_ONBOARDING */;
```
-> **Do not** import `BACKEND_URL` directly to make API calls. Resolve the URL at runtime so the core's `api_url` (via `openhuman.config_resolve_api_url`) takes effect:
+> Do not import `BACKEND_URL` directly to make API calls. Resolve the URL at runtime so the core's `api_url` (via `openhuman.config_resolve_api_url`) takes effect:
>
> ```typescript
> // React components
@@ -565,11 +621,11 @@ export const DEV_FORCE_ONBOARDING = /* dev-only VITE_DEV_FORCE_ONBOARDING */;
> const backendUrl = await getBackendUrl();
> ```
-#### Desktop Deep Link Listener (`utils/desktopDeepLinkListener.ts`)
+#### Desktop deep link listener (`utils/desktopDeepLinkListener.ts`)
Handles incoming `openhuman://` deep links via the Tauri deep-link plugin: parses the URL, performs the Rust-side token exchange (bypasses CORS), stores the session, and navigates. Set up lazily from `main.tsx` so the Tauri IPC bridge is ready first.
-#### URL Opener (`utils/openUrl.ts`)
+#### URL opener (`utils/openUrl.ts`)
Cross-platform URL opening: tries the Tauri opener plugin, falls back to `window.open`. Always use this instead of raw `window.open` so links open in the system browser.
@@ -583,12 +639,12 @@ Node.js globals (`Buffer`, `process`, `util`) are polyfilled for the browser. Se
Two layers provide them:
-1. **`vite-plugin-node-polyfills`** in `app/vite.config.ts` (`buffer`, `process`, `util`, `os`, `crypto`, `stream`, plus `Buffer`/`process`/`global` globals).
-2. **`polyfills.ts`**, imported **first** in `main.tsx`, which synchronously assigns `Buffer`/`process`/`util` onto `globalThis`/`window`/`global`/`self` before any dependent module executes.
+1. `vite-plugin-node-polyfills` in `app/vite.config.ts` (`buffer`, `process`, `util`, `os`, `crypto`, `stream`, plus `Buffer`/`process`/`global` globals).
+2. `polyfills.ts`, imported first in `main.tsx`, which synchronously assigns `Buffer`/`process`/`util` onto `globalThis`/`window`/`global`/`self` before any dependent module executes.
-### Best Practices
+### Best practices
-#### Hook dependencies & cleanup
+#### Hook dependencies and cleanup
```typescript
useEffect(() => {
@@ -622,25 +678,25 @@ const result = await callCoreRpc<Snapshot>({
});
```
-## Removed
+## Removed names
-Stated rather than deleted, because each of these still turns up in older code and in older notes:
+These names still turn up in older code and notes. Use the replacement:
-| Removed | Replaced by |
-| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
-| `SettingsModal`, `SettingsModalFrame`, `SettingsModalLayout`, `settingsOverlay.ts` | `/settings/*` as an ordinary route rendered by `Settings` |
-| `SettingsPanelLayout`, `useSettingsAnimation`, `ProfilePanel` | The `settingsRouteRegistry` plus `components/settings/layout/` |
-| `components/settings/search/` and `settingsSearchRegistry` | Nothing: the sidebar search field was removed. `searchKeywords` stays on the registry entries. |
-| `WebviewHost` overlay in `components/accounts/` | Nothing: it went with the CEF provider webviews |
-| The frontend QuickJS skills engine | Skill execution in the Rust core |
-| `UserProvider`, `AIProvider`, `SkillProvider` | `CoreStateProvider` for auth and user state; AI configuration and skills in the core |
-| `/conversations`, `/accounts` as standalone pages | `/chat/:threadId?` (`Accounts`), the unified chat surface |
+| Removed | Replaced by |
+| --- | --- |
+| `SettingsModal`, `SettingsModalFrame`, `SettingsModalLayout`, `settingsOverlay.ts` | `/settings/*` as an ordinary route rendered by `Settings` |
+| `SettingsPanelLayout`, `useSettingsAnimation`, `ProfilePanel` | The `settingsRouteRegistry` plus `components/settings/layout/` |
+| `components/settings/search/` and `settingsSearchRegistry` | Nothing: the sidebar search field was removed. `searchKeywords` stays on the registry entries. |
+| `WebviewHost` overlay in `components/accounts/` | Nothing: it went with the CEF provider webviews |
+| The frontend QuickJS skills engine | Skill execution in the Rust core |
+| `UserProvider`, `AIProvider`, `SkillProvider` | `CoreStateProvider` for auth and user state; AI configuration and skills in the core |
+| `/conversations`, `/accounts` as standalone pages | `/chat/:threadId?` (`Accounts`), the unified chat surface |
## See also
-* [Architecture overview](architecture.md): the Rust side this UI presents.
-* [Tauri Shell](tauri-shell.md): the host that serves this bundle and owns the IPC surface.
-* [Agent Harness](agent-harness.md): what the chat surface's tool timeline is rendering.
-* [Memory](../../features/memory.md): the user-facing shape of the `/connections?tab=brain` chips.
-* [Theming](../theming.md): the token layer behind `ThemeProvider` and Theme Studio.
-* [iOS Companion](../../features/ios-companion.md): the experimental mobile client the `AppRoutesIOS` shell and the `transport/` profiles belong to.
+- [Architecture](../architecture.md): the Rust side this UI presents.
+- [Tauri shell](tauri-shell.md): the host that serves this bundle and owns the IPC surface.
+- [Agent harness](agent-harness.md): what the chat surface's tool timeline is rendering.
+- [Memory](../../features/memory.md): the user-facing shape of the `/connections?tab=brain` chips.
+- [Theming](../theming.md): the token layer behind `ThemeProvider` and Theme Studio.
+- [iOS companion](../../features/ios-companion.md): the experimental mobile client the `AppRoutesIOS` shell and the `transport/` profiles belong to.
diff --git a/docs/gitbooks/en/developing/architecture/mcp-registry.md b/docs/gitbooks/en/developing/architecture/mcp-registry.md
index 3234638098..b6b233d54c 100644
--- a/docs/gitbooks/en/developing/architecture/mcp-registry.md
+++ b/docs/gitbooks/en/developing/architecture/mcp-registry.md
@@ -1,29 +1,28 @@
---
description: >-
- The host half of the dynamic, user-facing side of MCP-client support: browse
- servers on Smithery and the official MCP registry, declare the user's servers
- in one mcp.json document, connect them (persi
+ How OpenHuman browses MCP registries, connects the servers you declare in
+ mcp.json, and gives their tools to agents.
icon: plug
---
-# MCP Registry
+# MCP registry
-`crates/openhuman-core/src/mcp/registry/` is the **host half** of the dynamic, user-facing side of OpenHuman's Model Context Protocol client support: browsing the supported upstream registries (Smithery and the official modelcontextprotocol registry), reconciling the install store against the user's `mcp.json` document, persisting that, and (for servers launched as local subprocesses or HTTP-remote endpoints) supervising the connection lifecycle. Installed servers' tools are surfaced to agents via the unified tool registry (`crate::tools::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`).
-The registries are **browse-only**. There is no install-from-catalog path and no setup agent: a user who finds a server in the Registry tab opens its own page, reads the install instructions there, and declares 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` / `mcp_clients_config_set`).
+The registries are browse-only. There is no install-from-catalog path and no setup agent. If you find a server in the Registry tab, 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 **client half**, meaning both transports, the Smithery/official catalogs, the SQLite store, the live connection map, the subprocess supervisor, browser sign-in, and the write-audit log, moved to the vendored `tinymcp` crate (`vendor/tinymcp`). What lives in this directory is only what belongs to this application:
+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`): the one `tinymcp` service this process holds per workspace, and config-to-`tinymcp` conversion.
-* `registry/`: the `mcp_clients` RPC surface, the agent-facing tools, and the prompt-injection scan applied to remote tool definitions.
-* `audit/` (sibling of `registry/`): the RPC surface over `tinymcp`'s write-audit log.
-* `server/` (sibling of `registry/`): the `openhuman-core mcp` stdio/HTTP server that exposes this application's own tools to external MCP hosts (see [MCP Server](../mcp-server.md)). This is the _server_ side and did not move.
+- `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.
-> **Naming note**: the Rust module path is `crate::mcp::registry` (`crates/openhuman-core/src/mcp/registry/`), but the RPC namespace and on-disk SQLite filename stay `mcp_clients` for backward compatibility with existing frontend code and stored user state. Grep both names when chasing call sites.
+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`, the Smithery/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).
+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).
-```
+```text
┌────────────────────────────────────────────────┐
Registries ───► tinymcp (catalogs, store, supervisor) │
└────────────────────┬───────────────────────────┘
@@ -51,27 +50,27 @@ An `InstalledServer` (from `tinymcp_bus`, re-exported as `registry::types::Insta
## 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 gate the desktop app starting. Non-nominal ticks (stays-down, restored, parked) become `DomainEvent`s that reach the Event Log and the desktop notification bridge (#5931).
+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. |
+| 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 intentionally narrow:
+The exports from `mod.rs` are narrow on purpose:
```rust
pub use schemas::{
@@ -83,20 +82,20 @@ pub use schemas::{
pub use types::{ConnStatus, InstalledServer, McpTool};
```
-`types` and `connections` are thin `pub mod`s re-exporting the `tinymcp_bus` wire vocabulary and `super::host`-backed lookups, respectively. 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`.
+`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).
+- `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.
-* Frontend Connections UI: the **MCP Servers** page (`McpServersTab`) is three tabs over the `openhuman.mcp_clients_*` RPC namespace: **Servers** (rows, status, the credential form: connect/disconnect, `update_env`, sign-in), **mcp.json** (`config_get` / `config_set`, the only way a server is added or removed) and **Registry** (`registry_search`, browse-only; a 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 / tool-call fallback; they do not install them.
+- 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`, browse-only; a 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
@@ -104,9 +103,9 @@ Focused `*_tests.rs` siblings cover each file: `bus_tests.rs`, `ops_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 authoritative 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/HTTP server side, which did not move to `tinymcp`.
-* [Agent Harness](agent-harness.md): how the agent ends up calling MCP tools through `tool_registry`.
-* [Architecture overview](architecture.md): where this fits in the wider system.
+- [`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.
diff --git a/docs/gitbooks/en/developing/architecture/memory.md b/docs/gitbooks/en/developing/architecture/memory.md
index b54a733f20..b6e9085df4 100644
--- a/docs/gitbooks/en/developing/architecture/memory.md
+++ b/docs/gitbooks/en/developing/architecture/memory.md
@@ -7,13 +7,9 @@ icon: diagram-project
# Memory
-`crates/openhuman-core/src/memory/` is the host layer over TinyMemory: it drives
-the agent memory lifecycle around every turn, with a memory pack recalled before
-the model runs, the turn logged on both sides, memory 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. 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.
-The behaviour is specified in `docs/specs/memory-v2.md`; the user-facing feature
-is [Memory](../../features/memory.md).
+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).
## TinyMemory crates (`vendor/tinymemory/crates/`)
@@ -56,7 +52,7 @@ is [Memory](../../features/memory.md).
The turn's `MemoryTurn` (config, identity, thread, pack) rides
`OpenHumanRunContext::memory_turn`; a child run has its own.
-Chat thread persistence is not memory: it is `tinyagents_session::threads`,
+Chat thread persistence is not memory. It is `tinyagents_session::threads`,
wrapped by `crates/openhuman-core/src/threads/store`.
The MCP server exposes `memory.recall`, `memory.fetch`, `memory.list`,
diff --git a/docs/gitbooks/en/developing/architecture/security.md b/docs/gitbooks/en/developing/architecture/security.md
index b3220fd07a..1eb675a9ed 100644
--- a/docs/gitbooks/en/developing/architecture/security.md
+++ b/docs/gitbooks/en/developing/architecture/security.md
@@ -1,99 +1,111 @@
---
description: >-
- Trust boundary for the autonomous core - autonomy / risk policy, the policy
- that decides when to sandbox (mechanism lives in tinybox), audit log,
- encrypted secret store, public-bind / pairing guard, a
+ The trust boundary for the autonomous core: the autonomy and risk policy,
+ sandbox selection, the audit log, the encrypted secret store, the pairing
+ guard and the redact() helper.
icon: shield-halved
---
# Security
-`crates/openhuman-core/src/security/` is the **trust boundary for the autonomous core**. It owns the autonomy / risk policy that decides whether a given tool call is allowed, the pluggable sandbox backends that confine those calls when the host supports it, the append-only audit log of every agent action, the encrypted secret store, the pairing guard that gates public binding of the RPC server, and the `redact()` helper every other domain uses to keep logs free of plaintext credentials.
+`crates/openhuman-core/src/security/` is the trust boundary for the autonomous core. Look here first when you ask "is this agent action allowed, and if so, how is it confined?"
-It does **not** own:
+It owns:
-* The cross-domain `EncryptionEngine`, which lives in `crates/openhuman-core/src/security/encryption/`.
-* Per-channel credential storage, which lives in `crates/openhuman-core/src/security/credentials/`.
+- The autonomy and risk policy that decides whether a tool call is allowed.
+- The sandbox selection that confines calls when the host supports it.
+- The append-only audit log of every agent action.
+- The encrypted secret store.
+- The pairing guard that gates public binding of the RPC server.
+- The `redact()` helper every other domain uses to keep plaintext credentials out of logs.
-This module is the place to look first when asking "is this agent action allowed, and if so, how is it confined?"
+It does not own the cross-domain `EncryptionEngine` (in `security/encryption/`) or per-channel credential storage (in `security/credentials/`).
## Public surface
-| Item | File | Purpose |
-| ----------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
-| `SecurityPolicy` | `policy/types.rs` (path checks in `policy/path_checks.rs`, command classification in `policy/command_checks.rs`, gating in `policy/enforcement.rs`) | Assembles runtime policy from `AutonomyConfig` + workspace dir. |
-| `AutonomyLevel` (`ReadOnly` / `Supervised` / `Full`) | `policy/types.rs` | Three-step autonomy ladder. |
-| `CommandRiskLevel`, `ToolOperation`, `ActionTracker` | `policy/types.rs` | Risk classification + per-session counting. |
-| `SecretStore` | `keyring/encrypted_store.rs` (`secrets.rs` re-exports it) | OS-keychain / encrypted-file secret persistence with round-trip helpers. |
-| `AuditLogger`, `AuditEventType`, `AuditEvent`, `Actor`, `Action`, `ExecutionResult`, `SecurityContext`, `CommandExecutionLog` | `audit.rs` | Append-only audit trail. |
-| `PairingGuard`, `constant_time_eq`, `is_public_bind` | `pairing.rs` (`PairingGuard` and `constant_time_eq` are re-exported from `tinychannels_bus::security`) | Pairing-token check before binding the RPC server publicly. |
-| `redact(value: &str) -> String` | `core.rs` | Uniform 4-char-prefix redaction for logs. |
-| `security_policy_info_for_config(&Config) -> Outcome<serde_json::Value>` | `ops.rs` | RPC handler for the doctor / settings UI. |
+| Item | File | Purpose |
+| ----------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------------------------------------------------------------------- |
+| `SecurityPolicy` | `policy/types.rs` (path checks in `policy/path_checks.rs`, command classification in `policy/command_checks.rs`, gating in `policy/enforcement.rs`) | Assembles runtime policy from `AutonomyConfig` + workspace dir. |
+| `AutonomyLevel` (`ReadOnly` / `Supervised` / `Full`) | `policy/types.rs` | Three-step autonomy ladder. |
+| `CommandRiskLevel`, `ToolOperation`, `ActionTracker` | `policy/types.rs` | Risk classification and per-session counting. |
+| `SecretStore` | `keyring/encrypted_store.rs` (`secrets.rs` re-exports it) | OS-keychain / encrypted-file secret persistence with round-trip helpers. |
+| `AuditLogger`, `AuditEventType`, `AuditEvent`, `Actor`, `Action`, `ExecutionResult`, `SecurityContext`, `CommandExecutionLog` | `audit.rs` | Append-only audit trail. |
+| `PairingGuard`, `constant_time_eq`, `is_public_bind` | `pairing.rs` (`PairingGuard` and `constant_time_eq` are re-exported from `tinychannels_bus::security`) | Pairing-token check before binding the RPC server publicly. |
+| `redact(value: &str) -> String` | `core.rs` | Uniform 4-char-prefix redaction for logs. |
+| `security_policy_info_for_config(&Config) -> Outcome<serde_json::Value>` | `ops.rs` | RPC handler for the doctor / settings UI. |
## Sandboxing
-This module no longer carries sandbox backends. The old `Sandbox` trait, `NoopSandbox`, `create_sandbox` and the Docker / Bubblewrap / Firejail / Landlock `Command` wrappers had no callers and were removed. Per-session sandbox selection lives in `crates/openhuman-core/src/sandbox/`, which delegates local OS confinement to `tinybox-jail` (vendored tinybox) and keeps its own `docker run` executor. Shell-string scanning used by command classification is `tinybox_core::shell::scan`; the classification rules stay here.
+This module carries no sandbox backends. Per-session sandbox selection lives in `crates/openhuman-core/src/sandbox/`. It delegates local OS confinement to `tinybox-jail` (vendored tinybox) and keeps its own `docker run` executor. Command classification scans shell strings with `tinybox_core::shell::scan`, and the classification rules stay in this module.
## Autonomy ladder
-`AutonomyLevel` is a three-step ladder that controls how aggressively the policy gates tool calls, and it only takes effect while `[autonomy] enabled = true`. `ReadOnly` blocks every writing class outright: no in-tier approval can authorize one. `Supervised`, the default, allows reads and parks everything else for an approval round trip. `Full` allows reads and writes and still parks the network, install and destructive classes. The wire spellings are lowercase (`readonly`, `supervised`, `full`); the user-facing table is in [Approval Gate](../../features/approval-gate.md).
+`AutonomyLevel` is a three-step ladder that sets how strictly the policy gates tool calls. It only takes effect while `[autonomy] enabled = true`.
-`CommandRiskLevel` and `ToolOperation` classify a given tool call; `ActionTracker` keeps the per-session counts that the policy compares against those caps. The agent harness asks `SecurityPolicy` for a decision before every executable tool dispatch.
+- `ReadOnly` blocks every writing class outright. No approval can authorize one.
+- `Supervised` is the default. It allows reads and parks everything else for an approval round trip.
+- `Full` allows reads and writes. It still parks the network, install and destructive classes.
-All of this only applies when the autonomy policy is turned on. Per `AGENTS.md`, `[autonomy] enabled = false` is the default, and `SecurityPolicy::from_config` carries that flag through every enforcement entry point: with the policy disabled, command classification, the approval gate, the command allowlist, and the hourly action budget are all inert, and `workspace_only`, `forbidden_paths`, and the workspace-internal boundary are not enforced. One thing never turns off: `is_always_forbidden` blocks credential stores (`~/.ssh`, `~/.gnupg`, `~/.aws`) and system roots, and rejects `..` traversal and null bytes in a path, whether the autonomy policy is enabled or not. That is the floor this module keeps regardless of configuration.
+The wire spellings are lowercase (`readonly`, `supervised`, `full`). The user-facing table is in [Approval gate](../../features/approval-gate.md).
+
+`CommandRiskLevel` and `ToolOperation` classify a tool call. `ActionTracker` keeps the per-session counts that the policy compares against its caps. The agent harness asks `SecurityPolicy` for a decision before every executable tool dispatch.
+
+All of this applies only when the autonomy policy is on. `[autonomy] enabled = false` is the default, and `SecurityPolicy::from_config` carries that flag through every enforcement entry point. With the policy off, command classification, the approval gate, the command allowlist and the hourly action budget do nothing. `workspace_only`, `forbidden_paths` and the workspace-internal boundary are not enforced either.
+
+One check never turns off. `is_always_forbidden` blocks credential stores (`~/.ssh`, `~/.gnupg`, `~/.aws`) and system roots. It also rejects `..` traversal and null bytes in a path. This is the floor the module keeps whatever the configuration.
## Audit log
-`audit.rs` writes an append-only stream of `AuditEvent`s under the workspace dir. Every executable tool call lands here with its `Actor` (agent / user), `Action`, `ExecutionResult`, and the `SecurityContext` (autonomy level, sandbox backend, etc.) it ran under. The log is the post-hoc story of what the agent did and why it was allowed.
+`audit.rs` writes an append-only stream of `AuditEvent`s under the workspace dir. Every executable tool call lands here with its `Actor` (agent or user), `Action`, `ExecutionResult` and the `SecurityContext` (autonomy level, sandbox backend and so on) it ran under. The log tells you afterwards what the agent did and why it was allowed.
## Pairing guard
-`PairingGuard` (in `pairing.rs`) stands between the RPC server and any attempt to bind to a non-loopback address. `is_public_bind` detects the dangerous case; `PairingGuard` requires a constant-time-compared pairing token (`constant_time_eq`) before such a bind is permitted. This is the iOS / LAN-companion pairing flow's defence against an unpaired peer attaching to the desktop core.
+`PairingGuard` (in `pairing.rs`) stands between the RPC server and any attempt to bind to a non-loopback address. `is_public_bind` detects that case. `PairingGuard` then requires a pairing token, compared in constant time with `constant_time_eq`, before the bind is allowed. The iOS and LAN-companion pairing flow relies on this to keep an unpaired peer from attaching to the desktop core.
## Secret store
-`SecretStore` (implemented in `keyring/encrypted_store.rs`, re-exported through `secrets.rs`) encrypts config-field secrets with ChaCha20-Poly1305 (`enc2:` prefix) under a keychain-backed master key, migrating the legacy XOR `enc:` format on decrypt. Backend selection and the encrypted-file fallback are described in `crates/openhuman-core/src/security/keyring/README.md`.
+`SecretStore` (implemented in `keyring/encrypted_store.rs`, re-exported through `secrets.rs`) encrypts config-field secrets with ChaCha20-Poly1305 (`enc2:` prefix) under a keychain-backed master key. It migrates the legacy XOR `enc:` format when it decrypts. Backend selection and the encrypted-file fallback are described in `crates/openhuman-core/src/security/keyring/README.md`.
## `redact()`
-`redact(value)` returns a uniform 4-char-prefix string (e.g. `"sk-a"` -> `"sk-a…"`) for use in logs and error messages. Use it whenever a secret, credential, token, or PII string is about to be formatted into a `log::` / `tracing::` call. Other domains call it directly: `credentials/`, `webhooks/`, `composio/`, the integration adapters.
+`redact(value)` returns a uniform 4-character-prefix string (for example `"sk-a…"`) for use in logs and error messages. Use it whenever a secret, credential, token, or PII string is about to be formatted into a `log::` / `tracing::` call. Other domains call it directly: `credentials/`, `webhooks/`, `composio/`, the integration adapters.
## Layout
-| Path | Role |
-| ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
-| `policy/` (`mod.rs`, `types.rs`, `path_checks.rs`, `command_checks.rs`, `enforcement.rs`, `policy_*_tests.rs`, `proptest_tests.rs`) | `SecurityPolicy`, `AutonomyLevel`, risk classification, path and command checks, action tracking. |
-| `core.rs`, `core_tests.rs` | `redact()` + small shared helpers. |
-| `audit.rs` | Append-only audit log types. |
-| `secrets.rs`, `keyring/` | `SecretStore` (implemented in `keyring/encrypted_store.rs`) + round-trip tests. |
-| `pairing.rs`, `pairing_tests.rs` | `PairingGuard` + constant-time helpers. |
-| `ops.rs` | RPC handler (`security_policy_info_for_config`). |
-| `schemas.rs` | Controller schemas + handler dispatch. |
-| `mod.rs` | Re-exports of the public surface above. |
-| `live_policy.rs`, `scrub.rs`, `tools.rs` | Live-policy lookup, the host scrubbing policy (`scrub::host_policy`), and the domain's own agent tools. |
-| `approval/`, `credentials/`, `devices/`, `egress/`, `encryption/`, `keyring_consent/`, `pii/`, `prompt_injection/` | Sibling kernel-security domains under the same module. Each owns its own surface; this page covers the policy core only. |
+| Path | Role |
+| ------------------------------------------------------------- | ------------------------------------------------------------------------- |
+| `policy/` (`mod.rs`, `types.rs`, `path_checks.rs`, `command_checks.rs`, `enforcement.rs`, `policy_*_tests.rs`, `proptest_tests.rs`) | `SecurityPolicy`, `AutonomyLevel`, risk classification, path and command checks, action tracking. |
+| `core.rs`, `core_tests.rs` | `redact()` + small shared helpers. |
+| `audit.rs` | Append-only audit log types. |
+| `secrets.rs`, `keyring/` | `SecretStore` (implemented in `keyring/encrypted_store.rs`) + round-trip tests. |
+| `pairing.rs`, `pairing_tests.rs` | `PairingGuard` + constant-time helpers. |
+| `ops.rs` | RPC handler (`security_policy_info_for_config`). |
+| `schemas.rs` | Controller schemas + handler dispatch. |
+| `mod.rs` | Re-exports of the public surface above. |
+| `live_policy.rs`, `scrub.rs`, `tools.rs` | Live-policy lookup, the host scrubbing policy (`scrub::host_policy`), and the domain's own agent tools. |
+| `approval/`, `credentials/`, `devices/`, `egress/`, `encryption/`, `keyring_consent/`, `pii/`, `prompt_injection/` | Sibling kernel-security domains under the same module. Each owns its own surface. This page covers the policy core only. |
## Calls into
-* `crates/openhuman-core/src/config/`: `SecurityConfig`, `AutonomyConfig` for policy + sandbox selection.
-* Workspace filesystem, for the audit log and secret store.
+- `crates/openhuman-core/src/config/`: `SecurityConfig`, `AutonomyConfig` for policy + sandbox selection.
+- Workspace filesystem, for the audit log and secret store.
## Called by
-* `crates/openhuman-core/src/cron/ops.rs`: wraps shell jobs in `SecurityPolicy::from_config`.
-* `crates/openhuman-core/src/tools/ops.rs` and `tools/impl/{browser,document,filesystem,network,presentation,system}/`: every executable tool consults `SecurityPolicy`.
-* `crates/openhuman-core/src/tools/impl/network/{gate,mcp,mcp_server_tools}.rs`: risk-classify outbound calls.
-* `crates/openhuman-core/src/memory/guard.rs`: wraps every memory write in `security::scrub::host_policy()`.
-* `crates/openhuman-core/src/agent/tools/delegate.rs`: sub-agent dispatch goes through the autonomy gate.
-* `crates/openhuman-core/src/security/credentials/`: uses `SecretStore` and `redact`.
+- `crates/openhuman-core/src/cron/ops.rs`: wraps shell jobs in `SecurityPolicy::from_config`.
+- `crates/openhuman-core/src/tools/ops.rs` and `tools/impl/{browser,document,filesystem,network,presentation,system}/`: every executable tool consults `SecurityPolicy`.
+- `crates/openhuman-core/src/tools/impl/network/{gate,mcp,mcp_server_tools}.rs`: risk-classify outbound calls.
+- `crates/openhuman-core/src/memory/guard.rs`: wraps every memory write in `security::scrub::host_policy()`.
+- `crates/openhuman-core/src/agent/tools/delegate.rs`: sub-agent dispatch goes through the autonomy gate.
+- `crates/openhuman-core/src/security/credentials/`: uses `SecretStore` and `redact`.
## Tests
-* Unit: `pairing_tests.rs`, `policy/policy_tests*.rs`, `policy/proptest_tests.rs`, `keyring/encrypted_store_tests*.rs`.
-* `core_tests.rs` covers `redact()`.
+- Unit: `pairing_tests.rs`, `policy/policy_tests*.rs`, `policy/proptest_tests.rs`, `keyring/encrypted_store_tests*.rs`.
+- `core_tests.rs` covers `redact()`.
## Related
-* [`security/README.md`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/security/README.md): authoritative internal-audience overview this page mirrors.
-* [Architecture overview](architecture.md): wider system context.
-* [Agent Harness](agent-harness.md): where `SecurityPolicy` is consulted on every tool dispatch.
+- [`security/README.md`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/security/README.md): the in-repo overview this page mirrors.
+- [Architecture](../architecture.md): the wider system context.
+- [Agent harness](agent-harness.md): where `SecurityPolicy` is consulted on every tool dispatch.
diff --git a/docs/gitbooks/en/developing/architecture/tauri-shell.md b/docs/gitbooks/en/developing/architecture/tauri-shell.md
index f0f9f52cc2..a949a413a5 100644
--- a/docs/gitbooks/en/developing/architecture/tauri-shell.md
+++ b/docs/gitbooks/en/developing/architecture/tauri-shell.md
@@ -1,45 +1,45 @@
---
description: >-
- The desktop host in crates/openhuman-app/: Tauri v2 and WebView, the IPC
- command surface, the embedded core's lifecycle, and the core JSON-RPC bridge.
+ The desktop host in crates/openhuman-app/: the Tauri v2 webview, the IPC
+ commands, the embedded core's lifecycle and the JSON-RPC bridge.
icon: desktop
---
-# Tauri Shell
+# Tauri shell
-`crates/openhuman-app/` is the desktop host for OpenHuman: Tauri v2 and WebView, IPC commands, window management, and the bridge to the embedded `openhuman-core` Rust runtime over core JSON-RPC. It does **not** duplicate the full domain stack; that lives in `crates/openhuman-core` (library `openhuman_core`; the `openhuman-core` binary is `crates/openhuman-cli/src/main.rs`).
+`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`).
## Responsibilities
-1. **Web UI**. Load the Vite build from `app/dist` (or dev server on port 1420).
-2. **IPC**. Expose an explicit set of Tauri commands (see [Commands](#tauri-ipc-commands-cratesopenhuman-app)).
-3. **Core lifecycle**. Run the core JSON-RPC server as an in-process tokio task (`core_process.rs`) and hand the renderer its URL/bearer via `core_rpc_url` / `core_rpc_token`.
-4. **Window + tray**. Desktop window behavior (main, mascot, notch, overlay windows) and system tray (see `lib.rs`).
-5. **Session ownership**. Log the user in and keep the current user fresh (`session/`, backed by `openhuman_tinyhumans::session`): exchange the login token, validate the JWT against `GET /auth/me`, cache `/auth/me`, and hand the resulting credential to the core with `auth.set_credential`. The core never talks to the backend's auth endpoints itself.
+1. Web UI. Load the Vite build from `app/dist` (or dev server on port 1420).
+2. IPC. Expose an explicit set of Tauri commands (see [Tauri IPC commands](#tauri-ipc-commands-cratesopenhuman-app)).
+3. Core lifecycle. Run the core JSON-RPC server as an in-process tokio task (`core_process.rs`) and hand the renderer its URL/bearer via `core_rpc_url` / `core_rpc_token`.
+4. Window and tray. Desktop window behavior (main, mascot, notch, overlay windows) and system tray (see `lib.rs`).
+5. Session ownership. Log the user in and keep the current user fresh (`session/`, backed by `openhuman_tinyhumans::session`): exchange the login token, validate the JWT against `GET /auth/me`, cache `/auth/me`, and hand the resulting credential to the core with `auth.set_credential`. The core never talks to the backend's auth endpoints itself.
## Core process model
-`app/package.json` `core:stage` is intentionally a no-op kept for script compatibility. The desktop app links the core in-process, so local builds no longer need a staged `openhuman-core-*` sidecar under `crates/openhuman-app/binaries/`.
+The desktop app links the core in-process, so local builds need no staged `openhuman-core-*` sidecar. The `core:stage` script in `app/package.json` is a no-op kept for script compatibility.
## Stuck process recovery
-Normal app quit runs teardown from `RunEvent::ExitRequested`: long-lived scanner tasks stop, the embedded core's cancellation token is triggered, and the final process sweep sends `SIGTERM` to direct children before escalating holdouts with `SIGKILL` after a short grace period. Sweep summaries are logged as `[app] sweep: term=N kill=M total=K`; any nonzero `kill` count is a warning and means a child ignored graceful shutdown.
+Normal app quit runs teardown from `RunEvent::ExitRequested`: long-lived scanner tasks stop and the embedded core's cancellation token fires. The final process sweep then sends `SIGTERM` to direct children and, after a short grace period, `SIGKILL` to any holdouts. Sweep summaries are logged as `[app] sweep: term=N kill=M total=K`; any nonzero `kill` count is a warning and means a child ignored graceful shutdown.
On macOS, hard exits (Force Quit, `SIGKILL`, renderer crash) can skip normal teardown. The next launch runs startup recovery before the app runtime starts: it lists OpenHuman processes whose executable path belongs to the launching `.app/Contents`, skips the current process, sends `SIGTERM`, waits briefly, then `SIGKILL`s stragglers that still match the same pid+command. Logs use the `[startup-recovery]` prefix.
-Startup recovery skips when `OPENHUMAN_CORE_REUSE_EXISTING=1` is set so manual CLI-core reuse still works. The Tauri command `process_diagnostics_list_owned` returns the currently owned process list; the macOS implementation is bundle-scoped, Linux/Windows currently return empty.
+Startup recovery skips when `OPENHUMAN_CORE_REUSE_EXISTING=1` is set so manual CLI-core reuse still works. The Tauri command `process_diagnostics_list_owned` returns the currently owned process list; the macOS implementation is bundle-scoped, and Linux and Windows return an empty list.
## Tauri shell architecture (`crates/openhuman-app/`)
### Overview
-The **`crates/openhuman-app`** crate (Cargo package **`openhuman-app`**, lib **`openhuman`**, binary **`OpenHuman`**) is a **desktop-only** host. It embeds the React UI, registers plugins (deep link, opener, OS, notifications, autostart, updater), manages the main window and tray, and runs the core JSON-RPC server **in-process**.
+The `crates/openhuman-app` crate (Cargo package `openhuman-app`, lib `openhuman`, binary `OpenHuman`) is a desktop-only host. It embeds the React UI, registers plugins (deep link, opener, OS, notifications, autostart, updater), manages the main window and tray, and runs the core JSON-RPC server in-process.
Non-desktop targets fail at compile time (`compile_error!` in `lib.rs`).
-### Directory layout (actual)
+### Directory layout
-`crates/openhuman-app/src/` is a flat set of modules (no `commands/` or `utils/` subtree). Key modules:
+`crates/openhuman-app/src/` is a flat set of modules, with no `commands/` or `utils/` subtree. The key modules:
```text
crates/openhuman-app/src/
@@ -51,12 +51,12 @@ crates/openhuman-app/src/
│ # core at a URL, or one this app provisions in a container /
│ # over SSH / both (tinybox). types · store · ops · registry ·
│ # commands
-├── imessage_scanner/ # macOS-only: reads ~/Library/Messages/chat.db directly (never used CDP)
+├── imessage_scanner/ # macOS-only: reads ~/Library/Messages/chat.db directly
├── mascot_native_window.rs / notch_window.rs / window_state.rs
├── dictation_hotkeys.rs / ptt_hotkeys.rs / ptt_overlay.rs
├── native_notifications/
├── artifact_commands.rs # Artifact export (copy into Downloads)
-├── directory_picker.rs # Native folder picker for the folder memory source (#5831)
+├── directory_picker.rs # Native folder picker for the folder memory source
├── external_navigation.rs # Keeps the main webview from navigating off-app; hands remote links to the OS browser
├── workspace_paths.rs # Safe workspace-relative file open/reveal/preview
├── app_update.rs # Updater support (commands live in lib.rs)
@@ -70,14 +70,7 @@ crates/openhuman-app/src/
└── stderr_panic_hook.rs / reset_reboot_schedule.rs
```
-This listing was rewritten against the real tree after #5478 / #5456. Gone with
-the move off Chromium: `cdp/`, the `cef_*` preflight modules, `webview_accounts/`,
-every `*_scanner/` but `imessage_scanner/`, the `meet_*` call window,
-`fake_camera/` and `companion_commands.rs`. `webview_apis/` went later: it was
-the WS bridge those scanners called, and once they were gone its router
-dispatched nothing while still binding a loopback listener at boot.
-
-There is **no** `src-tauri/src/services/session_service.rs` in this tree; session semantics are handled in the web layer + backend + core as applicable.
+There is no `src-tauri/src/services/session_service.rs` in this tree. Session handling lives in `session/` (see [Session](#session-session)), the web layer, the backend and the core.
### Data flow: UI → core
@@ -88,54 +81,54 @@ React (fetch)
→ embedded openhuman core server (tokio task in this process)
```
-The renderer talks to the local core **directly over HTTP**: `app/src/services/coreRpcClient.ts` invokes `core_rpc_url` / `core_rpc_token` once, then issues plain `fetch()` calls. The `relay_http_rpc` Tauri command is a host-side fallback used only when the RPC URL is **not** a trustworthy origin for the secure `tauri://localhost` webview (e.g. a self-hosted runtime on a LAN IP, blocked as mixed content, #3865). In that case the Rust host delegates to `openhuman_rpc::post_json_rpc` from the shared `crates/openhuman-rpc` crate (feature `http-client`): 30 s timeout, redirects disabled when a bearer is present, status + body mirrored back verbatim as `HttpRpcResponse`. The shell adds only the gateway transport guard (`validate_remote_transport`, feature `gateways`) before delegating.
+The renderer talks to the local core directly over HTTP: `app/src/services/coreRpcClient.ts` invokes `core_rpc_url` / `core_rpc_token` once, then issues plain `fetch()` calls. The `relay_http_rpc` Tauri command is a host-side fallback used only when the RPC URL is not a trustworthy origin for the secure `tauri://localhost` webview (for example a self-hosted runtime on a LAN IP, blocked as mixed content). In that case the Rust host delegates to `openhuman_rpc::post_json_rpc` from the shared `crates/openhuman-rpc` crate (feature `http-client`): 30 s timeout, redirects disabled when a bearer is present, status + body mirrored back verbatim as `HttpRpcResponse`. The shell adds only the gateway transport guard (`validate_remote_transport`, feature `gateways`) before delegating.
`CoreProcessHandle` in `core_process.rs` owns the embedded server task (started via `openhuman_rpc::server::run_server_embedded_with_ready` with a per-launch random bearer token) and handles stale-listener/port-conflict recovery.
### Window and tray behavior
- The shell creates a tray icon at startup (`RunEvent::Ready`) and wires actions to open the main window or quit. Tray setup is skipped on Linux packaged runs (GTK panic).
-- Hide-to-tray is implemented in the `RunEvent::WindowEvent { CloseRequested }` handlers in `lib.rs`, not as IPC commands: macOS hides the whole app (`AppHandle::hide()`, #2049), Windows hides the top-level `Chrome_WidgetWin_1` frame via `EnumWindows` + `SW_HIDE` (#1607).
+- Hide-to-tray is implemented in the `RunEvent::WindowEvent { CloseRequested }` handlers in `lib.rs`, not as IPC commands: macOS hides the whole app (`AppHandle::hide()`), Windows hides the top-level `Chrome_WidgetWin_1` frame via `EnumWindows` and `SW_HIDE`.
- On macOS `RunEvent::Reopen` (Dock click) restores and focuses the main window.
### Bundled resources
-`tauri.conf.json` bundles **`../../crates/openhuman-core/src/agent/prompts`** so the core prompt markdown ships with the app.
+`tauri.conf.json` bundles `../../crates/openhuman-core/src/agent/prompts` so the core prompt markdown ships with the app.
### Related
-- IPC surface: see the [Commands](#tauri-ipc-commands-cratesopenhuman-app) section below
-- HTTP bridge: see the [Core bridge & helpers](#core-bridge--helpers-cratesopenhuman-app) section below
+- IPC surface: see [Tauri IPC commands](#tauri-ipc-commands-cratesopenhuman-app) below
+- HTTP bridge: see [Core bridge and helpers](#core-bridge-and-helpers-cratesopenhuman-app) below
- Rust domains and runtime: `crates/openhuman-core/src/`, `crates/openhuman-core/src/core/`
- Shared RPC contracts + HTTP client: `crates/openhuman-rpc/` (also used by `crates/openhuman-tui` for envelope decoding)
## Tauri IPC commands (`crates/openhuman-app`)
-All commands are registered in **`crates/openhuman-app/src/lib.rs`** inside `tauri::generate_handler![...]`: that list is the authoritative reference. The major families:
+All commands are registered in `crates/openhuman-app/src/lib.rs` inside `tauri::generate_handler![...]`. That list is the reference. The major families:
-### Core RPC & diagnostics
+### Core RPC and diagnostics
| Command | Purpose |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
-| `core_rpc_url` | Return the **active gateway's** JSON-RPC URL: the embedded core's `http://127.0.0.1:<port>/rpc` unless another gateway is active |
+| `core_rpc_url` | Return the active gateway's JSON-RPC URL: the embedded core's `http://127.0.0.1:<port>/rpc` unless another gateway is active |
| `core_rpc_token` | Return the active gateway's bearer. Paired with `core_rpc_url`: a token minted for the embedded core is meaningless to a core in a container |
| `core_rpc_endpoint` | Return the URL and bearer together from one resolved snapshot, so a gateway switch between two separate calls cannot pair one gateway's URL with another's token |
-| `relay_http_rpc` | Host-side JSON-RPC POST (`{ url, token?, body }` → `{ status, body }`) for self-hosted runtimes the webview cannot fetch (mixed content, #3865) |
+| `relay_http_rpc` | Host-side JSON-RPC POST (`{ url, token?, body }` → `{ status, body }`) for self-hosted runtimes the webview cannot fetch (mixed content) |
| `overlay_parent_rpc_url` | RPC URL inherited from a parent process (overlay windows), from `OPENHUMAN_CORE_RPC_URL` |
| `process_diagnostics_list_owned` | List OpenHuman processes owned by this app bundle (macOS; empty elsewhere) |
-Use **`app/src/services/coreRpcClient.ts`** (`callCoreRpc`) from the frontend.
+Use `app/src/services/coreRpcClient.ts` (`callCoreRpc`) from the frontend.
### Gateways: running the core somewhere else
-A **gateway** is one way of reaching an OpenHuman core. Four exist: the core inside this
+A gateway is one way of reaching an OpenHuman core. Four exist: the core inside this
process, a core somebody else is running at a URL, and two this app provisions itself: in
a Docker container, or on a machine reached over SSH. The last two are the same code:
[tinybox](https://github.com/tinyhumansai/tinybox) models *reach* (`local` / `ssh`) and
*confinement* (`passthrough` / `docker`) as independent axes, so "a container on the build
server" is those two choices made separately rather than a third case with code of its own.
-**The seam is one line.** A gateway resolves to a URL and a bearer, and `core_rpc_url` /
+The seam is one line. A gateway resolves to a URL and a bearer, and `core_rpc_url` /
`core_rpc_token` answer from the active one. Every RPC call site in the renderer therefore
follows along unchanged: there is no per-gateway transport in the frontend, and
`services/transport/` (the iOS `ConnectionProfile` path) is not involved.
@@ -155,9 +148,9 @@ that is easy to omit and impossible to notice missing: publishing puts the port
| `gateway_active` | Which gateway is active |
| `gateway_status` | `inactive` / `activating{step}` / `connected{endpoint}` / `failed{reason}` |
-Records live shell-side in `gateways.json`, **not** renderer `localStorage`: an SSH
+Records live shell-side in `gateways.json`, not renderer `localStorage`. An SSH
identity path and a remote bearer are materially more sensitive than a window position, and
-the renderer's own notes on the cloud token (audit U3, `utils/configPersistence.ts`) already
+the renderer's own notes on the cloud token (`utils/configPersistence.ts`) already
say a renderer XSS can read anything kept there. The frontend holds a gateway *id*.
Shell-internal callers (`imessage_scanner`, `local_data_reset`) deliberately
@@ -169,10 +162,10 @@ Gated by the shell-local `gateways` Cargo feature (default on). That gate is unr
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`.
-Frontend: **`app/src/services/gatewayService.ts`**, surfaced in Settings → Core connection
+Frontend: `app/src/services/gatewayService.ts`, surfaced in Settings → Core connection
(`components/settings/panels/core/GatewaySection.tsx`).
-### Core & app lifecycle
+### Core and app lifecycle
| Command | Purpose |
| ------------------------------------------------- | --------------------------------------------- |
@@ -207,7 +200,7 @@ A JWT accepted while the backend is unreachable (live `exp`, subject claim) is i
| Command | Purpose |
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| `register_dictation_hotkey` / `unregister_dictation_hotkey` | Global dictation shortcuts (`dictation_hotkeys.rs`) |
-| `register_ptt_hotkey` / `unregister_ptt_hotkey` / `show_ptt_overlay` | Push-to-talk: see the [PTT section](#push-to-talk-ptt-hotkey--overlay) below |
+| `register_ptt_hotkey` / `unregister_ptt_hotkey` / `show_ptt_overlay` | Push-to-talk: see the [PTT section](#push-to-talk-ptt-hotkey-and-overlay) below |
### Notifications
@@ -222,14 +215,14 @@ A JWT accepted while the backend is unreachable (live `exp`, subject claim) is i
| `mascot_window_show` / `mascot_window_hide` | Toggle the mascot native window |
| `notch_window_show` / `notch_window_hide` | Toggle the notch window |
-Hide-to-tray / reopen behavior is **not** an IPC command: it lives in the `RunEvent` handlers in `lib.rs` (see [Window and tray behavior](#window-and-tray-behavior)).
+Hide-to-tray / reopen behavior is not an IPC command: it lives in the `RunEvent` handlers in `lib.rs` (see [Window and tray behavior](#window-and-tray-behavior)).
### Artifacts, logs, MCP, OAuth
| Command | Purpose |
| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
-| `download_artifact_to_downloads` | Copy an artifact straight to the Downloads folder (`artifact_commands.rs`); the Save-As dialog this used to sit behind was dropped with the shell's `rfd` dependency |
-| `pick_directory_via_dialog` | Native OS folder picker for the folder memory source, returning an absolute path a `webkitdirectory` input cannot report (`directory_picker.rs`, #5831) |
+| `download_artifact_to_downloads` | Copy an artifact straight to the Downloads folder (`artifact_commands.rs`); there is no Save-As dialog |
+| `pick_directory_via_dialog` | Native OS folder picker for the folder memory source, returning an absolute path a `webkitdirectory` input cannot report (`directory_picker.rs`) |
| `reveal_logs_folder` / `logs_folder_path` | Open / return the file-logging folder (`file_logging.rs`) |
| `mcp_resolve_binary_path` / `mcp_open_client_config` | MCP client helpers (`mcp_commands.rs`) |
| `start_loopback_oauth_listener` / `stop_loopback_oauth_listener` | Localhost OAuth redirect listener (`loopback_oauth.rs`) |
@@ -237,7 +230,7 @@ Hide-to-tray / reopen behavior is **not** an IPC command: it lives in the `RunEv
### Workspace file links
-From **`workspace_paths.rs`** (closes `#1402`). These commands accept workspace-relative paths only. The shell resolves each path against the active OpenHuman workspace, canonicalizes the target, and rejects traversal, absolute paths, URI-like prefixes, and symlink escapes before opening or reading anything.
+From `workspace_paths.rs` . These commands accept workspace-relative paths only. The shell resolves each path against the active OpenHuman workspace, canonicalizes the target, and rejects traversal, absolute paths, URI-like prefixes, and symlink escapes before opening or reading anything.
| Command | Purpose |
| --------------------------------- | ---------------------------------------------------------------------- |
@@ -245,9 +238,9 @@ From **`workspace_paths.rs`** (closes `#1402`). These commands accept workspace-
| `reveal_workspace_path` | Reveal an existing workspace file or directory in the OS file manager. |
| `preview_workspace_text` | Read a capped UTF-8 text preview from an existing workspace file. |
-### Push-to-talk (PTT) hotkey + overlay
+### Push-to-talk (PTT) hotkey and overlay
-Registered in **`lib.rs`** (`ptt_hotkeys.rs` + `ptt_overlay.rs`). These commands manage the global push-to-talk shortcut and the floating overlay window.
+Registered in `lib.rs` (`ptt_hotkeys.rs` + `ptt_overlay.rs`). These commands manage the global push-to-talk shortcut and the floating overlay window.
| Command | Signature | Purpose |
| ----------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -255,21 +248,21 @@ Registered in **`lib.rs`** (`ptt_hotkeys.rs` + `ptt_overlay.rs`). These commands
| `unregister_ptt_hotkey` | `() -> Result<(), String>` | Unregister the current PTT hotkey and tear down the overlay window. |
| `show_ptt_overlay` | `(active: bool, session_id: u64) -> ()` | Show (`active: true`) or hide (`active: false`) the floating PTT overlay window. The window is focus-stealing-free (`focus: false`). Called by `PttHotkeyManager.tsx` via `app/src/utils/tauriCommands/ptt.ts`. |
-**Event flow:** `register_ptt_hotkey` wires the OS hotkey to fire `ptt://start` / `ptt://stop` Tauri events that `PttHotkeyManager.tsx` subscribes to via `@tauri-apps/api/event`. The manager forwards them into the `pttService` state machine which drives the audio capture → transcribe → chat-send pipeline.
+Event flow: `register_ptt_hotkey` wires the OS hotkey to fire `ptt://start` / `ptt://stop` Tauri events that `PttHotkeyManager.tsx` subscribes to via `@tauri-apps/api/event`. The manager forwards them into the `pttService` state machine which drives the audio capture → transcribe → chat-send pipeline.
-**Conflict detection:** `register_ptt_hotkey` checks for overlap with the active dictation shortcuts before registering. If a conflict is detected it returns `"ConflictsWithDictation(<shortcut>)"` without registering anything, and the settings panel surfaces this as `pttSettings.errorConflictsWithDictation`.
+Conflict detection: `register_ptt_hotkey` checks for overlap with the active dictation shortcuts before registering. If a conflict is detected it returns `"ConflictsWithDictation(<shortcut>)"` without registering anything, and the settings panel surfaces this as `pttSettings.errorConflictsWithDictation`.
### Synthetic input main-thread executor (native registry, not `invoke`)
-Registered in **`lib.rs`** at startup under the event-bus native-request method
+Registered in `lib.rs` at startup under the event-bus native-request method
`computer.input_on_main_thread` (`INPUT_ON_MAIN_THREAD_METHOD`, defined in
-`openhuman_core::tools::computer::main_thread`). This is **not** a
+`openhuman_core::tools::computer::main_thread`). This is not a
`@tauri-apps/api` `invoke` command. It is an in-process native request the
-**core** dispatches to the **shell** so synthetic input runs on the real app
+core dispatches to the shell so synthetic input runs on the real app
main thread.
Why: enigo's macOS keyboard-layout lookup (`TSMGetInputSourceProperty`) traps
-(`_dispatch_assert_queue_fail` / `EXC_BREAKPOINT`) and crashes the desktop host when
+(`_dispatch_assert_queue_fail`, `EXC_BREAKPOINT`) and crashes the desktop host when
called off the main thread. The `mouse` / `keyboard` tools therefore never call
enigo on their tokio worker; they build a closure and dispatch it here, where
the shell runs it via `AppHandle::run_on_main_thread`.
@@ -281,9 +274,9 @@ the shell runs it via `AppHandle::run_on_main_thread`.
| Response | `Result<String, String>`: `Ok(message)` on success, `Err(reason)` on failure |
| Availability | Desktop only. Headless / CLI builds register no executor; the core call then returns a clean `Err`. |
-### Removed / not present
+### Names that do not exist
-The following **do not** exist in the current `generate_handler!` list: `greet`, `core_rpc_relay` (superseded by direct `fetch` + `relay_http_rpc`), `ai_get_config` / `ai_refresh_config` / `write_ai_config_file`, `show_window` / `hide_window` / `toggle_window` / `minimize_window` / `maximize_window` / `close_window`, the `openhuman_*` daemon/service helpers, `exchange_token`, `get_auth_state`, `socket_connect`, `start_telegram_login`. Authentication and sockets are handled in the **React** app and **core** process, not via these IPC names.
+The following do not exist in the current `generate_handler!` list: `greet`, `core_rpc_relay` (replaced by direct `fetch` and `relay_http_rpc`), `ai_get_config` / `ai_refresh_config` / `write_ai_config_file`, `show_window` / `hide_window` / `toggle_window` / `minimize_window` / `maximize_window` / `close_window`, the `openhuman_*` daemon/service helpers, `exchange_token`, `get_auth_state`, `socket_connect`, `start_telegram_login`. Authentication and sockets are handled in the React app and the core process, not through these IPC names.
### Example: core RPC
@@ -300,20 +293,20 @@ const result = await callCoreRpc({
---
-_See `crates/openhuman-app/src/lib.rs` (`generate_handler!`) for the authoritative list._
+See `crates/openhuman-app/src/lib.rs` (`generate_handler!`) for the full list.
-## Core bridge & helpers (`crates/openhuman-app`)
+## Core bridge and helpers (`crates/openhuman-app`)
-The Tauri crate **does not** embed a duplicate Socket.io server or Telegram client; it focuses on **in-process core lifecycle** and the thin HTTP/auth glue around the core's JSON-RPC surface.
+The Tauri crate does not embed a duplicate Socket.io server or Telegram client; it focuses on in-process core lifecycle and the thin HTTP/auth glue around the core's JSON-RPC surface.
### `CoreProcessHandle` (`core_process.rs`)
-- Runs the core's HTTP/JSON-RPC server as a **tokio task inside the Tauri host** via `openhuman_rpc::server::run_server_embedded_with_ready`: no sidecar binary.
+- Runs the core's HTTP/JSON-RPC server as a tokio task inside the Tauri host via `openhuman_rpc::server::run_server_embedded_with_ready`: no sidecar binary.
- 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 (#1130): 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.
+- 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)`).
### `core_rpc` (`core_rpc.rs`)
- Shared auth helpers for host-side calls to the local core (URL from `OPENHUMAN_CORE_RPC_URL` or the default port; bearer from `core_process::current_rpc_token`).
-- **`relay_http_rpc`** Tauri command: a thin wrapper over `openhuman_rpc::post_json_rpc` (`crates/openhuman-rpc`, feature `http-client`) for self-hosted runtimes on non-trustworthy origins; `bearer_header`, `redact_url_for_log` and `HttpRpcResponse` are re-exported from that crate (see [Core RPC & diagnostics](#core-rpc--diagnostics)).
+- `relay_http_rpc` Tauri command: a thin wrapper over `openhuman_rpc::post_json_rpc` (`crates/openhuman-rpc`, feature `http-client`) for self-hosted runtimes on non-trustworthy origins; `bearer_header`, `redact_url_for_log` and `HttpRpcResponse` are re-exported from that crate (see [Core RPC and diagnostics](#core-rpc-and-diagnostics)).
diff --git a/docs/gitbooks/en/developing/building-rust-core.md b/docs/gitbooks/en/developing/building-rust-core.md
index 59c5ff4d8e..fe6a47d99a 100644
--- a/docs/gitbooks/en/developing/building-rust-core.md
+++ b/docs/gitbooks/en/developing/building-rust-core.md
@@ -3,28 +3,31 @@ description: Build the Rust core from scratch on a fresh machine.
icon: terminal
---
-# Building the Rust Core
+# Building the Rust core
-This page is the contributor-facing reference for compiling the Rust core on a fresh machine.
+This page shows how to compile the Rust core on a fresh machine. It covers the core workspace and its sibling crates:
-It covers the **core workspace and its sibling crates**:
+- Cargo package: `openhuman`
+- Binary: `openhuman-core` (built from `openhuman-cli`)
+- Library: `openhuman_core`
-* Cargo package: `openhuman`
-* Binary: `openhuman-core`
-* Library: `openhuman_core`
+The root `Cargo.toml` is a virtual workspace whose members are
+`crates/openhuman-core`, `crates/openhuman-embed`, `crates/openhuman-rpc`,
+`crates/openhuman-tinyhumans`, `crates/openhuman-cli`, and
+`crates/openhuman-tui`. `crates/openhuman-app` (the Tauri desktop shell) is
+excluded from that workspace and builds from its own manifest.
-The root `Cargo.toml` is a virtual workspace whose members are `crates/openhuman-core`, `crates/openhuman-embed`, `crates/openhuman-rpc`, `crates/openhuman-tinyhumans`, `crates/openhuman-cli`, and `crates/openhuman-tui`. `crates/openhuman-app` (the Tauri desktop shell) is excluded from that workspace and builds from its own manifest.
-
-If you want the full desktop app (`pnpm dev`, Tauri, frontend tooling), use [Getting Set Up](getting-set-up.md). That path has extra JavaScript, submodule, and desktop-runtime requirements that are **not** needed for a core-only `cargo` workflow.
+If you want the full desktop app (`pnpm dev`, Tauri, frontend tooling), use [Getting set up](getting-set-up.md). That path needs extra JavaScript, submodule and desktop-runtime tooling that a core-only `cargo` workflow does not.
## 1. Install the pinned Rust toolchain
The repository pins Rust in [`rust-toolchain.toml`](https://github.com/tinyhumansai/openhuman/blob/main/rust-toolchain.toml):
-* Channel: `1.96.1`
-* Components: `rustfmt`, `clippy`
+- Channel: `1.96.1`
+- Components: `rustfmt`, `clippy`
-The pin exists because `rusqlite` 0.40 / `libsqlite3-sys` 0.38 use the `cfg_select!` macro, stabilized in 1.96 (unstable through 1.95).
+The pin exists because `rusqlite` 0.40 and `libsqlite3-sys` 0.38 use the
+`cfg_select!` macro, which became stable in 1.96.
Recommended install:
@@ -44,37 +47,49 @@ git clone https://github.com/tinyhumansai/openhuman.git
cd openhuman
```
-That is enough for the Rust workspace. Core sources, the package manifest, and the authoritative domain implementation live under `crates/openhuman-core/`. The stable host-facing library facade is the sibling `crates/openhuman-embed/` package, while the terminal frontend is `crates/openhuman-tui/`. The `openhuman-core` binary itself, the developer and benchmark bins, and the root `tests/*.rs` / `examples/*.rs` targets live in `crates/openhuman-cli/`, which depends on `crates/openhuman-tinyhumans/` for the SDK-backed backend transport the core does not carry on its own. Shared JSON-RPC contracts and the HTTP client used by the Tauri shell and the TUI live in `crates/openhuman-rpc/`.
+That is enough for the Rust workspace. Here is where things live:
+
+- `crates/openhuman-core/` holds the core sources, the package manifest and the domain implementation.
+- `crates/openhuman-embed/` is the library facade for hosts.
+- `crates/openhuman-tui/` is the terminal frontend.
+- `crates/openhuman-cli/` holds the `openhuman-core` binary, the developer and benchmark bins, and the root `tests/*.rs` and `examples/*.rs` targets. It depends on `crates/openhuman-tinyhumans/` for the SDK-backed backend transport, which the core does not carry.
+- `crates/openhuman-rpc/` holds the JSON-RPC contracts and the HTTP client that the Tauri shell and the TUI use.
-The recursive submodules under repo-root `vendor/` are required for the core build too, not just the desktop shell: `crates/openhuman-core/Cargo.toml` path-depends on `vendor/tinyagents`, `vendor/tinymemory`, `vendor/tinymcp`, and the rest of the `tiny*` family, and the root `Cargo.toml` `[patch]` tables point into `vendor/tinymemory`, `vendor/tinyflows`, `vendor/tinychannels`, `vendor/motosan-ai-oauth`, and the `tinyinference` copy nested under `vendor/tinyagents/`.
+The recursive submodules under repo-root `vendor/` are required for the core
+build too, not just the desktop shell. `crates/openhuman-core/Cargo.toml`
+path-depends on `vendor/tinyagents`, `vendor/tinymemory`, `vendor/tinymcp`,
+and the rest of the `tiny*` family, and the root `Cargo.toml` `[patch]`
+tables point into `vendor/tinymemory`, `vendor/tinyflows`,
+`vendor/tinychannels`, `vendor/motosan-ai-oauth`, and the `tinyinference`
+copy nested under `vendor/tinyagents/`.
```bash
git submodule update --init --recursive vendor/
```
-Desktop/Tauri work has extra requirements on top of this: follow [Getting Set Up](getting-set-up.md) for those.
+Desktop and Tauri work has extra requirements. Follow [Getting set up](getting-set-up.md) for those.
## 3. Build commands
From the repository root:
```bash
-# Fast dependency + type check
+# Fast dependency and type check
cargo check --manifest-path Cargo.toml
-# Debug build of the actual CLI / RPC binary
+# Debug build of the CLI and RPC binary
cargo build --manifest-path Cargo.toml -p openhuman-cli --bin openhuman-core
# Check the stable host-facing embedding facade
cargo check --manifest-path Cargo.toml -p openhuman-embed
-# Check the shared RPC contracts + HTTP client crate
+# Check the shared RPC contracts and HTTP client crate
cargo check --manifest-path Cargo.toml -p openhuman-rpc
# Build the terminal frontend (embeds the core in-process)
cargo build --manifest-path Cargo.toml -p openhuman-tui
-# Check the desktop shell (separate Cargo world, own manifest/lockfile)
+# Check the desktop shell (separate Cargo world, own manifest and lockfile)
cargo check --manifest-path crates/openhuman-app/Cargo.toml
# Release build
@@ -86,37 +101,50 @@ cargo test --manifest-path Cargo.toml
Notes:
-* The core library's package name is `openhuman` (crate `openhuman_core`), but the runnable binary, `openhuman-core`, is built from the `openhuman-cli` package (`crates/openhuman-cli/src/main.rs`), which is why the commands above pass `-p openhuman-cli`.
-* The built binary lands at `target/debug/openhuman-core` or `target/release/openhuman-core`.
+- The core library's package is `openhuman` (crate `openhuman_core`). The runnable binary, `openhuman-core`, is built from the `openhuman-cli` package (`crates/openhuman-cli/src/main.rs`), which is why the commands above pass `-p openhuman-cli`.
+- The built binary lands at `target/debug/openhuman-core` or `target/release/openhuman-core`.
### Faster local linking (optional)
-The `openhuman` core crate links a large single rlib, so the edit → `cargo check`/`cargo test` inner loop is frequently link-bound. A faster linker (mold on Linux, lld on macOS) can cut a large slice off every incremental relink. [`.cargo/config.toml`](https://github.com/tinyhumansai/openhuman/blob/main/.cargo/config.toml) documents the manual opt-in, but the easiest path is:
+The `openhuman` core crate links a large single rlib, so the edit, `cargo check` and `cargo test` loop is often link-bound. A faster linker (mold
+on Linux, lld on macOS) cuts a large slice off every incremental relink.
+[`.cargo/config.toml`](https://github.com/tinyhumansai/openhuman/blob/main/.cargo/config.toml) documents the manual
+opt-in. The easiest path is:
```bash
# installs mold/lld detection into $CARGO_HOME/config.toml, never the
-# repo's tracked .cargo/config.toml, so it's a per-machine opt-in
+# repo's tracked .cargo/config.toml, so it is a per-machine opt-in
scripts/dev-setup-linker.sh
# preview the change first
scripts/dev-setup-linker.sh --dry-run
```
-Install the linker first (`apt install mold` / `brew install llvm`). The script detects it and exits with instructions if it's missing. It's idempotent: re-running it after the linker is already configured is a no-op. CI enables the same flag directly via `RUSTFLAGS` in the Linux Rust jobs; this script exists so local `cargo` invocations get the same speedup without depending on a container.
+Install the linker first (`apt install mold` / `brew install llvm`). The
+script detects it and exits with instructions if it is missing. It is
+idempotent, so running it again after the linker is configured does nothing.
+CI enables the same flag through `RUSTFLAGS` in the Linux Rust jobs. The
+script gives local `cargo` runs the same speedup.
### Feature gates and binary size
-`crates/openhuman-core/Cargo.toml` builds most of its domains behind Cargo features. A bare `cargo check` compiles the contributor default set (`media`, `skills`, `flows`, `mcp`, `channels`, `http-server`, `scheduler-gate`, `file-logging`, `modules`), which is not the same as what the desktop app ships: `scripts/ci/product-features.txt` is the single source of truth for the shipped product's gate list, and `scripts/ci/check-feature-forwarding.mjs` asserts that `crates/openhuman-app/Cargo.toml` forwards exactly that set. Turning a gate off drops real code and, for some gates, whole native dependencies. For measured binary sizes and RSS across a few feature recipes, see [Performance](performance.md).
+`crates/openhuman-core/Cargo.toml` builds most of its domains behind Cargo
+features. A bare `cargo check` compiles the contributor default set (`media`,
+`skills`, `flows`, `mcp`, `channels`, `http-server`, `scheduler-gate`,
+`file-logging`, `modules`), which is not what the desktop app
+ships. `scripts/ci/product-features.txt` is the single source of truth for
+the shipped product's gate list, and `scripts/ci/check-feature-forwarding.mjs`
+checks that `crates/openhuman-app/Cargo.toml` forwards exactly that set.
+Turning a gate off drops real code and, for some gates, whole native dependencies. For measured binary sizes and RSS across a few feature recipes,
+see [Performance](performance.md).
## 4. macOS prerequisites
Install:
-* Xcode Command Line Tools: `xcode-select --install`
-
-Why:
+- Xcode Command Line Tools: `xcode-select --install`
-* Native dependencies (`cpal` for audio capture behind the `inference` feature, which `voice` requires; the `objc2` Contacts cohort compiled by the vendored `tinymemory` crates) compile C/Objective-C code during the build and need Apple toolchains and SDK headers present.
+Why: native dependencies compile C and Objective-C code during the build, and they need the Apple toolchain and SDK headers. These include `cpal` for audio capture (behind the `inference` feature, which `voice` requires) and the `objc2` Contacts crates compiled by the vendored `tinymemory` crates.
After Xcode CLT is installed, the core should build with the cargo commands above.
@@ -126,7 +154,7 @@ After Xcode CLT is installed, the core should build with the cargo commands abov
Install these packages before running `cargo` on a fresh Linux machine.
-**Ubuntu / Debian:**
+Ubuntu or Debian:
```bash
sudo apt-get update
@@ -136,28 +164,28 @@ sudo apt-get install -y \
libstdc++-14-dev
```
-**Arch Linux:**
+Arch Linux:
```bash
sudo pacman -S --needed base-devel cmake pkgconf clang openssl \
alsa-lib libxi libxtst xdotool libevdev
```
-> On Arch, `clang` includes `libclang` and `base-devel` includes `gcc` (providing `libstdc++`), so separate `-dev` packages are not needed.
+> On Arch, `clang` includes `libclang` and `base-devel` includes `gcc` (providing `libstdc++`), so you do not need separate `-dev` packages.
Why these matter:
-* `build-essential` / `base-devel`, `cmake`, `pkg-config` / `pkgconf`: native builds used by transitive Rust dependencies.
-* `clang`, `libclang-dev`: bindgen (used by native crates such as `cpal`'s ALSA bindings) and C/C++ compilation paths.
-* `libssl-dev` / `openssl`: OpenSSL headers needed by some networking dependencies.
-* `libasound2-dev` / `alsa-lib`, `libxi-dev` / `libxi`, `libxtst-dev` / `libxtst`, `libxdo-dev` / `xdotool`, `libudev-dev` (included in Arch `systemd-libs`), `libevdev`: required by audio/input/device crates (`cpal`, `enigo`/X11 input handling) pulled into the core build.
-* `libstdc++-14-dev`: `clang`-driven builds may pick GCC 14 C++ headers on Ubuntu runners; this keeps `libstdc++.so` resolvable for those native crates.
+- `build-essential` / `base-devel`, `cmake`, `pkg-config` / `pkgconf`: native builds for transitive Rust dependencies.
+- `clang`, `libclang-dev`: bindgen (used by native crates such as `cpal`'s ALSA bindings) and C/C++ compilation paths.
+- `libssl-dev` / `openssl`: OpenSSL headers needed by some networking dependencies.
+- `libasound2-dev` / `alsa-lib`, `libxi-dev` / `libxi`, `libxtst-dev` / `libxtst`, `libxdo-dev` / `xdotool`, `libudev-dev` (included in Arch `systemd-libs`), `libevdev`: required by the audio, input and device crates (`cpal`, `enigo`/X11 input handling) pulled into the core build.
+- `libstdc++-14-dev`: `clang`-driven builds may pick GCC 14 C++ headers on Ubuntu runners; this keeps `libstdc++.so` resolvable for those native crates.
### Linux desktop/Tauri package set
If you are building the desktop shell instead of the core-only crate, install the broader dependency set.
-**Ubuntu / Debian** (mirrored from [`.github/workflows/build-desktop.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/build-desktop.yml)):
+Ubuntu or Debian (mirrored from [`.github/workflows/build-desktop.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/build-desktop.yml)):
```bash
sudo apt-get update
@@ -170,7 +198,7 @@ sudo apt-get install -y \
libgbm1 libpango-1.0-0 libcairo2 libatspi2.0-0 libxshmfence1 libu2f-udev
```
-**Arch Linux:**
+Arch Linux:
```bash
sudo pacman -S --needed gtk3 webkit2gtk-4.1 libayatana-appindicator \
@@ -185,9 +213,9 @@ Use the desktop lists only when you need `crates/openhuman-app/`; for root-crate
Install:
-* Rust via `rustup`
-* Visual Studio Build Tools 2022 or Visual Studio with the **Desktop development with C++** workload
-* The MSVC target used by CI and release builds: `x86_64-pc-windows-msvc`
+- Rust via `rustup`
+- Visual Studio Build Tools 2022 or Visual Studio with the Desktop development with C++ workload
+- The MSVC target used by CI and release builds: `x86_64-pc-windows-msvc`
Recommended commands after the Microsoft toolchain is installed:
@@ -201,9 +229,9 @@ Use the MSVC toolchain, not MinGW, to match CI and release builds.
## 7. Related paths
-* [Getting Set Up](getting-set-up.md): full desktop contributor setup with `pnpm`, Tauri, and submodules. The core runs in-process inside the desktop shell (see [Tauri Shell](architecture/tauri-shell.md)); there is no sidecar staging step.
-* [OpenHuman Architecture](architecture/): where the core fits into the desktop app and RPC flow.
-* [Deep Architecture Reference](architecture/architecture.md): the full crate map and repository layout.
-* [Embedding](embedding.md): using `crates/openhuman-embed` to run the core as a library in another product.
-* [Engines](engines.md): the pluggable LLM, embedding, memory, and search backends the core can run against.
-* [Performance](performance.md): binary size, cold start, and memory numbers across feature recipes.
+- [Getting set up](getting-set-up.md): the full desktop contributor setup with `pnpm`, Tauri and submodules. The core runs in-process inside the desktop shell (see [Tauri shell](architecture/tauri-shell.md)), so there is no sidecar staging step.
+- [Architecture overview](architecture/README.md): where the core fits into the desktop app and RPC flow.
+- [Architecture](architecture.md): the full crate map and repository layout.
+- [Embedding](embedding.md): using `crates/openhuman-embed` to run the core as a library in another product.
+- [Engines](engines.md): the pluggable LLM, embedding, memory and search backends the core can run against.
+- [Performance](performance.md): binary size, cold start, and memory numbers across feature recipes.
diff --git a/docs/gitbooks/en/developing/cef.md b/docs/gitbooks/en/developing/cef.md
index c05e57c240..ee85de397c 100644
--- a/docs/gitbooks/en/developing/cef.md
+++ b/docs/gitbooks/en/developing/cef.md
@@ -1,122 +1,34 @@
---
description: >-
- Historical design notes from when OpenHuman shipped its own Chromium (CEF)
- runtime. The shell now runs on stock Tauri (Wry); kept as background only.
+ Why the desktop shell no longer uses Chromium (CEF), what replaced it, and
+ the rule against injecting JavaScript into child webviews.
icon: chrome
---
-# Chromium Embedded Framework (historical)
+# Chromium Embedded Framework (retired)
-{% hint style="warning" %}
-**Historical.** The desktop shell no longer ships CEF. `crates/openhuman-app/` builds on upstream Tauri's native webview runtime (Wry: WKWebView / WebView2 / WebKitGTK), and `AGENTS.md` forbids restoring CEF or CDP-scanner assumptions. The native iMessage scanner remains separate because it reads `chat.db` directly. Everything below describes the retired runtime and is kept only as design background; the file paths it cites (`crates/openhuman-app/src/webview_accounts/`, `scripts/ensure-tauri-cli.sh`, `vendor/tauri-cef`) no longer exist.
-{% endhint %}
+OpenHuman no longer ships its own Chromium. The desktop shell, `crates/openhuman-app/`, runs on the native webview that Tauri v2 provides through Wry: WKWebView on macOS, WebView2 on Windows and WebKitGTK on Linux. Do not restore CEF or Chrome DevTools Protocol (CDP) scanner assumptions. [`AGENTS.md`](https://github.com/tinyhumansai/openhuman/blob/main/AGENTS.md) states this rule.
-For about a year OpenHuman did not run on the platform's built-in webview. It shipped its own **Chromium Embedded Framework (CEF) runtime** through a fork of `tauri-runtime`, and that single decision was load-bearing for almost every "OpenHuman knows what's happening in your tools" feature in the product.
+This page is background for anyone who finds CEF references in older code or notes.
-This page explains why CEF was in the bundle, what the codebase used it for, and what replaced each piece. Nothing described below is in the shipped app.
+## What CEF was for
-## Why CEF instead of a stock webview
+For a while the shell shipped Chromium through a fork of `tauri-runtime`. The stock native webviews do not expose CDP, and CDP was what let the app watch connected web apps such as Slack, WhatsApp, Telegram, Discord and Google Meet. Each one ran in its own child webview with isolated storage, and a scanner for each read its state over CDP rather than through injected JavaScript. The same runtime also powered a Google Meet camera that showed the mascot, and notification interception for embedded apps.
-Stock Tauri uses each platform's native webview. WKWebView on macOS, WebView2 on Windows, WebKitGTK on Linux. Those work fine for rendering the OpenHuman app itself. They have one fatal limitation for our use case: **none of them expose Chrome DevTools Protocol (CDP)**.
+None of that is in the shipped app.
-CDP is the load-bearing primitive. Every "watch what's happening inside Slack / WhatsApp / Telegram / Discord / Meet" feature in OpenHuman talks to those embedded apps via CDP, not via injected JavaScript. CDP gives us:
+## What replaced it
-- `Target.getTargets` to discover every page and service worker.
-- `IndexedDB.requestDatabaseNames` / `requestDatabase` / `requestData` to walk a third-party app's local storage.
-- `DOMSnapshot.captureSnapshot` for read-only DOM inspection that doesn't trip framework reactivity.
-- `Runtime.evaluate` for ephemeral one-shot reads (a single fixed JSON serializer, never a persistent bridge).
-- `Page.addScriptToEvaluateOnNewDocument` for the small number of cases where we genuinely need a renderer-side shim before page JS runs.
+- Browser automation moved out of the shell. A real Chrome is driven over CDP from the Rust side, through the `tinycomputer` module, as a separate process that the agent launches or attaches to. See [Browser and computer control](../features/native-tools/browser-and-computer.md).
+- The scanners that walked third-party apps are gone. The iMessage scanner remains because it reads `~/Library/Messages/chat.db` directly and never needed a browser.
-Stock webviews give none of that, which is why CEF was vendored.
+## No JavaScript injection into child webviews
-**What replaced it.** Browser automation moved out of the shell entirely: a real Chrome driven over CDP from the Rust side, through the `tinycomputer` module, as a separate process the agent either launches or attaches to. See [Browser & Computer Control](../features/native-tools/browser-and-computer.md). The scanners that walked a third-party app's IndexedDB are gone; the one that survived, iMessage, never needed a browser because it reads `chat.db` directly.
+Do not add JavaScript injection to child webviews. New behavior belongs in Rust-side IPC hooks, and any new Tauri plugin should be audited for `js_init_script`.
-The vendored runtime lived at `crates/openhuman-app/vendor/tauri-cef/` (forked from the upstream `tauri-cef` branch onto `tinyhumansai/tauri-cef:feat/cef-notification-intercept`, currently CEF 146.4.1). Every Tauri crate is patched at `crates/openhuman-app/Cargo.toml` via `[patch.crates-io]` to point at this fork. The vendored `cargo-tauri` CLI bundles Chromium correctly into `Contents/Frameworks/`; stock `@tauri-apps/cli` produces a broken bundle that panics in `cef::library_loader::LibraryLoader::new`. `scripts/ensure-tauri-cli.sh` (removed) reinstalled the vendored CLI whenever the fork is newer than the installed binary.
-
-## What CEF was used for
-
-### Embedded third-party webviews
-
-Every connected provider that runs as a hosted web app gets its own child CEF webview:
-
-- WhatsApp Web
-- Telegram Web
-- Slack
-- Discord
-- Google Meet
-- LinkedIn
-- Gmail
-- Zoom
-- WeChat
-- Google Messages
-- browserscan
-
-Per-account storage is isolated to `{app_local_data_dir}/webview_accounts/{id}/`. Two Slack workspaces, two browser profiles. Code (removed): `crates/openhuman-app/src/webview_accounts/mod.rs`.
-
-### CDP-driven scanners
-
-Each provider had a **scanner module** in `crates/openhuman-app/src/` (all removed except `imessage_scanner/`). Every scanner holds a long-lived WebSocket to CEF's `--remote-debugging-port=19222` and ticks on a fixed schedule:
-
-| Scanner | Cadence | What it does |
-| ------------------- | ------------------------------- | -------------------------------------------------------------------- |
-| `whatsapp_scanner` | 2s DOM tick + 30s full IDB walk | Reads message stores, pulls media metadata |
-| `telegram_scanner` | Same | Plus QR-login hand-off to native Telegram Desktop |
-| `slack_scanner` | 30s IDB walk | Pure IDB - no DOM scrape needed |
-| `discord_scanner` | Periodic | Channel + DM state via CDP |
-| `meet_scanner` | Periodic | Live captions + participant state during calls |
-| `wechat_scanner` | Periodic | WeChat Web chat list + active conversation DOM scrape via CDP |
-| `gmessages_scanner` | Periodic | Google Messages Web read-only IndexedDB walk |
-| `imessage_scanner` | Periodic | **No webview.** Reads `~/Library/Messages/chat.db` directly on macOS |
-
-Each scan emitted `webview:event` payloads from the shell, so scanning continued whether the UI window was open or backgrounded. (The native iMessage scanner's old `openhuman.memory_doc_ingest` RPC call no longer exists in the core.)
-
-### Google Meet mascot camera
-
-The flashiest CEF trick, and the one that went with it. The Meet agent did not just _attend_ a meeting, it **broadcast** itself as a camera. That worked because CEF let us:
-
-1. Inject a tiny bridge (`camera_bridge.js`) via `Page.addScriptToEvaluateOnNewDocument` before any Meet code runs.
-2. Override `navigator.mediaDevices.getUserMedia` so it returns a `MediaStream` from a hidden 640×480 canvas instead of a real camera.
-3. Render the mascot SVG on that canvas, swapping mood states (idle, thinking, talking) via `window.__openhumanSetMood(...)` driven from Rust over CDP.
-
-There's also a build-time path that rasterizes the mascot SVG to Y4M and uses CEF's native `--use-file-for-fake-video-capture` flag, a fully native fake-camera source with no JS at all.
-
-Code (removed): `crates/openhuman-app/src/meet_video/`.
-
-### Native notification interception
-
-The fork at `feat/cef-notification-intercept` adds renderer-side shims for `Notification.permission`, `Notification.requestPermission()`, and `navigator.permissions.query({name: "notifications"})`. These now install in the real `tauri-runtime-cef` path on every runtime code path, so when Slack checks if it can show notifications, the answer is consistent with what CEF's permission callbacks already granted.
-
-This was the bulk of the (since removed) `docs/TAURI_CEF_FINDINGS_AND_CHANGES.md`. It's why Slack stops asking the same permission five times in a session.
-
-## The "no new JS injection" rule
-
-The rule is documented in [`AGENTS.md`](https://github.com/tinyhumansai/openhuman/blob/main/AGENTS.md): **migrated providers load with zero injected JavaScript**. All scraping happens natively over CDP from the scanner side.
-
-This matters because anything host-controlled that runs inside a third-party origin is an attack-surface liability. A persistent JS bridge inside Slack is one Slack update away from breaking, and one mistake away from leaking the bridge to attacker-controlled JS. CDP from outside the renderer is strictly better.
-
-| Provider | Migrated? | What loads at startup |
-| ----------- | ------------- | -------------------------------- |
-| WhatsApp | Yes | Zero JS |
-| Telegram | Yes | Zero JS |
-| Slack | Yes | Zero JS |
-| Discord | Yes | Zero JS |
-| browserscan | Yes | Zero JS |
-| Gmail | grandfathered | Legacy `runtime.js` bridge |
-| LinkedIn | grandfathered | Legacy `LINKEDIN_RECIPE_JS` |
-| Google Meet | grandfathered | Camera + audio + caption bridges |
-
-Legacy injection should shrink, never grow. New providers go straight onto the CDP-only path.
-
-## Removed sections
-
-This page used to carry a CEF prewarm note, Windows and Linux startup-triage
-runbooks, a plugin-audit table, and a "where this could evolve" design section.
-They are dropped rather than kept: the runbooks told a maintainer to collect
-logs and set environment variables that no longer exist, and the design section
-has been overtaken. The one idea in it that did happen, browser automation as a
-first-class agent tool, is
-[Browser & Computer Control](../features/native-tools/browser-and-computer.md).
+Host-controlled code that runs inside a third-party origin is an attack-surface risk. A persistent bridge inside another site breaks when that site updates, and one mistake can expose the bridge to attacker-controlled JavaScript.
## See also
-- [`AGENTS.md`](https://github.com/tinyhumansai/openhuman/blob/main/AGENTS.md): the canonical rule that no JavaScript injection is added to child webviews, and that CEF and CDP-scanner assumptions are not restored.
+- [Tauri shell](architecture/tauri-shell.md): the current desktop host and its IPC surface.
+- [`AGENTS.md`](https://github.com/tinyhumansai/openhuman/blob/main/AGENTS.md): the repo-wide rules.
diff --git a/docs/gitbooks/en/developing/claude-code.md b/docs/gitbooks/en/developing/claude-code.md
deleted file mode 100644
index 022b100f0c..0000000000
--- a/docs/gitbooks/en/developing/claude-code.md
+++ /dev/null
@@ -1,105 +0,0 @@
----
-description: Routing a workload through the Claude Code CLI or the Claude Agent SDK.
-icon: terminal
----
-
-# Claude Code CLI provider
-
-OpenHuman can route any chat workload through Anthropic's `claude` CLI instead of calling the Anthropic HTTP API directly. The CLI handles model selection, auth, and prompt-cache management; OpenHuman drives it as a long-lived, session-resuming child process, parses its stream-json output, and hands it an MCP endpoint so the model can reach native OpenHuman state (memory, threads, agents, search). This is one of several pluggable LLM backends; see [Engines](engines.md) for the full list.
-
-The provider itself, `ClaudeCodeProvider`, is owned by `tinyagents-harness` (vendor/tinyagents), not by OpenHuman: see [its README](https://github.com/tinyhumansai/tinyagents/blob/main/crates/tinyagents-harness/src/providers/claude_code/README.md) for the full file map and implementation notes. OpenHuman only wires it up in `crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs`, which supplies the MCP endpoint (`OpenHumanMcpEndpoint`, below) and reads the resulting model string back into its own routing.
-
-## Requirements
-
-* Claude Code CLI **≥ 2.0.0** (`MIN_CLI_VERSION`), either on `PATH`, at one of the supported well-known install locations, or selected with `OPENHUMAN_CLAUDE_CLI=/abs/path/to/claude`.
-* An Anthropic API key in `ANTHROPIC_API_KEY`, **or** a pre-existing `~/.claude/.credentials.json` from `claude login`.
-* The `http-server` Cargo feature (on by default): OpenHuman exposes its MCP tools to the CLI over a loopback HTTP endpoint (`crate::mcp::server::ensure_local_http`), not by spawning `openhuman-core mcp` as a subprocess. Without that feature, the provider still runs, but the CLI gets no OpenHuman tools.
-
-## Routing a workload through the CLI
-
-The factory grammar accepts a new prefix: `claude-code:<model>[@<temperature>]`. Apply it via the standard inference settings (per-role, locked decision #3):
-
-```bash
-# Through the JSON-RPC update endpoint:
-openhuman-core rpc openhuman.inference_update_model_settings \
- --json '{"chat_provider":"claude-code:claude-sonnet-4-5"}'
-```
-
-| Role string | Field updated |
-| -------------------- | -------------------------------- |
-| `chat_provider` | foreground chat replies |
-| `reasoning_provider` | long-context reasoning workloads |
-| `agentic_provider` | multi-step agentic loops |
-
-A workload set to `claude-code:<model>` always spawns a fresh `claude` child per turn; concurrency is capped at `MAX_CONCURRENT_TURNS = 4` per `ClaudeCodeProvider` instance (see [Per-turn behavior](claude-code.md#per-turn-behavior)).
-
-## Verifying the install
-
-The status RPC is on the existing inference namespace:
-
-```bash
-openhuman-core rpc openhuman.inference_claude_code_status
-```
-
-Returns one of (`CliStatus` in [`tinyagents-harness`'s `claude_code/types.rs`](https://github.com/tinyhumansai/tinyagents/blob/main/crates/tinyagents-harness/src/providers/claude_code/types.rs)):
-
-* `{"status":"ok","version":"2.0.4","path":"/usr/local/bin/claude"}`: ready
-* `{"status":"not_installed"}`: no usable `claude` was found through the configured override, `PATH`, or the supported fallback locations
-* `{"status":"outdated","version":"1.9.0","min_required":"2.0.0","path":"…"}`: bump CLI
-* `{"status":"unusable","path":"…","reason":"…"}`: binary present but the version probe failed
-
-Binary lookup uses this precedence: `OPENHUMAN_CLAUDE_CLI` first, then the `PATH` search, then the ordered fallback locations. The fallback list covers the native installer and common user-local, Bun, npm-global, and Homebrew installations. When the CLI is found through a fallback, its directory and user bin directories are prepended to the child process `PATH`, while the inherited entries remain available.
-
-The same status is rendered in the settings panel via `ClaudeCodeStatusCard` ([`app/src/components/settings/panels/ai/ClaudeCodeStatusCard.tsx`](https://github.com/tinyhumansai/openhuman/blob/main/app/src/components/settings/panels/ai/ClaudeCodeStatusCard.tsx)).
-
-## Per-turn behavior
-
-`ClaudeCodeProvider::run_chat` acquires one of `MAX_CONCURRENT_TURNS` (4) semaphore permits, plus a per-thread mutex so two overlapping calls for the same conversation cannot race on the same session UUID. Each turn then:
-
-1. Resolves a per-thread CC session UUID from `<workspace_dir>/claude-code-sessions.json`. New threads get a fresh RFC-4122 v4 UUID; the CLI requires v4 specifically for `--resume`.
-2. Asks the host's `McpEndpointProvider` for an MCP endpoint. OpenHuman's implementation (`OpenHumanMcpEndpoint`) lazily starts one in-process HTTP MCP server per core (`crate::mcp::server::ensure_local_http`, loopback only) and returns its URL plus a bearer token; the config file passed via `--mcp-config` carries that token in its `Authorization` header. If starting the endpoint fails, the turn still proceeds, just without OpenHuman tools.
-3. Spawns the CLI with:
- * `-p --input-format stream-json --output-format stream-json --verbose --include-partial-messages --add-dir <project_dir>`
- * `--mcp-config <scratch>/openhuman-mcp-config.json --strict-mcp-config` when the endpoint resolved, so only the configured MCP servers are visible
- * `--permission-mode acceptEdits` (default) or `bypassPermissions` (full access, see below)
- * by default, `--disallowedTools Bash,BashOutput,KillShell,WebFetch,WebSearch,Task`, so CC's own shell, network, and subagent-fanout builtins stay off and OpenHuman tools (`mcp__openhuman__*`) are the only way to reach those capabilities; omitted entirely when full access is on
- * `--session-id <uuid>` on first turn, `--resume <uuid>` thereafter
- * `--model <model>` (the suffix after `claude-code:`)
- * `--append-system-prompt-file <scratch>/append-system-prompt.txt` if the conversation carries a system message (a file, not an argv value, so a large harness prompt does not hit Windows' argv length limit)
-4. Pipes stdin: full conversation history folded into a text preamble on a new session, just the pending user turn(s) on `--resume` (the CLI already holds its own prior-turn context server-side).
-5. Streams stdout through the JSONL parser, then the event mapper, into `ProviderDelta`s on the request's `stream` sink.
-
-On exit non-zero the driver bubbles stderr (capped at 16 KiB) up as the error message.
-
-On macOS the spawn is wrapped in a Seatbelt jail (`sandbox-exec`) by default when `/usr/bin/sandbox-exec` exists; set `OPENHUMAN_CLAUDE_CODE_SANDBOX=0` to opt out. The profile blocks reads and writes under the first `.openhuman*`-named ancestor of `workspace_dir` (this provider's own session store and settings), not the CLI's own file tools. Linux and Windows have no OS-level wall yet.
-
-### Permission posture and full access
-
-The default posture, `acceptEdits`, restricts CC to file reads and edits under `project_dir` and withholds shell, network, and `Task` fan-out via `--disallowedTools`. A user can opt into full access (CC's entire toolset, including Bash) either through the settings toggle persisted in `<workspace_dir>/claude_code_settings.json`, or with `OPENHUMAN_CLAUDE_CODE_PERMISSION_MODE=bypass|bypassPermissions|full`. This is an explicit user choice; enabling the Claude Code provider alone never grants shell or network access.
-
-## Auth resolution order
-
-1. `ANTHROPIC_API_KEY` env var (highest precedence, set on the spawned child).
-2. A host-provided auth-profile store, or Claude Pro/Max OAuth: both still future work.
-3. `~/.claude/.credentials.json`: the CLI's own login from `claude login` (Pro/Max subscription), used transparently by simply not setting `ANTHROPIC_API_KEY` on the child, so the CLI reads its own credentials (the Keychain, on macOS, under the `Claude Code-credentials` service).
-4. None: the CLI will fail with an auth error.
-
-The `openhuman.inference_claude_code_auth_status` RPC reports the richer state for the Settings → AI panel by spawning `claude auth status --json` (bounded by a 10-second timeout) rather than reading the credentials file directly, since a macOS login lives in the Keychain, not on disk.
-
-## Tool surface exposed to the CLI
-
-The CLI sees these tools as `mcp__openhuman__<name>`, served over the loopback HTTP MCP endpoint described above (the same tool set the stdio MCP server in [`crates/openhuman-core/src/mcp/server/`](../../../../../../crates/openhuman-core/src/mcp/server/) exposes to other MCP clients):
-
-* `core.list_tools`, `core.tool_instructions`
-* `memory.recall`, `memory.fetch`, `memory.list`, `memory.learn`, `memory.forget`
-* `agent.list_subagents`, `agent.run_subagent` (write, flagged `destructiveHint` per MCP spec)
-* `searxng_search`
-
-The MCP server enforces `SecurityPolicy::ToolOperation` checks; `agent.run_subagent`, `memory.learn` and `memory.forget` act (write); the rest are read-only. The CLI's own `tool_use` blocks (its internal Read/Bash/etc. calls) are never surfaced to OpenHuman as harness tool calls: the CLI has already executed them by the time they appear in the stream, so `event_mapper.rs` only strips their argument JSON out of the visible text.
-
-## Limitations (v1)
-
-* Vision input is forwarded as native image blocks when pasted images are available to the Claude Code provider. Images that cannot be read are sent as a short text notice.
-* Every role routed to `claude-code:` shares the same `MAX_CONCURRENT_TURNS` semaphore; under load a CC turn waits in queue rather than failing fast.
-* Cost accounting from the CLI's `result.total_cost_usd` is captured in the mapper but not yet wired into OpenHuman's billing layer ([`crates/openhuman-core/src/platform/cost/`](../../../../../../crates/openhuman-core/src/platform/cost/)).
-* Linux and Windows run the CLI unconfined; the Seatbelt jail is macOS-only.
diff --git a/docs/gitbooks/en/developing/developing.md b/docs/gitbooks/en/developing/developing.md
deleted file mode 100644
index e01315ebb8..0000000000
--- a/docs/gitbooks/en/developing/developing.md
+++ /dev/null
@@ -1,91 +0,0 @@
----
-description: Build, run, test, and ship OpenHuman from source.
-icon: code-branch
----
-
-# Overview
-
-OpenHuman is open source under GPLv3 at [github.com/tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman). This section is for contributors and anyone running OpenHuman from source.
-
-If you just want to use the app, head to [Getting Started](../overview/getting-started.md). If you're here to read the architecture, hack on a feature, or land a PR, you're in the right place.
-
-***
-
-## Why the harness is light
-
-Most of what makes OpenHuman fast is a choice made early on: the core is a Rust library, not a set of services talking to each other over sockets. Agents run in-process, so a turn pays for a function call instead of a process boundary or an RPC hop. We've measured 500 agents alive at once in a single process at roughly 1.77 MiB of marginal memory each, cold agent turns land around 100 ms, and a stripped build with only the domains you need can come in at 51 MiB. [Performance](performance.md) has the numbers and how we got them, and the rig that produces them is public at [tinyhumansai/openhuman-benchmarks](https://github.com/tinyhumansai/openhuman-benchmarks).
-
-Everything above that floor is modular: cargo feature gates decide what compiles in, loadable native modules carry the heavier engines, and the engines themselves, model providers, embeddings, memory, search, are chosen by config rather than baked into the binary. That's what [Pluggable engines](engines.md), [Loadable modules](loadable-modules.md) and [Jev](jev.md) cover.
-
-## Where things live
-
-| Path | What's there |
-| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `app/` | pnpm workspace `openhuman-app`. Vite + React frontend ([`app/src/`](../../../../app/src/)) and the Tauri desktop host ([`crates/openhuman-app/`](../../../../crates/openhuman-app/)). |
-| `crates/` | Rust crates ([overview](https://github.com/tinyhumansai/openhuman/blob/main/crates/README.md)). Six workspace members: `openhuman-core` (package `openhuman`: the core library, domains under `src/<domain>/`, the controller contract and in-process dispatch under `src/core/`; **no binary and no JSON-RPC server**), `openhuman-rpc` (JSON-RPC 2.0 over the core: envelopes, HTTP client, and the server), `openhuman-embed` (the typed library facade), `openhuman-tinyhumans` (the only crate that may depend on `tinyhumans-sdk`: backend transport, hosted RPC proxies, host-side session owner; every host installs it first), `openhuman-cli` (the `openhuman-core` binary and every root `tests/` and `examples/` target), `openhuman-tui` (terminal frontend). Plus `openhuman-app` (the Tauri host), which is excluded from the root workspace and builds from its own manifest. |
-| `gitbooks/` | This site (the public-facing docs, [source](../)). |
-| `docs/` | Internal maintainer docs: test-coverage matrix, release smoke checklist, library benchmarking and minimal-recipe notes, translated READMEs, `community/` ([`docs/`](../../../)). |
-
-[`AGENTS.md`](https://github.com/tinyhumansai/openhuman/blob/main/AGENTS.md) at the repo root is the source of truth for AI agents working on the codebase ([`CLAUDE.md`](https://github.com/tinyhumansai/openhuman/blob/main/CLAUDE.md) is a symlink to it). Same rules apply to humans.
-
-***
-
-## Start here
-
-If it's your first time pulling the repo:
-
-1. [**Getting Set Up**](getting-set-up.md). Toolchain, dependencies, the Tauri CLI, everything `pnpm dev` needs to actually start.
-2. [**Building the Rust Core**](building-rust-core.md). Fresh-machine setup for the Rust workspace only: pinned toolchain, OS packages, and exact `cargo` commands.
-3. [**Architecture**](architecture/architecture.md) (with the [overview](architecture/)). How the desktop app, the in-process Rust core, the JSON-RPC bridge, and the dual sockets fit together. Read this before you make non-trivial changes.
-4. [**Frontend**](architecture/frontend.md) and [**Tauri Shell**](architecture/tauri-shell.md). The React app and the desktop host that wraps it.
-5. [**MCP Server**](mcp-server.md). Opt-in stdio MCP mode for exposing read-only OpenHuman memory tools to local clients.
-
-***
-
-## The core, in depth
-
-* [**Performance**](performance.md). What "light and fast" means in numbers: memory per agent, cold-start timing, binary size, and how the benchmarks are run. Raw rigs and results live in the public [openhuman-benchmarks](https://github.com/tinyhumansai/openhuman-benchmarks) repo.
-* [**Pluggable engines**](engines.md). How the LLM, embeddings, memory, and web search layers are chosen by config, and what's available for each.
-* [**Jev**](jev.md). The fast probability model behind tool selection and routine browser decisions, and why it beats brute-force retrieval on both speed and accuracy.
-* [**Embedding OpenHuman**](embedding.md) (see also [`crates/openhuman-embed`](../../../../crates/openhuman-embed/)). Using `openhuman-embed` to run the core, and any number of agents on it, inside another Rust product.
-* [**One TinyHumans API key**](tinyhumans-api-key.md). What a single key unlocks: managed inference, embeddings, web search, media, integrations, voice, and Jev.
-
-***
-
-## Testing
-
-OpenHuman ships with three test layers. Know which one your change belongs in (the Rust integration targets are described in [`tests/README.md`](https://github.com/tinyhumansai/openhuman/blob/main/tests/README.md), the helper scripts in [`scripts/README.md`](https://github.com/tinyhumansai/openhuman/blob/main/scripts/README.md)):
-
-* [**Testing Strategy**](testing-strategy.md). When to write Vitest vs cargo tests vs WDIO.
-* [**E2E Testing**](e2e-testing.md). WDIO/Appium specs, dual-platform setup (Linux tauri-driver, macOS Appium Mac2), and how to run a single spec locally.
-* [**Agent Observability**](agent-observability.md). The artifact-capture layer that makes E2E and agent runs debuggable after the fact.
-
-PRs must clear the **≥ 80% coverage on changed lines** gate. Add tests for new behavior, not just the happy path.
-
-***
-
-## Shipping
-
-* [**Release Policy**](release-policy.md). Version policy, release cadence, OAuth + installer rules.
-* [**Cloud Deploy**](../features/cloud-deploy.md). Backend/cloud-side deployment when a change crosses the desktop boundary.
-
-***
-
-## Going deeper
-
-* [**Agent Harness**](architecture/agent-harness.md). The tinyagents-based turn loop (checkpointing, circuit breakers, sub-agent handback, journals/replay) and how to extend the tool surface.
-* [**Workflows**](../features/workflows.md). The tinyflows-backed `flows` domain: triggers, trust origins, approval-gated runs, and the `flows_*` RPC surface.
-* [**Loadable modules**](loadable-modules.md). Native `cdylib` modules the core loads at runtime, and how they are admitted.
-* [**Hooks**](hooks.md). User-owned scripts that run before a tool executes, after a file edit, or when a turn finishes.
-* [**Chromium Embedded Framework**](cef.md). Historical design notes from the CEF era; the shell now runs on stock Tauri (Wry).
-
-***
-
-## Contributing
-
-* Open issues and PRs at [tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman). The [`vendor/`](../../../../vendor/) submodules (tinyagents, tinymemory and friends) have their own repos under [tinyhumansai](https://github.com/tinyhumansai).
-* PRs target `main`. Push to your fork, not upstream.
-* Follow [`CONTRIBUTING.md`](https://github.com/tinyhumansai/openhuman/blob/main/CONTRIBUTING.md) and the issue/PR templates.
-* Keep changes focused. A bug fix doesn't need surrounding cleanup; a one-shot operation doesn't need a helper.
-
-Help building toward AGI doesn't have to mean shipping a kernel, bugfixes, docs, integrations, and tests all move the bar.
diff --git a/docs/gitbooks/en/developing/e2e-testing.md b/docs/gitbooks/en/developing/e2e-testing.md
index 154d093000..5bfa1ae3a3 100644
--- a/docs/gitbooks/en/developing/e2e-testing.md
+++ b/docs/gitbooks/en/developing/e2e-testing.md
@@ -1,26 +1,23 @@
---
description: >-
- The desktop and web end-to-end suites: the WDIO and tauri-driver harness,
- how to run a spec locally or in Docker, the environment variables each lane
- reads, and which lanes actually execute in CI.
+ How to run the end-to-end suites: the WDIO and tauri-driver harness, a spec
+ locally or in Docker, the environment variables, and which lanes run in CI.
icon: vials
---
-# E2E Testing
+# E2E testing
-End-to-end coverage runs in three lanes: a Rust mock-backend suite, a
-Playwright web suite, and a desktop suite driven through `tauri-driver`. Only
-the Linux desktop harness runs on a schedule; macOS and Windows are manual.
+End-to-end coverage runs in three lanes: a Rust mock-backend suite, a Playwright web suite, and a desktop suite driven through `tauri-driver`. Only the Linux desktop harness runs in CI. macOS and Windows are manual.
## Overview
-Desktop E2E tests use **WebDriverIO (WDIO)** to drive the app through a single `tauri-driver` (WebDriver) session against its native Wry/WebKit webview:
+Desktop E2E tests use WebDriverIO (WDIO) to drive the app through a single `tauri-driver` (WebDriver) session against its native Wry/WebKit webview:
| Platform | Driver | Port | App format | Selectors |
| --------- | ------------------------------ | ---- | ------------ | --------- |
-| **Linux** | tauri-driver + WebKitWebDriver | 4444 | Debug binary | CSS / DOM |
+| Linux | tauri-driver + WebKitWebDriver | 4444 | Debug binary | CSS / DOM |
-The app moved from CEF to Tauri's native Wry webview in #5456. The old Appium Chromium-driver backend attached over CEF's remote-debugging port; CDP only exists under a Chromium engine, so that backend was removed in #5478 along with CEF itself. Linux CI now drives the debug binary under Xvfb through `tauri-driver`. macOS and Windows have no automated desktop E2E coverage until a native driver (Appium Mac2 / WinAppDriver) replaces the removed one; that work is tracked in #5485. `pnpm --filter openhuman-app test:e2e:build` still produces a `.app` bundle on macOS for manual testing, but there is no supported automated session there yet.
+Linux CI drives the debug binary under Xvfb through `tauri-driver`. macOS and Windows have no automated desktop E2E coverage yet. The Chromium-based driver they used is gone, and a native driver (Appium Mac2 on macOS, WinAppDriver on Windows) would have to replace it. `pnpm --filter openhuman-app test:e2e:build` still produces a `.app` bundle on macOS for manual testing, but there is no supported automated session there.
---
@@ -45,15 +42,15 @@ bash app/scripts/e2e-run-spec.sh test/e2e/specs/smoke.spec.ts smoke
`app/scripts/e2e-run-session.sh` starts `tauri-driver` on `TAURI_DRIVER_PORT`
(default `4444`) with `WebKitWebDriver` as its native driver, waits for its
`/status` endpoint, then runs WDIO against `app/test/wdio.conf.ts`. On
-headless Linux the app itself runs under **Xvfb** for a virtual display; the
+headless Linux the app itself runs under Xvfb for a virtual display; the
driver process does not need one.
### Docker on macOS (Linux harness locally)
-Run the same Linux-based harness from macOS using Docker.
+To run the same Linux harness from macOS, use Docker.
```bash
-# Build + run all E2E flows
+# Build and run all E2E flows
docker compose -f e2e/docker-compose.yml run --rm e2e
# Build the app first (if needed)
@@ -73,17 +70,11 @@ Requires Docker Desktop or Colima. The repo is bind-mounted so builds persist be
### Platform detection
-`app/test/e2e/helpers/platform.ts` now exports two functions, both hardcoded
-to `true`: `isTauriDriver()` and `supportsExecuteScript()`. They date from an
-earlier harness split between an accessibility-tree macOS driver and a
-DOM-based Linux driver. Every session today exposes the WebView DOM and
-supports `browser.execute()`, so specs that still branch on either check
-always take the DOM-capable path. Treat them as compatibility shims, not
-active platform detection.
+`app/test/e2e/helpers/platform.ts` exports two functions, both hardcoded to `true`: `isTauriDriver()` and `supportsExecuteScript()`. Every session exposes the webview DOM and supports `browser.execute()`, so specs that still branch on either check always take the DOM path. Treat them as compatibility shims, not as platform detection.
### Element helpers
-`app/test/e2e/helpers/element-helpers.ts` provides a unified API over the WebView DOM:
+`app/test/e2e/helpers/element-helpers.ts` provides one API over the webview DOM:
| Helper | Behavior |
| ------------------------- | -------------------------------------------- |
@@ -114,14 +105,14 @@ Use `waitForTestId(testId)` and `clickTestId(testId)` from `element-helpers.ts`
`app/test/e2e/helpers/deep-link-helpers.ts` handles auth deep links:
-- **Primary path**: `browser.execute(window.__simulateDeepLink(url))`, which works against the WebView on every platform tauri-driver supports.
-- **macOS-only fallbacks** (unexercised by CI today, since macOS has no automated desktop session): the `macos: deepLink` extension command, then `open -a ...`.
-- Linux has no shell fallback: `xdg-open openhuman://...` needs a `.desktop` file registering the URL scheme, which the CI container does not have, so `triggerDeepLink` throws immediately if the WebView simulate call fails there.
+- Primary path: `browser.execute(window.__simulateDeepLink(url))`. It works against the webview on every platform tauri-driver supports.
+- macOS-only fallbacks: the `macos: deepLink` extension command, then `open -a ...`. CI does not exercise these, because macOS has no automated desktop session.
+- Linux has no shell fallback. `xdg-open openhuman://...` needs a `.desktop` file that registers the URL scheme, and the CI container does not have one. If the webview simulate call fails there, `triggerDeepLink` throws immediately.
-For release candidates, also run one manual secondary-instance smoke on Linux
-or macOS when touching single-instance or deep-link startup code (this
-exercises `tauri-plugin-single-instance`, which OpenHuman registers with the
-`deep-link` feature):
+For release candidates, also run one manual secondary-instance smoke test on Linux
+or macOS when you touch single-instance or deep-link startup code. It exercises
+`tauri-plugin-single-instance`, which OpenHuman registers with the
+`deep-link` feature.
1. Launch OpenHuman normally and leave it running.
2. Trigger `openhuman://auth?token=e2e-token&key=auth` through the OS opener.
@@ -129,20 +120,17 @@ exercises `tauri-plugin-single-instance`, which OpenHuman registers with the
second app instance starting.
4. Confirm the secondary process exits cleanly.
-This catches regressions where a second instance starts (or exits with an
-error) before Tauri's deep-link forwarding path is installed.
+This catches a second instance that starts, or exits with an
+error, before Tauri's deep-link forwarding path is installed.
### Writing cross-platform specs
-1. **Use helpers** from `element-helpers.ts`, never use raw `XCUIElementType*` selectors in specs
-2. **Use `clickNativeButton(text)`** instead of inline button-clicking code
-3. **Use `hasAppChrome()`** instead of checking for `XCUIElementTypeMenuBar`
-4. **Use `waitForWebView()`** instead of checking for `XCUIElementTypeWebView`
-5. For macOS-only tests, use `process.platform` guards or separate spec files
-6. Use `navigateViaHash(route)` for hash routes; it waits for the hash,
- `document.readyState`, and a mounted React root before returning. After
- onboarding, `walkOnboarding()` also waits for `#/home` plus a Home-page
- marker before specs navigate elsewhere.
+1. Use the helpers in `element-helpers.ts`. Never use raw `XCUIElementType*` selectors in specs.
+2. Use `clickNativeButton(text)` instead of inline button-clicking code.
+3. Use `hasAppChrome()` instead of checking for `XCUIElementTypeMenuBar`.
+4. Use `waitForWebView()` instead of checking for `XCUIElementTypeWebView`.
+5. For macOS-only tests, use `process.platform` guards or separate spec files.
+6. Use `navigateViaHash(route)` for hash routes. It waits for the hash, `document.readyState` and a mounted React root before it returns. After onboarding, `walkOnboarding()` also waits for `#/home` and a Home-page marker before specs navigate elsewhere.
---
@@ -160,13 +148,7 @@ error) before Tauri's deep-link forwarding path is installed.
| `DEBUG_E2E_DEEPLINK` | (verbose) | Set to `0` to silence deep link logs |
| `E2E_FORCE_CARGO_CLEAN` | unset | Force cargo clean before E2E build |
-Two web E2E sessions on one machine need separate ports. The lane refuses to
-start when any of its three ports is already listening, because its readiness
-probes are ordinary HTTP GETs that the other session's mock, core and web host
-answer just as happily, and `openhuman-core run` falls back to a neighbouring
-port rather than exiting, so it would stay alive on a port nothing probes
-(#5918). Set `E2E_PORT_BASE` for the build and the run alike: the mock and core
-ports are compiled into the bundle and cannot be changed afterwards (#6478).
+Two web E2E sessions on one machine need separate ports. The lane refuses to start when any of its three ports is already listening. Its readiness probes are ordinary HTTP GETs that another session's mock, core and web host would answer just as happily, and `openhuman-core run` falls back to a neighboring port instead of exiting, so it could stay alive on a port nothing probes. Set `E2E_PORT_BASE` for the build and the run alike. The mock and core ports are compiled into the bundle and cannot be changed afterwards.
```bash
E2E_PORT_BASE=31000 pnpm --filter openhuman-app test:e2e:web
@@ -191,16 +173,9 @@ on every push to it, and carries three E2E lanes:
| Playwright web | `playwright-e2e` | Linux |
| Desktop | `e2e-desktop`, via `e2e-reusable.yml` | Linux only |
-The desktop lane calls the reusable workflow with `run_linux: true`,
-`run_macos: false` and `run_windows: false`, so only the Linux harness
-executes. The job's "3 OS" title names the matrix the reusable workflow is
-able to run, not the one CI Full asks for.
+The desktop lane calls the reusable workflow with `run_linux: true`, `run_macos: false` and `run_windows: false`, so only the Linux harness runs. The job's "3 OS" title names the matrix the reusable workflow can run, not the one CI Full asks for.
-macOS and Windows desktop E2E therefore have no scheduled coverage on any
-branch. `.github/workflows/e2e.yml` is a manual dispatch whose `run_macos` and
-`run_windows` inputs default to `false` as well, so someone has to opt in
-explicitly to get cross-platform desktop signal before a promotion. Both stay
-off until #5485 lands a native driver for each platform.
+macOS and Windows desktop E2E therefore have no scheduled coverage on any branch. `.github/workflows/e2e.yml` is a manual dispatch whose `run_macos` and `run_windows` inputs also default to `false`. To get cross-platform desktop signal before a promotion, someone has to opt in. Both stay off until a native driver exists for each platform.
---
@@ -208,7 +183,7 @@ off until #5485 lands a native driver for each platform.
### Linux: "WebView not ready" timeout
-This usually means `tauri-driver` never reached its `/status` endpoint, or the app crashed before mounting its WebView. Use `app/scripts/e2e-run-session.sh`, which starts `tauri-driver` and waits on that endpoint before invoking WDIO, rather than driving the app by hand.
+This usually means `tauri-driver` never reached its `/status` endpoint, or the app crashed before mounting its webview. Use `app/scripts/e2e-run-session.sh`, which starts `tauri-driver` and waits on that endpoint before invoking WDIO, rather than driving the app by hand.
Ensure `DISPLAY` is set and Xvfb is running:
@@ -217,7 +192,7 @@ export DISPLAY=:99
Xvfb :99 -screen 0 1280x1024x24 &
```
-Also ensure dbus is started (required by webkit2gtk):
+Also make sure dbus is running (webkit2gtk needs it):
```bash
eval $(dbus-launch --sh-syntax)
@@ -225,7 +200,7 @@ eval $(dbus-launch --sh-syntax)
### Linux: `tauri-driver` or `WebKitWebDriver` not found
-Install `tauri-driver` with `cargo install tauri-driver`, and make sure `WebKitWebDriver` is on `PATH` (on Debian/Ubuntu it ships in `webkit2gtk-driver`) or point `WEBKIT_WEBDRIVER` at its location; `e2e-run-session.sh` defaults to `/usr/bin/WebKitWebDriver`.
+Install `tauri-driver` with `cargo install tauri-driver`, and make sure `WebKitWebDriver` is on `PATH` (on Debian and Ubuntu it ships in `webkit2gtk-driver`) or point `WEBKIT_WEBDRIVER` at its location. `e2e-run-session.sh` defaults to `/usr/bin/WebKitWebDriver`.
### macOS: Deep links not working in `tauri dev`
@@ -233,13 +208,11 @@ Deep links require a `.app` bundle. Use `pnpm tauri build --debug --bundles app`
### Docker: Build is slow on first run
-The first Docker build compiles Rust and installs the E2E harness dependencies. Subsequent runs use cached layers. Cargo registry and git sources are cached via Docker volumes.
+The first Docker build compiles Rust and installs the E2E harness dependencies. Subsequent runs use cached layers. Docker volumes cache the Cargo registry and git sources.
-## Spec: Notifications
+## Spec: notifications
-**File**: `app/test/e2e/specs/notifications.spec.ts`
-
-Tests notification RPC methods via the in-process core and the Notifications UI page:
+The spec `app/test/e2e/specs/notifications.spec.ts` tests notification RPC methods through the in-process core and the Notifications UI page:
- `notification_ingest`, creates a new notification via core RPC
- `notification_list`, verifies the ingested notification is returned
@@ -248,13 +221,13 @@ Tests notification RPC methods via the in-process core and the Notifications UI
- UI: Notifications page renders the integration notifications section (`[data-testid="integration-notifications-section"]`)
- UI: Notifications page shows the System Events section (`[data-testid="system-events-section"]`)
-**Run**:
+Run it with:
```bash
bash app/scripts/e2e-run-spec.sh test/e2e/specs/notifications.spec.ts notifications
```
-**Platform note**: both the RPC calls and the UI assertions in this spec run inside the same `tauri-driver` session, which supports `browser.execute()`.
+Both the RPC calls and the UI assertions in this spec run inside the same `tauri-driver` session, which supports `browser.execute()`.
---
@@ -279,13 +252,13 @@ For a canonical, inspectable run that drops screenshots, page-source dumps, and
bash app/scripts/e2e-agent-review.sh
```
-Artifacts land in `app/test/e2e/artifacts/<timestamp>-agent-review/`. Full details + helper API: [`agent-observability.md`](agent-observability.md). Any failing test triggers `wdio.conf.ts`'s `afterTest` hook, which writes `failure-*.png` + `failure-*.source.xml` into the same run dir.
+Artifacts land in `app/test/e2e/artifacts/<timestamp>-agent-review/`. Full details and the helper API: [`agent-observability.md`](agent-observability.md). Any failing test triggers `wdio.conf.ts`'s `afterTest` hook, which writes `failure-*.png` and `failure-*.source.xml` into the same run dir.
---
## Rust inference provider E2E
-These tests (`tests/inference_provider_e2e.rs`) use **wiremock** to mock HTTP upstreams and require no live LLM API calls. They cover OpenAI-compat chat, Anthropic auth style, per-model temperature suppression, Ollama local provider, and the `/v1` HTTP endpoint auth layer.
+These tests (`tests/inference_provider_e2e.rs`) use wiremock to mock HTTP upstreams and require no live LLM API calls. They cover OpenAI-compat chat, Anthropic auth style, per-model temperature suppression, Ollama local provider, and the `/v1` HTTP endpoint auth layer.
```bash
# Local:
@@ -302,4 +275,4 @@ docker compose -f e2e/docker-compose.yml run --rm inference-e2e
- [Testing strategy](testing-strategy.md): which layer a given test belongs in.
- [Agent observability](agent-observability.md): the artifact flow the review run writes to.
- [Tauri shell](architecture/tauri-shell.md): the Wry webview `tauri-driver` attaches to.
-- [Building and installing OpenHuman](getting-set-up.md): toolchain and submodules a local E2E build needs.
+- [Getting set up](getting-set-up.md): toolchain and submodules a local E2E build needs.
diff --git a/docs/gitbooks/en/developing/embedding.md b/docs/gitbooks/en/developing/embedding.md
index 7aea352430..c439fbd30c 100644
--- a/docs/gitbooks/en/developing/embedding.md
+++ b/docs/gitbooks/en/developing/embedding.md
@@ -1,17 +1,13 @@
---
description: >-
- Embedding the core in another Rust process: one Runtime, any number of
- independently configured Agents on it.
+ How to run the OpenHuman core inside your own Rust program: one Runtime,
+ with any number of separately configured Agents on it.
icon: code
---
# Embedding OpenHuman
-`openhuman-embed` is a typed Rust library for running the OpenHuman core
-in-process inside another product. It is the same core that ships in the
-desktop app and the CLI, minus the Tauri shell and the RPC server: business
-rules, agent turns, memory, tools and sandboxing, called directly from your
-own binary.
+`openhuman-embed` is a typed Rust library that runs the OpenHuman core inside your own product. It is the same core that ships in the desktop app and the CLI, without the Tauri shell and the RPC server. You call business rules, agent turns, memory, tools and sandboxing directly from your own binary.
## Adding the dependency
@@ -35,7 +31,7 @@ Every feature on this crate forwards to the same-named feature on
`flows`, `skills`, `mcp`, `crash-reporting`, `channels`,
`whatsapp-web`, `file-logging`, `scheduler-gate` (eighteen entries including
`default`). Two of them also gate
-items on this crate's own surface: `mcp` gates `HttpHeader`,
+items on this crate's own API: `mcp` gates `HttpHeader`,
`McpAuthConfig`, `McpServer`, `AgentSpec::mcp` and `HarnessBuilder::mcp`;
`skills` gates `AgentSpec::skills_dir` and `HarnessBuilder::skills_dir`.
@@ -51,10 +47,7 @@ if let Some(identity) = ProductIdentity::new("opencompany") {
## Two steps: a Runtime, then any number of Agents
-The library API has two levels. First, one `Runtime` for the process:
-features, background services, backend URL, the TinyHumans API key. Then
-any number of independently configured agents on it, each with its own
-provider, access tier, working directory, MCP servers and skills.
+The library API has two levels. First you build one `Runtime` for the process. It holds features, background services, the backend URL and the TinyHumans API key. Then you add any number of separately configured agents to it. Each agent has its own provider, access tier, working directory, MCP servers and skills.
```rust,no_run
use openhuman_embed::{Access, AgentSpec, McpServer, Provider, Runtime, Workspace};
@@ -96,19 +89,20 @@ println!("{}", again.reply);
# }
```
-An agent owns its provider and model, its access tier and turn origin, its
-`action_dir`, its MCP servers, its skills root
-(`<workspace>/agents/<id>/skills/`), its system prompt, its tool scope and
-sandbox mode, and a narrowed domain set or tool-group list. Every turn
-dispatches under that agent's own context, so config, domain gating,
-tool-group filtering and skill discovery all read that agent's settings and
-never another agent's. Transcripts are keyed by agent id, and a turn resumes
-only its own thread.
+An agent owns:
-The runtime owns the workspace and credential store, the event bus, the
-keyring, background services, the registered domain set (agents can only
-narrow it, so enable `mcp` or `skills` at runtime build time if any agent
-needs them), and the API key.
+- its provider and model
+- its access tier and turn origin
+- its `action_dir`
+- its MCP servers
+- its skills root (`<workspace>/agents/<id>/skills/`)
+- its system prompt
+- its tool scope and sandbox mode
+- a narrowed domain set or tool-group list
+
+Every turn runs under that agent's own context. Config, domain gating, tool-group filtering and skill discovery all read that agent's settings and never another agent's. Transcripts are keyed by agent id, and a turn resumes only its own thread.
+
+The runtime owns the workspace and credential store, the event bus, the keyring, background services, the registered domain set and the API key. Agents can only narrow the domain set, so enable `mcp` or `skills` at runtime build time if any agent needs them.
Layout under a runtime-owned root:
@@ -128,7 +122,7 @@ desktop's own narrower set. Chain builder methods to override:
- `.system_prompt(text)` and `.definition(spec)` for the prompt, tool scope,
disallowed tools, sandbox mode, iteration cap, temperature, display name
and delegation blurb (`AgentDefinitionSpec`).
-- `.provider(Provider)` / `.model(id)` for which model answers and where.
+- `.provider(Provider)` and `.model(id)` for which model answers and where.
- `.access(Access)` for what the agent may do.
- `.tool_groups(ToolGroups)` and `.domains(DomainSet)` to narrow further,
never wider than the runtime's own set.
@@ -136,14 +130,14 @@ desktop's own narrower set. Chain builder methods to override:
- `.skills_dir(path)` to copy skill bundles into this agent's own root.
- `.include_user_skills(bool)` to also let the agent see the operator's
`~/.openhuman/skills` (off by default).
-- `.action_dir(path)` for the agent's read/write root.
+- `.action_dir(path)` for the agent's read and write root.
- `.trust(path, access)` to grant a directory outside `action_dir`.
- `.tools(factory)` to hand the agent real in-process tools built fresh per
turn, rather than routing host callbacks through an MCP server.
- `.config(f)` as an escape hatch for config fields the spec does not model.
Agent ids must match `^[a-z0-9][a-z0-9_-]{0,63}$`; avoid the built-in ids
-(`orchestrator`, `summarizer`, ...), which the runtime-wide delegation
+(`orchestrator`, `summarizer` and so on), which the runtime-wide delegation
catalog resolves to the shipped definitions.
## Access tiers
@@ -156,12 +150,12 @@ silently refuse, which reads as a weak model rather than a missing scope.
- `Access::readonly()`: observe only, no writes, no shell, no network side
effects. Safe default for an untrusted prompt.
- `Access::supervised()`: act, but park risky operations for a human
- decision. Unlike the desktop default, this **turns the autonomy policy on**
+ decision. Unlike the desktop default, this turns the autonomy policy on
for that agent (`Access` sets the policy flag as well as the tier), so the
approval gate really is live and an unattended harness stalls here until an
approval answers or the ten-minute TTL denies it. The user-facing default is
the opposite: `[autonomy] enabled = false`, where the gate is inert. See
- [Approval Gate](../features/approval-gate.md).
+ [Approval gate](../features/approval-gate.md).
- `Access::full()`: act autonomously, no approval pauses. Grants real shell
and file access under `action_dir`; point it at a directory you are
willing to have changed. Hard blocks still apply regardless of tier:
@@ -180,8 +174,8 @@ already configured with: the account's managed backend, a local Ollama or
LM Studio, or a configured BYOK provider. `Provider::openai_compatible(url,
key)` points a turn at a specific OpenAI-compatible endpoint and bearer;
`/chat/completions` is appended to `url`, so pass the API root. `.model(id)`
-pins the model id on either; it is advisory, since a model no configured
-provider serves falls back rather than erroring.
+pins the model id on either; it is advisory, because a model that no configured
+provider serves falls back instead of failing.
An agent that names its own `Provider` never touches the runtime's API key.
One that names none inherits the runtime's default: managed inference on
@@ -227,13 +221,8 @@ include them.
`McpServer::stdio(name, command, args)` launches a local subprocess
speaking newline-delimited JSON-RPC; `McpServer::http(name, endpoint)`
-reaches a remote server over Streamable HTTP. Both support `.env(...)` or
-`.auth(McpAuthConfig)`, `.allow_tools([...])` / `.deny_tools([...])` to
-narrow which remote tools an agent sees (worth setting for a large server,
-since every exposed tool costs prompt budget), `.timeout_secs(n)` and
-`.description(text)`. Servers declared through `AgentSpec::mcp` are private
-to that agent; other agents on the same runtime do not see them. Servers are
-fixed at build time: there is no way to add one to a running harness.
+reaches a remote server over Streamable HTTP. Both support `.env(...)` or `.auth(McpAuthConfig)`. `.allow_tools([...])` and `.deny_tools([...])` narrow which remote tools an agent sees, which is worth doing for a large server because every exposed tool costs prompt budget. `.timeout_secs(n)` and `.description(text)` are also available. Servers declared through `AgentSpec::mcp` are private
+to that agent; other agents on the same runtime do not see them. Servers are fixed at build time. You cannot add one to a running harness.
## Skills
@@ -242,7 +231,7 @@ fixed at build time: there is no way to add one to a running harness.
copied rather than symlinked because skill discovery rejects symlinked
bundles. `.include_user_skills(true)` additionally lets the agent discover
skills the operator installed under `~/.openhuman/skills`; the default
-hides them, since an embedded agent should see what its host installed, not
+hides them, because an embedded agent should see what its host installed, not
what the machine's user did.
## Multi-turn sessions and progress streaming
@@ -276,11 +265,7 @@ println!("{}", outcome.reply);
# Ok(()) }
```
-`.seed(history)` replaces a session's history for one turn with the caller's
-own rows (`(role, content)` pairs) rather than reading the transcript; only
-a runtime-owned `Agent` can honour it, since it silently discards whatever
-that session held, and it is meant to be paired with a session id the turn
-is not sharing with turns that expect their history intact. `.meter(f)`
+`.seed(history)` replaces a session's history for one turn with your own `(role, content)` rows instead of reading the transcript. Only a runtime-owned `Agent` can honor it. It silently discards whatever the session held, so pair it with a session id that no other turn shares. `.meter(f)`
reports what a turn spent, including a turn that ran and then failed.
## Harness: the one-agent shorthand
@@ -359,13 +344,13 @@ agent that names its own `Provider` never touches the key at all.
## One runtime per process
The keyring master key, the RPC bearer, the global event bus and the
-process's domain subscribers are process-scoped, so a second runtime would
+process's domain subscribers are process-scoped. A second runtime would
silently share them while believing it had a separate workspace.
-`RuntimeBuilder::build` returns `RuntimeError::AlreadyRunning` instead;
-agents, not runtimes, are the unit of multiplicity within one process.
+`RuntimeBuilder::build` returns `RuntimeError::AlreadyRunning` instead.
+Within one process, add agents, not runtimes.
-Build the tokio runtime yourself rather than using `#[tokio::main]`. A turn
-is a large async state machine, and a sub-agent nesting inside it overflows
+Build the tokio runtime yourself instead of using `#[tokio::main]`. A turn
+is a large async state machine, and a nested sub-agent overflows
tokio's default 2 MiB worker stack:
```rust,no_run
@@ -381,7 +366,7 @@ let runtime = tokio::runtime::Builder::new_multi_thread()
## A narrow build, measured
-`docs/library-minimal-recipe.md` measures a headless recipe aimed at
+[`docs/library-minimal-recipe.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/library-minimal-recipe.md) measures a headless recipe aimed at
100 to 1,000 live agents on a 2 GB RAM / 2 vCPU box:
```bash
diff --git a/docs/gitbooks/en/developing/engines.md b/docs/gitbooks/en/developing/engines.md
index d6129d79ed..2319800191 100644
--- a/docs/gitbooks/en/developing/engines.md
+++ b/docs/gitbooks/en/developing/engines.md
@@ -1,133 +1,82 @@
---
description: >-
- The four swappable engine families (models, embeddings, memory, search) and
- how each one is selected by config rather than code.
+ The four swappable engines (models, embeddings, memory, search) and the
+ config key that selects each one.
icon: gears
---
# Pluggable engines
-OpenHuman routes four kinds of work, chat and reasoning, embeddings, memory,
-and web search, through a config key rather than a hardcoded client. Each has
-a managed default that needs no key, plus a bring-your-own-key or local path.
-This page is the map of what's supported and the exact key or environment
-variable that selects it; the linked pages under Features cover setup and
-tradeoffs.
+OpenHuman sends four kinds of work through a config key instead of a hardcoded client: chat and reasoning, embeddings, memory and web search. Each has a managed default that needs no key, plus a bring-your-own-key or local option. This page lists what is supported and the key that selects it. The linked Features pages cover setup and tradeoffs.
## LLM providers
-Chat, reasoning, vision, and coding workloads route through per-workload
-provider fields (`chat_provider`, `reasoning_provider`, `agentic_provider`,
-`coding_provider`, `vision_provider`, and more), each a string of the form
-`<slug>:<model>`. Leaving a field unset, blank, or set to `cloud` keeps it on
-the managed default.
+Chat, reasoning, vision and coding work each have their own provider field (`chat_provider`, `reasoning_provider`, `agentic_provider`, `coding_provider`, `vision_provider` and more). Each is a string of the form `<slug>:<model>`. A field that is unset, blank or set to `cloud` stays on the managed default.
Supported routes:
-- **Managed (TinyHumans)**: the default. Access to the OpenRouter model
- catalogue with no key to manage.
-- **Local**: a runtime the user installs and runs (Ollama, LM Studio, MLX,
- OMLX), addressed as `ollama:<model>`, `lmstudio:<model>`, `mlx:<model>` or
- `omlx:<model>`, with the endpoint in `[local_ai] base_url`. OpenHuman does
- not install the runtime or download models; the user pulls them.
-- **A local OpenAI-compatible endpoint**: any server that speaks the OpenAI
- chat API, as `local-openai:<model>` or registered with its own slug and
- endpoint.
-- **Claude Code / Claude Agent SDK**: a provider slug that shells out to an
- installed Claude Code CLI instead of calling a hosted API.
-- **26 BYOK slugs**, each shipped with a preset endpoint so only a key is
- needed: `openai`, `anthropic`, `google`, `openrouter`, `orcarouter`, `groq`,
+- Managed (TinyHumans): the default. It gives you the OpenRouter model catalogue with no key to manage.
+- Local: a runtime you install and run (Ollama, LM Studio, MLX, OMLX). Address it as `ollama:<model>`, `lmstudio:<model>`, `mlx:<model>` or `omlx:<model>`, and set the endpoint in `[local_ai] base_url`. OpenHuman does not install the runtime or download models. You pull them yourself.
+- A local OpenAI-compatible endpoint: any server that speaks the OpenAI chat API. Use `local-openai:<model>`, or register it with its own slug and endpoint.
+- Claude Code / Claude Agent SDK: a provider slug that runs your installed Claude Code CLI instead of calling a hosted API.
+- 26 bring-your-own-key slugs, each with a preset endpoint so you only need a key: `openai`, `anthropic`, `google`, `openrouter`, `orcarouter`, `groq`,
`mistral`, `deepseek`, `together`, `fireworks`, `cerebras`, `xai`,
`moonshot`, `gmi`, `huggingface`, `nvidia`, `zai`, `minimax`, `stepfun`,
`kilocode`, `deepinfra`, `novita`, `venice`, `vercel-ai-gateway`, `sumopod`,
`modelscope`.
Provider definitions live under `crates/openhuman-core/src/inference/provider/`
-(`factory.rs` resolves a `<slug>:<model>` string to a client; `types.rs` holds
-the provider shapes). Full setup and the local-model capability table are
-in [Local models & bring your own
-key](../features/model-routing/local-and-byok-models.md); routing behavior
-and fallback order are in [Automatic Model
-Routing](../features/model-routing/README.md).
+(`factory.rs` turns a `<slug>:<model>` string into a client, and `types.rs` holds the provider shapes). Setup and the local-model capability table are in [Local models and bring your own key](../features/model-routing/local-and-byok-models.md). Routing and fallback order are in [Automatic model routing](../features/model-routing/README.md).
## Embeddings
-Embeddings route through a separate provider selection
-(`embeddings.update_settings` over RPC, or `embeddings_provider` for
-per-workload override), independent of the chat provider:
+Embeddings have their own provider setting, separate from the chat provider. Set it with `embeddings.update_settings` over RPC, or override it per workload with `embeddings_provider`.
-- **Managed** (default): the OpenHuman backend's Voyage-backed embedding
- endpoint. Works on a fresh install with no local daemon.
-- **Voyage**: direct Voyage AI API with your own key.
-- **OpenAI**: cloud embeddings via the OpenAI API.
-- **Cohere**: the Cohere embed API with your own key.
-- **Ollama**: a local model the user has pulled, `bge-m3` recommended
- (`ollama pull bge-m3`). Memory v2 does not use these; the memory engine
- embeds on its own side.
-- **Custom**: any OpenAI-compatible embeddings endpoint.
+- Managed (default): the OpenHuman backend's Voyage-backed embedding endpoint. It works on a fresh install with no local daemon.
+- Voyage: the Voyage AI API with your own key.
+- OpenAI: cloud embeddings through the OpenAI API.
+- Cohere: the Cohere embed API with your own key.
+- Ollama: a local model you have pulled. `bge-m3` is recommended (`ollama pull bge-m3`). The memory engine does not use these, because it embeds on its own side.
+- Custom: any OpenAI-compatible embeddings endpoint.
-Implementation: `crates/openhuman-core/src/inference/embedding_host/` (`mod.rs`
-lists the providers; `factory.rs` builds the client; `schemas.rs` defines the
-`embeddings.*` RPC surface, including `set_api_key` per provider slug).
+The code is in `crates/openhuman-core/src/inference/embedding_host/`. `mod.rs` lists the providers, `factory.rs` builds the client, and `schemas.rs` defines the `embeddings.*` RPC surface, including `set_api_key` per provider slug.
## Memory
-Memory v2 (`docs/specs/memory-v2.md`) is Recall, Fetch and Store over a
-pluggable engine. The contract is `tinymemory-api` (vendored at
-`vendor/tinymemory/`): a `MemoryEngine` trait with `recall`, `fetch`, `store`,
-`forget`, `list` and `health`, plus an `EngineDescriptor` that declares whether
-the engine is hosted, needs an endpoint or key, and which fetch modes it
-supports. `tinymemory::list_engines` and `build_engine` are the registry.
+Memory is Recall, Fetch and Store over a pluggable engine. The contract is `tinymemory-api`, vendored at `vendor/tinymemory/`. It defines a `MemoryEngine` trait with `recall`, `fetch`, `store`, `forget`, `list` and `health`. An `EngineDescriptor` says whether the engine is hosted, whether it needs an endpoint or key, and which fetch modes it supports. `tinymemory::list_engines` and `build_engine` are the registry.
-Two engines ship, both served by `tinymemory-integrations` (the three TinyMemory crates are `tinymemory-api`, `tinymemory-tools` and `tinymemory-integrations`):
+Two engines ship, both served by `tinymemory-integrations`:
| id | what | endpoint | key |
| --- | --- | --- | --- |
| `tinyhumans` | CortexDB hosted behind the TinyHumans backend (`/memory/*`) | the backend origin | the signed-in session or API key, resolved per request through the host credential seam |
| `cortexdb` | the user's own CortexDB (direct `/v1/*`) | `[memory.engines.cortexdb] endpoint` (default `https://api-v1.cortexdb.ai`) | stored in the OS keychain as `memory-cortexdb` |
-Select one with `[memory] engine` or from Connections > Memory > Engine
-(`openhuman.memory_engine_set`). `memory::engine::resolve` binds it: signed out
-with no CortexDB key means **memory is off** (the `memory` tool is not
-registered, ingestion is a no-op and RPCs answer `MEMORY_OFF`). Built engines
-are cached by a fingerprint of engine id, endpoint and credential identity, so
-changing any of them rebuilds the engine on the next call. There is no engine
-migration: switching engines starts empty, and the one-time import of a v1
-store uploads to whichever engine is selected, after explicit consent.
+Select one with `[memory] engine` or from Connections > Memory > Engine (`openhuman.memory_engine_set`). `memory::engine::resolve` binds it. If you are signed out and have no CortexDB key, memory is off: the `memory` tool is not registered, ingestion does nothing and RPCs answer `MEMORY_OFF`.
-Both engines declare `fetch_modes = [hybrid]` because the CortexDB recall wire
-has no keyword/vector switch; asking for another mode fails with `UNSUPPORTED`.
+Built engines are cached by a fingerprint of engine id, endpoint and credential identity. Changing any of them rebuilds the engine on the next call. Engines do not migrate, so switching starts empty. The one-time import of an older store uploads to whichever engine is selected, after you consent.
+
+Both engines declare `fetch_modes = [hybrid]`, because the CortexDB recall wire has no keyword or vector switch. Asking for another mode fails with `UNSUPPORTED`.
Related pages: [Memory](../features/memory.md) and
[Memory architecture](architecture/memory.md).
## Web search
-`[search] engine` selects the active provider; only one is active at a time,
-mirroring the LLM provider model:
+`[search] engine` selects the active provider. Only one is active at a time:
-- `managed` (default): backend-proxied, no key needed.
-- `parallel`: search, extract, chat, research, enrich, and dataset tools
- against the Parallel API.
+- `managed` (default): proxied through the backend, no key needed.
+- `parallel`: search, extract, chat, research, enrich and dataset tools on the Parallel API.
- `brave`: Brave Search (web, news, images, videos).
- `querit`: Querit web search.
-- `exa`: Exa neural search (search, find-similar, contents). Direct to
- `api.exa.ai`, never through the managed backend.
-- `tavily`: Tavily search and extract (web, news, finance). Direct to
- `api.tavily.com`.
+- `exa`: Exa neural search (search, find-similar, contents). It calls `api.exa.ai` directly, never through the managed backend.
+- `tavily`: Tavily search and extract (web, news, finance). It calls `api.tavily.com` directly.
- `disabled`: no search tools registered.
-A BYOK engine selected without a stored key falls back to `managed` rather
-than leaving the agent with no search tool at all.
+If you pick a bring-your-own-key engine without a stored key, search falls back to `managed` so the agent is never left without a search tool.
+
+SearXNG is a separate toggle (`[searxng] enabled`, `base_url`), not a `search.engine` value, because it points at a self-hosted instance instead of a vendor API.
-SearXNG is a separate toggle (`[searxng] enabled`, `base_url`) rather than a
-`search.engine` value, since it points at a self-hosted instance instead of a
-vendor API. The providers themselves live in the `tinysearch` module
-(`vendor/tinysearch`), which owns the per-provider transports and the role
-dispatch; the host keeps provider resolution and credential policy in
-`crates/openhuman-core/src/search/` and
-`crates/openhuman-core/src/config/schema/tools/search.rs`, and the host's
-provider list is taken from the contract rather than maintained separately.
+The providers live in the `tinysearch` module (`vendor/tinysearch`), which owns the per-provider transports and role dispatch. The host keeps provider resolution and credential policy in `crates/openhuman-core/src/search/` and `crates/openhuman-core/src/config/schema/tools/search.rs`. Its provider list comes from the module contract.
-See [Web Search](../features/native-tools/web-search.md) for the tool surface
-each engine exposes.
+See [Web search](../features/native-tools/web-search.md) for the tools each engine exposes.
diff --git a/docs/gitbooks/en/developing/getting-set-up.md b/docs/gitbooks/en/developing/getting-set-up.md
index 5500e3d7c6..339a9054a6 100644
--- a/docs/gitbooks/en/developing/getting-set-up.md
+++ b/docs/gitbooks/en/developing/getting-set-up.md
@@ -1,29 +1,25 @@
---
description: >-
- Building OpenHuman from source: the pinned toolchain, the vendored submodules,
- the Tauri CLI wrapper, and local desktop builds, plus the release installers
- for each platform.
+ Build OpenHuman from source, or install a release: toolchain, submodules,
+ desktop builds and the installers for each platform.
icon: wrench
---
-# Getting Set Up
+# Getting set up
-This guide covers the full desktop/source install path plus the release installers, so pick whichever path matches what you're doing:
+There are two ways to get OpenHuman running: build it from source, or install the latest release. This page covers both.
-1. Build OpenHuman from source
-2. Install the latest stable release binaries
-
-If you only need the Rust workspace under `crates/` on a fresh machine (no Node, no Tauri), use [Building the Rust Core](building-rust-core.md) instead. That page has the pinned Rust toolchain, OS package prerequisites, and the exact `cargo` commands for `openhuman-core`.
+If you only need the Rust workspace under `crates/` (no Node, no Tauri), use [Building the Rust core](building-rust-core.md). It has the pinned toolchain, OS packages and the `cargo` commands for `openhuman-core`.
## Prerequisites
-* `git`
-* Node.js 24 or newer (see `app/package.json`)
-* `[email protected]` (see the root `package.json` `packageManager` field)
-* Rust 1.96.1 through `rustup` with `rustfmt` and `clippy` (see `rust-toolchain.toml`)
-* CMake, required by native Rust dependencies
-* Every `vendor/` submodule listed in `.gitmodules`, initialized recursively (`git submodule update --init --recursive`). The root `Cargo.toml` `[patch]` tables point into that tree, so cargo reads each manifest whether the crate is optional or not; a subset is always a build break
-* Platform desktop build tools: Xcode Command Line Tools on macOS, or the Tauri GTK/WebKit/AppIndicator package set on Linux
+- `git`
+- Node.js 24 or newer (see `app/package.json`)
+- `[email protected]` (see the root `package.json` `packageManager` field)
+- Rust 1.96.1 through `rustup` with `rustfmt` and `clippy` (see `rust-toolchain.toml`)
+- CMake, required by native Rust dependencies
+- Every `vendor/` submodule listed in `.gitmodules`, initialized recursively (`git submodule update --init --recursive`). The root `Cargo.toml` `[patch]` tables point into that tree, so cargo reads every manifest, optional crate or not. A partial checkout always fails to build
+- Platform desktop build tools: Xcode Command Line Tools on macOS, or the Tauri GTK/WebKit/AppIndicator package set on Linux
macOS Homebrew quick start:
@@ -46,7 +42,7 @@ rustup toolchain install 1.96.1 --profile minimal
rustup component add rustfmt clippy --toolchain 1.96.1
```
-## Build from source (local compile)
+## Build from source
Run from the repository root:
@@ -55,17 +51,17 @@ Run from the repository root:
git clone https://github.com/tinyhumansai/openhuman.git
cd openhuman
-# 2) Fetch the vendored tiny* crate submodules
+# 2) Fetch the vendored tiny* submodules
git submodule update --init --recursive
-# 3) Install JS deps (workspace)
+# 3) Install JS dependencies
pnpm install
-# 4) Build desktop app artifacts
+# 4) Build the desktop app
pnpm build
```
-For local development instead of production build:
+For development instead of a production build:
```bash
# Web-only UI development
@@ -78,47 +74,38 @@ pnpm dev:app
pnpm tauri build
```
-## Install latest stable release (macOS/Linux x64)
+## Install the latest release on macOS and Linux
-Primary install command:
+Run the install script:
```bash
curl -fsSL https://raw.githubusercontent.com/tinyhumansai/openhuman/main/scripts/install.sh | bash
```
-Installer behavior:
-
-* Resolves latest stable OpenHuman release for your platform
-* Validates artifact digest when available
-* Installs locally (no sudo by default)
-* macOS: installs `OpenHuman.app` into `~/Applications`
-* Linux x64: installs AppImage as `~/.local/bin/openhuman` and writes a desktop entry
+The script:
-### Arch Linux package recipe
+- Finds the latest stable release for your platform.
+- Checks the download against its SHA-256 digest.
+- Installs without sudo.
+- On macOS, installs `OpenHuman.app` into `~/Applications`.
+- On Linux x64, installs the AppImage as `~/.local/bin/openhuman` and writes a desktop entry.
-The repository includes an `openhuman-bin` AUR recipe at [`packages/arch/openhuman-bin`](../../../../../../packages/arch/openhuman-bin/). It uses the official x86\_64 AppImage as the binary source, extracts the bundled application tree during `makepkg`, installs a desktop entry, and exposes `/usr/bin/openhuman`.
-
-Until the package is published on AUR, build it locally on Arch:
+To preview what it would do without writing files, add `--dry-run`:
```bash
-cd packages/arch/openhuman-bin
-makepkg --syncdeps --install
+curl -fsSL https://raw.githubusercontent.com/tinyhumansai/openhuman/main/scripts/install.sh | bash -s -- --dry-run
```
-After publication, Arch users can install it with:
-
-```bash
-yay -S openhuman-bin
-```
+### Arch Linux
-Useful flags:
+There is no published AUR package. The repository includes an `openhuman-bin` recipe at [`packages/arch/openhuman-bin`](https://github.com/tinyhumansai/openhuman/tree/main/packages/arch/openhuman-bin). It uses the official x86_64 AppImage, extracts it during `makepkg`, installs a desktop entry and exposes `/usr/bin/openhuman`. Build it locally:
```bash
-# Preview actions without writing files
-curl -fsSL https://raw.githubusercontent.com/tinyhumansai/openhuman/main/scripts/install.sh | bash -s -- --dry-run
+cd packages/arch/openhuman-bin
+makepkg --syncdeps --install
```
-## Windows (latest stable)
+## Windows
Use PowerShell:
@@ -126,56 +113,51 @@ Use PowerShell:
irm https://raw.githubusercontent.com/tinyhumansai/openhuman/main/scripts/install.ps1 | iex
```
-Windows installer behavior:
+The script:
-* Resolves latest stable release
-* Downloads MSI/EXE for x64
-* Verifies digest when available
-* Runs per-user install where supported by installer package
+- Finds the latest stable release.
+- Downloads the x64 MSI or EXE.
+- Checks its SHA-256 digest.
+- Runs a per-user install where the installer supports it.
## ARM Linux build (aarch64)
-CI builds the `aarch64-unknown-linux-gnu` target on an `ubuntu-24.04-arm` runner with the same Tauri command as x64 (see [`.github/workflows/build-desktop.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/build-desktop.yml)). Locally, with the Linux desktop package set installed:
+CI builds the `aarch64-unknown-linux-gnu` target on an `ubuntu-24.04-arm` runner with the same Tauri command as x64 (see
+[`.github/workflows/build-desktop.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/build-desktop.yml)).
+Locally, with the Linux desktop package set installed:
```bash
pnpm tauri build --target aarch64-unknown-linux-gnu --bundles deb appimage
```
-The shell is stock Tauri on Wry, so the resulting binary needs no extra library path. Install the `.deb` bundle with `dpkg -i`.
+The shell is stock Tauri on Wry, so the binary needs no extra library path. Install the `.deb` bundle with `dpkg -i`.
-Manual download links (all platforms):
-
-* Website: https://tinyhumans.ai/openhuman
-* Latest release: https://github.com/tinyhumansai/openhuman/releases/latest
+You can also download any platform's installer from [tinyhumans.ai/openhuman](https://tinyhumans.ai/openhuman) or the [latest release](https://github.com/tinyhumansai/openhuman/releases/latest).
## Troubleshooting
-### Stale `openhuman` RPC process on the core port
-
-**Symptom**
+### Stale `openhuman` process on the core port
-A previous Tauri build or `openhuman-core run` harness left a process listening on `OPENHUMAN_CORE_PORT` (default `7788`). Until issue #1130 the new Tauri build would silently attach to that listener, leading to version drift and 401s when the new build's `OPENHUMAN_CORE_TOKEN` didn't match.
-
-**Current behavior (issue #1130)**
+A previous Tauri build or `openhuman-core run` can leave a process listening on `OPENHUMAN_CORE_PORT` (default `7788`). If a new build attached to it, you would see version drift and 401s, because the new build's `OPENHUMAN_CORE_TOKEN` would not match.
`core_process::ensure_running` now probes the port at startup:
-* If `GET /` identifies the listener as an OpenHuman core (JSON body with `"name": "openhuman"`), it is treated as a stale process from a previous run and proactively terminated (`SIGTERM`, then `SIGKILL` after 750ms on Unix; `taskkill /F /T /PID` on Windows). The Tauri host then spawns its own fresh embedded core.
-* If the listener is something else (or doesn't speak HTTP), startup fails loudly with the conflict surfaced in the log instead of silently attaching.
-* Set `OPENHUMAN_CORE_REUSE_EXISTING=1` to opt back into the legacy attach-to-anything behavior, useful when running `openhuman-core run` as a manual debugging harness.
+- If `GET /` identifies the listener as an OpenHuman core (a JSON body with `"name": "openhuman"`), it is treated as a stale process and stopped. On Unix it gets `SIGTERM`, then `SIGKILL` after 750 ms. On Windows it uses `taskkill /F /T /PID`. The Tauri host then starts its own embedded core.
+- If the listener is something else, or does not speak HTTP, startup fails and the log shows the conflict.
+- Set `OPENHUMAN_CORE_REUSE_EXISTING=1` to attach to whatever is listening instead. This is useful when you run `openhuman-core run` by hand for debugging.
-**Manual cleanup (still works)**
+To clean up manually:
```bash
pkill -f "OpenHuman.app/Contents"
pkill -f "openhuman-core"
```
-***
+---
## See also
-* [Building the Rust Core](building-rust-core.md): the cargo-only path, without Node or Tauri.
-* [E2E Testing Guide](e2e-testing.md): the harness a local desktop build feeds.
-* [Architecture](architecture/architecture.md): what the shell, the core and the frontend each own.
-* [Cloud deployment](../features/cloud-deploy.md): running the same core headless on a server.
+- [Building the Rust core](building-rust-core.md): the cargo-only path, without Node or Tauri.
+- [E2E testing guide](e2e-testing.md): the harness a local desktop build feeds.
+- [Architecture](architecture.md): what the shell, the core and the frontend each own.
+- [Cloud deployment](../features/cloud-deploy.md): running the same core headless on a server.
diff --git a/docs/gitbooks/en/developing/hooks.md b/docs/gitbooks/en/developing/hooks.md
index d1ca9a1947..5442df6331 100644
--- a/docs/gitbooks/en/developing/hooks.md
+++ b/docs/gitbooks/en/developing/hooks.md
@@ -7,21 +7,11 @@ icon: link
# Hooks
-A hook is a script you own that OpenHuman runs at a specific moment (before a
-tool executes, after a file is edited, when a turn finishes) and whose answer
-the agent obeys. It is how you make the agent follow a rule that lives in your
-repository rather than in our code: block `rm -rf`, run the formatter after every
-edit, write an audit line per tool call, refuse to read `.env`.
-
-The contract is deliberately the same as
-[Cursor's](https://cursor.com/docs/hooks): same file name, same event names,
-same stdin envelope, same stdout decision, same exit codes. A hook script written
-for either host runs on the other unchanged.
-
-> There is a second, unrelated meaning of "hook" in this codebase: the in-process
-> Rust traits in `crates/openhuman-core/src/agent/hooks.rs` that an *embedding host* installs
-> by compiling against the core. Those are for building a product on top of
-> OpenHuman. This page is about the file-based kind, for using OpenHuman.
+A hook is a script you own. OpenHuman runs it at a set moment, such as before a tool runs, after a file is edited or when a turn finishes, and the agent obeys its answer. Hooks let you enforce rules that live in your repository instead of in our code. You can block `rm -rf`, run the formatter after every edit, write an audit line per tool call, or refuse to read `.env`.
+
+The contract matches [Cursor's](https://cursor.com/docs/hooks): the same file name, event names, stdin envelope, stdout decision and exit codes. A hook script written for either host runs on the other unchanged.
+
+> "Hook" has a second, unrelated meaning in this codebase: the in-process Rust traits in `crates/openhuman-core/src/agent/hooks.rs`. An embedding host installs those by compiling against the core. This page is about the file-based kind.
## The file
@@ -46,8 +36,7 @@ for either host runs on the other unchanged.
}
```
-Four locations are read, and **they concatenate: a more specific file cannot
-remove a broader one's rules**:
+OpenHuman reads four locations and concatenates them. A more specific file cannot remove a broader file's rules.
| Layer | Path |
| ----- | ---- |
@@ -56,53 +45,45 @@ remove a broader one's rules**:
| Workspace | `<workspace_dir>/hooks.json` |
| Project | `<action_dir>/.openhuman/hooks.json` |
-Concatenation is safe because the **strictest verdict wins**: across every hook
-that ran, deny beats ask beats allow. Adding a hook can never loosen a policy
-another one set, which is what lets a repository ship its own `hooks.json` onto
-a machine an operator has already locked down.
+Concatenation is safe because the strictest verdict wins. Across every hook that ran, deny beats ask, and ask beats allow. Adding a hook never loosens a policy that another hook set. A repository can therefore ship its own `hooks.json` onto a machine an operator has already locked down.
### Fields
| Field | Meaning |
| ----- | ------- |
-| `command` | Program to run (or the prompt text, for `"type": "prompt"`). Runs with its own `hooks.json` directory as cwd. |
+| `command` | Program to run, or the prompt text for `"type": "prompt"`. It runs with the directory of its `hooks.json` as the working directory. |
| `type` | `command` (default) or `prompt`. |
-| `matcher` | Which occurrences reach this hook, see below. Absent means all. |
+| `matcher` | Which occurrences reach this hook. See Matchers below. Absent means all. |
| `timeout` | Seconds. Falls back to `[hooks] default_timeout_secs` (30). |
-| `failClosed` | Treat a crashed, missing, or timed-out hook as a denial. Default `false`. |
+| `failClosed` | Treat a crashed, missing or timed-out hook as a denial. Default `false`. |
| `loop_limit` | Follow-ups this hook may inject per session. Default 5; `0` means unlimited. |
| `model` | Model override for a `prompt` hook. |
| `enabled` | Set `false` to park a hook without deleting it. |
## The protocol
-The event arrives on **stdin** as one JSON object. The decision goes to
-**stdout**. The exit code decides how stdout is read:
+The event arrives on stdin as one JSON object. The decision goes to stdout. The exit code decides how stdout is read:
| Exit | Meaning |
| ---- | ------- |
| `0` | stdout is the decision. Empty stdout is a no-op. |
| `2` | Deny, whatever stdout said. stderr becomes the reason the agent is told. |
-| anything else | Failure. **Fails open** (the action proceeds) unless `failClosed`. |
+| anything else | Failure. It fails open (the action proceeds) unless `failClosed` is set. |
-A timeout, a missing interpreter, and unparseable stdout all take that same
-failure path. That symmetry is the point: a hook that denies only when it
-manages to run is not a security control, so `failClosed` covers every way a
-script can fail to answer.
+A timeout, a missing interpreter and unparseable stdout all take the same failure path. A hook that denies only when it manages to run is not a security control, so `failClosed` covers every way a script can fail to answer.
-stdout is parsed leniently: the last standalone JSON object wins, so a script
-that logs progress before answering works as written.
+stdout is parsed leniently. The last standalone JSON object wins, so a script that logs progress before answering works as written.
### Decision object
-Every field is optional, and each event honours the subset it defines:
+Every field is optional. Each event honors the subset it defines:
```json
{
"permission": "allow" | "deny" | "ask",
"user_message": "shown to the human",
"agent_message": "shown to the model",
- "updated_input": { "…": "replacement tool arguments" },
+ "updated_input": { "...": "replacement tool arguments" },
"additional_context": "appended to the tool result",
"continue": false,
"followup_message": "sent as another user turn",
@@ -110,22 +91,18 @@ Every field is optional, and each event honours the subset it defines:
}
```
-`ask` escalates to the approval gate where one is available; inside the tool
-middleware, which has no approval channel, it denies rather than quietly
-allowing.
+`ask` goes to the approval gate where one exists. Inside the tool middleware, which has no approval channel, it denies instead of quietly allowing.
## Events
-`hook_event_name` in the envelope tells a script which moment it is in. Names are
-matched loosely: `preToolUse`, `PreToolUse` and `pre_tool_use` are the same
-event, and Claude Code's `UserPromptSubmit` aliases onto `beforeSubmitPrompt`.
+`hook_event_name` in the envelope tells a script which moment it is in. Names match loosely: `preToolUse`, `PreToolUse` and `pre_tool_use` are the same event, and Claude Code's `UserPromptSubmit` maps to `beforeSubmitPrompt`.
-| Event | Fires | Honours |
+| Event | Fires | Honors |
| ----- | ----- | ------- |
| `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` / `node_exec` / ... | `permission`, `agent_message` |
| `afterShellExecution` | after one completed | - |
| `beforeReadFile` | before `file_read` / `read_diff` | `permission` |
| `afterFileEdit` | after `file_write` / `edit` / `apply_patch` | - |
@@ -136,30 +113,15 @@ event, and Claude Code's `UserPromptSubmit` aliases onto `beforeSubmitPrompt`.
| `stop` | after a turn | `followup_message` |
| `afterAgentResponse` | on the assistant's message | - |
-`sessionStart`, `sessionEnd`, `preCompact`, `afterAgentThought` and `subagentStop`
-are defined: they parse, match, execute, and can be exercised with `hooks test`,
-but the core does not fire them yet. (`subagentStop` is the near miss: the handler
-`hooks::ops::subagent_stopped` is complete, but the in-progress
-`agent/subagent_host` cutover currently fires only `subagentStart` and returns
-without ever calling the stop side.) Configuring one
-produces a load warning saying so, and `hooks list` reports `"wired": false` for
-it. That is deliberate: a hook that silently never runs is the worst thing this
-system can do to you.
+`sessionStart`, `sessionEnd`, `preCompact`, `afterAgentThought` and `subagentStop` are defined. They parse, match and execute, and you can exercise them with `hooks test`, but the core does not fire them yet. Configuring one produces a load warning, and `hooks list` reports `"wired": false` for it. A hook that silently never runs would be worse, so the warning is deliberate.
### Derived events
-OpenHuman has no separate "shell execution" or "file read" call site: those are
-the `shell`, `file_read` and `file_write` tools going through the ordinary tool
-seam. So the shell, file and MCP events are *derived* from tool calls, and their
-payloads are reshaped the way a Cursor hook expects: a `command` string, a
-`file_path`, an `edits` array. Both the generic `preToolUse` and the specialised
-event fire, generic first.
+OpenHuman has no separate "shell execution" or "file read" call site. Those are the `shell`, `file_read` and `file_write` tools going through the ordinary tool path. The shell, file and MCP events are therefore derived from tool calls, and their payloads are reshaped the way a Cursor hook expects: a `command` string, a `file_path`, an `edits` array. The generic `preToolUse` fires first, then the specialized event.
## Matchers
-One string, matched against a subject the event chooses: the tool name for tool
-events, the command line for shell events, the path for file events, the agent id
-for subagent events.
+A matcher is one string, matched against a subject the event chooses. That is the tool name for tool events, the command line for shell events, the path for file events and the agent id for subagent events.
* absent or `*`: everything
* `Shell`: a literal, case-insensitive name
@@ -167,17 +129,13 @@ for subagent events.
* `MCP:search_docs`: an MCP tool by name
* anything containing punctuation: a regular expression (`^rm\b`, `\.rs$`)
-An invalid regex matches **nothing** and logs.
+An invalid regex matches nothing and is logged.
## Latency
-Gating events run their hooks sequentially and the turn waits; a denial
-short-circuits the rest. Observational events (`afterShellExecution`,
-`postToolUseFailure`, `afterAgentResponse`, …) are dispatched onto a background
-task and the turn never waits, so an audit hook that hangs must not hang the agent.
+Gating events run their hooks one after another and the turn waits. A denial skips the rest. Observational events (`afterShellExecution`, `postToolUseFailure`, `afterAgentResponse` and others) run on a background task and the turn never waits, so a hung audit hook cannot hang the agent.
-When nothing is configured, the harness bridge is not installed at all, so an
-unconfigured host pays nothing per tool call.
+When nothing is configured, the harness bridge is not installed, so an unconfigured host pays nothing per tool call.
## Environment
@@ -189,20 +147,17 @@ Hook processes inherit the core's environment plus:
## Prompt hooks
-`"type": "prompt"` writes the policy in English instead of shell. The text is
-sent to a model with the event JSON substituted for `$ARGUMENTS`, and the model
-answers `{"ok": true}` or `{"ok": false, "reason": "…"}`.
+With `"type": "prompt"` you write the policy in English instead of shell. The text goes to a model with the event JSON substituted for `$ARGUMENTS`, and the model answers `{"ok": true}` or `{"ok": false, "reason": "..."}`.
```json
{ "command": "Deny if $ARGUMENTS deletes anything outside /tmp.", "type": "prompt" }
```
-It costs a model call per event, so put it on rare, high-stakes moments, not on
-every tool call.
+Each event costs a model call, so use prompt hooks for rare, high-stakes moments, not every tool call.
## Inspecting and debugging
-Three RPC methods, on the `hooks` namespace:
+Three commands cover it:
```bash
openhuman-core hooks list # what is configured, from which file, and whether it is wired
@@ -211,13 +166,9 @@ openhuman-core hooks test --event beforeShellExecution \
--payload '{"command":"rm -rf /","sandbox":false}'
```
-Over JSON-RPC the same three are `openhuman.hooks_list`, `openhuman.hooks_reload`
-and `openhuman.hooks_test`.
+Over JSON-RPC they are `openhuman.hooks_list`, `openhuman.hooks_reload` and `openhuman.hooks_test`.
-`hooks test` fires one synthetic event in the foreground and reports what each
-matching hook decided, including hooks for observational events that a real
-dispatch would run detached. Debug a hook with it rather than by asking the agent
-to do the dangerous thing to see whether the rule fires.
+`hooks test` fires one synthetic event in the foreground and reports what each matching hook decided. That includes hooks on observational events, which a real dispatch would run in the background. Use it to debug a hook instead of asking the agent to do the dangerous thing to see whether the rule fires.
## Host switches
@@ -254,7 +205,7 @@ echo '{"permission":"deny","agent_message":"Secrets files are off limits. Ask th
```sh
#!/bin/sh
-cat > /dev/null # drain stdin; this hook does not read the event
+cat > /dev/null # drain stdin, this hook ignores the event
cargo fmt >/dev/null 2>&1
echo '{}'
```
@@ -263,12 +214,6 @@ Both need `chmod +x`.
## Implementation
-The engine and the whole `hooks.json` contract live upstream, in
-`tinyagents_runtime::command_hooks`: the types, the file and its layering, the
-matcher, running one hook (stdin, timeout, exit codes), selection and ordering
-and aggregation, the context envelope, and follow-ups.
+The engine and the whole `hooks.json` contract live upstream in `tinyagents_runtime::command_hooks`. That covers the types, the file and its layering, the matcher, running one hook (stdin, timeout, exit codes), selection, ordering and aggregation, the context envelope, and follow-ups.
-What stays in `crates/openhuman-core/src/hooks/` is the host half: `bridge`
-(mounting the engine on the harness's existing tool and turn seams), `ops` (the
-moments with no existing seam), `host`, `schemas` (the RPC surface) and
-`prompt_eval`. The beside-code `README.md` there is the authoritative split.
+`crates/openhuman-core/src/hooks/` holds the host half: `bridge` (mounts the engine on the harness's tool and turn paths), `ops` (moments with no existing path), `host`, `schemas` (the RPC surface) and `prompt_eval`. The `README.md` beside the code is the authoritative split.
diff --git a/docs/gitbooks/en/developing/jev.md b/docs/gitbooks/en/developing/jev.md
index c5238a3ca5..411ad09c6e 100644
--- a/docs/gitbooks/en/developing/jev.md
+++ b/docs/gitbooks/en/developing/jev.md
@@ -1,151 +1,82 @@
---
description: >-
- The small decision model: what it answers, where it is called, what it
- costs, and how it is configured.
+ Jev, the small decision model: what it answers, where OpenHuman uses it,
+ what it costs and how to configure it.
icon: scale-balanced
---
# Jev
-Jev is a decision model, not a text generator. Give it a request and a
-handful of labelled options, and it returns a calibrated probability for
-each one in about 150 milliseconds. OpenHuman uses it as a fast, cheap judge
-wherever a turn needs to pick from a short list rather than write prose: tool
-selection during a search, and step-by-step browser control.
+Jev is a decision model, not a text generator. Give it a request and a handful of labelled options, and it returns a calibrated probability for each one in about 150 milliseconds. OpenHuman uses it as a fast, cheap judge wherever a turn must pick from a short list instead of writing prose. That means tool selection during a search and step-by-step browser control.
-The models are `jev-1.13` and `jev-latest`, built by TypeSafe AI and reached
-through the TinyHumans System One proxy or, for a BYOK OpenRouter route,
-directly. Pricing is $0.042 per million input tokens, output free, and a
-typical tool search costs one to two thousand tokens. There is no session,
-no chain of thought, and nothing to stream: one request, one set of
-probabilities.
+The models are `jev-1.13` and `jev-latest`, built by TypeSafe AI. OpenHuman reaches them through the TinyHumans System One proxy or, on a bring-your-own-key OpenRouter route, directly. Input costs $0.042 per million tokens and output is free. A typical tool search uses one to two thousand tokens. There is no session, no chain of thought and nothing to stream: one request, one set of probabilities.
## Three question types
-Jev answers three kinds of question, defined in `tinyjevclient`:
+Jev answers three kinds of question. They are defined in `tinyjevclient`:
-- **Choice**: probabilities over a set of named options, so the caller can
- pick the best one, the top three, or discard everything below a
- confidence floor.
-- **Score**: a single calibrated number for one thing, rather than a choice
- among several.
-- **Noul**: a yes/no probability, used where OpenHuman needs "does this even
- apply" rather than "which of these applies."
+- Choice: probabilities over a set of named options. The caller can take the best one, the top three, or drop everything below a confidence floor.
+- Score: one calibrated number for one thing, instead of a choice among several.
+- Noul: a yes/no probability. OpenHuman uses it to ask "does this apply at all" instead of "which of these applies".
-Tool search uses a Choice and a Noul in the same request: the Choice picks
-a tool from the shortlist (plus a `none` option), and the Noul answers
-whether the request needs a tool at all. Browser control uses Jev
-repeatedly, once per step, to decide the next action.
+Tool search sends a Choice and a Noul in the same request. The Choice picks a tool from the shortlist (plus a `none` option), and the Noul says whether the request needs a tool at all. Browser control calls Jev once per step to decide the next action.
## Why retrieval comes first
-Jev accepts at most 255 options in one Choice, and its accuracy drops as
-the option list fills with entries that have nothing to do with the
-request. So nothing in OpenHuman ever hands Jev a whole tool catalogue.
-`tinytools-jev` (`vendor/tinyagents/vendor/tinytools/crates/tinytools-jev/`)
-narrows first and decides second:
-
-1. A retriever (BM25 by default, or an embedding-based ranker when one is
- configured) shortlists `retrieval_k` candidates, 20 by default. This step
- is skipped when the catalogue already fits in one Choice.
-2. One request to Jev: a Choice over the shortlist plus `none`, and a Noul
- asking whether the request needs a tool at all.
-3. Hits come back ranked by probability, `none` removed, anything below
- `min_probability` (0.05 by default) dropped.
-
-`JevRankerConfig::with_strategy` picks how the catalogue gets narrowed:
-
-- `RetrieveThenDecide` (the default): retrieve top 20, decide once. Bounded
- by the retriever's recall, since a paraphrase the retriever misses never
- reaches Jev.
-- `FamilyThenDecide`: one evaluation picks the candidates' family first (a
- toolkit or pack; anything without one falls into `core`), then a second
- evaluation runs per chosen family (`max_families`, default 2, run
- concurrently) over every member of that family. A family that fits in one
- Choice skips retrieval entirely, so a paraphrase is judged on meaning at
- both stages instead of being filtered out lexically before Jev sees it.
+Jev accepts at most 255 options in one Choice, and its accuracy drops as the list fills with entries unrelated to the request. So OpenHuman never hands Jev a whole tool catalogue. `tinytools-jev` (`vendor/tinyagents/vendor/tinytools/crates/tinytools-jev/`) narrows first and decides second:
+
+1. A retriever (BM25 by default, or an embedding ranker when one is configured) shortlists `retrieval_k` candidates, 20 by default. This step is skipped when the catalogue already fits in one Choice.
+2. One request goes to Jev: a Choice over the shortlist plus `none`, and a Noul asking whether the request needs a tool at all.
+3. Hits come back ranked by probability. `none` is removed, and anything below `min_probability` (0.05 by default) is dropped.
+
+`JevRankerConfig::with_strategy` picks how the catalogue is narrowed:
+
+- `RetrieveThenDecide` (the default): retrieve the top 20, then decide once. Recall is capped by the retriever, because a paraphrase it misses never reaches Jev.
+- `FamilyThenDecide`: one evaluation picks the family first (a toolkit or pack, with anything else in `core`). A second evaluation then runs per chosen family over every member of it. `max_families` defaults to 2 and the evaluations run concurrently. A family that fits in one Choice skips retrieval, so a paraphrase is judged on meaning at both stages instead of being filtered out lexically first.
## How OpenHuman uses it
### Tool search
-The tinyagents harness owns the `tool_search` / `tool_call` bridge over
-every tool registered as deferred. `openhuman-tinyhumans` installs
-`TinyHumansJevRanker` (`crates/openhuman-tinyhumans/src/jev/ranker.rs`) as
-the process-wide ranker for that bridge
-(`crates/openhuman-core/src/agent/tinyagents/discovery/`). The product
-default uses `RetrieveThenDecide` with the process's embedding provider as
-the retriever, so retrieval finds candidates by meaning rather than by
-shared words before Jev decides among them.
-
-The ranker resolves its Jev route and credential fresh on every search
-rather than caching them at install time, because a desktop can sign in and
-out while the process keeps running. The route is `agent.tool_search.jev_route`
-(see [Configuration](#configuration)): the TinyHumans proxy, TypeSafe's own
-API, or OpenRouter's System One API. The built Jev client is cached by
-route, credential and backend URL, so a stable session does not rebuild an HTTP
-client on every search. When the process has no usable embedding provider,
-`TinyHumansJevRanker` refuses outright and the harness answers with its own
-BM25 ranking instead of running a Jev decision over a lexical shortlist that
-would only add a network round trip for no gain.
+The tinyagents harness owns the `tool_search` / `tool_call` bridge over every tool registered as deferred. `openhuman-tinyhumans` installs `TinyHumansJevRanker` (`crates/openhuman-tinyhumans/src/jev/ranker.rs`) as the process-wide ranker for that bridge (`crates/openhuman-core/src/agent/tinyagents/discovery/`). The product default uses `RetrieveThenDecide` with the process's embedding provider as the retriever, so candidates are found by meaning, not shared words, before Jev decides.
+
+The ranker resolves its Jev route and credential on every search instead of caching them at install time, because a desktop can sign in and out while the process keeps running. The route is `agent.tool_search.jev_route` (see [Configuration](#configuration)): the TinyHumans proxy, TypeSafe's own API, or OpenRouter's System One API. The built Jev client is cached by route, credential and backend URL, so a stable session does not rebuild an HTTP client on every search.
+
+If the process has no usable embedding provider, `TinyHumansJevRanker` declines and the harness uses its own BM25 ranking. Running Jev over a lexical shortlist would only add a network round trip for no gain.
### Browser control
-`crates/openhuman-core/src/modules/browser_task.rs` hands browser tasks to
-TinyComputer's task members (`StartTask`, then `AwaitTask` until the task
-pauses or finishes), confined to the browser surface and the allowed websites.
-The decision model is chosen in `[computer] decision_model`: Jev (through
-the hosted proxy when signed in, or the user's OpenRouter key), OpenJev, or
-Sage. A failed step goes to the rescue model (`[computer] rescue_model`,
-up to `max_rescues` times) before the task fails. An irreversible step pauses
-as `needs_approval`; the browser tool holds it behind a one-use token and only
-`confirm_pending`, through the host approval gate, answers `ContinueTask`.
-
-`crates/openhuman-core/src/modules/browser_sites.rs` keeps what finished
-browser tasks learned, per site, in `<workspace>/state/computer/sites/`, and
-hands it to the next task on the same site: the plan a run finished with, as
-`StartTask.flow` for the same goal and facts (no planning), and the elements
-it found, as `StartTask.memory` (a remembered element costs one yes/no instead
-of a search). Only a run that finished (`done`, or its payment checkpoint)
-teaches anything; a plan is kept only when its run needed no rescue and holds
-no fact value its goal does not, and a reused plan that fails or needs a
-rescue is forgotten. Elements holding a fact value or page text are not kept,
-entries expire after 30 days unused, and none of it reaches the agent's memory
-or prompts. `[browser] learn_from_tasks` turns it off, and
-`modules.browser_forget_sites` forgets one site or all.
+`crates/openhuman-core/src/modules/browser_task.rs` hands browser tasks to TinyComputer's task members (`StartTask`, then `AwaitTask` until the task pauses or finishes). Tasks stay on the browser surface and the allowed websites.
+
+The decision model is set in `[computer] decision_model`: Jev (through the hosted proxy when signed in, or your OpenRouter key), OpenJev or Sage. A failed step goes to the rescue model (`[computer] rescue_model`, up to `max_rescues` times) before the task fails. An irreversible step pauses as `needs_approval`. The browser tool holds it behind a one-use token, and only `confirm_pending`, through the host approval gate, answers `ContinueTask`.
+
+`crates/openhuman-core/src/modules/browser_sites.rs` keeps what finished browser tasks learned, per site, in `<workspace>/state/computer/sites/`. It hands that to the next task on the same site:
+
+- The plan a run finished with goes in as `StartTask.flow` for the same goal and facts, so no planning is needed.
+- The elements it found go in as `StartTask.memory`. A remembered element costs one yes/no instead of a search.
+
+Only a finished run (`done`, or its payment checkpoint) teaches anything. A plan is kept only when its run needed no rescue and holds no fact value its goal does not. A reused plan that fails or needs a rescue is forgotten. Elements holding a fact value or page text are not kept. Entries expire after 30 days unused, and none of it reaches the agent's memory or prompts. `[browser] learn_from_tasks` turns this off, and `modules.browser_forget_sites` forgets one site or all.
## Measured results
-From `docs/plans/jev-tool-search-baseline.md`, measured 2026-09-22 against
-215 core tools plus 1,000 recorded Composio actions, with 160 hand-written
-requests (66 mapped to a Composio action, 63 to a core tool, 31 that no tool
-should answer):
+These numbers come from [`docs/plans/jev-tool-search-baseline.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/plans/jev-tool-search-baseline.md). The test used 215 core tools plus 1,000 recorded Composio actions and 160 hand-written requests. Of those, 66 map to a Composio action, 63 to a core tool and 31 should get no tool.
| Ranker | Top-1 | Top-3 | Needless calls (of 31) | p50 latency |
| --- | --- | --- | --- | --- |
| BM25 | 22.5% | 38.0% | 26 | 28 ms |
| Jev, BM25 top-20 then decide | 57.4% | 62.0% | 1 | 1.5 s |
| Jev, embedding top-20 then decide (product default) | 62.0% | 66.7% | 1 | 1.5 s |
-| Jev, family then decide | 62.0-64.3% | 67.4-69.0% | 1 | 1.3 s |
-
-On the Composio-only slice, `FamilyThenDecide` with an embedding cut for
-oversized families reaches 80.3% top-1 and 87.9% top-3, against BM25's 18.2%
-and 36.4%. The gap comes mostly from retrieval, not the decision itself:
-under `RetrieveThenDecide` with BM25 shortlisting, Jev's Composio top-3
-(72.7%) lands exactly on BM25's recall@20, meaning Jev is choosing correctly
-from everything it was shown but a paraphrase like "ping alex" for
-`SLACK_SEND_MESSAGE` never reaches it. Letting Jev pick the family first
-removes the shortlist for every toolkit that fits in one Choice and lifts
-Composio top-3 into the high 80s.
-
-Needless tool calls collapse under any Jev configuration: BM25 answers 26 of
-31 tool-less requests with a (wrong) tool anyway, while Jev's `none` option
-and `needs_tool` Noul let it abstain on all but one.
+| Jev, family then decide | 62.0 to 64.3% | 67.4 to 69.0% | 1 | 1.3 s |
+
+On the Composio-only slice, `FamilyThenDecide` with an embedding cut for oversized families reaches 80.3% top-1 and 87.9% top-3. BM25 reaches 18.2% and 36.4%.
+
+The gap comes mostly from retrieval, not the decision. With `RetrieveThenDecide` and BM25 shortlisting, Jev's Composio top-3 (72.7%) equals BM25's recall@20. Jev chooses correctly from everything it sees, but a paraphrase like "ping alex" for `SLACK_SEND_MESSAGE` never reaches it. Letting Jev pick the family first removes the shortlist for every toolkit that fits in one Choice and lifts Composio top-3 into the high 80s.
+
+Needless tool calls drop sharply under any Jev setup. BM25 answers 26 of 31 tool-less requests with a wrong tool. Jev's `none` option and `needs_tool` Noul let it abstain on all but one.
## Configuration
-`ToolSearchConfig` (`crates/openhuman-core/src/config/schema/agent.rs`) is
-the `[agent.tool_search]` block:
+`ToolSearchConfig` (`crates/openhuman-core/src/config/schema/agent.rs`) is the `[agent.tool_search]` block:
```toml
[agent.tool_search]
@@ -155,33 +86,15 @@ jev_route = "auto" # "auto" (default) | "tinyhumans" | "typesafe" | "openroute
top_k = 3
```
-- `ranker = "jev"`: use the installed decision-model ranker, falling back to
- BM25 only when it fails or the process has no TinyHumans credential.
-- `"auto"`: same fallback behaviour as `"jev"`.
-- `"bm25"`: the built-in lexical ranker only, no network call.
-- `"compare"`: serve Jev, but also record the BM25 ranking in the
- `tool.searched` telemetry, so the two can be compared on live traffic
- without changing what the model sees.
-- `jev_route`: where the Jev decision calls go. `"auto"` uses the TinyHumans
- credential when the process has one, else `TYPESAFE_API_KEY` (direct to
- TypeSafe), else an OpenRouter key (`OPENROUTER_API_KEY`, or the stored
- `openrouter` BYOK key). `"tinyhumans"`, `"typesafe"` and `"openrouter"` pin
- one route and never fall through to another credential. Override per launch
- with `OPENHUMAN_JEV_ROUTE`.
-- `jev_base_url`: replaces the API origin of the `typesafe` / `openrouter`
- routes (a metering proxy, a mirror). Remote origins must be HTTPS; HTTP is
- accepted for literal loopback IPs only. Override per launch with
- `OPENHUMAN_JEV_BASE_URL`.
-- `top_k`: how many matches a search returns when the model does not ask for
- a specific number. Three by default, enough to choose from without
- returning so many schemas that the point of deferring them is lost.
-
-Without an embedding provider, or without a credential for the selected Jev
-route, tool search falls back to BM25 automatically, so `auto` and `jev` cost
-nothing extra with no credential. A BYOK setup with no TinyHumans account
-needs an embedding provider that does not depend on one (for example
-`memory.embedding_provider = "custom:<OpenAI-compatible endpoint>"`) as well as
-a TypeSafe or OpenRouter key.
+- `ranker = "jev"`: use the installed decision-model ranker. It falls back to BM25 only when Jev fails or the process has no TinyHumans credential.
+- `"auto"`: the same fallback as `"jev"`.
+- `"bm25"`: the built-in lexical ranker only, with no network call.
+- `"compare"`: serve Jev, and also record the BM25 ranking in the `tool.searched` telemetry. You can compare the two on live traffic without changing what the model sees.
+- `jev_route`: where Jev calls go. `"auto"` uses the TinyHumans credential if the process has one, else `TYPESAFE_API_KEY` (direct to TypeSafe), else an OpenRouter key (`OPENROUTER_API_KEY`, or the stored `openrouter` key). `"tinyhumans"`, `"typesafe"` and `"openrouter"` pin one route and never fall through to another credential. Override per launch with `OPENHUMAN_JEV_ROUTE`.
+- `jev_base_url`: replaces the API origin of the `typesafe` and `openrouter` routes, for example a metering proxy or a mirror. Remote origins must be HTTPS. HTTP is accepted only for literal loopback IPs. Override per launch with `OPENHUMAN_JEV_BASE_URL`.
+- `top_k`: how many matches a search returns when the model does not ask for a number. The default is three, enough to choose from without returning so many schemas that deferring them loses its point.
+
+Without an embedding provider, or without a credential for the selected route, tool search falls back to BM25 automatically. `auto` and `jev` therefore cost nothing extra when no credential is set. A setup with no TinyHumans account needs an embedding provider that does not depend on one (for example `memory.embedding_provider = "custom:<OpenAI-compatible endpoint>"`) and a TypeSafe or OpenRouter key.
## Running the benchmark
@@ -191,27 +104,14 @@ cargo run -p openhuman-cli --bin tool-search-bench -- --ranker jev --family --em
cargo run -p openhuman-cli --bin tool-search-bench -- --dump-catalogue
```
-`OPENHUMAN_BACKEND_API_KEY` (or `TYPESAFE_API_KEY`) selects the credential;
-without one the bench ranks through the signed-in TinyHumans session, same
-as the product.
+`OPENHUMAN_BACKEND_API_KEY` (or `TYPESAFE_API_KEY`) selects the credential. Without one, the bench ranks through the signed-in TinyHumans session, as the product does.
## Where the code lives
-- `vendor/tinyagents/vendor/tinytools/crates/tinytools-jev/`: the
- transport-neutral `ToolRanker` implementation, its retrieval strategies,
- and the `JevRankerConfig` / `JevRanking` types.
-- `crates/openhuman-tinyhumans/src/jev/`: the TinyHumans-specific evaluator
- (`TinyJevEvaluator`, over `tinyjevclient`) and the process-installed
- ranker (`TinyHumansJevRanker`).
-- `crates/openhuman-core/src/agent/tinyagents/discovery/`: the host slot
- that holds the installed ranker and turns `[agent.tool_search]` into the
- policy a turn runs with.
-- `crates/openhuman-core/src/modules/browser_task.rs`: the browser-task
- entry point that runs `JevController`.
-- `docs/plans/jev-tool-search-baseline.md`: the full benchmark writeup this
- page's numbers come from.
-
-See also: [Performance](performance.md) for the wider cost and density
-picture, [Pluggable engines](engines.md) for the other swappable pieces
-around inference and memory, and [Embedding OpenHuman](embedding.md) for
-running an agent as a library, including one that uses tool search.
+- `vendor/tinyagents/vendor/tinytools/crates/tinytools-jev/`: the transport-neutral `ToolRanker` implementation, its retrieval strategies and the `JevRankerConfig` / `JevRanking` types.
+- `crates/openhuman-tinyhumans/src/jev/`: the TinyHumans evaluator (`TinyJevEvaluator`, over `tinyjevclient`) and the process-installed ranker (`TinyHumansJevRanker`).
+- `crates/openhuman-core/src/agent/tinyagents/discovery/`: the host slot that holds the installed ranker and turns `[agent.tool_search]` into the policy a turn runs with.
+- `crates/openhuman-core/src/modules/browser_task.rs`: the browser-task entry point that runs `JevController`.
+- [`docs/plans/jev-tool-search-baseline.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/plans/jev-tool-search-baseline.md): the full benchmark writeup.
+
+See also [Performance](performance.md) for the wider cost and density picture, [Pluggable engines](engines.md) for the other swappable pieces, and [Embedding OpenHuman](embedding.md) for running an agent as a library.
diff --git a/docs/gitbooks/en/developing/loadable-modules.md b/docs/gitbooks/en/developing/loadable-modules.md
index f92d0dae8c..0bbe97332c 100644
--- a/docs/gitbooks/en/developing/loadable-modules.md
+++ b/docs/gitbooks/en/developing/loadable-modules.md
@@ -1,19 +1,19 @@
---
description: >-
- How capability arrives at runtime instead of compile time: the TinyBus module
- ABI, the pinned registry, admission checks, and what happens when one faults.
+ How OpenHuman loads optional native modules at runtime: the registry,
+ admission checks and what happens when a module faults.
icon: puzzle-piece
---
# Loadable modules
-Feature gates decide what compiles into the binary. Modules decide what the binary can *reach* once it is running. A module is a first-party native library, loaded into the core process, serving a small typed interface over TinyBus.
+Feature gates decide what compiles into the binary. Modules decide what the running binary can reach. A module is a first-party native library, loaded into the core process, that serves a small typed interface over TinyBus.
-The trade is explicit: a module shares the core's address space and its crash domain, so it is trusted code and the admission checks matter. In exchange, a user who never generates a document never pays for the document writer, in download size, in resident memory, or in dependency surface.
+The trade is explicit. A module shares the core's address space and crash domain, so it is trusted code and the admission checks matter. In return, a user who never generates a document never pays for the document writer in download size, memory or dependencies.
## 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.
+`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.
| Module | Provides |
| --- | --- |
@@ -30,13 +30,13 @@ The trade is explicit: a module shares the core's address space and its crash do
| `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 (`ubuntu-24.04` and `ubuntu-22.04` × `x86_64`/`arm64`, `macos-26` and `macos-15` × `arm64`/`x86_64`, `windows-2025-x86_64`, `windows-2022-x86_64`, `windows-11-arm64`), and `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. 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.
-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 point of the digest is that it describes the artifact the release workflow signed, not the one on your machine.
+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.
## Resolution order
-Each step exists to avoid the cost of the next:
+Each 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 `*_TEST_MODULE` environment variable.
@@ -44,28 +44,28 @@ Each step exists to avoid the cost of the next:
4. Bundled releases staged into the app at build time.
5. The release cache, downloading only if `[modules].allow_download` is true.
-An override **bypasses the digest check**, because the artifact is whatever is at that path. That is acceptable only because it is the operator's own file named by the operator's own config, and it is why the block cannot *add* a module that is not already in the registry.
+An override bypasses the digest check, because the artifact is whatever sits at that path. That is acceptable only because it is the operator's own file, named in the operator's own config. It also means an override cannot add a module that is not already in the registry.
-Platform candidates are ordered newest-first with fallthrough. On Linux, glibc 2.39 or newer prefers the 24.04 build and falls back to 22.04; 2.35 or newer gets 22.04; anything older, and musl or an unknown libc, gets an **empty** candidate list, so no published artifact can load there by design.
+Platform candidates are ordered newest first, with fallthrough. On Linux, glibc 2.39 or newer prefers the 24.04 build and falls back to 22.04. glibc 2.35 or newer gets 22.04. Anything older, plus musl or an unknown libc, gets an empty candidate list, so no published artifact loads there by design.
## Admission
-In order, and all of it before any module code runs:
+These checks run in order, all before any module code runs:
1. Directory ownership and mode, and a regular platform library file within the size cap.
2. The digest allowlist beside the artifact, when present, which is authoritative for its directory.
3. Resolve the ABI descriptor symbol, and validate its frozen 16-byte prefix before reading the rest.
-4. Validate the full descriptor: matching pointer width, endianness and target triple, a compatible TinyBus series, and module feature bits that are a subset of the host's. A module built with `panic = "abort"` is **refused**, because a panic that aborts takes the host with it.
+4. Validate the full descriptor: matching pointer width, endianness and target triple, a compatible TinyBus series, and module feature bits that are a subset of the host's. A module built with `panic = "abort"` is refused, because an aborting panic takes the host down with it.
5. Parse the manifest and resolve dependencies, rejecting missing providers, cycles and name clashes.
6. Initialize, take the vtable, attach the transport.
-Each module declares its interface in its own small `*-bus` contract crate: the interface name, the object path, one constant per member, and a contract version. The bind rule is majors equal **and** the module's minor at least the host's, so a newer module serves an older host and the reverse is refused rather than half-working. Never redeclare a contract type in OpenHuman, and call members through the contract's constants rather than string literals.
+Each module declares its interface in its own small `*-bus` contract crate: the interface name, the object path, one constant per member, and a contract version. The bind rule is that majors are equal and the module's minor is at least the host's. A newer module serves an older host, and the reverse is refused instead of half working. Never redeclare a contract type in OpenHuman, and call members through the contract's constants, not string literals.
## Faults are terminal
-Of the eleven lifecycle states, five are terminal: rejected, faulted, failed, stopped and disabled. A module in one of those answers "unavailable" immediately and is **never retried in the same process**.
+Of the eleven lifecycle states, five are terminal: rejected, faulted, failed, stopped and disabled. A module in one of those answers "unavailable" immediately and is never retried in the same process.
-That is the direct consequence of the other rule: **the loader never unloads a library.** A stopped module releases its transport and its names, but its code, thread-locals, panic metadata and callback addresses stay mapped until the process exits. Replacing an artifact needs a restart. Retrying a faulted module in place would be running code whose invariants you already know are broken.
+This follows from a second rule: the loader never unloads a library. A stopped module releases its transport and its names, but its code, thread-locals, panic metadata and callback addresses stay mapped until the process exits. Replacing an artifact needs a restart. Retrying a faulted module in place would run code whose invariants you already know are broken.
Untrusted code does not belong here. It belongs in a separate process, which is what the sandbox backends are for.
@@ -73,23 +73,23 @@ Untrusted code does not belong here. It belongs in a separate process, which is
```toml
[modules]
-enabled = true # off means the features say so, rather than failing at use
+enabled = true # when off, features report it instead of failing at use
allow_download = true # false suits an air-gapped or reproducible deployment
-# install_dir = "…" # defaults to the user cache dir, then the workspace
+# install_dir = "..." # defaults to the user cache dir, then the workspace
```
-Nothing is downloaded silently either way: the digest comes from the compiled-in registry rather than from the release being fetched.
+Nothing is downloaded silently either way. The digest comes from the compiled-in registry, not from the release being fetched.
-The `modules` RPC namespace exposes `list`, `status` and `load` (by id, never by path), plus `computer_status` and `browser_check_readiness` for the computer module's own readiness, and `browser_forget_sites`, which forgets what browser tasks learned about one site or every site (see [jev.md](jev.md)).
+The `modules` RPC namespace exposes `list`, `status` and `load` (by id, never by path), plus `computer_status` and `browser_check_readiness` for the computer module's readiness. `browser_forget_sites` forgets what browser tasks learned about one site or every site (see [Jev](jev.md)).
## Adding or moving one
-A module's behaviour belongs in the submodule that owns it, not here. The host side is the adapter: the proxy, the config it pushes at initialization, and the policy around the call. When you change a module:
+A module's behavior belongs in the submodule that owns it. The host side is the adapter: the proxy, the config it pushes at initialization and the policy around the call. When you change a module:
1. Land the change upstream and cut a release there.
2. Move the gitlink under `vendor/`.
3. Update the record's version, release URL and digests from that release's checksum file.
-4. Test both the gate-on and gate-off builds, since a leaf gate's absence should mean "absent", not "present and failing".
+4. Test both the gate-on and gate-off builds, because a missing leaf gate should mean the module is absent, not present and failing.
## See also
diff --git a/docs/gitbooks/en/developing/mcp-server.md b/docs/gitbooks/en/developing/mcp-server.md
index a2cafb7466..66398a3084 100644
--- a/docs/gitbooks/en/developing/mcp-server.md
+++ b/docs/gitbooks/en/developing/mcp-server.md
@@ -1,43 +1,27 @@
---
-description: Run OpenHuman Core as a read-only stdio Model Context Protocol server.
+description: Run OpenHuman Core as a stdio Model Context Protocol server for local MCP clients.
icon: plug
---
-# MCP Server
+# MCP server
-OpenHuman Core can run as an opt-in stdio MCP server for local MCP clients such
-as Claude Desktop, Cursor, or Zed.
+OpenHuman Core can run as an opt-in stdio MCP server. Local MCP clients such as Claude Desktop, Cursor or Zed can then use its search, memory and sub-agent tools.
```bash
openhuman-core mcp
```
-The command does not start the HTTP JSON-RPC server. It reads newline-delimited
-JSON-RPC 2.0 messages from stdin and writes MCP responses to stdout. Logs go to
-stderr; add `--verbose` for debug output.
+The command does not start the HTTP JSON-RPC server. It reads newline-delimited JSON-RPC 2.0 messages from stdin and writes MCP responses to stdout. Logs go to stderr. Add `--verbose` for debug output.
## Client provenance
-During `initialize`, the MCP server captures `params.clientInfo.name` for the
-stdio session. The name is normalized by trimming leading and trailing
-whitespace, converting to lowercase, replacing each sequence of
-non-ASCII-alphanumeric characters with a single hyphen, then trimming leading
-and trailing hyphens. For example, `Claude Desktop` becomes `claude-desktop`,
-`Cursor` becomes `cursor`, and `Windsurf` becomes `windsurf`.
+During `initialize`, the server captures `params.clientInfo.name` for the stdio session. It normalizes the name in four steps: trim whitespace, lowercase, replace each run of non-ASCII-alphanumeric characters with one hyphen, then trim leading and trailing hyphens. `Claude Desktop` becomes `claude-desktop`, `Cursor` becomes `cursor` and `Windsurf` becomes `windsurf`.
-If the client omits `clientInfo.name`, sends an empty value, or sends a name
-that normalizes to nothing, the session falls back to the bare `mcp` source
-label. Write-capable MCP tools should use this session source label for memory
-provenance so old clients keep the existing `mcp` behavior and identifiable
-clients can write as `mcp:<client>`.
+If the client omits `clientInfo.name`, sends an empty value, or sends a name that normalizes to nothing, the session uses the bare `mcp` source label. Write-capable MCP tools use this label for memory provenance. Unidentified clients write as `mcp`, and identifiable clients write as `mcp:<client>`.
## Tools
-The MCP surface routes through the existing controller registry plus the core
-security policy: read tools pass the read gate, and three tools pass the act
-gate. Two of them, `memory.learn` and `memory.forget`, are also recorded on the
-MCP write-audit path; `agent.run_subagent` is not, because the sub-agent's own
-side-effecting calls are audited through the approval gate instead:
+The MCP surface routes through the controller registry and the core security policy. Read tools pass the read gate. Three tools pass the act gate. Two of them, `memory.learn` and `memory.forget`, are also recorded on the MCP write-audit path. `agent.run_subagent` is not, because the sub-agent's own side-effecting calls are audited through the approval gate instead.
| MCP tool | Backing RPC | Purpose |
| ------------------- | ------------------------------------ | ----------------------------------------------------------------------- |
@@ -54,30 +38,22 @@ side-effecting calls are audited through the approval gate instead:
| `agent.list_subagents` | served in-layer | The registered sub-agent definitions the core can dispatch. |
| `agent.run_subagent` | served in-layer | Run a registered sub-agent and return its final response (act-gated). |
-- Tools marked \* are listed only when a provider can serve them: `web_search`
- and `web_answer` when their search role has a usable provider (a signed-in
- session, or a provider with your own key), `searxng_search` when SearXNG is
- enabled in search settings.
-
-`web_search` accepts `query`, optional `max_results` (1-20) and optional
-`provider` (pins one provider and disables fallback). `web_answer` accepts
-`query` and optional `depth` (`quick` or `deep`). `searxng_search` accepts
-`query` and optional `max_results` (1-20).
-`memory.recall` accepts `question` plus optional `filter` and `limit`.
-`memory.fetch` accepts `query` plus optional `mode`, `filter`, `limit` and
-`cursor`; `mode` must be one the active memory engine supports, and both launch
-engines (`tinyhumans`, `cortexdb`) support only `hybrid`, so leave it out
-unless you know otherwise. `memory.list` accepts optional `filter`, `limit` and
-`cursor`. `limit` defaults to 10 and is capped at 100. `filter` takes any of
-`workspace`, `folder`, `file_path`, `language`, `repo`, `commit`, `url`,
-`thread_id`, `agent_id`, `kinds` (`document`, `conversation`, `learning`),
-`sources`, `tags_any`, `observed_after` and `observed_before` (RFC 3339).
-`memory.learn` accepts `text` plus optional `kind` (`preference`, `fact`,
-`procedure`, `correction`, `other`) and `confidence` (0 to 1). `memory.forget`
-accepts `ids` (1 to 100). Memory tools answer `MEMORY_OFF` when no memory engine
-is usable. See [Memory v2](https://github.com/tinyhumansai/openhuman/blob/main/docs/specs/memory-v2.md) for the model.
-
-Enable SearXNG under Connections → Search, in `config.toml`, or via environment:
+Tools marked \* are listed only when a provider can serve them. `web_search` and `web_answer` need a usable provider for their search role, which is a signed-in session or a provider with your own key. `searxng_search` needs SearXNG enabled in search settings.
+
+Arguments:
+
+- `web_search`: `query`, optional `max_results` (1 to 20), and optional `provider` (pins one provider and disables fallback).
+- `web_answer`: `query` and optional `depth` (`quick` or `deep`).
+- `searxng_search`: `query` and optional `max_results` (1 to 20).
+- `memory.recall`: `question`, plus optional `filter` and `limit`.
+- `memory.fetch`: `query`, plus optional `mode`, `filter`, `limit` and `cursor`. `mode` must be one the active memory engine supports. Both launch engines (`tinyhumans`, `cortexdb`) support only `hybrid`, so leave it out unless you know otherwise.
+- `memory.list`: optional `filter`, `limit` and `cursor`.
+- `memory.learn`: `text`, plus optional `kind` (`preference`, `fact`, `procedure`, `correction`, `other`) and `confidence` (0 to 1).
+- `memory.forget`: `ids` (1 to 100).
+
+`limit` defaults to 10 and is capped at 100. `filter` takes any of `workspace`, `folder`, `file_path`, `language`, `repo`, `commit`, `url`, `thread_id`, `agent_id`, `kinds` (`document`, `conversation`, `learning`), `sources`, `tags_any`, `observed_after` and `observed_before` (RFC 3339). Memory tools answer `MEMORY_OFF` when no memory engine is usable. See the [memory spec](https://github.com/tinyhumansai/openhuman/blob/main/docs/specs/memory-v2.md) for the model.
+
+Enable SearXNG under Connections > Search, in `config.toml`, or with environment variables:
```toml
[search.providers.searxng]
@@ -102,9 +78,7 @@ OPENHUMAN_SEARXNG_TIMEOUT_SECONDS=10
## Resources
-The MCP server exposes the bundled prompt assets as static resources. Clients
-that support `resources/list` and `resources/read` can inspect the full agent
-personality and subagent prompt templates without executing any tool calls.
+The server exposes the bundled prompt assets as static resources. Clients that support `resources/list` and `resources/read` can read the agent personality and sub-agent prompt templates without running any tool.
### Capability advertisement
@@ -132,19 +106,13 @@ All resources have `mimeType: "text/markdown"`.
### Catalog parity
-A unit test (`catalog_mirrors_builtins`) cross-references the resource catalog
-against the `BUILTINS` slice in `loader.rs`. Adding a new built-in subagent
-without a matching catalog entry fails CI.
+A unit test (`catalog_mirrors_builtins`) checks the resource catalog against the `BUILTINS` slice in `loader.rs`. Adding a built-in sub-agent without a matching catalog entry fails CI.
### Resource templates
-The catalog is fully static (every URI is concrete, none are templated), so
-`resources/templates/list` always returns an empty `resourceTemplates` array.
-The handler exists for MCP-spec compliance: clients that probe
-`resources/templates/list` after seeing the `resources` capability get a
-well-formed result instead of `-32601 Method not found`.
+The catalog is static: every URI is concrete and none are templated. `resources/templates/list` therefore always returns an empty `resourceTemplates` array. The handler exists so clients that probe it after seeing the `resources` capability get a valid result instead of `-32601 Method not found`.
-### Smoke test
+### Smoke test for resources
```bash
printf '%s\n' \
@@ -158,9 +126,7 @@ printf '%s\n' \
## Tool registry
-The HTTP JSON-RPC server also exposes a read-only global tool registry for
-agents and dashboards that need discovery metadata without opening an MCP stdio
-session:
+The HTTP JSON-RPC server also exposes a read-only tool registry. Agents and dashboards can use it to discover tools without opening an MCP stdio session:
| RPC method | Purpose |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -168,15 +134,11 @@ session:
| `openhuman.tool_registry_get` | Return one registry entry by `tool_id`, for example `memory.recall` or `tools.web_search`. |
| `openhuman.tool_registry_diagnostics` | Return redacted inventory counts, write-surface candidates, policy surfaces, and external capability-provider diagnostics. |
-The registry is discovery-only. It does not change tool dispatch or permission
-checks; MCP calls still go through `tools/call`, and controller-backed tools
-still route through their existing JSON-RPC methods.
+The registry is for discovery only. It does not change tool dispatch or permission checks. MCP calls still go through `tools/call`, and controller-backed tools still use their own JSON-RPC methods.
### External capability providers
-OpenHuman can record trusted external capability providers in `config.toml`.
-This is governance metadata only: it does not install packages, execute remote
-code, or bypass the existing MCP/controller dispatch paths.
+You can record trusted external capability providers in `config.toml`. This is governance metadata only. It does not install packages, run remote code or bypass the MCP and controller dispatch paths.
```toml
[[capability_providers]]
@@ -188,13 +150,9 @@ trust_state = "trusted"
enabled = true
```
-Provider ids are normalized before policy checks. For example, `Acme Tools`
-becomes `acme-tools`; duplicates after normalization are rejected. A provider is
-eligible for future admission checks only when it is both `enabled = true` and
-`trust_state = "trusted"`. Missing provider config preserves the previous
-behavior: the provider registry is empty and no existing tools are hidden.
+Provider ids are normalized before policy checks, so `Acme Tools` becomes `acme-tools`. Duplicates after normalization are rejected. A provider is eligible for future admission checks only when it has both `enabled = true` and `trust_state = "trusted"`. With no provider config, the registry is empty and no existing tools are hidden.
-## Smoke test
+## Smoke test for tools
```bash
printf '%s\n' \
@@ -204,10 +162,7 @@ printf '%s\n' \
| openhuman-core mcp
```
-The response should include `capabilities.tools` from `initialize` and the
-curated tool names from `tools/list`. A successful run writes exactly two compact
-JSON response lines to stdout; the `notifications/initialized` message is a
-notification and has no response.
+The response should include `capabilities.tools` from `initialize` and the tool names from `tools/list`. A successful run writes exactly two compact JSON lines to stdout. `notifications/initialized` is a notification and has no response.
```text
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-06-18","capabilities":{"tools":{},"resources":{"subscribe":false,"listChanged":false}},"serverInfo":{"name":"openhuman-core","version":"<crate version>"},"instructions":"..."}}
diff --git a/docs/gitbooks/en/developing/performance.md b/docs/gitbooks/en/developing/performance.md
index f4a5b11c90..8434a4c4d7 100644
--- a/docs/gitbooks/en/developing/performance.md
+++ b/docs/gitbooks/en/developing/performance.md
@@ -1,31 +1,19 @@
---
description: >-
- Measured footprint: agent density in one process, cold start, binary size,
- and the dependency-floor ratchet that keeps it there.
+ Measured footprint: how many agents fit in one process, cold start, binary
+ size and the dependency limits that keep it small.
icon: gauge
---
# Performance and footprint
-OpenHuman's Rust core runs in-process as a library, not as one OS process per
-agent. That single decision is where most of the density numbers on this page
-come from: a fixed bootstrap cost (allocator warm-up, code paging, registries,
-detectors) is paid once per process and then shared across however many agents
-run inside it, instead of being paid again for every agent.
+OpenHuman's Rust core runs in-process as a library, not as one OS process per agent. Most of the density numbers on this page come from that one decision. A fixed bootstrap cost (allocator warm-up, code paging, registries, detectors) is paid once per process and shared by every agent inside it.
-Everything below was measured on Apple Silicon macOS, `--release` build,
-against a deterministic mock inference provider (the `rss-bench` feature),
-not real network calls. Treat the absolute numbers as this-machine numbers and
-the ratios (density, marginal cost, binary delta) as the parts worth
-generalizing. The scripts to reproduce them are listed at the end.
+Everything below was measured on Apple Silicon macOS with a `--release` build and a deterministic mock inference provider (the `rss-bench` feature), not real network calls. Treat the absolute numbers as numbers for that machine. The ratios (density, marginal cost, binary delta) are the parts worth generalizing. The scripts to reproduce them are listed at the end.
## Fleet: how many agents fit in one process
-`library-fleet.sh` runs N concurrent live agents in a single process, with
-latency-realistic mock inference (200 ms) so idle time behaves like a real
-network wait instead of a busy loop. It reports the *marginal* RSS per
-additional agent once the fixed base is paid, which is the number that
-actually decides how many agents fit in a box.
+`library-fleet.sh` runs N concurrent live agents in a single process. Mock inference takes 200 ms, so idle time behaves like a real network wait instead of a busy loop. The script reports the marginal RSS per additional agent once the fixed base is paid. That number decides how many agents fit in a box.
| N agents | Marginal KiB/agent | Settled MiB | Idle CPU ms/10s | Threads | FDs |
| ---: | ---: | ---: | ---: | ---: | ---: |
@@ -33,28 +21,15 @@ actually decides how many agents fit in a box.
| 100 | 1,866 | 356 | 3 | 123 | 820 |
| 500 | 1,770 | 1,393 | 3 | 211 | 3,220 |
-500 agents in one process, measured, at roughly 1.77 MiB marginal cost each.
-Idle CPU stays flat regardless of N, which is the property that matters: an
-agent that isn't mid-turn should not be spending cycles. Thread count grows
-about 0.35 per agent, which is the one line item worth watching before pushing
-past 500 in production.
+500 agents fit in one process at roughly 1.77 MiB marginal cost each. Idle CPU stays flat as N grows, which matters because an agent that is not mid-turn should not spend cycles. Thread count grows by about 0.35 per agent. Watch that line before pushing past 500 in production.
-Thousands of agents on a single box is the direction this is heading, not a
-number we've hit yet. The trend across 50/100/500 agents is a settling
-marginal cost, not a rising one, which is what makes that direction plausible.
+Thousands of agents on one box is a goal, not a measured result. The marginal cost settles across 50, 100 and 500 agents instead of rising, which makes the goal plausible.
## In-process vs one process per agent
-The same benchmark suite includes `library-instances.sh`, which spawns N
-independent `library-profile` processes instead of N agents inside one
-process. That measured about 47.8-48.2 MiB per instance, flat across N =
-10/25/50, which puts roughly 42 instances in a 2 GiB box by summed RSS (an
-upper bound; macOS has no PSS-equivalent metric to divide out shared pages).
+`library-instances.sh` spawns N independent `library-profile` processes instead of N agents in one process. Each instance used about 47.8 to 48.2 MiB, flat across N = 10, 25 and 50. That puts roughly 42 instances in a 2 GiB box by summed RSS. This is an upper bound, because macOS has no PSS-equivalent metric to divide out shared pages.
-One process per agent pays the ~30-50 MiB fixed base every time. The
-in-process model pays it once. At the measured marginal cost, the one-process
-fleet model is roughly 25 times denser than the per-process model for the same
-memory budget.
+One process per agent pays the 30 to 50 MiB fixed base every time. The in-process model pays it once. At the measured marginal cost, one process is roughly 25 times denser than one process per agent for the same memory budget.
## Cold start
@@ -63,28 +38,17 @@ memory budget.
| `agent-turn` (cold, one turn, no delegation) | 47.6 MiB | 102 ms |
| `cold-phases` (nine bootstrap phases: config load, registry init, agent build, memory construction, first turn) | 51.2 MiB | 476 ms |
-The `cold-phases` row is a historical measurement: that scenario was removed from the profile binary, so the number stands but cannot be re-run from this tree. Everything else on this page reproduces with the commands below.
+The `cold-phases` scenario was removed from the profile binary, so that row cannot be re-run from this tree. Everything else on this page reproduces with the commands below.
-A cold agent turn answers in about 102 ms. The full nine-phase bootstrap, the
-thing a process pays exactly once, takes 476 ms. After that, a warmed turn in
-the same process costs 0.5-1.9 MiB rather than the 26-31 MiB a first turn
-retains, because most of a cold turn's cost is executable code paging in for
-the first time, not per-turn allocation.
+A cold agent turn answers in about 102 ms. The full nine-phase bootstrap, which a process pays once, takes 476 ms. After that, a warmed turn in the same process costs 0.5 to 1.9 MiB, not the 26 to 31 MiB a first turn retains. Most of a cold turn's cost is executable code paging in for the first time, not per-turn allocation.
## Slim build footprint
-A `--no-default-features --features rss-bench` build (drops every optional
-domain) settles at about 15.2 MiB of private physical memory and roughly 42
-MiB RSS. The rest of that RSS is reclaimable executable text and allocator
-high-water retention, not live data: a deep attribution pass found about 3.2
-MiB of live heap and 18.7 MiB of resident executable text inside that 42 MiB.
+A `--no-default-features --features rss-bench` build, which drops every optional domain, settles at about 15.2 MiB of private physical memory and roughly 42 MiB RSS. The rest of that RSS is reclaimable executable text and allocator high-water retention, not live data. A deep attribution pass found about 3.2 MiB of live heap and 18.7 MiB of resident executable text inside the 42 MiB.
## Binary size by feature set
-Cargo feature gates control what compiles in. Two starting points matter:
-Contrib (`[features] default` in `crates/openhuman-core/Cargo.toml`, what a
-bare `cargo check` builds) and Product (`scripts/ci/product-features.txt`,
-what the desktop app ships).
+Cargo feature gates control what compiles in. Two starting points matter: Contrib (`[features] default` in `crates/openhuman-core/Cargo.toml`, what a bare `cargo check` builds) and Product (`scripts/ci/product-features.txt`, what the desktop app ships).
| Build | Features | Unstripped | Stripped |
| --- | --- | ---: | ---: |
@@ -92,54 +56,23 @@ what the desktop app ships).
| library-minimal | `skills,flows` | ~81.1 MiB | ~60.4 MiB |
| Pure slim | none | 68.4 MiB | 51.0 MiB |
-The `skills,flows` recipe in
-[`docs/library-minimal-recipe.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/library-minimal-recipe.md) is
-the supported embed target for a headless host: it keeps SKILL.md execution
-and saved-workflow runs, drops voice, web3, media, MCP and the desktop
-automation stack, and lands about 30% smaller than the default build. Most of
-that gain is binary size and code-paging surface; it only moves settled RSS by
-about 3-5 MiB per scenario, since most of the RSS story is initialization and
-allocator behavior rather than linked code size.
+The `skills,flows` recipe in [`docs/library-minimal-recipe.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/library-minimal-recipe.md) is the supported embed target for a headless host. It keeps SKILL.md execution and saved-workflow runs, drops voice, web3, media, MCP and the desktop automation stack, and ends up about 30% smaller than the default build. Most of that gain is binary size and code-paging surface. It moves settled RSS by only about 3 to 5 MiB per scenario, because RSS depends more on initialization and allocator behavior than on linked code size.
-Do not describe this as a "15 MB binary." The smallest number on this page is
-15.2 MiB of private memory in a slim, running process; the smallest binary is
-51 MiB stripped with nothing enabled.
+Note that the smallest figure here, 15.2 MiB, is private memory in a slim running process. It is not a binary size. The smallest binary is 51 MiB stripped with nothing enabled.
## Feature gates and loadable modules
-Everything above compiles in at build time through Cargo features (`media`,
-`skills`, `flows`, `mcp`, `channels`, `http-server`, `scheduler-gate`,
-`file-logging`, `modules`, and more). Beyond that, several domains ship as
-loadable native `cdylib` modules rather than being 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: `tinycomputer`,
-`tinysearch`, `tinydocs`, `tinywallet`, `tinyjuice`, `tinyvoice`,
-`tinyruntime` with its Node and Python providers, `tinymcp`,
-`tinyconnectors`, `tinybox`, `tinychannels` and `tinyhosts`, each 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) for the whole model.
-
-## The kernel-floor ratchet
-
-`scripts/kernel-floor.sh` measures the dependency graph of the `flows`
-profile (`--no-default-features --features flows`, the surface a second host
-would embed) along three numbers: package count, unique crate names, and
-native (C/C++) build count. `scripts/kernel-floor.limits` holds the ceiling
-for each, and the ratchet only moves down: a change that grows the graph has
-to lower those numbers in the same PR, and raising one requires a written
-justification a reviewer actually reads. Read the current ceiling out of the
-file rather than from here; it moves, and the file keeps a dated history of
-every move inline. This
-is what stops the dependency floor silently growing back after each gating
-effort sheds crates from it.
+Cargo 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 dependency-floor ratchet
+
+`scripts/kernel-floor.sh` measures the dependency graph of the `flows` profile (`--no-default-features --features flows`, the surface a second host would embed) on three counts: packages, unique crate names and native (C/C++) builds. `scripts/kernel-floor.limits` holds the ceiling for each. The ratchet only moves down. A change that grows the graph must lower those numbers in the same PR, and raising one needs a written justification. Read the current ceiling from the file, because it changes. The ratchet stops the dependency floor from creeping back up after a gating effort sheds crates.
## How to reproduce
-Every number above comes from the driver scripts under `scripts/profile/`,
-built around `crates/openhuman-cli/src/bin/library_profile/main.rs`
-(scenario implementations) and the `library-profile` / `rss-bench` binaries.
-Benchmarks run from these scripts, not in CI.
+Every number above comes from the driver scripts under `scripts/profile/`. They are built around `crates/openhuman-cli/src/bin/library_profile/main.rs` (the scenarios) and the `library-profile` and `rss-bench` binaries. The benchmarks run from these scripts, not in CI.
```bash
# RSS/duration medians across fresh processes, all scenarios
@@ -158,26 +91,12 @@ Benchmarks run from these scripts, not in CI.
scripts/kernel-floor.sh flows
```
-`scripts/profile/README.md` documents the remaining scripts (`library-cpu.sh`
-for CPU profiling via samply, `library-heap.sh` for live-heap attribution via
-dhat). Full methodology, caveats, and the per-scenario breakdown live in
+`scripts/profile/README.md` documents the remaining scripts: `library-cpu.sh` for CPU profiling with samply and `library-heap.sh` for live-heap attribution with dhat. Full methodology, caveats and the per-scenario breakdown are in
[`docs/library-benchmarking.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/library-benchmarking.md) and
[`docs/library-minimal-recipe.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/library-minimal-recipe.md).
-## Measurement conditions, stated plainly
-
-These numbers were gathered on macOS, which has no cgroup memory limit to
-enforce locally and no `/proc/<pid>/smaps_rollup`, so there is no true PSS
-(proportional shared memory) reading available. RSS overcounts shared pages
-in a way that matters more as agent count grows. The fleet and instances
-numbers are a projection from measured marginal cost, not a live "did it
-survive an OOM kill at N agents" test on the target 2 GB / 2 vCPU Linux box.
-Every scenario also replaces network inference with a deterministic mock
-provider at a fixed latency, so turn timings measure orchestration overhead,
-not real model latency. Real Linux cgroup validation is documented follow-up
-work, not something this page claims already happened.
-
-For token-level cost rather than process footprint, see [Smart Token
-Compression](../features/token-compression.md), which is the other half of
-"cheap": it controls how much of what the harness assembles actually reaches
-the model.
+## Measurement conditions
+
+These numbers were gathered on macOS. It has no local cgroup memory limit and no `/proc/<pid>/smaps_rollup`, so there is no true PSS (proportional shared memory) reading. RSS overcounts shared pages, and the error grows with agent count. The fleet and instances numbers project from measured marginal cost. They are not a live test of surviving an OOM kill at N agents on a 2 GB / 2 vCPU Linux box. Every scenario also replaces network inference with a mock provider at fixed latency, so turn timings measure orchestration overhead, not real model latency. Validation under Linux cgroups has not been done yet.
+
+For token cost instead of process footprint, see [Smart token compression](../features/token-compression.md). It is the other half of "cheap": it controls how much of what the harness assembles reaches the model.
diff --git a/docs/gitbooks/en/developing/providers/claude-code.md b/docs/gitbooks/en/developing/providers/claude-code.md
new file mode 100644
index 0000000000..5645f65ea9
--- /dev/null
+++ b/docs/gitbooks/en/developing/providers/claude-code.md
@@ -0,0 +1,106 @@
+---
+description: >-
+ Route chat workloads through the Claude Code CLI.
+icon: terminal
+---
+
+# Claude Code CLI provider
+
+OpenHuman can send any chat workload through Anthropic's `claude` CLI instead of calling the Anthropic HTTP API directly. The CLI handles model selection, auth and prompt caching. OpenHuman runs it as a long-lived child process that resumes sessions, parses its stream-json output, and gives it an MCP endpoint so the model can reach OpenHuman state (memory, threads, agents, search). This is one of several pluggable LLM backends. See [Engines](../engines.md) for the full list.
+
+`tinyagents-harness` (vendor/tinyagents) owns the provider, `ClaudeCodeProvider`. See [its README](https://github.com/tinyhumansai/tinyagents/blob/main/crates/tinyagents-harness/src/providers/claude_code/README.md) for the file map and implementation notes. OpenHuman only wires it up in `crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs`, which supplies the MCP endpoint (`OpenHumanMcpEndpoint`, below) and reads the resulting model string back into its own routing.
+
+## Requirements
+
+- Claude Code CLI 2.0.0 or newer (`MIN_CLI_VERSION`). It can be on `PATH`, in a supported well-known install location, or selected with `OPENHUMAN_CLAUDE_CLI=/abs/path/to/claude`.
+- An Anthropic API key in `ANTHROPIC_API_KEY`, or an existing `~/.claude/.credentials.json` from `claude login`.
+- The `http-server` Cargo feature (on by default). OpenHuman exposes its MCP tools to the CLI over a loopback HTTP endpoint (`crate::mcp::server::ensure_local_http`), not by running `openhuman-core mcp` as a subprocess. Without that feature the provider still runs, but the CLI gets no OpenHuman tools.
+
+## Routing a workload through the CLI
+
+Use the provider prefix `claude-code:<model>[@<temperature>]`. Set it per role through the standard inference settings:
+
+```bash
+# Through the JSON-RPC update endpoint:
+openhuman-core rpc openhuman.inference_update_model_settings \
+ --json '{"chat_provider":"claude-code:claude-sonnet-4-5"}'
+```
+
+| Role string | Field updated |
+| -------------------- | -------------------------------- |
+| `chat_provider` | foreground chat replies |
+| `reasoning_provider` | long-context reasoning workloads |
+| `agentic_provider` | multi-step agentic loops |
+
+A workload set to `claude-code:<model>` starts a fresh `claude` child for every turn. Concurrency is capped at `MAX_CONCURRENT_TURNS = 4` per `ClaudeCodeProvider` instance (see [Per-turn behavior](#per-turn-behavior)).
+
+## Verifying the install
+
+The status RPC is in the inference namespace:
+
+```bash
+openhuman-core rpc openhuman.inference_claude_code_status
+```
+
+It returns one of these (`CliStatus` in [`tinyagents-harness`'s `claude_code/types.rs`](https://github.com/tinyhumansai/tinyagents/blob/main/crates/tinyagents-harness/src/providers/claude_code/types.rs)):
+
+- `{"status":"ok","version":"2.0.4","path":"/usr/local/bin/claude"}`: ready
+- `{"status":"not_installed"}`: no usable `claude` was found through the
+ configured override, `PATH`, or the supported fallback locations
+- `{"status":"outdated","version":"1.9.0","min_required":"2.0.0","path":"..."}`: upgrade the CLI
+- `{"status":"unusable","path":"...","reason":"..."}`: binary present but the version probe failed
+
+Binary lookup checks `OPENHUMAN_CLAUDE_CLI` first, then `PATH`, then the ordered fallback locations. The fallbacks cover the native installer and common user-local, Bun, npm-global and Homebrew installs. When the CLI is found through a fallback, its directory and the user bin directories are prepended to the child process `PATH`. The inherited entries stay available.
+
+The settings panel shows the same status through `ClaudeCodeStatusCard` ([`app/src/components/settings/panels/ai/ClaudeCodeStatusCard.tsx`](https://github.com/tinyhumansai/openhuman/blob/main/app/src/components/settings/panels/ai/ClaudeCodeStatusCard.tsx)).
+
+## Per-turn behavior
+
+`ClaudeCodeProvider::run_chat` takes one of `MAX_CONCURRENT_TURNS` (4) semaphore permits, plus a per-thread mutex so two overlapping calls for the same conversation cannot race on one session UUID. Each turn then:
+
+1. Resolves a per-thread session UUID from `<workspace_dir>/claude-code-sessions.json`. New threads get a fresh RFC 4122 v4 UUID, because the CLI requires v4 for `--resume`.
+2. Asks the host's `McpEndpointProvider` for an MCP endpoint. OpenHuman's implementation (`OpenHumanMcpEndpoint`) lazily starts one in-process HTTP MCP server per core (`crate::mcp::server::ensure_local_http`, loopback only) and returns its URL plus a bearer token. The config file passed with `--mcp-config` carries that token in its `Authorization` header. If the endpoint fails to start, the turn still runs, without OpenHuman tools.
+3. Spawns the CLI with:
+ - `-p --input-format stream-json --output-format stream-json --verbose --include-partial-messages --add-dir <project_dir>`
+ - `--mcp-config <scratch>/openhuman-mcp-config.json --strict-mcp-config` when the endpoint resolved, so only the configured MCP servers are visible
+ - `--permission-mode acceptEdits` (default) or `bypassPermissions` (full access, described below)
+ - by default, `--disallowedTools Bash,BashOutput,KillShell,WebFetch,WebSearch,Task`, so Claude Code's own shell, network and sub-agent builtins stay off and OpenHuman tools (`mcp__openhuman__*`) are the only way to reach those capabilities. This flag is omitted when full access is on
+ - `--session-id <uuid>` on the first turn, `--resume <uuid>` after that
+ - `--model <model>` (the suffix after `claude-code:`)
+ - `--append-system-prompt-file <scratch>/append-system-prompt.txt` if the conversation carries a system message. It is a file, not an argument, so a large harness prompt does not hit Windows' argument length limit
+4. Pipes stdin. A new session gets the full conversation history folded into a text preamble. A `--resume` gets only the pending user turns, because the CLI already holds the earlier context.
+5. Streams stdout through the JSONL parser, then the event mapper, into `ProviderDelta`s on the request's `stream` sink.
+
+If the CLI exits non-zero, the driver returns its stderr (capped at 16 KiB) as the error message.
+
+On macOS the spawn runs inside a Seatbelt jail (`sandbox-exec`) by default when `/usr/bin/sandbox-exec` exists. Set `OPENHUMAN_CLAUDE_CODE_SANDBOX=0` to opt out. The profile blocks reads and writes under the first `.openhuman*`-named ancestor of `workspace_dir`, which holds this provider's own session store and settings. It does not restrict the CLI's own file tools. Linux and Windows have no OS-level wall yet.
+
+### Permission posture and full access
+
+The default, `acceptEdits`, limits Claude Code to file reads and edits under `project_dir` and withholds shell, network and `Task` access through `--disallowedTools`. You can opt into full access (the whole Claude Code toolset, including Bash) with the settings toggle saved in `<workspace_dir>/claude_code_settings.json`, or with `OPENHUMAN_CLAUDE_CODE_PERMISSION_MODE=bypass|bypassPermissions|full`. This is an explicit choice. Enabling the provider alone never grants shell or network access.
+
+## Auth resolution order
+
+1. `ANTHROPIC_API_KEY` env var (highest precedence, set on the spawned child).
+2. `~/.claude/.credentials.json`: the CLI's own login from `claude login` (Pro or Max subscription). OpenHuman leaves `ANTHROPIC_API_KEY` unset on the child, so the CLI reads its own credentials. On macOS they live in the Keychain under the `Claude Code-credentials` service.
+3. Neither: the CLI fails with an auth error.
+
+The `openhuman.inference_claude_code_auth_status` RPC reports the richer state for the Settings > AI panel. It runs `claude auth status --json` with a 10-second timeout instead of reading the credentials file, because a macOS login lives in the Keychain, not on disk.
+
+## Tool surface exposed to the CLI
+
+The CLI sees these tools as `mcp__openhuman__<name>`, served over the loopback HTTP MCP endpoint described above. It is the same tool set that the stdio MCP server in [`crates/openhuman-core/src/mcp/server/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/mcp/server) exposes to other MCP clients:
+
+- `core.list_tools`, `core.tool_instructions`
+- `memory.recall`, `memory.fetch`, `memory.list`, `memory.learn`, `memory.forget`
+- `agent.list_subagents`, `agent.run_subagent` (write, flagged `destructiveHint` as the MCP spec requires)
+- `searxng_search`
+
+The MCP server enforces `SecurityPolicy::ToolOperation` checks. `agent.run_subagent`, `memory.learn` and `memory.forget` write. The rest are read-only. The CLI's own `tool_use` blocks (its internal Read, Bash and similar calls) never reach OpenHuman as harness tool calls, because the CLI has already run them by the time they appear in the stream. `event_mapper.rs` only strips their argument JSON from the visible text.
+
+## Limitations
+
+- Vision input is forwarded as native image blocks when pasted images are available to the Claude Code provider. Images that cannot be read are sent as a short text notice.
+- Every role routed to `claude-code:` shares the same `MAX_CONCURRENT_TURNS` semaphore; under load a turn waits in the queue instead of failing fast.
+- Cost accounting from the CLI's `result.total_cost_usd` is captured in the mapper but not yet wired into OpenHuman's cost tracking ([`crates/openhuman-core/src/platform/cost/`](https://github.com/tinyhumansai/openhuman/tree/main/crates/openhuman-core/src/platform/cost)).
+- Linux and Windows run the CLI unconfined; the Seatbelt jail is macOS-only.
diff --git a/docs/gitbooks/en/developing/quickstart.md b/docs/gitbooks/en/developing/quickstart.md
index e6e15eb657..d3655153bc 100644
--- a/docs/gitbooks/en/developing/quickstart.md
+++ b/docs/gitbooks/en/developing/quickstart.md
@@ -1,25 +1,25 @@
---
description: >-
- A step-by-step path from an empty Cargo project to many agents running on one
- OpenHuman runtime in your own Rust process.
+ Go from an empty Cargo project to many agents on one OpenHuman runtime in
+ your own Rust process.
icon: rocket
---
-# Rust Quickstart
+# Build agents in Rust: quickstart
-This page takes you from an empty Cargo project to a fleet of agents running in one process. Each step builds on the last and ends with code you can run. The full reference for every type used here is [Embedding OpenHuman](embedding.md).
+This page takes you from an empty Cargo project to a fleet of agents in one process. Each step builds on the last and ends with code you can run. [Embedding OpenHuman](embedding.md) is the full reference for every type used here.
## What you get
-`openhuman-embed` runs the OpenHuman core inside your binary. There is no daemon to start and no RPC hop: a turn is a function call. You build one `Runtime` per process, then create as many `Agent`s on it as you need. Each agent has its own model, access tier, working directory, MCP servers and skills.
+`openhuman-embed` runs the OpenHuman core inside your binary. There is no daemon to start and no RPC hop, so a turn is a function call. You build one `Runtime` per process, then create as many `Agent`s on it as you need. Each agent has its own model, access tier, working directory, MCP servers and skills.
-Sharing one process is where the density comes from. The fixed bootstrap cost is paid once, and each extra agent adds a marginal cost. With a mock inference provider, 500 agents in one process measured about 1.8 MiB of marginal memory each. Thousands of agents per box is the direction, not a measured result. The numbers and how to reproduce them are on the [Performance](performance.md) page.
+Sharing one process is where the density comes from. The bootstrap cost is paid once, and each extra agent adds a small marginal cost. With a mock inference provider, 500 agents in one process used about 1.8 MiB of marginal memory each. Thousands of agents per box is a goal, not a measured result. The numbers and how to reproduce them are on the [Performance](performance.md) page.
## Prerequisites
You need Rust 1.96.1 or newer, the version pinned in [`rust-toolchain.toml`](https://github.com/tinyhumansai/openhuman/blob/main/rust-toolchain.toml). You also need an API key for any OpenAI-compatible endpoint, or a TinyHumans API key (see step 6).
-If you depend on OpenHuman through Cargo as shown below, Cargo fetches the vendored submodules for you. If you build from a clone of the repository instead, initialize them first:
+If you depend on OpenHuman through Cargo as shown below, Cargo fetches the vendored submodules for you. If you build from a clone, initialize them first:
```bash
git submodule update --init --recursive vendor/
@@ -42,13 +42,13 @@ The default feature set is the contributor build. To ship less code, turn defaul
openhuman-embed = { git = "https://github.com/tinyhumansai/openhuman", package = "openhuman-embed", default-features = false, features = ["inference", "mcp"] }
```
-Cargo applies `[patch]` tables only from the top-level workspace, so the ones in OpenHuman's [root `Cargo.toml`](https://github.com/tinyhumansai/openhuman/blob/main/Cargo.toml) do not reach your crate. They make every crate share one copy of `tinytools` and `tinyinference`. If dependency resolution fails over those crates, or you see two incompatible `tinytools` types, add the same `[patch]` sections to your own workspace.
+Cargo applies `[patch]` tables only from the top-level workspace, so the ones in OpenHuman's [root `Cargo.toml`](https://github.com/tinyhumansai/openhuman/blob/main/Cargo.toml) do not reach your crate. They make every crate share one copy of `tinytools` and `tinyinference`. If dependency resolution fails over those crates, or you see two incompatible `tinytools` types, copy the same `[patch]` sections into your own workspace.
-Every feature forwards to the same-named feature on the core. `mcp` and `skills` also gate `AgentSpec::mcp` and `AgentSpec::skills_dir`, so enable them if your agents need those.
+Each feature forwards to the same-named feature on the core. `mcp` and `skills` also gate `AgentSpec::mcp` and `AgentSpec::skills_dir`, so enable them if your agents need those.
## Step 2: build the tokio runtime yourself
-Do not use `#[tokio::main]`. A turn is a large async state machine, and a sub-agent nested inside a turn overflows tokio's default 2 MiB worker stack, which aborts the process. Build the runtime with the stack size and blocking-thread limit the core exports:
+Do not use `#[tokio::main]`. A turn is a large async state machine, and a sub-agent nested inside a turn overflows tokio's default 2 MiB worker stack and aborts the process. Build the runtime with the stack size and blocking-thread limit that the core exports:
```rust
use openhuman_core::core::runtime::{AGENT_WORKER_STACK_BYTES, MAX_BLOCKING_THREADS};
@@ -97,7 +97,7 @@ async fn run() -> anyhow::Result<()> {
}
```
-Pass the API root as the URL; `/chat/completions` is appended for you. `Workspace::Ephemeral` is removed when the harness drops, so nothing touches an existing install. `Access::readonly()` allows no writes and no shell, which makes it safe to point at any directory.
+Pass the API root as the URL. `/chat/completions` is appended for you. `Workspace::Ephemeral` is removed when the harness drops, so nothing touches an existing install. `Access::readonly()` allows no writes and no shell, which makes it safe to point at any directory.
A complete runnable version, with progress streaming, is the [`run_turn` example](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/run_turn.rs):
@@ -110,7 +110,7 @@ OPENHUMAN_EXAMPLE_MODEL=gpt-5 \
## Step 4: many agents on one runtime
-When you need more than one agent, build the `Runtime` directly and create agents from `AgentSpec`s. This is what `Harness` does underneath, so moving to it later is a small change.
+When you need more than one agent, build the `Runtime` directly and create agents from `AgentSpec`s. `Harness` does this underneath, so moving over later is a small change.
```rust
use openhuman_embed::{Access, AgentSpec, Provider, Runtime, Workspace};
@@ -157,9 +157,9 @@ Agent ids must match `^[a-z0-9][a-z0-9_-]{0,63}$`. Avoid the built-in ids such a
The access tier is the main safety control:
-* `Access::readonly()` observes only.
-* `Access::supervised()` can act, but risky operations wait for a human decision. It turns the autonomy policy on for that agent, so an unattended process stalls at the first approval until the ten-minute timeout denies it.
-* `Access::full()` acts autonomously with real shell and file access under `action_dir`. Point it at a directory you are willing to have changed. Credential stores such as `~/.ssh` stay blocked regardless.
+- `Access::readonly()` observes only.
+- `Access::supervised()` can act, but risky operations wait for a human decision. It turns the autonomy policy on for that agent, so an unattended process stalls at the first approval until the ten-minute timeout denies it.
+- `Access::full()` acts autonomously with real shell and file access under `action_dir`. Point it at a directory you are willing to have changed. Credential stores such as `~/.ssh` stay blocked regardless.
`action_dir` is the agent's read and write root. `.trust(path, access)` grants a directory outside it.
@@ -209,7 +209,7 @@ The core awaits every send, so a receiver that stops draining stalls the turn. T
## Step 6: managed inference with one API key
-Instead of bringing a provider key for each agent, you can give the runtime a single TinyHumans API key. Agents that name no `Provider` then run on managed inference, and backend features such as integrations and search use the same key. See [One TinyHumans API key](tinyhumans-api-key.md) for what it unlocks.
+Instead of a provider key for each agent, you can give the runtime one TinyHumans API key. Agents that name no `Provider` then run on managed inference, and backend features such as integrations and search use the same key. See [One TinyHumans API key](tinyhumans-api-key.md) for what it unlocks.
`openhuman-embed` alone installs no backend transport, so hosted surfaces answer `BACKEND_UNAVAILABLE:`. To boot connected, use the `RuntimeBuilder` from `openhuman-tinyhumans`, which mirrors the embed builder and installs the transport on `build()`:
@@ -237,11 +237,11 @@ For a headless process that boots the core itself, set `OPENHUMAN_BACKEND_API_KE
A few rules keep a large fleet small and predictable:
-* Run one `Runtime` per process. A second `build()` returns `RuntimeError::AlreadyRunning`, because the keyring, event bus and domain subscribers are process-wide. Add agents, not runtimes.
-* Build narrow. A headless build with `--no-default-features --features "skills,flows"` is about 60 MiB stripped, against 115.9 MiB with every gate on. The recipe is in [`docs/library-minimal-recipe.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/library-minimal-recipe.md).
-* Narrow each agent. `.tool_groups(..)`, `.domains(..)`, `ToolScopeSpec::Named(..)` and `.disallow_tools(..)` cut prompt size and the surface an agent can reach.
-* Pick a sandbox mode per agent through `AgentDefinitionSpec`: `SandboxModeSpec::None`, `ReadOnly` (write and execute tools are removed) or `Sandboxed` (commands run in the platform jail or Docker).
-* For a cloud host serving many users from one process, use `Workspace::stateless()` with a `SessionStoreProvider` so conversations live in your own database. The embed crate README covers it under "Conversations in a host store".
+- Run one `Runtime` per process. A second `build()` returns `RuntimeError::AlreadyRunning`, because the keyring, event bus and domain subscribers are process-wide. Add agents, not runtimes.
+- Build narrow. A headless build with `--no-default-features --features "skills,flows"` is about 60 MiB stripped. With every gate on it is 115.9 MiB unstripped. The recipe is in [`docs/library-minimal-recipe.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/library-minimal-recipe.md).
+- Narrow each agent. `.tool_groups(..)`, `.domains(..)`, `ToolScopeSpec::Named(..)` and `.disallow_tools(..)` cut prompt size and the surface an agent can reach.
+- Pick a sandbox mode per agent through `AgentDefinitionSpec`: `SandboxModeSpec::None`, `ReadOnly` (write and execute tools are removed) or `Sandboxed` (commands run in the platform jail or Docker).
+- For a cloud host serving many users from one process, use `Workspace::stateless()` with a `SessionStoreProvider` so conversations live in your own database. The embed crate README covers it under "Conversations in a host store".
To measure your own numbers, the scripts and method are in [`docs/library-benchmarking.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/library-benchmarking.md). The public benchmark results and rig are in [openhuman-benchmarks](https://github.com/tinyhumansai/openhuman-benchmarks).
@@ -249,16 +249,16 @@ To measure your own numbers, the scripts and method are in [`docs/library-benchm
You do not have to embed the library to use the core.
-The JSON-RPC server runs the same core behind HTTP. Start it with `openhuman-core serve`; `GET /schema` lists every method, `GET /health` reports liveness, and `GET /events` streams events. The server lives in [`crates/openhuman-rpc`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-rpc/README.md).
+The JSON-RPC server runs the same core behind HTTP. Start it with `openhuman-core serve`. `GET /schema` lists every method, `GET /health` reports liveness and `GET /events` streams events. The server lives in [`crates/openhuman-rpc`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-rpc/README.md).
-The CLI is the `openhuman-core` binary, which exposes the same controllers as subcommands and is documented in [`crates/openhuman-cli`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-cli/README.md).
+The CLI is the `openhuman-core` binary. It exposes the same controllers as subcommands and is documented in [`crates/openhuman-cli`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-cli/README.md).
The terminal client is `openhuman-tui`, a ratatui front end that boots the core in its own process and drives the same chat surface as the desktop app. See [`crates/openhuman-tui`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-tui/README.md).
## Next steps
-* [Embedding OpenHuman](embedding.md) is the full reference for `AgentSpec`, `Access`, workspaces, MCP, skills and the examples.
-* [Architecture](architecture/architecture.md) and the [agent harness](architecture/agent-harness.md) explain how a turn runs.
-* [Loadable modules](loadable-modules.md) covers the module contracts the core composes.
-* [Pluggable engines](engines.md) covers the inference, memory and search backends an agent chooses by config.
-* [Performance and footprint](performance.md) has the measured density, cold-start and binary-size numbers.
+- [Embedding OpenHuman](embedding.md) is the full reference for `AgentSpec`, `Access`, workspaces, MCP, skills and the examples.
+- [Architecture](architecture.md) and the [agent harness](architecture/agent-harness.md) explain how a turn runs.
+- [Loadable modules](loadable-modules.md) covers the module contracts the core composes.
+- [Pluggable engines](engines.md) covers the inference, memory and search backends an agent chooses by config.
+- [Performance and footprint](performance.md) has the measured density, cold-start and binary-size numbers.
diff --git a/docs/gitbooks/en/developing/release-policy.md b/docs/gitbooks/en/developing/release-policy.md
index 7721f76e4d..96f8208d28 100644
--- a/docs/gitbooks/en/developing/release-policy.md
+++ b/docs/gitbooks/en/developing/release-policy.md
@@ -1,74 +1,78 @@
---
-description: Release cadence, version policy, OAuth-and-installer rules. How shipping works.
+description: How OpenHuman ships a release, with the branch model, CI lanes, minimum-version gate and key rotation.
icon: ship
---
-# Release Policy
+# Release policy
-This runbook describes how we avoid users completing OAuth (including Gmail) on outdated desktop installers while the canonical flow is the latest release.
+This runbook covers how releases ship. It also explains how we stop users from completing OAuth (including Gmail) on an outdated desktop installer when the latest release is the supported flow.
## Distribution
- GitHub Releases for [tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman/releases) are the primary source for desktop builds.
-- The Tauri updater endpoint (see `scripts/prepareTauriConfig.js` and release workflows) should point users at the current release artifacts.
-- Retiring old stable artifacts: When dropping a release line, remove or hide obsolete installer assets on GitHub Releases, update website / CDN download links to releases/latest (or current), refresh the updater manifest (e.g. Gist / `latest.json`) so it does not point users at deprecated builds, and spot-check that old direct URLs are redirected, 404, or 410 where appropriate. Verification: try known-old asset URLs from docs or bookmarks and confirm they no longer deliver primary install paths.
+- The Tauri updater endpoint (see `scripts/prepareTauriConfig.js` and the release workflows) should point users at the current release artifacts.
+- To retire old stable artifacts when you drop a release line:
+ - Remove or hide the obsolete installer assets on GitHub Releases.
+ - Point website and CDN download links at `releases/latest`.
+ - Refresh the updater manifest (for example a Gist or `latest.json`) so it does not point at deprecated builds.
+ - Check that old direct URLs redirect or return 404 or 410. Try known-old asset URLs from docs or bookmarks and confirm they no longer deliver a primary install path.
## Minimum app version for OAuth
-Production web builds embed a minimum supported app semver at build time so OAuth deep links cannot complete on deprecated binaries. Each installer carries the floor that was set when that build was produced; raising the floor for users who never upgrade requires a new release they install (or in-app update). Optional future work: enforce a moving minimum via a runtime API with the bundled value as fallback only.
+Production web builds embed a minimum supported app version at build time, so OAuth deep links cannot complete on deprecated binaries. Each installer carries the floor that was set when that build was made. Raising the floor for users who never upgrade needs a new release that they install, or an in-app update.
| Variable | Purpose |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
-| `VITE_MINIMUM_SUPPORTED_APP_VERSION` | e.g. `0.51.0` - desktop app must be ≥ this to finish `openhuman://oauth/success`. |
+| `VITE_MINIMUM_SUPPORTED_APP_VERSION` | For example `0.51.0`. The desktop app must be at least this version to finish `openhuman://oauth/success`. |
| `VITE_LATEST_APP_DOWNLOAD_URL` | Optional; defaults to `https://github.com/tinyhumansai/openhuman/releases/latest`. Opened when the gate blocks OAuth. |
-Configure these as GitHub Actions variables. They must be present on both the standalone `pnpm build` step and the `tauri-apps/tauri-action` step env in `.github/workflows/build-desktop.yml` (the reusable matrix invoked by `release-production.yml` / `release-staging.yml`) so the Vite bundle embedded in shipped installers includes the gate. Leave `VITE_MINIMUM_SUPPORTED_APP_VERSION` unset for local dev (gate disabled).
+Configure these as GitHub Actions variables. Set them on both the standalone `pnpm build` step and the `tauri-apps/tauri-action` step in `.github/workflows/build-desktop.yml` (the reusable matrix that `release-production.yml` and `release-staging.yml` call), so the Vite bundle in shipped installers includes the gate. Leave `VITE_MINIMUM_SUPPORTED_APP_VERSION` unset for local development, which disables the gate.
-Implementation: `app/src/utils/oauthAppVersionGate.ts`, `app/src/utils/desktopDeepLinkListener.ts`.
+The code is in `app/src/utils/oauthAppVersionGate.ts`, `app/src/utils/desktopDeepLinkListener.ts`.
## Gmail / Google Cloud OAuth
- Redirect URIs in Google Cloud Console must match the current backend + tunnel callback paths.
-- The desktop scheme (`openhuman://`) is stable; the installed binary must meet the minimum version when `VITE_MINIMUM_SUPPORTED_APP_VERSION` is set.
+- The desktop scheme (`openhuman://`) is stable. When `VITE_MINIMUM_SUPPORTED_APP_VERSION` is set, the installed binary must meet the minimum version.
-## Release checklist (avoid regressions)
+## Release checklist
1. Bump `app/package.json` and `crates/openhuman-app/tauri.conf.json` (and root `Cargo.toml` / core) per existing version workflows.
2. When dropping support for older installs, set `VITE_MINIMUM_SUPPORTED_APP_VERSION` to the new floor before or with that release (repo Actions variables + both workflow steps above).
3. Remove, redirect, or retire older stable installers and stale updater entries from user-facing surfaces (GitHub Release assets, website, CDN, updater feed). Confirm deprecated artifacts are not reachable from default install/update flows.
4. Smoke-test Gmail connect on a fresh install from releases/latest.
-5. Complete the [manual smoke checklist](https://github.com/tinyhumansai/openhuman/blob/main/docs/RELEASE-MANUAL-SMOKE.md), then paste the completed sign-off block (verbatim, with every checked item left checked) as a GitHub commit comment on the `v<version>-staging` tagged commit that QA validated (there is no release PR in the promotion flow). Before approving the production run, the `Release-Approval` required reviewer verifies (a) the sign-off comment exists on the staging-tagged commit and (b) the production run actually targets that validated content: pass the staging-tagged SHA as `commit_sha`, or confirm nothing but `[skip ci]` version-bump commits separate it from the run's target. Anything more than bump commits means new content QA never smoked: re-run staging first.
+5. Complete the [manual smoke checklist](https://github.com/tinyhumansai/openhuman/blob/main/docs/RELEASE-MANUAL-SMOKE.md). Then paste the completed sign-off block, verbatim with every checked item left checked, as a GitHub commit comment on the `v<version>-staging` tagged commit that QA validated. The promotion flow has no release PR. Before approving the production run, the `Release-Approval` reviewer checks two things. First, the sign-off comment exists on the staging-tagged commit. Second, the production run targets that validated content: either pass the staging-tagged SHA as `commit_sha`, or confirm that only `[skip ci]` version-bump commits separate it from the run's target. Anything more is new content QA never smoked, so re-run staging first.
## Branch model and CI lanes
Two long-lived branches, two CI lanes:
-- `main`: where all feature/fix PRs land. Every PR runs CI Fast ([`ci-fast.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/ci-fast.yml)), with quality checks and complete unit-test suites for changed areas, gated at ≥ 80% diff coverage.
-- `release`: a maintainer-promoted snapshot of `main` that releases are cut from. PRs targeting `release` and every push to `release` run CI Full ([`ci-full.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/ci-full.yml)): complete unit suites, Rust mock-backend E2E, Playwright web E2E, and desktop E2E on Linux. macOS and Windows desktop E2E are a manual dispatch whose inputs default to off until a native driver lands for each, so cross-platform desktop signal is opt-in rather than part of the matrix. The `CI Full Gate` check aggregates every lane except the Playwright spec run, which is non-blocking signal for now (`continue-on-error`, flaky under CI contention, #3615): a green gate does not prove Playwright specs passed, so check that lane's result in the run before cutting. Only the Playwright artifact _build_ is gated.
+- `main`: where all feature and fix PRs land. Every PR runs CI Fast ([`ci-fast.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/ci-fast.yml)), with quality checks and full unit-test suites for changed areas, gated at 80% diff coverage or more.
+- `release`: a maintainer-promoted snapshot of `main` that releases are cut from. PRs targeting `release` and every push to `release` run CI Full ([`ci-full.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/ci-full.yml)): complete unit suites, Rust mock-backend E2E, Playwright web E2E, and desktop E2E on Linux. macOS and Windows desktop E2E are manual dispatches that default to off until a native driver exists for each, so cross-platform desktop signal is opt-in. The `CI Full Gate` check aggregates every lane except the Playwright spec run. That run is non-blocking for now (`continue-on-error`, because it is flaky under CI contention), so a green gate does not prove the Playwright specs passed. Check that lane's result before cutting. Only the Playwright artifact build is gated.
The cycle:
-1. A maintainer dispatches [`promote-main-to-release.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/promote-main-to-release.yml), which pushes a merge commit from `main` into `release` (no PR). Re-dispatching refreshes `release` with main's latest while preserving fix commits already on `release`; when `release` already contains `main` it's a no-op.
-2. CI Full runs on the promotion push. If it finds breakage, anyone with write access opens a fix PR directly against `release`; fix PRs run both lanes (CI Fast for quick lint and coverage feedback, CI Full as the merge-blocking `CI Full Gate` check), and the post-merge push re-runs CI Full on the merge result.
-3. Once CI Full is green on `release` HEAD, cut production with `release-production.yml`. Staging may instead be dispatched from `main` when QA needs to validate main before promotion. The release workflows do not query or enforce the `CI Full Gate`; operators verify the relevant CI evidence before cutting.
-4. A cut sourced from `release` back-merges `release` into `main` (`scripts/release/merge-release-into-main.sh`: fast-forward when possible, else a versioned merge commit such as `chore(release): merge release v1.2.4 back into main`), so bump commits and fix commits flow back. A staging cut sourced from `main` needs no back-merge. Version-bump commits carry `[skip ci]`.
+1. A maintainer dispatches [`promote-main-to-release.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/promote-main-to-release.yml), which pushes a merge commit from `main` into `release` with no PR. Re-dispatching refreshes `release` with the latest `main` and keeps fix commits already on `release`. If `release` already contains `main`, it does nothing.
+2. CI Full runs on the promotion push. If it finds breakage, anyone with write access opens a fix PR directly against `release`. Fix PRs run both lanes: CI Fast for quick lint and coverage feedback, and CI Full as the merge-blocking `CI Full Gate` check. The post-merge push re-runs CI Full on the merge result.
+3. Once CI Full is green on `release` HEAD, cut production with `release-production.yml`. You can dispatch staging from `main` instead when QA needs to validate `main` before promotion. The release workflows do not check the `CI Full Gate`, so operators must verify the CI evidence before cutting.
+4. A cut from `release` back-merges `release` into `main` with `scripts/release/merge-release-into-main.sh`. It fast-forwards when it can, and otherwise makes a versioned merge commit such as `chore(release): merge release v1.2.4 back into main`. Bump and fix commits flow back that way. A staging cut from `main` needs no back-merge. Version-bump commits carry `[skip ci]`.
-Required GitHub settings for this model (repo Settings → Rules): `main` requires the `PR CI Gate` status check on PRs; `release` requires PRs for non-bypass actors with the `CI Full Gate` status check required (it runs on PRs targeting release); the release GitHub App's identity sits on the bypass list of both rulesets so the promote/release workflows can push directly.
+Required GitHub settings for this model (repo Settings > Rules): `main` requires the `PR CI Gate` status check on PRs; `release` requires PRs for non-bypass actors with the `CI Full Gate` status check required (it runs on PRs targeting release); the release GitHub App is on the bypass list of both rulesets so the promote and release workflows can push directly.
-## Workflows: staging vs. production
+## Workflows: staging and production
-Two first-class GitHub Actions workflows, one per environment. Pick by intent rather than toggling a flag. Staging follows the selected `main` or `release` dispatch ref; production always checks out `release`, regardless of the dispatch ref shown by GitHub's workflow UI.
+There is one GitHub Actions workflow per environment. Pick by intent instead of toggling a flag. Staging follows the selected `main` or `release` dispatch ref; production always checks out `release`, regardless of the dispatch ref shown by GitHub's workflow UI.
| Workflow | Branch | Bumps | Tags pushed | Concurrency group | Use when |
| -------------------------------------------------------------------------- | ------------------- | -------------------------------------------------- | -------------------- | -------------------- | --------------------------------------------------------------------------------------- |
| [`release-staging.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/release-staging.yml) | `main` or `release` | `patch` only | `v<version>-staging` | `release-staging` | Cutting a staging build for QA from the selected branch. |
| [`release-production.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/release-production.yml) | `release` | `patch` / `minor` / `major` (`release_type` input) | `v<version>` | `release-production` | Shipping a production release from validated `release` HEAD (or a pinned `commit_sha`). |
-The matrix build / sign / Sentry-DIF / artifact-upload pipeline used by both flows lives in [`.github/workflows/build-desktop.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/build-desktop.yml) as a `workflow_call` reusable workflow. The two top-level workflows above own ref resolution, version bumping, tagging, and publish/cleanup; the build itself is shared.
+The build, sign, Sentry debug-file and artifact-upload pipeline that both flows use lives in [`.github/workflows/build-desktop.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/build-desktop.yml) as a reusable `workflow_call` workflow. The two workflows above own ref resolution, version bumping, tagging, and publish and cleanup. The build itself is shared.
### Android / Google Play
-Android releases are handled by the separate [`.github/workflows/android-compile.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/android-compile.yml) workflow, which builds a release Android App Bundle (`.aab`), signs it with the Play upload key, and uploads it to Google Play when publishing is enabled. The workflow keeps the unsigned and signed AABs as Actions artifacts for audit/debugging.
+Android releases are handled by the separate [`.github/workflows/android-compile.yml`](https://github.com/tinyhumansai/openhuman/blob/main/.github/workflows/android-compile.yml) workflow. It builds a release Android App Bundle (`.aab`), signs it with the Play upload key, and uploads it to Google Play when publishing is enabled. The unsigned and signed AABs stay as Actions artifacts for audit and debugging.
Manual Android uploads use the same workflow:
@@ -94,57 +98,56 @@ Optional GitHub Actions variables:
| `ANDROID_PLAY_TRACK` | `internal` | Play track to upload to (`internal`, `alpha`, `beta`, or `production`). |
| `ANDROID_PLAY_STATUS` | `completed` | Play release status (`completed`, `draft`, `inProgress`, `halted`). |
-Google Play requires each upload to use a monotonically increasing Android `versionCode`. The release bump scripts update `app/src-tauri-mobile/tauri.conf.json`, `app/src-tauri-mobile/Cargo.toml`, and `app/src-tauri-mobile/Cargo.lock` alongside desktop files so the generated Android `tauri.properties` moves with each release.
+Google Play requires each upload to use a higher Android `versionCode` than the last. The release bump scripts update `app/src-tauri-mobile/tauri.conf.json`, `app/src-tauri-mobile/Cargo.toml` and `app/src-tauri-mobile/Cargo.lock` with the desktop files, so the generated Android `tauri.properties` moves with each release.
### Cutting a staging build
-1. Run Release (Staging) via `workflow_dispatch` from `release` (optionally pinning a release-reachable `commit_sha`; `create_tag = false` bumps + commits without tagging or building).
+1. Run Release (Staging) via `workflow_dispatch` from `release` (optionally pinning a release-reachable `commit_sha`). `create_tag = false` bumps and commits without tagging or building.
2. The workflow bumps `patch` on `release`, commits `chore(staging): vX.Y.Z [skip ci]`, pushes, and creates an immutable `vX.Y.Z-staging` tag at that commit.
-3. Build matrix runs from the tag (not release HEAD), so reruns rebuild byte-identical content even if `release` has moved on.
+3. The build matrix runs from the tag, not `release` HEAD, so reruns rebuild identical content even if `release` has moved on.
4. The bump commit (and anything else on `release`) is merged back into `main`.
-5. On failure the staging tag is auto-deleted; the bump commit on `release` stays so the next cut continues from `vX.Y.(Z+1)`.
+5. On failure the staging tag is deleted automatically. The bump commit on `release` stays, so the next cut continues from `vX.Y.(Z+1)`.
-There is no separate `staging` branch: staging cuts and production releases both live on `release`. The two are distinguished only by tag suffix (`-staging` vs none) and by which workflow created the tag.
+There is no separate `staging` branch. Staging cuts and production releases both live on `release`, and only the tag suffix (`-staging` or none) and the workflow that made the tag tell them apart.
### Shipping a production release
1. Run Release Production via `workflow_dispatch` with the desired `release_type` (`patch` / `minor` / `major`), from `release` HEAD or a pinned release-reachable `commit_sha`.
-2. The run first parks on the `review-approval` job (`environment: Release-Approval`); a [required reviewer](#release-app-token-approval-gate-and-rotation) must approve before anything is pushed. Only after approval does `prepare-build` run the bump-and-tag path: bump on `release`, commit `chore(release): vX.Y.Z [skip ci]`, push, tag `vX.Y.Z`, build, publish.
+2. The run first waits on the `review-approval` job (`environment: Release-Approval`). A [required reviewer](#release-app-token-approval-gate-and-rotation) must approve before anything is pushed. Then `prepare-build` bumps the version on `release`, commits `chore(release): vX.Y.Z [skip ci]`, pushes, tags `vX.Y.Z`, builds and publishes.
3. `release` is merged back into `main` right after the cut.
### Tag policy and rollback
-- **Naming.** Staging tags use the SemVer pre-release suffix `-staging` (`v1.2.4-staging`) so they sort _before_ the matching production tag.
-- **Collisions.** Both workflows fail fast if the target tag already exists locally or on `origin`. Resolve by deleting the stale tag (org maintainers only) or bumping past it.
-- **Rollback (production).** A failed build matrix triggers `cleanup-failed-release`, which deletes both the draft GitHub Release and the `v<version>` tag.
-- **Rollback (staging).** A failed staging build deletes the `v<version>-staging` tag. The bump commit on the selected source branch is left in place; the next staging cut continues from the new patch number rather than re-using it (we accept a small "gap" in patch numbers over racing with concurrent merges).
-- **Who can delete tags.** Same write-access as `main`. Workflow-driven cleanup deletes run with the workflow's token via `actions/github-script` (the GitHub App token is only used by `prepare-build` for the bump commit + tag push); manual deletes (`git push --delete origin <tag>`) require equivalent maintainer permissions.
+- Naming: staging tags use the SemVer pre-release suffix `-staging` (`v1.2.4-staging`), so they sort before the matching production tag.
+- Collisions: both workflows fail fast if the target tag already exists locally or on `origin`. Delete the stale tag (org maintainers only) or bump past it.
+- Production rollback: a failed build matrix triggers `cleanup-failed-release`, which deletes the draft GitHub Release and the `v<version>` tag.
+- Staging rollback: a failed staging build deletes the `v<version>-staging` tag. The bump commit on the source branch stays. The next staging cut continues from the new patch number, which leaves a small gap in patch numbers instead of racing concurrent merges.
+- Deleting tags: you need the same write access as `main`. Workflow cleanup runs with the workflow's token through `actions/github-script`. The GitHub App token is used only by `prepare-build` for the bump commit and tag push. Manual deletes (`git push --delete origin <tag>`) need equivalent maintainer permissions.
## Release App token: approval gate and rotation
-`release-production.yml` bumps the version, commits to `release` and back-merges into `main`, pushing those commits + tag with a GitHub App token (`secrets.XGITHUB_APP_ID` / `secrets.XGITHUB_APP_PRIVATE_KEY`) that bypasses branch protection. The same App pushes staging bumps to the selected `main` or `release` source (`release-staging.yml`) and promotion merge commits (`promote-main-to-release.yml`). A leaked private key (via a log, a compromised action, or a misconfigured runner) would let an attacker push arbitrary commits to protected branches ([CWE-250: Execution with Unnecessary Privileges](https://cwe.mitre.org/data/definitions/250.html)). Two controls bound that blast radius.
+`release-production.yml` bumps the version, commits to `release` and back-merges into `main`, pushing those commits and the tag with a GitHub App token (`secrets.XGITHUB_APP_ID` / `secrets.XGITHUB_APP_PRIVATE_KEY`) that bypasses branch protection. The same App pushes staging bumps to the selected `main` or `release` source (`release-staging.yml`) and promotion merge commits (`promote-main-to-release.yml`). A leaked private key (through a log, a compromised action or a misconfigured runner) would let an attacker push arbitrary commits to protected branches ([CWE-250](https://cwe.mitre.org/data/definitions/250.html)). Two controls limit the damage.
### Manual approval gate
The `review-approval` job runs before `prepare-build` and parks every production run on the `Release-Approval` GitHub environment, so a human must approve before any push happens.
-One-time setup (repo Settings → Environments):
+One-time setup (repo Settings > Environments):
-1. Create an environment named `Release-Approval` (exact name: the workflow references it verbatim).
-2. Under Deployment protection rules, enable Required reviewers and add the maintainers allowed to authorize a production push to `main`. A reviewer cannot approve their own run unless _Prevent self-review_ is left off; for a release gate, keeping a second approver is preferred.
-3. (Optional) Set a short wait timer of 0. The gate is a human decision, not a delay.
+1. Create an environment named `Release-Approval` (the exact name, because the workflow references it verbatim).
+2. Under Deployment protection rules, enable Required reviewers and add the maintainers allowed to authorize a production push to `main`. A reviewer cannot approve their own run unless Prevent self-review is off. For a release gate, keep it on so a second person approves.
+3. Optionally set the wait timer to 0. The gate is a human decision, not a delay.
-When a production run starts it shows "Waiting" on the `review-approval` job; an approver opens the run and clicks Review deployments → Approve. Rejecting (or cancelling) leaves `prepare-build` skipped, so nothing is pushed.
+When a production run starts, the `review-approval` job shows "Waiting". An approver opens the run and clicks Review deployments > Approve. Rejecting or cancelling skips `prepare-build`, so nothing is pushed.
### Quarterly key rotation
-Rotate `XGITHUB_APP_PRIVATE_KEY` every quarter (and immediately on any suspected exposure). Schedule: end of Mar / Jun / Sep / Dec.
+Rotate `XGITHUB_APP_PRIVATE_KEY` every quarter (and immediately on any suspected exposure). Do it at the end of March, June, September and December.
-1. In the GitHub App settings (Org → Settings → Developer settings → GitHub Apps → the release App), under Private keys click Generate a private key. Download the new `.pem`.
-2. Update the repo secret: Settings → Secrets and variables → Actions → `XGITHUB_APP_PRIVATE_KEY` → paste the full new key (including the `-----BEGIN/END-----` lines). `XGITHUB_APP_ID` is unchanged.
-3. Trigger a low-risk verification run (e.g. Release (Staging)) and confirm the Generate GitHub App token step succeeds and the push authenticates.
- Do not use Release Production for this check unless you intentionally want to cut a real bump commit: even with `create_release = false`, `prepare-build` still bumps the version and commits to `release` (staging with `create_tag = false` does too, but skips the tag/build and is the lower-risk probe).
-4. Back in App settings → Private keys, delete the old key so only the freshly-issued one remains valid.
-5. Record the rotation date in the PR description or the ops log so the next quarter's owner can see when it last happened.
+1. In the GitHub App settings (Org > Settings > Developer settings > GitHub Apps > the release App), under Private keys click Generate a private key. Download the new `.pem`.
+2. Update the repo secret: Settings > Secrets and variables > Actions > `XGITHUB_APP_PRIVATE_KEY`, then paste the full new key (including the `-----BEGIN/END-----` lines). `XGITHUB_APP_ID` is unchanged.
+3. Trigger a low-risk verification run, such as Release (Staging), and confirm the Generate GitHub App token step succeeds and the push authenticates. Do not use Release Production for this unless you mean to cut a real bump commit. Even with `create_release = false`, `prepare-build` still bumps the version and commits to `release`. Staging with `create_tag = false` also commits but skips the tag and build, so it is the lower-risk probe.
+4. Back in the App settings under Private keys, delete the old key so only the freshly-issued one remains valid.
+5. Record the rotation date in the PR description or the ops log so the next owner can see when it last happened.
-Rotating invalidates any copy of the old key that may have leaked, capping the exposure window at one quarter.
+Rotating invalidates any leaked copy of the old key, which caps the exposure window at one quarter.
diff --git a/docs/gitbooks/en/developing/testing-strategy.md b/docs/gitbooks/en/developing/testing-strategy.md
index 7fb7a255b8..11444341cf 100644
--- a/docs/gitbooks/en/developing/testing-strategy.md
+++ b/docs/gitbooks/en/developing/testing-strategy.md
@@ -1,11 +1,11 @@
---
-description: How OpenHuman tests its product - Vitest, cargo test, WDIO E2E. Where each test goes.
+description: How OpenHuman tests its product with Vitest, cargo test and WDIO E2E, and where each kind of test goes.
icon: vial
---
-# Testing Strategy
+# Testing strategy
-How OpenHuman tests its product. Source of truth for "where does my test go?". Companion to [`TEST-COVERAGE-MATRIX.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/TEST-COVERAGE-MATRIX.md).
+This page answers "where does my test go?". It is the companion to [`TEST-COVERAGE-MATRIX.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/TEST-COVERAGE-MATRIX.md).
---
@@ -13,15 +13,15 @@ How OpenHuman tests its product. Source of truth for "where does my test go?". C
| Layer | Where it lives | What it tests | Driver |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
-| **Rust unit** | Sibling `<module>_tests.rs` files beside the module under `crates/openhuman-core/src/<domain>/`, or a `tests/` subdir under a domain (e.g. `crates/openhuman-core/src/channels/tests/`); inline `#[cfg(test)] mod` blocks and files named `tests.rs`/`test.rs` fail `pnpm rust:layout` | Pure domain logic, schemas, RPC handler shape, in-memory state machines | `cargo test` |
-| **Rust integration** | `tests/*.rs` at repo root, each an explicit `[[test]]` target in `crates/openhuman-cli/Cargo.toml` (`autotests = false`); `tests/raw_coverage/*.rs` is globbed by `build.rs` into the single `raw_coverage_all` target | Full domain wiring with real Tokio runtime, mock external services, JSON-RPC end-to-end (`tests/json_rpc_e2e.rs`), domain × domain interactions | `pnpm test:rust` (which calls `bash scripts/test-rust-with-mock.sh`) |
-| **Vitest unit** | Co-located as `*.test.ts(x)` next to source under `app/src/**`, or under `app/src/**/__tests__/` | React components, hooks, store slices, pure utilities, service-layer adapters | `pnpm test` (root) or `pnpm --filter openhuman-app test:unit` |
-| **WDIO E2E** | `app/test/e2e/specs/*.spec.ts` | Full desktop flow: UI → Tauri → in-process core → JSON-RPC; user-visible behaviour | All platforms: Linux CI drives the Wry-based debug build (macOS/Windows desktop E2E is disabled until a native driver lands, #5485). See [E2E Testing](e2e-testing.md). |
-| **Manual smoke** | [`docs/RELEASE-MANUAL-SMOKE.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/RELEASE-MANUAL-SMOKE.md) | OS-level surfaces drivers cannot assert: TCC permission prompts, Gatekeeper, code signing, DMG install, OS-native toasts | Human at release-cut; the completed sign-off block is pasted as a GitHub commit comment on the `v<version>-staging` tagged commit QA validated. There is no release PR in the promotion flow, see [Release Policy](release-policy.md) |
+| Rust unit | Sibling `<module>_tests.rs` files beside the module under `crates/openhuman-core/src/<domain>/`, or a `tests/` subdir under a domain (e.g. `crates/openhuman-core/src/channels/tests/`); inline `#[cfg(test)] mod` blocks and files named `tests.rs`/`test.rs` fail `pnpm rust:layout` | Pure domain logic, schemas, RPC handler shape, in-memory state machines | `cargo test` |
+| Rust integration | `tests/*.rs` at repo root, each an explicit `[[test]]` target in `crates/openhuman-cli/Cargo.toml` (`autotests = false`); `tests/raw_coverage/*.rs` is globbed by `build.rs` into the single `raw_coverage_all` target | Full domain wiring with real Tokio runtime, mock external services, JSON-RPC end-to-end (`tests/json_rpc_e2e.rs`), domain × domain interactions | `pnpm test:rust` (which calls `bash scripts/test-rust-with-mock.sh`) |
+| Vitest unit | Co-located as `*.test.ts(x)` next to source under `app/src/**`, or under `app/src/**/__tests__/` | React components, hooks, store slices, pure utilities, service-layer adapters | `pnpm test` (root) or `pnpm --filter openhuman-app test:unit` |
+| WDIO E2E | `app/test/e2e/specs/*.spec.ts` | Full desktop flow: UI → Tauri → in-process core → JSON-RPC; user-visible behavior | All platforms: Linux CI drives the Wry-based debug build (macOS and Windows desktop E2E is disabled until a native driver exists). See [E2E testing](e2e-testing.md). |
+| Manual smoke | [`docs/RELEASE-MANUAL-SMOKE.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/RELEASE-MANUAL-SMOKE.md) | OS-level surfaces drivers cannot assert: TCC permission prompts, Gatekeeper, code signing, DMG install, OS-native toasts | Human at release-cut; the completed sign-off block is pasted as a GitHub commit comment on the `v<version>-staging` tagged commit QA validated. The promotion flow has no release PR. See [Release policy](release-policy.md) |
---
-## Decision tree - where does my test go?
+## Where does my test go?
```text
Is the change behind the JSON-RPC boundary (in `crates/openhuman-core/src/`, `crates/openhuman-rpc/`, or `crates/openhuman-embed/`)?
@@ -37,13 +37,13 @@ Is the change behind the JSON-RPC boundary (in `crates/openhuman-core/src/`, `cr
└─ YES → Manual smoke checklist
```
-If a change touches more than one of these, write a test in **each** layer it touches. Don't substitute one for another.
+If a change touches more than one layer, write a test in each layer it touches. Do not substitute one for another.
---
## Failure-path requirement
-Every feature leaf in the coverage matrix must have **at least one failure / edge** assertion in addition to the happy path. Examples:
+Every feature in the coverage matrix needs at least one failure or edge assertion as well as the happy path. Examples:
- File-write tool: happy = wrote bytes; failure = path-restriction denial.
- OAuth flow: happy = token issued; edge = expired refresh token recovery.
@@ -55,47 +55,47 @@ A spec that asserts only the happy path is incomplete.
## Mock policy
-- **No real network in unit / integration / E2E.** Use the shared mock backend (`scripts/mock-api-core.mjs`, `scripts/mock-api-server.mjs`, `app/test/e2e/mock-server.ts`).
+- 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`).
- Admin endpoints for tests: `GET /__admin/health`, `POST /__admin/reset`, `POST /__admin/behavior`, `GET /__admin/requests`.
-- **External services** (Telegram, Slack, Gmail, Notion, Ollama, OpenAI, etc.) are stubbed at the mock backend level; tests assert the request shape via `getRequestLog()`.
+- External services (Telegram, Slack, Gmail, Notion, Ollama, OpenAI and others) are stubbed at the mock backend level; tests assert the request shape via `getRequestLog()`.
- The only acceptable exception is a documented release-cut manual smoke step.
---
## Determinism rules
-- No wall-clock waits, use `waitForApp`, `waitForAppReady`, `waitForWebView` helpers, or explicit element-readiness predicates.
-- No shared filesystem state, every E2E spec runs inside an isolated `OPENHUMAN_WORKSPACE` (created/cleaned by `app/scripts/e2e-run-spec.sh`).
-- No order-dependent specs, each spec must pass when run alone.
+- No wall-clock waits. Use the `waitForApp`, `waitForAppReady` and `waitForWebView` helpers, or explicit element-readiness checks.
+- No shared filesystem state. Every E2E spec runs in an isolated `OPENHUMAN_WORKSPACE`, created and cleaned by `app/scripts/e2e-run-spec.sh`.
+- No order-dependent specs. Each spec must pass when run alone.
- No reliance on absolute coordinates or animation timing.
-- Prefer synthesizing keyboard input via `browser.execute(...)` over `browser.keys()` (see `command-palette.spec.ts` for the pattern).
+- Prefer synthesizing keyboard input with `browser.execute(...)` over `browser.keys()`. See `command-palette.spec.ts` for the pattern.
---
## What the existing harness gives you
-- **Mock backend bootstrapping**: `startMockServer` / `stopMockServer` in `app/test/e2e/mock-server.ts`.
-- **Auth shortcut**: `triggerAuthDeepLink` / `triggerAuthDeepLinkBypass` in `helpers/deep-link-helpers.ts` skips real OAuth.
-- **Element helpers**: `clickNativeButton`, `waitForWebView`, `clickToggle` in `helpers/element-helpers.ts`, use these instead of raw `XCUIElementType*` selectors.
-- **Shared flows**: `completeOnboardingIfVisible`, `navigateViaHash`, `navigateToSkills`, `walkOnboarding` in `helpers/shared-flows.ts`.
-- **Core RPC from spec**: `callOpenhumanRpc` in `helpers/core-rpc.ts`, drives the embedded core directly when a UI step would be brittle.
-- **Platform guards**: `isTauriDriver` and `supportsExecuteScript` in `helpers/platform.ts`. Desktop E2E runs the debug binary under Xvfb through `tauri-driver` on Linux; the Appium Chromium-driver backend went away with CEF, and macOS and Windows have no automated desktop session yet.
-- **Artifact capture on failure**: `captureFailureArtifacts` runs from `wdio.conf.ts`, screenshots + DOM dumps land under `app/test/e2e/artifacts/`.
+- Mock backend: `startMockServer` and `stopMockServer` in `app/test/e2e/mock-server.ts`.
+- Auth shortcut: `triggerAuthDeepLink` and `triggerAuthDeepLinkBypass` in `helpers/deep-link-helpers.ts` skip real OAuth.
+- Element helpers: `clickNativeButton`, `waitForWebView` and `clickToggle` in `helpers/element-helpers.ts`. Use these instead of raw `XCUIElementType*` selectors.
+- Shared flows: `completeOnboardingIfVisible`, `navigateViaHash`, `navigateToSkills` and `walkOnboarding` in `helpers/shared-flows.ts`.
+- Core RPC from a spec: `callOpenhumanRpc` in `helpers/core-rpc.ts` drives the embedded core directly when a UI step would be brittle.
+- Platform guards: `isTauriDriver` and `supportsExecuteScript` in `helpers/platform.ts`. Desktop E2E runs the debug binary under Xvfb through `tauri-driver` on Linux. macOS and Windows have no automated desktop session yet.
+- Artifact capture on failure: `captureFailureArtifacts` runs from `wdio.conf.ts`, and screenshots and DOM dumps land under `app/test/e2e/artifacts/`.
---
-## Naming + structure conventions
+## Naming and structure
- WDIO specs: `<feature-area>-flow.spec.ts` for end-to-end product flows; `<feature>.spec.ts` for narrower surfaces.
- Vitest co-location: prefer `Component.tsx` + `Component.test.tsx` siblings; use `__tests__/` only when grouping multiple related tests.
- Rust integration tests: snake_case file matching the surface, `<feature>_e2e.rs` for JSON-RPC-driven flows, `<feature>_integration.rs` for cross-domain.
-- Each `describe` / `mod tests` block maps to a feature-list ID range, link the matrix row in a comment if the mapping is non-obvious.
+- Each `describe` block maps to a feature-list ID range. Link the matrix row in a comment if the mapping is not obvious.
---
## Pre-merge gates
-Run before opening a PR. CI runs the same set, but local runs are faster:
+Run these before opening a PR. CI runs the same set, but local runs are faster:
```bash
# Rust core
@@ -116,25 +116,25 @@ pnpm test # vitest, via the app workspace
# Rust integration with mock backend
pnpm test:rust
-# E2E (slow - run when behaviour changes user-visibly)
+# E2E (slow, run when behavior changes visibly to users)
pnpm --filter openhuman-app test:e2e:build
bash app/scripts/e2e-run-spec.sh test/e2e/specs/<your-spec>.spec.ts <id>
```
---
-## Not driver-automatable - manual smoke required
+## Manual smoke checks
-Some surfaces cannot be driven by WDIO / Appium because they cross OS-level trust boundaries or hardware paths. The complete checklist + sign-off block lives in [`docs/RELEASE-MANUAL-SMOKE.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/RELEASE-MANUAL-SMOKE.md), that file is the source of truth for what must be verified per release. Examples of what it covers:
+WDIO and Appium cannot drive some surfaces, because they cross OS-level trust boundaries or hardware paths. [`docs/RELEASE-MANUAL-SMOKE.md`](https://github.com/tinyhumansai/openhuman/blob/main/docs/RELEASE-MANUAL-SMOKE.md) holds the full checklist and sign-off block. It is the source of truth for what to verify per release. It covers items such as:
- macOS TCC permission prompts (Accessibility, Input Monitoring, Microphone)
- Gatekeeper signature validation on first launch
- Code-sign integrity (`codesign --verify --deep --strict`)
-- DMG install / drag-to-Applications flow
-- Auto-update download + relaunch
-- OS-native notification toasts on Linux (no display server visible to the driver beyond Xvfb)
+- DMG install and drag-to-Applications flow
+- Auto-update download and relaunch
+- OS-native notification toasts on Linux (the driver sees no display server beyond Xvfb)
-If a feature has no automated coverage AND is not on the manual smoke list, treat it as untested, open a coverage gap.
+If a feature has no automated coverage and is not on the manual smoke list, treat it as untested and open a coverage gap.
---
@@ -142,67 +142,42 @@ If a feature has no automated coverage AND is not on the manual smoke list, trea
Every feature leaf in the [coverage matrix](https://github.com/tinyhumansai/openhuman/blob/main/docs/TEST-COVERAGE-MATRIX.md) maps to:
-1. A test path or paths, **or**
+1. One or more test paths, or
2. A justified `🚫` with a manual-smoke entry.
-When you add / remove / rename a feature, **update the matrix row in the same PR**. CI will guard this contract once #965 lands.
+When you add, remove or rename a feature, update its matrix row in the same PR.
---
## A red Rust suite locally is usually not a defect
-Most local Rust failures in this repo are environmental, and the environments
-fail in ways that look exactly like product defects. Work down this list before
-concluding anything. Each step is one command, and every one of them has caught
-a wrong conclusion that was already on its way into an issue.
-
-**Every prerequisite below carries the failure you get without it.** A step with
-its failure attached is self-auditing: anyone can check in thirty seconds
-whether it is still true, and a stale one announces itself. A bare list of steps
-cannot be audited at all, which is how it rots into folklore. *If you cannot
-produce the failure for an item, it does not belong here.*
-
-**A note that tells you the cause is not evidence of the cause.** A line in a
-doc or a memory saying "these fail locally, it is provisioning" is a
-*pre-supplied conclusion*. It terminates the investigation before it starts,
-which is worse than no note at all: one such note sent a worker looking for a
-provisioning gap when the real cause was a product defect
-(`agent definition \`harness\` was not found`, openhuman#6487). Use the steps,
-not the folklore.
+Most local Rust failures here come from the environment, and they look exactly like product bugs. Work down this list before you conclude anything. Each step is one command. Each carries the failure you see without it, so you can check in thirty seconds whether it still holds.
+
+Do not trust a note that tells you the cause. A line saying "these fail locally, it is provisioning" ends the investigation before it starts. Once it sent a worker hunting for a provisioning gap when the real cause was a product defect (`agent definition \`harness\` was not found`). Use the steps, not folklore.
### 1. Did anything compile?
-`cargo` exits **101** for at least three states that are identical from the
-shell: nothing compiled, a test asserted false, or the process aborted.
+`cargo` exits 101 in at least three cases that look identical from the shell: nothing compiled, a test asserted false, or the process aborted.
```bash
grep -c "^test result" run.log # 0 = nothing ran
```
-Zero `test result` lines means the question is *compilation or abort*, never
-"which test failed". Then read the **first** error line:
+Zero `test result` lines means the problem is compilation or an abort, not a failing test. Read the first error line:
-- `failed to load source for dependency <x>` / `No such file or directory` →
- a submodule is not checked out.
-- `fatal runtime error: stack overflow` with `signal: 6, SIGABRT` and no
- `test result` line at all → the process aborted; see step 3.
+- `failed to load source for dependency <x>` or `No such file or directory` means a submodule is not checked out.
+- `fatal runtime error: stack overflow` with `signal: 6, SIGABRT` and no `test result` line means the process aborted. See step 3.
-### 2. Are the submodules actually there, at every depth?
+### 2. Are the submodules there, at every depth?
-Some crates depend on submodules **nested inside other submodules**.
-`openhuman-tinyhumans` is the clearest case: it needs `vendor/tinyhumans-sdk`
-(top level) **and** `vendor/tinyagents/vendor/tinytools` (nested). A plain
-`git submodule update --init` fetches the first and silently not the second, so
-the obvious command leaves you with a compile failure that reads as a test
-failure.
+Some crates depend on submodules nested inside other submodules. `openhuman-tinyhumans` is the clearest case. It needs `vendor/tinyhumans-sdk` (top level) and `vendor/tinyagents/vendor/tinytools` (nested). A plain `git submodule update --init` fetches the first and silently skips the second, so you get a compile failure that reads like a test failure.
```bash
git submodule update --init
git -C vendor/tinyagents submodule update --init --recursive
```
-*Falsified:* deinitialising `vendor/tinyagents/vendor/tinytools` and re-running
-`cargo test -p openhuman-tinyhumans` gives, with **no** `test result` line:
+Without the nested module, `cargo test -p openhuman-tinyhumans` fails with no `test result` line:
```text
error: failed to get `tinytools` as a dependency of package `openhuman-cli v0.63.31`
@@ -210,11 +185,7 @@ error: failed to get `tinytools` as a dependency of package `openhuman-cli v0.63
No such file or directory (os error 2)
```
-**Check content, never status.** `git submodule status` prints `-` only for
-*unregistered* modules, and registration happens **before** checkout, so a
-mid-flight init reads as ready while every working tree is still empty.
-Observed mid-`update --init`: **13 `+`, 3 ` `, zero `-`** while `du -sh vendor`
-was **120K** and `ls vendor/tinychannels` was empty.
+Check content, not status. `git submodule status` prints `-` only for unregistered modules, and registration happens before checkout. A half-finished init can therefore look ready while every working tree is empty. Seen mid-init: 13 `+`, 3 blank, zero `-`, while `du -sh vendor` said 120K and `ls vendor/tinychannels` was empty.
```bash
du -sh vendor # 120K = empty; a real checkout is GBs
@@ -223,74 +194,33 @@ ls vendor/<module> | wc -l # 0 = empty, whatever status says
### 3. Is your feature set the one CI uses?
-`cargo test -p openhuman --lib` on default features is a **materially smaller
-product** than CI builds, and the difference changes test *outcomes*, not just
-which tests exist.
-
-The mechanism is worth understanding because it is invisible in the output: a
-feature flag can gate the *registration* of a tool, a test's expected side is a
-static allowlist while its actual side is computed by **introspecting the built
-binary**, and so the flag silently moves the actual. Nothing is stubbed, nothing
-is skipped, and the failure names a product concept,
-*"agents that carry tools but whose prompt names none of them,"* with no
-mention of a feature anywhere.
-
-*Falsified, from the two runs side by side:* on `0f1ecc9d2`, `openhuman --lib`
-fails **5** tests on default and **3** under CI's set; the two that differ are
-pure profile artefacts
-(`every_prompt_names_at_least_one_tool_it_can_call` needs `runtime-node`,
-`the_withheld_block_renders_for_a_renamed_session_with_a_filter` needs
-`documents`). Reproduce CI exactly before asserting anything:
+`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:
```bash
RUST_MIN_STACK=67108864 cargo test -p openhuman --lib \
--features "$(bash scripts/ci/product-features.sh)"
```
-Tracked as openhuman#6512; per-profile detail in openhuman#6486.
-
-**`RUST_MIN_STACK` is per-suite, not universal.**
-
-*Falsified for `openhuman-tinyhumans`:* removing it and re-running still gives
-`183 passed; 0 failed`. It is **not** a requirement there.
-
-*Reported for `openhuman --lib`:* `web_chat` aborts with
-`fatal runtime error: stack overflow` without it, which is why the CI lane
-exports it. Not reproduced here: treat that as the reason the CI command above
-carries it, and re-verify before relying on it elsewhere.
+`RUST_MIN_STACK` is per suite, not universal. Removing it from `openhuman-tinyhumans` still gives `183 passed; 0 failed`, so that crate does not need it. For `openhuman --lib`, `web_chat` is reported to abort with `fatal runtime error: stack overflow` without it, which is why the CI lane exports it. That abort has not been reproduced locally, so re-verify before relying on it elsewhere.
-Two crates, one variable, opposite answers. That is the argument against a
-single blanket recipe: do not add a prerequisite by reflex. One that is not
-needed teaches contributors the docs are unreliable, and it is precisely how the
-misleading note above came to exist: someone's defensively-accumulated setup,
-written down as necessity, never falsified.
+Two crates, one variable, opposite answers. Do not add a prerequisite by reflex. An unneeded one teaches contributors that the docs are unreliable.
### 4. Only now suspect a defect, and make the silence speak
-If it compiled, the submodules are present and the feature set matches CI, then
-a failure may be real. The trap at this stage is a layer that *correctly*
-discards detail: a sanitizer, a scrubber, a redactor. The symptom is a generic
-message where a specific one was produced.
+If it compiled, the submodules are present and the feature set matches CI, a failure may be real. The trap at this stage is a layer that correctly discards detail, such as a sanitizer, scrubber or redactor. The symptom is a generic message where a specific one was produced.
-Patch the discarding line to print what it drops, run once, and read the
-underlying error. On openhuman#6487 a sanitized
-`hosted agent invocation was rejected by policy` was hiding
-`Validation("agent definition \`harness\` was not found")`, which named the
-defect outright. **Reading seven links of a chain correctly is not the same as
-watching it fire.**
+Patch the discarding line to print what it drops, run once, and read the underlying error. In one case a sanitized `hosted agent invocation was rejected by policy` hid `Validation("agent definition \`harness\` was not found")`, which named the defect outright.
### Why this order
-The cheap checks are first because a wrong answer early is invisible later: a
-suite that never compiled reports the same exit code as one that failed, and a
-plausible-but-wrong explanation gets *confirmed* rather than tested, because
-confirming it succeeds. Knowing that features matter is not enough: the rule is
-not applied at the moment of asserting. Running CI's literal command is.
+The cheap checks come first because a wrong answer early is invisible later. A suite that never compiled reports the same exit code as one that failed, and a plausible but wrong explanation gets confirmed instead of tested. Running CI's literal command is the surest way to avoid that.
---
## When in doubt
-- Push the test as low in the layer stack as possible (Rust unit > Rust integration > Vitest > WDIO). Lower layers are faster, more deterministic, and cheaper to run.
-- WDIO is for behaviours that genuinely cross UI ⇄ Tauri ⇄ embedded core ⇄ JSON-RPC. Don't drive a unit-testable concern through WDIO just because the UI exists.
+- Put the test as low in the stack as you can (Rust unit, then Rust integration, then Vitest, then WDIO). Lower layers are faster, more deterministic and cheaper.
+- Use WDIO only for behavior that really crosses UI, Tauri, the embedded core and JSON-RPC. Do not drive a unit-testable concern through WDIO just because the UI exists.
- A failing happy path is a regression. A missing failure-path test is a gap. Both are bugs.
diff --git a/docs/gitbooks/en/developing/theming.md b/docs/gitbooks/en/developing/theming.md
index 30adb5973c..fc1f6bb416 100644
--- a/docs/gitbooks/en/developing/theming.md
+++ b/docs/gitbooks/en/developing/theming.md
@@ -1,104 +1,57 @@
---
description: >-
The CSS token system behind every theme: how tokens are defined, how
- Tailwind consumes them, and how to add one.
+ Tailwind uses them and how to write components that follow it.
icon: palette
---
-# Theming (Token System)
+# Theming and design tokens
-OpenHuman is fully re-skinnable at runtime. Colours and fonts are driven by CSS
-variables (the "tokens"), so a theme is just a set of values for those variables.
-This page is the contributor reference for the token system.
+You can re-skin OpenHuman at runtime. CSS variables (the "tokens") drive colors and fonts, so a theme is a set of values for those variables. This page is the contributor reference for the token system.
## How it works
-1. **Tokens**: `app/src/styles/tokens.css` defines every themeable colour as a
- space-separated **RGB channel triple** (e.g. `--surface: 255 255 255;`) plus
- font-role vars (`--font-title/heading/body/mono/serif`). The Light palette
- lives in `:root`; the Dark palette in `:root.dark`.
-
-2. **Tailwind wiring**: the app runs Tailwind v4, so there is no
- `tailwind.config.js`. The `@theme` block in `app/src/index.css` exposes each
- token as a utility colour (`--color-surface: rgb(var(--surface));`, and so
- on), and Tailwind's opacity-modifier support handles `bg-surface/50` and
- `bg-primary-500/10` without any extra templating. Channel format (a
- space-separated RGB triple, never a hex string) is what makes that work: a
- hex string can't be composed with an opacity modifier this way.
-
-3. **Runtime application**: `app/src/providers/ThemeProvider.tsx` resolves the
- active `Theme` and writes its overrides as inline `--token` / `--font-<role>`
- variables on `<html>`, toggling `.dark` from `theme.isDark`. Variables a theme
- doesn't override fall through to the tokens.css defaults; variables left over
- from a previous theme are removed on switch.
-
-4. **State**: `app/src/store/themeSlice.ts` holds `activeThemeId` and
- `customThemes`. Built-in presets live in `app/src/lib/theme/presets.ts`.
- Users edit themes in **Settings → Theme Studio**
- (`app/src/components/settings/panels/ThemeStudioPanel.tsx`).
+1. Tokens: `app/src/styles/tokens.css` defines every themeable color as a space-separated RGB channel triple (for example `--surface: 255 255 255;`), plus font-role variables (`--font-title/heading/body/mono/serif`). The light palette lives in `:root` and the dark palette in `:root.dark`.
+
+2. Tailwind wiring: the app runs Tailwind v4, so there is no `tailwind.config.js`. The `@theme` block in `app/src/index.css` exposes each token as a utility color (`--color-surface: rgb(var(--surface));` and so on). Tailwind's opacity modifiers then handle `bg-surface/50` and `bg-primary-500/10` with no extra work. This only works because tokens are RGB triples. A hex string cannot be combined with an opacity modifier this way.
+
+3. Runtime application: `app/src/providers/ThemeProvider.tsx` resolves the active `Theme` and writes its overrides as inline `--token` and `--font-<role>` variables on `<html>`. It toggles `.dark` from `theme.isDark`. Variables a theme does not override fall back to the `tokens.css` defaults. Variables left over from a previous theme are removed on switch.
+
+4. State: `app/src/store/themeSlice.ts` holds `activeThemeId` and `customThemes`. Built-in presets live in `app/src/lib/theme/presets.ts`. Users edit themes in Settings > Theme Studio (`app/src/components/settings/panels/ThemeStudioPanel.tsx`).
## Token taxonomy
| Group | Tokens | Tailwind utilities |
| -------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
-| Surfaces | `surface`, `surface-canvas`, `surface-muted`, `surface-subtle`, `surface-strong`, `surface-hover`, `surface-overlay` | `bg-surface`, `bg-surface-muted`, … |
-| Text | `content`, `content-secondary`, `content-muted`, `content-faint`, `content-inverted` | `text-content`, `text-content-muted`, … |
-| Borders | `line`, `line-strong`, `line-subtle` | `border-line`, `border-line-strong`, … |
-| Accents | `primary-*`, `sage-*`, `amber-*`, `coral-*` (shades 50…950) | `bg-primary-500`, `text-coral-600`, … (var-backed, themeable, unchanged names) |
-| Fonts | `font-title`, `font-heading`, `font-body`, `font-mono`, `font-serif` | `font-title`, `font-heading`, `font-body`, … |
+| Surfaces | `surface`, `surface-canvas`, `surface-muted`, `surface-subtle`, `surface-strong`, `surface-hover`, `surface-overlay` | `bg-surface`, `bg-surface-muted`, ... |
+| Text | `content`, `content-secondary`, `content-muted`, `content-faint`, `content-inverted` | `text-content`, `text-content-muted`, ... |
+| Borders | `line`, `line-strong`, `line-subtle` | `border-line`, `border-line-strong`, ... |
+| Accents | `primary-*`, `sage-*`, `amber-*`, `coral-*` (shades 50 to 950) | `bg-primary-500`, `text-coral-600`, ... (backed by variables, themeable) |
+| Fonts | `font-title`, `font-heading`, `font-body`, `font-mono`, `font-serif` | `font-title`, `font-heading`, `font-body`, ... |
-The legacy `--cmd-*` and `--color-*` variable sets are thin aliases over these
-canonical tokens. Don't add new colours there.
+The legacy `--cmd-*` and `--color-*` variable sets are thin aliases over these tokens. Do not add new colors there.
## Authoring components
-- Use semantic utilities (`bg-surface`, `text-content`, `border-line`) for
- neutral surfaces/text/borders instead of `bg-white dark:bg-neutral-900` etc.
- You almost never need `dark:` variants for these, because the token flips for you.
-- Use the accent palettes (`primary`/`sage`/`amber`/`coral`) for semantic colour;
- they're themeable with no extra work.
-- Avoid hardcoded hex in `className` or inline `style`, since those bypass theming.
+- Use semantic utilities (`bg-surface`, `text-content`, `border-line`) for neutral surfaces, text and borders instead of `bg-white dark:bg-neutral-900`. You rarely need `dark:` variants, because the token flips for you.
+- Use the accent palettes (`primary`, `sage`, `amber`, `coral`) for semantic color. They are themeable with no extra work.
+- Avoid hardcoded hex in `className` or inline `style`. It bypasses theming.
-## Colour as identity: the four-ramp ceiling
+## Color as identity: the four-ramp ceiling
-A recurring shape in this codebase is a lookup table that answers "which thing
-is this?" with a colour: a skill category, an event-log domain, a notification
-provider, a catalogue source. Those tables are where stock Tailwind ramps keep
-creeping back in, because a table with nine rows wants nine hues and the app
-ships four.
+Some lookup tables answer "which thing is this?" with a color. Examples are a skill category, an event-log domain, a notification provider and a catalogue source. Stock Tailwind ramps keep creeping back into these tables, because a table with nine rows wants nine hues and the app ships four.
-**There are exactly four themeable ramps: `primary`, `sage`, `amber`, `coral`.**
-Everything else in Tailwind's default palette (`emerald`, `violet`, `sky`,
-`teal`, `indigo`, `cyan`, `rose`, `pink`, `purple`, …) resolves to a fixed oklch
-value that ignores the user's active theme entirely. A table built on those hues
-looks fine in the default skin and falls apart in every other one.
+There are exactly four themeable ramps: `primary`, `sage`, `amber` and `coral`. Everything else in Tailwind's default palette (`emerald`, `violet`, `sky`, `teal`, `indigo`, `cyan`, `rose`, `pink`, `purple` and more) resolves to a fixed oklch value that ignores the active theme. A table built on those hues looks fine in the default skin and falls apart in every other one.
### The rule
-1. **Map a stock ramp to its themeable equivalent at the same shade step:**
- `red → coral`, `green`/`emerald` → `sage`, `orange → amber`, `blue → primary`.
- `bg-emerald-50 text-emerald-700` becomes `bg-sage-50 text-sage-700`.
-
-2. **Hues that have no equivalent do not get one.** `violet`, `teal`, `sky`,
- `cyan`, `indigo`, `pink` and `purple` are not "nearly primary" or "nearly
- sage". Do not invent a fifth ramp, do not duplicate an existing one under a
- new name, and do not reach for `--accent-lavender` and friends: those are
- fixed hexes, not ramps.
-
-3. **When a table needs more than four distinct hues, send the surplus rows to
- the neutral pair the table already defines** (`bg-surface-subtle
-text-content-secondary`, or whatever that table's "unknown"/"other" row
- uses). Never let two rows collide on the same ramp: two domains rendering
- identically destroys the exact distinction the table exists to encode, which
- is strictly worse than rendering one of them in neutral.
-
-4. **Decide which rows keep a hue by which distinction a reader acts on.** The
- badge almost always prints its own label, so colour is a scanning aid, not
- the information itself. Spend the four ramps on the readings that change what
- someone does, and let the rest go neutral. Keep the semantics honest while
- you are at it: `coral` reads as failure, so an ordinary row painted coral
- makes routine state look broken. Leaving a ramp unassigned is a legitimate
- outcome.
+1. Map a stock ramp to its themeable equivalent at the same shade step: `red` to `coral`, `green` and `emerald` to `sage`, `orange` to `amber`, `blue` to `primary`. `bg-emerald-50 text-emerald-700` becomes `bg-sage-50 text-sage-700`.
+
+2. Hues with no equivalent do not get one. `violet`, `teal`, `sky`, `cyan`, `indigo`, `pink` and `purple` are not "nearly primary" or "nearly sage". Do not invent a fifth ramp, do not duplicate an existing one under a new name, and do not reach for `--accent-lavender` and similar. Those are fixed hexes, not ramps.
+
+3. When a table needs more than four distinct hues, send the surplus rows to the neutral pair the table already defines (`bg-surface-subtle text-content-secondary`, or whatever its "unknown" or "other" row uses). Never let two rows share a ramp. Two domains that render identically destroy the distinction the table exists to show, which is worse than rendering one of them in neutral.
+
+4. Decide which rows keep a hue by which distinction a reader acts on. The badge usually prints its own label, so color is a scanning aid, not the information. Spend the four ramps on the readings that change what someone does, and let the rest go neutral. Keep the meaning honest: `coral` reads as failure, so an ordinary row painted coral makes routine state look broken. Leaving a ramp unassigned is fine.
Worked examples in the tree:
@@ -107,30 +60,20 @@ Worked examples in the tree:
| `skills/skillIcons.tsx` `CATEGORY_META` | 9 | `Built-in` (primary), `Productivity` (sage), `Social` (coral), `Tools & Automation` (amber) | `Channels`, `Chat` and `Platform` share the neutral tone of `All` / `Other` |
| `skills/SkillsExplorerTab.tsx` `SOURCE_COLORS` | 6 | `built-in` (sage), `optional` (primary) | The four remote catalogues print their own name; provenance tier is the distinction that matters |
| `skills/SkillsExplorerTab.tsx` `FORMAT_MAP` | 5 rows, 3 tones | Hermes family (primary), ClawHub family (sage), `legacy` (amber) | Three tones fit under the ceiling, so nothing is lost |
-| `settings/panels/EventLogPanel.tsx` `DOMAIN_BADGE_COLORS` | 11 | `tool` (primary), `agent` (sage), `approval` (amber) | Who acted, and what waits on a human. Coral stays unassigned; no domain means failure |
+| `settings/panels/EventLogPanel.tsx` `DOMAIN_BADGE_COLORS` | 11 | `tool` (primary), `agent` (sage), `approval` (amber) | Who acted, and what waits on a human. Coral stays unassigned, because no domain means failure |
| `notifications/NotificationCard.tsx` provider badge | 6 | none | The importance badge in the same row already spends coral/amber/sage on high/medium/low; a coral provider would read as a failed notification |
### Brand tints are a separate question
-A few plates are a third party's brand colour, not an app hue: Telegram's
-`#249CD8`, Discord's `#5865F2`, iMessage's `#34C759` in
-`skills/skillIcons.tsx`. Flattening those to `bg-surface-subtle` erases them
-into the generic badge beside them, so they are deliberately left as hex.
-Giving them a themeable home means **adding brand tokens**, which is a product
-decision rather than a cleanup. The same applies to the provider badges in
-`NotificationCard.tsx`: reaching back for a stock ramp is not the fix.
+A few plates use a third party's brand color, not an app hue: Telegram's `#249CD8`, Discord's `#5865F2` and iMessage's `#34C759` in `skills/skillIcons.tsx`. Flattening them to `bg-surface-subtle` would erase them into the generic badge beside them, so they stay as hex on purpose. Giving them a themeable home means adding brand tokens, which is a product decision, not a cleanup. The same goes for the provider badges in `NotificationCard.tsx`: reaching for a stock ramp is not the fix.
### Do not repaint a primitive's variant
-`<Button variant="primary" className="bg-violet-500">` is the same bug wearing a
-different hat: the variant already paints the accent ramp, and the override
-both freezes the colour and desynchronises hover, focus and disabled states.
-Retint the surface around it instead, and drop the override.
+`<Button variant="primary" className="bg-violet-500">` is the same bug. The variant already paints the accent ramp, and the override freezes the color and breaks the hover, focus and disabled states. Drop the override and retint the surface around the button instead.
## The migration codemod
-`scripts/theme-codemod/` collapses audited `light dark:` Tailwind pairings into
-the semantic utilities. It is idempotent and dry-run by default:
+`scripts/theme-codemod/` collapses audited light and `dark:` Tailwind pairings into the semantic utilities. It is idempotent and runs as a dry run by default:
```bash
node scripts/theme-codemod/migrate.mjs # dry-run + report
@@ -138,5 +81,4 @@ node scripts/theme-codemod/migrate.mjs --write # apply
node scripts/theme-codemod/migrate.mjs --selftest # fixture assertions
```
-It only rewrites adjacent pairs and never touches opacity-suffixed utilities or
-test files. Mapping table: `scripts/theme-codemod/map.mjs`.
+It only rewrites adjacent pairs and never touches opacity-suffixed utilities or test files. The mapping table is `scripts/theme-codemod/map.mjs`.
diff --git a/docs/gitbooks/en/developing/tinyhumans-api-key.md b/docs/gitbooks/en/developing/tinyhumans-api-key.md
index c796c74c12..ea60a82d27 100644
--- a/docs/gitbooks/en/developing/tinyhumans-api-key.md
+++ b/docs/gitbooks/en/developing/tinyhumans-api-key.md
@@ -1,32 +1,23 @@
---
description: >-
- What a single TinyHumans API key unlocks, how it is resolved, and which
- seams read it.
+ What one TinyHumans API key unlocks, how to use it and how OpenHuman stores
+ and sends it.
icon: key
---
# One TinyHumans API key
-One TinyHumans credential unlocks every managed backend surface: chat
-inference over the OpenRouter model catalogue, web search, embeddings, media
-generation, integrations, voice, and the Jev ranker. There's no separate key
-per service. The desktop app gets this credential through sign-in; a library
-host or a headless process supplies it directly.
+One TinyHumans credential unlocks every managed backend service: chat inference over the OpenRouter model catalogue, web search, embeddings, media generation, integrations, voice and the Jev ranker. There is no separate key per service. The desktop app gets the credential when you sign in. A library host or a headless process supplies it directly.
## How to get one
-Managed inference, search, and the rest of the backend surface all sit behind
-one TinyHumans account. Sign in through the desktop app to get a session
-credential, or generate an API key (`th_...`) for library and headless use.
+All managed services sit behind one TinyHumans account. Sign in through the desktop app to get a session credential, or generate an API key (`th_...`) for library and headless use.
## Using it
-**Desktop app**: sign in with a TinyHumans account. The app stores a session
-credential in the OS-backed auth-profile store and the core resolves it the
-same way it resolves an API key, through `security::credentials::api_key` and
-`session_support::resolve_backend_credential`.
+Desktop app: sign in with a TinyHumans account. The app stores a session credential in the OS-backed auth-profile store. The core resolves it the same way it resolves an API key, through `security::credentials::api_key` and `session_support::resolve_backend_credential`.
-**Library**: pass the key to `RuntimeBuilder` and it boots connected:
+Library: pass the key to `RuntimeBuilder` and it boots connected:
```rust
use openhuman_tinyhumans::{embed::Workspace, RuntimeBuilder};
@@ -38,40 +29,21 @@ let runtime = RuntimeBuilder::new()
.await?;
```
-`openhuman_tinyhumans::RuntimeBuilder` mirrors `openhuman_embed::RuntimeBuilder`
-method for method, then installs the SDK-backed transport and binds it to the
-runtime on `build()`.
+`openhuman_tinyhumans::RuntimeBuilder` mirrors `openhuman_embed::RuntimeBuilder` method for method. On `build()` it installs the SDK-backed transport and binds it to the runtime.
-**Headless**: set `OPENHUMAN_BACKEND_API_KEY` before the core boots. The boot
-sequence (`crates/openhuman-core/src/security/credentials/ops/boot_env.rs`)
-installs it on a fresh credential store and never overwrites one that's
-already there.
+Headless: set `OPENHUMAN_BACKEND_API_KEY` before the core boots. The boot sequence (`crates/openhuman-core/src/security/credentials/ops/boot_env.rs`) installs it on a fresh credential store and never overwrites a credential that is already there.
-## Where it's stored and how it's sent
+## Where it is stored and how it is sent
-The key lives in the same auth-profile store as an app session, under its own
-provider id (`api-key`), never in `config.toml` and never logged. It's the
-only credential a library embedder holds: no login-token exchange, no session
-JWT, no `/auth/me` round trip.
+The key lives in the same auth-profile store as an app session, under its own provider id (`api-key`). It is never written to `config.toml` and never logged. It is the only credential a library embedder holds. There is no login-token exchange, no session JWT and no `/auth/me` round trip.
-Two wire forms, chosen by endpoint:
+The key is sent in one of two forms, depending on the endpoint:
-- **Managed inference** (`{api_url}/openai/v1`): `Authorization: Bearer
- <key>`. `OpenHumanBackendModel::resolve_bearer` prefers the stored API key
- over an app session when both exist.
-- **Backend REST** (`BackendClient`, `IntegrationClient`):
- `x-api-key: <key>`.
+- Managed inference (`{api_url}/openai/v1`): `Authorization: Bearer <key>`. `OpenHumanBackendModel::resolve_bearer` prefers the stored API key over an app session when both exist.
+- Backend REST (`BackendClient`, `IntegrationClient`): `x-api-key: <key>`.
-`crates/openhuman-core/src/security/credentials/api_key.rs` owns storage and
-retrieval (`store_api_key`, `get_api_key`, `has_api_key`, `clear_api_key`);
-`session_support::BackendCredential` is what resolves either credential form
-into the right header at request time.
+`crates/openhuman-core/src/security/credentials/api_key.rs` owns storage and retrieval (`store_api_key`, `get_api_key`, `has_api_key`, `clear_api_key`). `session_support::BackendCredential` turns either credential form into the right header at request time.
-## BYOK stays available
+## Bring your own key still works
-The API key covers the managed path. Every workload can still be pointed at
-your own provider instead, chat and reasoning at a BYOK LLM slug, embeddings
-at Voyage or OpenAI or Cohere directly, search at Brave or Exa or Tavily
-directly. See [Pluggable engines](engines.md) for the full list and the
-config key for each. Running everything BYOK does not require a TinyHumans
-key at all; running anything through the managed backend does.
+The API key covers the managed path. You can still point any workload at your own provider: chat and reasoning at a bring-your-own-key LLM slug, embeddings at Voyage, OpenAI or Cohere directly, and search at Brave, Exa or Tavily directly. See [Pluggable engines](engines.md) for the full list and the config key for each. Running everything with your own keys needs no TinyHumans key. Running anything through the managed backend does.
diff --git a/docs/gitbooks/en/features/approval-gate.md b/docs/gitbooks/en/features/approval-gate.md
index 19df12a76f..61537d3a56 100644
--- a/docs/gitbooks/en/features/approval-gate.md
+++ b/docs/gitbooks/en/features/approval-gate.md
@@ -1,62 +1,57 @@
---
description: >-
- Human-in-the-loop consent for side-effecting tool calls. When the autonomy
- policy is on, the agent parks any risky action until you approve it, and fails
- closed if you don't.
+ The agent asks before it does anything risky. When the autonomy policy is
+ on, risky actions wait for your approval and are denied if you don't answer.
icon: shield-check
---
-# Approval Gate
+# Approval gate
-The Approval Gate is the checkpoint between the agent and the outside world. It parks the calls your autonomy tier classifies **Prompt**, rather than every tool with a real-world effect: `SecurityPolicy::gate_decision` (`crates/openhuman-core/src/security/policy/command_checks.rs`) maps each call's command class against your tier, and only a `Prompt` becomes a gate round-trip. When one does, the gate intercepts the call before the tool runs, shows you what is about to happen, and waits for your decision. A class your tier already allows runs silently: on `full` a `Write` is never prompted, as the tier table below shows.
+The approval gate sits between the agent and the outside world. When the agent wants to do something your autonomy tier says needs a check, the gate stops the call, shows you what is about to happen, and waits for your decision. Actions your tier already allows run without a prompt. On the `full` tier, for example, a write is never prompted.
{% hint style="warning" %}
-**The autonomy policy is off by default, and the gate is part of it.** `[autonomy] enabled` defaults to `false` (`crates/openhuman-core/src/config/schema/autonomy.rs`). Until you turn it on, command classification, the tier table, the allowlist, the hourly action budget, `workspace_only` and `forbidden_paths` are all inert, and an acting tool call runs without a prompt, apart from the forced approvals below.
+The autonomy policy is off by default, and the gate is part of it. With `[autonomy] enabled = false`, command classification, the tier table, the allowlist, the hourly action budget, `workspace_only` and `forbidden_paths` do nothing, and acting tool calls run without a prompt. The exceptions are the forced approvals below.
-That is deliberate rather than an oversight: these agents are expected to run inside a container, a platform jail or a Docker sandbox that already provides the isolation this in-process policy was approximating, and a shell that refuses ordinary shell syntax is not a usable shell. Set `[autonomy] enabled = true` in `config.toml` to turn on the autonomy policy described here. The floor in the next section, and the forced approvals below, hold either way.
+This is deliberate. Agents are expected to run inside a container, a platform jail or a Docker sandbox that already provides isolation, and a shell that refuses ordinary shell syntax is not a usable shell. To turn the policy on, set `[autonomy] enabled = true` in `config.toml`.
{% endhint %}
## What still holds with the policy off
-Three things do not depend on `[autonomy] enabled`:
+Three protections do not depend on `[autonomy] enabled`:
-* **Credential stores and system roots stay unreachable.** `SecurityPolicy::is_always_forbidden` refuses `~/.ssh`, `~/.gnupg`, `~/.aws` and system roots, along with `..` traversal and null bytes in a path, on every code path. It is a floor, not a tier.
-* **Hard tool-level blocks are independent.** The checks inside the tool implementations themselves, including the tool-policy middleware, run regardless.
-* **Sandboxing is a separate mechanism.** The platform jail and the Docker backend are chosen by `[runtime]` and the session's origin, not by the autonomy tier. See [sandboxing](privacy-and-security/).
+- Credential stores and system roots stay unreachable. `~/.ssh`, `~/.gnupg`, `~/.aws` and system roots are always refused, as are `..` traversal and null bytes in a path.
+- Hard blocks inside the tools themselves, including the tool-policy middleware, always run.
+- Sandboxing is separate. The platform jail and the Docker backend are chosen by `[runtime]` and the session's origin, not by the autonomy tier. See [Privacy and security](privacy-and-security.md).
Everything below describes the policy with `[autonomy] enabled = true`.
-***
-
## What triggers a prompt
-Every acting tool call is classified into a **command class**, and your **autonomy tier** decides whether that class runs silently, prompts, or is blocked.
+The agent classifies every acting tool call into a command class. Your autonomy tier then decides whether that class runs, prompts or is blocked.
| Command class | What it covers |
| ------------- | ----------------------------------------------------------------- |
-| Read | Provably read-only or observational (curated allowlist) |
-| Write | State-changing; the fail-closed default for anything unrecognized |
-| Network | Reaches the network (curl, wget, ssh, scp, …) |
+| Read | Provably read-only or observational (a curated allowlist) |
+| Write | Changes state. This is the default for anything unrecognized |
+| Network | Reaches the network (curl, wget, ssh, scp, and so on) |
| Install | Installs an OS or global language package |
| Destructive | Catastrophic, irreversible or privilege-escalating |
-The tier comes from **Settings → Permissions** (`[autonomy].level`, `AutonomyLevel` in `crates/openhuman-core/src/security/policy/types.rs`):
-
-| Tier | Read | Write | Network / Install / Destructive |
-| ---------------------------------------------- | ----- | ------ | ------------------------------- |
-| `readonly` | Allow | Block | Block |
-| `supervised` _(default when the policy is on)_ | Allow | Prompt | Prompt |
-| `full` | Allow | Allow | Prompt |
+You pick the tier in **Settings > Permissions** (`[autonomy].level`):
-Anything that lands on **Prompt** is parked at the gate. `Block` is refused outright: no in-tier approval can authorize it. Classification is fail-closed. A command that is not provably read-only is treated as at least `Write`, and across a piped command the highest class wins, so `ls | curl …` is `Network`.
+| Tier | Read | Write | Network, Install, Destructive |
+| ---------------------------------------------- | ----- | ------ | ----------------------------- |
+| `readonly` | Allow | Block | Block |
+| `supervised` (default when the policy is on) | Allow | Prompt | Prompt |
+| `full` | Allow | Allow | Prompt |
-A quoted heredoc body (`<< 'EOF' … EOF`) is data, not shell: it is blanked before any structural scan. An unquoted delimiter (`<< EOF`) is still expanded and still scanned.
+A call that lands on Prompt waits at the gate. A call that lands on Block is refused, and no approval can override it.
-***
+Classification fails closed. A command that is not provably read-only counts as at least a write. In a piped command the highest class wins, so `ls | curl ...` is Network. A quoted heredoc body (`<< 'EOF' ... EOF`) is treated as data and not scanned. An unquoted one (`<< EOF`) is expanded and scanned.
-## The flow
+## How a request flows
-```
+```text
agent wants to act
│
▼
@@ -80,98 +75,84 @@ Approve Always allow Deny 10-min TTL
run run refused (fail closed)
```
-When a call is parked, an **Approval Request card** appears above the chat composer. It shows the tool name, a safe one-line summary of the action, and the redacted command. Three choices:
+A parked call shows an approval card above the chat composer. The card has the tool name, a one-line summary of the action and the redacted command. You have three choices:
-* **Approve**: run this one call.
-* **Always allow**: run it, and add the tool to your `auto_approve` list so it skips the prompt next time.
-* **Deny**: refuse this call.
+- **Approve** runs this one call.
+- **Always allow** runs it and adds the tool to your `auto_approve` list, so it skips the prompt next time.
+- **Deny** refuses the call.
-You can also type **yes** or **no** in chat. The reply is routed back to the parked request.
-
-***
+You can also type "yes" or "no" in chat, and the reply goes to the parked request.
## Always allow
-Approving with **Always allow** persists the tool name onto `[autonomy].auto_approve` (config save plus a live policy reload), so the gate short-circuits to allow for that tool on later turns. Remove an entry in **Settings → Agent access** to start being prompted again.
-
-The shipped default list is `file_read`, `memory_search`, `memory_list`, `get_time`, `list_dir`, `glob`, `grep`. Four of those names no longer match a registered tool: the memory surface is one tool called `memory`, the clock is `current_time`, and the directory listing is `list`. Those four entries are therefore inert, and `file_read`, `glob` and `grep` are the three that do anything. Checked against `app/src/features/conversations/tools/__fixtures__/coreToolNames.json`. That fixture is the catalogue the core's drift test compares against, though it is not exhaustive: a few credential-gated and env-gated tools are registered without appearing in it.
+Choosing **Always allow** saves the tool name to `[autonomy].auto_approve` and reloads the policy. The gate then lets that tool through on later turns. To be prompted again, remove the entry in **Settings > Agent access**.
-***
+The default list is `file_read`, `memory_search`, `memory_list`, `get_time`, `list_dir`, `glob` and `grep`. Four of those names no longer match a registered tool. Memory is now one tool called `memory`, the clock is `current_time`, and directory listing is `list`. So only `file_read`, `glob` and `grep` have any effect.
-## `auto_approve_all`
+## auto_approve_all
-Separately from the per-tool list, `[autonomy].auto_approve_all` approves **every** call without prompting. Three things are worth knowing before enabling it:
+`[autonomy].auto_approve_all` approves every call without asking. Before you enable it, know three things:
-* An unlabelled call site is still hard-denied, and the hard security blocks inside the tool implementations are unaffected.
-* It bypasses **parking**, not just the prompt. A remote-origin triage dispatch (a connector or webhook payload reaching `triage.escalate`) normally parks and writes an audit row; with this flag on it is allowed immediately and **no audit row is written**, so those dispatches leave no approval trail.
-* It does not reach a **forced** approval, below.
-
-***
+- A call from an unlabelled call site is still denied, and the hard blocks inside the tools still apply.
+- It skips parking, not just the prompt. A triage dispatch from a connector or webhook payload normally parks and writes an audit row. With this flag it runs at once and writes no audit row, so those dispatches leave no approval trail.
+- It does not override a forced approval.
## Forced approvals
-Browser page interactions are the one surface that cannot be pre-authorized. Every `click`, `double_click`, `fill`, `type`, `press`, `select` and `check` is routed through `ApprovalGate::intercept_forced` (`crates/openhuman-core/src/security/approval/gate_setup.rs`) rather than the ordinary entry point, which changes three things:
-
-* **Every shortcut is skipped.** `auto_approve_all`, the `auto_approve` allowlist and the per-flow tool trust are all ignored, and the forced park does not consult the autonomy tier, so the call parks even with `[autonomy] enabled = false`.
-* **The decision is one-time.** **Always allow** is refused on a forced request: only approve-once or deny can resolve it.
-* **It needs a live chat.** A turn whose origin is not a web-chat turn carrying both a thread id and a client id is denied instead of parked, so a cron, channel or flow turn cannot drive the browser.
+Browser page interactions cannot be pre-authorized. Every `click`, `double_click`, `fill`, `type`, `press`, `select` and `check` goes through a forced approval, which works differently:
-The card names the action kind, the page origin and a SHA-256 digest binding that action to that URL. If the page navigates while you are deciding, the approved action is refused rather than replayed against the new page.
+- Every shortcut is skipped. `auto_approve_all`, the `auto_approve` list and per-flow tool trust are ignored. The call parks even with `[autonomy] enabled = false`.
+- The decision is one-time. **Always allow** is refused, so you can only approve once or deny.
+- It needs a live chat. A turn that is not a web-chat turn is denied instead of parked, so a cron job, channel message or flow cannot drive your browser.
-***
+The card names the action, the page origin and a SHA-256 digest that ties the action to that URL. If the page navigates while you decide, the approved action is refused and not replayed on the new page.
## Fail-closed behavior
-Every non-approve path resolves to **Deny**:
-
-* **Timeout**: a parked request lives for 10 minutes; if undecided it transitions to a terminal `deny`.
-* **Persist failure** or a dropped channel: denied.
-* The timeout path re-reads the stored decision first, so an approval that committed in the race still wins.
+Every path that is not an approval ends in a denial:
-Pending requests are stored in SQLite (`{workspace_dir}/approval/approval.db`) and **survive a core restart**. After an approved tool finishes, the gate records a write-once execution outcome (success or error, with the error text sanitized and capped) as a durable audit trail. Everything persisted or broadcast is redacted first: PII and chat content are scrubbed and home paths stripped.
+- A parked request lives for 10 minutes. If you have not decided by then, it is denied.
+- If saving the request fails or the channel drops, the call is denied.
+- On timeout the gate re-reads the stored decision first, so an approval that landed at the last moment still wins.
-***
+Pending requests are stored in SQLite (`{workspace_dir}/approval/approval.db`) and survive a core restart. After an approved tool finishes, the gate records the outcome (success or error) as an audit trail. Error text is sanitized and capped. Everything stored or broadcast is redacted first: personal data and chat content are scrubbed and home paths are stripped.
## What the turn's origin decides
-The gate is **interactive-only**: a parked call needs a surface that can answer it. Which turns it parks, and which pass straight through, is decided by the turn's origin, in `crates/openhuman-core/src/security/approval/gate_intercept.rs`, not by the tool:
+The gate is interactive, so a parked call needs a surface that can answer it. The turn's origin decides what gets parked and what passes straight through:
-| Turn origin | At the gate |
-| ------------------------------------------------------------------------------------------------ | ------------------------------------------ |
-| Cron and internal background jobs (`TrustedAutomation` → `Cron` / `Background`) | Allowed, no row, no event |
-| A saved flow's pre-declared action (`Workflow { require_approval: false }`) | Allowed, no row, no event |
-| CLI, a delegated sub-agent, and a **locally initiated** triage dispatch, which is labelled `Cli` | Allowed, no row, no event |
-| Web chat | Parks for your decision |
-| A **remote-origin** triage dispatch: a connector or webhook payload reaching `triage.escalate` | Parks and writes a `pending_approvals` row |
-| An external channel turn (Telegram, Slack, …) | Parks and writes a row |
-| An unlabelled call site (`Unknown`) | Denied outright |
+| Turn origin | At the gate |
+| --- | --- |
+| Cron and internal background jobs | Allowed, no row, no event |
+| A saved flow's pre-declared action | Allowed, no row, no event |
+| CLI, a delegated sub-agent, and a triage dispatch started on your own machine | Allowed, no row, no event |
+| Web chat | Parks for your decision |
+| A triage dispatch from a connector or webhook payload | Parks and writes a pending-approval row |
+| An external channel turn (Telegram, Slack and so on) | Parks and writes a row |
+| An unlabelled call site | Denied |
-Triage is therefore two cases rather than one. A dispatch your own machine started keeps the authority its caller already had and is allowed silently. A dispatch steered by a payload from outside carries `TrustedAutomation { Workflow { require_approval: true } }`, so it parks and leaves an audit row even though no surface can decide a background park yet and it expires at the TTL. That buys the audit trail, not a working escalation, and `auto_approve_all` gives even that up. The two triage cases are pinned apart in `gate_triage_tests.rs`.
+A triage dispatch that your own machine started keeps the authority its caller already had. One steered by an outside payload parks and leaves an audit row. No surface can decide a background park yet, so it expires at the timeout. You get the audit trail, not a working escalation, and `auto_approve_all` gives up even that.
-An external channel turn parks for the same reason: remote input is untrusted, so the row is written and a decision can still arrive on the thread card before the TTL.
-
-***
+An external channel turn parks because remote input is untrusted. The row is written, and you can still decide on the thread card before the timeout.
## Configuration and RPC
-* **`[autonomy].enabled`**: the master switch for the policy. `false` by default; the command classes, the tier table, the allowlist and the hourly budget all need it `true`. Forced approvals and the always-forbidden floor do not.
-* **`OPENHUMAN_APPROVAL_GATE`**: set to `0` or `false` to skip installing the gate even with the policy on. With no gate, `Prompt`-class calls run unprompted.
-* **`[autonomy].level`** and **`[autonomy].auto_approve`**: tier and allowlist, via the `config.update_autonomy_settings` RPC or the settings panels.
+- `[autonomy].enabled` is the master switch for the policy. It is `false` by default. Forced approvals and the always-forbidden floor work without it.
+- `OPENHUMAN_APPROVAL_GATE` set to `0` or `false` skips installing the gate even with the policy on. With no gate, Prompt-class calls run unprompted.
+- `[autonomy].level` and `[autonomy].auto_approve` set the tier and the allowlist. Change them with the `config.update_autonomy_settings` RPC or in the settings panels.
The `approval` controller exposes three JSON-RPC methods:
| Method | Purpose |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `openhuman.approval_list_pending` | The live queue of parked requests. |
-| `openhuman.approval_list_recent_decisions` | Decided and executed audit rows (`limit` 1 to 500, default 50). Surfaced in **Settings → Approval history**. |
-| `openhuman.approval_decide` | Apply a decision (`approve_once` / `approve_always_for_tool` / `deny`). |
-
-`list_pending` and `list_recent_decisions` return empty rather than an error when no gate is installed; `decide` errors when the gate is absent or the request is unknown or already decided.
+| `openhuman.approval_list_recent_decisions` | Decided and executed audit rows (`limit` 1 to 500, default 50), shown in **Settings > Approval history**. |
+| `openhuman.approval_decide` | Applies a decision (`approve_once`, `approve_always_for_tool` or `deny`). |
-***
+The two list methods return an empty list, not an error, when no gate is installed. `decide` returns an error when the gate is absent or the request is unknown or already decided.
## See also
-* [Privacy & Security](privacy-and-security/): what leaves the machine, and the layers underneath this one.
-* [Security architecture](../developing/architecture/security.md): command classification and policy internals.
-* [Agent access settings](settings.md): where the tier, the trusted roots and the allowlist are edited.
+- [Privacy and security](privacy-and-security.md): what leaves the machine, and the layers underneath this one.
+- [Security architecture](../developing/architecture/security.md): command classification and policy internals.
+- [Agent access settings](settings.md): where the tier, the trusted roots and the allowlist are edited.
diff --git a/docs/gitbooks/en/features/billing-and-usage.md b/docs/gitbooks/en/features/billing-and-usage.md
index de04fcdbdc..d66e8d604c 100644
--- a/docs/gitbooks/en/features/billing-and-usage.md
+++ b/docs/gitbooks/en/features/billing-and-usage.md
@@ -1,110 +1,102 @@
---
description: >-
- Plans, credits and saved cards over Stripe and Coinbase, plus a local
+ Plans, credits and saved cards paid through Stripe or Coinbase, plus a local
dashboard for token usage and cost estimates.
icon: credit-card
---
-# Billing, Cost & Usage
+# Billing, cost and usage
-OpenHuman keeps two related but separate ledgers. **Billing** is what you pay the hosted backend: plans, credit top-ups, saved cards and coupons, all settled through Stripe or Coinbase. **Cost & Usage** is what the agent spends on your behalf, tracked locally per provider call so you can inspect estimated token costs.
+OpenHuman keeps two separate ledgers. Billing is what you pay the hosted backend: plans, credit top-ups, saved cards and coupons, settled through Stripe or Coinbase. Cost and usage is what the agent spends on your behalf, tracked locally for each provider call so you can see estimated token costs.
-The first lives in the cloud; the second never leaves your workspace.
+Billing lives in the cloud. Cost and usage never leaves your workspace.
-***
+## Billing and payments
-## Part 1: Billing & Payments
+The `billing` domain holds no payment logic or state of its own. Each operation forwards an authenticated HTTPS call to the hosted backend (`/payments/*`, `/coupons/*`) using your stored app session and returns the backend's JSON response as is. The backend enforces authorization, plan ownership and payment policy. A missing or invalid session gets the backend's `401` or `403` directly. Tokens and card data are never logged.
-The `billing` domain is a thin RPC adapter. It holds **no payment logic or state of its own**. Every operation forwards an authenticated HTTPS call to the hosted backend (`/payments/*`, `/coupons/*`) using your stored app-session JWT, and surfaces the JSON response verbatim. Authorization, plan ownership and payment policy are all enforced backend-side. A missing or invalid session yields the backend's `401`/`403` directly; JWTs and card data are never logged.
-
-Pre-HTTP, the adapter does light input validation only: non-empty plan/coupon/payment-method ids, a finite positive `amountUsd`, and a gateway whitelist of `stripe` / `coinbase`.
+Before sending anything, the adapter checks only the basics: plan, coupon and payment-method ids are not empty, `amountUsd` is a positive number, and the gateway is `stripe` or `coinbase`.
### Plans
-Three tiers are offered, each with a monthly and annual interval:
+There are three tiers, each with a monthly and an annual price.
-| Tier | Monthly | Annual | Per-call discount vs pay-as-you-go |
-| --------- | ------- | --------- | ---------------------------------- |
-| **Free** | $0 | $0 | None (pay-as-you-go baseline) |
-| **Basic** | $19.99 | $199 | 50% cheaper per call |
-| **Pro** | $199.99 | $1,799.99 | 90% cheaper per call |
+| Tier | Monthly | Annual | Per-call discount vs pay-as-you-go |
+| ----- | ------- | --------- | ---------------------------------- |
+| Free | $0 | $0 | None (the pay-as-you-go baseline) |
+| Basic | $19.99 | $199 | 50% cheaper per call |
+| Pro | $199.99 | $1,799.99 | 90% cheaper per call |
-Higher tiers do not unlock features so much as lower the **per-call margin** over the pay-as-you-go baseline. All tiers have "access to everything"; you are buying cheaper inference, not gated capabilities.
+Higher tiers do not unlock features. Every tier has access to everything. You are buying cheaper inference.
### Payment providers
-Two gateways are wired, and only two:
+Two gateways are supported:
-* **Stripe**: plan purchases (Checkout sessions), the customer billing portal, credit top-ups, saved-card management (SetupIntents) and auto-recharge.
-* **Coinbase Commerce**: crypto charges, used for credit top-ups and annual billing.
+- Stripe handles plan purchases (Checkout sessions), the customer billing portal, credit top-ups, saved cards (SetupIntents) and auto-recharge.
+- Coinbase Commerce handles crypto charges for credit top-ups and annual billing.
-`top_up_credits` and `create_coinbase_charge` default to the `stripe` gateway and `annual` interval; an empty or whitespace gateway normalises to Stripe.
+`top_up_credits` and `create_coinbase_charge` default to the `stripe` gateway and the `annual` interval. An empty gateway becomes Stripe.
-### Credits, top-ups & auto-recharge
+### Credits, top-ups and auto-recharge
-Beyond a subscription you hold a **USD credit balance**. You can read the balance, page through transaction history, and top up via either gateway. **Auto-recharge** (Stripe only) re-fills credits from a saved card when the balance runs low; you can read and update its settings, and list / add / update / delete saved cards. Adding a card creates a Stripe SetupIntent; deleting one is treated as a dangerous operation.
+Besides a subscription, you can hold a USD credit balance. You can read the balance, page through transaction history, and top up through either gateway. Auto-recharge (Stripe only) refills credits from a saved card when the balance runs low. You can read and change its settings, and list, add, update and delete saved cards. Adding a card creates a Stripe SetupIntent. Deleting one is treated as a dangerous operation.
### Coupons
-Coupon codes are redeemed against the backend (`POST /coupons/redeem`), and you can list the coupons currently redeemed on your account (`GET /coupons/me`).
+You can redeem a coupon code (`POST /coupons/redeem`) and list the coupons on your account (`GET /coupons/me`).
### Where billing lives in the app
-The **Billing** button on the desktop Accounts page opens the hosted web billing dashboard, where you can manage plans, top-ups, coupons, cards, and invoices. The former desktop Billing summary page has been removed. Other clients can reach the same hosted billing operations through the authenticated RPC controllers described below; they are not exposed as agent tools.
+The **Billing** button on the desktop Accounts page opens the hosted billing dashboard. There you manage plans, top-ups, coupons, cards and invoices. Other clients can reach the same operations through the RPC controllers below. They are not exposed as agent tools.
### RPC surface
-Namespace `billing`, exposed as `openhuman.billing_*`. The registered set is `all_billing_registered_controllers` in `crates/openhuman-tinyhumans/src/hosted/billing/schemas.rs`:
+The namespace is `billing`, exposed as `openhuman.billing_*`.
-| Area | Methods |
-| ---------------- | ----------------------------------------------------------------------------------------------------------- |
+| Area | Methods |
+| --- | --- |
| Plan and summary | `billing_get_summary`, `billing_get_current_plan`, `billing_purchase_plan`, `billing_create_portal_session` |
-| Credits | `billing_get_balance`, `billing_top_up`, `billing_create_coinbase_charge`, `billing_get_transactions` |
-| Auto-recharge | `billing_get_auto_recharge`, `billing_update_auto_recharge` |
-| Saved cards | `billing_get_cards`, `billing_create_setup_intent`, `billing_update_card`, `billing_delete_card` |
-| Coupons | `billing_redeem_coupon`, `billing_get_coupons` |
-
-***
+| Credits | `billing_get_balance`, `billing_top_up`, `billing_create_coinbase_charge`, `billing_get_transactions` |
+| Auto-recharge | `billing_get_auto_recharge`, `billing_update_auto_recharge` |
+| Saved cards | `billing_get_cards`, `billing_create_setup_intent`, `billing_update_card`, `billing_delete_card` |
+| Coupons | `billing_redeem_coupon`, `billing_get_coupons` |
-## Part 2: Cost & Usage Dashboard
+## Cost and usage dashboard
-The `cost` domain is entirely local. It records every provider call's token usage and computed USD cost to an append-only JSONL file (`<workspace>/state/costs.jsonl`), keeps in-memory daily/monthly aggregates and serves a 7-day dashboard over JSON-RPC. A process-global singleton tracker is shared by the agent turn loop (which logs telemetry after each provider call) and the dashboard handlers, so each call is persisted exactly once.
+The `cost` domain is entirely local. It records the token usage and USD cost of every provider call to an append-only file (`<workspace>/state/costs.jsonl`), keeps daily and monthly totals in memory, and serves a 7-day dashboard over JSON-RPC. One tracker is shared by the agent loop and the dashboard, so each call is saved exactly once.
-### Real-time token & cost tracking
+### How cost is computed
-For each call, per-call cost is computed from token counts and per-million-token prices (clamping non-finite or negative prices to `0.0`). When the provider echoes an authoritative `charged_amount_usd` that value wins; otherwise OpenHuman falls back to a static pricing catalog of known models. Usage is bucketed in UTC, keyed by model, with the **provider** derived from the `provider/model` prefix. All-zero usage payloads are skipped so providers that don't report usage don't inflate the request count.
+Cost per call comes from token counts and per-million-token prices. Non-finite or negative prices count as zero. If the provider reports the amount it charged (`charged_amount_usd`), that value wins. Otherwise OpenHuman uses a built-in price list of known models. Usage is bucketed by UTC day and keyed by model, and the provider comes from the `provider/model` prefix. Calls with all-zero usage are skipped, so providers that do not report usage do not inflate the request count.
-### Local tracking and usage view
+### Usage views
-The local `[cost] monthly_limit_usd` setting is a legacy display target, not an enforced cap. The core no longer refuses requests when estimated cost passes it. Hosted credit exhaustion is enforced by the backend and is separate from the local usage ledger. The Usage view therefore does not show a budget gauge, limit status, or daily threshold colors.
+The `[cost] monthly_limit_usd` setting is a display target, not a cap. The core does not refuse requests when estimated cost passes it. The backend enforces hosted credit limits separately, so the Usage view shows no budget gauge or limit status.
-Settings → **Usage** shows the last seven UTC calendar days of recorded cost and token activity, a monthly pace projection, and a per-model breakdown. Costs can be estimates when the provider did not return a charged amount. The dashboard refreshes about every 10 seconds.
+**Settings > Usage** shows the last seven UTC days of recorded cost and token activity, a projection of the month's pace, and a per-model breakdown. Costs are estimates when the provider did not return a charged amount. The dashboard refreshes about every 10 seconds.
-The **Usage log** tab shows local provider-call records in a selected rolling period. It fetches at most 1,000 newest rows and supports category, provider, cost-source, and model/session filters over those loaded rows. The displayed row count and cost are for the filtered loaded set, not a complete billing total.
+The **Usage log** tab lists local provider-call records for a rolling period. It loads at most the 1,000 newest rows and lets you filter them by category, provider, cost source, and model or session. The row count and cost shown cover the filtered rows that were loaded, not a full billing total.
### RPC surface
-Namespace `cost`, exposed as `openhuman.cost_*`:
-
-| Method | Inputs | Output |
-| ------------------------ | ------------------------------------- | ----------------------------------------------------------------------------- |
-| `cost_get_dashboard` | none | 7-day buckets, summary metrics, legacy budget fields, per-model breakdown |
-| `cost_get_daily_history` | `days?` (default 7, clamped 1 to 366) | Ordered daily entries, oldest first, gaps zero-filled |
-| `cost_get_summary` | none | Live session / daily / monthly cost summary |
-| `cost_get_usage_log` | `days?`, `limit?` | Newest local provider-call records and category totals, bounded to 1,000 rows |
-
-These are also exposed as read-only, default-ON agent tools so the agent can inspect its own spend.
+The namespace is `cost`, exposed as `openhuman.cost_*`.
-***
+| Method | Inputs | Output |
+| ------------------------ | ------------------------------------- | ------------------------------------------------------------------------- |
+| `cost_get_dashboard` | none | 7-day buckets, summary metrics, budget fields, per-model breakdown |
+| `cost_get_daily_history` | `days?` (default 7, clamped 1 to 366) | Daily entries, oldest first, gaps filled with zero |
+| `cost_get_summary` | none | Live session, daily and monthly cost summary |
+| `cost_get_usage_log` | `days?`, `limit?` | Newest local provider-call records and category totals, up to 1,000 rows |
-## Cost & token compression
+These are also read-only agent tools, on by default, so the agent can check its own spend.
-Because cost tracks **real token counts**, anything that shrinks the prompt directly lowers spend. OpenHuman's [TokenJuice token compression](token-compression.md) reduces the tokens sent on each call, and [model routing](model-routing/) sends work to the cheapest model that can handle it. Both can show up as lower recorded costs in the dashboard.
+## Lowering cost
-***
+Cost follows real token counts, so anything that shrinks the prompt lowers spend. [Token compression](token-compression.md) cuts the tokens sent on each call, and [model routing](model-routing/README.md) sends work to the cheapest model that can handle it. Both show up as lower costs in the dashboard.
## See also
-* [Smart Token Compression](token-compression.md): fewer tokens on each call, so a lower recorded cost.
-* [Automatic Model Routing](model-routing/): sends work to the cheapest model that can handle it.
-* [Privacy & Security](privacy-and-security/): what is logged, and what never is.
+- [Token compression](token-compression.md): fewer tokens on each call.
+- [Model routing](model-routing/README.md): the cheapest capable model for each task.
+- [Privacy and security](privacy-and-security.md): what is logged, and what never is.
diff --git a/docs/gitbooks/en/features/channels.md b/docs/gitbooks/en/features/channels.md
index cc7919b941..2352b1df65 100644
--- a/docs/gitbooks/en/features/channels.md
+++ b/docs/gitbooks/en/features/channels.md
@@ -1,93 +1,86 @@
---
description: >-
- Messaging platforms OpenHuman talks back to you on: inbound dispatch into the
- agent loop, outbound replies and proactive delivery, and per-channel
- credentials.
+ Messaging apps OpenHuman talks back to you on: how messages reach the agent,
+ how replies and proactive messages go out, and how each channel signs in.
+icon: messages-square
---
-# Messaging Channels
+# Messaging channels
-A **channel** is a messaging platform OpenHuman uses to _talk back_ to you. This is the mirror image of an [integration](integrations/): an integration is mostly a source the agent _reads from_ (your inbox, your calendar, your CRM), while a channel is a two-way conversation surface. You message the agent on a platform you already use, and the agent replies there.
+A channel is a messaging app the agent uses to talk to you. You message the agent on a platform you already use, and it replies there. A channel is the opposite of an [integration](integrations/README.md). An integration is mostly something the agent reads from, such as your inbox, calendar or CRM. A channel is a two-way conversation.
-Under the hood every channel implements one small Rust contract (a `send` path for outbound messages and a `listen` path for inbound ones), so the same agent loop serves Telegram, Discord, the built-in web chat, and a dozen others without per-platform branching in the core.
-
-***
+Every channel follows the same small contract: one path to send messages and one to listen. That is why the same agent loop can serve Telegram, Discord, the built-in web chat and a dozen others without per-platform code.
## What a channel does
-Each channel does two things:
+A channel handles two directions.
-* **Inbound**: when a message arrives, the channel normalizes it into a `ChannelMessage` (sender, reply target, content, optional thread id) and hands it to the dispatch loop. Dispatch spawns or resumes an agent run, scopes its tools, and the agent works the request. Some platforms support a `/models` and `/model` command to switch the model for that sender's session; Telegram additionally supports remote-control commands.
-* **Outbound**: the agent's response is sent back through the same channel to your `reply_target`, threaded when the platform supports it. Channels can also deliver **proactively** (no incoming message to reply to) when fired by a [trigger](integrations/triggers.md) or a cron job. A channel only receives proactive sends if it advertises a default delivery target; channels without one are skipped rather than posted to an empty recipient.
+**Inbound.** When a message arrives, the channel turns it into a standard message (sender, reply target, content, optional thread id) and hands it to the dispatch loop. Dispatch starts or resumes an agent run, limits its tools, and the agent works on the request. Some platforms support `/models` and `/model` to switch the model for that sender's session. Telegram also supports remote-control commands.
-Channels that support it can show a typing indicator, stream progressive **draft updates**, post **threaded replies**, and add **emoji reactions**. Capabilities are declared per channel, not assumed.
+**Outbound.** The agent's reply goes back through the same channel to your reply target, in a thread when the platform supports it. A channel can also send proactively, with no incoming message, when a [trigger](integrations/triggers.md) or a cron job fires. A channel receives proactive messages only if it has a default delivery target. Channels without one are skipped.
-***
+Where the platform allows it, channels can show a typing indicator, stream draft updates, post threaded replies and add emoji reactions. Each channel declares what it supports.
## Supported channels
-OpenHuman ships **15 channel provider modules**, of which **14 compile into the shipped desktop build**: WhatsApp Web sits behind the `whatsapp-web` Cargo feature, which is in neither the contributor default set nor the shipped product set, so it is an opt-in build rather than something you can switch on. Alongside them, the in-app **Web** chat is built into the app rather than being a provider module, and a separate `cli` channel serves the `openhuman-core` terminal binary. **Eight** channels have a setup flow in the app (Telegram, Discord, Web, iMessage, Lark/Feishu, DingTalk, Email, 元宝); the rest are enabled by hand in `config.toml`.
+OpenHuman has 15 channel providers. 14 are built into the shipped desktop app. WhatsApp Web sits behind the `whatsapp-web` build feature, which the shipped app does not enable, so you can't switch it on. The in-app Web chat is built in and is not a provider. A separate `cli` channel serves the `openhuman-core` terminal binary. Eight channels have a setup flow in the app: Telegram, Discord, Web, iMessage, Lark/Feishu, DingTalk, Email and 元宝 (Yuanbao). You turn on the rest by hand in `config.toml`.
-Matrix is the one to know about: a `[channels.matrix]` stanza is still accepted by the config parser, but the provider was removed from the build. It is logged and skipped, so a Matrix config does nothing.
+Matrix is no longer supported. The config parser still accepts a `[channels.matrix]` section, but the provider was removed, so it is logged and skipped.
-| Channel | Direction | Inbound transport | Credential mode | In Settings UI |
-| ----------------- | ------------- | ---------------------------- | ------------------------------------------------------------------ | -------------- |
-| **Telegram** | Two-way | Bot API long-poll | Connect via OpenHuman (managed DM) **or** your own BotFather token | Yes |
-| **Discord** | Two-way | Gateway | Your own bot token, OAuth install, **or** managed account link | Yes |
-| **Web** | Two-way | In-app | Built-in, no setup (local) | Yes |
-| **iMessage** | Two-way | macOS Messages (AppleScript) | Local-only, no credentials (needs Full Disk Access) | Yes |
-| **Lark / Feishu** | Two-way | WebSocket or webhook | Your own app id + secret | Yes |
-| **DingTalk** | Two-way | Stream Mode WebSocket | Your own client id + secret | Yes |
-| **元宝 (Yuanbao)** | Two-way | WebSocket | Your own AppID + AppSecret | Yes |
-| **Slack** | Two-way | Events/socket | Your own bot token | `config.toml` |
-| **WhatsApp** | Two-way | Meta Cloud webhook | Your own access token | `config.toml` |
-| **IRC** | Two-way | Persistent socket | Your own server/nick | `config.toml` |
-| **Signal** | Two-way | signal-cli REST events | Your own linked signal-cli account | `config.toml` |
-| **Mattermost** | Two-way | WebSocket | Your own bot token | `config.toml` |
-| **QQ** | Two-way | WebSocket | Your own bot credentials | `config.toml` |
-| **Linq** | Two-way (SMS) | Webhook | Your own API token | `config.toml` |
-| **Email** | Two-way | IMAP IDLE + SMTP | Your own mailbox credentials | `config.toml` |
+| Channel | Direction | Inbound transport | Credentials | In Settings UI |
+| ------------------ | ------------- | ---------------------------- | ------------------------------------------------------------------ | -------------- |
+| Telegram | Two-way | Bot API long-poll | Connect via OpenHuman (managed DM) or your own BotFather token | Yes |
+| Discord | Two-way | Gateway | Your own bot token, OAuth install, or managed account link | Yes |
+| Web | Two-way | In-app | Built in, no setup (local) | Yes |
+| iMessage | Two-way | macOS Messages (AppleScript) | Local only, no credentials (needs Full Disk Access) | Yes |
+| Lark / Feishu | Two-way | WebSocket or webhook | Your own app id and secret | Yes |
+| DingTalk | Two-way | Stream Mode WebSocket | Your own client id and secret | Yes |
+| 元宝 (Yuanbao) | Two-way | WebSocket | Your own AppID and AppSecret | Yes |
+| Slack | Two-way | Events/socket | Your own bot token | `config.toml` |
+| WhatsApp | Two-way | Meta Cloud webhook | Your own access token | `config.toml` |
+| IRC | Two-way | Persistent socket | Your own server and nick | `config.toml` |
+| Signal | Two-way | signal-cli REST events | Your own linked signal-cli account | `config.toml` |
+| Mattermost | Two-way | WebSocket | Your own bot token | `config.toml` |
+| QQ | Two-way | WebSocket | Your own bot credentials | `config.toml` |
+| Linq | Two-way (SMS) | Webhook | Your own API token | `config.toml` |
+| Email | Two-way | IMAP IDLE and SMTP | Your own mailbox credentials | Yes |
-WhatsApp also has an experimental peer-to-peer variant behind the `whatsapp-web` feature flag. Channels marked "webhook" keep a live connection alive but receive inbound messages by HTTP push, so they need a reachable HTTPS endpoint configured on the provider's side.
+WhatsApp also has an experimental peer-to-peer variant behind the `whatsapp-web` feature. Channels that use a webhook receive messages by HTTP push, so they need an HTTPS endpoint that the provider can reach.
-Telegram is the most fully featured channel. It supports typing indicators and live draft updates, and is currently the only channel wired to a per-channel approval surface, so `Prompt`-class tool calls can be answered inline rather than parked. Discord adds native threaded replies; Lark also threads. Web supports rich text and stays entirely local.
+Telegram has the most features. It supports typing indicators and live draft updates, and it is the only channel with its own approval surface, so approval prompts can be answered inline. Discord adds native threaded replies, and Lark threads too. Web supports rich text and stays entirely local.
-**Email deserves a special mention**: it is a fully **native, self-hosted connector**, with no third-party broker in the loop. Inbound mail arrives over IMAP with **IMAP IDLE** push (new mail reaches the agent in seconds, with the connection refreshed every \~29 minutes per the RFC), and replies go out over SMTP with full attachment/multipart support, from your own address on any provider you configure. An `allowed_senders` allowlist is the inbound security gate. Set it explicitly to the addresses you trust. (In `config.toml` an empty list means deny-all, but the Connections UI defaults a blank field to `["*"]`, which allows **any** sender. So don't leave it blank if strangers shouldn't be able to prompt your agent by email.)
+### Email
-***
+Email is a native, self-hosted connector with no third-party broker. Inbound mail arrives over IMAP IDLE push, so new mail reaches the agent in seconds. The connection refreshes about every 29 minutes, as the RFC requires. Replies go out over SMTP with full attachment support, from your own address on any provider you configure.
-## Credential modes
+An `allowed_senders` list controls who can reach the agent by email. Set it to the addresses you trust. In `config.toml`, an empty list denies everyone. The Connections UI is different: a blank field becomes `["*"]`, which allows any sender. Don't leave it blank if strangers should not be able to prompt your agent.
-Channels authenticate one of a few ways:
+## Credential modes
-* **Connect via OpenHuman (managed)**: a one-click, encrypted connection brokered through the OpenHuman backend. Today this covers Telegram (message the managed bot directly) and Discord (link your account or install via OAuth). No tokens live on your machine.
-* **Your own credentials**: you supply a bot token, API key/secret, or app credentials. Telegram (BotFather token), Discord (bot token), Slack, WhatsApp, Lark/Feishu, DingTalk, Yuanbao, Signal, Mattermost, QQ, Linq, IRC, and Email all support this. Maximum control; you own the platform account, rate limits, and any webhook endpoint.
-* **Local, no credentials**: the **Web** chat and **iMessage** need no tokens at all. Web runs inside the desktop app; iMessage drives the local macOS Messages app over an AppleScript bridge (grant Full Disk Access). Both keep messages on your machine.
+Channels sign in one of three ways.
-Secrets supplied for any mode are stored through OpenHuman's credential layer and protected at rest by the [encryption layer](privacy-and-security/). They are never written to `config.toml` in plaintext for the UI-managed channels.
+- **Connect via OpenHuman (managed).** A one-click encrypted connection brokered by the OpenHuman backend. It covers Telegram (message the managed bot directly) and Discord (link your account or install through OAuth). No tokens are stored on your machine.
+- **Your own credentials.** You supply a bot token, API key and secret, or app credentials. Telegram (BotFather token), Discord, Slack, WhatsApp, Lark/Feishu, DingTalk, Yuanbao, Signal, Mattermost, QQ, Linq, IRC and Email all support this. You get the most control, and you own the platform account, rate limits and any webhook endpoint.
+- **Local, no credentials.** Web chat and iMessage need no tokens. Web runs inside the desktop app. iMessage drives the local macOS Messages app through AppleScript, so grant Full Disk Access. Both keep messages on your machine.
-***
+Secrets for any mode go through OpenHuman's credential layer and are encrypted at rest (see [Privacy and security](privacy-and-security.md)). Channels managed in the UI never write secrets to `config.toml` in plaintext.
## Where to connect a channel
-Channels are set up under **Connections → Channels** in the left sidebar, **not** under Settings, and not under any "Automation & Channels" menu (no such menu exists). Open that tab, pick a platform tile, and follow its setup card:
+Set up channels under **Connections > Channels** in the left sidebar, not under Settings. Open that tab, pick a platform tile and follow its setup card:
-* **Discord**: choose _Connect via OpenHuman_ (link your account or install the bot via OAuth), or paste your own Discord bot token.
-* **Telegram**: message the managed OpenHuman bot to link, or paste a BotFather bot token.
+- **Discord.** Choose Connect via OpenHuman (link your account or install the bot through OAuth), or paste your own bot token.
+- **Telegram.** Message the managed OpenHuman bot to link, or paste a BotFather token.
-Slack is connected as an **app** under **Connections → OAuth** (Composio) so the agent can read and act in Slack; it is not set up as a talk-back channel in the Channels tab.
-
-***
+Slack is connected as an app under **Connections > OAuth** so the agent can read and act in Slack. It is not set up as a talk-back channel in the Channels tab.
## Choosing the default channel
-Open **Connections → Channels** to pick which channel is the **active route**: the one OpenHuman uses for proactive, recipient-less delivery (cron, triggers). The default is the in-app **Web** chat until you change it. Setting a new default takes effect immediately, without restarting the channel runtime, and the panel shows which channel is currently active. Inbound messages always get answered on whatever channel they arrived on, regardless of the default route.
-
-***
+In **Connections > Channels** you can pick the active route, which is the channel used for proactive messages with no recipient, such as cron jobs and triggers. The default is the in-app Web chat. A new default takes effect immediately, with no restart, and the panel shows which channel is active. Replies to inbound messages always go back on the channel they came from, whatever the default is.
## See also
-* [Integrations](integrations/): the read-side catalog the agent pulls context from.
-* [Triggers](integrations/triggers.md): live events that fire proactive channel delivery.
-* [Privacy & Security](privacy-and-security/): where credentials live and the backend boundary.
-* [OS Keyring & Secret Storage](privacy-and-security/os-keyring-and-secret-storage.md): at-rest protection for channel secrets.
+- [Integrations](integrations/README.md): the catalog the agent pulls context from.
+- [Triggers](integrations/triggers.md): live events that fire proactive channel messages.
+- [Privacy and security](privacy-and-security.md): where credentials live and the backend boundary.
+- [OS keyring and secret storage](os-keyring-and-secret-storage.md): at-rest protection for channel secrets.
diff --git a/docs/gitbooks/en/features/chat.md b/docs/gitbooks/en/features/chat.md
index ab3e14aec1..f96968081f 100644
--- a/docs/gitbooks/en/features/chat.md
+++ b/docs/gitbooks/en/features/chat.md
@@ -1,97 +1,97 @@
---
description: >-
- The chat surface: composer, slash commands, mentions, model and effort
+ The chat screen: composer, slash commands, mentions, model and effort
pickers, the context ring, the tool timeline, approvals, sub-agent cards,
- artifacts and threads.
+ files and threads.
icon: comments
---
# Chat
-Chat is where almost everything happens. It is not a text box with a send button: a turn here can call tools, spawn sub-agents, stop to ask you something, park an action for approval, produce files, and bill itself, and the transcript shows all of it in order.
+Chat is where almost everything happens. A turn here can call tools, spawn sub-agents, stop to ask you a question, wait for your approval, produce files and track its own cost. The transcript shows all of it in order.
-Open it at **Chat** in the sidebar, or `⌘N` for a new conversation.
+Open it from **Chat** in the sidebar, or press `⌘N` for a new conversation.
## The composer
-The input is a rich text field rather than a plain one, which is what lets a `/` become a command chip and a popover anchor to the caret as you type. Alongside it:
+The input is a rich text field. That is how a `/` becomes a command chip and a popover follows your cursor as you type. Around it you have:
-* **Attach** files. An image, a PDF, an Office document or an archive is preserved in the working folder and offered to the model natively when the model and the route both support that type; otherwise it degrades to extracted text, a bounded readout, or an archive listing with accessible paths.
-* **Model**, and a separate **thinking effort**. Both apply to this conversation, not globally.
-* **Context ring**, which shows how full the context window is for this thread and opens a breakdown with per-sub-agent cost.
-* **Voice**: tap to speak, or hand the turn to the live voice agent. See [Voice](native-tools/voice.md).
-* When the box is empty, the mascot button takes you to the full-screen [mascot](mascot.md) stage.
+- **Attach**. Images, PDFs, Office documents and archives are saved in the working folder. The model gets them natively when both the model and the route support that type. Otherwise it gets extracted text, a short readout, or an archive listing.
+- **Model** and **thinking effort**. Both apply to this conversation only, not globally.
+- **Context ring**. It shows how full the context window is for this thread. Click it for a breakdown with the cost of each sub-agent.
+- **Voice**. Tap to speak, or hand the turn to the live voice agent. See [Voice](native-tools/voice.md).
+- **Mascot button**. When the box is empty, it opens the full-screen [mascot](mascot/README.md) stage.
### Slash commands
-Typing `/` offers three sources at once: the built-ins (`/new`, `/clear`, `/stop`, `/plan`, `/build`), the core's own command list, and your installed skills and workflows.
+Typing `/` lists the built-in commands (`/new`, `/clear`, `/stop`, `/plan`, `/build`), the core's own commands, and your installed skills and workflows.
### Mentions
-Typing `@` offers two sources: **memory**, searched as you type, and **files**, meaning the artifacts this thread has already produced. A mention becomes a chip, so the agent gets the reference rather than a guess at what you meant.
+Typing `@` offers your memory, searched as you type, and the files this thread has already produced. A mention becomes a chip, so the agent gets the exact reference and does not have to guess.
## Reading a turn
-Each assistant turn groups its reasoning and its tool calls into one chronological block, so you can see what it thought and what it did in the order it happened rather than in two separate panes.
+Each assistant turn puts its reasoning and tool calls in one block, in the order they happened.
-* **Tool calls** render per tool: a search shows its queries and sources, a shell call shows its command and exit, a failed call shows a failure card with the reason rather than a stack trace. Every tool runs in the core; nothing executes in the browser.
-* **Sources** appear as badges under an answer, up to four inline and then a count.
-* **Timing and cost** are on the turn, and the context ring's breakdown attributes spend to the sub-agents that caused it.
-* **Find in conversation** (`⌘F`) searches this thread only, and the right-edge rail jumps between turns.
+- Tool calls render by tool. A search shows its queries and sources. A shell call shows its command and exit code. A failed call shows the reason, not a stack trace. Every tool runs in the core, never in the browser.
+- Sources appear as badges under an answer: up to four, then a count.
+- Timing and cost are shown on the turn. The context ring attributes spend to the sub-agents that caused it.
+- **Find in conversation** (`⌘F`) searches this thread only. The rail on the right edge jumps between turns.
-The action bar on an assistant turn has copy, regenerate, a thumbs up or down that is remembered, read-aloud, and export as Markdown. On your own turns you can edit and resend, which branches the conversation: the branch picker moves between versions.
+An assistant turn has copy, regenerate, thumbs up or down (remembered), read aloud, and export as Markdown. On your own turns you can edit and resend. That branches the conversation, and the branch picker switches between versions.
## When the agent needs you
-Four different kinds of stop, all inline:
+The agent can stop for four reasons, all shown inline:
-| Stop | What it looks like |
-| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **Approval** | A card naming the tool and a redacted one-line summary of the action. Approve once, always allow that tool, or deny. See [Approval Gate](approval-gate.md). |
-| **Permission** | A connector or provider needs authorizing; the card collects exactly the fields that provider needs. |
-| **Clarification** | The agent asks a direct question and waits. |
-| **Plan review** | A proposed plan with approve, reject, or revise-with-feedback. |
+| Stop | What you see |
+| --- | --- |
+| Approval | A card naming the tool and a redacted one-line summary. Approve once, always allow that tool, or deny. See [Approval gate](approval-gate.md). |
+| Permission | A connector or provider needs authorizing. The card asks for exactly the fields that provider needs. |
+| Clarification | The agent asks a direct question and waits. |
+| Plan review | A proposed plan. Approve it, reject it, or ask for a revision with feedback. |
-A background or scheduled turn has nobody to ask, so an approval raised outside a live chat collects in a deck you can decide later. Undecided requests deny themselves after ten minutes.
+A background or scheduled turn has nobody to ask. Approvals raised outside a live chat collect in a deck you can decide later. Undecided requests are denied after ten minutes.
## Sub-agents
-When a turn delegates, each child appears as its own card: a nested transcript, its own status, a reply box when it is waiting on you, and a cancel button. Delegation is asynchronous, so the parent keeps working and the card fills in as the child reports. Detached background agents, scheduled runs and memory syncs collect in a separate inbox card rather than interrupting the thread.
+When a turn delegates work, each child gets its own card. The card has a nested transcript, a status, a reply box if the child is waiting on you, and a cancel button. Delegation is asynchronous, so the parent keeps working while the card fills in. Detached background agents, scheduled runs and memory syncs collect in a separate inbox card so they don't interrupt the thread.
## Files the agent makes
-Anything the agent produces that is meant for you, a document, a deck, an image, a render, becomes an artifact: a chip above the composer opens a panel with download, reveal in folder, and delete. Only finished artifacts persist across a restart; a failed one offers a retry.
+Anything the agent produces for you, such as a document, a deck, an image or a render, becomes an artifact. A chip above the composer opens a panel where you can download it, reveal it in its folder, or delete it. Only finished artifacts survive a restart. A failed one offers a retry.
## Workflow proposals
-Ask for an automation and the agent proposes a graph. The proposal is validate-only: it arrives as a card with the node list and three choices, save and enable, dismiss, or open it on the canvas. That card is the only path from a proposal to a saved automation, which is deliberate. See [Workflows](workflows.md).
+If you ask for an automation, the agent proposes a graph. The proposal is validate-only. It arrives as a card with the node list and three choices: save and enable, dismiss, or open on the canvas. That card is the only way to turn a proposal into a saved automation. See [Workflows](workflows.md).
## Threads
-The sidebar lists your conversations. You can create, select, rename inline, and delete behind a confirmation. Turns on different threads run **concurrently**, so starting something slow in one conversation does not block another.
+The sidebar lists your conversations. You can create, select, rename and delete them (delete asks for confirmation). Turns on different threads run at the same time, so a slow task in one conversation does not block another.
-Threads carry a goal and a to-do list when the agent sets them, shown as a pinned list and a banner with its token budget. Both are read-only in the UI today: the agent maintains them, you do not edit them there.
+A thread can carry a goal and a to-do list that the agent sets. They show as a pinned list and a banner with the token budget. The agent maintains them. You can't edit them in the UI yet.
-A long conversation is compacted rather than truncated. The compaction seals what came before and opens a new generation that records the sealed one as its parent, so nothing is deleted on disk even though the model only reads the head. There is no UI for browsing those generations yet.
+A long conversation is compacted, not truncated. Compaction seals what came before and starts a new generation that points back to the sealed one. Nothing is deleted on disk, though the model reads only the latest generation. There is no UI for browsing older generations yet.
## Keyboard
-| Shortcut | Action |
-| ----------- | ------------------------- |
-| `⌘K` / `⌘P` | Command palette |
-| `⌘N` | New conversation |
-| `⌘F` | Find in this conversation |
-| `⌘B` | Toggle the sidebar |
-| `⌘,` | Settings |
-| `⌘/` or `?` | Shortcut sheet |
+| Shortcut | Action |
+| --- | --- |
+| `⌘K` / `⌘P` | Command palette |
+| `⌘N` | New conversation |
+| `⌘F` | Find in this conversation |
+| `⌘B` | Toggle the sidebar |
+| `⌘,` | Settings |
+| `⌘/` or `?` | Shortcut sheet |
## Not here yet
-Stated so you don't go looking: there is no thread search, pinning, folders or archiving in the sidebar; no UI for setting a thread goal or ticking a to-do; no browser for compaction generations; and follow-up suggestion chips are built but have no producer, so the row stays empty.
+So you don't go looking: the sidebar has no thread search, pinning, folders or archiving. There is no UI to set a thread goal or tick a to-do, and no browser for compaction generations. Follow-up suggestion chips exist in the UI but nothing produces them yet, so that row stays empty.
## See also
-* [Memory](memory.md): what the agent recalls before it answers, and what it writes after.
-* [The Orchestrator](orchestration.md): how delegation is planned.
-* [Available Tools](native-tools/): what those tool cards are calling.
-* [Notifications & Activity](notifications-and-activity.md): what happens when a turn finishes while you are elsewhere.
+- [Memory](memory.md): what the agent recalls before it answers, and what it writes after.
+- [The Orchestrator](orchestration.md): how delegation is planned.
+- [Available tools](native-tools/README.md): what those tool cards are calling.
+- [Notifications and activity](notifications-and-activity.md): what happens when a turn finishes while you are elsewhere.
diff --git a/docs/gitbooks/en/features/cloud-deploy.md b/docs/gitbooks/en/features/cloud-deploy.md
index 17b0fd3034..9a6ec34ffc 100644
--- a/docs/gitbooks/en/features/cloud-deploy.md
+++ b/docs/gitbooks/en/features/cloud-deploy.md
@@ -1,38 +1,38 @@
---
description: >-
- Hosting the headless openhuman-core on a server: DigitalOcean App Platform,
- Fly.io, Docker Compose on any VPS, or an Oracle Cloud Terraform stack, plus
- the bearer token, workspace volume, and secret-s
+ Run the headless openhuman-core on a server: DigitalOcean App Platform, Fly.io,
+ Docker Compose on any VPS, or an Oracle Cloud Terraform stack, with the bearer
+ token, workspace volume and secret storage each one needs.
icon: cloud
---
-# Cloud Deploy
+# Cloud deploy
-**Who this page is for:** an operator running the core as a server process. A desktop user never needs any of it; the shell already runs a core in-process.
+This page is for operators who want to run the core as a server process. Desktop users never need it, because the desktop app already runs a core in-process.
-OpenHuman is a desktop app, but its **Rust core** (`openhuman-core`) is a headless JSON-RPC server that can be hosted in the cloud. Deploying the core separately is useful for:
+OpenHuman is a desktop app, but its Rust core (`openhuman-core`) is also a headless JSON-RPC server that you can host in the cloud. Hosting the core separately is useful for:
-* Multi-device access, point several desktop clients at the same hosted core
-* Internal testers without local Rust toolchains
-* Long-running cron jobs / webhooks that should outlive a laptop session
+- Reaching the same core from several devices.
+- Internal testers without a local Rust toolchain.
+- Long-running cron jobs and webhooks that should outlive a laptop session.
This guide covers five deploy paths, easiest first:
-1. [DigitalOcean App Platform: one-click](cloud-deploy.md#1-digitalocean-app-platform-one-click)
-2. [DigitalOcean App Platform: manual via doctl](cloud-deploy.md#2-digitalocean-app-platform-manual-via-doctl)
-3. [Any VPS via Docker Compose](cloud-deploy.md#3-any-vps-via-docker-compose)
-4. [Fly.io](cloud-deploy.md#4-flyio)
-5. [Oracle Cloud Infrastructure: Terraform on Always Free](cloud-deploy.md#5-oracle-cloud-infrastructure-terraform-on-always-free)
+1. [DigitalOcean App Platform: one-click](#1-digitalocean-app-platform-one-click)
+2. [DigitalOcean App Platform: manual via doctl](#2-digitalocean-app-platform-manual-via-doctl)
+3. [Any VPS via Docker Compose](#3-any-vps-via-docker-compose)
+4. [Fly.io](#4-flyio)
+5. [Oracle Cloud Infrastructure: Terraform on Always Free](#5-oracle-cloud-infrastructure-terraform-on-always-free)
-What gets deployed in every path: a single container running `openhuman-core serve` on port `7788`. Public hosts should sit behind the provider's TLS, for example `https://core.example.com/rpc`. Private-only hosts on localhost, RFC1918 networks, or tailnets such as Tailscale can use plain HTTP, for example `http://100.x.x.x:7788/rpc`, when the core is not reachable from the public internet. The desktop app already knows how to talk to a remote core: it has a first-class **Settings → Core connection** panel that persists the RPC URL and bearer token, so nothing has to be put in an environment file.
+Every path deploys a single container running `openhuman-core serve` on port `7788`. Public hosts should sit behind the provider's TLS, for example `https://core.example.com/rpc`. Private-only hosts on localhost, RFC1918 networks or tailnets such as Tailscale can use plain HTTP, for example `http://100.x.x.x:7788/rpc`, when the core is not reachable from the public internet. The desktop app can talk to a remote core directly. **Settings > Core connection** saves the RPC URL and bearer token, so you don't need an environment file on the desktop.
-***
+---
## Remote UI choices
-OpenHuman's supported remote deployment is **core remote, UI local**: run `openhuman-core` on a Linux server and point a desktop client at that RPC URL. The deployed core does not serve the full React/Tauri UI as a production web app yet. Desktop-only features still need the Tauri shell, including tray controls, native deep links, the native iMessage scanner, OS keychain integration, and window/screen affordances.
+The supported remote setup is core remote, UI local. Run `openhuman-core` on a Linux server and point a desktop client at its RPC URL. The deployed core does not serve the full UI as a production web app yet. Desktop-only features still need the desktop app: tray controls, native deep links, the native iMessage scanner, OS keychain integration and window and screen features.
-For a browser-accessible UI on a private server today, use the Vite web build as a development/preview surface against the remote core:
+For a browser UI on a private server today, use the Vite web build as a development and preview surface against the remote core:
```bash
# On the server, run the core with an explicit token.
@@ -51,28 +51,38 @@ Then tunnel both ports from your workstation:
ssh -L 1420:127.0.0.1:1420 -L 7788:127.0.0.1:7788 user@server
```
-Open `http://127.0.0.1:1420`, choose the remote/core option on the first-run screen, and enter `http://127.0.0.1:7788/rpc` plus the `OPENHUMAN_CORE_TOKEN` value from the server.
+Open `http://127.0.0.1:1420`, choose the remote/core option on the first-run
+screen, and enter `http://127.0.0.1:7788/rpc` plus the
+`OPENHUMAN_CORE_TOKEN` value from the server.
-If you serve the browser UI from a non-loopback origin, add that exact origin to the core's CORS allowlist:
+If you serve the browser UI from a non-loopback origin, add that exact origin to
+the core's CORS allowlist:
```bash
export OPENHUMAN_CORE_ALLOWED_ORIGINS="https://openhuman-ui.example.com"
```
-Loopback Vite origins such as `http://127.0.0.1:1420` and `http://localhost:1420` are allowed automatically. Public `http://` origins are not recommended because every RPC call carries the bearer token.
+Loopback Vite origins such as `http://127.0.0.1:1420` and
+`http://localhost:1420` are allowed automatically. Public `http://` origins are
+not recommended because every RPC call carries the bearer token.
-***
+---
-## Single source of truth for the bearer token
+## The bearer token
-Every `/rpc` call carries `Authorization: Bearer <token>`. The core has two ways to load that token at startup ([`crates/openhuman-core/src/core/auth.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/core/auth.rs)):
+Every `/rpc` call carries `Authorization: Bearer <token>`. The core can load that token in two ways at startup:
-1. **`OPENHUMAN_CORE_TOKEN` environment variable**: pre-seeded by the caller (Tauri shell, Docker, App Platform, systemd unit, …). The core uses this value as-is and **never** writes a file.
-2. **`{workspace}/core.token` file**: generated by the core on first boot _only when `OPENHUMAN_CORE_TOKEN` is unset_. Standalone `openhuman-core run` uses this so CLI clients can `cat` the file.
+1. **`OPENHUMAN_CORE_TOKEN` environment variable**: pre-seeded by the caller
+ (Tauri shell, Docker, App Platform, systemd unit, …). The core uses this
+ value as-is and **never** writes a file.
+2. **`{workspace}/core.token` file**: generated by the core on first boot
+ _only when `OPENHUMAN_CORE_TOKEN` is unset_. Standalone `openhuman-core run`
+ uses this so CLI clients can `cat` the file.
-**Rule of thumb for any remote / dockerized deploy: always set `OPENHUMAN_CORE_TOKEN`.** Do not rely on `core.token` in a container. Ephemeral filesystems lose it on redeploy, and any client trying to read the file from outside the container will get a stale or empty value. The two paths are deliberately mutually exclusive at startup; mixing them is the most common reason behind "the dashboard gets 401 after I redeployed".
+For any remote or Docker deploy, always set `OPENHUMAN_CORE_TOKEN`. Do not rely on `core.token` in a container. Ephemeral filesystems lose it on redeploy, and a client reading the file from outside the container gets a stale or empty value. The two paths are mutually exclusive on purpose. Mixing them is the most common cause of "the dashboard gets 401 after I redeployed".
-To check what the _running_ core is using, run [`scripts/print-core-token.sh`](https://github.com/tinyhumansai/openhuman/blob/main/scripts/print-core-token.sh) on the host (or inside the container with `docker compose exec`):
+To check what the running core is using, run [`scripts/print-core-token.sh`](https://github.com/tinyhumansai/openhuman/blob/main/scripts/print-core-token.sh)
+on the host (or inside the container with `docker compose exec`):
```bash
scripts/print-core-token.sh --where # prints 'env' or 'file:/path'
@@ -80,65 +90,70 @@ scripts/print-core-token.sh --redact # first 8 hex chars + '…' (safe for lo
scripts/print-core-token.sh # full value (pipe straight into a client)
```
-The desktop app's first-run picker and **Settings → Core connection** both expose a **Test connection** button next to the Core RPC URL and token fields. It fires `core.ping` against the typed URL with the typed token and reports one of three outcomes inline, connected, auth failed or unreachable, before anything is persisted.
+The desktop app's first-run picker and **Settings > Core connection** both have a **Test connection** button next to the Core RPC URL and token fields. It sends `core.ping` to the URL you typed with the token you typed, and reports one of three results before anything is saved: connected, auth failed or unreachable.
-***
+---
## What you need before you start
-| Setting | Required | Notes |
-| ----------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `OPENHUMAN_CORE_TOKEN` | yes | Bearer token clients send to `/rpc`. Generate with `openssl rand -hex 32`. **Anyone with this token can drive the core.** |
-| `BACKEND_URL` | yes | Tinyhumans backend the core talks to (`https://api.tinyhumans.ai` for prod). |
-| `OPENHUMAN_APP_ENV` | no | `production` or `staging`. Defaults to `production`. |
+| Setting | Required | Notes |
+| ----------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `OPENHUMAN_CORE_TOKEN` | yes | Bearer token clients send to `/rpc`. Generate with `openssl rand -hex 32`. **Anyone with this token can drive the core.** |
+| `BACKEND_URL` | yes | Tinyhumans backend the core talks to (`https://api.tinyhumans.ai` for prod). |
+| `OPENHUMAN_APP_ENV` | no | `production` or `staging`. Defaults to `production`. |
| `OPENHUMAN_KEYRING_MASTER_KEY` | no | 64 hex characters (`openssl rand -hex 32`). Master key for the staging/production `encrypted_file` keyring, so a container with no OS keychain can store provider keys encrypted. Inject it from your secret manager like the bearer token; **losing it orphans every stored secret.** |
-| `OPENHUMAN_KEYRING_MASTER_KEY_FILE` | no | Path to a file holding the same value, for Docker/Kubernetes secret mounts. Set one of the two, not both. Without either, `encrypted_file` needs an OS keychain. |
-| `OPENHUMAN_CORE_HOST` | no | Defaults to `0.0.0.0` in the container. |
-| `OPENHUMAN_CORE_PORT` | no | Defaults to `7788`. |
-| `RUST_LOG` | no | `info` is fine; `debug` for triage. |
-
-Endpoints exposed by the running container, with the route policy from [`crates/openhuman-rpc/src/server/auth.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-rpc/src/server/auth.rs):
-
-| Endpoint | Auth |
-| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `GET /health` | None. The liveness probe every deploy path's healthcheck uses. |
-| `GET /` | None. Info page naming the other routes. |
-| `GET /schema` | None. Read-only schema discovery. |
-| `POST /rpc` | The bearer token. This is the executable surface. |
-| `GET /events` | Exempt from the header check, because a browser `EventSource` cannot set headers, but the handler enforces its own credential. Not an open stream. |
-| `GET /ws/dictation` | The bearer token, as a header or `?token=`, checked before the WebSocket upgrade. |
-| `GET /oauth/mcp/callback` | Exempt from the bearer middleware: an external authorization server posts back here with no bearer. The one-time `state`, minted in `oauth_begin`, is the guard. |
-| `GET /dev/connect` | Exempt from the middleware, guarded in the handler instead: a debug build or an explicit opt-in, a loopback `app` origin and `Host`, and no cross-site navigation. It should not be reachable on a deployed core. |
-| `POST /v1/chat/completions`, `GET /v1/models` | The OpenAI-compatible surface, behind core's `http-server` gate. These accept the core bearer or an external provider key, so they are executable too, not just `/rpc`. |
+| `OPENHUMAN_KEYRING_MASTER_KEY_FILE` | no | Path to a file holding the same value, for Docker/Kubernetes secret mounts. Set one of the two, not both. Without either, `encrypted_file` needs an OS keychain. |
+| `OPENHUMAN_CORE_HOST` | no | Defaults to `0.0.0.0` in the container. |
+| `OPENHUMAN_CORE_PORT` | no | Defaults to `7788`. |
+| `RUST_LOG` | no | `info` is fine; `debug` for triage. |
+
+The running container exposes these endpoints:
+
+| Endpoint | Auth |
+| --- | --- |
+| `GET /health` | None. The liveness probe every deploy path's healthcheck uses. |
+| `GET /` | None. Info page naming the other routes. |
+| `GET /schema` | None. Read-only schema discovery. |
+| `POST /rpc` | The bearer token. This is the executable surface. |
+| `GET /events` | Exempt from the header check, because a browser `EventSource` cannot set headers, but the handler enforces its own credential. Not an open stream. |
+| `GET /ws/dictation` | The bearer token, as a header or `?token=`, checked before the WebSocket upgrade. |
+| `GET /oauth/mcp/callback` | Exempt from the bearer middleware: an external authorization server posts back here with no bearer. The one-time `state`, minted in `oauth_begin`, is the guard. |
+| `GET /dev/connect` | Exempt from the middleware, guarded in the handler instead: a debug build or an explicit opt-in, a loopback `app` origin and `Host`, and no cross-site navigation. It should not be reachable on a deployed core. |
+| `POST /v1/chat/completions`, `GET /v1/models` | The OpenAI-compatible surface, behind core's `http-server` gate. These accept the core bearer or an external provider key, so they are executable too, not just `/rpc`. |
+
+Only `/health`, `/` and `/schema` are truly unauthenticated. `/events`, `/oauth/mcp/callback` and `/dev/connect` skip the header check but each has its own guard. The two executable surfaces are `/rpc` and `/v1/*`.
+
+The `OPENHUMAN_WORKSPACE` directory (`/home/openhuman/.openhuman` inside the
+container) holds the core's config, SQLite databases and skill state. Mount it on a persistent volume in every production deploy, or you will lose data on restart.
-Treat only `/health`, `/` and `/schema` as genuinely unauthenticated. `/events`, `/oauth/mcp/callback` and `/dev/connect` are exempt from the _header_ check but each carries its own guard; the two executable surfaces are `/rpc` and `/v1/*`.
-
-The `OPENHUMAN_WORKSPACE` directory (`/home/openhuman/.openhuman` inside the container) holds the core's config, sqlite databases, and skill state. **Mount it on a persistent volume** in every production deploy or you will lose data on restart.
-
-***
+---
## 1. DigitalOcean App Platform: one-click
-Click the button below to create a new App Platform application from this repository's [`.do/app.yaml`](https://github.com/tinyhumansai/openhuman/blob/main/.do/app.yaml):
+Click the button below to create an App Platform application from this repository's [`.do/app.yaml`](https://github.com/tinyhumansai/openhuman/blob/main/.do/app.yaml):
[![Deploy to DO](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/tinyhumansai/openhuman/tree/main)
Then, in the App Platform UI, **before the first deploy completes**:
-1. Open the **Settings → App-Level Environment Variables** tab.
-2. Replace the placeholder `OPENHUMAN_CORE_TOKEN` value with a strong secret (`openssl rand -hex 32`). Mark it encrypted.
-3. If you are deploying staging, change `OPENHUMAN_APP_ENV` to `staging` and `BACKEND_URL` to `https://staging-api.tinyhumans.ai`.
+1. Open the **Settings > App-Level Environment Variables** tab.
+2. Replace the placeholder `OPENHUMAN_CORE_TOKEN` value with a strong secret
+ (`openssl rand -hex 32`). Mark it encrypted.
+3. If you are deploying staging, change `OPENHUMAN_APP_ENV` to `staging` and
+ `BACKEND_URL` to `https://staging-api.tinyhumans.ai`.
4. Hit **Save**. App Platform redeploys with the new secret.
-App Platform handles TLS, restart-on-crash, log streaming, and rolling redeploys on `git push` (set `deploy_on_push: true` in `.do/app.yaml` to opt-in).
+App Platform handles TLS, restart-on-crash, log streaming, and rolling
+redeploys on `git push` (set `deploy_on_push: true` in `.do/app.yaml` to
+opt-in).
-> **Persistence note:** App Platform Basic does not provide block storage. The core's workspace lives in the container's ephemeral filesystem and is lost on redeploy. For durable storage, attach a managed database or upgrade to a tier that supports volumes. See the [Compose path](cloud-deploy.md#3-any-vps-via-docker-compose) for a self-host alternative with persistent volumes out of the box.
+> **Persistence:** App Platform Basic has no block storage. The core's workspace lives in the container's ephemeral filesystem and is lost on redeploy. For durable storage, attach a managed database or upgrade to a tier that supports volumes. The [Compose path](#3-any-vps-via-docker-compose) gives you persistent volumes out of the box.
-***
+---
## 2. DigitalOcean App Platform: manual via doctl
-If you'd rather not click through the UI:
+If you prefer not to click through the UI:
```bash
# One-time: install doctl and authenticate.
@@ -159,11 +174,12 @@ Update an existing app after editing the spec:
doctl apps update <app-id> --spec .do/app.yaml
```
-***
+---
## 3. Any VPS via Docker Compose
-Works on any host with Docker Engine ≥ 24 and the Compose plugin. DigitalOcean Droplet, Hetzner, Linode, EC2, a home server.
+Works on any host with Docker Engine ≥ 24 and the Compose plugin.
+DigitalOcean Droplet, Hetzner, Linode, EC2, a home server.
Each production release publishes a multi-tagged image to GHCR:
@@ -173,11 +189,21 @@ docker pull ghcr.io/tinyhumansai/openhuman-core:v<version> # pinned by GitH
docker pull ghcr.io/tinyhumansai/openhuman-core:<version> # pinned by SemVer
```
-Take `<version>` from the [latest release](https://github.com/tinyhumansai/openhuman/releases/latest). The two pinned tags are immutable and pushed per release; `:latest` is promoted only after the release publishes, so it never points at a cut that was rolled back (`.github/workflows/release-production.yml`).
+Take `<version>` from the [latest release](https://github.com/tinyhumansai/openhuman/releases/latest).
+The two pinned tags are immutable and pushed per release; `:latest` is promoted
+only after the release publishes, so it never points at a cut that was rolled
+back (`.github/workflows/release-production.yml`).
-The image is `linux/amd64`. arm64 hosts pull the standalone tarball attached to the same GitHub Release (`openhuman-core-<version>-aarch64-unknown-linux-gnu.tar.gz`) or build the image from source on an arm64 builder.
+The image is `linux/amd64`. arm64 hosts pull the standalone tarball
+attached to the same GitHub Release (`openhuman-core-<version>-aarch64-unknown-linux-gnu.tar.gz`)
+or build the image from source on an arm64 builder.
-If you wrap a release tarball in your own image, match the builder it came from. The release matrix builds `aarch64` on `ubuntu-24.04-arm` and `x86_64` on `ubuntu-22.04` (`.github/workflows/release-production.yml`), so the `aarch64` binary needs glibc 2.39 or newer: `ubuntu:24.04` works, while `debian:bookworm-slim` ships 2.36 and fails at exec with `GLIBC_2.39' not found`. For `x86_64`, Ubuntu 22.04 or Debian 12 and newer.
+If you wrap a release tarball in your own image, match the builder it came
+from. The release matrix builds `aarch64` on `ubuntu-24.04-arm` and `x86_64` on
+`ubuntu-22.04` (`.github/workflows/release-production.yml`), so the `aarch64`
+binary needs glibc 2.39 or newer: `ubuntu:24.04` works, while
+`debian:bookworm-slim` ships 2.36 and fails at exec with
+`GLIBC_2.39' not found`. For `x86_64`, Ubuntu 22.04 or Debian 12 and newer.
Quick run with a published image:
@@ -190,7 +216,11 @@ docker run -d --name openhuman-core -p 7788:7788 \
ghcr.io/tinyhumansai/openhuman-core:latest
```
-Or use the in-repo Compose file, which builds the image locally from `Dockerfile`. To consume the published image instead, replace the service's `build:` block in `docker-compose.yml` with `image: ghcr.io/tinyhumansai/openhuman-core:latest`; leaving `build:` in place keeps building from source and merely retags the result.
+Or use the in-repo Compose file, which builds the image locally from
+`Dockerfile`. To consume the published image instead, replace the service's
+`build:` block in `docker-compose.yml` with
+`image: ghcr.io/tinyhumansai/openhuman-core:latest`; leaving `build:` in place
+keeps building from source and merely retags the result.
```bash
# On the server:
@@ -214,7 +244,8 @@ curl -fsS http://localhost:7788/health
### Headless install without Docker
-If you can't run Docker on the host, grab the standalone CLI tarball attached to the latest [GitHub Release](https://github.com/tinyhumansai/openhuman/releases/latest):
+If you can't run Docker on the host, grab the standalone CLI tarball
+attached to the latest [GitHub Release](https://github.com/tinyhumansai/openhuman/releases/latest):
```bash
# Pick the tarball that matches your host arch.
@@ -230,18 +261,25 @@ curl -fsSL "https://github.com/tinyhumansai/openhuman/releases/download/v${VERSI
openhuman-core --version
```
-Then run `openhuman-core serve` under your service manager of choice (systemd, supervisord, …) with the same environment variables documented above.
+Then run `openhuman-core serve` under your service manager of choice
+(systemd, supervisord, …) with the same environment variables documented
+above.
-The tarballs are dynamically linked, so the host's glibc has to be at least as new as the builder's: `aarch64` needs 2.39 or newer (Ubuntu 24.04, Debian 13), `x86_64` wants Ubuntu 22.04 or Debian 12 and newer. Check with `ldd --version` on the host.
+The tarballs are dynamically linked, so the host's glibc has to be at least as
+new as the builder's: `aarch64` needs 2.39 or newer (Ubuntu 24.04, Debian 13),
+`x86_64` wants Ubuntu 22.04 or Debian 12 and newer. Check with `ldd --version`
+on the host.
### Headless self-update contract
-Headless deployments should treat `openhuman.update_apply` as the safe primitive: it downloads the release asset, writes it atomically next to the current binary, and returns. Nothing exits automatically.
+Headless deployments should treat `openhuman.update_apply` as the safe primitive:
+it downloads the release asset, writes it atomically next to the current binary,
+and returns. Nothing exits automatically.
`openhuman.update_run` follows `config.update.restart_strategy`:
-* `self_replace` (default): stage the binary, publish an in-process restart request, and let the running core respawn itself.
-* `supervisor`: stage the binary and return `restart_requested=false`. Your outer service manager must restart the process.
+- `self_replace` (default): stage the binary, publish an in-process restart request, and let the running core respawn itself.
+- `supervisor`: stage the binary and return `restart_requested=false`. Your outer service manager must restart the process.
For long-running Linux services, set:
@@ -268,12 +306,22 @@ ExecReload=/bin/kill -HUP $MAINPID
Operator flow:
1. Call `openhuman.update_check` to discover a release.
-2. Configure `restart_strategy = "supervisor"` under `[update]` in the core's `config.toml` (or set `OPENHUMAN_AUTO_UPDATE_RESTART_STRATEGY=supervisor`) so the core stages the new binary without trying to re-exec itself, then call `openhuman.update_apply` or `openhuman.update_run`. `restart_strategy` is a configuration setting, not an RPC parameter.
+2. Configure `restart_strategy = "supervisor"` under `[update]` in the core's
+ `config.toml` (or set
+ `OPENHUMAN_AUTO_UPDATE_RESTART_STRATEGY=supervisor`) so the core stages the
+ new binary without trying to re-exec itself, then call
+ `openhuman.update_apply` or `openhuman.update_run`. `restart_strategy` is a
+ configuration setting, not an RPC parameter.
3. Restart the unit explicitly: `systemctl restart openhuman`.
-If download or staging fails, the running binary is left in place and no restart is requested. If a staged binary proves bad after restart, roll back by restoring the previous binary from your package manager, image tag, or release artifact and restarting the supervisor again.
+If download or staging fails, the running binary is left in place and no
+restart is requested. If a staged binary proves bad after restart, roll back by
+restoring the previous binary from your package manager, image tag, or release
+artifact and restarting the supervisor again.
-The Compose file ([`docker-compose.yml`](https://github.com/tinyhumansai/openhuman/blob/main/docker-compose.yml)) maps the core on `:7788`, mounts a named volume `openhuman-workspace` for persistence, and sets `restart: unless-stopped` so the core comes back after host reboots.
+The Compose file ([`docker-compose.yml`](https://github.com/tinyhumansai/openhuman/blob/main/docker-compose.yml)) maps the core
+on `:7788`, mounts a named volume `openhuman-workspace` for persistence, and
+sets `restart: unless-stopped` so the core comes back after host reboots.
### Updating
@@ -283,7 +331,9 @@ docker compose build
docker compose up -d
```
-For RPC-exposed production deployments, prefer leaving mutating update RPCs disabled (`OPENHUMAN_AUTO_UPDATE_RPC_MUTATIONS_ENABLED=false`) and perform rollouts through your existing image tag or package-management flow instead.
+For RPC-exposed production deployments, prefer leaving mutating update RPCs
+disabled (`OPENHUMAN_AUTO_UPDATE_RPC_MUTATIONS_ENABLED=false`) and perform
+rollouts through your existing image tag or package-management flow instead.
### Logs
@@ -293,7 +343,8 @@ docker compose logs -f openhuman-core
### Rotating the bearer token
-`OPENHUMAN_CORE_TOKEN` is the only thing standing between the public internet and full RPC access. Rotate it on a schedule and after any suspected leak:
+`OPENHUMAN_CORE_TOKEN` is the only thing standing between the public internet
+and full RPC access. Rotate it on a schedule and after any suspected leak:
```bash
# 1. Generate a new token and update the server-side .env.
@@ -309,15 +360,16 @@ docker compose exec openhuman-core /bin/sh -c \
'echo -n "$OPENHUMAN_CORE_TOKEN" | head -c 8; echo "…"'
# 4. Re-paste the new token on every desktop client, in
-# Settings -> Core connection. Clients that still hold the old token get
+# Settings > Core connection. Clients that still hold the old token get
# HTTP 401 on the next /rpc call, which is expected rather than a regression.
```
-For App Platform, do the same in **Settings → App-Level Environment Variables**: edit the `OPENHUMAN_CORE_TOKEN` secret and let App Platform redeploy. There is no separate token file to delete; the env var is the only state.
+For App Platform, do the same in **Settings > App-Level Environment Variables**. Edit the `OPENHUMAN_CORE_TOKEN` secret and let App Platform redeploy. There is no token file to delete. The environment variable is the only state.
### Putting it behind TLS
-Use Caddy, nginx, or Traefik as a reverse proxy in front of `:7788`. A minimal `Caddyfile`:
+Use Caddy, nginx, or Traefik as a reverse proxy in front of `:7788`. A minimal
+`Caddyfile`:
```caddy
core.example.com {
@@ -325,131 +377,162 @@ core.example.com {
}
```
-***
+---
## Pointing the desktop app at a hosted core
-Configure this in the app, not in a file. **Settings → Core connection** (`app/src/components/settings/panels/CoreConnectionPanel.tsx`) takes the core's RPC URL and bearer token, offers a **Test connection** button that fires `core.ping` against the typed values, and shows live reachability for the active core. The pre-router first-run picker accepts the same two fields.
+Set this up in the app, not in a file. **Settings > Core connection** takes the core's RPC URL and bearer token. It has a **Test connection** button that sends `core.ping` with the values you typed, and it shows live reachability for the active core. The first-run picker accepts the same two fields.
Enter the server's URL and the token you set on it:
-| Deployment | URL to enter |
-| ----------------------- | ------------------------------ |
-| Public host behind TLS | `https://core.example.com/rpc` |
-| Private tailnet-only VM | `http://100.x.x.x:7788/rpc` |
+| Deployment | URL to enter |
+| --- | --- |
+| Public host behind TLS | `https://core.example.com/rpc` |
+| Private tailnet-only VM | `http://100.x.x.x:7788/rpc` |
-Saving persists the choice and restarts the app, so the normal boot gate re-runs against the new mode. A URL with no path is treated as the core's base and `/rpc` is appended for you, and a `user:pass@host` URL is rejected because the token field is the only credential path.
+Saving stores the choice and restarts the app, so the normal startup checks run against the new core. A URL with no path is treated as the core's base, and `/rpc` is added for you. A `user:pass@host` URL is rejected, because the token field is the only way to give a credential.
-Plain `http://` is accepted without complaint only for loopback and private-network hosts, which includes RFC1918 ranges and the Tailscale `100.64.0.0/10` range (`isLocalOrPrivateNetworkHost` in `app/src/utils/configPersistence.ts`). A public `http://` host still saves, but the panel warns.
+Plain `http://` is accepted without a warning only for loopback and private-network hosts, including RFC1918 ranges and the Tailscale `100.64.0.0/10` range. A public `http://` host still saves, but the panel warns you.
{% hint style="warning" %}
-**A private address is not encryption.** Over plain `http://`, every `/rpc` request carries the bearer token in cleartext, and that token is the only credential the core checks. Anyone who can observe the link can read it and replay it, and "private" covers a shared office LAN, a hotel network and a coffee-shop Wi-Fi subnet as readily as it covers your own machine. Treat plain HTTP as safe only on a link you control end to end, such as loopback or an encrypted overlay like Tailscale or WireGuard. Use HTTPS for anything else.
+A private address is not encryption. Over plain `http://`, every `/rpc`
+request carries the bearer token in cleartext, and that token is the only
+credential the core checks. Anyone who can observe the link can read it and
+replay it, and "private" covers a shared office LAN, a hotel network and a
+coffee-shop Wi-Fi subnet as readily as it covers your own machine. Treat plain
+HTTP as safe only on a link you control end to end, such as loopback or an
+encrypted overlay like Tailscale or WireGuard. Use HTTPS for anything else.
{% endhint %}
-`VITE_OPENHUMAN_CORE_RPC_URL` in `app/.env.local` is a build-time fallback only. The saved panel value outranks it, as does the shell's own `core_rpc_url` command, so setting it will not move a desktop client onto a remote core.
+`VITE_OPENHUMAN_CORE_RPC_URL` in `app/.env.local` is only a build-time fallback. The saved panel value outranks it, so setting it will not move a desktop client onto a remote core.
### Troubleshooting: sign-in fails after OAuth on a cloud runtime
-Symptom: OAuth in the browser completes ("close this and return to the app"), but the desktop then shows a sign-in error, while the **same** account signs in fine on the local (embedded) runtime (issue #3025).
+The symptom: OAuth in the browser completes ("close this and return to the app"), but the desktop then shows a sign-in error, while the same account signs in fine on the local (embedded) runtime.
-The desktop shell validates the fresh session token against the backend (`GET /auth/me`) itself and only then hands the credential to the core (`auth.set_credential`). On a cloud runtime that handoff travels to your server, so the usual causes are:
+The desktop app checks the fresh session token against the backend (`GET /auth/me`) itself and only then hands the credential to the core (`auth.set_credential`). On a cloud runtime that handoff goes to your server. The usual causes are:
-* **Wrong RPC token or URL.** A token mismatch surfaces as HTTP 401 on `/rpc`; re-paste the token (see "Rotating the bearer token") and check the URL.
-* **Outdated core.** Older cores predate `auth.set_credential`; the desktop still sends the legacy `auth_store_session` name through an alias, but a core older than that alias rejects the call. Update the server to a current release.
-* **`BACKEND_URL` unset or wrong on the server.** The remote core does not validate the session any more, but every backend call it makes on your behalf (billing, teams, managed inference) still goes there. It must be `https://api.tinyhumans.ai` for prod (or the staging URL).
+- **Wrong RPC token or URL.** A token mismatch shows up as HTTP 401 on `/rpc`. Paste the token again (see "Rotating the bearer token") and check the URL.
+- **Outdated core.** Older cores do not have `auth.set_credential`. The desktop still sends the older `auth_store_session` name through an alias, but a core older than that alias rejects the call. Update the server to a current release.
+- **`BACKEND_URL` unset or wrong on the server.** The remote core no longer validates the session, but every backend call it makes for you (billing, teams, managed inference) still goes there. It must be `https://api.tinyhumans.ai` for production, or the staging URL.
-Check the desktop log for the shell's session-owner lines (`[session]`) and the remote core log for `[credentials][set-credential]`. The desktop reports a cloud-specific, actionable message for these instead of a generic "try again" (issue #3025).
+Check the desktop log for `[session]` lines and the remote core log for `[credentials][set-credential]`. For these cases the desktop shows a specific message instead of a generic "try again".
### Headless sign-in
-A cloud core has no browser to complete OAuth in. Obtain a credential elsewhere and hand it to the core at boot:
+A cloud core has no browser to complete OAuth in. Get a credential elsewhere and hand it to the core at startup:
-* `OPENHUMAN_BACKEND_API_KEY=<key>`: a TinyHumans API key (recommended; no user identity, nothing to expire).
-* `OPENHUMAN_BACKEND_SESSION_TOKEN=<jwt>`: a session JWT with a subject claim.
+- `OPENHUMAN_BACKEND_API_KEY=<key>`: a TinyHumans API key. This is the recommended option. It has no user identity and nothing to expire.
+- `OPENHUMAN_BACKEND_SESSION_TOKEN=<jwt>`: a session JWT with a subject claim.
-Either installs the credential only when the store has none of that kind; to rotate, clear first (`openhuman-core auth clear_credential --kind api-key`). The same operation is available over RPC as `openhuman.auth_clear_credential`.
+Either one installs the credential only when the store has none of that kind. To rotate, clear it first (`openhuman-core auth clear_credential --kind api-key`).
+The same operation is available over RPC as `openhuman.auth_clear_credential`.
### Headless without a TinyHumans account
-Custom cloud providers (`inference_url` + `api_key`, or an entry in `cloud_providers`) are only built when a backend session or TinyHumans API key exists. Without one, every turn fails with `SESSION_EXPIRED: backend session not active — sign in to use custom providers`. Caller-owned runtimes are exempt from that gate, and `local-openai` is one of them, so any hosted OpenAI-compatible endpoint can run a headless core with no account:
+Custom cloud providers (`inference_url` and `api_key`, or an entry in `cloud_providers`) are built only when a backend session or TinyHumans API key exists. Without one, every turn fails with a `SESSION_EXPIRED: backend session not active` error. Runtimes you supply yourself are exempt, and `local-openai` is one of them. So any hosted OpenAI-compatible endpoint can run a headless core with no account:
-1. Set `LOCAL_OPENAI_URL=https://<your endpoint>/v1` in the core's environment (`OPENHUMAN_LOCAL_INFERENCE_URL` also works and overrides it).
-2. Store the endpoint's bearer key with `openhuman.config_update_local_ai_settings` (`runtime_enabled: true`, `opt_in_confirmed: true`, `api_key: "<key>"`).
-3. Pin the workloads with `openhuman.config_update_model_settings`: `chat_provider`, `reasoning_provider`, `agentic_provider`, `coding_provider` (and `vision_provider`, `memory_provider`, `embeddings_provider` if you want them off the managed route) to `local-openai:<model-id>`, plus `default_model: "<model-id>"`. Those are the whole set the controller accepts; see `crates/openhuman-core/src/config/ops/model.rs`.
+1. Set `LOCAL_OPENAI_URL=https://<your endpoint>/v1` in the core's environment
+ (`OPENHUMAN_LOCAL_INFERENCE_URL` also works and overrides it).
+2. Store the endpoint's bearer key with `openhuman.config_update_local_ai_settings`
+ (`runtime_enabled: true`, `opt_in_confirmed: true`, `api_key: "<key>"`).
+3. Pin the workloads with `openhuman.config_update_model_settings`:
+ `chat_provider`, `reasoning_provider`, `agentic_provider`, `coding_provider`
+ (and `vision_provider`, `memory_provider`, `embeddings_provider` if you want
+ them off the managed route) to `local-openai:<model-id>`, plus
+ `default_model: "<model-id>"`. Those are the whole set the controller
+ accepts.
-`openhuman.inference_agent_chat_simple` is the quickest end-to-end check. Managed features (integrations, teams, hosted voice) still need a TinyHumans credential; see [Local models and bring your own key](model-routing/local-and-byok-models.md).
+`openhuman.inference_agent_chat_simple` is the quickest end-to-end check. Managed features (integrations, teams, hosted voice) still need a TinyHumans credential. See [Local models and bring your own key](model-routing/local-and-byok-models.md).
### Secret storage in containers
-In `production` and `staging` the keyring backend is `encrypted_file`, and its master key is loaded from the OS keychain. A container has no keychain, so the first write that stores a provider key fails with `Failed to encrypt api_key` (`[keyring] set error ... master key unavailable`). Supply the master key from the environment instead: `OPENHUMAN_KEYRING_MASTER_KEY` (64 hex characters) or `OPENHUMAN_KEYRING_MASTER_KEY_FILE` (a secret mount), described in "What you need before you start" (#6926). On a release that predates those variables, set `OPENHUMAN_KEYRING_BACKEND=file`, which keeps secrets in `$OPENHUMAN_WORKSPACE/dev-keychain.json` (plaintext, `0600`); put the workspace volume on encrypted storage and treat the host as the secret boundary.
-
-Mount the key file without group- or world-write permissions. The core rejects group- or world-writable files, while read-only group/world access may be accepted for container secret mounts; any process able to read the file can decrypt the entire keyring. Restrict the mode where the mount is declared:
-
-* Kubernetes: Secret volumes are root-owned, and `runAsUser` does not change the owner of a projected Secret. For a non-root core, use an init container running as root to copy the Secret into an `emptyDir`, `chown` the copy to the core UID, and `chmod 0400` it before the core starts. Mount the original Secret read-only in the init container and the `emptyDir` read-only in the core container. For example:
-
- ```yaml
- volumes:
- - name: master-key-secret
- secret:
- secretName: openhuman-master-key
- defaultMode: 0400
- - name: master-key
- emptyDir: {}
- initContainers:
- - name: prepare-master-key
- image: busybox:1.36
- command: ["sh", "-c", "cp /source/master.key /target/master.key && chown 10001:10001 /target/master.key && chmod 0400 /target/master.key"]
- volumeMounts:
- - name: master-key-secret
- mountPath: /source
- readOnly: true
- - name: master-key
- mountPath: /target
- containers:
- - name: openhuman
- securityContext:
- runAsUser: 10001
- runAsGroup: 10001
- runAsNonRoot: true
- env:
- - name: OPENHUMAN_KEYRING_MASTER_KEY_FILE
- value: /run/openhuman-master-key/master.key
- volumeMounts:
- - name: master-key
- mountPath: /run/openhuman-master-key
- readOnly: true
- ```
-
- Set the `emptyDir` medium and the core UID/GID to match the ownership applied by the init container. The `defaultMode: 0400` setting is important. For a direct non-root mount, also provide `fsGroup` (or equivalent group access) matching the core's group so kubelet can make the file readable; the resulting read-only `0440` mode is accepted. The init-container recipe above instead grants access by changing the copied file's owner. An equivalent setup is a secret volume whose `defaultMode` is `0400` and whose file is mounted with ownership matching the core's `runAsUser`/`runAsGroup`.
-* Docker Swarm: set `mode: 0400` (with `uid`/`gid` for a non-root user) on the service's secret.
-* A plain file: `chmod 600` it, owned by the user the core runs as.
+In `production` and `staging`, the keyring backend is `encrypted_file`, and its master key is loaded from the OS keychain. A container has no keychain, so the first write that stores a provider key fails with `Failed to encrypt api_key` (`[keyring] set error ... master key unavailable`). Supply the master key from the environment instead: `OPENHUMAN_KEYRING_MASTER_KEY` (64 hex characters) or `OPENHUMAN_KEYRING_MASTER_KEY_FILE` (a secret mount). Both are described in "What you need before you start". On a release older than those variables, set `OPENHUMAN_KEYRING_BACKEND=file`. That keeps secrets in `$OPENHUMAN_WORKSPACE/dev-keychain.json` (plaintext, mode `0600`), so put the workspace volume on encrypted storage and treat the host as the secret boundary.
+
+Mount the key file without group or world write permission. The core rejects group-writable and world-writable files. Read-only group or world access may be accepted for container secret mounts, but any process that can read the file can decrypt the whole keyring. Restrict the mode where the mount is declared:
+
+- Kubernetes: Secret volumes are root-owned, and `runAsUser` does not change
+ the owner of a projected Secret. For a non-root core, use an init container
+ running as root to copy the Secret into an `emptyDir`, `chown` the copy to
+ the core UID, and `chmod 0400` it before the core starts. Mount the original
+ Secret read-only in the init container and the `emptyDir` read-only in the
+ core container. For example:
+
+ ```yaml
+ volumes:
+ - name: master-key-secret
+ secret:
+ secretName: openhuman-master-key
+ defaultMode: 0400
+ - name: master-key
+ emptyDir: {}
+ initContainers:
+ - name: prepare-master-key
+ image: busybox:1.36
+ command: ["sh", "-c", "cp /source/master.key /target/master.key && chown 10001:10001 /target/master.key && chmod 0400 /target/master.key"]
+ volumeMounts:
+ - name: master-key-secret
+ mountPath: /source
+ readOnly: true
+ - name: master-key
+ mountPath: /target
+ containers:
+ - name: openhuman
+ securityContext:
+ runAsUser: 10001
+ runAsGroup: 10001
+ runAsNonRoot: true
+ env:
+ - name: OPENHUMAN_KEYRING_MASTER_KEY_FILE
+ value: /run/openhuman-master-key/master.key
+ volumeMounts:
+ - name: master-key
+ mountPath: /run/openhuman-master-key
+ readOnly: true
+ ```
+
+ Set the `emptyDir` medium and the core UID/GID to match the ownership applied
+ by the init container. The `defaultMode: 0400` setting is important. For a
+ direct non-root mount, also provide `fsGroup` (or equivalent group access)
+ matching the core's group so kubelet can make the file readable; the resulting
+ read-only `0440` mode is accepted. The init-container recipe above instead
+ grants access by changing the copied file's owner. An equivalent setup is a
+ secret volume whose `defaultMode` is `0400` and whose file is mounted with
+ ownership matching the core's `runAsUser`/`runAsGroup`.
+- Docker Swarm: set `mode: 0400` (with `uid`/`gid` for a non-root user) on the
+ service's secret.
+- A plain file: `chmod 600` it, owned by the user the core runs as.
-***
+---
## Named-volume ownership and the Docker entrypoint
-Docker creates named volumes owned `root:root` by default. Because the core runs as the non-root `openhuman` user (UID 10001), the first write after the banner (`init_rpc_token → write_token_file` into `$OPENHUMAN_WORKSPACE`) would raise `Permission denied (os error 13)` if nothing fixes the ownership first.
+Docker creates named volumes owned by `root:root`. The core runs as the non-root `openhuman` user (UID 10001), so its first write into `$OPENHUMAN_WORKSPACE` would fail with `Permission denied (os error 13)` if nothing fixed the ownership first.
-The image ships a dedicated entrypoint at `/usr/local/bin/docker-entrypoint-core.sh` that:
+The image ships a dedicated entrypoint at
+`/usr/local/bin/docker-entrypoint-core.sh` that:
1. Starts as `root`.
-2. Runs `mkdir -p` + `chown openhuman:openhuman` on both `$OPENHUMAN_WORKSPACE` and `$HOME/.openhuman` (the directory `core.token` is written to when `OPENHUMAN_CORE_TOKEN` is unset).
-3. Calls `exec gosu openhuman openhuman-core "$@"` to drop privileges and hand off to the binary.
+2. Runs `mkdir -p` + `chown openhuman:openhuman` on both `$OPENHUMAN_WORKSPACE`
+ and `$HOME/.openhuman` (the directory `core.token` is written to when
+ `OPENHUMAN_CORE_TOKEN` is unset).
+3. Calls `exec gosu openhuman openhuman-core "$@"` to drop privileges and
+ hand off to the binary.
-This is **idempotent**: on a freshly-created volume the chown heals the root-owned directory; on a volume that was already healed the chown is a no-op. No manual `docker volume rm` is required when upgrading from images predating this fix.
+This is idempotent. On a new volume the chown fixes the root-owned directory. On a volume that was already fixed, it does nothing. You don't need to run `docker volume rm` when upgrading from an older image.
-The entrypoint is named `docker-entrypoint-core.sh` and wired **only** into the root `Dockerfile`. The E2E image (`e2e/docker-entrypoint.sh`) is unaffected.
+The entrypoint is used only by the root `Dockerfile`. The E2E image (`e2e/docker-entrypoint.sh`) is unaffected.
-***
+---
## 4. Fly.io
-[Fly.io](https://fly.io) is a good fit for `openhuman-core`: it handles TLS automatically, supports persistent volumes on all tiers, and can auto-stop idle machines to cut costs.
+[Fly.io](https://fly.io) suits `openhuman-core`. It handles TLS automatically, supports persistent volumes on all tiers, and can stop idle machines to cut costs.
### Prerequisites
-* [flyctl](https://fly.io/docs/flyctl/install/) installed and authenticated (`fly auth login`)
-* A Fly.io account
+- [flyctl](https://fly.io/docs/flyctl/install/) installed and authenticated (`fly auth login`)
+- A Fly.io account
### Step 1: Launch the app
@@ -457,11 +540,13 @@ The entrypoint is named `docker-entrypoint-core.sh` and wired **only** into the
fly launch --no-deploy --config .fly/fly.toml
```
-Fly.io detects the `Dockerfile` automatically. Choose a region close to your users and skip the first deploy when prompted. This generates a config file.
+Fly.io finds the `Dockerfile` automatically. Choose a region close to your users and skip the first deploy when prompted. This generates a config file.
### Step 2: Configure `.fly/fly.toml`
-The repo ships a template at [`.fly/fly.toml`](https://github.com/tinyhumansai/openhuman/blob/main/.fly/fly.toml). Fill in `<your-app-name>` and `<your-region>` with the values you chose during `fly launch`:
+The repo ships a template at [`.fly/fly.toml`](https://github.com/tinyhumansai/openhuman/blob/main/.fly/fly.toml). Fill in
+`<your-app-name>` and `<your-region>` with the values you chose during
+`fly launch`:
```toml
app = '<your-app-name>'
@@ -487,7 +572,7 @@ primary_region = '<your-region>'
auto_start_machines = true
# min_machines_running = 0 fully stops the machine when idle (cheapest), but
# the first request after idle pays a cold-start penalty (container boot +
- # Rust binary init — several seconds). Set to 1 to keep one machine warm.
+ # Rust binary init, several seconds). Set to 1 to keep one machine warm.
min_machines_running = 0
processes = ['app']
@@ -509,7 +594,7 @@ primary_region = '<your-region>'
fly volumes create openhuman_workspace --size 5 --region <your-region> --config .fly/fly.toml
```
-**Mount the workspace on a persistent volume** or data is lost on every redeploy.
+Mount the workspace on a persistent volume, or data is lost on every redeploy.
### Step 4: Set secrets
@@ -523,12 +608,13 @@ fly secrets set OPENHUMAN_APP_ENV="production"
fly secrets set OPENHUMAN_AUTO_UPDATE_RPC_MUTATIONS_ENABLED="false"
fly secrets set OPENHUMAN_AUTO_UPDATE_RESTART_STRATEGY="supervisor"
-# Optional — error reporting and analytics:
+# Optional: error reporting and analytics:
fly secrets set OPENHUMAN_CORE_SENTRY_DSN="https://<key>@o<org>.ingest.sentry.io/<project>"
fly secrets set OPENHUMAN_ANALYTICS_ENABLED="true"
```
-Save the value of `OPENHUMAN_CORE_TOKEN`. You will need it to connect the desktop app later. **Anyone with this token can drive the core**; treat it like a password and rotate it with `fly secrets set OPENHUMAN_CORE_TOKEN="$(openssl rand -hex 32)"` after any suspected leak.
+Save the value of `OPENHUMAN_CORE_TOKEN`. You need it to connect the desktop app later. Anyone with this token can drive the core, so treat it like a password and rotate it with `fly secrets set OPENHUMAN_CORE_TOKEN="$(openssl rand -hex 32)"`
+after any suspected leak.
### Step 5: Deploy
@@ -544,16 +630,19 @@ curl -fsS https://<your-app-name>.fly.dev/health
### Step 6: Point the desktop app at the hosted core
-In the desktop app, open **Settings → Core connection**, switch it to the remote core, and enter:
+In the desktop app, open **Settings > Core connection**, switch it to the remote core, and enter:
-* URL: `https://<your-app-name>.fly.dev/rpc`
-* Token: the value you set in Step 4
+- URL: `https://<your-app-name>.fly.dev/rpc`
+- Token: the value you set in Step 4
-Press **Test connection** to confirm before saving. The first-run picker takes the same two fields. See [Pointing the desktop app at a hosted core](cloud-deploy.md#pointing-the-desktop-app-at-a-hosted-core).
+Press **Test connection** to confirm before saving. The first-run picker takes
+the same two fields. See
+[Pointing the desktop app at a hosted core](#pointing-the-desktop-app-at-a-hosted-core).
### Continuous deployment
-To redeploy automatically on every push to `main`, add a workflow file at `.github/workflows/fly-deploy.yml`:
+To redeploy automatically on every push to `main`, add a workflow file at
+`.github/workflows/fly-deploy.yml`:
```yaml
name: Fly Deploy
@@ -576,7 +665,7 @@ jobs:
steps:
- uses: actions/checkout@v4
# Pin the Fly action to a tagged release (or a full commit SHA) rather
- # than `@master` — tracking a moving branch trusts every future commit
+ # than `@master`. Tracking a moving branch trusts every future commit
# pushed there, including any made by a compromised maintainer account.
- uses: superfly/flyctl-actions/[email protected]
- run: flyctl deploy --remote-only --config .fly/fly.toml
@@ -584,7 +673,8 @@ jobs:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
```
-Generate a deploy token with `fly tokens create deploy` and add it as a repository secret named `FLY_API_TOKEN`.
+Generate a deploy token with `fly tokens create deploy` and add it as a
+repository secret named `FLY_API_TOKEN`.
### Updating
@@ -592,7 +682,8 @@ Generate a deploy token with `fly tokens create deploy` and add it as a reposito
fly deploy --config .fly/fly.toml
```
-For version-pinned deployments, update the image tag in `.fly/fly.toml` and redeploy:
+For version-pinned deployments, update the image tag in `.fly/fly.toml` and
+redeploy:
```toml
[build]
@@ -605,15 +696,15 @@ For version-pinned deployments, update the image tag in `.fly/fly.toml` and rede
fly logs --config .fly/fly.toml
```
-### Known gotcha: UID mismatch on volumes
+### Known issue: user ID mismatch on volumes
-If you switch between building from `Dockerfile` (which creates the `openhuman` user at UID 10001) and pulling the pre-built GHCR image (which uses UID 1000), files already written to the persistent volume will be owned by the old UID and produce `Permission denied (os error 13)` on startup.
+If you switch between building from the `Dockerfile` (which creates the `openhuman` user at UID 10001) and pulling the pre-built GHCR image (which uses UID 1000), files already on the persistent volume belong to the old UID. The core then fails at startup with `Permission denied (os error 13)`.
-The same thing happens to a Docker named volume that outlives an image upgrade, and to any workspace a **root** `docker exec` wrote into. `docker exec` does not run the entrypoint, so it lands as root and leaves a `root:root` `config.toml` behind (the core writes it at mode 0600, so the runtime user then cannot open it at all).
+The same thing happens to a Docker named volume that outlives an image upgrade, and to any workspace that a root `docker exec` wrote into. `docker exec` does not run the entrypoint, so it runs as root and leaves a `root:root` `config.toml` behind. The core writes that file with mode 0600, so the runtime user then cannot open it at all.
-`scripts/docker-entrypoint-core.sh` now repairs this automatically: it chowns the workspace **recursively** on every start, skipping entries already owned correctly. If the repair cannot run, for example `cap_drop: ALL` without `cap_add: CHOWN`, the entrypoint refuses to start rather than booting a container that answers `/health` with 200 while every config RPC returns `Permission denied (os error 13)`, and prints the exact `chown` to run. Look for `[docker-entrypoint] pre-heal` / `FATAL` lines in the container log.
+`scripts/docker-entrypoint-core.sh` repairs this automatically. On every start it recursively chowns the workspace and skips entries that already have the right owner. If the repair cannot run (for example `cap_drop: ALL` without `cap_add: CHOWN`), the entrypoint refuses to start and prints the exact `chown` to run. Otherwise you would get a container that answers `/health` with 200 while every config RPC returns `Permission denied (os error 13)`. Look for `[docker-entrypoint] pre-heal` and `FATAL` lines in the container log.
-Fix an older container by SSH-ing in and re-owning the workspace:
+To fix an older container, SSH in and re-own the workspace:
```bash
fly ssh console --config .fly/fly.toml
@@ -622,7 +713,7 @@ exit
fly machine restart --config .fly/fly.toml
```
-The Docker equivalent. Derive the ids from the container rather than hard-coding them, so this stays correct whichever image you are running:
+The Docker equivalent derives the ids from the container instead of hard-coding them, so it stays correct whichever image you run:
```bash
docker exec -u 0 openhuman-core sh -c \
@@ -630,20 +721,20 @@ docker exec -u 0 openhuman-core sh -c \
docker restart openhuman-core
```
-To see which UID owns what before repairing. Note `docker exec` defaults to **root**, so ask about the runtime user explicitly rather than trusting a bare `id`:
+To see which UID owns what before repairing, ask about the runtime user explicitly. `docker exec` defaults to root, so a bare `id` would be misleading:
```bash
docker exec openhuman-core sh -c 'id openhuman; ls -ln /home/openhuman/.openhuman/config.toml'
```
-***
+---
## Smoke test
-Two failure modes guard the cloud deploy path:
+Two smoke checks cover the cloud deploy path:
-* **`docker-image`**: sets `OPENHUMAN_CORE_TOKEN` and mounts no volume. Protects the DigitalOcean App Platform path (`.do/app.yaml`) where the token is always pre-set and no persistent volume is used.
-* **`docker-volume-permissions`**: omits `OPENHUMAN_CORE_TOKEN` and mounts a fresh anonymous volume at `/home/openhuman/.openhuman`. Reproduces the exact failure mode of issue #2065 and asserts that `/health` returns 200 and that `Permission denied (os error 13)` is absent from the logs.
+- `docker-image` sets `OPENHUMAN_CORE_TOKEN` and mounts no volume. It covers the DigitalOcean App Platform path (`.do/app.yaml`), where the token is always set and no persistent volume is used.
+- `docker-volume-permissions` omits `OPENHUMAN_CORE_TOKEN` and mounts a fresh anonymous volume at `/home/openhuman/.openhuman`. It reproduces the volume ownership failure and asserts that `/health` returns 200 and that `Permission denied (os error 13)` is absent from the logs.
Run the smoke check locally:
@@ -671,20 +762,31 @@ docker rm -f oh-vol-smoke
docker volume rm oh-vol-test
```
-***
+---
## 5. Oracle Cloud Infrastructure: Terraform on Always Free
-A community-maintained Terraform stack runs the headless core on OCI's Always Free tier: an Ampere A1 VM in a private subnet running the release binary in a container, a flexible load balancer that forwards only `/rpc`, `/health` and `/events`, secrets in OCI Vault read by the VM's instance principal, OCI Generative AI as the model provider through the `local-openai` route above, and an Autonomous Database that agents reach through Oracle's managed Database Tools MCP Server once an operator registers a user access token for that server (the stack's post-apply step; the MCP server authenticates users, not the VM's instance principal).
+A community-maintained Terraform stack runs the headless core on OCI's Always
+Free tier: an Ampere A1 VM in a private subnet running the release binary in a
+container, a flexible load balancer that forwards only `/rpc`, `/health` and
+`/events`, secrets in OCI Vault read by the VM's instance principal, OCI
+Generative AI as the model provider through the `local-openai` route above, and
+an Autonomous Database that agents reach through Oracle's managed Database
+Tools MCP Server once an operator registers a user access token for that server
+(the stack's post-apply step; the MCP server authenticates users, not the VM's
+instance principal).
+
+Repository and run book: <https://github.com/kamelhar/openhuman-oci>. Like the
+Fly and DigitalOcean recipes, it sets `OPENHUMAN_CORE_TOKEN`, mounts the
+workspace on persistent storage, and keeps the core off the public internet
+except through the load balancer.
-Repository and run book: [https://github.com/kamelhar/openhuman-oci](https://github.com/kamelhar/openhuman-oci). Like the Fly and DigitalOcean recipes, it sets `OPENHUMAN_CORE_TOKEN`, mounts the workspace on persistent storage, and keeps the core off the public internet except through the load balancer.
-
-***
+---
## See also
-* [Privacy & Security](privacy-and-security/): the trust model a server-hosted core inherits.
-* [OS Keyring & Secret Storage](privacy-and-security/os-keyring-and-secret-storage.md): why a container needs a keyring master key.
-* [Local models and bring your own key](model-routing/local-and-byok-models.md): running a headless core with no TinyHumans account.
-* [Building the Rust Core](../developing/building-rust-core.md): compiling the binary a non-Docker host runs.
-* [Architecture](../developing/architecture/architecture.md): what the core owns versus the shell.
+- [Privacy and security](privacy-and-security.md): the trust model a server-hosted core inherits.
+- [OS keyring and secret storage](os-keyring-and-secret-storage.md): why a container needs a keyring master key.
+- [Local models and bring your own key](model-routing/local-and-byok-models.md): running a headless core with no TinyHumans account.
+- [Building the Rust core](../developing/building-rust-core.md): compiling the binary a non-Docker host runs.
+- [Architecture](../developing/architecture.md): what the core owns versus the shell.
diff --git a/docs/gitbooks/en/features/connections.md b/docs/gitbooks/en/features/connections.md
index 0d8a8e7ef3..4092ae4de6 100644
--- a/docs/gitbooks/en/features/connections.md
+++ b/docs/gitbooks/en/features/connections.md
@@ -7,44 +7,42 @@ icon: plug
# Connections
-**Connections** is the hub. Almost everything you would call a setting that changes what the agent _can do_, rather than how it looks, lives here, split into two groups in the left rail.
-
-Most of the older addresses redirect here, so a bookmark to `/skills` or `/channels` still lands in the right place.
+Connections is the hub. Almost every setting that changes what the agent can do, as opposed to how the app looks, lives here. The left rail splits it into two groups. Old addresses such as `/skills` and `/channels` redirect here, so bookmarks still work.
## Integrations
-| Tab | What it holds |
-| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **OAuth** | The OAuth connectors. Pick a toolkit, authorize it in a browser window, and choose its scope (read, write or admin) and which triggers may fire. See [Third-party Integrations](integrations/). |
-| **Channels** | The channels the agent talks to you on: Telegram, Discord, the in-app web chat, Lark/Feishu, DingTalk, iMessage, email over IMAP and SMTP, and 元宝. See [Messaging Channels](channels.md). |
-| **MCP Servers** | Model Context Protocol servers, in four views: your servers, client config, the raw `mcp.json` (which is the only place a server is actually added), and a browsable registry. Includes a playground for calling one tool by hand. |
-| **Skills** | Installed skill bundles, a registry to browse and install from, and a runner. See [MCP Servers & Skills](integrations/mcp-and-skills.md). |
-| **Brain** | [Memory](memory.md): the engine, ask, explorer, learnings, conversations, the shared brain, background jobs and recall settings. |
-| **Agent tools** | Which tools the agent may use, and the per-tool policy. |
-| **Browser Control** | Desktop and browser control, the decision model, and the planner. See [Browser & Computer Control](native-tools/browser-and-computer.md). |
-| **Wallet** | Balances, send and receive, and the recovery phrase. See [Wallet](wallet.md). |
+| Tab | What it holds |
+| --- | --- |
+| OAuth | The OAuth connectors. Pick a toolkit, authorize it in a browser window, and choose its scope (read, write or admin) and which triggers may fire. See [Third-party integrations](integrations/README.md). |
+| Channels | The channels the agent talks to you on: Telegram, Discord, the in-app web chat, Lark/Feishu, DingTalk, iMessage, email over IMAP and SMTP, and 元宝. See [Messaging channels](channels.md). |
+| MCP Servers | Model Context Protocol servers, in four views: your servers, client config, the raw `mcp.json` (the only place a server is actually added), and a browsable registry. It also has a playground for calling one tool by hand. |
+| Skills | Installed skill bundles, a registry to browse and install from, and a runner. See [MCP servers and skills](integrations/mcp-and-skills.md). |
+| Brain | [Memory](memory.md): the engine, ask, explorer, learnings, conversations, the shared brain, background jobs and recall settings. |
+| Agent tools | Which tools the agent may use, and the policy for each. |
+| Browser Control | Desktop and browser control, the decision model and the planner. See [Browser and computer control](native-tools/browser-and-computer.md). |
+| Wallet | Balances, send and receive, and the recovery phrase. See [Wallet](wallet.md). |
## API keys
-The second group is mostly one tab per engine family, each the same shape: use the managed TinyHumans route, or paste your own key. **Usage** is the exception, and reports spending and background activity rather than configuring anything.
+The second group has mostly one tab per engine family. Each works the same way: use the managed TinyHumans route, or paste your own key. The exception is Usage, which reports spending and background activity and configures nothing.
-| Tab | Covers |
-| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **LLM** | Model providers: the managed route, your own keys for 26 built-in providers, and local servers (Ollama, LM Studio, MLX, any OpenAI-compatible endpoint). See [Automatic Model Routing](model-routing/). |
-| **Composio** | Your own connector-platform key, if you would rather not use the managed route. |
-| **Voice agents** | Speech-to-text and text-to-speech providers, per-workload routing, and the dictation hotkey. |
-| **Embeddings** | The embedding provider behind memory and tool search. |
-| **Search** | Web-search providers. Two have a managed route; the rest are bring-your-own-key. See [Web Search](native-tools/web-search.md). |
-| **Usage** | What you have spent, by day and by model, plus the background-activity log. See [Billing, Cost & Usage](billing-and-usage.md). |
+| Tab | Covers |
+| --- | --- |
+| LLM | Model providers: the managed route, your own keys for 26 built-in providers, and local servers (Ollama, LM Studio, MLX, any OpenAI-compatible endpoint). See [Model routing](model-routing/README.md). |
+| Composio | Your own connector-platform key, if you prefer it to the managed route. |
+| Voice agents | Speech-to-text and text-to-speech providers, routing per workload, and the dictation hotkey. |
+| Embeddings | The embedding provider behind memory and tool search. |
+| Search | Web search providers. Two have a managed route. The rest need your own key. See [Web search](native-tools/web-search.md). |
+| Usage | What you have spent, by day and by model, plus the background activity log. See [Billing, cost and usage](billing-and-usage.md). |
## Why one page
-These used to be a dozen separate settings screens, and the split never held: connecting Gmail is an integration, a memory source, a trigger source and a set of agent tools at once, and so is connecting GitHub. Keeping them on one page with one rail means the thing you are setting up stays in front of you while you set up the parts of it that live in other systems.
+Connecting Gmail is an integration, a memory source, a trigger source and a set of agent tools all at once. GitHub is the same. Keeping them together means the thing you are setting up stays in front of you while you configure the parts that live in other systems.
-Settings that change how the app _behaves_ rather than what it reaches, appearance, personality, security, keychain, autonomy, stay in [Settings](settings.md).
+Settings that change how the app behaves, such as appearance, personality, security, keychain and autonomy, stay in [Settings](settings.md).
## See also
-* [Getting Started](../overview/getting-started.md): the first-run path through this page.
-* [Memory](memory.md), [Messaging Channels](channels.md), [Third-party Integrations](integrations/): the three tabs with the most behind them.
-* [Privacy & Security](privacy-and-security/): what each connection means for what leaves your machine.
+- [Getting started](../overview/getting-started.md): the first-run path through this page.
+- [Memory](memory.md), [Messaging channels](channels.md), [Third-party integrations](integrations/README.md): the three tabs with the most behind them.
+- [Privacy and security](privacy-and-security.md): what each connection means for what leaves your machine.
diff --git a/docs/gitbooks/en/features/goals-and-todos.md b/docs/gitbooks/en/features/goals-and-todos.md
index 54eb4ea132..5c031df83a 100644
--- a/docs/gitbooks/en/features/goals-and-todos.md
+++ b/docs/gitbooks/en/features/goals-and-todos.md
@@ -1,52 +1,33 @@
---
description: >-
- The agent's session todo list and its per-thread goals: in-session work
- state the chat pane reflects, rather than a task board you manage.
+ The agent's session to-do list and per-thread goals: work state the chat
+ pane shows you, not a task board you manage.
icon: target
---
-# Goals & Todos
+# Goals and to-dos
-The agent tracks its own work in two places: a session todo list for the steps
-of the request it is handling, and a per-thread goal for the objective that
-thread is trying to finish.
+The agent tracks its own work in two places. A session to-do list holds the steps of the request it is handling. A per-thread goal holds the objective that thread is trying to finish.
----
-
-## Agent work state
+## How the agent uses them
-While it works on a multi-step request the agent keeps a session todo list,
-the same shape Claude Code and Codex use: one `todo` tool call writes the whole
-list (`content` + `pending` / `in_progress` / `completed`), scoped to the agent
-session and held in memory for the life of the process. Thread goals are the
-per-thread completion contract (`goal_set` / `goal_get` / `goal_complete`).
+While it works on a multi-step request, the agent keeps a session to-do list in the same shape that Claude Code and Codex use. One `todo` tool call writes the whole list. Each item has `content` and a state: `pending`, `in_progress` or `completed`. The list belongs to the agent session and stays in memory while the process runs.
-Neither is a kanban board. There is no per-thread task board, no card CRUD,
-no approval gate, and no `thread_goals`, `todos`, or `threads_task_board` RPC
-endpoint. Conversation threads remain the chat/session container.
+Thread goals are the completion contract for a thread. The agent sets, reads and completes them with `goal_set`, `goal_get` and `goal_complete`.
----
+Neither is a kanban board. There is no per-thread task board, no cards to edit, and no `thread_goals`, `todos` or `threads_task_board` RPC endpoint. Conversation threads are still the chat container.
## In the chat pane
-Both show above the composer while the agent works, read-only: the agent
-owns them, the pane reflects them.
+Both show above the composer while the agent works. They are read-only. The agent owns them and the pane reflects them.
-- The **todo checklist** lists every step with its state: completed items
- strike through and stay, the one `in_progress` item is marked, and the
- header counts how many are done. It collapses to that header.
-- The **goal banner** shows the objective, its status (active, paused, budget
- reached, complete) and tokens used against the budget when one was set.
+- The to-do checklist lists every step with its state. Completed items are struck through and stay in the list. The `in_progress` item is marked, and the header counts how many are done. You can collapse it to the header.
+- The goal banner shows the objective, its status (active, paused, budget reached or complete), and tokens used against the budget if one was set.
-Neither has an RPC of its own. Each tool call answers with its state as JSON,
-so the pane reads the newest `todo` / `goal_*` tool result in the thread,
-across the live turn and the thread's persisted turns, which is what keeps a
-goal on screen for the many turns after the one that set it.
-
----
+Neither has an RPC of its own. Each tool call returns its state as JSON, and the pane reads the newest `todo` or `goal_*` result in the thread, across the live turn and earlier turns. That is why a goal stays on screen for many turns after the one that set it.
## See also
-- [Memory](memory.md): durable preferences and facts live there as learnings; goals and todos are in-session only.
-- [Native Tools](native-tools/README.md): where the `todo` and `goal_*` tool calls sit among the rest.
-- [Agent Harness](../developing/architecture/agent-harness.md): the crate-backed stores behind both.
+- [Memory](memory.md): durable preferences and facts live there as learnings. Goals and to-dos last only for the session.
+- [Native tools](native-tools/README.md): where the `todo` and `goal_*` tool calls sit among the rest.
+- [Agent harness](../developing/architecture/agent-harness.md): the stores behind both.
diff --git a/docs/gitbooks/en/features/hosting.md b/docs/gitbooks/en/features/hosting.md
index f02fbbae3d..75ee3d682c 100644
--- a/docs/gitbooks/en/features/hosting.md
+++ b/docs/gitbooks/en/features/hosting.md
@@ -1,41 +1,41 @@
---
description: >-
- Put a workspace folder on the internet: deploy a site, provision and wire a
- database, set environment variables, attach a domain, roll back.
+ Put a workspace folder on the internet: deploy a site, set up a database,
+ set environment variables, attach a domain, and roll back.
icon: cloud-arrow-up
---
# Hosting
-The agent can take a folder in your workspace and make it a live site, with a database behind it if the app needs one. Ask for it in chat; the deploy itself is a tool call like any other, and an irreversible one goes through the [Approval Gate](approval-gate.md).
+The agent can take a folder in your workspace and make it a live site, with a database behind it if the app needs one. Ask for it in chat. The deploy is a tool call like any other, and an irreversible one goes through the [approval gate](approval-gate.md).
{% hint style="info" %}
-**Vercel is the only provider today.** The model underneath is provider-neutral, and Railway, Cloudflare and a self-hosted target are the named next steps, but nothing else is wired yet.
+Vercel is the only provider today. The design is provider-neutral, and Railway, Cloudflare and a self-hosted target are planned, but nothing else works yet.
{% endhint %}
## What the agent can do
| Tool | Effect |
| --- | --- |
-| `hosting_launch_site` | Deploy a workspace directory as a live site, optionally provisioning a database and wiring it in, setting environment variables, and attaching domains. |
+| `hosting_launch_site` | Deploys a workspace directory as a live site. It can also set up a database and connect it, set environment variables, and attach domains. |
| `hosting_deployment_status` | Whether a build has finished. |
| `hosting_list_deployments` | A site's recent deployments, newest first, with status and target. |
| `hosting_deployment_logs` | A deployment's build and runtime log events. |
-| `hosting_rollback` | Point production back at an earlier deployment that already built. |
+| `hosting_rollback` | Points production back at an earlier deployment that already built. |
| `hosting_list_sites` | The sites on the account. |
-| `hosting_set_env` | Set environment variables on an existing site. |
-| `hosting_add_domain` | Attach a custom domain. |
+| `hosting_set_env` | Sets environment variables on an existing site. |
+| `hosting_add_domain` | Attaches a custom domain. |
| `hosting_domain_status` | Whether a site's domains are verified and serving. |
| `hosting_analytics` | Traffic over the last N days. |
-A launch runs its five steps in the one order that works: create the site, provision the database, **connect the database before the build**, set the environment, then build. A framework that reads its environment at build time gets a broken build in any other order. The call returns while the build is still running, so the agent polls `hosting_deployment_status` rather than blocking.
+A launch runs five steps in the only order that works: create the site, create the database, connect the database before the build, set the environment, then build. A framework that reads its environment at build time breaks in any other order. The call returns while the build is still running, so the agent polls `hosting_deployment_status` and does not block.
-There is a rollback and no separate promote, because a rollback *is* promoting an older deployment. It refuses a deployment that never finished building, since promoting a failed build would take the site down during an attempt to bring it back up.
+There is a rollback but no separate promote, because a rollback is promoting an older deployment. It refuses a deployment that never finished building. Promoting a failed build would take the site down while you try to bring it back.
-## Two things it will not do
+## What it will not do
-- **Read a secret.** A managed database's connection string is injected by the provider into the site's environment. OpenHuman learns the variable *names* and never their values, which is why a launch reports `DATABASE_URL` rather than a URL.
-- **Deploy something you did not name.** The directory resolver refuses an absolute path, a `..` escape and anything that is not a directory. It is the one place that decides what may leave the machine, and a deployment uploads every byte under the folder it is given.
+- **Read a secret.** The provider puts a managed database's connection string into the site's environment. OpenHuman learns the variable names and never their values. That is why a launch reports `DATABASE_URL` and not a URL.
+- **Deploy something you did not name.** The directory check refuses an absolute path, a `..` escape and anything that is not a directory. It is the one place that decides what may leave your machine, and a deployment uploads every byte under the folder it is given.
## Setting it up
@@ -47,12 +47,14 @@ api_key = "" # leave blank to read the provider's own env var
team = "" # blank means your personal account
```
-With `api_key` blank the credential comes from `TINYHOSTS_VERCEL_TOKEN`, falling back to `VERCEL_TOKEN`; a team account also reads `TINYHOSTS_VERCEL_TEAM_ID` or `VERCEL_TEAM_ID`.
+With `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`.
-`[hosting] enabled` is `false` by default. With it off, or with no credential resolvable anywhere, **the ten tools are not registered at all** rather than registered and failing. That is deliberate: a tool that is present and cannot work is worse than one that is absent, because a model retries it. A *misconfigured* section is an error and is logged rather than silently skipped: an unknown provider slug, or a key that is present but blank after trimming. Leaving `api_key = ""` out entirely, or set to the empty string, is the documented way to defer to the provider's environment variable and is not a misconfiguration.
+`[hosting] enabled` is `false` by default. 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.
## See also
-- [Cloud Deploy](cloud-deploy.md): hosting the OpenHuman core itself, which is a different thing.
-- [Approval Gate](approval-gate.md): how a deploy gets your yes.
+- [Cloud deploy](cloud-deploy.md): hosting the OpenHuman core itself, which is a different thing.
+- [Approval gate](approval-gate.md): how a deploy gets your yes.
- [Coder](native-tools/coder.md): building the thing before you ship it.
diff --git a/docs/gitbooks/en/features/integrations/README.md b/docs/gitbooks/en/features/integrations/README.md
index 7fa7f53aaf..6ec2d4bbde 100644
--- a/docs/gitbooks/en/features/integrations/README.md
+++ b/docs/gitbooks/en/features/integrations/README.md
@@ -1,93 +1,93 @@
---
description: >-
- Managed OAuth into Gmail, Notion, GitHub, Slack, Stripe, Calendar and more -
- with one-click OAuth and zero API keys.
+ Managed OAuth into Gmail, Notion, GitHub, Slack, Stripe, Calendar and more,
+ with one-click sign-in and no API keys.
icon: plug
---
-# Third-party Integrations
+# Third-party integrations
-OpenHuman ships with backend-proxied access to the connector platform's managed-auth catalog, **119 toolkits** as the app knows them. Connecting one through the managed path is a one-click OAuth flow inside the app: no API keys to wire by hand, and no plugin marketplace to navigate.
+OpenHuman gives you managed access to 119 toolkits. Connecting one is a one-click OAuth flow inside the app. You don't wire up API keys or browse a plugin marketplace.
-That figure is the catalog the app ships (`KNOWN_COMPOSIO_TOOLKITS` in [`app/src/components/composio/toolkitMeta.tsx`](https://github.com/tinyhumansai/openhuman/blob/main/app/src/components/composio/toolkitMeta.tsx), pinned at 119 by [`toolkitMeta.test.tsx`](https://github.com/tinyhumansai/openhuman/blob/main/app/src/components/composio/toolkitMeta.test.tsx)). What you can actually connect is whatever the backend's allowlist returns when the page loads, and the per-toolkit action schemas are fetched live, so no number in this repository bounds the total actions reachable.
+The 119 is the catalog the app ships. What you can connect is whatever the backend's allowlist returns when the page loads. The actions for each toolkit are fetched live, so no fixed number bounds the total.
-Under the hood, the connector layer is powered by [Composio](https://composio.dev) (the module is [`tinyconnectors`](https://github.com/tinyhumansai/tinyconnectors)). In the default managed mode, OpenHuman's backend owns the Composio API key, OAuth token brokering, rate limits, and trigger webhook fan-out. If you switch to direct mode, the core talks to Composio with your own Composio API key; synchronous tool calls work, but real-time trigger webhooks must be configured on your own webhook infrastructure.
+The connector layer is powered by [Composio](https://composio.dev). In the default managed mode, OpenHuman's backend owns the Composio API key, OAuth token handling, rate limits and trigger webhooks. In direct mode, the core talks to Composio with your own API key. Synchronous tool calls work in that mode, but you must set up your own webhook infrastructure for real-time triggers.
-Once a service is connected, it shows up in four places at once:
+Once a service is connected, it shows up in three places:
-1. As an **agent tool**, the model can call it directly.
-2. As a **profile signal**, your activity across services feeds your personalization.
-3. As a **trigger source**, live events (a new email, a new charge, an inbound DM) flow into the [Triggers](triggers.md) pipeline and can fire off agent actions automatically.
+1. As an agent tool, which the model can call directly.
+2. As a profile signal. Your activity across services feeds your personalization.
+3. As a trigger source. Live events (a new email, a new charge, an inbound DM) flow into the [triggers](triggers.md) pipeline and can fire agent actions automatically.
-## Some of what's in the catalog
+## What is in the catalog
-The catalog spans productivity, business, social, messaging and Google. A non-exhaustive sample:
+The catalog spans productivity, business, social, messaging and Google. Here is a sample:
| Category | Examples |
| ----------------------- | ---------------------------------------------------- |
-| **Email & calendar** | Gmail, Outlook, Google Calendar, Apple Calendar |
-| **Docs & storage** | Google Docs, Google Drive, Notion, Dropbox, Airtable |
-| **Code & dev** | GitHub, Linear, Jira, Figma |
-| **Comms** | Slack, Discord, Microsoft Teams, Telegram, WhatsApp |
-| **CRM & sales** | Salesforce, HubSpot |
-| **Commerce & payments** | Stripe, Shopify |
-| **Project management** | Asana, Trello |
-| **Social** | Twitter / X, Spotify, YouTube |
+| Email and calendar | Gmail, Outlook, Google Calendar, Apple Calendar |
+| Docs and storage | Google Docs, Google Drive, Notion, Dropbox, Airtable |
+| Code and dev | GitHub, Linear, Jira, Figma |
+| Comms | Slack, Discord, Microsoft Teams, Telegram, WhatsApp |
+| CRM and sales | Salesforce, HubSpot |
+| Commerce and payments | Stripe, Shopify |
+| Project management | Asana, Trello |
+| Social | Twitter / X, Spotify, YouTube |
-## Native vs proxied
+## Native and proxied
-Some services have **native providers**. Rust modules that know how to ingest the service into memory directly (e.g. Gmail's native ingest path). Others are exposed as **proxied tools** only: the agent can call them, but there's no automatic ingest yet. New native providers are added as features land.
+Some services have native providers. These are Rust modules that load the service straight into memory, such as Gmail's native ingest. Others are proxied tools only: the agent can call them, but nothing is ingested automatically. Native providers are added over time.
## How connections work
-Click **Connect** on any integration. A browser window opens for OAuth. Once you sign in, the connection becomes active and you can add it as a [memory source](../memory.md) to sync it on a schedule.
+Click **Connect** on any integration. A browser window opens for OAuth. Once you sign in, the connection is active, and you can add it as a [memory source](../memory.md) to sync on a schedule.
-Each integration shows its current status:
+Each integration shows its status:
-* **Not connected**: the integration has not been set up.
-* **Connected**: the integration is active and being synced.
-* **Manage**: an active integration, with options to reconfigure or disconnect.
+- **Not connected**: it has not been set up.
+- **Connected**: it is active and syncing.
+- **Manage**: it is active, with options to reconfigure or disconnect.
You can revoke any connection at any time from the **Connections** page.
## Messaging channels
-Some integrations are not just something to read from: OpenHuman uses them to _talk back_ to you. Eight channels have a setup flow in the app, and more are available by hand in `config.toml`. The three you are most likely to start with:
+Some integrations are not just something to read from. OpenHuman also uses them to talk back to you. Eight channels have a setup flow in the app, and more can be enabled by hand in `config.toml`. The three to start with:
-* **Telegram**: the usual first choice. Two-way, with a managed one-click connection or your own bot token.
-* **Discord**: two-way, by OAuth or your own bot token, with a server and channel picker.
-* **Web**: the chat inside the desktop app itself. Messages stay entirely local.
+- **Telegram** is the usual first choice. It is two-way, with a managed one-click connection or your own bot token.
+- **Discord** is two-way, through OAuth or your own bot token, with a server and channel picker.
+- **Web** is the chat inside the desktop app. Messages stay entirely local.
-Set your default under **Connections → Channels**. [Messaging Channels](../channels.md) has the full list and what each one can do.
+Set your default under **Connections > Channels**. [Messaging channels](../channels.md) lists them all and what each can do.
-## Beyond the curated catalog: MCP & Skills
+## Beyond the curated catalog
-The managed OAuth connectors are the curated path. Beyond them, OpenHuman opens up the wider open-tooling ecosystem:
+The managed OAuth connectors are the curated path. Two more routes open up the wider ecosystem:
-* **MCP servers**: a built-in registry browses thousands of [Model Context Protocol](https://modelcontextprotocol.io) servers (Smithery + the official registry) that install locally as new agent tools.
-* **Skills**: a browsable catalog of `SKILL.md` capability bundles aggregated from several public registries, installed from the **Connections → Skills** tab. The old in-app JavaScript sandbox is gone; a skill runs as its own agent session with the interpreters it declares, not as code inside the app.
+- **MCP servers.** A built-in registry browses thousands of [Model Context Protocol](https://modelcontextprotocol.io) servers (Smithery and the official registry) and installs them locally as new agent tools.
+- **Skills.** A browsable catalog of `SKILL.md` capability bundles from several public registries, installed from the **Connections > Skills** tab. A skill runs as its own agent session with the interpreters it declares. It is not code inside the app.
-See [MCP Servers & Skills](mcp-and-skills.md) for the full picture.
+See [MCP servers and skills](mcp-and-skills.md) for more.
## Native voice and tools
-Two capabilities ship native rather than as integrations because they're load-bearing for the desktop experience:
+Two capabilities are built in rather than offered as integrations, because the desktop experience depends on them:
-* [**Voice**](../native-tools/voice.md): STT in, TTS out, and a live voice agent you can interrupt mid-sentence.
-* [**Native tools**](../native-tools/): built-in web search, a web-fetch scraper, and a full filesystem, git, lint, test and grep coder toolset the agent has out of the box.
+- [Voice](../native-tools/voice.md): speech in, speech out, and a live voice agent you can interrupt mid-sentence.
+- [Native tools](../native-tools/README.md): built-in web search, a web-fetch scraper, and a full coder toolset (filesystem, git, lint, test and grep).
## Privacy boundary
-OpenHuman's core never calls any third-party API directly. All requests go through the OpenHuman backend, which handles OAuth tokens and rate limiting. Your tokens never sit on disk in plaintext on your machine, and the agent only sees the _results_ of tool calls, not the credentials.
+In managed mode, OpenHuman's core never calls a third-party API directly. Requests go through the OpenHuman backend, which handles OAuth tokens and rate limits. Your tokens are never stored in plaintext on your machine, and the agent sees only the results of tool calls, not the credentials.
-If you opt into direct Composio mode, that boundary changes: your local core uses your own Composio API key and you are responsible for the Composio account, rate limits, billing relationship, and any webhook endpoint needed for trigger delivery.
+In direct mode that boundary changes. Your local core uses your own Composio API key, and you are responsible for the Composio account, its rate limits and billing, and any webhook endpoint needed for triggers.
-See [Privacy & Security](../privacy-and-security/) for the full boundary.
+See [Privacy and security](../privacy-and-security.md) for the full boundary.
## See also
-* [Triggers](triggers.md), live events from connected integrations and how they fire agent actions.
-* [Memory](../memory.md)
-* [MCP Servers & Skills](mcp-and-skills.md), the open-tooling path beyond the curated catalog.
-* [`integrations` domain](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/integrations/README.md), the Rust side of this page.
-* [Architecture](../../developing/architecture/), for how the backend proxy fits the core.
+- [Triggers](triggers.md): live events from connected integrations, and how they fire agent actions.
+- [Memory](../memory.md)
+- [MCP servers and skills](mcp-and-skills.md): the open tooling path beyond the curated catalog.
+- [Integrations domain](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/integrations/README.md): the Rust side of this page.
+- [Architecture](../../developing/architecture/README.md): how the backend proxy fits the core.
diff --git a/docs/gitbooks/en/features/integrations/mcp-and-skills.md b/docs/gitbooks/en/features/integrations/mcp-and-skills.md
index 93cb8872cc..3a2b39636c 100644
--- a/docs/gitbooks/en/features/integrations/mcp-and-skills.md
+++ b/docs/gitbooks/en/features/integrations/mcp-and-skills.md
@@ -1,46 +1,38 @@
---
description: >-
- Beyond the curated OAuth connectors - browse thousands of MCP servers and a
- 90,000-entry Skills catalog, and let OpenHuman act as an MCP server itself.
+ Go beyond the curated OAuth connectors: browse thousands of MCP servers and
+ a catalog of about 90,000 skills, and let OpenHuman act as an MCP server.
icon: blocks
---
-# MCP Servers & Skills
+# MCP servers and skills
-The [one-click OAuth integrations](README.md) are the curated path. Beyond them, OpenHuman opens up the wider open-tooling ecosystem in two ways: the **Model Context Protocol (MCP)** registry and the **Skills** catalog. OpenHuman can also expose _itself_ as an MCP server to other clients.
+The [one-click OAuth integrations](README.md) are the curated path. Beyond them, OpenHuman opens up the wider tooling ecosystem in two ways: the Model Context Protocol (MCP) registry and the skills catalog. OpenHuman can also act as an MCP server for other clients.
----
-
-## MCP servers (thousands)
+## MCP servers
-OpenHuman has a built-in **MCP registry** that browses the open MCP ecosystem and lets you install servers locally as new typed tools for the agent.
+A built-in registry browses the open MCP ecosystem and installs servers locally as new tools for the agent.
-- **Two upstream registries, merged.** Discovery fans out in parallel to [Smithery.ai](https://smithery.ai) and the official [`registry.modelcontextprotocol.io`](https://registry.modelcontextprotocol.io), then merges the results: thousands of servers across both.
-- **Search → install → connect.** Search the catalog, view a server's details, and install it. A local install spawns the server as a stdio subprocess; deployed servers connect over HTTP.
-- **Supervised connections.** Installed servers are persisted in a local SQLite store (`mcp_clients/mcp_clients.db`) with their command, args, and transport. A supervisor loop keeps enabled servers connected, probing every ~60s with per-server exponential backoff. Each non-nominal probe outcome (a slow answer, a dropped transport, a reconnect that succeeded or failed) shows up in **Settings → Developer → Event Log** under the `mcp` badge. An answered probe does not, so a healthy server stays silent. A server that stays down, comes back after failing, or cannot start because its launcher runtime is missing raises a notification.
+- **Two registries, merged.** Search queries [Smithery.ai](https://smithery.ai) and the official [MCP registry](https://registry.modelcontextprotocol.io) in parallel and merges the results. Together they hold thousands of servers.
+- **Search, install, connect.** Search the catalog, open a server's details and install it. A local install runs the server as a stdio subprocess. Deployed servers connect over HTTP.
+- **Supervised connections.** Installed servers are saved in a local SQLite store (`mcp_clients/mcp_clients.db`) with their command, arguments and transport. A supervisor keeps enabled servers connected. It probes about every 60 seconds and backs off per server after failures. Unusual probe results (a slow answer, a dropped transport, a reconnect that worked or failed) appear in **Settings > Developer > Event Log** under the `mcp` badge. A healthy probe is silent. You get a notification when a server stays down, comes back after failing, or cannot start because its launcher runtime is missing.
-Once connected, an MCP server's tools are available to the agent exactly like native tools.
-
-> The catalogs are open-ended and grow on their own. The "5,000+" figure reflects the combined Smithery + official ecosystem size, not a fixed list baked into OpenHuman.
+Once connected, an MCP server's tools work for the agent exactly like built-in tools. The catalogs grow on their own, so there is no fixed list baked into OpenHuman.
### OpenHuman as an MCP server
-OpenHuman can run the other way around, too. `openhuman-core mcp` exposes OpenHuman over stdio as an MCP server, offering memory tools (recall with citations, fetch, list, learn and forget) and optional web search to clients like Claude Desktop. See [MCP Server](../../developing/mcp-server.md) for setup.
+It also works the other way. `openhuman-core mcp` exposes OpenHuman over stdio as an MCP server for clients such as Claude Desktop. It offers memory tools (recall with citations, fetch, list, learn and forget) and optional web search. See [MCP server](../../developing/mcp-server.md) for setup.
----
+## Skills
-## Skills (90,000-entry catalog)
+Skills are a large, browsable catalog of `SKILL.md` capability bundles, gathered from several public sources such as HermesHub, ClawHub and LobeHub.
-**Skills** are a large, browsable catalog of agent skills (`SKILL.md`-style capability bundles) aggregated from multiple upstream sources (HermesHub, ClawHub, LobeHub, and more).
-
-- **One aggregated catalog.** Sourced from HermesHub (configurable via `OPENHUMAN_SKILL_REGISTRY_CATALOG_URL`), the catalog runs to roughly **90,000 entries**. Each entry carries id, name, description, source, author, version, tags, platforms, a download URL, and license.
-- **Cached and fast.** The catalog is fetched on boot in the background (without blocking startup), cached locally at `~/.openhuman/skill-registry/cache.json` with a ~1-hour TTL and served stale-while-revalidate. A single-flight gate prevents duplicate downloads of the large catalog.
-- **Metadata-first.** OpenHuman's in-app skills runtime (the old QuickJS sandbox) has been **removed**. Skills are now a metadata catalog you browse and install from the **Connections → Skills** tab, not code executing inside the app. Availability varies per entry: some expose a direct `SKILL.md` download, others point to external hosting.
-
----
+- **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.
+- **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 also
-- [Third-party Integrations](README.md): the curated managed-auth OAuth connectors.
-- [MCP Server](../../developing/mcp-server.md): running OpenHuman as an MCP server.
-- [Available Tools](../native-tools/README.md): the native tools that ship by default.
+- [Third-party integrations](README.md): the curated OAuth connectors.
+- [MCP server](../../developing/mcp-server.md): running OpenHuman as an MCP server.
+- [Available tools](../native-tools/README.md): the built-in tools.
diff --git a/docs/gitbooks/en/features/integrations/triggers.md b/docs/gitbooks/en/features/integrations/triggers.md
index fb1db15355..d85a640d9b 100644
--- a/docs/gitbooks/en/features/integrations/triggers.md
+++ b/docs/gitbooks/en/features/integrations/triggers.md
@@ -1,135 +1,124 @@
---
description: >-
- Live events from connected integrations (a new Gmail message, a Notion edit, a
- Stripe charge) arrive as triggers, get classified by a triage agent, and can
- fire agent actions automatically.
+ Live events from connected apps (a new Gmail message, a Notion edit, a Stripe
+ charge) arrive as triggers, get sorted by a triage agent, and can start agent
+ actions automatically.
icon: bolt
---
# Triggers
-A connected integration is not just a place the agent can read from on demand. It is also a **source of live events**. When someone sends you an email, edits a Notion page, opens a GitHub issue on one of your repos, charges a card on Stripe, or DMs you on Slack, OpenHuman receives that event in near-real-time and can decide whether to do something about it.
+A connected integration is more than a place the agent can read from on demand. It is also a source of live events. When someone emails you, edits a Notion page, opens a GitHub issue on your repo, charges a card on Stripe or DMs you on Slack, OpenHuman gets the event within moments and decides whether to act on it.
-This page is about that pipeline: how triggers arrive, how they get classified, and how a trigger can turn into a full agent action without you typing a thing.
+This page covers how triggers arrive, how they are sorted, and how one can turn into a full agent action without you typing anything.
## What a trigger is
-A trigger is an external event published by an integration you've connected. Common shapes:
+A trigger is an external event published by an integration you have connected. Some examples:
-| Integration | Example trigger |
-| ------------ | ----------------------------------------------------------------- |
-| **Gmail** | `GMAIL_NEW_GMAIL_MESSAGE`, new mail in inbox |
-| **Slack** | `SLACK_NEW_MESSAGE`, channel/DM message you were mentioned in |
-| **Notion** | `NOTION_PAGE_UPDATED`, a tracked page changed |
-| **GitHub** | `GITHUB_ISSUE_OPENED`, `GITHUB_PULL_REQUEST_OPENED` on your repos |
-| **Stripe** | `STRIPE_CHARGE_SUCCEEDED`, a successful charge on your account |
-| **Calendar** | `GOOGLE_CALENDAR_EVENT_CREATED`, a new event on your calendar |
+| Integration | Example trigger |
+| ----------- | ----------------------------------------------------------------- |
+| Gmail | `GMAIL_NEW_GMAIL_MESSAGE`, new mail in your inbox |
+| Slack | `SLACK_NEW_MESSAGE`, a channel or DM message that mentions you |
+| Notion | `NOTION_PAGE_UPDATED`, a tracked page changed |
+| GitHub | `GITHUB_ISSUE_OPENED`, `GITHUB_PULL_REQUEST_OPENED` on your repos |
+| Stripe | `STRIPE_CHARGE_SUCCEEDED`, a successful charge on your account |
+| Calendar | `GOOGLE_CALENDAR_EVENT_CREATED`, a new event on your calendar |
-The full set comes from the [Composio](https://composio.dev) connector layer that powers [third-party integrations](./). When a connection is active, the relevant trigger subscriptions are wired up automatically.
+The full set comes from the [Composio](https://composio.dev) connector layer behind [third-party integrations](README.md). When a connection is active, the matching trigger subscriptions are set up for you.
### Gmail OAuth scopes
-Gmail trigger subscriptions require message-read access on the connected Google account. Fresh OpenHuman Gmail authorizations request `https://www.googleapis.com/auth/gmail.readonly` so `GMAIL_NEW_GMAIL_MESSAGE` can be enabled and the native Gmail sync path can read the new message metadata.
+Gmail triggers need message-read access on the connected Google account. New Gmail authorizations request `https://www.googleapis.com/auth/gmail.readonly`, so `GMAIL_NEW_GMAIL_MESSAGE` can be enabled and the native Gmail sync can read new message metadata. If you connected Gmail before this scope was requested, reconnect it from Settings before enabling Gmail triggers.
-If an older Gmail connection was created before this scope was requested, reconnect Gmail from Settings before enabling Gmail triggers.
+## How a trigger reaches the agent
-## Where triggers come from, end to end
-
-```
+```text
┌────────────────────┐
-│ third-party API │ Gmail / Slack / Notion / GitHub / ...
+│ third-party API │ Gmail / Slack / Notion / GitHub / ...
└─────────┬──────────┘
- │ webhook
- ▼
+ │ webhook
+ ▼
┌────────────────────┐
-│ OpenHuman backend │ HMAC-verifies the webhook, normalises the payload
+│ OpenHuman backend │ verifies the webhook signature, cleans up the payload
└─────────┬──────────┘
- │ Socket.IO event ("composio:trigger")
- ▼
+ │ Socket.IO event ("composio:trigger")
+ ▼
┌────────────────────┐
-│ Rust core │ publishes DomainEvent::ComposioTriggerReceived
-│ (your laptop) │ on the in-process event bus
+│ Rust core │ publishes a trigger-received event
+│ (your computer) │ on the in-process event bus
└─────────┬──────────┘
- │
- ▼
+ │
+ ▼
┌────────────────────┐
-│ Trigger Triage │ classifies: drop / acknowledge / react / escalate
+│ Trigger triage │ drop / acknowledge / react / escalate
└─────────┬──────────┘
- │
- ▼
+ │
+ ▼
┌────────────────────┐
-│ One of: │
-│ - nothing │ ← drop
-│ - memory note │ ← acknowledge
-│ - Trigger Reactor │ ← react (1-2 tool calls)
-│ - Orchestrator │ ← escalate (full multi-step planning)
+│ One of: │
+│ - nothing │ ← drop
+│ - memory note │ ← acknowledge
+│ - Trigger reactor │ ← react (1-2 tool calls)
+│ - Orchestrator │ ← escalate (full multi-step planning)
└────────────────────┘
```
-The webhook never reaches your machine raw. The backend is what holds the OAuth token and what receives the webhook directly from the third-party. It does HMAC verification, normalises the payload, and forwards it to your Rust core over the existing authenticated socket. Your laptop sees a clean, validated `ComposioTriggerReceived` event on the bus, nothing else.
+The raw webhook never reaches your machine. The backend holds the OAuth token and receives the webhook from the third party. It verifies the HMAC signature, cleans up the payload and forwards it to your core over the existing authenticated socket. Your computer only sees a validated event.
## The triage step
-Before any action runs, every trigger goes through the [`trigger_triage`](../../../../../../../crates/openhuman-core/src/agent/registry/agents/trigger_triage/) agent. Its only job is to decide what the rest of the system should do.
+Before anything runs, the `trigger_triage` agent looks at every trigger. Its only job is to decide what happens next. It picks exactly one of four actions:
+
+| Action | What happens | When it is used |
+| ------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `drop` | Nothing. The trigger is logged and discarded. | Spam, duplicates and noise. This is the default for things you don't care about. |
+| `acknowledge` | A short memory note is saved. No agent runs. | Passive notices worth remembering, such as "a new page was created in archive". |
+| `react` | The `trigger_reactor` agent runs with one or two tool calls. | A small one-step effect: store a memory entry, post a quick acknowledgement, mark a thread read. |
+| `escalate` | The full orchestrator agent takes over and plans. | Anything that needs reasoning or several steps: drafting a reply, updating several Notion pages, deciding how to handle an inbound issue. |
-It picks exactly one of four actions:
+The triage agent has the same memory and workspace context as the rest of the agent. It can tell whether a trigger relates to what you are working on, who is involved, and whether you have asked OpenHuman to act on this kind of thing before.
-| Action | What happens | When to use |
-| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| **`drop`** | Nothing. Trigger is silently logged and discarded. | Spam, duplicates, irrelevant noise. The default for things you don't care about. |
-| **`acknowledge`** | A short memory note is persisted, no agent runs. | Passive notifications worth remembering ("a new page was created in archive"). |
-| **`react`** | The [`trigger_reactor`](../../../../../../../crates/openhuman-core/src/agent/registry/agents/trigger_reactor/) agent runs with one or two tool calls. | A small, single-step side effect: store a memory entry, post a quick acknowledgement, mark a thread read. |
-| **`escalate`** | The full **orchestrator** agent takes over with planning capability. | Anything that needs reasoning, multiple steps, or multiple skills: drafting a reply, updating several Notion pages, deciding how to triage an inbound issue. |
+## When a trigger becomes an agent action
-The triage agent has the same memory and workspace context the rest of the agent has. It can tell whether a trigger is relevant to something you're currently working on, who the people involved are, and whether it's the kind of thing you've asked OpenHuman to act on before.
+This is what separates "OpenHuman has a Gmail integration" from "OpenHuman is on call for your inbox".
-## When a trigger turns into an agent action
+**React** is the cheap path. The trigger reactor is a narrow specialist with a hard budget of a couple of tool calls. It suits writing a one-line memory note ("saw a new Stripe charge for $84, customer X"), marking a Slack message handled because it is the same automated alert you have already triaged twice this week, or storing a structured record of an event you might look up later.
-This is the part that distinguishes "OpenHuman has a Gmail integration" from "OpenHuman is on call for your inbox":
+**Escalate** is the heavy path. When triage decides a trigger needs real work, it hands the orchestrator a self-contained task description. The orchestrator has your full set of skills, tools and memory. It might:
-* **`react`** is the cheap path. The Trigger Reactor is a narrow specialist with a hard budget of a couple of tool calls. It's perfect for: writing a one-line memory note that says "saw a new charge from Stripe for $84, customer X, merchant Y", silently marking a Slack message as handled because it's the same automated alert you've already triaged twice this week, or storing a structured record of an event the user might want to look up later.
-* **`escalate`** is the heavy path. When the Triage agent decides the trigger needs real work, it hands off to the Orchestrator with a self-contained task description. The orchestrator has access to your full skill surface, tools, and memory. From there it might:
- * Draft a reply to an important email and queue it for your approval.
- * Pull up the relevant Notion / Linear / Drive context for an inbound issue and write a structured comment.
- * Update three connected systems based on a single inbound event ("this customer's plan changed in Stripe, update HubSpot, post in #revenue, and add a note to their Notion file").
+- Draft a reply to an important email and queue it for your approval.
+- Pull the relevant Notion, Linear or Drive context for an inbound issue and write a structured comment.
+- Update three connected systems from one event, such as a customer's plan changing in Stripe, which updates HubSpot, posts in #revenue and adds a note to their Notion file.
-In both cases the action runs on your machine, against your configured memory engine, with the same model-routing and tool surface the rest of the agent uses.
+Either way, the action runs on your machine, against your configured memory engine, with the same model routing and tools as the rest of the agent.
-## Why a triage step at all
+## Why triage exists
-It's tempting to skip the classifier and just pipe every trigger straight into the orchestrator. That's a bad idea for two reasons:
+You could pipe every trigger straight into the orchestrator. That would be a mistake for two reasons.
-1. **Most triggers are noise.** A connected Gmail account fires dozens of triggers an hour, the vast majority of which the user doesn't care about. Running the orchestrator on each would burn budget and produce a constant stream of background activity.
-2. **Different triggers deserve different ceilings.** An automated Stripe receipt and a personal Slack DM should not cost the same number of tokens to handle. Triage lets the cheap path be cheap and reserves the orchestrator for things that earn it.
+1. Most triggers are noise. A connected Gmail account fires dozens of triggers an hour, and you care about few of them. Running the orchestrator on each would burn budget and create a constant stream of background activity.
+2. Triggers deserve different budgets. An automated Stripe receipt and a personal Slack DM should not cost the same number of tokens. Triage keeps the cheap path cheap and saves the orchestrator for events that earn it.
-Triage runs on the fast model tier (see [Automatic Model Routing](../model-routing/)) so the classification itself is sub-second.
+Triage runs on the fast model tier (see [Model routing](../model-routing/README.md)), so classification takes well under a second.
## Configuration and opt-out
-* **On by default.** Once an integration is connected, its triggers feed into the pipeline automatically.
-* **Opt-out.** The triage path is gated on the `OPENHUMAN_TRIGGER_TRIAGE_DISABLED` environment variable. Setting it to `1` / `true` / `yes` turns off agent classification and falls back to passive logging only. The integration itself stays connected; only the auto-action behaviour is suppressed.
-* **Per-trigger settings.** Trigger settings (which integrations and event types should be evaluated) are managed under **Settings**; the underlying RPC methods are `update_composio_trigger_settings` / `get_composio_trigger_settings`.
-* **Audit log.** Every trigger, regardless of decision, is written to the trigger history so you can see what arrived, what the classifier decided, and what (if anything) ran. Decisions and escalations are also published as `TriggerEvaluated` / `TriggerEscalated` events on the in-process bus, which means anything inside the core can subscribe to them.
+- **On by default.** Once an integration is connected, its triggers feed the pipeline automatically.
+- **Opt out.** Set the `OPENHUMAN_TRIGGER_TRIAGE_DISABLED` environment variable to `1`, `true` or `yes`. Agent classification turns off and triggers are only logged. The integration stays connected. Only the automatic actions stop.
+- **Per-trigger settings.** Choose which integrations and event types are evaluated under **Settings**. The RPC methods are `get_composio_trigger_settings` and `update_composio_trigger_settings`.
+- **Audit log.** Every trigger is written to the trigger history, whatever the decision, so you can see what arrived, what triage decided and what ran. Decisions and escalations are also published as `TriggerEvaluated` and `TriggerEscalated` events on the in-process bus, so anything inside the core can subscribe.
## Privacy boundary
-Triggers follow the same boundary as the rest of the product (see [Privacy & Security](../privacy-and-security/)):
-
-* The third-party token lives on the backend, never on your laptop.
-* The webhook is HMAC-verified by the backend before it reaches your machine.
-* The trigger payload is processed by your local core; classification and any reaction run on your machine, against your configured memory engine.
-* Memory notes written by `acknowledge` / `react` / `escalate` paths are stored as learnings in your memory engine when memory is on.
-
-## Implementation pointers (for developers)
+Triggers follow the same boundary as the rest of the product (see [Privacy and security](../privacy-and-security.md)):
-* Triage agent: `crates/openhuman-core/src/agent/registry/agents/trigger_triage/`
-* Reactor agent: `crates/openhuman-core/src/agent/registry/agents/trigger_reactor/`
-* Composio bus subscriber: `crates/openhuman-core/src/integrations/composio/bus.rs` (`ComposioTriggerSubscriber`)
-* Trigger history persistence: `crates/openhuman-core/src/integrations/composio/trigger_history.rs`
-* Domain events: `DomainEvent::ComposioTriggerReceived`, `DomainEvent::TriggerEscalated` in `crates/openhuman-core/src/core/events.rs`
-* Trigger settings RPC: `update_composio_trigger_settings` / `get_composio_trigger_settings` in `crates/openhuman-core/src/config/`
+- The third-party token lives on the backend and never on your computer.
+- The backend verifies the webhook signature before anything reaches your machine.
+- Your local core processes the payload. Classification and any reaction run on your machine, against your configured memory engine.
+- Notes written by the acknowledge, react and escalate paths are stored as learnings in your memory engine when memory is on.
## See also
-* [Third-party Integrations](./), the catalog of services triggers come from.
-* [Memory sources](../memory.md), the polling counterpart, periodic ingest of source data into memory.
+- [Third-party integrations](README.md): the catalog of services triggers come from.
+- [Memory sources](../memory.md): the polling counterpart, which pulls source data into memory on a schedule.
diff --git a/docs/gitbooks/en/features/ios-companion.md b/docs/gitbooks/en/features/ios-companion.md
index 38cfc4f18a..94af8ba2de 100644
--- a/docs/gitbooks/en/features/ios-companion.md
+++ b/docs/gitbooks/en/features/ios-companion.md
@@ -1,35 +1,31 @@
---
description: >-
- Pair an iOS companion app to your desktop OpenHuman over an end-to-end
- encrypted tunnel, scanned from a QR code.
+ Pair an iOS companion app with your desktop OpenHuman over an end-to-end
+ encrypted tunnel, set up by scanning a QR code.
icon: mobile-screen
---
-# iOS Companion
+# iOS companion
-The iOS Companion lets you reach your desktop OpenHuman from your phone: you scan a QR code shown on the desktop, the two devices agree on a shared key, and from then on the phone talks to the desktop core over an encrypted channel.
+The iOS companion lets you reach your desktop OpenHuman from your phone. You scan a QR code shown on the desktop, the two devices agree on a shared key, and from then on the phone talks to the desktop core over an encrypted channel.
{% hint style="warning" %}
-**Experimental / non-shipping.** The iOS client is in-progress and is **not** part of the shipped desktop product. APIs, wire formats, and the pairing flow can change without notice, and an upgrade may force you to re-pair. Treat everything below as a developer preview.
+Experimental and not shipping. The iOS client is in progress and is not part of the shipped desktop product. APIs, wire formats and the pairing flow can change without notice, and an upgrade may force you to pair again. Treat everything below as a developer preview.
{% endhint %}
-The desktop core is always the source of truth. The phone is a thin client. It does not run its own agent, it relays requests to the core and renders the results.
+The desktop core is always the source of truth. The phone is a thin client. It does not run its own agent. It relays requests to the core and shows the results.
-What is experimental here is the **client**, not the core. The core's pairing domain is complete and wired into the controller registry (`crates/openhuman-core/src/security/devices/`): it registers the channel, derives the keys, persists the device, and tracks peer status. Earlier contributor notes described pairing as blocked on an unmerged backend change; that is no longer the case. Two real gaps remain, both noted below: there is no desktop screen for managing paired devices, and revocation is local-side only.
+The experimental part is the client, not the core. The core's pairing code is complete: it registers the channel, derives the keys, saves the device and tracks whether the peer is online. Two gaps remain. There is no desktop screen for managing paired devices, and revoking a device only takes effect locally.
-***
+## How pairing works
-## What it is
+The core's `devices` domain handles pairing. The core registers a pairing channel with the backend's `tunnel:*` Socket.IO relay, generates a fresh X25519 keypair and shows a QR code. The phone scans it, generates its own X25519 keypair and connects back over the same relay. The backend only forwards frames. It relays opaque data and never sees plaintext.
-Pairing is brokered by the Rust `devices` domain in the core. The core registers a pairing channel with the tinyhumans backend's `tunnel:*` Socket.IO relay, generates a fresh X25519 keypair, and renders a QR code. The phone scans it, generates **its own** X25519 keypair, and connects back over the same relay. The backend is a **blind forwarder**: it relays opaque frames and never sees plaintext.
+Pairing and revocation are core RPCs, not a desktop screen. The old **Settings > Devices** page was removed, and its address now redirects to **Settings > Account**. Nothing in the desktop frontend calls the `devices_*` methods yet, so listing or revoking a paired device means calling the core directly.
-Pairing and revocation are core RPCs, not a desktop screen. The old **Settings → Devices** page was removed and its slug now redirects to **Settings → Account** (`app/src/components/settings/settingsRouteRegistry.ts`), and nothing in the desktop frontend calls the `devices_*` methods. Listing and revoking a paired device means calling the core directly for now.
+## Pairing with a QR code
-***
-
-## Pairing via QR code
-
-```
+```text
Desktop core Backend relay iOS app
| | |
|-- devices_create_pairing RPC | |
@@ -52,50 +48,50 @@ Desktop core Backend relay iOS app
| devices_list now returns it | |
```
-The QR payload (carried as an `openhuman://pair?...` deep link) contains the channel id (`cid`), a single-use pairing token (`pt`), the core's public key (`cpk`), an optional LAN URL (`rpc`), and an expiry (`exp`). The pairing token is single-use and the QR is rejected client-side once `exp` has passed. The core does not choose that expiry: it stores and republishes whatever `pairingExpiresAt` the backend returns in its `tunnel:register` ACK, so the real TTL is the backend's.
+The QR code carries an `openhuman://pair?...` deep link with these fields:
-***
+- `cid`: the channel id.
+- `pt`: a single-use pairing token.
+- `cpk`: the core's public key.
+- `rpc`: an optional LAN URL.
+- `exp`: the expiry.
-## The end-to-end tunnel
+The phone rejects the QR once `exp` has passed. The core does not choose the expiry. It stores and republishes whatever `pairingExpiresAt` the backend returns when the channel is registered, so the real lifetime is the backend's.
-Confidentiality and integrity live entirely on the two endpoints. The exact primitives, from `crates/openhuman-core/src/security/devices/crypto.rs`:
+## The end-to-end tunnel
-* **Key agreement:** X25519 Diffie-Hellman. Each side has a long-term static keypair (the core's is in the QR; the device's is minted at scan time) plus an ephemeral keypair minted per session for forward secrecy.
-* **Session-key derivation:** HKDF-SHA256 over `ikm = static_dh || eph_dh`, salted with `client_eph_pub || server_eph_pub`. Two **directional** 32-byte subkeys are expanded with distinct info tags (`openhuman-tunnel/v1/c2s` and `openhuman-tunnel/v1/s2c`), so a frame one side seals can never decrypt under its own opener (closes the cross-direction reflection attack class).
-* **Frame cipher:** XChaCha20-Poly1305 (AEAD, 192-bit nonce). Wire format is `version(0x02) || nonce(24) || ciphertext+tag`, with a random nonce per frame.
-* **Replay protection:** a sliding window over the last 128 nonces seen per opener.
+Confidentiality and integrity are handled entirely by the two endpoints. The primitives are:
-Static DH authenticates the peer via the QR-code provenance; ephemeral DH means a later static-key leak cannot decrypt past traffic. The legacy single-key `version=0x01` frame shape is rejected with an explicit "re-pair required" error, so peers must re-pair after an upgrade. Outbound frames are capped at 64 KB.
+- **Key agreement:** X25519 Diffie-Hellman. Each side has a long-term static keypair (the core's is in the QR code, and the device's is created at scan time) plus an ephemeral keypair for each session, for forward secrecy.
+- **Session keys:** HKDF-SHA256 over the static and ephemeral shared secrets, salted with both ephemeral public keys. It expands two directional 32-byte keys with different labels (`openhuman-tunnel/v1/c2s` and `openhuman-tunnel/v1/s2c`). A frame one side seals can therefore never be opened by the same side, which blocks reflection attacks.
+- **Frame cipher:** XChaCha20-Poly1305 with a 192-bit nonce. A frame is `version(0x02) || nonce(24) || ciphertext+tag`, with a random nonce each time.
+- **Replay protection:** a sliding window over the last 128 nonces seen by each receiver.
-***
+The static exchange authenticates the peer through the QR code. The ephemeral exchange means a later leak of a static key cannot decrypt past traffic. The old single-key `version=0x01` frame is rejected with a "re-pair required" error, so peers must pair again after an upgrade. Outbound frames are capped at 64 KB.
## Transport strategies
-The phone may reach the core three ways. `TransportManager` (`app/src/services/transport/`) picks one from the saved `ConnectionProfile`; for a paired device it **races LAN against the tunnel** (2 s LAN timeout) and uses whichever answers `openhuman.ping` first.
-
-| Strategy | Class | When it's used | Trade-offs |
-| ------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
-| **LAN HTTP** (`LanHttpTransport`) | Direct HTTP to the core's LAN `rpc_url` | Phone and desktop on the same network | Fastest, lowest latency. Requires same LAN; not encrypted by this layer (relies on local network trust). |
-| **Tunnel** (`TunnelTransport`) | E2E encrypted frames over the backend Socket.IO relay | Anywhere with internet; default fallback | Works across networks; X25519 + XChaCha20-Poly1305 end to end. Higher latency (relayed); depends on backend availability. |
-| **Cloud HTTP** (`CloudHttpTransport`) | HTTP to a cloud-hosted core endpoint | Profile `kind: "cloud"`, when LAN and tunnel are unreachable | Reachable from anywhere; depends on a hosted core and its own auth. |
-
-***
+The phone can reach the core in three ways. `TransportManager` picks one based on the saved connection profile. For a paired device it races the LAN against the tunnel (with a 2 second LAN timeout) and uses whichever answers `openhuman.ping` first.
-## Device management & revocation
+| Strategy | What it does | When it is used | Trade-offs |
+| --- | --- | --- | --- |
+| LAN HTTP (`LanHttpTransport`) | Direct HTTP to the core's LAN `rpc_url` | Phone and desktop on the same network | Fastest. Needs the same LAN, and this layer does not encrypt it, so it relies on trust in the local network. |
+| Tunnel (`TunnelTransport`) | Encrypted frames over the backend Socket.IO relay | Anywhere with internet. The default fallback. | Works across networks and is encrypted end to end. Slower because it is relayed, and it depends on the backend being up. |
+| Cloud HTTP (`CloudHttpTransport`) | HTTP to a cloud-hosted core endpoint | Profile `kind: "cloud"`, when LAN and tunnel are unreachable | Reachable from anywhere. Needs a hosted core and its own auth. |
-Paired devices are persisted by the core in SQLite (`{workspace_dir}/devices/devices.db`, table `paired_devices`): channel id, label, the device's public key, a SHA-256 hash of the core session token, and timestamps. The core's X25519 private key is stored encrypted at rest (via the OS keyring `SecretStore`) so handshakes survive a restart.
+## Device management and revocation
-* **Create**: `devices_create_pairing` registers the channel, mints and persists the keypair, and returns the QR fields.
-* **List**: `devices_list` returns non-revoked devices, overlaying a live `peer_online` flag sourced from `tunnel:peer-status` (online status is never persisted).
-* **Revoke**: `devices_revoke` soft-deletes the device, tears down all in-memory and tunnel state for the channel, and publishes a `DeviceRevoked` event. Today revocation is local-side: the backend channel is left to expire via its pairing-token TTL (a backend revoke endpoint is a follow-up).
+The core saves paired devices in SQLite (`{workspace_dir}/devices/devices.db`, table `paired_devices`). Each record has the channel id, a label, the device's public key, a SHA-256 hash of the core session token, and timestamps. The core's X25519 private key is encrypted at rest through the OS keyring, so handshakes survive a restart.
-All three are reachable over JSON-RPC as `openhuman.devices_create_pairing`, `openhuman.devices_list` and `openhuman.devices_revoke`, and on the CLI through the generic namespace dispatcher: `openhuman-core devices create_pairing`, `openhuman-core devices list`, `openhuman-core devices revoke --channel_id <id>`.
+- **Create:** `devices_create_pairing` registers the channel, creates and saves the keypair, and returns the QR fields.
+- **List:** `devices_list` returns devices that are not revoked, with a live `peer_online` flag from `tunnel:peer-status`. Online status is never saved.
+- **Revoke:** `devices_revoke` soft-deletes the device, clears all in-memory and tunnel state for the channel, and publishes a `DeviceRevoked` event. Revocation is local only. The backend channel is left to expire with its pairing-token lifetime.
-***
+All three are available over JSON-RPC as `openhuman.devices_create_pairing`, `openhuman.devices_list` and `openhuman.devices_revoke`. On the CLI, use `openhuman-core devices create_pairing`, `openhuman-core devices list` and `openhuman-core devices revoke --channel_id <id>`.
## See also
-* [Privacy & Security](privacy-and-security/): how OpenHuman handles your data and keys.
-* [Voice](native-tools/voice.md): push-to-talk and dictation, the headline use case for a phone companion.
-* [Architecture](../developing/architecture/architecture.md): where the iOS client sits relative to the core.
-* [OS Keyring & Secret Storage](privacy-and-security/os-keyring-and-secret-storage.md): where the core's X25519 private key is kept.
+- [Privacy and security](privacy-and-security.md): how OpenHuman handles your data and keys.
+- [Voice](native-tools/voice.md): push-to-talk and dictation, the main use for a phone companion.
+- [Architecture](../developing/architecture.md): where the iOS client sits relative to the core.
+- [OS keyring and secret storage](os-keyring-and-secret-storage.md): where the core's X25519 private key is kept.
diff --git a/docs/gitbooks/en/features/mascot.md b/docs/gitbooks/en/features/mascot.md
deleted file mode 100644
index e85ff1d57f..0000000000
--- a/docs/gitbooks/en/features/mascot.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-description: >-
- The on-screen face of OpenHuman: a desktop mascot that speaks, reacts, and
- keeps working in the background even when you aren't looking at it.
-icon: face-smile
----
-
-# The Mascot
-
-OpenHuman has a face. The mascot is an animated character that lives on your desktop and acts as the visible surface of the agent, what it's saying, what it's thinking about, when it's idle, when it's busy, when it has something to tell you.
-
-It is not a chrome ornament. The mascot is wired into the same pieces as the rest of the agent: [voice](native-tools/voice.md), [memory](memory.md) and [scheduled runs](native-tools/cron.md). When the agent talks, the mascot is the one talking; when the agent is thinking, the mascot is the one thinking.
-
-## What it does
-
-### It speaks, and lip-syncs to its own voice
-
-When the agent replies, the audio is generated through a hosted TTS model and streamed to your speakers. At the same time, the mascot drives a viseme map against the audio so its mouth shapes match the words coming out. There's no separate "talking head" video, the same audio stream that you hear is the one driving the animation.
-
-See [Native Voice](native-tools/voice.md) for the speech-to-text and text-to-speech plumbing the mascot rides on top of.
-
-### It moves and reacts to its surroundings
-
-The mascot has mood states (idle, thinking, listening, talking, surprised) and it transitions between them based on what the agent is doing. When you start typing it shifts into a listening pose. When the model is reasoning, it shows that. When a tool call returns something noteworthy, it reacts. When you stop interacting for a while, it drifts into idle.
-
-After a turn finishes, the desktop mascot also reads the conversation-level cue that arrives with the chat result. A success cue produces a short happy acknowledgement, uncertainty produces a confused acknowledgement, and warnings or failed outcomes produce a concerned acknowledgement. If no strong cue is present, it keeps the existing calm post-turn acknowledgement and falls back to idle.
-
-It is meant to feel alive, not animated-on-rails.
-
-### It remembers you
-
-The mascot is the visible part of an agent that has [memory](memory.md) underneath it. It remembers what you've talked about, what you prefer, what's in your documents and what's been decided, across the sources you've added. When it greets you in the morning, it isn't starting from zero.
-
-That memory is what makes the personality consistent over weeks and months. The mascot you talk to today knows what the mascot you talked to last Tuesday knows.
-
-### It works while you're away
-
-Even when you've stopped typing, work can keep happening on your behalf: [scheduled routines](native-tools/cron.md) run on a cron expression, [triggers](integrations/triggers.md) fire on inbound events, and [workflows](workflows.md) execute durable, approval-gated graphs. So when you come back to the desk, the mascot may have already drafted the email, refreshed the dashboard, or queued the question it needs to ask you. The face on the screen is the one that did the work.
-
-## Why have a mascot at all?
-
-Most assistants are a blinking text input. That's fine for a tool. It's not fine for something that's meant to be alongside you all day, with persistent memory of your life, taking actions on your behalf.
-
-The mascot exists because:
-
-* **Presence beats panels.** A face you can glance at tells you, in one frame, whether the agent is busy, idle, or trying to get your attention.
-* **It makes talking feel like a conversation.** An animated character lip-syncing to its own speech is a different experience from a robotic voice and a blank panel.
-* **Personality is a UX surface.** A consistent character on screen is easier to trust, talk to, and forgive when it makes a mistake than a faceless API.
-
-## See also
-
-* [Native Voice](native-tools/voice.md), the STT / TTS plumbing the mascot rides on.
-* [Memory](memory.md), what the mascot remembers, and how.
-* [Themes & Theme Studio](theming.md), where the mascot's colour, shape and voice are set.
-* [Chat](chat.md) and [Notifications & Activity](notifications-and-activity.md), where the mascot's cues surface.
-* [`voice` domain](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/voice/README.md), the Rust side of speech.
diff --git a/docs/gitbooks/en/features/mascot/README.md b/docs/gitbooks/en/features/mascot/README.md
new file mode 100644
index 0000000000..2604c632f4
--- /dev/null
+++ b/docs/gitbooks/en/features/mascot/README.md
@@ -0,0 +1,50 @@
+---
+description: >-
+ The face of OpenHuman: an on-screen mascot that speaks, reacts, and shows
+ when the agent is working, even while you aren't looking.
+icon: face-smile
+---
+
+# The mascot
+
+OpenHuman has a face. The mascot is an animated character on your desktop that shows what the agent is saying, what it is thinking about, whether it is idle or busy, and when it has something to tell you.
+
+It is more than decoration. The mascot is wired into the same parts as the rest of the agent: [voice](../native-tools/voice.md), [memory](../memory.md) and [scheduled runs](../native-tools/cron.md). When the agent talks, the mascot talks. When the agent thinks, the mascot thinks.
+
+## What it does
+
+### It speaks and lip-syncs
+
+When the agent replies, a hosted text-to-speech model generates the audio and streams it to your speakers. The mascot maps the audio to mouth shapes so its lips match the words. There is no separate talking-head video. The audio you hear is the same stream that drives the animation.
+
+See [Voice](../native-tools/voice.md) for the speech-to-text and text-to-speech behind it.
+
+### It reacts
+
+The mascot has moods: idle, thinking, listening, talking and surprised. It moves between them based on what the agent is doing. It shifts into a listening pose when you start typing, shows when the model is reasoning, reacts when a tool returns something noteworthy, and drifts into idle when you stop interacting.
+
+After a turn finishes, the mascot also reads the conversation-level cue that comes with the chat result. A success cue gets a short happy acknowledgement. Uncertainty gets a confused one. Warnings and failures get a concerned one. With no strong cue, it keeps the calm default and goes back to idle.
+
+### It remembers you
+
+Behind the mascot is an agent with [memory](../memory.md). It remembers what you have talked about, what you prefer, what is in your documents and what you decided, across the sources you have added. When it greets you in the morning, it isn't starting from zero. That memory keeps its personality consistent over weeks and months.
+
+### It works while you are away
+
+Work can continue when you stop typing. [Scheduled routines](../native-tools/cron.md) run on a cron expression, [triggers](../integrations/triggers.md) fire on inbound events, and [workflows](../workflows.md) run durable graphs with approval steps. When you come back, the mascot may have already drafted the email, refreshed the dashboard, or queued the question it needs to ask you.
+
+## Why have a mascot
+
+Most assistants are a blinking text box. That works for a tool. It works less well for something that stays with you all day, remembers your life and acts for you. The mascot helps in three ways:
+
+- A face you can glance at shows in one frame whether the agent is busy, idle or asking for attention.
+- A character that lip-syncs its own speech makes talking feel like a conversation.
+- A consistent character is easier to trust, talk to and forgive than a faceless API.
+
+## See also
+
+- [Voice](../native-tools/voice.md): the speech-to-text and text-to-speech behind the mascot.
+- [Memory](../memory.md): what the mascot remembers, and how.
+- [Themes and Theme Studio](../theming.md): where the mascot's color, shape and voice are set.
+- [Chat](../chat.md) and [Notifications and activity](../notifications-and-activity.md): where the mascot's cues show up.
+- [Voice domain](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/voice/README.md): the Rust side of speech.
diff --git a/docs/gitbooks/en/features/memory.md b/docs/gitbooks/en/features/memory.md
index b3e0de0301..2fbc49e0d8 100644
--- a/docs/gitbooks/en/features/memory.md
+++ b/docs/gitbooks/en/features/memory.md
@@ -1,113 +1,115 @@
---
description: >-
Memory: a pluggable engine that stores your documents, conversations and
- learnings, recalls what matters before every turn, and answers questions with
- citations.
+ learnings, recalls what matters before every turn, and answers questions
+ with citations.
icon: brain
---
# Memory
-OpenHuman's memory lets the agent remember you across chats: what you are working on, what you prefer, what is in your documents. Memory is a feature of the app, not a hidden database. You pick who stores it, see what is stored, and delete anything.
+Memory lets the agent remember you across chats: what you are working on, what you prefer, what is in your documents. It is a feature of the app, not a hidden database. You choose who stores it, see what is stored, and delete anything.
-Open it from **Connections → Memory**. It has eight tabs (chips): **Engine**, **Ask**, **Explorer**, **Learnings**, **Conversations**, **Brain**, **Background** and **Settings**. The old `/brain` and `/settings/memory-engine` addresses redirect there.
+Open it from **Connections > Memory**. It has eight tabs: Engine, Ask, Explorer, Learnings, Conversations, Brain, Background and Settings. The old `/brain` and `/settings/memory-engine` addresses redirect there.
## How the agent uses memory
-Memory works around every turn, without the agent having to ask:
+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, token-budgeted _memory pack_ for the turn: relevant learnings (and beliefs the engine has built from them), documents from your brain, this agent's earlier conversations and, briefly, other agents'. The pack is added to the model request for that turn only. It is never written into the chat, so the conversation itself stays exactly as you had it.
-* **After the answer**, the reply is logged together 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.
-* **In the background**, every few minutes, the engine builds beliefs from what was stored ("the user prefers short answers", "deploys happen on Fridays").
+- **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.
+- **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".
-The answer's memory chips show which stored items the pack cited. To see what a turn would get, open **Ask → Pack preview**.
+Memory chips on an answer show which stored items the pack cited. To see what a turn would get, open **Ask > Pack preview**.
## Engines
-An engine stores your memory and answers questions about it. There are two:
+An engine stores your memory and answers questions about it. There are two.
-| Engine | What it is | Needs |
-| -------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
-| **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 not the managed one |
+| Engine | What it is | Needs |
+| --- | --- | --- |
+| 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 |
-Either way your memory items are stored in CortexDB, not on your computer; OpenHuman keeps only bookkeeping (queued jobs, sync and import progress) locally. See [Where your memory is stored](privacy-and-security/#where-your-memory-is-stored).
+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).
-Pick one 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.
+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.
## What the engine does
-* **Recall** answers a question in plain language and cites the stored items it relied on. The engine implements it.
-* **Fetch** is raw search over stored items with metadata filters (folder, repo, thread, source, time window). Both launch engines support hybrid search only.
-* **Store** takes three kinds of items: documents, conversations and learnings.
+- **Recall** answers a question in plain language and cites the stored items it used.
+- **Fetch** is a raw search over stored items with metadata filters (folder, repo, thread, source, time window). Both engines support hybrid search only.
+- **Store** takes three kinds of items: documents, conversations and learnings.
## What gets stored
### The brain: documents
-The **Brain** tab holds documents every agent shares, filed by source type: `pdf`, `markdown`, `notion`, `github`, `web`, and one per other source (`gmail`, `docx`, …). It shows how many documents each source holds, lets you search them, add one (pasted text or a file on your computer), and forget a whole source.
+The **Brain** tab holds documents that every agent shares, filed by source type: `pdf`, `markdown`, `notion`, `github`, `web`, and one per other source (`gmail`, `docx` and so on). It shows how many documents each source holds. You can search them, add one (pasted text or a file from your computer), and forget a whole source.
-Below that, **Synced sources** keep the brain up to date. A source is one of:
+Below that, synced sources keep the brain up to date. A source is one of:
-| Kind | Target | Filed under |
-| -------- | --------------------------- | ---------------------------------------------- |
-| `folder` | A folder on your computer | `pdf`, `web` (HTML) or `markdown` by file type |
-| `file` | A single file | as for a folder |
-| `link` | A web page | `web` |
-| `github` | A repository (`owner/repo`) | `github` |
-| `rss` | A feed URL | `web` |
+| Kind | Target | Filed under |
+| --- | --- | --- |
+| `folder` | A folder on your computer | `pdf`, `web` (HTML) or `markdown`, by file type |
+| `file` | A single file | Same as a folder |
+| `link` | A web page | `web` |
+| `github` | A repository (`owner/repo`) | `github` |
+| `rss` | A feed URL | `web` |
-Sources sync when you press sync and on a schedule you set per source. An unchanged file that syncs again is not stored twice. Removing a source can also forget the items it produced.
+Sources sync when you press sync and on a schedule you set for each source. An unchanged file that syncs again is not stored twice. Removing a source can also forget the items it produced.
### Conversations
-Every turn is logged as it happens: your message before the model runs, 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. Turn logging can be switched off on the **Conversations** tab, which also lists each agent's stored turns.
+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.
### Learnings
-A learning is one durable statement: a preference, fact, procedure or correction. The agent saves them with its `memory` tool (`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 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".
Everything is scrubbed for secrets and personal identifiers before it leaves your machine.
### Past conversations
-Chats from before turn logging are not in memory until you sync them. The **Conversations** tab shows how many chats and turns are still unsynced; **Sync past conversations** uploads them (after you confirm) in the same form as new turns, without tool arguments. You can close the page while it runs, and syncing again later only sends what is new.
+Chats from before turn logging are not in memory until you sync them. The **Conversations** tab shows how many chats and turns are still unsynced. **Sync past conversations** uploads them after you confirm, in the same form as new turns and without tool arguments. You can close the page while it runs, and syncing again later sends only what is new.
## Exploring what memory holds
-The **Explorer** tab shows everything your memory holds, grouped by one property at a time: type, memory node, source, workspace, folder, file, language, repository, link, thread, agent, tool or tag. Each value shows how many items carry it. Click one to narrow to those items, then group again by another property; the breadcrumb at the top takes you back up. The items at each step are listed below, and **Open** shows one in full with all its details and a **Forget** button.
+The **Explorer** tab shows everything your memory holds, grouped by one property at a time: type, memory node, source, workspace, folder, file, language, repository, link, thread, agent, tool or tag. Each value shows how many items carry it. Click a value to narrow to those items, then group by another property. The breadcrumb at the top takes you back up. The items at each step are listed below. **Open** shows one in full with all its details and a **Forget** button.
-On a very large memory the counts may cover only the items scanned so far; the tab says so when that happens.
+On a very large memory, the counts may cover only the items scanned so far. The tab says so when that happens.
## Each agent's own memory
-Memory is organised the way a team works:
+Memory is organized the way a team works:
-* **Shared by every agent:** learnings and the brain.
-* **Each agent's own:** its conversations. The pack an agent gets leads with its own history; other agents' turns appear only briefly.
-* **Teams and tenants:** an agent team gets a memory of its own, below its own root (`team:<id>`), apart from everyone else's.
+- **Shared by every agent:** learnings and the brain.
+- **Each agent's own:** its conversations. An agent's pack leads with its own history, and other agents' turns appear only briefly.
+- **Teams and tenants:** an agent team gets its own memory below its own root (`team:<id>`), apart from everyone else's.
-By default an agent's memory id is its definition id. In `config.toml`, `[memory.agents.<id>]` can give a definition another memory id (`agent_id`), another root (`root`), or switch its per-turn pack off (`recall = false`). A host that runs OpenHuman agents as part of something larger (an AI company, a multi-agent product) binds each agent to its own memory: `[memory] agent_id` and `root` on that agent's config, or `AgentSpec::memory(MemoryBinding::new("employee-7").root("team:acme"))` through the [embedding library](../developing/embedding.md).
+By default an agent's memory id is its definition id. In `config.toml`, `[memory.agents.<id>]` can give a definition another memory id (`agent_id`), another root (`root`), or turn off its per-turn pack (`recall = false`).
+
+A host that runs OpenHuman agents as part of something larger, such as an AI company or a multi-agent product, can bind each agent to its own memory. Use `[memory] agent_id` and `root` on that agent's config, or `AgentSpec::memory(MemoryBinding::new("employee-7").root("team:acme"))` through the [embedding library](../developing/embedding.md).
## 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) exposes 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`. 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 work
-The **Settings** tab sets the pack's shape: on or off, its size in tokens, how many learnings, documents and turns it holds, and how often beliefs are built. The **Background** tab lists queued belief builds and recent runs, with **Run now**. With the TinyHumans engine, beliefs are built on the service's own schedule.
+The **Settings** tab sets the shape of the pack: on or off, its size in tokens, how many learnings, documents and turns it holds, and how often beliefs are built. The **Background** tab lists queued belief builds and recent runs, with a **Run now** button. With the TinyHumans engine, beliefs are built on the service's own schedule.
## Importing your previous memory
-If OpenHuman finds memory from the earlier (v1) version, the Memory page offers a one-time import. It uploads that data to the engine you selected, so it only starts after you explicitly consent. It resumes if interrupted.
+If OpenHuman finds memory from the earlier (v1) version, the Memory page offers a one-time import. It uploads that data to the engine you selected, so it starts only after you consent. It resumes if interrupted.
-## Removed
+## What is not here
-The memory tree, graph view, goals list, people and contacts, learning profile, `MEMORY.md` and `PROFILE.md`, the Obsidian vault, the local TinyCortex engine and the Supermemory, Mem0, Cognee and agentMemory engines are gone, as is engine migration. The compiled `context.md` brief is replaced by the per-turn memory pack. See the [spec](https://github.com/tinyhumansai/openhuman/blob/main/docs/specs/memory-v2.md).
+The current memory has no memory tree, graph view, goals list, people and contacts, learning profile, `MEMORY.md` or `PROFILE.md` files, or Obsidian vault. Other memory engines (Supermemory, Mem0, Cognee, agentMemory and the local TinyCortex engine) are gone, and so is migrating between engines. The per-turn memory pack replaces the old compiled `context.md` brief.
## See also
-* [Memory architecture](../developing/architecture/memory.md)
-* [Pluggable engines](../developing/engines.md)
-* [Privacy and security](privacy-and-security/)
+- [Memory architecture](../developing/architecture/memory.md)
+- [Pluggable engines](../developing/engines.md)
+- [Privacy and security](privacy-and-security.md)
diff --git a/docs/gitbooks/en/features/model-routing/README.md b/docs/gitbooks/en/features/model-routing/README.md
index 493b14d6e8..06b3928b66 100644
--- a/docs/gitbooks/en/features/model-routing/README.md
+++ b/docs/gitbooks/en/features/model-routing/README.md
@@ -1,61 +1,61 @@
---
description: >-
- One subscription, many models. Tasks pick their model via hint prefixes:
- reasoning goes to a strong model, fast paths go to a fast one, vision to
- vision.
+ One subscription, many models. Each task picks its model with a hint:
+ reasoning goes to a strong model, quick work to a fast one, images to a
+ vision model.
icon: route
---
-# Automatic Model Routing
+# Automatic model routing
-Different parts of an agent want different models. Long reasoning wants a frontier model. Quick "fix this typo" calls want a fast cheap one. Vision wants a vision model. OpenHuman handles this with a built-in **router provider** so you never have to think about it.
+Different parts of an agent want different models. Long reasoning wants a frontier model. A quick "fix this typo" wants a fast, cheap one. Images want a vision model. OpenHuman has a built-in router that picks for you.
-## How a request gets routed
+## How a request is routed
-The model parameter on any chat call can take one of two shapes:
+The model parameter on a chat call takes one of two forms:
-* **Concrete model name**: for example `anthropic/claude-sonnet-4`. Routes to the default provider with that exact model.
-* **Hint prefix**: for example `hint:reasoning`. Looks the hint up in the route table and resolves to a `(provider, model)` pair.
+- **A concrete model name**, such as `anthropic/claude-sonnet-4`. It goes to the default provider with that exact model.
+- **A hint prefix**, such as `hint:reasoning`. The router looks the hint up in the route table and resolves it to a provider and model.
-The rule is the whole of it: strip a `hint:` prefix, look the remainder up in the route table, and fall through to the default provider with the name unchanged if there is no entry. A name without the prefix is never rewritten.
+That is the whole rule. The router strips a `hint:` prefix, looks up the rest in the route table, and falls through to the default provider with the name unchanged if there is no entry. A name without the prefix is never rewritten.
-The route table is `[[model_routes]]` in `config.toml`, one entry per hint (`ModelRouteConfig` in [`crates/openhuman-core/src/config/schema/routes.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/config/schema/routes.rs)), with `[[embedding_routes]]` doing the same for embeddings. Resolution and provider construction live in [`crates/openhuman-core/src/inference/`](../../../../../../../crates/openhuman-core/src/inference/) (see its [README](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/inference/README.md)). Hints can be remapped at runtime without restarting the core.
+The route table is `[[model_routes]]` in `config.toml`, with one entry per hint. `[[embedding_routes]]` does the same for embeddings. You can remap hints at runtime without restarting the core.
## Common hints
-| Hint | Typical target | When it's used |
+| Hint | Typical target | When it is used |
| ---------------- | --------------------------------- | ----------------------------------------------------- |
| `hint:reasoning` | A strong reasoning model | Multi-step planning, math, code-heavy turns |
-| `hint:fast` | A fast/cheap model | UI helpers, autocompletes, small classification calls |
+| `hint:fast` | A fast, cheap model | UI helpers, autocomplete, small classification calls |
| `hint:vision` | A vision-capable model | Screenshots, image attachments, OCR |
| `hint:summarize` | A model good at compression | Background summarization |
| `hint:code` | A code-tuned model | Native coder turns |
| `hint:burst` | A high-throughput, low-cost model | Cheap, latency-tolerant work for high-fanout agents |
-The exact mappings are configurable; the defaults ship sensible per-provider routes.
+The mappings are configurable, and the defaults ship with sensible per-provider routes.
## One subscription, or your own
-Routing happens behind a single OpenHuman subscription by default. You don't hold separate API keys for Anthropic, OpenAI, Google etc., the backend brokers access, and the router picks the right one per task. That's the "one subscription, many providers" promise from the README, made concrete.
+By default, routing happens behind a single OpenHuman subscription. You don't hold separate API keys for Anthropic, OpenAI or Google. The backend brokers access and the router picks the right model for each task.
-The subscription is the default, not a requirement. The same router works against **your own provider key** or a **local model on a runtime you run yourself** (Ollama, LM Studio, MLX, or any OpenAI-compatible server), per workload, and you can mix all three. See [Local models & bring your own key](local-and-byok-models.md) for setup and for what each route supports for chat, vision, and embeddings.
+The subscription is a default, not a requirement. The same router works with your own provider key or a local model on a runtime you run yourself (Ollama, LM Studio, MLX, or any OpenAI-compatible server). You choose per workload and can mix all three. See [Local models and bring your own key](local-and-byok-models.md) for setup and for what each route supports for chat, vision and embeddings.
## Overriding routes
-* **Globally**: `[[model_routes]]` in `config.toml` supplies the route table at startup.
-* **Per call**: pass a concrete model name with no `hint:` prefix and the router falls through to the default provider with that exact model.
-* **For a skill**: a skill can pin a hint or a model in its manifest.
-* **Per agent**: an agent definition can pin its own provider and model, which wins over the table.
+- **Globally:** `[[model_routes]]` in `config.toml` sets the route table at startup.
+- **Per call:** pass a concrete model name with no `hint:` prefix. The router falls through to the default provider with that exact model.
+- **For a skill:** a skill can pin a hint or a model in its manifest.
+- **Per agent:** an agent definition can pin its own provider and model, which wins over the table.
## Default model
-Settings → Connections → LLM → Routing has a **Default model** row: a model from the managed catalog that every managed chat turn runs on instead of the anonymous chat tier (it opens on DeepSeek V4 Flash). The composer's model pill can still override it for one conversation, and the specialised tiers (reasoning, coding, vision, summarisation) keep their own routing. The rows beneath it route each workload to Managed, a BYOK provider, a local runtime, or Claude Code.
+**Settings > Connections > LLM > Routing** has a **Default model** row. It sets a model from the managed catalog that every managed chat turn runs on, instead of the anonymous chat tier. It opens on DeepSeek V4 Flash. The model pill in the composer can still override it for one conversation. The specialized tiers (reasoning, coding, vision and summarization) keep their own routing. The rows below it send each workload to Managed, a BYOK provider, a local runtime or Claude Code.
## Per-agent model pins
-Sub-agents can also pin an exact model without disabling automatic routing for the rest of the app. Use this when an orchestrator or team lead needs a stronger model, while high-volume leaf agents should stay on a cheaper one.
+Sub-agents can pin an exact model without turning off automatic routing for the rest of the app. This helps when an orchestrator or team lead needs a stronger model while high-volume leaf agents stay on a cheaper one.
-Inline calls win for one delegation:
+An inline pin wins for a single delegation:
```json
{
@@ -65,7 +65,7 @@ Inline calls win for one delegation:
}
```
-Persistent defaults live in `config.toml`:
+Lasting defaults go in `config.toml`:
```toml
[orchestrator]
@@ -79,23 +79,23 @@ agent_model = "groq/llama-3.1-8b-instant"
agent_model = "openai/gpt-5.1"
```
-Resolution order:
+The router picks the model in this order:
-1. Inline `model` on `spawn_subagent` or an archetype delegation call.
-2. `[orchestrator].model`, or `[teams.<agent_id>]`, or the `_agent`-stripped alias (`[teams.image]` for `image_agent`).
+1. The inline `model` on `spawn_subagent` or an archetype delegation call.
+2. `[orchestrator].model`, or `[teams.<agent_id>]`, or the alias without `_agent` (`[teams.image]` for `image_agent`).
3. The archetype's own model hint and the normal route table.
-For `[teams.*]`, `lead_model` applies to agents that can delegate and `agent_model` applies to leaf workers. If only one is set, the harness falls back to it for both roles.
+For `[teams.*]`, `lead_model` applies to agents that can delegate, and `agent_model` applies to leaf workers. If only one is set, it is used for both roles.
-## Why this isn't just "model switcher"
+## Why this is more than a model switcher
-Routing isn't a UI dropdown. The agent loop itself emits hints based on what it's about to do. You don't pick the model; the _task_ does. That's the difference between "multi-model" and "smart routing".
+Routing is not a dropdown. The agent loop itself picks a hint based on what it is about to do. You don't pick the model, the task does. That is the difference between multi-model and smart routing.
## See also
-* [Smart Token Compression](../token-compression.md). what makes large reasoning calls affordable.
-* [Native Tools](../native-tools/). different tool calls hint at different routes.
-* [Local models & bring your own key](local-and-byok-models.md). run on your own key or fully on-device.
-* [Local AI (optional)](local-ai.md). Add your own local runtime as a provider; lightweight chat hints can run on-device.
-* [Pluggable engines](../../developing/engines.md). How the provider layers are chosen by config.
-* [One TinyHumans API key](../../developing/tinyhumans-api-key.md). The single key behind managed routing.
+- [Token compression](../token-compression.md): what makes large reasoning calls affordable.
+- [Native tools](../native-tools/README.md): different tool calls hint at different routes.
+- [Local models and bring your own key](local-and-byok-models.md): run on your own key or fully on-device.
+- [Local AI](local-ai.md): add your own local runtime as a provider. Lightweight chat hints can run on-device.
+- [Pluggable engines](../../developing/engines.md): how config chooses the provider layers.
+- [One TinyHumans API key](../../developing/tinyhumans-api-key.md): the single key behind managed routing.
diff --git a/docs/gitbooks/en/features/model-routing/local-ai.md b/docs/gitbooks/en/features/model-routing/local-ai.md
index 815b9b8826..c97a810940 100644
--- a/docs/gitbooks/en/features/model-routing/local-ai.md
+++ b/docs/gitbooks/en/features/model-routing/local-ai.md
@@ -1,56 +1,56 @@
---
description: >-
- Use a local model runtime you run yourself (Ollama, LM Studio, MLX, OMLX, or
- any OpenAI-compatible server) as an OpenHuman provider. OpenHuman does not
- install the runtime or download models.
+ Use a model runtime you run yourself (Ollama, LM Studio, MLX, OMLX, or any
+ OpenAI-compatible server) as an OpenHuman provider. OpenHuman does not install
+ the runtime or download models.
icon: microchip
---
# Local AI (optional)
-OpenHuman can send any workload to a model running on your own machine: chat, reasoning, agentic turns, coding, vision, and embeddings. Local AI is **opt-in** and **off** by default.
+OpenHuman can send any workload to a model running on your own machine: chat, reasoning, agentic turns, coding, vision and embeddings. Local AI is opt-in and off by default.
-OpenHuman does not install, start, stop, or update a local runtime, and it does not download model weights. You:
+OpenHuman does not install, start, stop or update a local runtime, and it does not download model weights. You do three things:
-1. install and run the runtime yourself (Ollama, LM Studio, MLX, OMLX, or another OpenAI-compatible server),
-2. pull or load the models you want with that runtime's own tools (for example `ollama pull bge-m3`),
-3. add the runtime's endpoint to OpenHuman as a provider and route workloads to it.
+1. Install and run the runtime yourself (Ollama, LM Studio, MLX, OMLX, or another OpenAI-compatible server).
+2. Pull or load the models you want with that runtime's own tools, for example `ollama pull bge-m3`.
+3. Add the runtime's endpoint to OpenHuman as a provider and route workloads to it.
-If a workload names a model the runtime does not have, the request fails with the runtime's error. Pull the model and retry; OpenHuman will not fetch it for you.
+If a workload names a model the runtime does not have, the request fails with the runtime's error. Pull the model and retry. OpenHuman will not fetch it for you.
## Supported runtimes
-Every local runtime is reached over its OpenAI-compatible HTTP API. The provider string prefix decides which runtime a workload uses (`crates/openhuman-core/src/inference/provider/factory/local_runtime.rs`):
+OpenHuman reaches every local runtime over its OpenAI-compatible HTTP API. The prefix of the provider string decides which runtime a workload uses.
-| Runtime | Provider string | Default endpoint | Endpoint overrides (highest first) |
-| -------------------------------- | ---------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------ |
-| [Ollama](https://ollama.com) | `ollama:<model>` | `http://127.0.0.1:11434` | `local_ai.base_url`, then `OPENHUMAN_OLLAMA_BASE_URL`, then `OLLAMA_HOST`. OpenHuman appends `/v1` for chat. |
-| [LM Studio](https://lmstudio.ai) | `lmstudio:<model>` | `http://localhost:1234/v1` | `OPENHUMAN_LM_STUDIO_BASE_URL`, then `LM_STUDIO_BASE_URL`, then `local_ai.base_url` |
-| MLX (`mlx_lm.server`) | `mlx:<model>` | `http://127.0.0.1:8080/v1` | `OPENHUMAN_LOCAL_INFERENCE_URL`, then `MLX_SERVER_URL`, then `local_ai.base_url` |
-| OMLX | `omlx:<model>` | `http://127.0.0.1:8000/v1` | `OPENHUMAN_LOCAL_INFERENCE_URL`, then `OMLX_SERVER_URL`, then `local_ai.base_url` |
-| Any OpenAI-compatible server | `local-openai:<model>` | `http://127.0.0.1:8080/v1` | `OPENHUMAN_LOCAL_INFERENCE_URL`, then `LOCAL_OPENAI_URL`, then `local_ai.base_url` |
+| Runtime | Provider string | Default endpoint | Endpoint overrides (highest first) |
+| -------------------------------- | ---------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------- |
+| [Ollama](https://ollama.com) | `ollama:<model>` | `http://127.0.0.1:11434` | `local_ai.base_url`, then `OPENHUMAN_OLLAMA_BASE_URL`, then `OLLAMA_HOST`. OpenHuman appends `/v1` for chat. |
+| [LM Studio](https://lmstudio.ai) | `lmstudio:<model>` | `http://localhost:1234/v1` | `OPENHUMAN_LM_STUDIO_BASE_URL`, then `LM_STUDIO_BASE_URL`, then `local_ai.base_url` |
+| MLX (`mlx_lm.server`) | `mlx:<model>` | `http://127.0.0.1:8080/v1` | `OPENHUMAN_LOCAL_INFERENCE_URL`, then `MLX_SERVER_URL`, then `local_ai.base_url` |
+| OMLX | `omlx:<model>` | `http://127.0.0.1:8000/v1` | `OPENHUMAN_LOCAL_INFERENCE_URL`, then `OMLX_SERVER_URL`, then `local_ai.base_url` |
+| Any OpenAI-compatible server | `local-openai:<model>` | `http://127.0.0.1:8080/v1` | `OPENHUMAN_LOCAL_INFERENCE_URL`, then `LOCAL_OPENAI_URL`, then `local_ai.base_url` |
-LM Studio, OMLX, and `local-openai` send `local_ai.api_key` as a Bearer token when one is set; Ollama and MLX send no auth. Local runtimes do not need an OpenHuman account.
+LM Studio, OMLX and `local-openai` send `local_ai.api_key` as a Bearer token when one is set. Ollama and MLX send no auth. Local runtimes do not need an OpenHuman account.
-The model part of the provider string is passed to the runtime unchanged, so it must match the runtime's own model id (for Ollama, the name you pulled, including the tag). An optional `@<temperature>` suffix pins a temperature, for example `ollama:qwen2.5:[email protected]`.
+The model part of the provider string goes to the runtime unchanged, so it must match the runtime's own model id. For Ollama, that is the name you pulled, including the tag. An optional `@<temperature>` suffix pins a temperature, for example `ollama:qwen2.5:[email protected]`.
## Multiple self-hosted servers
-If you run several OpenAI-compatible model servers, a gateway can expose one endpoint and use named model IDs to select the upstream. See [Use multiple local LLM servers](../../guides/guides/multiple-local-llm-servers.md) for an optional community Model Router example with a Mac mini and Linux GPU PC. OpenHuman does not bundle or supervise the gateway.
+If you run several OpenAI-compatible model servers, a gateway can expose one endpoint and use named model ids to pick the upstream server. See [Use multiple local LLM servers](../../guides/multiple-local-llm-servers.md) for an optional community example with a Mac mini and a Linux GPU PC. OpenHuman does not bundle or supervise the gateway.
## Adding a local runtime in the app
1. Start the runtime and make sure its server is listening. For Ollama, `curl http://localhost:11434/api/tags` should return JSON.
-2. Pull or load the models you plan to use (see [Use OpenHuman with a local model](../../guides/guides/local-model.md)).
-3. Open **Connections → LLM**, choose **Add a provider**, and pick the runtime under **Local runtimes** (Ollama, LM Studio, OMLX). For MLX or another server, use **Add a custom provider** with its OpenAI-compatible endpoint.
+2. Pull or load the models you plan to use (see [Use OpenHuman with a local model](../../guides/local-model.md)).
+3. Open **Connections > LLM**, choose **Add a provider**, and pick the runtime under **Local runtimes** (Ollama, LM Studio, OMLX). For MLX or another server, use **Add a custom provider** with its OpenAI-compatible endpoint.
4. Confirm or edit the endpoint. On save, OpenHuman writes `local_ai.base_url` and `local_ai.provider`, turns on `local_ai.runtime_enabled`, and lists the endpoint's models. If the runtime is not reachable, the provider is not saved.
5. Route workloads to it with **Custom routing**, choosing from the models the runtime reports.
-The model list comes from the runtime. A model you have not pulled does not appear; pull it in the runtime and reopen the picker.
+The model list comes from the runtime. A model you have not pulled does not appear. Pull it in the runtime and reopen the picker.
## Configuration
-The same setup by hand, in `config.toml`:
+Here is the same setup by hand in `config.toml`:
```toml
[local_ai]
@@ -62,7 +62,7 @@ embedding_model_id = "bge-m3"
vision_model_id = "gemma3:4b-it-qat" # leave empty for no local vision
```
-Workload routing lives at the top level of `config.toml`; each field takes a provider string:
+Workload routing sits at the top level of `config.toml`. Each field takes a provider string:
```toml
chat_provider = "ollama:gemma3:4b-it-qat"
@@ -70,67 +70,67 @@ reasoning_provider = "ollama:qwen2.5:14b"
embeddings_provider = "ollama:bge-m3"
```
-The workload fields are `chat_provider`, `reasoning_provider`, `agentic_provider`, `coding_provider`, `vision_provider`, `memory_provider` and `embeddings_provider`. A field that is unset, blank, or `cloud` stays on the default route. For the background workloads, `Config::workload_local_model(...)` in `crates/openhuman-core/src/config/schema/types/resolvers.rs` treats a workload as local only when its field is `ollama:<model>`.
+The workload fields are `chat_provider`, `reasoning_provider`, `agentic_provider`, `coding_provider`, `vision_provider`, `memory_provider` and `embeddings_provider`. A field that is unset, blank or `cloud` stays on the default route. For background workloads, a workload counts as local only when its field is `ollama:<model>`.
-The legacy `local_ai.usage.*` booleans are kept only so older configs migrate. They do not override the workload fields.
+The older `local_ai.usage.*` booleans remain only so older configs migrate. They do not override the workload fields.
## What the local runtime is used for
-| Workload | Configured by | Notes |
-| ------------------------------------ | --------------------------------------------- | ----------------------------------------------------------------------------- |
-| **Chat, reasoning, coding, agentic** | `chat_provider`, `reasoning_provider`, ... | Any local prefix from the table above. |
-| **Vision** | `vision_provider`, `local_ai.vision_model_id` | Must be a vision-capable model. See [Local vision](local-ai.md#local-vision). |
+| Workload | Configured by | Notes |
+| -------------------------------- | --------------------------------------------- | ------------------------------------------------------------------ |
+| Chat, reasoning, coding, agentic | `chat_provider`, `reasoning_provider`, ... | Any local prefix from the table above. |
+| Vision | `vision_provider`, `local_ai.vision_model_id` | Must be a vision-capable model. See [Local vision](#local-vision). |
-For lightweight chat hints (`hint:reaction`, `hint:classify`, `hint:format`, `hint:sentiment`, `hint:summarize`, `hint:medium`, `hint:tool_lite`), the [router](./) prefers the local provider when `local_ai.runtime_enabled = true` and it is reachable. Heavy hints (`hint:reasoning`, `hint:agentic`, `hint:coding`) stay on the default route unless the matching workload field points at a local provider.
+For lightweight chat hints (`hint:reaction`, `hint:classify`, `hint:format`, `hint:sentiment`, `hint:summarize`, `hint:medium`, `hint:tool_lite`), the [router](README.md) prefers the local provider when `local_ai.runtime_enabled = true` and the runtime is reachable. Heavy hints (`hint:reasoning`, `hint:agentic`, `hint:coding`) stay on the default route unless the matching workload field points at a local provider.
## What stays in the cloud by default
-| Workload | Why |
-| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
-| **STT** | Backend-proxied transcription (`crates/openhuman-core/src/voice/cloud_transcribe.rs`) or a third-party key. There is no local STT engine. |
-| **TTS** | Hosted [text-to-speech](../native-tools/voice.md) by default. Local Piper works if you install it yourself and set `PIPER_BIN`. |
-| **Web search** | Backend proxy, or your own search provider key. |
+| Workload | Why |
+| ---------- | -------------------------------------------------------------------------------------------------------------------- |
+| STT | Transcription goes through the backend or a third-party key. There is no local speech-to-text engine. |
+| TTS | [Text-to-speech](../native-tools/voice.md) is hosted by default. Local Piper works if you install it and set `PIPER_BIN`. |
+| Web search | Backend proxy, or your own search provider key. |
Any workload you have not pointed at a local provider keeps using the default route.
### Local text-to-speech with Piper
-Setting `local_ai.tts_provider = "piper"` runs [Piper](https://github.com/rhasspy/piper) for spoken replies. OpenHuman does not ship or install Piper or its voices: install the Piper binary and a voice model yourself and point the `PIPER_BIN` environment variable at the binary.
+Setting `local_ai.tts_provider = "piper"` runs [Piper](https://github.com/rhasspy/piper) for spoken replies. OpenHuman does not ship or install Piper or its voices. Install the Piper binary and a voice model yourself, and point the `PIPER_BIN` environment variable at the binary.
## Privacy
-[Privacy Mode](../privacy-and-security/privacy-mode.md) set to `local_only` refuses every non-local chat provider at construction time and permits only the local prefixes above. It does not start a runtime or fetch models: with privacy mode on and no reachable local runtime, workloads fail rather than fall back to the cloud.
+[Privacy mode](../privacy-mode.md) set to `local_only` refuses every non-local chat provider and permits only the local prefixes above. It does not start a runtime or fetch models. With privacy mode on and no reachable local runtime, workloads fail instead of falling back to the cloud.
-Without privacy mode, lightweight hints routed to a local provider that turns out to be unreachable fall back to the remote provider. Use privacy mode if strict locality matters.
+Without privacy mode, a lightweight hint routed to an unreachable local provider falls back to the remote provider. Use privacy mode if strict locality matters.
-The backend URL guard in `crates/openhuman-tinyhumans/src/backend/url.rs` keeps the two kinds of endpoint apart. If `api_url` is set to something that looks like a local model server (a loopback or private host on a common runner port such as 11434, 1234, 8000, or 8080, or a `/v1/chat/completions` path), backend requests ignore it and go to the hosted API. Configure local endpoints through a provider or `local_ai.base_url`, not `api_url`.
+OpenHuman also keeps local and hosted endpoints apart. If `api_url` looks like a local model server (a loopback or private host on a common runner port such as 11434, 1234, 8000 or 8080, or a `/v1/chat/completions` path), backend requests ignore it and go to the hosted API. Set local endpoints through a provider or `local_ai.base_url`, not `api_url`.
## Local vision
-Vision is a separate capability from chat, and most small local models cannot do it. Ollama does not reject an image sent to a text-only model: it drops the image and answers from the prompt text, which produces a description of something the model never saw. OpenHuman resolves the vision model through a capability check and refuses to route a vision request at a known chat-only model.
+Vision is separate from chat, and most small local models cannot do it. Ollama does not reject an image sent to a text-only model. It drops the image and answers from the prompt text, so you get a description of something the model never saw. OpenHuman checks the vision model's capabilities and refuses to route a vision request to a known chat-only model.
-* `vision_provider` and `local_ai.vision_model_id` must name a vision-capable model, and you must have pulled it. `moondream:1.8b-v2-q4_K_S` (about 1.7 GB) is a small option; `gemma3:4b-it-qat` handles chat and vision with one set of weights.
-* Gemma 3 is text-only at 270M and 1B and multimodal from 4B up. Gemma 3n is a different model and is text-only at every size.
-* Leaving `vision_model_id` empty is a valid "no local vision" setup.
-* Attaching an image to a chat turn also needs the model's **vision** flag in the model registry. See [Local models & bring your own key](local-and-byok-models.md#attaching-images-in-chat-needs-one-more-flag).
+- `vision_provider` and `local_ai.vision_model_id` must name a vision-capable model that you have pulled. `moondream:1.8b-v2-q4_K_S` (about 1.7 GB) is a small option. `gemma3:4b-it-qat` handles chat and vision with one set of weights.
+- Gemma 3 is text-only at 270M and 1B, and multimodal from 4B up. Gemma 3n is a different model and is text-only at every size.
+- Leaving `vision_model_id` empty is a valid "no local vision" setup.
+- To attach an image to a chat turn, the model also needs its vision flag set in the model registry. See [Local models and bring your own key](local-and-byok-models.md#attaching-images-in-chat-needs-one-more-flag).
## What you need
-* The runtime installed and running. OpenHuman does not manage it.
-* The models pulled or loaded in that runtime.
-* Enough disk and RAM for the models you chose. As a rough guide, `bge-m3` is about 1.2 GB on disk and a 4B chat model about 4 GB; plan for 8 GB+ RAM, 16 GB+ for larger models.
+- The runtime installed and running. OpenHuman does not manage it.
+- The models pulled or loaded in that runtime.
+- Enough disk and RAM for the models you chose. As a rough guide, `bge-m3` is about 1.2 GB on disk and a 4B chat model about 4 GB. Plan for 8 GB or more of RAM, and 16 GB or more for larger models.
-### Troubleshooting
+## Troubleshooting
-* **Provider will not save, or the model list is empty.** The runtime is not reachable at the endpoint. Start it and check the port. For Ollama, run `curl http://localhost:11434/api/tags`.
-* **The runtime reports the model is missing.** The model is not pulled or loaded. Run `ollama pull <model>`, or load it in LM Studio, then retry.
-* **LM Studio on a different port.** Set `local_ai.base_url` or `OPENHUMAN_LM_STUDIO_BASE_URL`. Load the model in LM Studio before OpenHuman calls it.
-* **Ollama context too small for agent turns.** Set `local_ai.num_ctx` to send `options.num_ctx` with each Ollama chat request.
+- **The provider will not save, or the model list is empty.** The runtime is not reachable at the endpoint. Start it and check the port. For Ollama, run `curl http://localhost:11434/api/tags`.
+- **The runtime says the model is missing.** The model is not pulled or loaded. Run `ollama pull <model>`, or load it in LM Studio, then retry.
+- **LM Studio runs on a different port.** Set `local_ai.base_url` or `OPENHUMAN_LM_STUDIO_BASE_URL`. Load the model in LM Studio before OpenHuman calls it.
+- **Ollama's context is too small for agent turns.** Set `local_ai.num_ctx` to send `options.num_ctx` with each Ollama chat request.
## See also
-* [Use OpenHuman with a local model](../../guides/guides/local-model.md). Step-by-step setup.
-* [Local models & bring your own key](local-and-byok-models.md). Per-model capability table and BYOK setup.
-* [Memory](../memory.md). Memory is stored by its engine, not by a local model.
-* [Automatic Model Routing](./). How lightweight chat hints prefer the local provider.
-* [Privacy Mode](../privacy-and-security/privacy-mode.md). Enforcing local-only inference.
+- [Use OpenHuman with a local model](../../guides/local-model.md): step-by-step setup.
+- [Local models and bring your own key](local-and-byok-models.md): per-model capability table and BYOK setup.
+- [Memory](../memory.md): memory is stored by its engine, not by a local model.
+- [Model routing](README.md): how lightweight chat hints prefer the local provider.
+- [Privacy mode](../privacy-mode.md): enforcing local-only inference.
diff --git a/docs/gitbooks/en/features/model-routing/local-and-byok-models.md b/docs/gitbooks/en/features/model-routing/local-and-byok-models.md
index d45bfb4c47..8e76ec15d4 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
@@ -1,22 +1,22 @@
---
description: >-
Three ways to power OpenHuman: the managed subscription, your own provider key
- (BYOK), or fully local models on a runtime you run yourself. What each one
- supports for chat, vision, and embeddings, and
+ (BYOK), or local models on a runtime you run yourself. What each one supports
+ for chat, vision and embeddings, and how to set it up.
icon: sliders
---
-# Local models & bring your own key
+# Local models and bring your own key
-The OpenHuman subscription is the **default**, not a requirement. Inference can come from any of three places, and you can mix them per workload: run embeddings locally, chat on your own Anthropic key, and leave vision on the managed route, all at once.
+The OpenHuman subscription is the default, not a requirement. Inference can come from any of three places, and you can mix them for each workload. For example, you can run embeddings locally, chat on your own Anthropic key, and leave vision on the managed route.
-This page covers how to set up the two self-owned options and, importantly, **what each one can actually do**. Not every local model can see images, and picking a chat-only model for vision work is the single most common way to end up with a setup that looks configured but quietly does the wrong thing.
+This page covers how to set up the two self-owned options and what each one can actually do. Not every local model can see images. Picking a chat-only model for vision work is the most common way to end up with a setup that looks configured but quietly does the wrong thing.
## The three routes at a glance
-| | **Managed (default)** | **BYOK cloud** | **Local (runtime you run)** |
+| | Managed (default) | BYOK cloud | Local (runtime you run) |
| -------------------------------------- | ----------------------------- | ------------------------------------------- | ----------------------------------------- |
-| **Chat & reasoning** | Included | Your key, your billing | Yes, quality scales with model size |
+| **Chat and reasoning** | Included | Your key, your billing | Yes, quality scales with model size |
| **Vision** | Included | Your key, if the model supports images | Yes, but only with a vision-capable model |
| **Embeddings** | Included | Your key, if the provider serves embeddings | Yes, `bge-m3` recommended |
| **Speech to text** | Included | Your own key, via a voice provider slug | No local STT engine |
@@ -25,14 +25,14 @@ This page covers how to set up the two self-owned options and, importantly, **wh
| **Inference data leaves your machine** | Yes, to the OpenHuman backend | Yes, to your chosen provider | No |
| **API keys to manage** | None | One per provider | None |
-Speech is configured separately from the LLM workload fields, and the two halves are easy to confuse. `voice_providers` holds the third-party provider **definitions** (slug, endpoint, key, default model or voice); editing one does not change which provider is actually used. The **active route** is picked separately:
+Speech is configured separately from the LLM workload fields, and the two halves are easy to confuse. `voice_providers` holds the third-party provider definitions (slug, endpoint, key, default model or voice). Editing one does not change which provider is used. The active route is set separately:
-* STT reads `stt_provider`, falling back to the legacy `local_ai.stt_provider`, and finally to `voice_server.stt_engine` when neither names a provider.
-* TTS reads `tts_provider`, falling back to the legacy `local_ai.tts_provider`, and finally to `cloud`.
+- STT reads `stt_provider`, then the older `local_ai.stt_provider`, then `voice_server.stt_engine` when neither names a provider.
+- TTS reads `tts_provider`, then the older `local_ai.tts_provider`, then `cloud`.
-There is no local STT engine: speech-to-text is either the hosted proxy or a third-party API you supply a key for, while TTS keeps a local option in Piper. OpenHuman does not install Piper: install the binary and a voice yourself, set `PIPER_BIN`, and set `tts_provider = "piper"`.
+There is no local STT engine. Speech-to-text is either the hosted proxy or a third-party API with your own key. TTS has a local option in Piper. OpenHuman does not install Piper. Install the binary and a voice yourself, set `PIPER_BIN`, and set `tts_provider = "piper"`.
-That last row is deliberately about **inference data only**. Sign-in, managed integration OAuth, billing, and hosted features such as media generation and managed web search still use the OpenHuman backend even when inference is entirely yours, so running local models is not by itself a guarantee that nothing leaves the machine. If you want a hard guarantee that no inference leaves the machine, use [Privacy Mode](../privacy-and-security/privacy-mode.md), which enforces the local-only path in the Rust core rather than relying on configuration alone.
+The last row of the table is about inference data only. Sign-in, managed integration OAuth, billing, and hosted features such as media generation and managed web search still use the OpenHuman backend even when inference is entirely yours. Running local models is not by itself a guarantee that nothing leaves the machine. If you need that guarantee, use [Privacy mode](../privacy-mode.md), which enforces the local-only path in the Rust core instead of relying on configuration alone.
## Route A: local models
@@ -40,7 +40,7 @@ OpenHuman does not install a runtime or download model weights. You run the runt
### 1. Install Ollama and pull a model
-Install [Ollama](https://ollama.com), then pull what you need. Every model named on this page is pullable from the public Ollama library:
+Install [Ollama](https://ollama.com), then pull what you need. Every model named on this page is in the public Ollama library.
```bash
ollama pull gemma3:1b-it-qat # small chat model
@@ -50,32 +50,32 @@ ollama pull moondream:1.8b-v2-q4_K_S # vision, small
### 2. Know what each model supports
-This is the part that bites people. A model that only does text will still **accept** an image request on Ollama: it silently drops the image and answers from the prompt text alone, which reads as a confident but entirely invented description. OpenHuman guards against this by refusing to route a vision request at a chat-only model, but it is worth knowing which is which.
+A text-only model on Ollama still accepts an image request. It silently drops the image and answers from the prompt text alone, which reads as a confident but invented description. OpenHuman refuses to route a vision request to a chat-only model, but it helps to know which is which.
-| Model | Size | Chat | Vision | Embeddings |
-| -------------------------- | ------- | ------- | ------- | ----------------- |
-| `gemma3:270m-it-qat` | 0.2 GB | Yes | No | No |
-| `gemma3:1b-it-qat` | 1.0 GB | Yes | No | No |
-| `gemma3:4b-it-qat` | 4.0 GB | Yes | **Yes** | No |
-| `gemma3n:e4b-it-q8_0` | 9.5 GB | Yes | No | No |
-| `gemma4:e4b-it-q8_0` | 11.6 GB | Yes | **Yes** | No |
-| `moondream:1.8b-v2-q4_K_S` | 1.7 GB | Minimal | **Yes** | No |
-| `llava:7b` | 4.7 GB | Minimal | **Yes** | No |
-| `bge-m3` | 1.2 GB | No | No | **Yes**, 1024 dim |
-| `all-minilm:latest` | 0.05 GB | No | No | 384 dim |
+| Model | Size | Chat | Vision | Embeddings |
+| -------------------------- | -------- | ------- | ------- | ---------------------------------- |
+| `gemma3:270m-it-qat` | 0.2 GB | Yes | No | No |
+| `gemma3:1b-it-qat` | 1.0 GB | Yes | No | No |
+| `gemma3:4b-it-qat` | 4.0 GB | Yes | Yes | No |
+| `gemma3n:e4b-it-q8_0` | 9.5 GB | Yes | No | No |
+| `gemma4:e4b-it-q8_0` | 11.6 GB | Yes | Yes | No |
+| `moondream:1.8b-v2-q4_K_S` | 1.7 GB | Minimal | Yes | No |
+| `llava:7b` | 4.7 GB | Minimal | Yes | No |
+| `bge-m3` | 1.2 GB | No | No | Yes, 1024 dimensions |
+| `all-minilm:latest` | 0.05 GB | No | No | 384 dimensions |
-Two traps worth calling out:
+Two traps:
-* **Gemma 3 is split by size.** The 270M and 1B builds are text-only. Vision starts at 4B. Picking `gemma3:1b-it-qat` for vision gets you a text-only model.
-* **`gemma3n` is not `gemma3`.** Despite the name, Gemma 3n is a separate, text-only model on Ollama. It is a fine chat model and a bad vision model.
+- Gemma 3 is split by size. The 270M and 1B builds are text-only. Vision starts at 4B. If you pick `gemma3:1b-it-qat` for vision, you get a text-only model.
+- `gemma3n` is not `gemma3`. Despite the name, Gemma 3n is a separate, text-only model on Ollama. It is a fine chat model and a bad vision model.
-For embeddings, prefer **`bge-m3`** (1024 dimensions). Note what that does and does not cover. An `embeddings_provider` of `ollama:bge-m3` routes OpenHuman's own embedding calls to your machine. It does not move memory: the engine embeds on its own side, so recall still runs wherever the engine runs. Those are three separate decisions, and no one switch covers all of them: this field routes OpenHuman's embeddings, [Privacy Mode](../privacy-and-security/privacy-mode.md) enforces where _inference_ may go, and the memory engine you choose decides where memory lives.
+For embeddings, prefer `bge-m3` (1024 dimensions). An `embeddings_provider` of `ollama:bge-m3` routes OpenHuman's own embedding calls to your machine. It does not move memory, because the memory engine embeds on its own side, so recall still runs wherever the engine runs. Three separate settings are involved. This field routes OpenHuman's embeddings. [Privacy mode](../privacy-mode.md) enforces where inference may go. The memory engine you choose decides where memory lives.
### 3. Point OpenHuman at it
-In the desktop app, open **Connections → LLM → Add a provider** and pick Ollama (or LM Studio / OMLX) under **Local runtimes**, or add a custom OpenAI-compatible endpoint. OpenHuman saves the endpoint, enables the local runtime, and lists the models the runtime reports. Models you have not pulled do not appear. See [Local AI (optional)](local-ai.md#adding-a-local-runtime-in-the-app).
+In the desktop app, open **Connections > LLM > Add a provider** and pick Ollama (or LM Studio or OMLX) under **Local runtimes**, or add a custom OpenAI-compatible endpoint. OpenHuman saves the endpoint, turns on the local runtime, and lists the models the runtime reports. Models you have not pulled do not appear. See [Local AI](local-ai.md#adding-a-local-runtime-in-the-app).
-To configure by hand, the keys live under `[local_ai]` in `config.toml`:
+To configure by hand, use the `[local_ai]` section of `config.toml`:
```toml
[local_ai]
@@ -87,11 +87,11 @@ vision_model_id = "gemma3:4b-it-qat" # must be vision-capable
embedding_model_id = "bge-m3"
```
-Every model you name here must already be pulled. Leaving `vision_model_id` empty means "no local vision", which is a valid setup.
+Every model you name must already be pulled. Leaving `vision_model_id` empty means "no local vision", which is a valid setup.
### 4. Route workloads to it
-Adding a local provider does not move everything on-device. You choose per workload with a provider string such as `ollama:<model>` (or `lmstudio:`, `mlx:`, `omlx:`, `local-openai:`):
+Adding a local provider does not move everything on-device. You choose for each workload with a provider string such as `ollama:<model>` (or `lmstudio:`, `mlx:`, `omlx:`, `local-openai:`):
```toml
chat_provider = "ollama:gemma3:4b-it-qat"
@@ -99,13 +99,13 @@ vision_provider = "ollama:gemma3:4b-it-qat"
embeddings_provider = "ollama:bge-m3"
```
-The full set of workload fields is `chat_provider`, `reasoning_provider`, `agentic_provider`, `coding_provider`, `vision_provider`, `memory_provider`, `embeddings_provider`, and `learning_provider`. Any field left unset, blank, or set to `cloud` stays on the default route.
+The workload fields are `chat_provider`, `reasoning_provider`, `agentic_provider`, `coding_provider`, `vision_provider`, `memory_provider`, `embeddings_provider` and `learning_provider`. A field that is unset, blank or `cloud` stays on the default route.
#### Attaching images in chat needs one more flag
-`vision_provider` routes the **vision workload**: image summaries and the OCR/description path. It does not by itself let you attach an image to a chat or agent turn.
+`vision_provider` routes the vision workload: image summaries and the OCR and description path. It does not by itself let you attach an image to a chat or agent turn.
-A turn only rehydrates image attachments when the resolved chat model is known to accept them, and for a local model that knowledge comes from the per-model registry, not from `vision_provider`. Set the model's **vision** flag in Settings → AI (the custom-model dialog), which records it in `model_registry`:
+A turn passes image attachments through only when the chat model is known to accept them. For a local model, that knowledge comes from the per-model registry, not from `vision_provider`. Set the model's vision flag in **Settings > AI** (the custom-model dialog), which records it in `model_registry`:
```toml
[[model_registry]]
@@ -114,27 +114,27 @@ provider = "ollama"
vision = true
```
-Without that flag the images are stripped before dispatch and the model answers from the text alone, fluently, and with no indication that it never saw the picture.
+Without that flag, images are stripped before the request is sent. The model answers from the text alone, fluently, with no sign that it never saw the picture.
-See [Local AI (optional)](local-ai.md) for endpoint overrides, the other runtimes, and troubleshooting.
+See [Local AI](local-ai.md) for endpoint overrides, the other runtimes and troubleshooting.
## Route B: bring your own key
-BYOK keeps the routing, memory, tools, and agent harness exactly as they are, and swaps out who serves the tokens. Your key, your account, your billing, no OpenHuman inference charges.
+BYOK keeps the routing, memory, tools and agent harness exactly as they are, and changes only who serves the tokens. It is your key, your account and your billing, with no OpenHuman inference charges.
### 1. Add the provider
-Add your key in the desktop app under the LLM settings, which stores it in the OS keyring rather than in plain config. OpenHuman ships presets for these slugs, so you do not need to supply an endpoint:
+Add your key in the desktop app under the LLM settings. It is stored in the OS keyring, not in plain config. OpenHuman ships presets for these slugs, so you don't need to supply an endpoint:
`openai`, `anthropic`, `google`, `openrouter`, `orcarouter`, `groq`, `mistral`, `deepseek`, `together`, `fireworks`, `cerebras`, `xai`, `moonshot`, `gmi`, `huggingface`, `nvidia`, `zai`, `minimax`, `stepfun`, `kilocode`, `deepinfra`, `novita`, `venice`, `vercel-ai-gateway`, `sumopod`, `modelscope`
-Anything else that speaks the OpenAI-compatible API works too: register it with your own slug and endpoint, and it routes the same way.
+Anything else that speaks the OpenAI-compatible API also works. Register it with your own slug and endpoint, and it routes the same way.
-On a headless core (`openhuman-core serve`) custom cloud providers are only built when a backend session or TinyHumans API key is present. If you run the core with no account, wire the endpoint as the `local-openai` runtime instead (`LOCAL_OPENAI_URL`, key in `local_ai.api_key`, workloads pinned to `local-openai:<model>`); see [Headless without a TinyHumans account](../cloud-deploy.md#headless-without-a-tinyhumans-account).
+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 it
-Provider strings follow `<slug>:<model>`, using the same workload fields as the local route:
+Provider strings follow `<slug>:<model>` and use the same workload fields as the local route:
```toml
chat_provider = "anthropic:claude-sonnet-4"
@@ -143,15 +143,15 @@ coding_provider = "deepseek:deepseek-coder"
vision_provider = "openai:gpt-5.1"
```
-To make one provider the default for everything that is not pinned, set `primary_cloud` to its slug. Every workload left on `cloud` then resolves to that provider instead of the OpenHuman backend.
+To make one provider the default for everything that is not pinned, set `primary_cloud` to its slug. Every workload left on `cloud` then goes to that provider and not to the OpenHuman backend.
-### 3. Check the model supports the workload
+### 3. Check that the model supports the workload
-BYOK inherits your provider's capabilities, not OpenHuman's. Before pinning `vision_provider`, confirm the model you named accepts image input, and before pinning `embeddings_provider`, confirm the provider serves an embeddings endpoint. Not every chat provider does.
+BYOK gets your provider's capabilities, not OpenHuman's. Before you pin `vision_provider`, confirm the model accepts image input. Before you pin `embeddings_provider`, confirm the provider serves an embeddings endpoint. Not every chat provider does.
## Mixing routes
-The workload fields are independent, so a common privacy-conscious setup keeps recurring background work on-device and reserves a strong cloud model for the turns that need it:
+The workload fields are independent. A common privacy-minded setup keeps recurring background work on-device and saves a strong cloud model for the turns that need it:
```toml
# On-device: everything that runs constantly over personal data
@@ -168,11 +168,11 @@ reasoning_provider = "anthropic:claude-sonnet-4"
**The model you want is not offered, or a request says the model is missing.** The runtime does not have it. Run `ollama pull <model>` (or load it in LM Studio), then retry. OpenHuman does not pull models.
-**Vision answers look plausible but describe the wrong image.** You are almost certainly on a chat-only model. Check `vision_model_id` against the capability table above. Current builds refuse this routing and fall back to a vision-capable model, so this points at an older build or a provider outside the local path.
+**Vision answers look plausible but describe the wrong image.** You are almost certainly on a chat-only model. Check `vision_model_id` against the capability table above. Current builds refuse this routing and fall back to a vision-capable model, so this points to an older build or a provider outside the local path.
## See also
-* [Local AI (optional)](local-ai.md). Supported runtimes, endpoints, and the opt-in flags.
-* [Automatic Model Routing](./). How hints pick a model per task.
-* [Privacy Mode](../privacy-and-security/privacy-mode.md). Enforcing local-only inference in the core.
-* [Privacy & Security](../privacy-and-security/). What moves on-device when you opt in.
+- [Local AI](local-ai.md): supported runtimes, endpoints and the opt-in flags.
+- [Model routing](README.md): how hints pick a model for each task.
+- [Privacy mode](../privacy-mode.md): enforcing local-only inference in the core.
+- [Privacy and security](../privacy-and-security.md): what moves on-device when you opt in.
diff --git a/docs/gitbooks/en/features/native-tools/README.md b/docs/gitbooks/en/features/native-tools/README.md
index 51a2c1172d..d9e25bdeba 100644
--- a/docs/gitbooks/en/features/native-tools/README.md
+++ b/docs/gitbooks/en/features/native-tools/README.md
@@ -1,46 +1,46 @@
---
description: >-
- The full toolset OpenHuman's agent has out of the box - research, code,
- control your machine, schedule jobs, talk back to you, and call into your
- connected services.
+ The toolset OpenHuman's agent has out of the box: research, code, control
+ your machine, schedule jobs, talk back to you, and call your connected
+ services.
icon: toolbox
---
-# Native Tools
+# Native tools
-OpenHuman's agent doesn't ship empty. Every model behind the agent has a curated set of tools available the moment you install - no plugin marketplace, no API keys to wire up, no MCP servers to register. The whole toolbelt is in the box.
+The agent comes with a full set of tools the moment you install it. There is no plugin marketplace, no API keys to wire up and no MCP servers to register.
This page is the index. Each subpage covers one family of tools.
-## Why ship them natively
+## Why built in
-A plugin-only model means tools live in different processes, behind RPC, with their own auth and packaging stories. That's fine for open-ended extensibility, but for the **core** tools every agent needs (read a file, search the web, edit code, set a reminder, drive a browser), shipping them in-process means:
+A plugin-only model puts tools in separate processes, behind RPC, each with its own auth and packaging. That suits open-ended extensions. For the core tools every agent needs (read a file, search the web, edit code, set a reminder, drive a browser), running in-process gives you:
-* Consistent error handling.
-* Zero install friction.
-* All output passes through [Smart Token Compression](../token-compression.md) for free.
-* Predictable security boundary - filesystem tools respect workspace scoping, and network tools use the managed OpenHuman proxy by default unless you opt into a self-hosted path such as SearXNG.
+- Consistent error handling.
+- Nothing to install.
+- Output that passes through [token compression](../token-compression.md) for free.
+- A predictable security boundary. File tools respect workspace scoping. Network tools use the managed OpenHuman proxy by default unless you opt into a self-hosted path such as SearXNG.
## The toolbelt
-| Family | What it covers |
-| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Web Search](web-search.md) | Search the live web via the managed proxy (powered by Exa), backend-proxied Parallel, your own Exa/Brave/Querit/Tavily key, or self-hosted SearXNG. |
-| [Web Scraper](web-scraper.md) | Pull clean text out of any URL - articles, docs, READMEs. |
-| [Coder](coder.md) | Read/write/edit/patch files, glob, grep, git, lint, test. |
-| [Documents](documents.md) | Write `.docx` and `.pptx`, and read PDF, Word, PowerPoint and Excel back in. |
-| [Browser & Computer Control](browser-and-computer.md) | Open URLs, inspect DOM snapshots, click, type, move the mouse. |
-| [Cron & Scheduling](cron.md) | Recurring jobs, one-off reminders, scheduled agent runs. |
-| [Voice](voice.md) | Speech-to-text in, text-to-speech out, and a live voice agent you can interrupt. |
-| [Memory Tools](memory-tools.md) | Recall, fetch, learn and forget through the single `memory` tool, over [memory](../memory.md). |
-| [Third-party Integrations](../integrations/) | The agent's view of the [connected services](../integrations/). |
-| [Agent Coordination](agent-coordination.md) | Spawn subagents, delegate to skills, plan, ask the user. |
-| [System & Utilities](system-and-utilities.md) | Shell, node, SQL, current time, push notifications, LSP. |
+| Family | What it covers |
+| --- | --- |
+| [Web search](web-search.md) | Search the live web through the managed proxy (powered by Exa), backend-proxied Parallel, your own Exa, Brave, Querit or Tavily key, or self-hosted SearXNG. |
+| [Web scraper](web-scraper.md) | Pull clean text out of any URL: articles, docs, READMEs. |
+| [Coder](coder.md) | Read, write, edit and patch files; glob, grep, git, lint, test. |
+| [Documents](documents.md) | Write `.docx` and `.pptx`, and read PDF, Word, PowerPoint and Excel files. |
+| [Browser and computer control](browser-and-computer.md) | Open URLs, inspect DOM snapshots, click, type, move the mouse. |
+| [Cron and scheduling](cron.md) | Recurring jobs, one-off reminders, scheduled agent runs. |
+| [Voice](voice.md) | Speech-to-text in, text-to-speech out, and a live voice agent you can interrupt. |
+| [Memory tools](memory-tools.md) | Recall, fetch, learn and forget through the single `memory` tool. |
+| [Third-party integrations](integrations.md) | The agent's view of your [connected services](../integrations/README.md). |
+| [Agent coordination](agent-coordination.md) | Spawn subagents, delegate to skills, plan, ask the user. |
+| [System and utilities](system-and-utilities.md) | Shell, node, SQL, current time, push notifications, LSP. |
## See also
-* [Smart Token Compression](../token-compression.md) - what keeps tool output costs bounded.
-* [Third-party Integrations](../integrations/) - the user-facing pitch and OAuth flow for the managed catalog.
-* [Privacy & Security](../privacy-and-security/) - the boundary every tool runs inside.
-* [Tools domain](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/tools/README.md) - the Rust module that registers these tools.
-* [Agent harness](../../developing/architecture/agent-harness.md) - how tool calls run inside a turn.
+- [Token compression](../token-compression.md): what keeps tool output costs bounded.
+- [Third-party integrations](../integrations/README.md): the OAuth flow for the managed catalog.
+- [Privacy and security](../privacy-and-security.md): the boundary every tool runs inside.
+- [Tools domain](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/tools/README.md): the Rust module that registers these tools.
+- [Agent harness](../../developing/architecture/agent-harness.md): how tool calls run inside a turn.
diff --git a/docs/gitbooks/en/features/native-tools/agent-coordination.md b/docs/gitbooks/en/features/native-tools/agent-coordination.md
index 3deb5bc5b8..46d88efb56 100644
--- a/docs/gitbooks/en/features/native-tools/agent-coordination.md
+++ b/docs/gitbooks/en/features/native-tools/agent-coordination.md
@@ -1,43 +1,43 @@
---
-description: Tools the agent uses to plan, delegate, and ask for help.
+description: Tools the agent uses to plan, delegate and ask for help.
icon: sitemap
---
-# Agent Coordination
+# Agent coordination
-Beyond doing the work, the agent has tools for _organising_ the work - planning multi-step jobs, delegating to specialists, spawning subagents, and pausing to ask the user when something is genuinely ambiguous.
+Besides doing the work, the agent has tools for organizing it: planning multi-step jobs, delegating to specialists, spawning sub-agents, and pausing to ask you when something is genuinely unclear.
-## Tools in the family
+## Tools in this family
-| Tool | What it does |
-| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
-| `todo` | Rewrite the session todo list across a long task; the chat shows it as a checklist that ticks off as work progresses. |
-| `spawn_subagent` | Delegate to a reusable async specialist by default; creates a fresh worker only when incompatible or requested. |
-| `spawn_async_subagent` | Lower-level reusable async delegation surface with the same durable session identity. |
-| `steer_subagent` / `wait_subagent` | Message or collect a running worker by durable `subagent_session_id` or transient `task_id`. |
-| `list_subagents` / `close_subagent` | Inspect reusable workers for the parent thread or explicitly retire one. |
-| `spawn_worker_thread` | Explicit background work tracked as a separate worker thread. |
-| `delegate` | Hand a task to a specialist (e.g. an archetype with different prompts/tools/permissions). |
-| `spawn_parallel_agents` | Fan one task out to several specialists at once and merge what they return. |
-| `use_skill` | Load an inline skill's playbook and tools (coding, web3, system, scheduling, docs, mcp) and call them directly. |
-| `ask_user_clarification` | Pause and ask the user a precise question instead of guessing. |
-| `plan_exit` | Exit a planning phase and start executing. |
+| Tool | What it does |
+| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
+| `todo` | Rewrites the session to-do list across a long task. The chat shows it as a checklist that ticks off as work progresses. |
+| `spawn_subagent` | Delegates to a reusable async specialist. It creates a fresh worker only when the work is incompatible or you ask. |
+| `spawn_async_subagent` | A lower-level reusable async delegation tool with the same durable session identity. |
+| `steer_subagent`, `wait_subagent` | Message or collect a running worker by durable `subagent_session_id` or transient `task_id`. |
+| `list_subagents`, `close_subagent` | Inspect the reusable workers for the parent thread, or retire one. |
+| `spawn_worker_thread` | Explicit background work tracked as a separate worker thread. |
+| `delegate` | Hands a task to a specialist, such as an archetype with different prompts, tools or permissions. |
+| `spawn_parallel_agents` | Fans one task out to several specialists at once and merges what they return. |
+| `use_skill` | Loads an inline skill's playbook and tools (coding, web3, system, scheduling, docs, mcp) so the agent can call them. |
+| `ask_user_clarification` | Pauses and asks you a precise question instead of guessing. |
+| `plan_exit` | Leaves the planning phase and starts executing. |
-`spawn_subagent` and archetype delegation calls accept an optional `model` field for a one-off exact model pin. If it is omitted, the harness uses config-level per-agent pins when present and otherwise falls back to the normal model-routing hints. Model, sandbox mode, parent thread, action root, and task key are part of reusable sub-agent compatibility, so materially different work gets a separate worker.
+`spawn_subagent` and archetype delegation calls accept an optional `model` field to pin an exact model for one call. If you leave it out, the harness uses per-agent pins from config when present, and otherwise falls back to normal model-routing hints. Model, sandbox mode, parent thread, action root and task key all affect whether a sub-agent can be reused, so materially different work gets its own worker.
-Reusable delegation returns both a transient `task_id` and a durable `subagent_session_id`. Prefer the durable id for cross-turn follow-ups. Pass `fresh: true` only when the user or task needs a clean worker; pass `blocking: true` only when the parent must wait inline for the child result.
+Reusable delegation returns a transient `task_id` and a durable `subagent_session_id`. Use the durable id for follow-ups in later turns. Pass `fresh: true` only when you or the task needs a clean worker. Pass `blocking: true` only when the parent must wait for the child's result.
-## Why these are tools, not implicit behaviour
+## Why these are tools
-Long tasks fall apart when the agent tries to keep everything in one head. Splitting work via TODOs and subagents means:
+Long tasks fall apart when an agent tries to hold everything in one head. Splitting work with to-dos and sub-agents helps in three ways:
-- Each subagent keeps useful local context for the same logical job instead of being respawned every turn.
+- Each sub-agent keeps useful local context for the same job instead of being respawned every turn.
- The main thread keeps a high-level view of progress.
-- Failures in one branch don't poison the rest.
+- A failure in one branch does not spoil the rest.
-Asking for clarification is a tool too, on purpose: it makes "I should ask the user" a _visible_ decision the agent can be steered toward, not an emergent behaviour.
+Asking for clarification is a tool on purpose. It makes "I should ask the user" a visible decision the agent can be steered toward, instead of something that only happens by chance.
## See also
-- [Coder](coder.md) - the coding tools, most of them loaded through the `coding` skill.
-- [Cron & Scheduling](cron.md) - how background agent runs get scheduled.
+- [Coder](coder.md): the coding tools, most of them loaded through the `coding` skill.
+- [Cron and scheduling](cron.md): how background agent runs are scheduled.
diff --git a/docs/gitbooks/en/features/native-tools/browser-and-computer.md b/docs/gitbooks/en/features/native-tools/browser-and-computer.md
index e6a5c356dc..4f0077d87f 100644
--- a/docs/gitbooks/en/features/native-tools/browser-and-computer.md
+++ b/docs/gitbooks/en/features/native-tools/browser-and-computer.md
@@ -2,102 +2,102 @@
description: >-
Read and drive a real browser and a real desktop: accessibility snapshots,
element references, bounded tasks that stop at a payment page, and a small
- decision model picking each step.
+ decision model that picks each step.
icon: display
---
-# Browser & Computer Control
+# Browser and computer control
-When the agent needs to _use_ a machine the way a person would, open a page, read what is on screen, click a button, type a phrase, these tools are how it does it. Both surfaces come from one loadable module, **TinyComputer**, which serves desktop and browser control over a single interface and is downloaded on first use.
+When the agent needs to use a computer the way a person would, by opening a page, reading the screen, clicking a button or typing a phrase, these tools do it. Desktop and browser control both come from one loadable module, TinyComputer. It downloads on first use.
## Two surfaces, one model
-Desktop and browser produce the same kind of "screen": a compact list of the things a person could interact with, each with a role, a name, a value, its states, the actions it supports, and the labels of the boxes it sits in, capped at 254 controls. Both offer the same short action list (click, type, check, uncheck, expand, collapse, scroll, wait, press), so the agent learns one vocabulary.
+Desktop and browser produce the same kind of "screen": a compact list of things a person could interact with. Each item has a role, a name, a value, its states, the actions it supports, and the labels of the boxes it sits in. The list is capped at 254 controls. Both surfaces offer the same short list of actions (click, type, check, uncheck, expand, collapse, scroll, wait, press), so the agent learns one vocabulary.
-Elements are addressed by **reference**, never by coordinates or CSS selectors. A desktop reference like `@s8f3k2p9:e1` is bound to the snapshot that produced it: acting on it either reaches the element that was described, or fails with a stale-reference error telling the agent to look again. It never clicks whatever has since moved into that position. Browser references survive a redraw, because they are marks that last as long as the element is on the page.
+Elements are addressed by reference, never by coordinates or CSS selectors. A desktop reference like `@s8f3k2p9:e1` is tied to the snapshot that produced it. Acting on it either reaches the element that was described or fails with a stale-reference error telling the agent to look again. It never clicks whatever has moved into that spot since. Browser references survive a redraw, because they are marks that last as long as the element is on the page.
## Browser
-The browser is a real Chrome or Chromium, driven over the Chrome DevTools Protocol by a library linked into the module. Chrome is its own process, as it has to be, but nothing sits between it and the module: no driver binary, no local HTTP bridge, no second OpenHuman process.
+The browser is a real Chrome or Chromium, driven over the Chrome DevTools Protocol by a library built into the module. Chrome runs as its own process, but nothing sits between it and the module: no driver binary, no local HTTP bridge and no second OpenHuman process.
-- **Open** a session: launch a fresh browser (headless or headed), or **attach to the Chrome you already have running**. Attaching matters more than it sounds: plenty of sites turn away a fresh automated browser and serve a person's own. On task end an attached browser is only disconnected, never closed.
-- **Snapshot** the page. The default perception mode, `sight`, runs a small in-page script that reads the page the way a person sees it: real links, buttons and fields, plus anything with a pointer cursor, a click handler or a tab stop. Hidden, zero-size, transparent and disabled things are dropped; things below the fold are marked offscreen and things behind a dialog are marked covered. It falls back to the accessibility tree when it cannot read a page, and `perception: "tree"` forces the tree.
-- **Act**: click (optionally into a new tab), fill, type, press, select, check, hover, scroll, wait, read, go back.
+- **Open** a session. You can launch a fresh browser (headless or headed) or attach to the Chrome you already have running. Attaching matters because many sites turn away a fresh automated browser but serve a person's own. When a task ends, an attached browser is only disconnected, never closed.
+- **Snapshot** the page. The default mode, `sight`, runs a small in-page script that reads the page the way a person sees it: real links, buttons and fields, plus anything with a pointer cursor, a click handler or a tab stop. It drops hidden, zero-size, transparent and disabled items. It marks items below the fold as offscreen and items behind a dialog as covered. It falls back to the accessibility tree when it can't read a page, and `perception: "tree"` forces the tree.
+- **Act**: click (optionally into a new tab), fill, type, press, select, check, hover, scroll, wait, read and go back.
- **Read** the page as text, Markdown or serialized DOM, and **evaluate** JavaScript.
-- **Downloads**: list the browser's download events, and wait for a completed file. A page snapshot alone does not prove a file finished.
+- **Downloads**: list the browser's download events and wait for a completed file. A page snapshot alone doesn't prove a file finished.
-Screenshots are never returned inline. A reply carries a handle the agent reads in chunks and releases when done.
+Screenshots are never returned inline. A reply carries a handle that the agent reads in chunks and releases when done.
-Sessions are bounded: the module allows up to 8 at once, and OpenHuman keeps at most 6 per conversation thread with a 30-minute idle timeout, so a long chat reuses one browser instead of opening a new one per turn. A session can be restricted to a set of origins.
+Sessions are bounded. The module allows up to 8 at once. OpenHuman keeps at most 6 per conversation thread with a 30-minute idle timeout, so a long chat reuses one browser and doesn't open a new one every turn. A session can be restricted to a set of origins.
## Desktop
-Desktop control reads the operating system's **accessibility tree**, the same interface a screen reader uses: running apps, windows, displays, Notification Center entries, the clipboard, and screenshots.
+Desktop control reads the operating system's accessibility tree, the same interface a screen reader uses. It covers running apps, windows, displays, Notification Center entries, the clipboard and screenshots.
-Actions go through the accessibility API rather than synthesized input, so by default they do **not** steal focus, move your cursor or touch the pasteboard, and a run can proceed while you use the machine. A "headed" mode and real mouse and key events exist for apps that need them, and are the exception.
+Actions go through the accessibility API and not through synthesized input. By default they don't steal focus, move your cursor or touch the clipboard, so a run can continue while you use the machine. A headed mode and real mouse and key events exist for apps that need them, but they are the exception.
-For dense apps, a skeleton snapshot caps the walk at three levels and returns structure without leaf detail, which is the difference between tens of thousands of tokens and a few hundred.
+For dense apps, a skeleton snapshot stops at three levels and returns structure without leaf detail. That is the difference between tens of thousands of tokens and a few hundred.
## Tasks
-Above the primitives sits a bounded task loop. You describe the outcome; the module plans the steps and a small decision model ([Jev](../../developing/jev.md)) picks every click. A task starts and returns immediately with a status, which the agent polls and answers:
+Above these basics sits a bounded task loop. You describe the outcome, the module plans the steps, and a small decision model ([Jev](../../developing/jev.md)) picks every click. A task starts and returns at once with a status, which the agent polls and answers:
-| Status | What it means |
-| ----------------- | ----------------------------------------------------------------------- |
-| `running` | Working. |
-| `needs_input` | A field it cannot fill without you. |
-| `needs_approval` | An irreversible step. Only an explicit approval releases it. |
-| `needs_human` | A captcha, OTP, 2FA or login. No model can get past it. |
-| `needs_plan` | Plain language with no planner configured. |
-| `checkpoint` | Stopped on purpose, with the page left open. |
-| `done` / `failed` / `cancelled` | Terminal. |
+| Status | What it means |
+| ------------------------------- | ----------------------------------------------------------------- |
+| `running` | Working. |
+| `needs_input` | A field it can't fill without you. |
+| `needs_approval` | An irreversible step. Only an explicit approval releases it. |
+| `needs_human` | A captcha, OTP, 2FA or login. No model can get past it. |
+| `needs_plan` | Plain language with no planner configured. |
+| `checkpoint` | Stopped on purpose, with the page left open. |
+| `done`, `failed`, `cancelled` | Final states. |
-Two properties are worth stating plainly:
+Two rules hold for every task:
-- **Reaching a payment page always stops the task.** It becomes a checkpoint that cannot be continued, with the page left open for a person. The agent does not pay.
-- **Secret values never reach a model.** Facts you mark secret are shared as `${name}` templates; the planner, the decision model and the rescue model see the name, and the value is typed locally into the field.
+- **Reaching a payment page always stops the task.** It becomes a checkpoint that can't be continued, with the page left open for a person. The agent does not pay.
+- **Secret values never reach a model.** Facts you mark secret are shared as `${name}` templates. The planner, the decision model and the rescue model see only the name, and the value is typed locally into the field.
-Page and screen text is treated as data, never as instructions, and the safety rules are plain code rather than model judgement.
+Page and screen text is treated as data, never as instructions. The safety rules are plain code, not model judgment.
## Agent tools
| Tool | What it does |
| --- | --- |
-| `browser` | Everything above on one `action` argument: `open`, `snapshot`, `read_page`, `click`, `fill`, `type`, `get_text`, `get_title`, `get_url`, `wait`, `press`, `hover`, `scroll`, `is_visible`, `find`, `task`, `task_continue`, `task_cancel`, `confirm_pending`, `list_downloads`, `wait_download`, `close`. |
-| `browser_open` | Open a URL and get a session back. |
+| `browser` | Everything above through one `action` argument: `open`, `snapshot`, `read_page`, `click`, `fill`, `type`, `get_text`, `get_title`, `get_url`, `wait`, `press`, `hover`, `scroll`, `is_visible`, `find`, `task`, `task_continue`, `task_cancel`, `confirm_pending`, `list_downloads`, `wait_download`, `close`. |
+| `browser_open` | Opens a URL and returns a session. |
| `desktop_list_apps`, `desktop_list_windows` | What is running and where. |
-| `desktop_launch` | Start an app. |
-| `desktop_snapshot`, `desktop_find` | Read the screen, or look for one thing on it. |
-| `desktop_goal`, `desktop_continue_goal` | Run a desktop task and answer its stops. |
+| `desktop_launch` | Starts an app. |
+| `desktop_snapshot`, `desktop_find` | Reads the screen, or looks for one thing on it. |
+| `desktop_goal`, `desktop_continue_goal` | Runs a desktop task and answers its stops. |
-Irreversible steps go through OpenHuman's [Approval Gate](../approval-gate.md), bound to a digest of the exact action and URL. If no approval gate is installed, the action is **denied**, not allowed.
+Irreversible steps go through OpenHuman's [approval gate](../approval-gate.md), tied to a digest of the exact action and URL. If no approval gate is installed, the action is denied.
## Platform support
| Platform | Desktop | Browser |
| --- | --- | --- |
-| macOS | Yes. Needs **Accessibility** permission, plus **Screen Recording** for screenshots and **Automation** for the Notification Center opener. | Yes |
+| macOS | Yes. Needs Accessibility permission, plus Screen Recording for screenshots and Automation for the Notification Center opener. | Yes |
| Windows | Yes | Yes |
| Linux | No | No |
-A permission check runs before the first read, because an accessibility API called by an unauthorized process usually returns an *empty tree* rather than an error, which is indistinguishable from an app with no buttons. A missing permission produces a named refusal that says which setting to change.
+A permission check runs before the first read. An accessibility API called by an unauthorized process usually returns an empty tree, not an error, and that looks the same as an app with no buttons. A missing permission produces a named refusal that says which setting to change.
-Linux is not in the shipped surface: the module registry publishes no Linux artifact, so neither desktop control nor browser automation is available there even though the browser engine itself would run.
+Linux is not supported. The module registry publishes no Linux build, so neither desktop control nor browser automation is available there, even though the browser engine itself would run.
## Settings
-**Connections → Computer Control** holds all of it: the module's status and contract version, the decision model (Jev, OpenJEV or Levanto Sage) and which route it bills through, the planner and rescue models, and the browser section (executable path, perception mode, allowed domains).
+**Connections > Computer Control** holds all of it: the module's status and contract version, the decision model (Jev, OpenJEV or Levanto Sage) and which route it bills through, the planner and rescue models, and the browser section (executable path, perception mode and allowed domains).
-`[desktop] approvals_enabled` defaults to `false`, and it governs one narrow thing: the module's own mid-goal confirmation stop on the **desktop** surface, which the core then auto-continues after the module re-observes and re-validates the exact target. Setting it `true` surfaces that stop as an approval card instead. It does not weaken the [Approval Gate](../approval-gate.md): an irreversible step still needs an approval, and with no gate installed it is denied. Desktop goal confirmations are single-use and expire after 10 minutes.
+`[desktop] approvals_enabled` defaults to `false`. It governs one narrow thing: the module's own confirmation stop in the middle of a desktop goal. When it is off, the core continues automatically after the module re-observes and re-validates the exact target. When it is `true`, that stop shows as an approval card. It does not weaken the [approval gate](../approval-gate.md). An irreversible step still needs approval, and with no gate installed it is denied. Desktop goal confirmations are single-use and expire after 10 minutes.
-## What it's good for
+## What it is good for
- Driving sites that have no API and no [native integration](../integrations/README.md).
-- Multi-step UI flows where each snapshot tells you the next actionable element.
+- Multi-step UI flows where each snapshot shows the next element to act on.
- Automating a local app from inside a chat.
## See also
-- [Web Scraper](web-scraper.md): when you only need the article, not the whole page.
+- [Web scraper](web-scraper.md): when you only need the article, not the whole page.
- [Jev](../../developing/jev.md): the decision model that picks each step.
-- [Approval Gate](../approval-gate.md): what gets parked, and what happens with no gate installed.
+- [Approval gate](../approval-gate.md): what gets parked, and what happens with no gate installed.
diff --git a/docs/gitbooks/en/features/native-tools/coder.md b/docs/gitbooks/en/features/native-tools/coder.md
index e90e661356..1de3519181 100644
--- a/docs/gitbooks/en/features/native-tools/coder.md
+++ b/docs/gitbooks/en/features/native-tools/coder.md
@@ -1,43 +1,47 @@
---
-description: A complete toolset for working on real codebases - read, write, edit, search, git, lint, test.
+description: >-
+ A complete toolset for working on real codebases: read, write, edit, search,
+ git, lint and test.
icon: code
---
# Coder
-The coder family is what makes OpenHuman a viable coding partner instead of a chat window that _pretends_ to know the codebase.
+The coder tools make OpenHuman a real coding partner and not a chat window that only pretends to know your codebase.
-## Tools in the family
+## Tools in this family
-| Tool | What it does |
-| ---------------- | ----------------------------------------------------------------- |
-| `file_read` | Read a file (with line numbers, like `cat -n`). |
-| `file_write` | Write a new file. |
-| `edit` | Targeted edits - match-and-replace with strict uniqueness checks. |
-| `apply_patch` | Apply a unified diff. |
-| `glob` | Find files by glob pattern. |
-| `grep` | Ripgrep-style search across the tree. |
-| `list` | Walk a directory tree. |
-| `read_diff` | Diff between two files or revisions. |
-| `git_operations` | Status, diff, log, blame, branch, commit. |
-| `run_linter` | Run the project's linter. |
-| `run_tests` | Run the project's test command. |
-| `csv_export` | Export query results as CSV. |
+| Tool | What it does |
+| ---------------- | --------------------------------------------------------------------- |
+| `file_read` | Reads a file, with line numbers like `cat -n`. |
+| `file_write` | Writes a new file. |
+| `edit` | Makes targeted edits by match and replace, with strict uniqueness checks. |
+| `apply_patch` | Applies a unified diff. |
+| `glob` | Finds files by glob pattern. |
+| `grep` | Searches the tree, ripgrep style. |
+| `list` | Walks a directory tree. |
+| `read_diff` | Shows the diff between two files or revisions. |
+| `git_operations` | Status, diff, log, blame, branch and commit. |
+| `run_linter` | Runs the project's linter. |
+| `run_tests` | Runs the project's test command. |
+| `csv_export` | Exports query results as CSV. |
-## Why these are native, not shell-only
+## Why these are native
-A shell tool plus `cat`/`sed`/`awk` could _technically_ do all of this. The native tools exist because:
+A shell tool plus `cat`, `sed` and `awk` could technically do all of this. The native tools exist because:
-- Edits go through a uniqueness check, so the agent can't accidentally clobber the wrong line.
+- Edits go through a uniqueness check, so the agent can't clobber the wrong line.
- Reads come back with line numbers the agent can refer to in follow-ups.
-- Git operations parse output into structured data, instead of leaving the agent to scrape porcelain.
-- Lint and test runs are wired to the project's actual commands, not generic guesses.
+- Git output is parsed into structured data, so the agent doesn't scrape porcelain output.
+- Lint and test runs use the project's real commands, not generic guesses.
## Workspace scoping
-Filesystem tools act inside the agent's **working folder** (`action_dir`), not the workspace directory, which holds internal state and is never a tool target. With the autonomy policy on, `workspace_only` confines them to that folder and anything outside it needs an explicit trusted root. With the policy off (the default) that confinement is not enforced, and the thing that still holds either way is the hard floor: credential stores (`~/.ssh`, `~/.gnupg`, `~/.aws`) and system roots are unreachable, as are `..` traversal and null bytes in a path. See [Approval Gate](../approval-gate.md).
+File tools act inside the agent's working folder (`action_dir`). The workspace directory holds internal state and is never a tool target.
+
+With the autonomy policy on, `workspace_only` confines the tools to the working folder, and anything outside it needs an explicit trusted root. With the policy off (the default), that confinement is not enforced. One floor holds either way: credential stores (`~/.ssh`, `~/.gnupg`, `~/.aws`) and system roots are unreachable, as are `..` traversal and null bytes in a path. See [Approval gate](../approval-gate.md).
## See also
-- [System & Utilities](system-and-utilities.md) - `shell`, `node_exec`, `npm_exec`, `python_exec` for the rest of the dev loop.
-- [Agent Coordination](agent-coordination.md) - `todo_write`, `spawn_subagent` for larger refactors.
+- [System and utilities](system-and-utilities.md): `shell`, `node_exec`, `npm_exec` and `python_exec` for the rest of the dev loop.
+- [Agent coordination](agent-coordination.md): `todo` and `spawn_subagent` for larger refactors.
diff --git a/docs/gitbooks/en/features/native-tools/cron.md b/docs/gitbooks/en/features/native-tools/cron.md
index fd3a7b41c7..ee90b01f5b 100644
--- a/docs/gitbooks/en/features/native-tools/cron.md
+++ b/docs/gitbooks/en/features/native-tools/cron.md
@@ -1,39 +1,39 @@
---
-description: Recurring jobs, one-off reminders, and scheduled agent runs - first-class.
+description: Recurring jobs, one-off reminders and scheduled agent runs.
icon: clock
---
-# Cron & Scheduling
+# Cron and scheduling
-Scheduling is a first-class capability, not a workaround. The agent can set up recurring jobs ("every weekday at 9am, summarise my inbox"), one-off reminders ("nudge me about this in three hours"), and arbitrary agent runs on a cron schedule.
+Scheduling is a built-in capability. The agent can set up recurring jobs ("every weekday at 9am, summarize my inbox"), one-off reminders ("nudge me about this in three hours") and any agent run on a cron schedule.
-## Tools in the family
+## Tools in this family
-| Tool | What it does |
-| ------------- | ------------------------------------------------------------------ |
-| `cron_add` | Create a new scheduled job - cron expression + agent prompt. |
-| `cron_list` | List existing jobs and their next-run times. |
-| `cron_update` | Edit an existing job - change schedule, prompt, or enabled state. |
-| `cron_remove` | Delete a job. |
-| `cron_run` | Run a job once, immediately, regardless of its schedule. |
-| `cron_runs` | Inspect the recent run history - when, how long, what it produced. |
+| Tool | What it does |
+| ------------- | --------------------------------------------------------------------- |
+| `cron_add` | Creates a scheduled job from a cron expression and an agent prompt. |
+| `cron_list` | Lists existing jobs and their next run times. |
+| `cron_update` | Edits a job: its schedule, prompt or enabled state. |
+| `cron_remove` | Deletes a job. |
+| `cron_run` | Runs a job once, right now, whatever its schedule. |
+| `cron_runs` | Shows recent run history: when, how long and what it produced. |
-There's also a one-shot `schedule` tool in [System & Utilities](system-and-utilities.md) for "do this once at time T" cases that don't need a recurring entry.
+For "do this once at time T" cases that don't need a recurring entry, there is also a one-shot `schedule` tool in [System and utilities](system-and-utilities.md).
-Agent jobs run a full model turn every time they fire, so they must be scheduled at least five minutes apart. `cron_add` and `cron_update` reject a tighter cron expression or `every_ms` for an agent job and say which two runs would be too close (`*/7 * * * *`, for instance, fires at :56 and again at :00). Shell jobs have no such floor.
+Agent jobs run a full model turn each time they fire, so they must be at least five minutes apart. `cron_add` and `cron_update` reject a tighter cron expression or `every_ms` for an agent job, and they say which two runs would be too close. For example, `*/7 * * * *` fires at :56 and again at :00. Shell jobs have no such limit.
-## What it's good for
+## What it is good for
-- Daily / weekly digests delivered to your messaging channel of choice.
+- Daily or weekly digests delivered to your messaging channel.
- Polling a slow integration that doesn't push events.
-- Reminders the agent itself owns ("remind me Thursday to follow up with Alice").
-- Recurring research - "every Monday, check what's new on this topic and write me a brief".
+- Reminders the agent owns, such as "remind me Thursday to follow up with Alice".
+- Recurring research, such as "every Monday, check what's new on this topic and write me a brief".
-## How it ties back to the rest
+## How it fits with the rest
-Every cron run is just a normal agent invocation, so it can use any other tool - search the web, query [memory](../memory.md), call a [third-party integration](../integrations/README.md), send a message. Run history is recorded so you can see what each tick produced.
+A cron run is a normal agent run, so it can use any other tool: search the web, query [memory](../memory.md), call a [third-party integration](../integrations/README.md), or send a message. Run history is recorded so you can see what each run produced.
## See also
-- [System & Utilities](system-and-utilities.md) - the one-shot `schedule` tool.
-- [Agent Coordination](agent-coordination.md) - for jobs that fan out into subagents.
+- [System and utilities](system-and-utilities.md): the one-shot `schedule` tool.
+- [Agent coordination](agent-coordination.md): for jobs that fan out into sub-agents.
diff --git a/docs/gitbooks/en/features/native-tools/documents.md b/docs/gitbooks/en/features/native-tools/documents.md
index 1b14f613a7..c8b7106880 100644
--- a/docs/gitbooks/en/features/native-tools/documents.md
+++ b/docs/gitbooks/en/features/native-tools/documents.md
@@ -1,22 +1,22 @@
---
description: >-
- Write .docx and .pptx files, and read PDF, Word, PowerPoint and Excel back
- in, with every limit stated up front.
+ Write .docx and .pptx files, and read PDF, Word, PowerPoint and Excel files
+ back in, with every limit stated up front.
icon: file-lines
---
# Documents
-Two tools write files a person can open, and the ingest path reads the common office formats back in. Both run in a loadable module rather than in the app binary, which is why the writers' dependencies are in no OpenHuman build.
+Two tools write files a person can open, and the ingest path reads the common office formats back in. Both run in a separate loadable module, not in the app itself.
## Writing
| Tool | Produces |
| --- | --- |
-| `generate_document` | A `.docx` from a structured spec: title, author, headings, paragraphs, bullet lists. |
-| `generate_presentation` | A `.pptx` from slides: titles, bullets, images. |
+| `generate_document` | A `.docx` from a structured spec: title, author, headings, paragraphs and bullet lists. |
+| `generate_presentation` | A `.pptx` from slides: titles, bullets and images. |
-The spec is validated before anything is written, and the limits are part of the contract rather than advice:
+The spec is checked before anything is written. The limits are part of the contract:
| `.docx` | Limit |
| --- | --- |
@@ -36,29 +36,29 @@ The spec is validated before anything is written, and the limits are part of the
| Images per deck | 8 |
| Bytes per image | 5 MiB |
-The aggregate character cap is the load-bearing one: sections times paragraphs times characters per paragraph would otherwise allow a spec that no reader could open.
+The total character cap is the one that matters most. Without it, sections times paragraphs times characters per paragraph would allow a spec that no reader could open.
-The finished file arrives as an [artifact](../chat.md), so it shows up in the thread's files panel with download and reveal-in-folder.
+The finished file arrives as an [artifact](../chat.md). It appears in the thread's files panel with download and reveal-in-folder.
## Reading
-Attach a file, or point a [memory source](../memory.md) at one, and the ingest path extracts text with per-section provenance (a page number for a PDF, the part path for an Office file):
+Attach a file, or point a [memory source](../memory.md) at one, and the ingest path extracts its text. Each piece of text keeps its origin: a page number for a PDF, or the part path for an Office file.
| Format | Notes |
| --- | --- |
-| PDF | Up to 4,096 source pages. A page with no text layer is kept and flagged as a scan candidate, which is a suggestion for vision, not a claim that OCR is needed. |
-| DOCX, PPTX, XLSX | Slide and sheet order comes from the file's own relationship manifest, so an unreferenced slide is excluded rather than guessed at by filename. Spreadsheets read shared and inline strings and use cached cell values; formulas are never evaluated. |
+| PDF | Up to 4,096 source pages. A page with no text layer is kept and flagged as a scan candidate. That flag suggests using vision. It does not claim OCR is needed. |
+| DOCX, PPTX, XLSX | Slide and sheet order comes from the file's own manifest, so an unreferenced slide is left out and not guessed from its filename. Spreadsheets read shared and inline strings and use cached cell values. Formulas are never evaluated. |
-Bounds: 64 MiB in, 256 result sections, 200,000 bytes of text out, and the result says whether it was truncated. Text is never cut mid-character. Rendering PDF pages to images is opt-in per page, at most 8 pages per call and 2,048 pixels on the longest edge.
+The bounds are 64 MiB in, 256 result sections and 200,000 bytes of text out. The result says whether it was truncated. Text is never cut mid-character. Rendering PDF pages to images is opt-in for each page, with at most 8 pages per call and 2,048 pixels on the longest edge.
Nothing is written to disk during extraction, no office application is launched, and there is no network OCR.
## Where it runs
-Document work happens in the `tinydocs` module: a signed native library downloaded on first use and verified against a SHA-256 pinned in the compiled registry. The consequence worth knowing is that the document writers and the PDF reader are **not** in OpenHuman's dependency graph in any build configuration, and with the `documents` feature off the two tools are simply absent from the agent's list rather than present and failing, while a PDF attachment degrades to 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 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.
## See also
-- [Image & Video Generation](media-generation.md): the other thing that produces a file.
-- [Memory](../memory.md): where a read document ends up if you add it as a source.
+- [Image and video generation](media-generation.md): the other tools that produce a file.
+- [Memory](../memory.md): where a document ends up if you add it as a source.
- [Loadable modules](../../developing/loadable-modules.md): how a module is pinned and loaded.
diff --git a/docs/gitbooks/en/features/native-tools/image-tools.md b/docs/gitbooks/en/features/native-tools/image-tools.md
index 94ee165e1f..01929cf1e1 100644
--- a/docs/gitbooks/en/features/native-tools/image-tools.md
+++ b/docs/gitbooks/en/features/native-tools/image-tools.md
@@ -1,43 +1,43 @@
---
description: >-
- The reading side of images: attachments the model can see natively, local
- image metadata, and which model handles vision.
+ Show the agent an image: attachments the model can see, local image
+ metadata, and which model handles vision.
icon: image
---
-# Image Tools
+# Image tools
-Generating images is [Image & Video Generation](media-generation.md). This page is the other direction: getting an image *into* a turn so the model can look at it.
+This page is about getting an image into a turn so the model can look at it. To make images instead, see [Image and video generation](media-generation.md).
## Attaching an image
-Attach a file in the composer, or point the agent at a path. What happens next depends on the model and the route, not on a setting:
+Attach a file in the composer, or point the agent at a path. What happens next depends on the model and the route, not on a setting.
-- If the model's facts say it accepts that modality **and** the transport supports it, the image goes up natively as image content.
-- If not, it degrades rather than failing: a bounded readout, or a reference to the file with its path and metadata, so the agent can still reason about it and tell you what it cannot see.
+- If the model accepts images and the transport supports them, the image goes up natively as image content.
+- If not, it degrades instead of failing. The agent gets a bounded readout, or a reference to the file with its path and metadata. It can still reason about the file and tell you what it cannot see.
-Uploads are preserved in the acting workspace across a restart, and the ordered references survive in the transcript, so a later turn can still refer to "the second screenshot".
+Uploads stay in the acting workspace across a restart. The ordered references stay in the transcript, so a later turn can still refer to "the second screenshot".
## `image_info`
-One tool, read-only: it reads a local image's metadata (format, dimensions, size) and can return its bytes as base64 text for a model that wants them inline. It is the tool to reach for when the question is "what *is* this file", and it does not need a vision model.
+`image_info` is a read-only tool. It reads a local image's metadata (format, dimensions, size) and can return the bytes as base64 text for a model that wants them inline. Use it when the question is "what is this file". It does not need a vision model.
## Which model sees it
-Vision is a workload with its own provider slot, so you can route it independently of chat:
+Vision has its own provider slot, so you can route it separately from chat:
```toml
vision_provider = "…" # a provider id, or leave unset to use the chat provider
```
-If a configured vision model turns out to be chat-only, the call returns a named error rather than silently substituting another model. There is deliberately no default local vision model: a local setup has to name one. [Local models and BYOK](../model-routing/local-and-byok-models.md) lists the ones worth trying.
+If a configured vision model turns out to be chat-only, the call returns a named error. It never silently swaps in another model. There is no default local vision model, so a local setup has to name one. [Local models and BYOK](../model-routing/local-and-byok-models.md) lists the ones worth trying.
## Delegation
-A turn that needs to look at several images, or to work through one carefully, is usually handed to the built-in vision sub-agent rather than done inline, so the main conversation does not carry every pixel of context. Delegation happens on the agent's own judgement; you do not have to ask for it.
+When a turn needs to look at several images, or study one closely, the agent usually hands it to the built-in vision sub-agent. That keeps the main conversation from carrying every pixel of context. The agent decides this itself. You do not have to ask.
## See also
-- [Image & Video Generation](media-generation.md): making images and video rather than reading them.
+- [Image and video generation](media-generation.md): making images and video.
- [Chat](../chat.md): where attachments live in the UI.
-- [Automatic Model Routing](../model-routing/README.md): how the vision slot is resolved.
+- [Automatic model routing](../model-routing/README.md): how the vision slot is resolved.
diff --git a/docs/gitbooks/en/features/native-tools/integrations.md b/docs/gitbooks/en/features/native-tools/integrations.md
index 8bece0a361..cb26a6c16b 100644
--- a/docs/gitbooks/en/features/native-tools/integrations.md
+++ b/docs/gitbooks/en/features/native-tools/integrations.md
@@ -1,35 +1,35 @@
---
-description: The agent's view of the connected third-party services.
+description: How the agent uses your connected third-party services as tools.
icon: plug
---
-# Third-party Integrations
+# Third-party integrations
-OpenHuman's agent can call into [the connected third-party services](../integrations/), Gmail, Notion, GitHub, Slack, Lark/Feishu, Stripe, Calendar and the long tail, through a single proxied tool surface.
+The agent can call the [services you connect](../integrations/README.md), such as Gmail, Notion, GitHub, Slack, Lark/Feishu, Stripe and Calendar, through one proxied tool surface.
-## How it shows up to the agent
+## How the agent sees them
-Once you've connected a service via OAuth, its actions become callable tools. The agent doesn't need to know whether a tool talks to Gmail or to a local file - it just calls the tool, the proxy routes the request through the OpenHuman backend with your token, and the result comes back like any other tool output.
+Once you connect a service with OAuth, its actions become callable tools. The agent does not need to know whether a tool talks to Gmail or a local file. It calls the tool, the proxy routes the request through the OpenHuman backend with your token, and the result comes back like any other tool output.
-A few examples of what becomes available:
+Some examples of what you can ask:
-* "Send a message to #engineering on Slack."
-* "Create an issue in the openhuman repo."
-* "What's on my calendar tomorrow?"
-* "Pull the last 20 Stripe charges over $1000."
+- "Send a message to #engineering on Slack."
+- "Create an issue in the openhuman repo."
+- "What's on my calendar tomorrow?"
+- "Pull the last 20 Stripe charges over $1000."
-## Native vs proxied
+## Native and proxied services
-Some services have **native providers** - Rust modules that know how to ingest the service into [memory](../memory.md) directly (e.g. Gmail's native ingest path). Others are exposed as **proxied tools** only: the agent can call them, but there's no automatic ingest yet. New native providers are added as features land.
+Some services have a native provider. That is a Rust module that ingests the service into [memory](../memory.md) directly, such as Gmail's native ingest path. Other services are proxied tools only. The agent can call them, but nothing is ingested automatically yet.
-Lark / Feishu currently has two surfaces: a native real-time channel for message send/receive, and a Composio-proxied workspace toolkit entry for chat, docs, wiki, and meeting actions when the backend allowlist exposes it. Historical chat/doc backfill into memory is not yet a native provider; track that separately from the live channel connector.
+Lark/Feishu has two surfaces. One is a native real-time channel for sending and receiving messages. The other is a Composio-proxied workspace toolkit for chat, docs, wiki and meeting actions, available when the backend allowlist exposes it. Backfilling old Lark chat and docs into memory is not a native provider yet.
## Privacy boundary
-For Composio-proxied integrations, OpenHuman's core never calls any third-party API directly. Requests go through the OpenHuman backend, which handles OAuth tokens and rate limiting. Your tokens never sit on disk in plaintext on your machine, and the agent only sees the _results_ of tool calls, not the credentials. Native channels such as Lark / Feishu use their own local configuration and should be reviewed separately from the Composio OAuth boundary.
+For Composio-proxied integrations, the core never calls a third-party API directly. Requests go through the OpenHuman backend, which handles OAuth tokens and rate limiting. Your tokens never sit on your disk in plaintext, and the agent only sees the results of tool calls, never the credentials. Native channels such as Lark/Feishu use their own local configuration, so review them separately from the Composio OAuth boundary.
## See also
-* [Third-party Integrations (catalog)](../integrations/) - the user-facing pitch, OAuth flow, and connection management.
-* [Memory](../memory.md) - how connected services become memory sources (Composio kind).
-* [Privacy & Security](../privacy-and-security/) - the full boundary.
+- [Third-party integrations catalog](../integrations/README.md): the OAuth flow and connection management.
+- [Memory](../memory.md): how connected services become memory sources.
+- [Privacy and security](../privacy-and-security.md): the full boundary.
diff --git a/docs/gitbooks/en/features/native-tools/media-generation.md b/docs/gitbooks/en/features/native-tools/media-generation.md
index 6485228802..48b9f66329 100644
--- a/docs/gitbooks/en/features/native-tools/media-generation.md
+++ b/docs/gitbooks/en/features/native-tools/media-generation.md
@@ -1,33 +1,34 @@
---
description: >-
- Ask for an image or a video and dedicated media agents generate it: image
- generation and editing (Seedream / SeedEdit), plus text-to-video and
- animate-a-reference-image (Seedance / Veo), saved straigh
+ Ask for an image or a video and dedicated media agents generate it, with
+ image editing and animation of a reference image, saved into your workspace.
icon: clapperboard
---
-# Image & Video Generation
+# Image and video generation
-OpenHuman can _make_ media, not just read it. Ask the assistant to "generate an image of…", "edit this screenshot to…", or "animate this photo into a short clip" and a dedicated media sub-agent takes over. No plugin, no API key, no separate billing.
+OpenHuman can make media, not just read it. Ask for "an image of…", "edit this screenshot to…" or "animate this photo into a short clip", and a dedicated media sub-agent takes over. You need no plugin, no API key and no separate billing.
## What it can do
-* **Image generation & editing.** Text-to-image and image editing through hosted GMI models (**Seedream** for generation, **SeedEdit** for edits).
-* **Video generation.** Text-to-video, or animate a reference image into a clip (**Seedance** / **Veo**). Video is asynchronous: the agent kicks off the render and collects the clip when it's done.
-* **Model discovery.** The agent can list the currently available media models and pick the right one for the job.
+- **Image generation and editing.** Text-to-image and image editing through hosted GMI models (Seedream for generation, SeedEdit for edits).
+- **Video generation.** Text-to-video, or animate a reference image into a clip (Seedance or Veo). Video is asynchronous. The agent starts the render and collects the clip when it is done.
+- **Model discovery.** The agent can list the media models available now and pick the right one.
## How it works
-The `media_generation` domain (`crates/openhuman-core/src/media/generation/`) exposes three agent tools (generate image, generate video, list models) backed by the OpenHuman backend's media-generation provider. The backend owns the provider keys, billing, and rate limiting; your subscription covers it like any other model call.
+The `media_generation` domain (`crates/openhuman-core/src/media/generation/`) gives the agent three tools: generate image, generate video and list models. They use the OpenHuman backend's media-generation provider. The backend owns the provider keys, billing and rate limiting, and your subscription covers it like any other model call.
-The tools submit the job and then poll on a 4-second cadence (up to 180 s for images, 420 s for video), so the agent, and you, get live progress instead of a hung call. Finished artifacts are downloaded into the agent's `generated-media/` folder in your workspace and returned as local file paths, ready to attach, post, or edit further.
+The tools submit a job and then poll every 4 seconds, for up to 180 seconds for images and 420 seconds for video. You and the agent see live progress instead of a hung call. Finished files are downloaded into the `generated-media/` folder of your workspace and returned as local file paths, ready to attach, post or edit further.
## Privacy
-Prompts and reference media for these tools are sent to the OpenHuman backend and on to the hosted media provider. This is disclosed in the in-app capability catalog (`intelligence.image_generation` / `intelligence.video_generation`, both Beta). Note that [Privacy Mode](../privacy-and-security/privacy-mode.md)'s local-only enforcement currently covers **inference providers only**. The media tools still call the backend, so avoid using them if you need strict no-egress today. Extending enforcement to integrations and network tools is a planned later slice.
+Prompts and reference media go to the OpenHuman backend and on to the hosted media provider. The in-app capability catalog discloses this (`intelligence.image_generation` and `intelligence.video_generation`, both Beta).
+
+[Privacy mode](../privacy-mode.md) local-only enforcement covers inference providers only. The media tools still call the backend, so avoid them if you need strict no-egress today.
## See also
-* [Image Tools](image-tools.md) covers the reading side: attachments, image metadata, and the vision model slot.
-* [Available Tools](./) lists the full native toolbelt.
-* [Billing, Cost & Usage](../billing-and-usage.md) explains how media jobs are metered.
+- [Image tools](image-tools.md): attachments, image metadata and the vision model slot.
+- [Native tools](README.md): the full toolbelt.
+- [Billing, cost and usage](../billing-and-usage.md): how media jobs are metered.
diff --git a/docs/gitbooks/en/features/native-tools/memory-tools.md b/docs/gitbooks/en/features/native-tools/memory-tools.md
index 137a1ebf79..7fe5326cc3 100644
--- a/docs/gitbooks/en/features/native-tools/memory-tools.md
+++ b/docs/gitbooks/en/features/native-tools/memory-tools.md
@@ -3,22 +3,24 @@ description: How the agent recalls, fetches, learns and forgets with its single
icon: brain
---
-# Memory Tools
+# Memory tools
-[Memory](../memory.md) is OpenHuman's knowledge base. The agent talks to it through one tool, `memory`, whose `action` is one of:
+[Memory](../memory.md) is OpenHuman's knowledge base. The agent uses it through one tool, `memory`, whose `action` is one of these:
| Action | What it does |
| --- | --- |
-| `recall` | Ask a question; returns an answer and the citations it rests on. |
-| `fetch` | Raw search (hybrid) over stored items, optionally filtered by metadata. Returns hits. |
-| `learn` | Save one durable learning (a preference, fact, procedure or correction). |
+| `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. |
-The tool is only registered when a memory engine is usable. With none selected, memory is off and the agent never sees it. Each learning is shared with every agent under the same memory root and tagged with the workspace, thread, agent and tool call that produced it.
+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>`): the learnings, documents and history most relevant to what you just said. The tool is for going further than the pack: asking a question the pack does not cover ("what do I know about the Stripe webhook?"), searching with metadata filters, or saving something worth remembering next time.
+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.
+
+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.
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.md
index a50b7926dd..ee92304160 100644
--- a/docs/gitbooks/en/features/native-tools/system-and-utilities.md
+++ b/docs/gitbooks/en/features/native-tools/system-and-utilities.md
@@ -1,36 +1,36 @@
---
-description: Shell, node, SQL, current time, push notifications - the small tools that round out the toolbelt.
+description: Shell, node, Python, current time and push notifications, the small tools that round out the toolbelt.
icon: gear
---
-# System & Utilities
+# System and utilities
-The catch-all family. Small, sharp tools the agent reaches for to round out a task.
+These are small tools the agent uses to finish a task.
## Tools in the family
-| Tool | What it does |
-| ------------------- | --------------------------------------------------------------------------- |
-| `shell` | Run a shell command. Bounded output, captured exit code. |
-| `node_exec` | Run a Node.js snippet - useful for one-off scripting. |
-| `npm_exec` | Run an `npm`/`pnpm`/`yarn` script. |
-| `python_exec` | Run a Python 3 snippet or `.py` script - one-off scripting in Python. |
-| `current_time` | Get the current time in any timezone, with formatting options. |
-| `schedule` | One-shot "do this once at time T" - for recurring jobs see [Cron](cron.md). |
-| `pushover` | Send a push notification to your devices. |
-| `lsp` | Query a language server (definitions, references, diagnostics). |
+| 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. |
+| `lsp` | Query a language server for definitions, references and diagnostics. |
| `read_workspace_state` | Inspect the current working folder: open files, recent edits, environment. |
-| `proxy_config` | Read or change proxy configuration for outbound requests. |
-| `tool_stats` | Self-reflection - what tools have been used in this session and how often. |
+| `proxy_config` | Read or change proxy configuration for outbound requests. |
+| `tool_stats` | Show which tools were used in this session and how often. |
-## What it's good for
+## What they are good for
-- The bits of a workflow that don't fit a richer tool family.
+- The parts of a workflow that do not fit a richer tool family.
- "Just run this command and tell me what it printed."
-- Time-aware behaviour ("what time is it for the user right now?") without baking timezone assumptions into prompts.
-- Letting the agent _notify you_ when it's done with a long-running job.
+- Time-aware behavior ("what time is it for the user right now?") without baking timezone assumptions into prompts.
+- Notifying you when a long-running job is done.
## See also
-- [Coder](coder.md) - for filesystem-heavy work, prefer the dedicated tools over `shell`.
-- [Cron & Scheduling](cron.md) - for anything recurring.
+- [Coder](coder.md): for file-heavy work, prefer the dedicated tools over `shell`.
+- [Cron and scheduling](cron.md): for anything recurring.
diff --git a/docs/gitbooks/en/features/native-tools/voice.md b/docs/gitbooks/en/features/native-tools/voice.md
index c9e73c2334..7eca75a802 100644
--- a/docs/gitbooks/en/features/native-tools/voice.md
+++ b/docs/gitbooks/en/features/native-tools/voice.md
@@ -1,57 +1,57 @@
---
description: >-
- Native voice: speech-to-text in, text-to-speech out, mascot lip-sync, and a
- live voice agent you can interrupt mid-sentence.
+ Speech-to-text in, text-to-speech out, mascot lip-sync, and a live voice
+ agent you can interrupt mid-sentence.
icon: microphone
---
# Voice
-OpenHuman is voice-first when you want it to be. Dictation, reply speech and the live voice agent are part of the core, not a third-party plugin.
+You can talk to OpenHuman instead of typing. Dictation, spoken replies and the live voice agent are part of the core, not a plugin.
## Speech-to-text
-* **Hotkey** - push-to-talk and toggle modes.
-* **Audio capture** - cross-platform mic capture with voice-activity detection.
-* **Streaming transcription** - words appear as you speak.
-* **Hallucination filter** - strips well-known artefacts ("Thanks for watching", silence-induced phrases).
-* **Postprocess** - punctuation, capitalisation, dictation cleanup.
+- **Hotkey.** Push-to-talk and toggle modes.
+- **Audio capture.** Cross-platform mic capture with voice-activity detection.
+- **Streaming transcription.** Words appear as you speak.
+- **Hallucination filter.** Strips known artifacts such as "Thanks for watching" and phrases invented from silence.
+- **Postprocessing.** Punctuation, capitalization and dictation cleanup.
-Dictation can replace the active text input on your desktop, or be sent straight into a chat with the agent.
+Dictation can replace the active text input on your desktop, or go straight into a chat with the agent.
## Text-to-speech
-Reply speech routes through a hosted TTS model. The agent's responses can be spoken back in a voice you pick, with natural timing and prosody. Voice selection is configurable per user, and the mascot avatar lip-syncs to the audio stream via a viseme map.
+Replies are spoken through a hosted TTS model. The agent can speak back in a voice you pick, with natural timing. Voice selection is set per user, and the mascot lip-syncs to the audio through a viseme map.
## Talk to Tiny live
-Click Tiny, the mascot in the chat composer, and just talk. Tiny listens and answers out loud in real time, and you can cut in mid-sentence. It uses the same tools as typed chat, under the same tool policy, and anything that needs your approval asks in the conversation. What you both say is saved to the conversation you have open, and Tiny knows what you were just typing about.
+Click Tiny, the mascot in the chat composer, and talk. Tiny listens and answers out loud in real time, and you can cut in mid-sentence. It uses the same tools as typed chat under the same tool policy, and anything that needs your approval asks in the conversation. What you both say is saved to the open conversation, and Tiny knows what you were just typing about.
Choose how Tiny's voice runs under **Connections → Voice agents**:
-| Provider | Setup | Notes |
-| ----------------------------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
-| Gemini Live (TinyHumans) | None (default) | One model that hears and speaks. Billed through your TinyHumans balance. |
-| ElevenLabs Agent (TinyHumans) | None | Hosted ElevenLabs voice with OpenHuman as its brain. |
-| Gemini Live (Google API key) | Your Google AI Studio key | Talks to Google directly. |
-| Sarvam AI | Your Sarvam key | Indian languages (Hindi, Tamil, Bengali and more, or automatic detection). Sarvam's speech recognition, chat model and voices work together. |
+| Provider | Setup | Notes |
+| --- | --- | --- |
+| Gemini Live (TinyHumans) | None (default) | One model that hears and speaks. Billed through your TinyHumans balance. |
+| ElevenLabs Agent (TinyHumans) | None | Hosted ElevenLabs voice with OpenHuman as its brain. |
+| Gemini Live (Google API key) | Your Google AI Studio key | Talks to Google directly. |
+| Sarvam AI | Your Sarvam key | Indian languages (Hindi, Tamil, Bengali and more, or automatic detection). Sarvam's speech recognition, chat model and voices work together. |
Each card has a **Test** button that opens a short session to check the provider. You can also pick the voice, and the language where the provider supports it.
## Privacy
-* Audio capture is local. Where the audio goes next depends on the provider you picked: the managed routes send it to the OpenHuman backend, and a bring-your-own-key provider such as Gemini Live on a Google API key talks to that vendor directly. Either way no recording is retained beyond the live transcript.
-* TTS audio is streamed and discarded: nothing stored.
-* What you and the agent say in a live session is saved to the open conversation, and so reaches your memory engine on the same terms as typed chat, when memory is on.
+- Audio capture is local. Where the audio goes next depends on the provider you picked. Managed routes send it to the OpenHuman backend. A bring-your-own-key provider such as Gemini Live on a Google API key talks to that vendor directly. Either way, no recording is kept beyond the live transcript.
+- TTS audio is streamed and discarded. Nothing is stored.
+- What you and the agent say in a live session is saved to the open conversation. When memory is on, it reaches your memory engine on the same terms as typed chat.
-There is no local speech-to-text engine. The bundled whisper build was removed; STT is either the hosted route or a third-party API you bring a key for. Text-to-speech still has a local option (Piper).
+There is no local speech-to-text engine. Speech-to-text is either the hosted route or a third-party API you bring a key for. Text-to-speech still has a local option (Piper).
-## Removed
+## Google Meet
-The **live Google Meet agent** is gone. It joined a call through the old embedded Chromium webview, transcribed it into memory and spoke back as an outbound camera stream. The frontend surface, the `agent_meetings` domain and the join path were all removed; nothing in the shipped build joins a meeting. The second mascot and its per-mascot voice (the "meeting duo") survive as [mascot](../mascot.md) settings.
+The live Google Meet agent has been removed. Nothing in the shipped build joins a meeting. The second mascot and its per-mascot voice remain as [mascot](../mascot/README.md) settings.
## See also
-* [The Mascot](../mascot.md): the face that lip-syncs to this audio.
-* [Memory](../memory.md): where a spoken conversation ends up.
-* [Automatic Model Routing](../model-routing/): live turns want `hint:fast`.
+- [The mascot](../mascot/README.md): the face that lip-syncs to this audio.
+- [Memory](../memory.md): where a spoken conversation ends up.
+- [Automatic model routing](../model-routing/README.md): live turns want `hint:fast`.
diff --git a/docs/gitbooks/en/features/native-tools/web-scraper.md b/docs/gitbooks/en/features/native-tools/web-scraper.md
index 3d6c693cd0..1534876ec9 100644
--- a/docs/gitbooks/en/features/native-tools/web-scraper.md
+++ b/docs/gitbooks/en/features/native-tools/web-scraper.md
@@ -1,78 +1,66 @@
---
description: >-
- The `web_fetch` tool: a single-purpose GET-and-read primitive that returns a
- page as Markdown rather than raw HTML, behind an allowlist and an SSRF guard.
+ The `web_fetch` tool reads a web page and returns it as Markdown instead of
+ raw HTML, behind an allowlist and an SSRF guard.
icon: globe
---
-# Web Scraper
+# Web scraper
-`web_fetch` is the agent's GET-and-read primitive, deliberately separate from `http_request` and `curl`. It exists because the agent rarely wants the markup: it wants the page. HTML comes back converted to Markdown, with links kept and scripts dropped.
+`web_fetch` is the agent's tool for reading a page. It is separate from `http_request` and `curl` because the agent rarely wants the markup. It wants the page. HTML comes back as Markdown, with links kept and scripts dropped.
-Reach for `http_request` instead when you need POST, custom headers or richer HTTP semantics, and for `curl` when the point is to stream a file to disk.
-
-***
+Use `http_request` when you need POST, custom headers or richer HTTP behavior. Use `curl` to stream a file to disk.
## Arguments
-| Argument | Required | Effect |
-| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `url` | Yes | An absolute `http` or `https` URL. |
-| `max_bytes` | No | Truncate the body at this many bytes instead of the configured cap. |
-| `raw` | No | Skip the Markdown conversion and return the body as served. It is not a way around the limits: the response cap and any `max_bytes` still truncate, and the result still carries the truncation marker. |
-| `summary_focus` | No | An OpenHuman addition that steers the [TokenJuice](../token-compression.md) summary toward a topic. |
-
-The tool is read-only and never prompts for approval. Parallel `web_fetch` calls are safe, since a GET is idempotent.
+| Argument | Required | Effect |
+| --- | --- | --- |
+| `url` | Yes | An absolute `http` or `https` URL. |
+| `max_bytes` | No | Truncate the body at this many bytes instead of the configured cap. |
+| `raw` | No | Skip the Markdown conversion and return the body as served. This does not bypass the limits. The response cap and any `max_bytes` still truncate, and the result still carries the truncation marker. |
+| `summary_focus` | No | Steers the [TokenJuice](../token-compression.md) summary toward a topic. |
-Conversion is driven by the response `Content-Type`, falling back to content sniffing when the header is absent. A response that is explicitly not HTML is returned verbatim.
+The tool is read-only and never asks for approval. Parallel `web_fetch` calls are safe, because a GET is idempotent.
-***
+Conversion follows the response `Content-Type`, and falls back to content sniffing when the header is missing. A response that is explicitly not HTML is returned as is.
## Limits
-| Limit | Value | Where it comes from |
-| -------------------------------------- | ----------------- | ----------------------------------------- |
-| Body cap | 1,000,000 bytes | `[http_request].max_response_size` |
-| Request timeout | 30 seconds | `[http_request].timeout_secs` |
+| Limit | Value | Where it comes from |
+| --- | --- | --- |
+| Body cap | 1,000,000 bytes | `[http_request].max_response_size` |
+| Request timeout | 30 seconds | `[http_request].timeout_secs` |
| Text handed to the model in one result | 24,000 characters | `max_result_size_chars` in `web_fetch.rs` |
-| Redirects followed | None | `redirect::Policy::none()` |
-
-The first two are the shipped defaults in `crates/openhuman-core/src/config/schema/tools/http.rs` and are shared with `http_request`. A `0` in either key is treated as unset and falls back to the default, so a stale zero cannot disable every fetch.
+| Redirects followed | None | `redirect::Policy::none()` |
-Two behaviours are worth knowing:
+The first two are the shipped defaults in `crates/openhuman-core/src/config/schema/tools/http.rs`, shared with `http_request`. A `0` in either key counts as unset and falls back to the default, so a stale zero cannot disable every fetch.
-* **Oversize pages are truncated, not dropped.** The body is cut at a character boundary, never mid-character, and the result header records `download_capped_at=<N>B` so the agent knows it is looking at a partial page. The cap bounds what reaches the model rather than what is downloaded, since the response is read before it is trimmed. Streaming with a hard download ceiling is `curl`'s job, not this tool's.
-* **Past 24,000 characters the remainder is not discarded.** The full extracted page is spilled to an artifact and the result carries the `file_read` call that pages through it.
+- **Oversize pages are truncated, not dropped.** The body is cut at a character boundary, and the result header records `download_capped_at=<N>B` so the agent knows the page is partial. The cap bounds what reaches the model, not what is downloaded, because the response is read before it is trimmed. Streaming with a hard download ceiling is `curl`'s job.
+- **Past 24,000 characters the rest is kept.** The full extracted page is saved as an artifact, and the result carries the `file_read` call that pages through it.
-**Redirects are never followed.** A redirect target can sit on a host the allowlist would refuse, so a 3xx returns as a result naming its `Location` and leaves the decision to the agent. Re-calling `web_fetch` with that URL runs the whole guard again from scratch rather than inheriting the first call's approval.
-
-***
+Redirects are never followed. A redirect target can sit on a host the allowlist would refuse, so a 3xx returns a result naming its `Location` and leaves the decision to the agent. Calling `web_fetch` again with that URL runs the whole guard from scratch.
## The allowlist and the URL guard
-Every fetch passes `tinytools-std`'s URL guard (`vendor/tinyagents/vendor/tinytools/crates/tinytools-std/src/url_guard/`) before any connection is made. It is the same gate `http_request` and `curl` use.
-
-**Shape.** Only `http` and `https` are accepted. URLs carrying whitespace, a backslash, userinfo (`user:pass@`), a percent-encoded authority, or an IPv6 literal host are rejected outright.
-
-**Allowed websites.** `[http_request].allowed_domains` ships as `["*"]`, so research works out of the box. An exact host also matches its subdomains, `"*"` allows all public sites, and an empty list blocks all web access. If every entry is malformed the list fails closed rather than open. Narrow it from the allowed-websites setting described in [Web Search](web-search.md#settings), which writes the same key.
+Every fetch passes the URL guard in `tinytools-std` (`vendor/tinyagents/vendor/tinytools/crates/tinytools-std/src/url_guard/`) before any connection is made. `http_request` and `curl` use the same gate.
-**Address checks.** The guard resolves the hostname and refuses the fetch if any resolved address is non-global: loopback, RFC1918 private, link-local (which covers the cloud metadata address `169.254.169.254`), CGNAT, the unspecified and broadcast ranges, and the IPv6 equivalents including unique-local, link-local and IPv4-mapped forms. Hostnames such as `localhost`, anything ending in `.localhost`, and anything under a `.local` TLD are refused by name. These checks apply even under `"*"`, so the wildcard opens public hosts and never the private network.
+**Shape.** Only `http` and `https` are accepted. URLs with whitespace, a backslash, userinfo (`user:pass@`), a percent-encoded authority or an IPv6 literal host are rejected.
-Under privacy mode's local-only setting the fetch is refused before validation or DNS, so a blocked destination is never even looked up. Rate limiting applies, and the egress disclosure spine records the destination host before the request leaves.
+**Allowed websites.** `[http_request].allowed_domains` ships as `["*"]`, so research works out of the box. An exact host also matches its subdomains. `"*"` allows all public sites, and an empty list blocks all web access. If every entry is malformed, the list fails closed. To narrow it, use the allowed-websites setting described in [Web search](web-search.md#settings), which writes the same key.
-***
+**Address checks.** The guard resolves the hostname and refuses the fetch if any resolved address is non-global. That covers loopback, RFC1918 private, link-local (including the cloud metadata address `169.254.169.254`), CGNAT, unspecified and broadcast ranges, and the IPv6 equivalents including unique-local, link-local and IPv4-mapped forms. Hostnames such as `localhost`, anything ending in `.localhost` and anything under a `.local` TLD are refused by name. These checks apply even under `"*"`, so the wildcard opens public hosts and never the private network.
-## What it's good for
+Under privacy mode's local-only setting, the fetch is refused before validation or DNS, so a blocked destination is never looked up. Rate limiting applies, and the egress disclosure records the destination host before the request leaves.
-* Reading articles, documentation pages and GitHub READMEs without the surrounding noise.
-* Following up on a [Web Search](web-search.md) result.
-* Summarising a single known page on demand.
+## What it is good for
-***
+- Reading articles, documentation pages and GitHub READMEs without the surrounding noise.
+- Following up on a [web search](web-search.md) result.
+- Summarizing a single known page on demand.
## See also
-* [Web Search](web-search.md): finds the URLs to feed this tool, and owns the allowed-websites list.
-* [Smart Token Compression](../token-compression.md): what trims a long page before it reaches the model.
-* [Browser & Computer Control](browser-and-computer.md): for pages that need clicking rather than reading.
-* [Privacy & Security](../privacy-and-security/): the local-only mode and egress disclosure behind the guard.
+- [Web search](web-search.md): finds the URLs to feed this tool, and owns the allowed-websites list.
+- [Token compression](../token-compression.md): what trims a long page before it reaches the model.
+- [Browser and computer control](browser-and-computer.md): for pages that need clicking rather than reading.
+- [Privacy and security](../privacy-and-security.md): the local-only mode and egress disclosure behind the guard.
diff --git a/docs/gitbooks/en/features/native-tools/web-search.md b/docs/gitbooks/en/features/native-tools/web-search.md
index fa9ee981ed..e42129a734 100644
--- a/docs/gitbooks/en/features/native-tools/web-search.md
+++ b/docs/gitbooks/en/features/native-tools/web-search.md
@@ -5,11 +5,11 @@ description: >-
icon: magnifying-glass
---
-# Web Search
+# Web search
-The agent can search the live web, get a grounded answer with citations, and read pages on its own. Out of the box this runs on providers **included with TinyHumans**: [Exa](https://exa.ai) for search and page contents, and [Gemini](https://ai.google.dev) with Google Search grounding for answers. You don't need a search API key for either. You can add more providers with your own key, and several providers can be on at the same time.
+The agent can search the live web, get a grounded answer with citations, and read pages on its own. Out of the box it runs on providers included with TinyHumans: [Exa](https://exa.ai) for search and page contents, and [Gemini](https://ai.google.dev) with Google Search grounding for answers. You do not need a search API key for either. You can add more providers with your own key, and several can be on at once.
-## What it's good for
+## What it is good for
- Research: "what's the latest on X".
- Citation hunting: "find me three sources for Y".
@@ -18,15 +18,15 @@ The agent can search the live web, get a grounded answer with citations, and rea
## Roles: one tool per job
-The agent sees one tool per **capability role**, whichever providers are on:
+The agent sees one tool per capability role, whichever providers are on:
| Role | Agent tool | What it returns |
| ------------ | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **Search** | `web_search_tool` | Ranked results: title, URL, publish date and an excerpt. |
-| **Answer** | `web_answer_tool` | A written answer grounded in web sources, with citations. With `depth: "deep"` it runs Gemini Deep Research instead, which needs your own Gemini key. |
-| **Contents** | `web_contents_tool` | The extracted text of the URLs it is given. |
+| Search | `web_search_tool` | Ranked results: title, URL, publish date and an excerpt. |
+| Answer | `web_answer_tool` | A written answer grounded in web sources, with citations. With `depth: "deep"` it runs Gemini Deep Research instead, which needs your own Gemini key. |
+| Contents | `web_contents_tool` | The extracted text of the URLs it is given. |
-Each role has an ordered provider list. The first **usable** provider serves the call; if it fails, the next one is tried, and so on. The result says which provider answered and which were skipped, for example `Answer for: … (via Gemini, after Exa)`, and the chat card shows the same "via Gemini, after Exa" note under the answer and its sources. A role with no usable provider has no tool at all, so the agent never sees a tool that can't run.
+Each role has an ordered provider list. The first usable provider serves the call. If it fails, the next one is tried, and so on. The result says which provider answered and which were skipped, for example `Answer for: … (via Gemini, after Exa)`, and the chat card shows the same "via Gemini, after Exa" note under the answer and its sources. A role with no usable provider has no tool at all, so the agent never sees a tool that cannot run.
The default order is:
@@ -40,10 +40,10 @@ Providers that are off are skipped, so with the defaults only Exa and Gemini ser
## Providers and routes
-Every provider has a **route**:
+Every provider has a route:
-- **Included with TinyHumans** (`managed`): the call goes through the TinyHumans backend and is billed to your TinyHumans balance. It needs a signed-in session. No key is stored on your machine.
-- **Own key** (`direct`): the call goes straight from your machine to the provider with your API key.
+- Included with TinyHumans (`managed`): the call goes through the TinyHumans backend and is billed to your TinyHumans balance. It needs a signed-in session. No key is stored on your machine.
+- Own key (`direct`): the call goes straight from your machine to the provider with your API key.
| Provider | Routes | Roles | Notes |
| -------- | ------------------ | ------------------------- | ----------------------------------------------------------------------------------------------------- |
@@ -57,7 +57,7 @@ Every provider has a **route**:
| Seltz | Own key | Search | Off by default. |
| SearXNG | Own instance | Search | Off by default. Uses the URL of your own [SearXNG](https://docs.searxng.org/) instance, not a key. |
-A provider is **usable** when it is on, its route is available (you are signed in for the included route, or a key is saved for the own-key route), and search as a whole is on. The settings page shows this as a badge on each provider: **Ready**, **Needs key**, **Sign in required**, or **Off**.
+A provider is usable when it is on, its route is available (you are signed in for the included route, or a key is saved for the own-key route), and search as a whole is on. The settings page shows this as a badge on each provider: Ready, Needs key, Sign in required or Off.
If you use OpenHuman without signing in (a local session), the included route is unavailable. Turn on a provider with your own key to keep web search working.
@@ -67,13 +67,13 @@ When your TinyHumans balance runs out, included providers stop answering and the
Everything is under **Connections → Search**:
-- **Web search**: one switch turns every search tool on or off.
-- **Providers**: one card per provider with an on/off switch, the route choice (for providers that support both), the API key field for the own-key route, and the instance URL for SearXNG. Gemini always shows its key field, since the key is what enables Deep Research.
-- **Roles**: the provider order for Search, Answer and Contents, with which provider currently serves each role. Move providers up or down, remove fallbacks, add a provider back, or reset a role to its default order.
-- **Allowed websites**: which sites the assistant may open and read through web fetch and the browser tool. This list does not restrict web search.
-- **Advanced → Expose each provider's own tools**: gives the agent each usable provider's own tools (for example Brave news or image search, or Exa's find-similar) rather than one tool per role. This uses more of the context window.
+- Web search: one switch turns every search tool on or off.
+- Providers: one card per provider with an on/off switch, the route choice (for providers that support both), the API key field for the own-key route, and the instance URL for SearXNG. Gemini always shows its key field, since the key is what enables Deep Research.
+- Roles: the provider order for Search, Answer and Contents, with which provider currently serves each role. Move providers up or down, remove fallbacks, add a provider back, or reset a role to its default order.
+- Allowed websites: which sites the assistant may open and read through web fetch and the browser tool. This list does not restrict web search.
+- Advanced → Expose each provider's own tools**: gives the agent each usable provider's own tools (for example Brave news or image search, or Exa's find-similar) rather than one tool per role. This uses more of the context window.
-Keys are stored in `config.toml`. When secret encryption is on, OpenHuman stores them as ciphertext; the OS keyring protects the master encryption key, not the provider keys themselves.
+Keys are stored in `config.toml`. When secret encryption is on, OpenHuman stores them as ciphertext. The OS keyring protects the master encryption key, not the provider keys themselves.
### Configuration file and environment
@@ -105,9 +105,9 @@ Environment overrides:
| Variable | Effect |
| ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| `OPENHUMAN_SEARCH_ENABLED` | Turns search on or off. |
-| `OPENHUMAN_SEARCH_PROVIDERS` | Replaces the provider set, e.g. `exa:managed,gemini,brave`. |
-| `OPENHUMAN_SEARCH_ROUTES` | Changes routes, e.g. `exa=direct,gemini=managed`. |
-| `OPENHUMAN_SEARCH_ROLES` | Sets role orders, e.g. `search=brave\|exa;answer=gemini`. |
+| `OPENHUMAN_SEARCH_PROVIDERS` | Replaces the provider set, for example `exa:managed,gemini,brave`. |
+| `OPENHUMAN_SEARCH_ROUTES` | Changes routes, for example `exa=direct,gemini=managed`. |
+| `OPENHUMAN_SEARCH_ROLES` | Sets role orders, for example `search=brave\|exa;answer=gemini`. |
| `OPENHUMAN_EXA_API_KEY`, `OPENHUMAN_GEMINI_API_KEY`, `OPENHUMAN_BRAVE_API_KEY`, `OPENHUMAN_TAVILY_API_KEY`, `OPENHUMAN_QUERIT_API_KEY`, `OPENHUMAN_PARALLEL_API_KEY`, `OPENHUMAN_SELTZ_API_KEY` | Provider keys. The unprefixed names (`EXA_API_KEY`, `GEMINI_API_KEY`, …) work too. |
Treat environment-provided keys as secrets.
@@ -118,14 +118,14 @@ Besides serving the Search role, an enabled SearXNG instance is exposed to RPC a
## Parallel is own-key only
-Parallel is no longer included with TinyHumans; it works only with your own Parallel key. A saved Parallel key carries over when you upgrade (Parallel stays first for search if it was your chosen engine). A setup that relied on the included Parallel route without a key moves to the included Exa and Gemini providers. `OPENHUMAN_PARALLEL_ROUTE` is ignored.
+Parallel works only with your own Parallel key. A Parallel key saved before this change carries over on upgrade, and Parallel stays first for search if it was your chosen engine. A setup that used the included Parallel route without a key moves to the included Exa and Gemini providers. `OPENHUMAN_PARALLEL_ROUTE` is ignored.
## How it differs from generic HTTP
-A plain `http_request` tool can fetch a URL but can't _find_ one. Web search is the discovery layer: it finds the right URLs, and the Contents role (or the [Web Scraper](web-scraper.md)) reads them.
+A plain `http_request` tool can fetch a URL but cannot find one. Web search finds the right URLs, and the Contents role (or the [web scraper](web-scraper.md)) reads them.
## See also
- [MCP Server](../../developing/mcp-server.md): how `searxng_search` appears to MCP clients.
-- [Web Scraper](web-scraper.md): fetch and clean a specific URL.
-- [Smart Token Compression](../token-compression.md): search snippets are compressed before they reach the model.
+- [Web scraper](web-scraper.md): fetch and clean a specific URL.
+- [Token compression](../token-compression.md): search snippets are compressed before they reach the model.
diff --git a/docs/gitbooks/en/features/notifications-and-activity.md b/docs/gitbooks/en/features/notifications-and-activity.md
index bfb3d2b16d..53b3cc027e 100644
--- a/docs/gitbooks/en/features/notifications-and-activity.md
+++ b/docs/gitbooks/en/features/notifications-and-activity.md
@@ -1,91 +1,82 @@
---
description: >-
- The notification center, the quiet notice tray, and where background work
- now surfaces: everything OpenHuman tells you about, and everything it does
- while you are not watching.
+ The notification center, the notice tray, and where background work shows
+ up: what OpenHuman tells you about, and what it does while you are away.
icon: bell
---
-# Notifications & Activity
+# Notifications and activity
-OpenHuman surfaces two kinds of "what's happening": **notifications** (things you should look at, like an important Slack message, a failed webhook, or a high-priority email) and **activity** (a ledger of what the agent did on its own while you weren't watching).
+OpenHuman shows two kinds of "what is happening". Notifications are things you should look at, like an important Slack message, a failed webhook or a high-priority email. Activity is a record of what the agent did on its own while you were not watching.
-Both live on the **Notifications** page. There is no longer an Activity hub or a Routines screen. Both addresses still resolve, but not to what they used to show: `/activity` redirects to **Settings → Account**, and `/routines` to [Workflows](workflows.md). The notification feeds moved here, and the scheduler moved to Workflows → Schedules.
+Both live on the Notifications page. There is no Activity hub or Routines screen. `/activity` redirects to **Settings → Account**, and `/routines` redirects to [Workflows](workflows.md). The scheduler lives under Workflows → Schedules.
----
-
-## Notification Center
+## Notification center
-The notification center is fed by two independent streams, which render as two stacked sections on the Notifications page.
+Two independent streams feed the notification center. They show as two stacked sections on the Notifications page.
### Integration notifications
-Notifications captured from connected accounts (Gmail, Slack, WhatsApp, Discord, …) are ingested through the `notification.ingest` RPC, persisted to a per-workspace SQLite store, and then **triaged by a local LLM in the background**. Ingest returns immediately; triage runs in a spawned task and back-fills the score a moment later, so a freshly arrived item can briefly show as unscored.
-
-Triage assigns each notification an **action**, which maps to a fixed importance score between 0.0 and 1.0:
+Notifications from connected accounts (Gmail, Slack, WhatsApp, Discord and others) come in through the `notification.ingest` RPC. They are saved to a per-workspace SQLite store, then triaged by a local LLM in the background. Ingest returns immediately. Triage runs in a spawned task and fills in the score a moment later, so a new item can briefly show as unscored.
-| Triage action | Score | What it means |
-| ------------- | ----- | -------------------------------- |
-| `drop` | 0.10 | Noise, not worth surfacing |
-| `acknowledge` | 0.35 | Low value, informational |
-| `react` | 0.65 | Worth a follow-up |
-| `escalate` | 0.90 | High priority, hand to the agent |
+Triage gives each notification an action, which maps to a fixed importance score from 0.0 to 1.0:
-Only `react` and `escalate` are considered "routed" actions; `drop` and `acknowledge` stay quiet. Each ingested item carries a one-sentence `triage_reason` justifying the classifier's call, plus a lifecycle status: **unread → read → acted → dismissed**. Duplicate content received within a 60-second window collapses to a single entry.
+| Triage action | Score | What it means |
+| --- | --- | --- |
+| `drop` | 0.10 | Noise, not worth surfacing |
+| `acknowledge` | 0.35 | Low value, informational |
+| `react` | 0.65 | Worth a follow-up |
+| `escalate` | 0.90 | High priority, hand to the agent |
-### System (core-bridge) notifications
+Only `react` and `escalate` are routed. `drop` and `acknowledge` stay quiet. Each item carries a one-sentence `triage_reason` explaining the call, and a status that moves from unread to read to acted to dismissed. Duplicate content received within 60 seconds collapses into one entry.
-The second stream translates selected internal events into compact, user-facing alerts and pushes them over the socket bridge as they happen. These are persisted before broadcast, so anything fired while the app was closed syncs down on the next open. Each carries a **category** and an in-app deep link:
+### System notifications
-| Source event | Category | Surfaces when |
-| -------------------- | -------- | ----------------------------------------- |
-| Cron job completed | Agents | Always (success or failure) |
-| Webhook processed | System | **Only on failure**; successes are silent |
-| Sub-agent finished | Agents | Always |
-| Sub-agent failed | Agents | Always |
-| Notification triaged | Agents | Only when routed (`escalate`/`react`) |
-| API key rejected | System | Always; links to the LLM settings tab |
+The second stream turns selected internal events into short alerts and pushes them over the socket bridge as they happen. They are saved before they are sent, so anything fired while the app was closed syncs on the next open. Each has a category and an in-app deep link:
-The category set the notification center understands is **messages, agents, skills, system, meetings, reminders, important**. The page shows a filter chip row, but only for the categories that actually appear in the current feed, plus **Mark all read** and **Clear**. Clicking a notification marks it read and follows its deep link. Some core notifications carry **action buttons** and are pinned to the top. The feed holds the most recent 200 items.
+| Source event | Category | Shows when |
+| --- | --- | --- |
+| Cron job completed | Agents | Always (success or failure) |
+| Webhook processed | System | Only on failure. Successes are silent. |
+| Sub-agent finished | Agents | Always |
+| Sub-agent failed | Agents | Always |
+| Notification triaged | Agents | Only when routed (`escalate` or `react`) |
+| API key rejected | System | Always. Links to the LLM settings tab. |
-### Per-provider routing & thresholds
+The categories are messages, agents, skills, system, meetings, reminders and important. The page shows filter chips only for categories present in the current feed, plus **Mark all read** and **Clear**. Clicking a notification marks it read and follows its deep link. Some system notifications have action buttons and are pinned to the top. The feed holds the most recent 200 items.
-Every provider has its own settings (`notification.settings_set`), letting you tune the noise per source:
+### Per-provider routing and thresholds
-| Setting | Effect |
-| ----------------------- | ------------------------------------------------------------------------------ |
-| `enabled` | When off, that provider's notifications are not ingested at all |
-| `importance_threshold` | Minimum score (0.0 to 1.0) to display; `0.0` shows everything |
-| `route_to_orchestrator` | When on, high-importance (`react`/`escalate`) items are forwarded to the agent |
+Each provider has its own settings (`notification.settings_set`), so you can tune the noise per source:
-Auto-routing re-reads the provider's settings the moment before escalating, so toggling a setting mid-flight takes effect immediately. A notification is only routed to the agent when its score clears the provider threshold **and** `route_to_orchestrator` is enabled.
+| Setting | Effect |
+| --- | --- |
+| `enabled` | When off, that provider's notifications are not ingested at all. |
+| `importance_threshold` | Minimum score (0.0 to 1.0) to display. `0.0` shows everything. |
+| `route_to_orchestrator` | When on, high-importance (`react` or `escalate`) items are forwarded to the agent. |
-These per-provider settings have no UI today: the page that edited them was removed, so they are set through the RPC or by hand. The per-category preferences gate **ingest**, not just display, which is worth knowing before changing one.
+Auto-routing re-reads the provider's settings just before it escalates, so a change takes effect immediately. A notification goes to the agent only when its score clears the provider threshold and `route_to_orchestrator` is on.
----
+These per-provider settings have no UI today. Set them through the RPC or by hand. They gate ingest, not just display, so keep that in mind before changing one.
## The notice tray
-Separate from the notification center, a quiet tray in the bottom-right corner collects **things you can act on**: a provider key that was rejected, a plan limit reached, a keyring consent prompt. It replaced the full-width banners that used to push the chat down. Repeats of the same problem bump a count rather than stacking, and the tray is in-memory, so it clears on restart.
+A quiet tray in the bottom-right corner collects things you can act on: a rejected provider key, a reached plan limit, a keyring consent prompt. Repeats of the same problem bump a count instead of stacking. The tray lives in memory, so it clears on restart.
-Product announcements arrive separately again, as a modal shown once per signed-in session, with the ids you have already seen remembered.
+Product announcements arrive separately, as a modal shown once per signed-in session. OpenHuman remembers the ids you have already seen.
----
-
-## Where background work surfaces
+## Where background work shows up
| Kind of background work | Where to look |
| --- | --- |
-| Scheduled jobs and their run history | **Workflows → Schedules**. See [Cron & Scheduling](native-tools/cron.md). |
+| Scheduled jobs and their run history | **Workflows → Schedules**. See [Cron and scheduling](native-tools/cron.md). |
| Workflow runs | **Workflows → Runs** |
| Memory belief builds and source syncs | **Connections → Memory → Background** |
| Detached sub-agents and async delegation | The background inbox card in the thread that started them. See [Chat](chat.md). |
-| Everything above, as notifications | The Notifications page, Agents category |
-
----
+| All of the above, as notifications | The Notifications page, Agents category |
## See also
-- [Cron & Scheduling](native-tools/cron.md): the scheduling engine and the agent tools behind the Schedules view.
+- [Cron and scheduling](native-tools/cron.md): the scheduling engine and the agent tools behind the Schedules view.
- [Triggers](integrations/triggers.md): webhooks and inbound events that can raise a notification.
- [Chat](chat.md): where an approval or a sub-agent result lands when you are in the conversation.
diff --git a/docs/gitbooks/en/features/orchestration.md b/docs/gitbooks/en/features/orchestration.md
index 502c3dff4a..0bdc1982cb 100644
--- a/docs/gitbooks/en/features/orchestration.md
+++ b/docs/gitbooks/en/features/orchestration.md
@@ -1,54 +1,57 @@
---
description: >-
OpenHuman is an orchestrator, not a chatbot: durable agent graphs, visual
- workflows, sub-agent fleets, and a split-brain always-on layer, all in one
- coherent stack.
+ workflows, sub-agent fleets and an always-on two-agent layer.
icon: sitemap
---
-# The Orchestrator
+# The orchestrator
<figure><img src="../.gitbook/assets/orchestration.png" alt=""><figcaption><p>OpenHuman orchestrating a fleet of agents.</p></figcaption></figure>
-Most harnesses run one agent in one loop. OpenHuman is built as an **orchestrator**: a stack for coordinating many agents, over long horizons, across machines. It does this durably, observably, and under your control.
-
-Four layers make that real:
+Most harnesses run one agent in one loop. OpenHuman coordinates many agents over long stretches of time, across machines. It does this durably, visibly and under your control. Four layers make that work.
## 1. Graphs, not loops
-Every agent turn runs on [tinyagents](https://github.com/tinyhumansai/tinyagents), our open-source graph engine. Multi-step work compiles to **state-machine graphs with conditional routing**: `plan → execute ⇄ review → finalize` for delegation, phase DAGs for multi-agent workflow runs, and map-reduce fan-out for parallel workers. All of it has **durable checkpointing**. A graph can pause mid-run (for your answer, for an approval, for a restart) and resume exactly where it stopped.
+Every agent turn runs on [tinyagents](https://github.com/tinyhumansai/tinyagents), our open-source graph engine. Multi-step work compiles to state-machine graphs with conditional routing:
-## 2. Sub-agent fleets that don't get lost
+- `plan → execute ⇄ review → finalize` for delegation.
+- Phase DAGs for multi-agent workflow runs.
+- Map-reduce fan-out for parallel workers.
-The orchestrator spawns specialized sub-agents (up to 3 levels deep), reuses compatible idle workers instead of re-spawning, and routes each to the right model tier: heavy reasoning for the core, a fast **burst tier** for low-context workers. Reliability is structural: a no-progress circuit breaker stops loops, and stuck children hand back a `question` (pause + resume on your answer) or an `Incomplete` root-cause summary, never silence. See the [Agent Harness](../developing/architecture/agent-harness.md).
+All of it is checkpointed. A graph can pause mid-run, for your answer, an approval or a restart, and resume exactly where it stopped.
-## 3. Workflows you can see
+## 2. Sub-agent fleets that do not get lost
+
+The orchestrator spawns specialized sub-agents, up to 3 levels deep. It reuses compatible idle workers instead of spawning new ones. It also routes each worker to the right model tier: heavy reasoning for the core, and a fast burst tier for low-context workers.
-[Workflows](workflows.md) lift orchestration out of the chat: the agent _proposes_ a typed graph of triggers, agents, tools and conditions; you review it on a canvas and save it. Runs are durable, approval-gated, and fully inspectable step-by-step, powered by open-source [tinyflows](https://github.com/tinyhumansai/tinyflows).
+Reliability is built in. A no-progress circuit breaker stops loops. A stuck child hands back a `question` (pause and resume on your answer) or an `Incomplete` root-cause summary, never silence. See the [agent harness](../developing/architecture/agent-harness.md).
-## 4. An always-on split brain
+## 3. Workflows you can see
-Inbound traffic hits a **fast reflex agent** that triages in seconds and hands a deep **reasoning core** a concise brief; the core does the multi-step work and delegates to workers. Mid-task steering input can be delivered into a live session, and 20:1 compression keeps week-long sessions bounded.
+[Workflows](workflows.md) move orchestration out of the chat. The agent proposes a typed graph of triggers, agents, tools and conditions. You review it on a canvas and save it. Runs are durable, gated by approvals and inspectable step by step. They run on the open-source [tinyflows](https://github.com/tinyhumansai/tinyflows) engine.
-## What's next
+## 4. An always-on two-agent layer
-The scripted-orchestration idea this page used to advertise, agents writing control flow as small programs in a sandboxed REPL, is **not being built**: the harness dropped that runtime and the tool no longer exists. The substrate above, graphs with checkpointing under a trust model, is the shape orchestration takes.
+Inbound traffic first reaches a fast reflex agent that triages in seconds. It hands a concise brief to a deeper reasoning core, which does the multi-step work and delegates to workers. You can steer a task mid-run, because input can be delivered into a live session. 20:1 compression keeps week-long sessions bounded.
-What is tracked in the open instead: an [agent-to-agent protocol](https://github.com/tinyhumansai/openhuman/issues/3463) so a graph can span instances, and durable swarm task graphs. See the [roadmap](../overview/roadmap.md).
+## What is next
----
+Agents writing control flow as small programs in a sandboxed REPL is not being built. The harness dropped that runtime and the tool no longer exists. Graphs with checkpointing under a trust model are the shape orchestration takes.
+
+Two items are on the [roadmap](../overview/roadmap.md): an agent-to-agent protocol so a graph can span instances, and durable swarm task graphs.
-## Why this differentiates
+## How it differs
-| | Single-agent harnesses (Claude Code, OpenClaw, Hermes) | OpenHuman |
-| --------------- | ------------------------------------------------------ | --------------------------------------------------------------- |
-| Execution model | One loop, one context | Compiled graphs, conditional routing, checkpoint/resume |
-| Parallelism | Manual / plugin | Native sub-agent fleets, map-reduce fan-out, worker reuse |
-| Automation | Scripts & cron | Visual, durable, approval-gated workflows |
-| Always-on | None | Split-brain reflex + reasoning core, mid-task steering |
+| | Single-agent harnesses (Claude Code, OpenClaw, Hermes) | OpenHuman |
+| --- | --- | --- |
+| Execution model | One loop, one context | Compiled graphs, conditional routing, checkpoint and resume |
+| Parallelism | Manual or plugin | Native sub-agent fleets, map-reduce fan-out, worker reuse |
+| Automation | Scripts and cron | Visual, durable, approval-gated workflows |
+| Always-on | None | Reflex agent plus reasoning core, mid-task steering |
## See also
- [Workflows](workflows.md)
-- [Agent Harness](../developing/architecture/agent-harness.md): the developer deep-dive on graphs, breakers, journals.
-- [Agent Coordination tools](native-tools/agent-coordination.md): the user-facing spawn/delegate surface.
+- [Agent harness](../developing/architecture/agent-harness.md): the developer deep dive on graphs, breakers and journals.
+- [Agent coordination tools](native-tools/agent-coordination.md): the spawn and delegate surface.
diff --git a/docs/gitbooks/en/features/os-keyring-and-secret-storage.md b/docs/gitbooks/en/features/os-keyring-and-secret-storage.md
new file mode 100644
index 0000000000..69f8f5631d
--- /dev/null
+++ b/docs/gitbooks/en/features/os-keyring-and-secret-storage.md
@@ -0,0 +1,86 @@
+---
+description: >-
+ How OpenHuman uses the OS keyring to protect local secrets, what stays
+ encrypted on disk, and what the consent prompt asks.
+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:
+
+- **macOS:** Keychain
+- **Windows:** Credential Manager
+- **Linux:** Secret Service (libsecret)
+
+This is the root of trust for local secrets. OpenHuman does not keep user credentials in a plaintext `.env` file or a plaintext config file.
+
+## What goes into the keyring
+
+The 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.
+
+**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.
+
+## What stays encrypted on disk
+
+When OpenHuman saves a sensitive setting locally, it writes the ciphertext to disk and keeps the key in the keyring. That covers:
+
+- BYO API keys for supported providers.
+- Channel and webhook secrets stored in local config.
+- Other locally saved secret settings that desktop features need.
+
+The encryption is authenticated, so OpenHuman detects tampering instead of silently accepting changed ciphertext. In short: the key is in the keyring, the ciphertext is in the file, and plaintext exists only in memory when needed.
+
+## Why this beats plaintext config
+
+Plaintext secrets in config files are a risk if you have a workspace backup, a sync folder or a support bundle. With the keyring as the root secret store:
+
+- You can copy config files without exposing raw credentials.
+- Accidental log or file inspection is less likely to reveal secrets.
+- The decryption key belongs to the platform's credential system, not to a plaintext file the app manages.
+
+This does not replace full-disk encryption or OS account security. It is a narrower, stronger way to handle application secrets.
+
+## Managed integrations and local secrets
+
+In the default managed integration flow, the OpenHuman backend handles third-party OAuth tokens. Your app does not need to keep those provider tokens in plaintext on your machine.
+
+When you choose a bring-your-own-key or direct-mode path, OpenHuman treats those credentials as local secrets. It protects them with the OS keyring and encrypted local storage where needed.
+
+## Migrating from older installs
+
+Older versions could keep local encryption material in a file. Current desktop builds move that material into the OS keyring and keep the encrypted values on disk. You do not need to re-enter your secrets.
+
+## When the keyring is unavailable
+
+Sometimes the keyring cannot be reached. On Linux that can mean no Secret Service daemon. On macOS it can mean keychain access was denied. When that happens, OpenHuman stops and asks before it falls back to local encrypted storage.
+
+1. **Detection.** On startup the core probes the OS keychain. If the probe fails, it classifies the reason (no daemon, locked, denied) and reports a structured `KeyringStatus` through the `openhuman.keyring_consent_status` RPC and the app snapshot.
+2. **Consent prompt.** The first time a secret must be read or written without recorded consent, a modal explains what happened, what "store locally" means and the risks. You can choose:
+ - **Use Local Encrypted Storage:** consent to ChaCha20-Poly1305 encrypted files. The master key is also on disk.
+ - **Retry OS Keychain:** probe again, which helps after you grant OS permission.
+ - **Skip:** decline local storage. Features that need secrets will be unavailable.
+3. **Saved choice.** Your choice is recorded in `app-state.json` (the `keyringConsent` field) and cached in the process. The app probes again on each launch and asks again if the keyring becomes available after a local-only session.
+4. **Settings.** **Settings → Security** shows the active storage mode, keychain availability and failure reason, with buttons to retry or change consent.
+
+### One fallback policy
+
+Auth profiles, config secrets, the wallet mnemonic and the `secrets.enc` backend all call `keyring_consent::policy::check_secret_access()` instead of checking `is_available()` directly. No code path switches storage modes silently.
+
+| Policy decision | Meaning |
+| --- | --- |
+| `Proceed` | The OS keyring is available, or you consented to local encrypted storage. |
+| `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.
+
+## See also
+
+- [Privacy and security](privacy-and-security.md)
+- [Third-party integrations](integrations/README.md)
+- [Local AI (optional)](model-routing/local-ai.md)
diff --git a/docs/gitbooks/en/features/personalization.md b/docs/gitbooks/en/features/personalization.md
index 7d1133b5f1..346def258a 100644
--- a/docs/gitbooks/en/features/personalization.md
+++ b/docs/gitbooks/en/features/personalization.md
@@ -5,27 +5,27 @@ description: >-
icon: brain
---
-# Personalization & Self-Learning
+# Personalization and self-learning
-OpenHuman gets to know you through [memory](memory.md), not a settings form. Three things shape how it behaves toward you, and all three are visible and editable.
+OpenHuman gets to know you through [memory](memory.md), not a settings form. Three things shape how it treats you, and you can see and edit all of them.
## Learnings
-A **learning** is one durable statement: a preference, fact, procedure or correction ("prefers pnpm", "never schedule meetings before 10"). The agent saves one with its `memory` tool (`learn` action) when you state or correct something worth keeping, and you can add your own on **Connections → Memory → Learnings**. Each learning records where it came from (workspace, thread, agent, the tool call). Delete any learning there, or ask the agent to forget it.
+A learning is one durable statement: a preference, fact, procedure or correction, such as "prefers pnpm" or "never schedule meetings before 10". The agent saves one with its `memory` tool (the `learn` action) when you state or correct something worth keeping. You can add your own on **Connections → Memory → Learnings**. Each learning records where it came from (workspace, thread, agent and tool call). Delete any learning there, or ask the agent to forget it.
Learnings live in your selected memory engine, so memory has to be on (see [Engines](memory.md#engines)). Secrets and personal identifiers are scrubbed before storing.
## The memory pack
-Before every turn, OpenHuman recalls a short, token-budgeted *memory pack* from memory: relevant learnings (and beliefs the engine has built from them), documents from your brain, this agent's earlier conversations and, briefly, other agents' turns. The pack is added to that turn's model request only and is never written into the chat, so the agent defaults to your preferences without being asked and the prompt cache is unaffected. Preview it on **Connections → Memory → Ask**. See [How the agent uses memory](memory.md#how-the-agent-uses-memory).
+Before every turn, OpenHuman recalls a short, token-budgeted memory pack. It holds relevant learnings (and beliefs the engine built from them), documents from your brain, this agent's earlier conversations and, briefly, other agents' turns.
+
+The pack goes into that turn's model request only. It is never written into the chat. So the agent follows your preferences without being asked, and the prompt cache is unaffected. Preview the pack on **Connections → Memory → Ask**. See [How the agent uses memory](memory.md#how-the-agent-uses-memory).
## Persona files
-How the agent presents itself (`SOUL.md`, `IDENTITY.md`, `ROLE.md` in your workspace) is separate from memory. These are plain Markdown files you edit directly.
+How the agent presents itself is separate from memory. It comes from `SOUL.md`, `IDENTITY.md` and `ROLE.md` in your workspace. These are plain Markdown files you edit directly.
## See also
-- [Memory](memory.md), the engines, sources and tabs behind all of this.
-- [Memory tools](native-tools/memory-tools.md), how the agent recalls and learns.
-- [Goals & Todos](goals-and-todos.md), the agent's in-session work tracking.
-- [Cron & Scheduling](native-tools/cron.md), the scheduled runs that keep working your workspace between turns.
+- [Memory](memory.md): the engines, sources and tabs behind all of this.
+- [Memory tools](native-tools/memory-tools.md): how the agent recalls and learns.
diff --git a/docs/gitbooks/en/features/platform.md b/docs/gitbooks/en/features/platform.md
index 8a5ac2da53..2b6c4a011f 100644
--- a/docs/gitbooks/en/features/platform.md
+++ b/docs/gitbooks/en/features/platform.md
@@ -1,54 +1,43 @@
---
description: >-
- What OpenHuman ships as (native React + Tauri v2 desktop app with a Rust
- core), supported platforms, and what's in scope today.
+ What OpenHuman ships as (a native desktop app with a Rust core), which
+ platforms it supports, and how it behaves offline and when updating.
icon: layer-plus
---
-# Platform & Availability
+# Platform and availability
-OpenHuman is a native desktop application, not a browser extension, not an Electron wrapper. Built on **React + Tauri v2** with a **Rust core**, it ships small, starts fast, and stays out of the way.
-
----
+OpenHuman is a native desktop app. It is not a browser extension or an Electron wrapper. It is built on React and Tauri v2 with a Rust core, so it ships small, starts fast and stays out of the way.
## Supported platforms
-| Platform | Architectures | Distribution |
-| ----------- | -------------------- | ---------------------------------------------- |
-| **macOS** | Intel, Apple Silicon | `.dmg` installer, Homebrew |
-| **Windows** | x64, ARM64 | `.msi` installer |
-| **Linux** | x64 | AppImage, `.deb`, AUR recipe (`openhuman-bin`) |
+| Platform | Architectures | Distribution |
+| --- | --- | --- |
+| macOS | Intel, Apple Silicon | `.dmg` installer, Homebrew cask (can lag a release) |
+| Windows | x64 | `.msi` or `.exe` installer |
+| Linux | x64, ARM64 | `.deb`, AppImage |
+
+Download from [tinyhumans.ai/openhuman](https://tinyhumans.ai/openhuman) or the [latest release](https://github.com/tinyhumansai/openhuman/releases/latest), or use the install scripts, which check the release's SHA-256. See [INSTALL.md](https://github.com/tinyhumansai/openhuman/blob/main/INSTALL.md).
### Linux AppImage notes
-The Linux AppImage is built for x64 desktops and is the default asset selected
-by the curl installer. On newer distributions, especially builds that tighten
-unprivileged user namespaces or AppArmor defaults, AppImage startup can fail
-before OpenHuman reaches its own crash reporter. Known symptoms include:
+On Debian and Ubuntu the install script picks the `.deb`. Elsewhere it picks the AppImage. On newer distributions that tighten unprivileged user namespaces or AppArmor defaults, the AppImage can fail before OpenHuman reaches its own crash reporter. Known symptoms are:
- `unshare: write failed /proc/self/uid_map: Operation not permitted`
- `Interpreter not found!`
- `cannot execute binary file`
-When that happens, prefer the `.deb` package on Debian/Ubuntu systems. For
-Fedora, openSUSE, and other non-Debian distributions, include the distro
-version, kernel version, GPU/driver stack, and the exact AppImage filename when
-reporting the issue so maintainers can distinguish host restrictions from a
-badly packaged AppImage runtime.
-
----
+If that happens on Debian or Ubuntu, use the `.deb`. On Fedora, openSUSE and other distributions, include the distro version, kernel version, GPU and driver stack, and the exact AppImage filename when you report the problem. That helps maintainers tell host restrictions from a bad AppImage runtime.
## Why native matters
-OpenHuman is built as a native application rather than a web wrapper for three reasons.
-
-**Small footprint.** A fraction of the size of typical communication tools. Starts in under a second and uses minimal memory.
+Native beats a web wrapper for three reasons.
-**Fast startup.** No browser engine to initialize. Ready to accept requests immediately.
+Small footprint. It is a fraction of the size of typical communication tools and uses little memory.
-**OS-level security.** Credentials live in your platform's secure keychain, macOS Keychain, Windows Credential Manager, Linux Secret Service. Sensitive data never sits in browser storage or plain text files. Memory items live in the engine you select.
+Fast startup. There is no browser engine to initialize, so it accepts requests right away.
----
+OS-level security. Credentials live in your platform's secure keychain: macOS Keychain, Windows Credential Manager or Linux Secret Service. Sensitive data never sits in browser storage or plain text files. Memory items live in the engine you select.
## Architecture at a glance
@@ -69,40 +58,24 @@ OpenHuman is built as a native application rather than a web wrapper for three r
└────────────────────────────────────────────────────────┘
```
-The shell is a delivery vehicle (windowing, process lifecycle, IPC). All product logic lives in the Rust core, which runs as a tokio task **inside** the shell process rather than as a separate binary the shell launches. The React frontend talks to it over JSON-RPC on loopback. See [Architecture](../developing/architecture/README.md) for the full picture.
+The shell handles windowing, process lifecycle and IPC. All product logic lives in the Rust core, which runs as a tokio task inside the shell process, not as a separate binary. The React frontend talks to it over JSON-RPC on loopback. See [Architecture](../developing/architecture/README.md) for more.
----
+## Remote and headless use
-## Remote/headless usage
+A Linux server can host the Rust core without a desktop session. In production, you run a remote `openhuman-core` JSON-RPC service and point a local desktop client at its URL with a bearer token.
-Linux servers can host the Rust core without a desktop session. The production
-shape is a remote `openhuman-core` JSON-RPC service plus a local desktop client
-configured with that core URL and bearer token.
-
-A private browser UI is possible for development/preview by serving the Vite
-frontend and pointing it at the remote core, but it is not a full replacement
-for the desktop shell. Native deep links, tray controls, OS keychain access, the
-native iMessage scanner, and screen and window integrations still require the
-Tauri app.
-See [Cloud Deploy](cloud-deploy.md#remote-ui-choices) for the current remote UI
-setup.
-
----
+For development and preview, you can serve the Vite frontend as a private browser UI that points at the remote core. It does not replace the desktop shell. Native deep links, tray controls, OS keychain access, the native iMessage scanner, and screen and window integrations still need the Tauri app. See [Cloud deploy](cloud-deploy.md#remote-ui-choices) for the remote UI setup.
## Real-time communication
-The desktop app maintains a persistent connection to the OpenHuman backend. Responses stream as they are generated; outputs appear progressively, not after a hang. If the network drops, the app reconnects automatically with progressive backoff.
-
----
+The desktop app keeps a persistent connection to the OpenHuman backend. Responses stream as they are generated, so output appears progressively. If the network drops, the app reconnects automatically with increasing backoff.
## Offline behavior
-Your local state persists on your device. Preferences, settings, and connected-source configurations remain available offline. Your workspace files stay readable without a network connection. The [memory engine](memory.md) itself needs connectivity unless you point CortexDB at a local endpoint.
-
-Source sync and live LLM calls require connectivity. When the network returns, the next scheduled sync picks up where it left off.
+Your local state stays on your device. Preferences, settings and connected-source configurations remain available offline, and your workspace files stay readable. The [memory engine](memory.md) needs a connection unless you point CortexDB at a local endpoint.
----
+Source sync and live LLM calls need a connection. When the network returns, the next scheduled sync picks up where it left off.
## Auto-update
-The desktop shell auto-updates itself via Tauri's updater plugin against a manifest published on GitHub Releases. The core is linked into the shell, so a shell update upgrades both; there is no separate core update. Details, including the retry policy and why a signature failure is never retried, are in [Auto-update](../overview/auto-update.md).
+The desktop shell updates itself through Tauri's updater plugin, using a manifest published on GitHub Releases. The core is linked into the shell, so one update upgrades both. Details, including the retry policy and why a signature failure is never retried, are in [Auto-update](../overview/auto-update.md).
diff --git a/docs/gitbooks/en/features/privacy-and-security.md b/docs/gitbooks/en/features/privacy-and-security.md
new file mode 100644
index 0000000000..f7b7d4100e
--- /dev/null
+++ b/docs/gitbooks/en/features/privacy-and-security.md
@@ -0,0 +1,101 @@
+---
+description: >-
+ Where your memory is stored, what stays on your machine, what the backend
+ brokers, and which protections are on by default.
+icon: shield
+---
+
+# Privacy and security
+
+Your workspace files, settings and audio buffers stay on your machine. Your memory does not. Memory items are stored in CortexDB, either the hosted CortexDB that TinyHumans runs for you or a CortexDB you point OpenHuman at. The OpenHuman backend brokers the rest of what has to leave the device: LLM calls, OAuth tokens, search proxying and hosted memory.
+
+## Privacy by design
+
+**You choose where memory lives.** [Memory](memory.md) is stored by the engine you select: hosted TinyHumans (CortexDB behind the OpenHuman backend, which needs sign-in) or your own CortexDB endpoint. With neither, memory is off and nothing is stored. Secrets and personal identifiers are scrubbed from every item before it is sent. Tool-call arguments are never stored. You can delete any item. See [Where your memory is stored](#where-your-memory-is-stored).
+
+**Integration tokens stay with the backend, not your laptop.** OAuth tokens are never written to your disk in plaintext. The OpenHuman backend brokers each integration request, and the core never talks to a third-party API directly.
+
+**OS-level credential storage.** Sensitive local secrets are rooted in your platform's secure keychain: macOS Keychain, Windows Credential Manager or Linux Secret Service. See [OS keyring and secret storage](os-keyring-and-secret-storage.md).
+
+**No training on your data.** Your conversations, memories and personal information are never used to train AI models or improve systems.
+
+**Optional [local AI](model-routing/local-ai.md).** To keep embeddings and summary-tree building on your machine, run a local runtime such as Ollama, pull the models yourself and add it as a provider. Learning and reflection passes, and chat if you choose, can move on-device the same way. OpenHuman does not install the runtime or download models.
+
+## What stays on your machine
+
+| 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. |
+| Audio capture buffers | Local. Discarded after speech-to-text. |
+| Local model state | Local. |
+
+## Where your memory is stored
+
+Memory items are your brain documents, logged conversation turns, learnings, and the facts and beliefs the engine builds from them. They are stored in CortexDB, never in a database on your machine. Which CortexDB depends on the engine:
+
+| Engine | Path | Who can reach it |
+| --- | --- | --- |
+| TinyHumans (hosted) | The core sends each request over TLS to the TinyHumans backend's `/memory/*` routes, authenticated with your session or TinyHumans API key. The backend applies a per-user rate limit and billing, then forwards to a CortexDB proxy that places every scope under your own tenant root. | Only your account. The proxy derives the tenant from your credential, not from the request, so one user cannot read or write another's memory. TinyHumans operates the service. |
+| CortexDB (direct) | The core calls CortexDB itself (`api-v1.cortexdb.ai`, or a self-hosted endpoint) with your own CortexDB API key, kept in the OS keychain. It does not go through the TinyHumans backend. | Whoever holds that key, and the operator of that endpoint. |
+
+Inside either engine, memory sits below a root derived from the active config identity: `org:<id>` for a TinyHumans account, or `org:local-<digest>` for a local identity. On hosted memory this is the tenant root the backend pins, so paths read `org:<id>/ws:main/…`. That way memory can be listed, confined and erased as one tree. Your agents share learnings and the brain. Each agent's conversations are tagged with that agent.
+
+We claim only TLS in transit and per-user tenant isolation for hosted memory. These docs do not promise end-to-end or client-side encryption. The hosted service can read what it stores, which is how it answers recall.
+
+### Deleting memory
+
+- **One item:** use **Forget** in the Memory page's **Explorer**, on a memory chip under an answer, on the **Learnings** tab, or through the agent's `memory` tool (`forget`).
+- **One source:** use **Forget source** on the **Brain** tab, or tick **Also delete memory from this source** when you disconnect an integration.
+- **Everything:** call the `openhuman.memory_erase_all` RPC (`{"confirm": true}`). It erases all memory the selected engine holds, for good. On hosted memory it calls the backend's `DELETE /memory`, which erases your whole tenant. On a direct CortexDB it erases your own `org:<id>` tree (and the earlier `user:<id>` tree while it is still read). Memory written there before the per-user layout, which other accounts on a self-hosted CortexDB may share, is left for you to delete through your CortexDB account or endpoint. The **Settings** tab of the Memory page has an **Erase memory** card that calls the same RPC after you confirm.
+
+Signing out does not delete stored memory. Neither does disconnecting an integration, unless you tick that box.
+
+## What the OpenHuman backend handles
+
+| Area | What the backend does |
+| --- | --- |
+| LLM calls | Proxies them under one subscription, then forwards to the underlying provider (Anthropic, OpenAI, Google and others) per the [model router](model-routing/README.md). |
+| Web search proxy | The native [web search tool](native-tools/web-search.md) can use the backend proxy, so you do not carry a search API key. Only Exa and Gemini have a managed route. Brave, Querit, Tavily, Seltz, Parallel, TinyFish and Gemini Deep Research are bring-your-own-key and go directly to that provider. SearXNG goes to the instance you configured. With Tavily selected, the `tavily_extract` tool also sends extraction requests, including the URLs being extracted, directly to Tavily. |
+| Integration OAuth and tool proxy | Stores tokens and brokers rate-limited requests for [the connected integrations](integrations/README.md). |
+| TTS streaming | Streams hosted [text-to-speech](native-tools/voice.md) audio. Audio is generated and discarded, not kept. |
+
+## Permissions and access control
+
+OpenHuman accesses an integration only after you complete its OAuth flow. Each connection has its own scope, and you can revoke any of them at any time from the **Connections** page.
+
+[Memory sources](memory.md) sync on a schedule while they exist. Integration sync is bound by:
+
+- The OAuth scope you granted that integration.
+- A per-provider sync interval (for example, Gmail every 15 minutes by default).
+- A daily budget per connection that caps API usage.
+
+If you revoke a connection, the next sync stops. Items already stored in your memory engine remain until you forget them.
+
+## Why memory is scrubbed and scoped
+
+Memory only helps if it is safe to keep. Every item goes through secret and PII scrubbing before it is stored. Conversations record tool-call names and ids but never arguments. The agent only sees what a recall or fetch returns at the moment of a turn. You can inspect and delete items from **Connections → Memory** (see [Deleting memory](#deleting-memory)). Scrubbing and scoped retrieval together form the privacy architecture.
+
+## Security
+
+**Encrypted in transit.** All communication between the app and the OpenHuman backend uses TLS. So do hosted memory requests and direct calls to CortexDB's managed API. A self-hosted CortexDB endpoint is only as protected as the URL you configure.
+
+**Key in keyring, ciphertext on disk.** For local secrets that must be saved in app files, OpenHuman stores encrypted ciphertext on disk and keeps the master decryption key in the OS keyring. See [OS keyring and secret storage](os-keyring-and-secret-storage.md).
+
+**Sandboxed execution.** Shell commands and code the agent runs go through a sandbox backend chosen per session: none, the OS jail (Landlock on Linux, Seatbelt on macOS), or a Docker container with no network, dropped capabilities and a read-only root filesystem by default. Skills are not sandboxed separately. A skill runs as its own agent session under the same execution policy as any other turn.
+
+**Working-folder-scoped tools.** The native [filesystem tools](native-tools/coder.md) act inside the agent's working folder. That confinement is part of the autonomy policy, which is off by default. Until you set `[autonomy] enabled = true`, it is not enforced. What is enforced either way is the hard floor: credential stores and system roots. See [Approval gate](approval-gate.md).
+
+**Short-lived tokens.** Authentication tokens between the app and the backend are time-limited.
+
+## Trust and risk signals
+
+OpenHuman has an intelligence layer that helps you judge credibility, information quality and risk across your connected sources.
+
+- **Scam and impersonation signals.** Patterns associated with scams, impersonation or coordinated abuse can surface as warnings. Signals come from patterns, not from sharing individual message content.
+- **Contextual trust.** Trust is contextual. Credibility in one domain does not automatically carry over to another. OpenHuman represents trust through aggregated artifacts and historical accuracy rather than static scores.
+- **Advisory only.** Trust and risk outputs inform your judgment. OpenHuman does not ban users, remove messages or enforce moderation decisions.
+
+## Shared environments
+
+In team or community settings, privacy stays user-centric. Each user's connected sources are scoped to their account, and admins get no backdoor into other users' memory. Community-level intelligence comes from aggregated, anonymized signals, never from direct access to individual message content.
diff --git a/docs/gitbooks/en/features/privacy-and-security/README.md b/docs/gitbooks/en/features/privacy-and-security/README.md
deleted file mode 100644
index dfa6f757fa..0000000000
--- a/docs/gitbooks/en/features/privacy-and-security/README.md
+++ /dev/null
@@ -1,119 +0,0 @@
----
-description: >-
- Where your memory is stored, what stays on your machine, what the backend
- brokers, and which of these layers are enforced by default.
-icon: shield
----
-
-# Privacy & Security
-
-Your workspace files, settings and audio buffers stay on your machine. **Your memory does not**: memory items are stored in CortexDB, either the hosted CortexDB that TinyHumans runs for you or a CortexDB you point OpenHuman at. The OpenHuman backend brokers the rest of what has to leave the device (LLM calls, OAuth tokens, search proxying, hosted memory).
-
-***
-
-## Privacy by Design
-
-**You choose where memory lives.** [Memory](../memory.md) is stored by the engine you select: hosted TinyHumans (CortexDB behind the OpenHuman backend, requires sign-in) or your own CortexDB endpoint. With neither, memory is off and nothing is stored. Secrets and personal identifiers are scrubbed from every item before it is sent, tool-call arguments are never stored, and you can delete any item. See [Where your memory is stored](./#where-your-memory-is-stored) below.
-
-**Integration tokens are held by the backend, not on your laptop.** OAuth tokens are never written to disk in plaintext on your device. The OpenHuman backend brokers each integration request, the core never speaks any third-party API directly.
-
-**OS-level credential storage.** Sensitive local secrets are rooted in your platform's secure keychain, macOS Keychain, Windows Credential Manager, Linux Secret Service. See [OS Keyring & Secret Storage](os-keyring-and-secret-storage.md).
-
-**No training on your data.** Your conversations, your memories, and your personal information are never used to train AI models or improve systems.
-
-**Optional** [**Local AI**](../model-routing/local-ai.md)**.** If you want embeddings and summary-tree building to stay on your machine, run a local runtime such as Ollama, pull the models yourself, and add it as a provider. Learning and reflection passes, and chat if you choose, can be moved on-device the same way. OpenHuman does not install the runtime or download models.
-
-***
-
-## What stays on your machine
-
-| | |
-| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **Memory items** | **Not local with hosted memory.** Stored in CortexDB by your selected engine (see below); a CortexDB you self-host on your own machine keeps it there. |
-| **Memory bookkeeping** | Local: the job queue and sync, backfill and import progress under `<workspace>/memory/`, the sources list in `config.toml`, a CortexDB key in the OS keychain. No memory content. |
-| **Audio capture buffers** | Local. Discarded after STT. |
-| **Local model state** | Local. |
-
-## Where your memory is stored
-
-Memory items are your brain documents, logged conversation turns, learnings, and the facts and beliefs the engine builds from them. They are stored in CortexDB, never in a database on your machine. Which CortexDB depends on the engine:
-
-| Engine | Path | Who can reach it |
-| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **TinyHumans** (hosted) | The core sends each request over TLS to the TinyHumans backend's `/memory/*` routes, authenticated with your session or TinyHumans API key. The backend applies a per-user rate limit and billing, then forwards to a CortexDB proxy that places every scope under your own tenant root. | Only your account. The proxy derives the tenant from your credential, not from the request, so one user cannot read or write another's memory. TinyHumans operates the service. |
-| **CortexDB** (direct) | The core calls CortexDB itself (`api-v1.cortexdb.ai`, or a self-hosted endpoint) with your own CortexDB API key, kept in the OS keychain. It does not go through the TinyHumans backend. | Whoever holds that key, and the operator of that endpoint. |
-
-Inside either engine, memory is kept below a root derived from the active config identity (`org:<id>` for a TinyHumans account, `org:local-<digest>` for a local identity; on hosted memory this is the tenant root the backend pins, so paths read `org:<id>/ws:main/…`), so it can be listed, confined and erased as one tree. Learnings and the brain are shared by your agents; each agent's conversations are tagged with that agent.
-
-We make no claim beyond TLS in transit and per-user tenant isolation for hosted memory. In particular, these docs do not promise end-to-end or client-side encryption: the hosted service can read what it stores, which is how it answers recall.
-
-### Deleting memory
-
-* **One item:** **Forget** in the Memory page's **Explorer**, on a memory chip under an answer, on the **Learnings** tab, or through the agent's `memory` tool (`forget`).
-* **One source:** **Forget source** on the **Brain** tab, or tick **Also delete memory from this source** when disconnecting an integration.
-* **Everything:** the `openhuman.memory_erase_all` RPC (`{"confirm": true}`) erases all memory the selected engine holds, for good. On hosted memory it calls the backend's `DELETE /memory`, which erases your whole tenant. On a direct CortexDB it erases your own `org:<id>` tree (and the earlier `user:<id>` tree while it is still read); memory written there before the per-user layout, which other accounts on a self-hosted CortexDB may share, is left for you to delete with your CortexDB account or endpoint. The **Settings** tab of the Memory page has an **Erase memory** card that calls the same RPC after you confirm.
-
-Signing out does **not** delete stored memory, and neither does disconnecting an integration unless you tick that box.
-
-## What the OpenHuman backend handles
-
-| | |
-| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **LLM calls** | Proxied through the backend under one subscription, then forwarded to the underlying provider (Anthropic / OpenAI / Google / etc.) per the [model router](../model-routing/). |
-| **Web search proxy** | The native [web search tool](../native-tools/web-search.md) can use the backend proxy, so you don't carry a search API key. Only **Exa** and **Gemini** have a managed route; Brave, Querit, Tavily, Seltz, Parallel, TinyFish and Gemini Deep Research are bring-your-own-key and go **directly** to that provider, and SearXNG goes to the instance you configured. With Tavily selected, the `tavily_extract` tool also sends extraction requests, including the URLs being extracted, directly to Tavily. |
-| **Integration OAuth & tool proxy** | Token storage and rate-limited request brokering for [the connected integrations](../integrations/). |
-| **TTS streaming** | Hosted [text-to-speech](../native-tools/voice.md) audio streams. Audio is generated and discarded - not retained. |
-
-***
-
-## Permissions and access control
-
-OpenHuman accesses an integration only after you complete its OAuth flow. Each connection has its own scope; you can revoke any of them at any time from the **Connections** page.
-
-[Memory sources](../memory.md) sync on a schedule while they exist, which is the point. Integration sync is bound by:
-
-* The **OAuth scope** you granted that integration.
-* A **per-provider sync interval** (e.g. Gmail every 15 min by default).
-* A **daily budget** per connection that caps API usage.
-
-If you revoke a connection, the next sync stops; items already stored in your memory engine remain until you forget them.
-
-***
-
-## Why memory is scrubbed and scoped
-
-Memory only helps if it is safe to keep. Every item passes through secret and PII scrubbing before it is stored, conversations record tool-call names and ids but never arguments, and the agent only sees what a recall or fetch returns at the moment of a turn. You can inspect and delete items from **Connections → Memory** (see [Deleting memory](./#deleting-memory)).
-
-Scrubbing and scoped retrieval together become the privacy architecture.
-
-## Security
-
-**Encrypted in transit.** All communication between the application and the OpenHuman backend uses TLS, and so do hosted memory requests and direct calls to CortexDB's managed API. A self-hosted CortexDB endpoint is only as protected as the URL you configure.
-
-**Key in keyring, ciphertext on disk.** For local secrets that must be persisted in app files, OpenHuman stores encrypted ciphertext on disk and keeps the master decryption key in the OS keyring. See [OS Keyring & Secret Storage](os-keyring-and-secret-storage.md).
-
-**Sandboxed execution.** Shell and code the agent runs goes through a sandbox backend chosen per session: none, the OS jail (Landlock on Linux, Seatbelt on macOS), or a Docker container with no network, dropped capabilities and a read-only root filesystem by default. Skills are not separately sandboxed: the in-app JavaScript sandbox was removed, and a skill now runs as its own agent session subject to the same execution policy as any other turn.
-
-**Working-folder-scoped tools.** The native [filesystem tools](../native-tools/coder.md) act inside the agent's working folder. That confinement is part of the autonomy policy, which is **off by default**: until you set `[autonomy] enabled = true` it is not enforced. What is enforced either way is the hard floor, credential stores and system roots. See [Approval Gate](../approval-gate.md).
-
-**Short-lived tokens.** Authentication tokens between the app and the backend are time-limited.
-
-***
-
-## Trust & Risk Intelligence
-
-OpenHuman includes an intelligence layer designed to help you reason about credibility, information quality, and potential risks across your connected sources.
-
-**Scam and impersonation signals.** Behavioral patterns associated with scams, impersonation, or coordinated abuse can surface as warnings. Signals come from patterns, not from sharing individual message content.
-
-**Contextual dynamic trust.** Trust is contextual, credibility in one domain does not automatically transfer to another. OpenHuman represents trust through aggregated artifacts and historical accuracy rather than static scores.
-
-**Advisory, not enforcement.** Trust and risk outputs are advisory signals to inform your judgment. OpenHuman does not ban users, remove messages, or enforce moderation decisions.
-
-***
-
-## Shared environments
-
-In team or community settings, privacy remains user-centric. Each user's connected sources are scoped to their account; admins do not get a backdoor into other users' memory.
-
-Community-level intelligence is derived from aggregated and anonymized signals, never from direct access to individual message content.
diff --git a/docs/gitbooks/en/features/privacy-and-security/os-keyring-and-secret-storage.md b/docs/gitbooks/en/features/privacy-and-security/os-keyring-and-secret-storage.md
deleted file mode 100644
index 536ce091ac..0000000000
--- a/docs/gitbooks/en/features/privacy-and-security/os-keyring-and-secret-storage.md
+++ /dev/null
@@ -1,145 +0,0 @@
----
-description: >-
- The OS keyring as root of trust: what is stored there, what is encrypted on
- disk beside it, and what the consent prompt is asking for.
-icon: key
----
-
-# OS Keyring & Secret Storage
-
-OpenHuman uses the **operating system's secure credential store** to protect the secrets that must live on your device.
-
-On desktop builds, that means:
-
-* **macOS:** Keychain
-* **Windows:** Credential Manager
-* **Linux:** Secret Service / libsecret
-
-This is the root of trust for local secret material. OpenHuman does not rely on a plaintext `.env` file or a plaintext local config file for user credentials.
-
-***
-
-## What goes into the OS keyring
-
-OpenHuman uses the OS keyring for two kinds of local secret material:
-
-### 1. Credential entries
-
-When a feature needs a local credential slot, OpenHuman stores it in the platform keyring rather than writing the raw secret into a normal config file.
-
-Examples include:
-
-* locally stored provider API keys
-* session and bearer tokens that must remain on-device
-* wallet secret material where applicable
-
-These entries are scoped under OpenHuman's own key namespace so they do not collide with unrelated apps.
-
-### 2. The master encryption key
-
-Some sensitive values still need to live **inside local files** because the application configuration itself is file-based.
-
-OpenHuman handles that by splitting storage in two:
-
-* the **secret value on disk** is stored as encrypted ciphertext
-* the **master key used to decrypt it** lives in the OS keyring
-
-This means your local config and state files can contain encrypted values without the decryption key sitting beside them in plaintext.
-
-***
-
-## What stays encrypted on disk
-
-When OpenHuman needs to persist sensitive application settings locally, it writes the **ciphertext** to disk and keeps the key in the OS keyring.
-
-That covers local secrets such as:
-
-* BYO API keys for supported providers
-* channel and webhook secrets stored in local config
-* other locally persisted secret settings required for desktop features
-
-The encryption format is authenticated, so OpenHuman can detect tampering instead of silently accepting modified ciphertext.
-
-In practice, the security model is:
-
-* **key in keyring**
-* **ciphertext in file**
-* **plaintext only in memory when needed**
-
-***
-
-## Why this is better than plaintext config
-
-If your machine has a local workspace backup, sync folder, or support bundle, plaintext secrets in config files are a liability.
-
-Using the OS keyring as the root secret store gives OpenHuman a safer split:
-
-* config files can be copied without exposing raw credentials
-* accidental log or file inspection is less likely to reveal secrets
-* the decryption key is delegated to the platform's credential system rather than to an app-managed plaintext file
-
-This is not a replacement for full-disk encryption or OS account security. It is a narrower, stronger way to handle application secrets.
-
-***
-
-## Managed integrations vs local secrets
-
-Not every secret follows the same path.
-
-### Managed integrations
-
-For the default managed integration flow, third-party OAuth tokens are handled by the OpenHuman backend. Your local app does **not** need to persist those provider tokens in plaintext on your machine.
-
-### Local BYO credentials
-
-When you choose a bring-your-own-key or direct-mode path, OpenHuman treats those credentials as **local secrets** and protects them using the OS keyring plus encrypted-at-rest local storage where needed.
-
-***
-
-## Migration from older installs
-
-Older versions could keep local encryption material in a file-based form.
-
-Current desktop builds migrate that material into the OS keyring and keep the encrypted payloads on disk. The goal is to move the root secret out of ordinary files and into the platform credential store, without requiring users to re-enter every secret by hand.
-
-***
-
-## Consent flow when the keyring is unavailable
-
-Sometimes the OS keyring is unreachable, for example on Linux without a Secret Service daemon, or on macOS when keychain access is denied. When that happens, OpenHuman **stops and asks** before falling back to local encrypted storage.
-
-### How it works
-
-1. **Detection.** On startup the core probes the OS keychain. If the probe fails, it classifies the reason (no daemon, locked, denied) and reports a structured `KeyringStatus` via the `openhuman.keyring_consent_status` RPC and the app snapshot.
-2. **Consent prompt.** The first time a secret must be read or written and no consent has been recorded, a modal overlay explains what happened, what "store locally" means, and what the risks are. The user can:
- * **Use Local Encrypted Storage**: consent to ChaCha20-Poly1305 encrypted files (master key also on disk).
- * **Retry OS Keychain**: re-probe (useful after granting OS permission).
- * **Skip**: decline local storage; features that need secrets will be unavailable.
-3. **Persisted preference.** The choice is recorded in `app-state.json` (`keyringConsent` field) and cached in-process. The app re-probes on each launch and re-prompts if the keyring becomes available after a local-only session.
-4. **Settings visibility.** **Settings → Security** shows the active storage mode, keychain availability, failure reason, and buttons to retry or change consent.
-
-### Unified fallback policy
-
-Auth profiles, config secrets, wallet mnemonic, and the `secrets.enc` backend all call `keyring_consent::policy::check_secret_access()` instead of raw `is_available()`. This ensures no code path silently switches storage modes.
-
-| Policy decision | Meaning |
-| ----------------- | ---------------------------------------------------------- |
-| `Proceed` | OS keyring available, or user consented to local encrypted |
-| `ConsentRequired` | Keyring unavailable, no consent yet; block and prompt |
-| `Declined` | User refused local storage; skip the secret operation |
-
-***
-
-## Platform note
-
-This page describes **desktop** OpenHuman: the Tauri app on macOS, Windows, and Linux.
-
-In development and test environments, the repository may use test-specific overrides so automated runs do not depend on an interactive OS keychain. That is a developer convenience, not the end-user desktop security model.
-
-***
-
-## See also
-
-* [Privacy & Security](./)
-* [Third-party Integrations](../integrations/)
-* [Local AI (optional)](../model-routing/local-ai.md)
diff --git a/docs/gitbooks/en/features/privacy-and-security/privacy-mode.md b/docs/gitbooks/en/features/privacy-and-security/privacy-mode.md
deleted file mode 100644
index d5d47a1b03..0000000000
--- a/docs/gitbooks/en/features/privacy-and-security/privacy-mode.md
+++ /dev/null
@@ -1,59 +0,0 @@
----
-description: >-
- One switch, enforced in the Rust core: local-only mode blocks every cloud
- model call, plus network tools, web search, integrations and cloud embeddings,
- permitting only on-device runtimes (Ollama, LM
-icon: lock
----
-
-# Privacy Mode
-
-Most assistants' privacy stories are a paragraph in a system prompt. OpenHuman's is an **enforcement chokepoint in the Rust core**.
-
-The `[privacy]` config block defines three modes:
-
-| Mode | What it means |
-| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **`standard`** _(default)_ | Normal operation: managed cloud routing, BYO providers, and local models all available. |
-| **`local_only`** | **No inference leaves the device.** Every external chat provider (the managed cloud, BYO cloud keys, even CLI delegates like Claude Code) is refused at construction time, and network tools, web search, integrations, and cloud embeddings are refused at their egress points. Only local runtimes pass: Ollama, LM Studio, MLX, and local OpenAI-compatible endpoints. Voice is the one exception, because no local STT engine exists. |
-| **`sensitive`** | Foundation for the upcoming PII-aware tier (detection, redaction, destination disclosure). Today it behaves like `standard`. |
-
-## Why "enforced" matters
-
-Privacy Mode is deliberately **not** a policy the model is asked to follow. The first check lives in the inference provider factory (`crates/openhuman-core/src/inference/provider/factory/`): under `local_only`, the core refuses to _build_ an external provider at all, and the error names exactly which provider was blocked and tells you how to fix it: switch to a local model, or change the mode in Settings.
-
-That makes the guarantee independent of prompts, agents, tools, or bugs upstream: if a code path anywhere in the app tries to reach a cloud model while you're in local-only mode, it structurally cannot get a client.
-
-Inference is no longer the only chokepoint. `local_only` is also enforced at the egress points where the agent ships your data anywhere else (`crates/openhuman-core/src/security/egress/enforce.rs`):
-
-| Egress point | Behaviour under `local_only` |
-| ---------------------------------------------------------------- | --------------------------------------------------------- |
-| Network tools (`http_request`, `web_fetch`, `curl`) | Refused, with a policy-blocked message in the tool result |
-| Web search (Exa, Tavily) | Refused the same way |
-| Composio tool calls and integration requests | Refused with an error |
-| Cloud embeddings | Refused with an error |
-| Local runtimes (Ollama, LM Studio, MLX, local OpenAI-compatible) | Always permitted, nothing leaves the device |
-
-One deliberate exemption: backend **control-plane** round-trips (sign-in, session, team, billing, and the integration connection-management and catalog reads) keep flowing, because blocking them breaks the app for no privacy gain. They carry auth tokens, ids, and routing metadata, never user content.
-
-**Voice is not covered.** There is no local speech-to-text engine, so dictation and transcription still leave the device under `local_only`: to the hosted OpenHuman STT proxy, or to whichever third-party STT provider you configured. If that matters for your threat model, leave voice off.
-
-Privacy Mode governs **data egress**. It is orthogonal to the [autonomy tiers](../approval-gate.md) (readonly / supervised / full), which govern what the agent may _do_. You can run a fully autonomous agent that never sends a byte of inference off-device.
-
-## Pairing it with local models
-
-Local-only mode is designed to work with [Local AI](../model-routing/local-ai.md). OpenHuman does not install runtimes or download models, so you set these up yourself before turning it on:
-
-* Chat and reasoning on a runtime you run (**Ollama, LM Studio, MLX, OMLX**, or another OpenAI-compatible server), with the models you pulled, added as a provider under **Connections → LLM**.
-* **Piper** text-to-speech, if you install the Piper binary and a voice yourself and set `PIPER_BIN`.
-* Memory stays on a CortexDB endpoint you run yourself; the hosted TinyHumans engine is a cloud call and is blocked by local-only mode.
-
-With local-only on, a workload routed to a runtime that isn't running, or to a model you haven't pulled, fails instead of falling back to the cloud.
-
-See the [Use OpenHuman with a local model](../../guides/guides/local-model.md) guide for a full local setup, and [Keep sensitive data private](../../guides/guides/privacy-sensitive-data.md) for a broader privacy walkthrough.
-
-## See also
-
-* [Privacy & Security](./): the full trust model (approval gate, sandboxing, path roots, command classification).
-* [OS Keyring & Secret Storage](os-keyring-and-secret-storage.md): where credentials live.
-* [Local AI](../model-routing/local-ai.md): the on-device model runtimes.
diff --git a/docs/gitbooks/en/features/privacy-mode.md b/docs/gitbooks/en/features/privacy-mode.md
new file mode 100644
index 0000000000..fdc84a3ad8
--- /dev/null
+++ b/docs/gitbooks/en/features/privacy-mode.md
@@ -0,0 +1,60 @@
+---
+description: >-
+ One switch, enforced in the Rust core. Local-only mode blocks cloud model
+ calls, network tools, web search, integrations and cloud embeddings, and
+ allows only on-device runtimes. Voice is the exception, because there is no
+ local speech-to-text engine.
+icon: lock
+---
+
+# Privacy mode
+
+Most assistants' privacy story is a paragraph in a system prompt. OpenHuman's is an enforcement point in the Rust core.
+
+The `[privacy]` config block defines three modes:
+
+| Mode | What it means |
+| --- | --- |
+| `standard` (default) | Normal operation. Managed cloud routing, BYO providers and local models are all available. |
+| `local_only` | No inference leaves the device. Every external chat provider is refused when it is built: the managed cloud, BYO cloud keys, even CLI delegates like Claude Code. Network tools, web search, integrations and cloud embeddings are refused at their egress points. Only local runtimes pass: Ollama, LM Studio, MLX and local OpenAI-compatible endpoints. Voice is the one exception, because no local speech-to-text engine exists. |
+| `sensitive` | The base for an upcoming PII-aware tier (detection, redaction, destination disclosure). Today it behaves like `standard`. |
+
+## Why enforcement matters
+
+Privacy mode is not a policy the model is asked to follow. The first check lives in the inference provider factory (`crates/openhuman-core/src/inference/provider/factory/`). Under `local_only`, the core refuses to build an external provider at all. The error names the blocked provider and tells you how to fix it: switch to a local model, or change the mode in Settings.
+
+That makes the guarantee independent of prompts, agents, tools or upstream bugs. If any code path tries to reach a cloud model in local-only mode, it cannot get a client.
+
+`local_only` is also enforced at the egress points where the agent sends your data anywhere else (`crates/openhuman-core/src/security/egress/enforce.rs`):
+
+| Egress point | Behavior under `local_only` |
+| --- | --- |
+| Network tools (`http_request`, `web_fetch`, `curl`) | Refused, with a policy-blocked message in the tool result |
+| Web search (Exa, Tavily) | Refused the same way |
+| Composio tool calls and integration requests | Refused with an error |
+| Cloud embeddings | Refused with an error |
+| Local runtimes (Ollama, LM Studio, MLX, local OpenAI-compatible) | Always permitted, nothing leaves the device |
+
+One deliberate exemption: backend control-plane round-trips keep flowing. These are sign-in, session, team, billing, and integration connection management and catalog reads. Blocking them breaks the app for no privacy gain. They carry auth tokens, ids and routing metadata, never user content.
+
+Voice is not covered. There is no local speech-to-text engine, so dictation and transcription still leave the device under `local_only`. They go to the hosted OpenHuman STT proxy, or to whichever third-party STT provider you configured. If that matters for your threat model, leave voice off.
+
+Privacy mode governs data egress. It is separate from the [autonomy tiers](approval-gate.md) (readonly, supervised, full), which govern what the agent may do. You can run a fully autonomous agent that never sends a byte of inference off-device.
+
+## Pairing it with local models
+
+Local-only mode works with [local AI](model-routing/local-ai.md). OpenHuman does not install runtimes or download models, so you set these up yourself before turning it on:
+
+- Chat and reasoning on a runtime you run (Ollama, LM Studio, MLX, OMLX, or another OpenAI-compatible server), with the models you pulled, added as a provider under **Connections → LLM**.
+- Piper text-to-speech, if you install the Piper binary and a voice yourself and set `PIPER_BIN`.
+- Memory on a CortexDB endpoint you run yourself. The hosted TinyHumans engine is a cloud call, so local-only mode blocks it.
+
+With local-only on, a workload routed to a runtime that is not running, or to a model you have not pulled, fails instead of falling back to the cloud.
+
+See [Use OpenHuman with a local model](../guides/local-model.md) for a full local setup, and [Keep sensitive data private](../guides/privacy-sensitive-data.md) for a broader privacy walkthrough.
+
+## See also
+
+- [Privacy and security](privacy-and-security.md): the full trust model (approval gate, sandboxing, path roots, command classification).
+- [OS keyring and secret storage](os-keyring-and-secret-storage.md): where credentials live.
+- [Local AI](model-routing/local-ai.md): the on-device model runtimes.
diff --git a/docs/gitbooks/en/features/settings.md b/docs/gitbooks/en/features/settings.md
index 163fe60230..a021ca4266 100644
--- a/docs/gitbooks/en/features/settings.md
+++ b/docs/gitbooks/en/features/settings.md
@@ -1,52 +1,52 @@
---
description: >-
- The settings surface: what each panel controls, where the autonomy tier
- actually lives, and which old addresses now redirect into Connections.
+ What each Settings panel controls, where the autonomy tier lives, and which
+ old addresses now redirect into Connections.
icon: gear
---
# Settings
-Settings is a two-pane screen: a grouped rail on the left, one panel on the right. It holds the things that change how the app behaves. Things that change what the agent can _reach_ live in [Connections](connections.md), and most of the old settings addresses for those now redirect there.
+Settings is a two-pane screen with a grouped rail on the left and one panel on the right. It holds what changes how the app behaves. What the agent can reach lives in [Connections](connections.md), and most of the old settings addresses for those now redirect there.
Open it with the gear in the sidebar header, or `⌘,`.
## The groups
-**General**
+### General
-| Panel | What it controls |
-| ------------- | ----------------------------------------------------------------------------------------------------------- |
-| **Account** | Who you are signed in as, your plan and usage, team, devices, notifications, and language. |
-| **Privacy** | [Privacy Mode](privacy-and-security/privacy-mode.md) and what may leave the machine. |
-| **Migration** | Moving your data folder, and importing from an earlier version. |
-| **Core** | Point the app at a core running somewhere else: its RPC URL, a bearer token, and a live reachability check. |
-| **Feedback** | Send feedback from inside the app. |
-| **About** | Version, build, licences, and the capability catalogue. |
+| Panel | What it controls |
+| --- | --- |
+| Account | Who you are signed in as, your plan and usage, team, devices, notifications and language. |
+| Privacy | [Privacy mode](privacy-mode.md) and what may leave the machine. |
+| Migration | Moving your data folder, and importing from an earlier version. |
+| Core | Point the app at a core running somewhere else: its RPC URL, a bearer token and a live reachability check. |
+| Feedback | Send feedback from inside the app. |
+| About | Version, build, licenses and the capability catalog. |
-**Appearance**
+### Appearance
-| Panel | What it controls |
-| ---------------- | --------------------------------------------------------------------------------------------------------------------------- |
-| **Appearance** | Font size (including a custom pixel value), layout corners and borders, and language. |
-| **Theme Studio** | Theme family and variant, per-token colours, per-role fonts, backdrop, and your own saved themes. See [Themes](theming.md). |
-| **Personality** | The editable `SOUL.md` prompt and its companion identity file. See [Personalization](personalization.md). |
-| **Face** | Which mascot, its colours, a second "duo" mascot, a custom image, and its voice. See [The Mascot](mascot.md). |
+| Panel | What it controls |
+| --- | --- |
+| Appearance | Font size (including a custom pixel value), layout corners and borders, and language. |
+| Theme Studio | Theme family and variant, per-token colors, per-role fonts, backdrop and your own saved themes. See [Themes](theming.md). |
+| Personality | The editable `SOUL.md` prompt and its companion identity file. See [Personalization](personalization.md). |
+| Face | Which mascot, its colors, a second "duo" mascot, a custom image and its voice. See [The mascot](mascot/README.md). |
-**Security**
+### Security
-| Panel | What it controls |
-| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| **Keychain** | The OS keyring, consent, and what is encrypted at rest. See [OS Keyring & Secret Storage](privacy-and-security/os-keyring-and-secret-storage.md). |
-| **Agent access** | Trusted roots and their read or write grant, the always-allow list, the blanket auto-approve switch, action and tool timeouts, the workspace-only switch, and the tool-call dialect. |
-| **Sandbox** | Which sandbox backend a session gets, and its limits. |
-| **Approval history** | The audit trail of approval decisions and their outcomes. |
+| Panel | What it controls |
+| --- | --- |
+| Keychain | The OS keyring, consent, and what is encrypted at rest. See [OS keyring and secret storage](os-keyring-and-secret-storage.md). |
+| Agent access | Trusted roots and their read or write grant, the always-allow list, the blanket auto-approve switch, action and tool timeouts, the workspace-only switch and the tool-call dialect. |
+| Sandbox | Which sandbox backend a session gets, and its limits. |
+| Approval history | The audit trail of approval decisions and their outcomes. |
## Where the autonomy tier is
-Not in Agent access, which is the first place everyone looks.
+It is not in Agent access, which is where most people look first.
-The tier itself (`readonly`, `supervised`, `full`) has no control in the normal settings navigation. The panel that holds the radios is registered developer-only and as a hidden deep link, so it does not appear in the sidebar. Set the tier in `config.toml`:
+The tier (`readonly`, `supervised` or `full`) has no control in the normal settings navigation. The panel with the radios is developer-only and reachable only as a hidden deep link, so it does not appear in the sidebar. Set the tier in `config.toml`:
```toml
[autonomy]
@@ -54,29 +54,29 @@ enabled = true # off by default; nothing below applies until this is tr
level = "supervised"
```
-`[autonomy] enabled` is `false` out of the box, which means Agent access's trusted roots, the always-allow list and the workspace-only switch are all inert until you turn the policy on. [Approval Gate](approval-gate.md) explains the whole model, including what stays enforced either way.
+`[autonomy] enabled` is `false` out of the box. Until you turn the policy on, the trusted roots, the always-allow list and the workspace-only switch in Agent access do nothing. [Approval gate](approval-gate.md) explains the whole model, including what stays enforced either way.
## Redirects
-Roughly three times as many settings routes redirect as render, because the panels moved into [Connections](connections.md) and the addresses were kept working. Notable ones:
+The panels moved into [Connections](connections.md), and the old addresses still work. Many more settings routes redirect than render. The main ones:
-| Old address | Now |
-| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
-| `/settings/llm`, `/settings/embeddings`, `/settings/voice`, `/settings/search` | Connections, the matching API-keys tab |
-| `/settings/agents/*`, `/settings/tools` | Connections → Tools |
-| `/settings/memory-*`, `/settings/intelligence` | Connections → Memory |
-| `/settings/mcp-server`, `/settings/skills-runner` | Connections → MCP Servers, Connections → Skills |
-| `/settings/wallet-balances` | Connections → Wallet Balances |
-| `/settings/cron-jobs` | Workflows → Schedules |
-| `/settings/automations` | Workflows |
-| `/settings/team`, `/settings/billing`, `/settings/notifications`, `/settings/devices`, `/settings/language` | Settings → Account |
+| Old address | Now |
+| --- | --- |
+| `/settings/llm`, `/settings/embeddings`, `/settings/voice`, `/settings/search` | Connections, the matching API-keys tab |
+| `/settings/agents/*`, `/settings/tools` | Connections → Tools |
+| `/settings/memory-*`, `/settings/intelligence` | Connections → Memory |
+| `/settings/mcp-server`, `/settings/skills-runner` | Connections → MCP Servers, Connections → Skills |
+| `/settings/wallet-balances` | Connections → Wallet Balances |
+| `/settings/cron-jobs` | Workflows → Schedules |
+| `/settings/automations` | Workflows |
+| `/settings/team`, `/settings/billing`, `/settings/notifications`, `/settings/devices`, `/settings/language` | Settings → Account |
## Not here yet
-There is no search across settings: the global search bar was removed, and the per-entry keywords are no longer read by anything. Notification categories gate which events are ingested, but the page that edited them is gone, so they are config-only today.
+Settings has no search. Notification categories gate which events are ingested, but the page that edited them is gone, so they are config-only today.
## See also
-* [Connections](connections.md): everything the agent plugs into.
-* [Approval Gate](approval-gate.md): the autonomy policy these panels configure.
-* [Privacy & Security](privacy-and-security/): the posture behind the privacy panel.
+- [Connections](connections.md): everything the agent plugs into.
+- [Approval gate](approval-gate.md): the autonomy policy these panels configure.
+- [Privacy and security](privacy-and-security.md): the posture behind the privacy panel.
diff --git a/docs/gitbooks/en/features/theming.md b/docs/gitbooks/en/features/theming.md
index 1c8c6a05dd..50dd9e202e 100644
--- a/docs/gitbooks/en/features/theming.md
+++ b/docs/gitbooks/en/features/theming.md
@@ -1,168 +1,148 @@
---
description: >-
- Five theme families with light, dark and auto variants, a visual Theme Studio
- for colours, fonts and backdrops, and Appearance controls for text size,
- corner rounding and borders.
+ Five theme families with light, dark and auto variants, a Theme Studio for
+ colors, fonts and backdrops, and Appearance controls for text size, corner
+ rounding and borders.
icon: palette
---
-# Themes & Theme Studio
+# Themes and Theme Studio
-OpenHuman is re-skinnable at runtime. Every change applies instantly and persists locally, with no restart.
+You can re-skin OpenHuman at runtime. Every change applies instantly, is saved locally and needs no restart.
The controls sit in two places:
-| Page | What you set there |
-| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
-| **Settings → Appearance** (`/settings/appearance`) | Text size, corner rounding, border contrast, per-area borders |
-| **Settings → Theme Studio** (`/settings/theme`) | Theme family, light/dark/auto, every colour token, fonts per role, the backdrop, and custom-theme management |
-
-***
+| Page | What you set there |
+| --- | --- |
+| Settings → Appearance (`/settings/appearance`) | Text size, corner rounding, border contrast, per-area borders |
+| Settings → Theme Studio (`/settings/theme`) | Theme family, light, dark or auto, every color token, fonts per role, the backdrop and custom-theme management |
## Built-in themes
Five families ship in `app/src/lib/theme/presets.ts`, each with a light and a dark variant:
-| Family | Feel | Default variant |
-| ------------ | ------------------------------------------------- | --------------- |
-| **Classic** | The default OpenHuman look. | Light |
-| **Ocean** | Cool blues. | Light |
-| **Sepia** | Warm and paper-like, set in a serif. | Light |
-| **Matrix** | High-contrast green on black, set in a monospace. | Dark |
-| **HAL 9000** | Deep black with a red accent. | Dark |
-
-Each family is applied as **Light**, **Dark** or **Auto**. Auto follows your operating system's `prefers-color-scheme` and re-applies live the moment you flip the OS between light and dark, with no reload.
-
-Classic carries no colour or font overrides of its own on purpose: it is the palette defined in `app/src/styles/tokens.css`, selected by nothing more than the light/dark switch.
+| Family | Feel | Default variant |
+| --- | --- | --- |
+| Classic | The default OpenHuman look. | Light |
+| Ocean | Cool blues. | Light |
+| Sepia | Warm and paper-like, set in a serif. | Light |
+| Matrix | High-contrast green on black, set in a monospace. | Dark |
+| HAL 9000 | Deep black with a red accent. | Dark |
-***
+Each family is applied as Light, Dark or Auto. Auto follows your operating system's `prefers-color-scheme` and re-applies the moment you switch the OS between light and dark, with no reload.
-## Colours
+Classic has no color or font overrides of its own on purpose. It is the palette in `app/src/styles/tokens.css`, chosen by the light and dark switch alone.
-The Theme Studio exposes every colour token, grouped as **Surfaces**, **Text**, **Borders** and **Accent colours**. The four accent ramps (primary, sage, amber, coral) show their `500` shade by default and expand to all eleven shades from `50` to `950`.
+## Colors
-Each token is stored as a space-separated RGB channel triple such as `255 255 255`, not a hex string, because Tailwind wraps every token as `rgb(var(--token) / <alpha-value>)` so opacity modifiers like `bg-surface/50` keep working. The reasoning is recorded at the top of `app/src/styles/tokens.css`.
+The Theme Studio exposes every color token, grouped as Surfaces, Text, Borders and Accent colors. The four accent ramps (primary, sage, amber, coral) show their `500` shade by default and expand to all eleven shades from `50` to `950`.
-A **contrast warning** appears when the luminance gap between `content` and `surface-canvas` falls under 0.2. It is advisory and does not block the change.
+Each token is stored as a space-separated RGB channel triple such as `255 255 255`, not a hex string. Tailwind wraps every token as `rgb(var(--token) / <alpha-value>)`, so opacity modifiers like `bg-surface/50` keep working. The reasoning is at the top of `app/src/styles/tokens.css`.
-***
+A contrast warning appears when the luminance gap between `content` and `surface-canvas` falls under 0.2. It is advisory and does not block the change.
## Fonts
-Five roles can each take a different family:
+Each of five roles can take a different font family:
-| Role | Used for |
-| --------- | --------------------------- |
-| `title` | Display and brand type |
-| `heading` | Section headings |
-| `body` | Everything else |
-| `mono` | Code and fixed-width output |
-| `serif` | Serif passages |
+| Role | Used for |
+| --- | --- |
+| `title` | Display and brand type |
+| `heading` | Section headings |
+| `body` | Everything else |
+| `mono` | Code and fixed-width output |
+| `serif` | Serif passages |
-All five pick from the same six choices in `app/src/lib/theme/tokens.ts` (`FONT_CHOICES`): Inter, Cabinet Grotesk, System UI, Newsreader (serif), Georgia (serif) and JetBrains Mono. A role whose stored stack matches no choice shows a disabled **Current** entry rather than silently snapping to another font.
+All five pick from the same six choices in `app/src/lib/theme/tokens.ts` (`FONT_CHOICES`): Inter, Cabinet Grotesk, System UI, Newsreader (serif), Georgia (serif) and JetBrains Mono. A role whose stored stack matches no choice shows a disabled Current entry instead of silently switching to another font.
-Cabinet Grotesk is not bundled, so every stack naming it resolves to Inter. The name is kept so the intended stack stays legible; see the note in `app/src/styles/tokens.css`.
-
-***
+Cabinet Grotesk is not bundled, so every stack naming it resolves to Inter. The name stays so the intended stack is still readable. See the note in `app/src/styles/tokens.css`.
## Backdrop
-Three kinds, set in the Theme Studio's **Background** card:
+Three kinds, set in the Theme Studio's Background card:
-| Kind | What it paints |
-| ------- | ---------------------------------------------------------------------- |
+| Kind | What it paints |
+| --- | --- |
| `solid` | Nothing of its own: the themed body colour shows through. The default. |
-| `mesh` | An animated, theme-tinted WebGL mesh gradient. |
-| `image` | A cover image from a URL you supply. |
-
-No built-in preset sets a backdrop, so every family starts on `solid` and the animated shader is opt-in. The dotted-canvas overlay that once sat above all three was removed outright rather than defaulted off, so there is no setting to rediscover.
+| `mesh` | An animated, theme-tinted WebGL mesh gradient. |
+| `image` | A cover image from a URL you supply. |
-***
+No built-in preset sets a backdrop, so every family starts on `solid` and the animated shader is opt-in.
## Text size
Four tiers, applied as an inline `font-size` on the root `<html>` element so everything rem-based scales with it:
-| Tier | Size |
-| ----------- | -------------- |
-| Small | 14px |
-| Medium | 16px (default) |
-| Large | 18px |
-| Extra large | 20px |
+| Tier | Size |
+| --- | --- |
+| Small | 14px |
+| Medium | 16px (default) |
+| Large | 18px |
+| Extra large | 20px |
-Beyond the tiers, a **Custom size** number field and slider take any whole pixel value. It is clamped to **12px to 28px** by `clampFontSizePx` in `app/src/store/themeSlice.ts`, which brackets the tiers on both sides: denser than Small, larger than Extra large. A non-finite value falls back to 16. Picking a tile clears the custom value.
-
-***
+A Custom size number field and slider take any whole pixel value. `clampFontSizePx` in `app/src/store/themeSlice.ts` clamps it to 12px to 28px, so you can go denser than Small or larger than Extra large. A non-finite value falls back to 16. Picking a tier clears the custom value.
## Layout
-Three controls in `app/src/lib/theme/layout.ts`, all under Appearance, with a **Reset layout** button that restores every default.
+Three controls in `app/src/lib/theme/layout.ts`, all under Appearance, with a Reset layout button that restores every default.
-**Corner rounding** scales Tailwind's whole radius scale (`--radius-xs` through `--radius-5xl`) by one factor:
+Corner rounding scales Tailwind's whole radius scale (`--radius-xs` through `--radius-5xl`) by one factor:
-| Option | Factor |
-| ------- | ----------------------------------------------------- |
-| None | 0 |
-| Subtle | 0.5 |
+| Option | Factor |
+| --- | --- |
+| None | 0 |
+| Subtle | 0.5 |
| Default | 1 (the variables are removed, so the stylesheet wins) |
-| Round | 1.6 |
+| Round | 1.6 |
Pills and avatars use `rounded-full` rather than a radius token, so they stay round at any setting.
-**Border contrast** adjusts `--line`, `--line-strong` and `--line-subtle`, leaving `--line-chrome` to the theme. The tokens are reset before each change, so levels never compound:
-
-| Option | Effect |
-| ------- | ------------------------------------------------------- |
-| Subtle | Mixes the line tokens 55 percent toward the surface |
-| Default | No change: the theme's own values stand |
-| Strong | Mixes the line tokens 30 percent toward the text colour |
+Border contrast adjusts `--line`, `--line-strong` and `--line-subtle`, and leaves `--line-chrome` to the theme. The tokens reset before each change, so levels never compound:
-**Per-area borders** turn borders off for one area at a time, by setting a `data-borders-<area>="off"` attribute that `app/src/styles/layout-overrides.css` acts on. Four areas:
+| Option | Effect |
+| --- | --- |
+| Subtle | Mixes the line tokens 55 percent toward the surface |
+| Default | No change. The theme's own values stand |
+| Strong | Mixes the line tokens 30 percent toward the text colour |
-| Area | Covers |
-| -------------- | ------------------------------------------- |
-| Cards & panels | Settings cards, grouped sections and panels |
-| Form controls | Text fields, text boxes and dropdowns |
-| Row dividers | Hairlines between rows in lists |
-| Window frame | The edge around the main content area |
+Per-area borders turn borders off for one area at a time. They set a `data-borders-<area>="off"` attribute that `app/src/styles/layout-overrides.css` acts on. There are four areas:
-***
+| Area | Covers |
+| --- | --- |
+| Cards and panels | Settings cards, grouped sections and panels |
+| Form controls | Text fields, text boxes and dropdowns |
+| Row dividers | Hairlines between rows in lists |
+| Window frame | The edge around the main content area |
## Custom themes
-Changing any colour, font or backdrop on a built-in preset forks it into a new custom theme named `<Name> (custom)` and makes that active. The preset stays pristine, so you can start from Ocean, tweak it, and keep both. Forking happens once per source theme.
-
-A custom theme also offers **Reset overrides** (back to the preset it was forked from, or empty if it was not) and **Delete theme**, which falls back to Classic.
+Changing any color, font or backdrop on a built-in preset forks it into a new custom theme named `<Name> (custom)` and makes that active. The preset stays untouched, so you can start from Ocean, tweak it and keep both. Forking happens once per source theme.
-Sharing goes through JSON on the clipboard, not a file. **Copy JSON** puts the whole theme object in your clipboard and also renders it in a read-only text box to copy by hand. Import is a paste field: the JSON needs a `colors` object whose values are all strings, an empty one is accepted, and an unrecognised backdrop kind is dropped rather than failing the import. An imported theme gets a fresh id, so importing never overwrites what you have.
+A custom theme also offers Reset overrides (back to the preset it was forked from, or empty if it was not forked) and Delete theme, which falls back to Classic.
-***
+You share themes as JSON on the clipboard, not as a file. Copy JSON puts the whole theme object on your clipboard and also shows it in a read-only text box to copy by hand. Import is a paste field. The JSON needs a `colors` object whose values are all strings (an empty one is accepted). An unrecognized backdrop kind is dropped instead of failing the import. An imported theme gets a fresh id, so importing never overwrites what you have.
## How a theme is applied
-A theme is just a set of values for the tokens in `app/src/styles/tokens.css`. `applyTheme` in `app/src/providers/ThemeProvider.tsx` writes the active theme's colours and fonts as inline `--token` custom properties on the root `<html>` element, overriding the stylesheet's light and dark blocks at runtime.
+A theme is a set of values for the tokens in `app/src/styles/tokens.css`. `applyTheme` in `app/src/providers/ThemeProvider.tsx` writes the active theme's colors and fonts as inline `--token` custom properties on the root `<html>` element. They override the stylesheet's light and dark blocks at runtime.
-**Presets and fully custom themes are the same mechanism.** There is no per-theme stylesheet class and no `data-theme` attribute. The only class involved is `.dark`, a light/dark base selector that also keeps residual Tailwind `dark:` utilities aligned. Any token a theme leaves out falls through to the stylesheet defaults, and tokens set by a previous theme are cleared on each switch so nothing leaks.
+Presets and fully custom themes use the same mechanism. There is no per-theme stylesheet class and no `data-theme` attribute. The only class involved is `.dark`, a light and dark base selector that also keeps Tailwind `dark:` utilities aligned. Any token a theme leaves out falls through to the stylesheet defaults. Tokens set by a previous theme are cleared on each switch, so nothing leaks.
-Theme state persists through `redux-persist` under the `theme` key in plain `localStorage` rather than `userScopedStorage`, deliberately: the theme is a pre-login, whole-app preference, so it survives switching users instead of being scoped to one.
-
-***
+Theme state persists through `redux-persist` under the `theme` key in plain `localStorage`, not `userScopedStorage`. The theme is a pre-login, whole-app preference, so it survives switching users instead of being scoped to one.
## Not wired
-Two fields in `app/src/store/themeSlice.ts` are persisted but inert. Neither has a UI control, and neither has a consumer:
-
-| Field | State |
-| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `developerMode` | Has a reducer and a `selectDeveloperMode` selector, but nothing dispatches or reads either. Its own doc comment points at a `useDeveloperMode` hook that does not exist. Developer Options gates on core mode instead. |
-| `tabBarLabels` | Has a reducer and no selector at all, so there is not even a readable accessor. |
+Two fields in `app/src/store/themeSlice.ts` are persisted but do nothing. Neither has a UI control or a consumer:
-Both sit in the persist whitelist, so a stale default may sit in `localStorage` doing nothing. Editing either by hand has no visible effect.
+| Field | State |
+| --- | --- |
+| `developerMode` | Has a reducer and a `selectDeveloperMode` selector, but nothing dispatches or reads either. Its doc comment points at a `useDeveloperMode` hook that does not exist. Developer Options gates on core mode instead. |
+| `tabBarLabels` | Has a reducer and no selector, so nothing can read it. |
-***
+Both are in the persist whitelist, so a stale default may sit in `localStorage`. Editing either by hand has no visible effect.
## See also
-* [Theming (contributor reference)](../developing/theming.md): the token taxonomy, Tailwind wiring and component-authoring rules.
-* [The Mascot](mascot.md): the other large piece of OpenHuman's personality.
-* [Platform & Availability](platform.md): which desktop platforms the shell ships on.
+- [Theming (contributor reference)](../developing/theming.md): the token taxonomy, Tailwind wiring and component-authoring rules.
+- [The mascot](mascot/README.md): the other large piece of OpenHuman's personality.
+- [Platform and availability](platform.md): which desktop platforms the shell ships on.
diff --git a/docs/gitbooks/en/features/token-compression.md b/docs/gitbooks/en/features/token-compression.md
index da87406f88..699fa4e6ae 100644
--- a/docs/gitbooks/en/features/token-compression.md
+++ b/docs/gitbooks/en/features/token-compression.md
@@ -1,24 +1,19 @@
---
description: >-
- TokenJuice - a multi-stage compression router that compacts verbose tool
- output before it ever enters LLM context.
+ TokenJuice compacts verbose tool output before it enters the model's
+ context, and keeps the full original recoverable.
icon: file-zipper
---
-# Smart Token Compression
+# Token compression
-LLM tokens are expensive, and verbose tool output is where most of them go to die. A `git status` in a busy repo, a `cargo build` log, a 600-message email thread, a `docker ps -a` against a real cluster. Each can balloon a context window for almost no information gain.
+LLM 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 wired directly into the agent's tool-execution path. Before any tool result reaches a model, TokenJuice classifies it, routes it to a specialized compressor, optionally offloads the full original to a recoverable cache, and records how many tokens (and dollars) it saved.
+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).
-It began as a port of [vincentkoc/tokenjuice](https://github.com/vincentkoc/tokenjuice). That JSON rule overlay is still in here as the log/command compressor, but it has since grown into a multi-stage, content-aware pipeline.
+## The pipeline
----
-
-## The pipeline, step by step
-
-Every blob that flows through the policy-aware TokenJuice tool-output adapters
-takes the same path through the vendored TinyJuice router (`vendor/tinyjuice/src/compress.rs`):
+Every tool result takes the same path through the TinyJuice router (`vendor/tinyjuice/src/compress.rs`):
```text
raw tool result
@@ -48,132 +43,111 @@ raw tool result
compact text → LLM context
```
-1. **Size gate.** If the router is disabled or the input is below `min_bytes_to_compress` (default **2048 bytes**), it passes through untouched. Tiny outputs aren't worth compressing.
-2. **Content detection** (`detect/kind.rs`). The blob is classified into one of seven `ContentKind`s. Precedence: an explicit hint → MIME/extension tag → a per-tool prior (e.g. `grep` → Search, `git_operations` → Diff, `run_tests` → Log) → cheap structural heuristics (JSON → Diff → HTML → Search → Code → Log → PlainText). No regex on the hot path.
-3. **Compressor selection.** Each kind routes to a dedicated compressor, honoring per-kind toggles (`search_enabled`, `code_enabled`, `html_enabled`, `ml_compression_enabled`).
+1. **Size gate.** If the router is off or the input is below `min_bytes_to_compress` (default 2048 bytes), it passes through untouched. Tiny outputs are not worth compressing.
+2. **Content detection** (`detect/kind.rs`). The result is classified into one of seven kinds. The order of precedence is an explicit hint, then a MIME or extension tag, then a per-tool prior (for example `grep` means Search, `git_operations` means Diff, `run_tests` means Log), then cheap structural heuristics (JSON, Diff, HTML, Search, Code, Log, PlainText). There is no regex on the hot path.
+3. **Compressor selection.** Each kind goes to its own compressor, honoring per-kind toggles (`search_enabled`, `code_enabled`, `html_enabled`, `ml_compression_enabled`).
4. **Compression.** The compressor runs. If it declines or its output is no smaller than the input, TokenJuice falls back to the generic compressor or passes the original through. It never makes things bigger.
-5. **CCR offload.** For **lossy** compressions where the original is large enough (`ccr_min_tokens`, default ~500 tokens), the full original is stowed in the **Compress-Cache-Retrieve** store so nothing is permanently lost.
-6. **Recovery marker.** A footer carrying the canonical marker `⟦tj:<hash>⟧` is appended, telling the agent it's looking at a partial view and how to fetch the rest.
-7. **Savings accounting.** Tokens saved and estimated cost saved are recorded, attributed by model and by compressor.
-
----
+5. **CCR offload.** When a compression is lossy and the original is large enough (`ccr_min_tokens`, default about 500 tokens), the full original goes into the Compress-Cache-Retrieve (CCR) store, so nothing is lost for good.
+6. **Recovery marker.** A footer with the marker `⟦tj:<hash>⟧` is appended. It tells the agent the view is partial and how to fetch the rest.
+7. **Savings accounting.** Tokens saved and estimated cost saved are recorded by model and by compressor.
## The compressors
Each content kind has a purpose-built compressor (`vendor/tinyjuice/src/compressors/`):
-| Compressor | Kind | What it does |
-| ---------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **SmartCrusher** | JSON | Re-renders arrays of objects as a compact table; past ~40 rows keeps head + tail + error rows + numeric outliers. |
-| **Code** | Code | Keeps signatures and imports, collapses deep function bodies to `{ … N lines … }` (tree-sitter when available, brace-depth heuristic otherwise). Preserves `TODO`/`FIXME`/`error`/`panic`/`unsafe` markers. |
-| **Log** | Log | For **command output**, delegates to the JSON rule engine (below). For other logs, keeps errors / warnings / stack traces / summaries and drops the noise. |
-| **Search** | Search | Groups grep/ripgrep `path:line:body` hits by file, ranks by query-term density, keeps the top matches per file, and tallies `[+N more]`. |
-| **Diff** | Diff | Keeps changed lines and hunk headers, collapses long unchanged runs to an anchor; lockfile hunks shrink to a one-line `+A/-B` summary. |
-| **Html** | HTML | Strips markup to readable text with sensible block-boundary newlines and entity decoding (allocation-light, no DOM). |
-| **MlText** | PlainText | Opt-in ML salience compression (see below). |
-| **Generic** | fallback | Head/tail summariser for command output that no specific rule matched; declines on structured blobs so they're preserved. |
+| Compressor | Kind | What it does |
+| --- | --- | --- |
+| SmartCrusher | JSON | Re-renders arrays of objects as a compact table. Past about 40 rows it keeps the head, the tail, error rows and numeric outliers. |
+| Code | Code | Keeps signatures and imports and collapses deep function bodies to `{ … N lines … }` (tree-sitter when available, a brace-depth heuristic otherwise). Preserves `TODO`, `FIXME`, `error`, `panic` and `unsafe` markers. |
+| Log | Log | For command output, uses the JSON rule engine (below). For other logs, keeps errors, warnings, stack traces and summaries and drops the noise. |
+| Search | Search | Groups grep and ripgrep `path:line:body` hits by file, ranks by query-term density, keeps the top matches per file and tallies `[+N more]`. |
+| Diff | Diff | Keeps changed lines and hunk headers and collapses long unchanged runs to an anchor. Lockfile hunks shrink to a one-line `+A/-B` summary. |
+| Html | HTML | Strips markup to readable text with sensible block-boundary newlines and entity decoding (allocation-light, no DOM). |
+| MlText | PlainText | Opt-in ML salience compression (see below). |
+| Generic | fallback | Head and tail summary for command output that no specific rule matched. It declines on structured results so they are preserved. |
-Multi-byte text (CJK, emoji, combining marks) is handled grapheme-by-grapheme throughout, never split mid-character.
+Multi-byte text (CJK, emoji, combining marks) is handled grapheme by grapheme and never split mid-character.
----
+## Handle preview and the juice tools (default)
-## Handle preview and the REPL 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 router does not compress to one blob. It stores the original in the CCR cache and shows the model a small preview instead:
-
-- a one-line **stats** description of the shape (estimated tokens, bytes, lines, JSON keys or a Markdown outline, never values),
-- the **first 500 characters**,
+- a one-line stats description of the shape (estimated tokens, bytes, lines, JSON keys or a Markdown outline, never values),
+- the first 500 characters,
- an extractive outline, and
-- a footer naming the **handle** (the CCR token).
+- a footer naming the handle (the CCR token).
The model then queries the stored original with three read-only tools, none of which calls a model:
-| Tool | Does |
-| ---- | ---- |
+| Tool | What it does |
+| --- | --- |
| `juice_find` | `text`, `grep`, `regex`, `rank` (BM25), `sed`, `awk` and `jq` over the output, with a Python-style `scope` slice. |
| `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. Because a handle preview is built without a model call, it also replaces the LLM summary for results big enough to get one, so a slow summarizer cannot stall the turn. The three tools are registered (about 1.5 KB of schema) only while this mode is in effect.
-
-Opt out of the whole feature with `context.compaction_enabled = false` or `OPENHUMAN_COMPACTION=0`. Keep compaction but return to the one-blob compression and `juice_retrieve` with `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.
+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.
----
+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.
## ML compression (opt-in)
-Beyond the deterministic compressors, TokenJuice can route plain text through a **ModernBERT** token-salience model that scores and drops low-information spans. The TinyJuice compressor exposes the optional ML slot, and OpenHuman bridges it to Kompress in `crates/openhuman-core/src/inference/tokenjuice/ml/`.
+Besides the deterministic compressors, TokenJuice can route plain text through a ModernBERT token-salience model that scores and drops low-information spans. TinyJuice exposes the optional ML slot, and OpenHuman connects it to Kompress in `crates/openhuman-core/src/inference/tokenjuice/ml/`.
-- **Off by default.** Enable with `ml_compression_enabled = true` in `[tokenjuice]`.
-- **Runs locally** as the `kompress` backend of the long-running Python host
- process OpenHuman keeps warm for Python-backed models
- (`crates/openhuman-core/src/runtime/python_server/`), reached over a private
- stdio protocol. No data leaves your machine.
-- **Tunable:** `ml_model_id` (default `answerdotai/ModernBERT-base`), `ml_target_ratio` (default `0.5`), `ml_max_input_chars` (default `200000`), `ml_device` (`cpu`/`auto`), `ml_sidecar_idle_timeout_secs`.
-- **Graceful:** if that process is unavailable or an input exceeds the char cap, it degrades to the native compressors without ever failing the agent loop.
-
----
+- Off by default. Enable it with `ml_compression_enabled = true` in `[tokenjuice]`.
+- It runs locally, as the `kompress` backend of the long-running Python host process OpenHuman keeps warm for Python-backed models (`crates/openhuman-core/src/runtime/python_server/`), reached over a private stdio protocol. No data leaves your machine.
+- Tunable keys: `ml_model_id` (default `answerdotai/ModernBERT-base`), `ml_target_ratio` (default `0.5`), `ml_max_input_chars` (default `200000`), `ml_device` (`cpu`/`auto`), `ml_sidecar_idle_timeout_secs`.
+- If that process is unavailable or an input exceeds the character cap, it falls back to the native compressors and never fails the agent loop.
-## Nothing is lost: CCR cache & retrieval
+## Nothing is lost: the CCR cache
-Lossy compression would normally mean throwing data away. TokenJuice instead **offloads** the full original into the **Compress-Cache-Retrieve (CCR)** store and leaves a breadcrumb (`vendor/tinyjuice/src/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/`).
-- **In-memory tier** (always on): a process-global store keyed by SHA-256 hash, bounded by entry count (`max_cache_entries`, default 256) and total bytes (`max_cache_bytes`, default 64 MiB), FIFO eviction.
-- **On-disk tier** (optional): `<workspace>/.tokenjuice/ccr/`, enabled with `ccr_disk_enabled`, survives memory eviction. Optional TTL via `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/line `range`) to pull back the full original or a slice. The token is an unguessable SHA-256 digest.
+- **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.
+- **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.
-So the agent gets the cheap compacted view by default, and can transparently "zoom in" on the full text only when it actually needs it.
-
----
+The agent gets the cheap compacted view by default and can zoom in on the full text only when it needs it.
## Savings tracking
-Every compression is metered by an OpenHuman savings callback (`crates/openhuman-core/src/inference/tokenjuice/savings.rs`). TokenJuice reports events and token deltas; OpenHuman applies the configured default model's input pricing, aggregates `total`, `by_model`, and `by_compressor`, and persists stats to `<workspace>/state/tokenjuice_savings.json`.
+An OpenHuman savings callback meters every compression (`crates/openhuman-core/src/inference/tokenjuice/savings.rs`). TokenJuice reports events and token deltas. OpenHuman applies the configured default model's input pricing, aggregates `total`, `by_model` and `by_compressor`, and saves stats to `<workspace>/state/tokenjuice_savings.json`.
Read them over RPC with `openhuman.tokenjuice_savings_stats`; clear them with `openhuman.tokenjuice_savings_reset`.
----
-
-## The rule overlay (command & log output)
-
-The original three-layer JSON rule overlay still powers the Log/command compressor. Rules merge in order, later layers overriding earlier ones:
+## The rule overlay (command and log output)
-| Layer | Path | Purpose |
-| ----------- | ----------------------------- | ------------------------------------------------------------ |
-| **Builtin** | shipped with the binary | ~96 vendored rules for git, npm, cargo, docker, kubectl, ls… |
-| **User** | `~/.config/tokenjuice/rules/` | personal overrides, apply everywhere |
-| **Project** | `.tokenjuice/rules/` | repo-specific overrides, checked in and shared with the team |
+A three-layer JSON rule overlay powers the log and command compressor. Rules merge in order, and later layers override earlier ones:
-Each rule names a command/tool pattern and a reduction strategy (skip/keep filters, transforms like strip-ANSI and dedupe, head/tail summarize, named counters, canned messages). Rules are JSON. Add one and it applies with no recompile.
+| Layer | Path | Purpose |
+| --- | --- | --- |
+| Builtin | shipped with the binary | About 96 vendored rules for git, npm, cargo, docker, kubectl, ls and more |
+| User | `~/.config/tokenjuice/rules/` | Personal overrides that apply everywhere |
+| Project | `.tokenjuice/rules/` | Repo-specific overrides, checked in and shared with the team |
----
+Each rule names a command or tool pattern and a reduction strategy: skip and keep filters, transforms like strip-ANSI and dedupe, head and tail summaries, named counters and canned messages. Rules are JSON. Add one and it applies with no recompile.
-## Configuration, RPC & tools
+## Configuration, RPC and tools
Everything lives under the `[tokenjuice]` config block (`crates/openhuman-core/src/config/schema/tokenjuice.rs`) and can be changed live.
-- **Master switches:** `context.compaction_enabled` (default `true`; `OPENHUMAN_COMPACTION=0` opts out) and `router_enabled` (default `true`).
-- **Handle preview:** `repl_handle_enabled` (default `true`), `repl_save_enabled` (default `false`).
-- **Thresholds:** `min_bytes_to_compress`, `ccr_min_tokens`.
-- **CCR:** `ccr_enabled`, `ccr_disk_enabled`, `max_cache_entries`, `max_cache_bytes`, `ccr_ttl_secs`.
-- **Per-kind:** `search_enabled`, `code_enabled`, `html_enabled`, plus the `ml_*` keys.
-- **RPC** (`openhuman.tokenjuice_*`): `detect`, `compress` (dry-run the pipeline), `settings_get` / `settings_update` (live partial patch), `cache_stats`, `retrieve`, `savings_stats`, `savings_reset`.
-- **Agent tools:** `juice_retrieve` recovers a whole offloaded original; `juice_find`, `juice_extract` and `juice_summarize` query one by handle. All are read-only.
-- **Debugging:** start the core with `RUST_LOG=openhuman_core::inference::tokenjuice=debug` to watch detection, matching, and how much each blob is trimmed.
-
----
+- Master switches: `context.compaction_enabled` (default `true`; `OPENHUMAN_COMPACTION=0` opts out) and `router_enabled` (default `true`).
+- Handle preview: `repl_handle_enabled` (default `true`) and `repl_save_enabled` (default `false`).
+- Thresholds: `min_bytes_to_compress` and `ccr_min_tokens`.
+- CCR: `ccr_enabled`, `ccr_disk_enabled`, `max_cache_entries`, `max_cache_bytes` and `ccr_ttl_secs`.
+- Per kind: `search_enabled`, `code_enabled`, `html_enabled`, plus the `ml_*` keys.
+- RPC (`openhuman.tokenjuice_*`): `detect`, `compress` (dry-run the pipeline), `settings_get` and `settings_update` (live partial patch), `cache_stats`, `retrieve`, `savings_stats` and `savings_reset`.
+- Agent tools: `juice_retrieve` recovers a whole stored original. `juice_find`, `juice_extract` and `juice_summarize` query one by handle. All are read-only.
+- Debugging: start the core with `RUST_LOG=openhuman_core::inference::tokenjuice=debug` to watch detection, matching and how much each result is trimmed.
## Why this matters
-Agents live or die by their context budget. A single working session can fan out across dozens of tool calls: greps, builds, test runs, `git` output, and large [web-fetch / scrape](native-tools/web-scraper.md) results the agent pulls down. TokenJuice sits on that tool-execution path and compacts each result before it lands in context, so an agent can sweep a noisy repo or a long web page without each step ballooning the window. The savings compound across a session and are metered in real dollars (see [Billing, Cost & Usage](billing-and-usage.md)).
+An agent's context budget is its limit. One working session can fan out across dozens of tool calls: greps, builds, test runs, `git` output and large [web fetch](native-tools/web-scraper.md) results. TokenJuice compacts each result before it lands in context, so an agent can sweep a noisy repo or a long web page without filling the window. The savings add up across a session and are metered in dollars (see [Billing, cost and usage](billing-and-usage.md)).
-> **Scope note.** TokenJuice runs on the agent's **tool results**, not on [memory](memory.md) ingestion. Source sync converts documents itself and does not route payloads through TokenJuice.
-
----
+TokenJuice runs on the agent's tool results, not on [memory](memory.md) ingestion. Source sync converts documents itself and does not route payloads through TokenJuice.
## See also
-- [Available Tools](native-tools/README.md): most heavy tool output flows through TokenJuice.
+- [Native tools](native-tools/README.md): most heavy tool output flows through TokenJuice.
- [Memory](memory.md): ingestion has its own document conversion and scrubbing.
-- [Billing, Cost & Usage](billing-and-usage.md): where token savings show up as real money.
+- [Billing, cost and usage](billing-and-usage.md): where token savings show up as real money.
diff --git a/docs/gitbooks/en/features/wallet.md b/docs/gitbooks/en/features/wallet.md
index 20bdb2d373..a7b5dcae56 100644
--- a/docs/gitbooks/en/features/wallet.md
+++ b/docs/gitbooks/en/features/wallet.md
@@ -1,114 +1,99 @@
---
description: >-
- Local, non-custodial multi-chain crypto wallet the agent can read balances
- from and send transfers with. Keys stay in-core and never cross the wire.
+ A local, non-custodial multi-chain crypto wallet the agent can read balances
+ from and prepare transfers with. Keys stay in the core and never cross the
+ wire.
icon: wallet
---
# Wallet
-A deliberately **basic**, **non-custodial** multi-chain crypto wallet owned by the Rust core. It manages one account per supported chain derived from a single recovery phrase, reads balances, and runs a strict **prepare → confirm → execute** flow for native sends and a small set of token transfers.
+The wallet is a basic, non-custodial multi-chain crypto wallet owned by the Rust core. It keeps one account per supported chain, all derived from a single recovery phrase. It reads balances and runs a strict prepare, confirm, execute flow for native sends and a small set of token transfers.
-It is intentionally minimal: key/account management plus the primitive on-chain operations. Higher-level DeFi (swaps, bridges, generic contract/dapp calls) lives in a separate `web3` module and is **not** part of the wallet's agent or RPC surface.
+It is minimal on purpose: key and account management, plus the primitive on-chain operations. Higher-level DeFi (swaps, bridges, generic contract and dapp calls) lives in a separate `web3` module and is not part of the wallet's agent or RPC surface.
-The most important property to understand: **signing and broadcast happen entirely in-core from the decrypted recovery phrase. No private keys ever leave the device or cross the network.** This is your money, so the wallet is conservative by design.
-
-***
+The key point: signing and broadcast happen entirely in the core, from the decrypted recovery phrase. No private key ever leaves the device or crosses the network. This is your money, so the wallet is conservative by design.
## Supported chains and token standards
-Setup derives **exactly one account per chain**. EVM is a single account reused across six networks. Only the standards listed below are supported for transfers. Anything else (swaps, arbitrary contract calls) is out of scope for the wallet.
-
-| Chain | Networks | Native | Token standard | Notes |
-| ------- | ------------------------------------------------------ | ---------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
-| EVM | Ethereum, Base, Arbitrum, Optimism, Polygon, BNB Chain | ETH / BNB / etc. | ERC-20 (BEP-20 on BNB Chain) | One `Evm` account across all six; network selected per request, defaults to Ethereum mainnet. EIP-1559 / typed-tx signing. |
-| Bitcoin | Mainnet | BTC | None | P2WPKH (native SegWit). **Rejects token transfers.** Esplora REST for balance/broadcast. |
-| Solana | Mainnet / devnet (per RPC) | SOL | SPL | ed25519 signing; native + SPL token transfers. |
-| Tron | Mainnet | TRX | TRC-20 | TronGrid REST for native + TRC-20 transfers. |
+Setup derives exactly one account per chain. The EVM account is reused across six networks. Only the standards below are supported for transfers. Anything else, such as swaps or arbitrary contract calls, is out of scope.
-Built-in asset catalogs include the native asset plus common stablecoins per chain (e.g. USDC/USDT as ERC-20/BEP-20, USDC as SPL on Solana, USDT as TRC-20 on Tron).
+| Chain | Networks | Native | Token standard | Notes |
+| --- | --- | --- | --- | --- |
+| EVM | Ethereum, Base, Arbitrum, Optimism, Polygon, BNB Chain | ETH, BNB and others | ERC-20 (BEP-20 on BNB Chain) | One `Evm` account across all six. The network is chosen per request and defaults to Ethereum mainnet. EIP-1559 and typed-tx signing. |
+| Bitcoin | Mainnet | BTC | None | P2WPKH (native SegWit). Rejects token transfers. Esplora REST for balance and broadcast. |
+| Solana | Mainnet or devnet (per RPC) | SOL | SPL | ed25519 signing. Native and SPL token transfers. |
+| Tron | Mainnet | TRX | TRC-20 | TronGrid REST for native and TRC-20 transfers. |
-***
+The built-in asset catalogs include the native asset plus common stablecoins per chain, for example USDC and USDT as ERC-20 or BEP-20, USDC as SPL on Solana, and USDT as TRC-20 on Tron.
## Onboarding and the recovery phrase
-Setup is a single, all-or-nothing operation: it persists a consent flag, the mnemonic word count, the setup source, exactly one derived account per supported chain, and the encrypted recovery phrase. Valid BIP-39 mnemonic word counts are **12, 15, 18, 21, or 24**.
+Setup is a single, all-or-nothing operation. It saves a consent flag, the mnemonic word count, the setup source, exactly one derived account per supported chain, and the encrypted recovery phrase. Valid BIP-39 word counts are 12, 15, 18, 21 and 24.
-The recovery phrase is the only secret. The wallet stores the per-chain account **addresses** (safe to surface) separately from the secret material, and only the encrypted phrase can reconstruct private keys.
-
-***
+The recovery phrase is the only secret. The wallet stores the per-chain account addresses (safe to show) apart from the secret material. Only the encrypted phrase can rebuild private keys.
## Key custody and security
-The wallet is **non-custodial and local**. There is no server-side key escrow.
-
-* **The recovery phrase is always encrypted at rest.** It is encrypted via the core `encryption` domain before being persisted anywhere.
-* **Preferred home: the OS keychain.** The encrypted phrase lives in the operating system keychain under the key `wallet.mnemonic`, scoped by a workspace-derived user id. Access is gated by the keyring consent policy.
-* **Fallback: workspace JSON.** When the keychain is unavailable (e.g. headless), the encrypted phrase falls back to `{workspace_dir}/state/wallet-state.json`. On load, any JSON-resident secret is transparently **migrated into the keychain** when one becomes available, and stripped from the JSON.
-* **Atomic, guarded writes.** `wallet-state.json` is written atomically (temp file + fsync + persist) under a process-wide lock. Corrupt or invalid state files are quarantined rather than trusted.
-* **Decrypt only at signing time.** Chain signers decrypt the phrase in-core only when deriving a key to sign a confirmed transaction. Plaintext keys are never persisted and never serialized over the wire.
+The wallet is non-custodial and local. There is no server-side key escrow.
-See [OS keyring & secret storage](privacy-and-security/os-keyring-and-secret-storage.md) for how secrets are stored across platforms, and [Privacy & security](privacy-and-security/) for the broader model.
+- The recovery phrase is always encrypted at rest. The core `encryption` domain encrypts it before it is saved anywhere.
+- The preferred home is the OS keychain. The encrypted phrase lives there under the key `wallet.mnemonic`, scoped by a workspace-derived user id. The keyring consent policy gates access.
+- When the keychain is unavailable (for example on a headless machine), the encrypted phrase falls back to `{workspace_dir}/state/wallet-state.json`. When a keychain becomes available, any secret in that JSON is migrated into it and removed from the JSON.
+- Writes to `wallet-state.json` are atomic (temp file, fsync, persist) under a process-wide lock. Corrupt or invalid state files are quarantined, not trusted.
+- Chain signers decrypt the phrase in the core only when deriving a key to sign a confirmed transaction. Plaintext keys are never saved and never sent over the wire.
-***
+See [OS keyring and secret storage](os-keyring-and-secret-storage.md) for how secrets are stored on each platform, and [Privacy and security](privacy-and-security.md) for the broader model.
## Reading balances and chain info
-Read-only surfaces require no confirmation:
+Read-only surfaces need no confirmation:
-* **Status**: onboarding state plus the safe per-chain account addresses.
-* **Balances**: native-asset balances per account. Note: only **EVM balances read live** today (Ethereum mainnet); BTC, Solana, and Tron call their providers but fall back to a zero balance with a "provider missing" status on error.
-* **Network defaults / supported assets**: per-chain RPC and explorer URLs, capability flags, and the built-in asset catalog.
-* **Chain status**: per-chain readiness and the active RPC URL.
+- **Status:** onboarding state plus the safe per-chain account addresses.
+- **Balances:** native-asset balances per account. Only EVM balances read live today (Ethereum mainnet). BTC, Solana and Tron call their providers but fall back to a zero balance with a "provider missing" status on error.
+- **Network defaults and supported assets:** per-chain RPC and explorer URLs, capability flags and the built-in asset catalog.
+- **Chain status:** per-chain readiness and the active RPC URL.
-RPC endpoints are overridable per chain/network via `OPENHUMAN_WALLET_RPC_*` environment variables. URLs are redacted to scheme + host in logs.
+You can override RPC endpoints per chain and network with `OPENHUMAN_WALLET_RPC_*` environment variables. Logs redact URLs to scheme and host.
-***
+## Sending transfers: prepare, confirm, execute
-## Sending transfers: prepare → confirm → execute
+Every write is a two-step, deliberate flow. The wallet never sends in one shot.
-Every write is a two-step, intentional flow. The wallet never sends in one shot.
+1. **Prepare** (`prepare_transfer`) validates the amount, the destination address and (for tokens) the calldata, estimates fees, and returns a prepared quote with a `quoteId`. Quotes sit in an in-memory store with a 5-minute TTL, capped at 64. They are not kept across restarts.
+2. **Confirm and execute** (`execute_prepared`) needs `confirmed: true` and a valid `quoteId`. The quote is consumed atomically before broadcast, so concurrent confirmations cannot double-submit. On failure it is restored with a refreshed TTL, so you can retry.
-1. **Prepare** (`prepare_transfer`): validates the amount, destination address, and (for tokens) calldata, estimates fees, and returns a **prepared quote** with a `quoteId`. Quotes are held in an in-memory store with a **5-minute TTL**, capped at 64, and are **not** persisted across restarts.
-2. **Confirm + execute** (`execute_prepared`): requires `confirmed: true` and a valid `quoteId`. The quote is consumed atomically before broadcast so concurrent confirmations can't double-submit; on failure it's restored with a refreshed TTL so it stays retryable.
+Each quote is bound to the chat thread that prepared it. Only that owner can execute it. A `quoteId` leaked into a shared channel returns the same "not found" error as an unknown id, so another session cannot hijack it.
-**Quote-owner binding.** Each quote is bound to the chat thread that prepared it. A quote can only be executed by the same owner that prepared it; a `quoteId` leaked into a shared channel returns an indistinguishable "not found" error rather than letting another session hijack it.
-
-Transfers are limited to **native sends and the token standards in the table above**. Bitcoin rejects token transfers. Swaps, bridges, and generic contract calls are not available here.
-
-***
+Transfers are limited to native sends and the token standards in the table above. Bitcoin rejects token transfers. Swaps, bridges and generic contract calls are not available here.
## Transaction status tracking
-After broadcast, three read-only inspectors let the agent follow a transaction by hash:
+After broadcast, three read-only tools let the agent follow a transaction by hash:
-* **`tx_status`**: lifecycle state (pending / confirmed / failed / not found).
-* **`tx_receipt`**: receipt details (success, fee, block).
-* **`lookup_tx`**: the raw transaction payload.
-
-***
+- `tx_status`: lifecycle state (pending, confirmed, failed or not found).
+- `tx_receipt`: receipt details (success, fee, block).
+- `lookup_tx`: the raw transaction payload.
## Agent tools and approval safety
The agent reaches the wallet through six tools:
-| Tool | Purpose |
-| ------------------------- | --------------------------------------- |
-| `wallet_status` | Onboarding status + account addresses. |
-| `wallet_chain_status` | Per-chain readiness + active RPC. |
+| Tool | Purpose |
+| --- | --- |
+| `wallet_status` | Onboarding status and account addresses. |
+| `wallet_chain_status` | Per-chain readiness and active RPC. |
| `wallet_prepare_transfer` | Build a validated, fee-estimated quote. |
-| `wallet_tx_status` | Transaction lifecycle state by hash. |
-| `wallet_tx_receipt` | Transaction receipt by hash. |
-| `wallet_lookup_tx` | Raw transaction lookup by hash. |
-
-Notice there is **no agent tool that executes a transfer.** The agent can prepare a quote, but actually moving funds (`execute_prepared`) goes through the RPC surface, where it must be explicitly confirmed and pass the owner-binding check. Combined with the prepare-then-confirm flow and the per-thread quote binding, this keeps the agent from silently spending funds.
+| `wallet_tx_status` | Transaction lifecycle state by hash. |
+| `wallet_tx_receipt` | Transaction receipt by hash. |
+| `wallet_lookup_tx` | Raw transaction lookup by hash. |
-Because these are financial actions, the shape of every write is prepare-then-confirm: a quote is bound to the conversation that asked for it, expires after five minutes, and is consumed when it executes, so two confirmations cannot double-submit. The [approval gate](approval-gate.md) is the second layer, and it only applies once you have turned the autonomy policy on, which is **off by default**. Treat every transfer as a high-stakes action and read that page before relying on the gate.
+No agent tool executes a transfer. The agent can prepare a quote, but moving funds (`execute_prepared`) goes through the RPC surface, where it must be explicitly confirmed and pass the owner-binding check. Together with prepare-then-confirm and per-thread quote binding, this keeps the agent from spending funds silently.
-***
+A quote is bound to the conversation that asked for it, expires after five minutes and is consumed when it executes. The [approval gate](approval-gate.md) is the second layer. It applies only once you turn on the autonomy policy, which is off by default. Treat every transfer as high-stakes and read that page before relying on the gate.
## See also
-* [Approval gate](approval-gate.md)
-* [Privacy & security](privacy-and-security/)
-* [OS keyring & secret storage](privacy-and-security/os-keyring-and-secret-storage.md)
+- [Approval gate](approval-gate.md)
+- [Privacy and security](privacy-and-security.md)
+- [OS keyring and secret storage](os-keyring-and-secret-storage.md)
diff --git a/docs/gitbooks/en/features/workflows.md b/docs/gitbooks/en/features/workflows.md
index 2f6cd451cb..c7281ab0ad 100644
--- a/docs/gitbooks/en/features/workflows.md
+++ b/docs/gitbooks/en/features/workflows.md
@@ -1,8 +1,8 @@
---
description: >-
- Durable, visual automations built on the open-source tinyflows engine. The
- agent proposes a workflow in chat; you review it on a canvas, save it, and it
- runs on schedules or live app events, pausing f
+ Durable, visual automations. The agent proposes a workflow in chat, you
+ review it on a canvas and save it, and it runs on schedules or live app
+ events, pausing for your approval when it matters.
icon: diagram-project
---
@@ -10,58 +10,60 @@ icon: diagram-project
<figure><img src="../.gitbook/assets/workflows.png" alt=""><figcaption><p>A workflow on the visual canvas. The agent proposes the graph; you review each step and save.</p></figcaption></figure>
-Chat is great for one-off asks. **Workflows** are for the things you want done _every time_: triage every new support email, file every Linear ticket that mentions your team, post a digest every Monday at 9. Heavily inspired by [n8n](https://n8n.io) and [Zapier](https://zapier.com), a workflow is a saved, typed graph of steps you can see on a canvas and that runs without you. It is backed by the open-source [tinyflows](https://github.com/tinyhumansai/tinyflows) engine and the same trust and approval machinery as the rest of OpenHuman. The difference from n8n and Zapier: you don't build the graph, the agent does.
+Chat is good for one-off asks. Workflows are for things you want done every time: triage every new support email, file every Linear ticket that mentions your team, post a digest every Monday at 9.
+
+A workflow is a saved, typed graph of steps. You can see it on a canvas, and it runs without you. It is inspired by [n8n](https://n8n.io) and [Zapier](https://zapier.com), and it runs on the open-source [tinyflows](https://github.com/tinyhumansai/tinyflows) engine with the same trust and approval machinery as the rest of OpenHuman. The difference from n8n and Zapier is that you do not build the graph. The agent does.
## The agent builds it, you approve it
-You don't drag boxes to get started. Describe the automation in chat, for example _"whenever a new email arrives from a customer, summarize it and post to my Slack"_, and the agent uses its `propose_workflow` tool to draft a complete workflow graph. The proposal shows up in chat as a **Workflow Proposal Card** with a plain-English summary of every step.
+You do not drag boxes to get started. Describe the automation in chat, for example "whenever a new email arrives from a customer, summarize it and post to my Slack". The agent uses its `propose_workflow` tool to draft a full workflow graph. The proposal appears in chat as a Workflow Proposal Card with a plain-English summary of every step.
-Three design guarantees make this safe:
+Three guarantees keep this safe:
-* The `propose_workflow` tool **only validates and describes** a candidate graph. It can never persist or enable a flow by itself.
-* Every authoring turn is propose-only by default. The usual path from a proposal to a saved workflow is you clicking **Save & enable** on the card, which calls the `flows_create` RPC directly from the app, not from the agent.
-* Nothing the agent can do turns a flow **on**. `flows_set_enabled` is off its belt entirely.
+- `propose_workflow` only validates and describes a candidate graph. It can never save or enable a flow.
+- Every authoring turn is propose-only by default. Normally you click **Save & enable** on the card, which calls the `flows_create` RPC from the app, not from the agent.
+- Nothing the agent can do turns a flow on. `flows_set_enabled` is not one of its tools.
-Persisting is scoped to two explicit asks. `save_workflow` writes the built graph onto an **already-existing** flow, the case when _you_ started the build: the Workflows page prompt bar creates the flow first and opens the copilot on it. When there is no flow yet and you explicitly ask for one ("create this and save it"), the agent may also use `create_workflow`, or `duplicate_flow` to clone a saved flow for clone-then-edit. Both are on the `workflow_builder` agent's named tool list (`crates/openhuman-core/src/flows/agents/workflow_builder/agent.toml`), and both are force-disabled at creation: `CreateWorkflowTool` calls `flows_set_enabled(.., false)` on anything `flows_create` left enabled, and reports the flow's real state rather than the intended one if that second write fails. So a flow the agent creates is born off and stays off until you enable it, and a real test run of a saved flow always needs your confirmation first.
+The agent can save in two explicit cases. `save_workflow` writes the built graph onto an existing flow. That is the case when you started the build: the Workflows page prompt bar creates the flow first and opens the copilot on it. When there is no flow yet and you explicitly ask for one ("create this and save it"), the agent may also use `create_workflow`, or `duplicate_flow` to clone a saved flow so you can edit the copy. Both are on the `workflow_builder` agent's tool list (`crates/openhuman-core/src/flows/agents/workflow_builder/agent.toml`), and both force the flow off at creation. `CreateWorkflowTool` calls `flows_set_enabled(.., false)` on anything `flows_create` left enabled. If that second write fails, it reports the flow's real state, not the intended one. So a flow the agent creates starts off and stays off until you enable it. A real test run of a saved flow always needs your confirmation first.
## What a workflow is made of
-A workflow graph is built from the engine's **22 node kinds**: exactly one `trigger`, plus any mix of `agent` (a full agent turn with tools), `tool_call`, `http_request`, `code` (JavaScript or Python), `shell`, `condition`, `switch`, `transform`, `split_out`, `merge`, `output_parser`, `sub_workflow`, `memory`, `dedup`, `loop`, `spawn`, `gate`, `scatter`, `gather`, `approval`, and `void`.
+A workflow graph uses the engine's 22 node kinds: exactly one `trigger`, plus any mix of `agent` (a full agent turn with tools), `tool_call`, `http_request`, `code` (JavaScript or Python), `shell`, `condition`, `switch`, `transform`, `split_out`, `merge`, `output_parser`, `sub_workflow`, `memory`, `dedup`, `loop`, `spawn`, `gate`, `scatter`, `gather`, `approval` and `void`.
-The canvas palette offers fifteen of them today: `trigger`, `agent`, `tool_call`, `http_request`, `code`, `condition`, `switch`, `merge`, `split_out`, `transform`, `output_parser`, `sub_workflow`, `memory`, `dedup` and `loop`. The other seven are reachable by importing a graph. Two also have no host adapter wired yet: a `shell` node has no runner, and an `approval` node falls back to pausing the run for `flows_resume` rather than raising its own card.
+The canvas palette offers fifteen of them today: `trigger`, `agent`, `tool_call`, `http_request`, `code`, `condition`, `switch`, `merge`, `split_out`, `transform`, `output_parser`, `sub_workflow`, `memory`, `dedup` and `loop`. You can reach the other seven by importing a graph. Two also have no host adapter wired yet. A `shell` node has no runner, and an `approval` node pauses the run for `flows_resume` instead of raising its own card.
-A graph is usually a straight line or a fan-out, but it may also contain a **bounded loop**: a `loop` node emits on its `body` port until its `max_iterations` cap (or an optional `condition`) says stop, then emits on `done`. You close the loop by wiring the body's last node back to the `loop` node. The cap is always finite, and `on_exceeded` decides what reaching it means: `error` fails the run and names the loop, `continue` stops looping and carries the last pass's items out through `done`.
+A graph is usually a straight line or a fan-out. It can also contain a bounded loop. A `loop` node emits on its `body` port until its `max_iterations` cap (or an optional `condition`) says stop, then emits on `done`. You close the loop by wiring the body's last node back to the `loop` node. The cap is always finite, and `on_exceeded` decides what reaching it means. `error` fails the run and names the loop. `continue` stops looping and carries the last pass's items out through `done`.
-Triggers come in several kinds. The ones live today:
+These triggers are live today:
-* **Schedule**: cron-backed; the flow fires on its schedule and re-registers itself on every app boot.
-* **App event**: a live [trigger](integrations/triggers.md) from a connected integration (a new Gmail thread, a Notion change, a Linear ticket) matched by toolkit + trigger slug.
-* **Manual**: a Run button on the Workflows page or the `flows_run` RPC.
-* **Resume**: continuing a run that paused at an approval gate.
+- **Schedule:** cron-backed. The flow fires on its schedule and re-registers itself on every app boot.
+- **App event:** a live [trigger](integrations/triggers.md) from a connected integration (a new Gmail thread, a Notion change, a Linear ticket), matched by toolkit and trigger slug.
+- **Manual:** a Run button on the Workflows page, or the `flows_run` RPC.
+- **Resume:** continuing a run that paused at an approval gate.
-A per-flow dispatch lock means a schedule burst can never run the same flow twice concurrently.
+A per-flow dispatch lock means a schedule burst can never run the same flow twice at once.
-## Trust, approvals, and human-in-the-loop
+## Trust, approvals and human-in-the-loop
-Every flow run executes under a dedicated trust origin (`TrustedAutomation → Workflow`). The reasoning: the flow's _actions_ (which tools it calls, which URLs it hits) are static graph configuration you approved at save time. The runtime trigger payload (a webhook body, an inbound event) stays **untrusted**: it can feed arguments into those pre-declared actions, but it can never introduce a new action.
+Every flow run executes under a dedicated trust origin (`TrustedAutomation → Workflow`). The flow's actions, meaning which tools it calls and which URLs it hits, are static graph configuration you approved at save time. The runtime trigger payload (a webhook body, an inbound event) stays untrusted. It can feed arguments into those pre-declared actions, but it can never add a new action.
-On top of that, each flow has a **"Require approval for outbound actions"** switch. With it on, every external-effect tool or HTTP call in the run parks at the [approval gate](approval-gate.md) and waits for a real decision. The run's trust root does not auto-allow anything.
+Each flow also has a **Require approval for outbound actions** switch. With it on, every external-effect tool or HTTP call in the run waits at the [approval gate](approval-gate.md) for a real decision. The run's trust root does not auto-allow anything.
-When a run pauses, you get a **Flow Approval Card** in your notifications naming the flow and the pending steps. Approve resumes the run (via `flows_resume`) exactly where it stopped. Runs are durable and checkpointed, so "later today" is fine.
+When a run pauses, a Flow Approval Card appears in your notifications naming the flow and the pending steps. Approving resumes the run (through `flows_resume`) exactly where it stopped. Runs are durable and checkpointed, so "later today" is fine.
## Watching it run
-* **`/flows`**: the Workflows hub, showing every flow with its enabled toggle, last-run status (`completed` / `pending approval` / `failed`), and a Run button.
-* **`/flows/:id`**: a read-only **canvas view** of the workflow graph, rendered as nodes and edges so you can see exactly what you approved.
-* **Run Inspector**: a drawer showing each run step by step (node label, emitted output, and final status), live-polling every 2 seconds until the run finishes.
-* Full **run history** is persisted per flow: status, start/finish times, pending approvals, errors, and reconstructed per-step output.
+- `/flows` is the Workflows hub. It shows every flow with its enabled toggle, last-run status (`completed`, `pending approval` or `failed`) and a Run button.
+- `/flows/:id` is a read-only canvas view of the workflow graph, drawn as nodes and edges, so you can see exactly what you approved.
+- The Run Inspector is a drawer that shows each run step by step (node label, emitted output and final status). It polls every 2 seconds until the run finishes.
+- Full run history is saved per flow: status, start and finish times, pending approvals, errors and rebuilt per-step output.
## RPC surface (for developers)
-The `flows` domain (`crates/openhuman-core/src/flows/`) exposes 36 controllers under `openhuman.flows_*`, covering definitions (`create`, `get`, `list`, `update`, `delete`, `set_enabled`, `duplicate`, `validate`, `import`), runs (`run`, `resume`, `cancel`, `list_runs`, `get_run`, history), drafts and the authoring copilot. See the [Agent Harness](../developing/architecture/agent-harness.md) page for how flow runs share the tinyagents execution stack.
+The `flows` domain (`crates/openhuman-core/src/flows/`) exposes 36 controllers under `openhuman.flows_*`. They cover definitions (`create`, `get`, `list`, `update`, `delete`, `set_enabled`, `duplicate`, `validate`, `import`), runs (`run`, `resume`, `cancel`, `list_runs`, `get_run`, history), drafts and the authoring copilot. See the [agent harness](../developing/architecture/agent-harness.md) page for how flow runs share the tinyagents execution stack.
## See also
-* [Triggers](integrations/triggers.md): the live app events that fire `app_event` workflows.
-* [Approval Gate](approval-gate.md): how pending approvals are surfaced and expire.
-* [Cron & Scheduling](native-tools/cron.md): one-shot and recurring agent jobs (workflows are the structured, multi-step upgrade).
+- [Triggers](integrations/triggers.md): the live app events that fire `app_event` workflows.
+- [Approval gate](approval-gate.md): how pending approvals are surfaced and expire.
+- [Cron and scheduling](native-tools/cron.md): one-shot and recurring agent jobs. Workflows are the structured, multi-step upgrade.
diff --git a/docs/gitbooks/en/guides/README.md b/docs/gitbooks/en/guides/README.md
new file mode 100644
index 0000000000..f35ae653dd
--- /dev/null
+++ b/docs/gitbooks/en/guides/README.md
@@ -0,0 +1,62 @@
+---
+description: >-
+ Step-by-step guides for getting a result out of OpenHuman: set up an
+ assistant, run local models, protect sensitive data, recover a broken install
+ or move to a new machine.
+icon: list-check
+---
+
+# Guides
+
+The rest of the docs explain how OpenHuman works. These guides are about what you want to get done. Each one starts from a concrete goal, such as "I want a private assistant", "my install is broken" or "I'm moving to a new laptop", and walks you to a working result. You do not need to read them in order or be technical.
+
+## Pick your goal
+
+| I want to | Guide |
+| --- | --- |
+| Set up a personal assistant from scratch | [Create my personal AI assistant](personal-assistant.md) |
+| Keep model inference on my own machine | [Use OpenHuman with a local model](local-model.md) |
+| Spread work across several model servers I run | [Use multiple local LLM servers](multiple-local-llm-servers.md) |
+| Understand what leaves my computer and what doesn't | [Keep sensitive data private](privacy-sensitive-data.md) |
+| Fix an install that won't start or finish | [Recover from a failed installation](recover-failed-installation.md) |
+| Move everything to a new computer | [Move OpenHuman to a new PC](move-to-new-pc.md) |
+| Let the agent tidy a folder of files | [Organize my project folders](organize-project-folders.md) |
+| Build a role-specific assistant, such as a clinical one | [Create a doctor-specific assistant](doctor-assistant.md) |
+| Set up a locked-down assistant for a child | [Create a safe companion for a child](child-safe-companion.md) |
+
+## How a guide is laid out
+
+Every guide has the same sections:
+
+- **Prerequisites**: what you need before you start.
+- **Privacy implications**: what stays on your machine and what goes to the OpenHuman backend or a model provider.
+- **Steps**: the path to follow.
+- **Success checks**: how to confirm it works.
+- **Common failures**: how the flow breaks, and what each symptom means.
+- **Recovery**: how to get unstuck without losing data.
+
+{% hint style="info" %}
+These guides describe the shipping desktop app, which is in active development. If a screen name and what you see disagree, trust the app and check the [release notes](https://github.com/tinyhumansai/openhuman/releases). Then tell us on [Discord](https://guild.tinyhumans.ai).
+{% endhint %}
+
+## Where your data lives
+
+OpenHuman keeps your settings, workspace files and secrets on your machine. Your memory is stored in CortexDB, either the hosted one TinyHumans runs behind your account or your own. The managed backend also handles sign-in, model routing, integration access, web-search proxying and some real-time integration triggers. That split is behind most of the privacy and recovery advice here. If you read one background page, read [Privacy and security](../features/privacy-and-security.md).
+
+On disk, everything lives in one folder:
+
+| Platform | Data folder |
+| --- | --- |
+| macOS and Linux | `~/.openhuman/` |
+| Windows | `%USERPROFILE%\.openhuman\` |
+
+Backups, recovery and migration all come back to that folder. Memory items are not in it, so backing up or deleting the folder neither copies nor erases them.
+
+## See also
+
+- [Privacy and security](../features/privacy-and-security.md): the trust model these guides assume.
+- [Local AI](../features/model-routing/local-ai.md): the config reference behind the local-model guides.
+- [Memory](../features/memory.md): what memory stores and where.
+- [Getting started](../overview/getting-started.md): install and first run.
+- [Troubleshooting sign-in](../overview/troubleshooting-sign-in.md): if you cannot get past login.
+- [Developing](../developing/README.md): building from source.
diff --git a/docs/gitbooks/en/guides/child-safe-companion.md b/docs/gitbooks/en/guides/child-safe-companion.md
new file mode 100644
index 0000000000..10cb50e972
--- /dev/null
+++ b/docs/gitbooks/en/guides/child-safe-companion.md
@@ -0,0 +1,92 @@
+---
+description: >-
+ Combine OpenHuman's autonomy, approval and screening controls into a
+ locked-down assistant for a child, with an honest account of the limits.
+icon: child
+---
+
+# Create a safe companion for a child
+
+This guide sets up the most restricted, supervised version of OpenHuman you can build, for a child to use with an adult present.
+
+{% hint style="danger" %}
+OpenHuman has no dedicated child mode, no age verification, and no filter on what the model says. It is not a certified parental-control product. You can combine its existing safety controls into a tightly locked-down setup. That reduces risk, but it does not make an AI assistant safe for a child to use alone. Adult supervision is the control that matters most, so do not rely on software alone.
+{% endhint %}
+
+The guide stacks the controls that exist and says plainly what each one does and does not cover.
+
+## Prerequisites
+
+- OpenHuman set up on the machine the child will use. See [Create my personal AI assistant](personal-assistant.md).
+- An adult who owns the account and stays involved.
+
+## Privacy implications
+
+- Keep it local. Use a [local model](local-model.md) so conversations are not sent to a cloud provider, and connect no personal integrations.
+- Do not connect a child's accounts. The safest memory is minimal memory.
+
+## What each control does
+
+| Control | What it protects against | What it does not do |
+| --- | --- | --- |
+| `readonly` autonomy (needs the policy on) | The assistant taking any action: sending, writing files, running commands or reaching the network on its own | Filter what it says |
+| Approval Gate | A state-changing or network action going through without an adult's yes | Review conversation content |
+| Workspace-only and blocked system directories | The agent touching files outside a small folder, or any credential or system directory | Limit which topics come up |
+| Prompt-injection screening | Pasted text that tries to hijack the assistant's instructions | Moderate content in general |
+| No integrations connected | The assistant pulling in or acting on personal data | Nothing else. Not connecting is the whole control |
+
+None of these filter the model's language or subject matter. An adult in the room and persona instructions fill that gap, not a setting.
+
+## Steps
+
+### 1. Set the strictest autonomy tier
+
+Go to **Settings → Agents → Agent access**:
+
+- Set `[autonomy] enabled = true` with `level = "readonly"` in `config.toml`. The assistant can then talk and answer, but cannot act, write files or reach the network on its own. The policy is off by default, so this is the first thing to set.
+- Keep `workspace_only` on.
+- Leave the [Approval Gate](../features/approval-gate.md) installed as a second layer. At `readonly`, acting is blocked anyway.
+- Review the auto-approve list and remove anything you do not want running without a prompt.
+
+### 2. Keep inference and data local
+
+- Set up a [local model](local-model.md). You run the runtime and pull the model yourself. Then route chat and reasoning to the local provider so conversations stay on-device. Adding the provider alone does not move chat. It stays on the default cloud route until you point the chat and reasoning workloads at the local provider and confirm with a test message. Turning on `local_only` [Privacy mode](../features/privacy-mode.md) makes that guarantee firm.
+- Connect no integrations, and do not sign in the child's accounts.
+
+### 3. Write a protective persona
+
+Edit the behavior prompt (`SOUL.md`, on the **Brain** page at `/brain`) to set age-appropriate rules. For example: "You are talking with a child. Keep language simple and kind. Refuse and redirect anything violent, sexual, frightening or unsafe. Never give instructions that could cause harm. Encourage them to ask a parent." With no built-in filter, persona instructions are your main lever over content.
+
+### 4. Supervise, and test first
+
+- Sit with the child, at least at first.
+- Before handing it over, try to break it yourself. Ask it things a child might, and confirm the persona redirects well.
+
+## Success checks
+
+- [ ] `[autonomy] enabled = true`, `level = "readonly"`, and `workspace_only` is on.
+- [ ] No integrations are connected.
+- [ ] Inference is local (`ready`), so conversations do not go to a cloud provider.
+- [ ] In your own testing, the persona refuses and redirects unsafe prompts.
+- [ ] An adult is present during use. This is a check, not a nicety.
+
+## Common failures
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| It produced content you consider inappropriate | There is no content filter, and the persona alone governs tone | Strengthen the `SOUL.md` rules and supervise. This is a limit of the tool |
+| It tried to send, open or fetch something | The policy is off, or the tier is not `readonly` | Set `enabled = true` and `level = "readonly"` in `config.toml` |
+| Conversation went to the cloud | Chat is not routed to a local provider | Route chat to a [local model](local-model.md) and send a test message |
+| The child reached settings and changed things | OpenHuman has no separate child login | Use OS-level user accounts or parental controls to lock down the machine |
+
+## Recovery
+
+- **Lock down at once.** Set `enabled = true` and `level = "readonly"`, if either drifted. The level does nothing while `enabled` is `false`, so check both. Acting stops on the next turn.
+- **Reset the persona.** Revert your `SOUL.md` edits to the defaults if the customization misbehaves.
+- **Supervise.** If the experience is not right for the child, step in. No setting replaces that.
+
+## See also
+
+- [Keep sensitive data private](privacy-sensitive-data.md): the controls this guide stacks.
+- [Approval Gate](../features/approval-gate.md): the autonomy tiers and what each one blocks.
+- [Privacy and security](../features/privacy-and-security.md): what leaves the machine, and what does not.
diff --git a/docs/gitbooks/en/guides/doctor-assistant.md b/docs/gitbooks/en/guides/doctor-assistant.md
new file mode 100644
index 0000000000..29ba9495f7
--- /dev/null
+++ b/docs/gitbooks/en/guides/doctor-assistant.md
@@ -0,0 +1,85 @@
+---
+description: >-
+ Shape OpenHuman into an assistant for clinical work, with a persona, tight
+ data boundaries and clear limits.
+icon: user-doctor
+---
+
+# Create a doctor-specific assistant
+
+This guide tailors OpenHuman to a clinician's workflow: a persona that speaks the part, memory limited to the right sources, and privacy settings suited to sensitive information.
+
+{% hint style="danger" %}
+OpenHuman is a general-purpose assistant. It is not a medical device and not a source of medical advice, and it can hallucinate. Nothing here makes it safe for diagnosis, treatment decisions, or handling protected health information under a regulation such as HIPAA or GDPR. You are responsible for compliance, clinical judgment and the data you let it touch. Treat its output as draft text that a qualified person must verify.
+{% endhint %}
+
+## Prerequisites
+
+- OpenHuman set up. See [Create my personal AI assistant](personal-assistant.md).
+- A clear decision about what data this assistant may and may not see. For anything sensitive, plan to keep inference [local](local-model.md).
+
+## Privacy implications
+
+- Decide early whether real patient data will ever be involved. If regulatory rules apply to your data, the safest setup is a local model, minimal integrations, and read-only or supervised autonomy.
+- OpenHuman keeps memory local and redacts secrets and personal data on save, but that is not a compliance guarantee. It is a general privacy design, not a certification for regulated health data.
+- By default, reasoning goes through the [OpenHuman backend](../features/privacy-and-security.md), which sends relevant snippets to the model provider on each turn. For sensitive material, turn on a [local model](local-model.md) so the work stays on your device.
+
+## Steps
+
+### 1. Lock down the boundaries before adding data
+
+In **Settings → Agents → Agent access**:
+
+- Turn the autonomy policy on and set its tier. In `config.toml`, set `[autonomy] enabled = true` with `level = "readonly"` (questions and drafting only) or `level = "supervised"` (drafting plus approved actions). Avoid `full` for clinical use. The policy is off until you set `enabled = true`.
+- Keep `workspace_only` on so the agent cannot wander your disk.
+- With the policy on, the [Approval Gate](../features/approval-gate.md) sits between the assistant and any acting call. At `readonly` the call is refused. At `supervised` the gate holds it for your yes, unless its tool is on the always-allow list. Clear that list in **Settings → Agent access** if you want every call reviewed. The gate covers actions, not network transport, so prompts and attachments can still be sent upstream for inference.
+
+### 2. Turn on local inference for sensitive work
+
+Follow [Use OpenHuman with a local model](local-model.md) and pick at least "memory + reflection", so embeddings and background summaries stay on your device. Confirm the status reads `ready`.
+
+### 3. Give it a clinical persona
+
+The assistant's tone and behavior come from an editable prompt (`SOUL.md`), with mission and values in `IDENTITY.md`. To make it clinical:
+
+- Set a display name and description in **Settings → Personality**.
+- Edit the behavior prompt on the **Brain** page (`/brain`) to describe the role. For example: "You assist a physician with documentation and literature summaries. You always flag uncertainty, cite sources, and never present output as a diagnosis or treatment recommendation. You remind the user to verify clinically."
+
+Put the caveats in the persona so they appear in every reply, not only in your memory.
+
+### 4. Connect only the sources that belong
+
+Add only the integrations the workflow needs, such as a reference or notes source. Do not connect anything with data you are not cleared to process. Every integration is a separate OAuth grant that you can revoke.
+
+### 5. Test with synthetic inputs
+
+Test with made-up cases, never real patient data, until you are satisfied with the tone, caution and citations.
+
+## Success checks
+
+- [ ] `[autonomy] enabled = true`, `level` is `readonly` or `supervised`, and `workspace_only` is on.
+- [ ] If you keep inference on-device, your local runtime is running, the models are pulled, and a turn routed to it answers.
+- [ ] The persona reliably adds uncertainty flags and "verify clinically" language to replies on synthetic prompts.
+- [ ] Only the intended sources are connected.
+- [ ] The assistant declines to present output as a diagnosis when tested.
+
+## Common failures
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| It states things with false confidence | The persona does not enforce caution | Strengthen `SOUL.md` to require uncertainty flags and citations |
+| Sensitive text went to the cloud | Inference is on the default route | Turn on a [local model](local-model.md) and confirm `ready` before using sensitive input |
+| It tried to act on its own | The policy is off, or the tier is too permissive | Set `enabled = true` and `level = "readonly"` |
+| It remembered something it should not have | A source with disallowed data was connected | Revoke the integration. Chunks already ingested are local and can be cleared from the workspace |
+
+## Recovery
+
+- **Stop acting at once.** Set `enabled = true` and `level = "readonly"` together. The level does nothing while the policy is off, so you need both. Acting stops on the next turn.
+- **Pull a source.** Revoke any integration in Settings, and future syncs stop immediately.
+- **Reset the persona.** The behavior lives in an editable file. Revert your edits to return to the default tone.
+
+## See also
+
+- [Keep sensitive data private](privacy-sensitive-data.md): the controls this guide combines.
+- [Use OpenHuman with a local model](local-model.md): keeping sensitive inference on your device.
+- [Approval Gate](../features/approval-gate.md): how actions are gated.
diff --git a/docs/gitbooks/en/guides/guides/README.md b/docs/gitbooks/en/guides/guides/README.md
deleted file mode 100644
index 25f7507ae9..0000000000
--- a/docs/gitbooks/en/guides/guides/README.md
+++ /dev/null
@@ -1,70 +0,0 @@
----
-description: >-
- Outcome-driven, step-by-step guides for getting a real result out of
- OpenHuman: set up an assistant, run one or several local models, protect
- sensitive data, recover a broken install, or move to a new
-icon: list-check
----
-
-# Guides
-
-The rest of the docs explain **how OpenHuman works**. This section is about **what you want to get done**. Each guide starts from a concrete outcome ("I want a private assistant", "my install is broken", "I'm moving to a new laptop") and walks you to a working result without asking you to first understand the architecture.
-
-You do not need to read these in order, and you do not need to be technical. Pick the guide that matches your goal.
-
-***
-
-## Pick your goal
-
-| I want to… | Guide |
-| --------------------------------------------------- | -------------------------------------------------------------------- |
-| Set up a personal assistant from scratch | [Create my personal AI assistant](personal-assistant.md) |
-| Keep model inference on my own machine | [Use OpenHuman with a local model](local-model.md) |
-| Share work across several model servers I run | [Use multiple local LLM servers](multiple-local-llm-servers.md) |
-| Understand what leaves my computer and what doesn't | [Keep sensitive data private](privacy-sensitive-data.md) |
-| Fix an install that won't start or finish | [Recover from a failed installation](recover-failed-installation.md) |
-| Move everything to a new computer | [Move OpenHuman to a new PC](move-to-new-pc.md) |
-| Let the agent tidy a folder of files | [Organize my project folders](organize-project-folders.md) |
-| Build a role-specific assistant (e.g. clinical) | [Create a doctor-specific assistant](doctor-assistant.md) |
-| Set up a locked-down assistant for a child | [Create a safe companion for a child](child-safe-companion.md) |
-
-***
-
-## How to read a guide
-
-Every guide in this section follows the same shape, so you always know where to look:
-
-* **Prerequisites**: what you need before you start (an account, disk space, another app installed).
-* **Privacy implications**: what stays on your machine and what is sent to the OpenHuman backend or a model provider for this workflow, in plain language.
-* **Steps**: the actual click-by-click path.
-* **Success checks**: how to confirm the workflow is actually working, not just "looks done".
-* **Common failures**: the specific ways this flow breaks, and what each symptom means.
-* **Recovery**: how to get unstuck without losing your data.
-
-{% hint style="info" %}
-**These guides describe the shipping desktop app.** OpenHuman is in active development; where a guide points at a Settings screen or diagnostic surface, that surface may keep improving. When a screen name and what you see disagree, trust the app and check the [release notes](https://github.com/tinyhumansai/openhuman/releases), then let us know on [Discord](https://guild.tinyhumans.ai).
-{% endhint %}
-
-## The one thing worth knowing first
-
-OpenHuman keeps your settings, workspace files and secrets on your machine, but **your memory is stored in CortexDB**: the hosted CortexDB that TinyHumans runs (behind your account) or your own CortexDB. The managed backend also brokers sign-in, model routing, integration access, web-search proxying, and some real-time integration triggers. That split is behind most of the privacy and recovery advice in this section. If you read only one background page, read [Privacy & Security](../../features/privacy-and-security/).
-
-Where your data physically lives on disk:
-
-| Platform | Data folder |
-| ------------- | --------------------------- |
-| macOS / Linux | `~/.openhuman/` |
-| Windows | `%USERPROFILE%\.openhuman\` |
-
-Almost everything in this section (backups, recovery, migration) comes back to that one folder. Memory items are not in it: backing up or deleting the folder neither copies nor erases them.
-
-***
-
-## See also
-
-* [Privacy & Security](../../features/privacy-and-security/): the trust model every guide here assumes.
-* [Local AI (optional)](../../features/model-routing/local-ai.md): the config reference behind the local-model guides.
-* [Memory](../../features/memory.md): what memory stores and where.
-* [Getting Started](../../overview/getting-started.md): install and first run, before any guide.
-* [Troubleshooting Sign-In](../../overview/troubleshooting-sign-in.md): if you cannot get past login.
-* [Developing](../../developing/developing.md): building from source, for the technical reader.
diff --git a/docs/gitbooks/en/guides/guides/child-safe-companion.md b/docs/gitbooks/en/guides/guides/child-safe-companion.md
deleted file mode 100644
index d67947d845..0000000000
--- a/docs/gitbooks/en/guides/guides/child-safe-companion.md
+++ /dev/null
@@ -1,98 +0,0 @@
----
-description: >-
- Compose OpenHuman's autonomy, approval, and content-screening controls into a
- locked-down assistant for a child, with an honest account of the limits.
-icon: child
----
-
-# Create a safe companion for a child
-
-**Goal:** set up the most restricted, supervised version of OpenHuman you can, intended for a child to use with an adult present.
-
-{% hint style="danger" %}
-**Read this first. It is an honest warning.** OpenHuman has **no dedicated "child mode"**, no age verification, and no content filter on what the model _says_. There is no certified parental-control product here. What you _can_ do is compose the existing safety controls into a tightly locked-down setup. That reduces risk; it does not make an AI assistant a safe, unsupervised experience for a child. **Adult supervision is the control that matters most.** Do not rely on software alone.
-{% endhint %}
-
-This guide is about stacking the real controls that exist, and being clear about what they do and don't cover.
-
-***
-
-## Prerequisites
-
-* OpenHuman set up on the machine the child will use. See [Create my personal AI assistant](personal-assistant.md).
-* An adult who owns the account and stays involved.
-
-## Privacy implications
-
-* Keep it local. Use a [local model](local-model.md) so conversations aren't sent to a cloud provider, and connect **no** personal integrations.
-* Do not connect a child's accounts. The safest memory is minimal memory.
-
-## What each control actually does
-
-| Control | What it protects against | What it does **not** do |
-| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
-| **`readonly` autonomy** (needs the policy on) | The assistant taking any action (sending, writing files, running commands, or reaching the network on its own) | Doesn't filter what it _says_ |
-| **Approval Gate (on)** | Any state-changing/network action slipping through without an adult's yes | Doesn't review conversation content |
-| **Workspace-only + blocked system dirs** | The agent touching files outside a small folder, or any credential/system directory | Doesn't restrict what topics come up |
-| **Prompt-injection screening** | Attempts (in pasted text) to hijack the assistant's instructions | Isn't a general content moderator |
-| **No integrations connected** | The assistant pulling in or acting on personal data | (Nothing; not connecting is the whole control) |
-
-The honest gap: **none of these filter the model's language or subject matter.** That gap is filled by an adult in the room and by persona instructions, not by a setting.
-
-***
-
-## Steps
-
-### 1. Set the strictest autonomy tier
-
-**Settings → Agents → Agent access:**
-
-* Autonomy: `[autonomy] enabled = true` with `level = "readonly"` in `config.toml`. The assistant can then talk and answer, but cannot act, write files, or reach the network on its own. The policy is off by default, so this is the first thing to set.
-* Keep **workspace-only** on.
-* Leave the [Approval Gate](../../features/approval-gate.md) installed as a second layer. (At `readonly`, acting is blocked outright anyway.)
-* Review the **auto-approve** list and remove anything you don't want running without a prompt.
-
-### 2. Keep inference and data local
-
-* Set up a [local model](local-model.md) (run the runtime and pull the model yourself), then **route chat and reasoning at the local provider** so conversations run on-device. Adding the provider alone does not move chat; it stays on the default cloud route until you point the chat/reasoning workloads at the local provider and confirm with a test message. Turning on `local_only` [Privacy Mode](../../features/privacy-and-security/privacy-mode.md) makes that guarantee hard.
-* Connect **no** integrations. Don't sign the child's accounts in.
-
-### 3. Write a protective persona
-
-Edit the behavior prompt (`SOUL.md`, via the **Brain** page `/brain`) to set age-appropriate rules directly. For example: "You are talking with a child. Keep language simple and kind. Refuse and redirect anything violent, sexual, frightening, or unsafe. Never give instructions that could cause harm. Encourage them to ask a parent." Persona instructions are your main lever over _content_, since there's no built-in filter.
-
-### 4. Supervise, and test first
-
-* Sit with the child, at least at first.
-* Before handing it over, **try to break it yourself**: ask it things a child might, and confirm the persona redirects appropriately.
-
-***
-
-## Success checks
-
-* [ ] `[autonomy] enabled = true` and `level = "readonly"`; `workspace_only` is on.
-* [ ] No integrations are connected.
-* [ ] Inference is local (`ready`), so conversations aren't going to a cloud provider.
-* [ ] In your own testing, the persona refuses and redirects unsafe prompts.
-* [ ] An adult is present for use. _(This is a check, not a nicety.)_
-
-## Common failures
-
-| Symptom | Cause | Fix |
-| ---------------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------- |
-| It produced content you consider inappropriate | There is no content filter; the persona alone governs tone | Strengthen the `SOUL.md` rules; supervise; this is an inherent limit of the tool |
-| It tried to do something (send/open/fetch) | The policy is off, or the tier isn't `readonly` | Set `enabled = true` and `level = "readonly"` in `config.toml` |
-| Conversation went to the cloud | Chat isn't routed to a local provider | Route chat to a [local model](local-model.md) and send a test message |
-| The child reached settings and changed things | OpenHuman has no separate child login | Use OS-level user accounts/parental controls to lock down the machine itself |
-
-## Recovery
-
-* **Instant lockdown:** set `enabled = true` and `level = "readonly"` (if either drifted). The level does nothing while `enabled` is `false`, so check both. Acting stops next turn.
-* **Reset persona:** revert your `SOUL.md` edits to defaults if the customization misbehaves.
-* **The real recovery is supervision.** If the experience isn't right for the child, step in. No software setting substitutes for that.
-
-## See also
-
-* [Keep sensitive data private](privacy-sensitive-data.md): the controls this guide stacks.
-* [Approval Gate](../../features/approval-gate.md): the autonomy tiers and what each one blocks.
-* [Privacy & Security](../../features/privacy-and-security/): what leaves the machine, and what does not.
diff --git a/docs/gitbooks/en/guides/guides/doctor-assistant.md b/docs/gitbooks/en/guides/guides/doctor-assistant.md
deleted file mode 100644
index 92e19e913d..0000000000
--- a/docs/gitbooks/en/guides/guides/doctor-assistant.md
+++ /dev/null
@@ -1,93 +0,0 @@
----
-description: >-
- Shape OpenHuman into a role-specific assistant for clinical work: persona,
- tight data boundaries, and the limits you must keep in mind.
-icon: user-doctor
----
-
-# Create a doctor-specific assistant
-
-**Goal:** tailor OpenHuman for a clinician's workflow: a persona that speaks the part, memory scoped to the right sources, and privacy settings appropriate for sensitive information.
-
-{% hint style="danger" %}
-**Read this first.** OpenHuman is a general-purpose assistant, **not** a medical device and **not** a source of medical advice. It can hallucinate. Nothing here makes it safe for diagnosis, treatment decisions, or handling protected health information under a specific regulatory regime (HIPAA, GDPR, etc.). You are responsible for compliance, for clinical judgment, and for what data you let it touch. Treat its output as draft text a qualified human must verify.
-{% endhint %}
-
-With that boundary set, here's how to shape it responsibly.
-
-***
-
-## Prerequisites
-
-* OpenHuman set up. See [Create my personal AI assistant](personal-assistant.md).
-* A clear decision about **what data this assistant may and may not see**. For anything sensitive, plan to keep inference [local](local-model.md).
-
-## Privacy implications
-
-* Decide early whether any real patient data will ever be involved. If regulatory rules apply to your data, the safest posture is: **local model on, minimal integrations, read-only or supervised autonomy.**
-* OpenHuman keeps memory local and redacts secrets/PII on save, but **that is not a compliance guarantee**. It is a general privacy design. Do not treat it as certified for regulated health data.
-* If you route reasoning to the [OpenHuman backend](../../features/privacy-and-security/) (the default), relevant snippets are sent to the model provider for each turn. For sensitive material, turn on a [local model](local-model.md) so that work stays on-device.
-
-***
-
-## Steps
-
-### 1. Lock down the boundaries before adding data
-
-In **Settings → Agents → Agent access**:
-
-* Turn the autonomy policy on and set its tier: `[autonomy] enabled = true` with `level = "readonly"` (pure Q\&A and drafting) or `level = "supervised"` (drafting plus approved actions) in `config.toml`. Avoid `full` for clinical use. The policy is off until you set `enabled = true`.
-* Keep **workspace-only** on so the agent can't wander your disk.
-* With the policy on, the [Approval Gate](../../features/approval-gate.md) stands between the assistant and any acting call: at `readonly` the tier refuses the call outright, and at `supervised` the gate parks it for your yes, unless its tool is on the always-allow list. Clear that list in **Settings → Agent access** if you want every call reviewed. Note the gate covers **actions**, not network transport: prompts and attachments can still be sent upstream for inference.
-
-### 2. Turn on local inference for sensitive work
-
-Follow [Use OpenHuman with a local model](local-model.md) and pick at least **"memory + reflection"** so embeddings and background summarization stay on-device. Confirm status reads `ready`.
-
-### 3. Give it a clinical persona
-
-The assistant's tone and behavior come from an editable prompt (`SOUL.md`), with mission/values in `IDENTITY.md`. To make it clinical:
-
-* Set a display name and description in **Settings → Personality**.
-* Edit the behavior prompt (via the **Brain** page, `/brain`) to describe the role you want. For example: "You assist a physician with documentation and literature summaries. You always flag uncertainty, cite sources, and never present output as a diagnosis or treatment recommendation. You remind the user to verify clinically."
-
-Bake the caveats **into the persona** so they show up in every reply, not just your memory.
-
-### 4. Connect only the sources that belong
-
-Add only the integrations relevant to the workflow (e.g. a reference/notes source), and **not** anything carrying data you're not cleared to process. Every integration is a separate, revocable OAuth grant.
-
-### 5. Verify behavior with safe, synthetic inputs
-
-Test with **made-up** cases, never real patient data, until you're satisfied with tone, caution, and citations.
-
-***
-
-## Success checks
-
-* [ ] `[autonomy] enabled = true`, `level` is `readonly` or `supervised`, and `workspace_only` is on.
-* [ ] If you're keeping inference on-device, your local runtime is running, the models are pulled, and a turn routed to it answers.
-* [ ] The persona reliably adds uncertainty flags and "verify clinically" language in replies to synthetic prompts.
-* [ ] Only intended sources are connected.
-* [ ] The assistant declines to present output as a diagnosis when tested.
-
-## Common failures
-
-| Symptom | Cause | Fix |
-| ------------------------------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
-| It states things with false confidence | Persona doesn't enforce caution | Strengthen `SOUL.md` to require uncertainty flags and citations |
-| Sensitive text went to the cloud | Inference is on the default route | Turn on a [local model](local-model.md) and confirm `ready` before using sensitive input |
-| It tried to take an action on its own | The policy is off, or the tier is too permissive | Set `enabled = true` and `level = "readonly"` |
-| It "remembered" something it shouldn't have | A source with disallowed data was connected | Revoke the integration; already-ingested chunks are local and can be cleared from the workspace |
-
-## Recovery
-
-* **Instant containment:** set `enabled = true` and `level = "readonly"` together. The level is inert while the policy is off, so both have to be set. Acting stops on the next turn.
-* **Pull a source:** revoke any integration from Settings; future syncs stop immediately.
-* **Reset the persona:** the behavior lives in an editable file; revert your edits to return to default tone.
-
-## See also
-
-* [Keep sensitive data private](privacy-sensitive-data.md): the controls this guide composes.
-* [Use OpenHuman with a local model](local-model.md): keeping sensitive inference on-device.
-* [Approval Gate](../../features/approval-gate.md): how actions are gated.
diff --git a/docs/gitbooks/en/guides/guides/local-model.md b/docs/gitbooks/en/guides/guides/local-model.md
deleted file mode 100644
index b528aac14b..0000000000
--- a/docs/gitbooks/en/guides/guides/local-model.md
+++ /dev/null
@@ -1,117 +0,0 @@
----
-description: >-
- Run a local model runtime yourself (Ollama, LM Studio, MLX, or any
- OpenAI-compatible server), pull your own models, and add the endpoint to
- OpenHuman as a provider. Includes checks and common failures
-icon: microchip
----
-
-# Use OpenHuman with a local model
-
-**Goal:** move some or all of OpenHuman's model work onto your own computer, so that the data used for those workloads never leaves the machine.
-
-OpenHuman does not install a runtime, start it, or download models. You run the runtime, you pull the models, and OpenHuman calls the endpoint you give it. Local AI is **opt-in**; adding a local provider does not reroute anything until you point workloads at it.
-
-For the config reference (provider strings, endpoint overrides, every workload field), see [Local AI (optional)](../../features/model-routing/local-ai.md). This guide is the task-oriented version.
-
-***
-
-## Prerequisites
-
-* A local runtime you install and run yourself:
- * [**Ollama**](https://ollama.com), default address `http://localhost:11434`.
- * [**LM Studio**](https://lmstudio.ai) with its local server enabled, default `http://localhost:1234/v1`.
- * MLX (`mlx_lm.server`), OMLX, or any other OpenAI-compatible server.
-* Disk and RAM for the models you pick. A small chat model plus `bge-m3` for embeddings is a few GB on disk; 8 GB+ RAM is a sensible floor.
-
-## Privacy implications
-
-* Workloads you route locally run on-device. Nothing about that work is sent out.
-* Anything you leave on the default route still goes through the OpenHuman [model router](../../features/model-routing/). Local AI only changes the workloads you move.
-* Without [Privacy Mode](../../features/privacy-and-security/privacy-mode.md), lightweight hints routed locally can fall back to the remote provider if the runtime is unreachable. Turn on `local_only` privacy mode if strict locality matters; then an unreachable runtime makes the request fail instead.
-
-***
-
-## Steps
-
-### 1. Start the runtime
-
-Install and launch the runtime so its server is running. For Ollama, confirm from a terminal:
-
-```bash
-curl http://localhost:11434/api/tags
-```
-
-A JSON list of models (even an empty one) means the server is reachable. For LM Studio or another OpenAI-compatible server, `curl http://localhost:1234/v1/models` (adjust the port) should return a model list.
-
-### 2. Pull the models yourself
-
-OpenHuman never pulls models. Pull every model you plan to route to before you configure it. For Ollama:
-
-```bash
-ollama pull gemma3:4b-it-qat # chat, and vision from 4B up
-ollama pull bge-m3 # memory embeddings (1024 dimensions)
-```
-
-In LM Studio, download the model in LM Studio and load it. For MLX or another server, start it with the model you want served.
-
-See [Local models & bring your own key](../../features/model-routing/local-and-byok-models.md) for which models can do chat, vision, and embeddings.
-
-### 3. Add the endpoint as a provider
-
-Open **Connections → LLM** and choose **Add a provider**:
-
-* For Ollama, LM Studio, or OMLX, pick it under **Local runtimes**. The default endpoint is filled in; change it if your runtime listens elsewhere.
-* For MLX or another server, choose **Add a custom provider** and enter its OpenAI-compatible endpoint (for example `http://127.0.0.1:8080/v1`).
-
-When you save, OpenHuman asks the endpoint for its model list. If the runtime isn't reachable, the provider isn't saved; fix step 1 and try again.
-
-### 4. Route workloads to it
-
-Use **Custom routing** on the workloads you want local (chat, reasoning, vision, and so on) and pick a model the runtime reported. Only models you have pulled or loaded appear.
-
-For memory embeddings, open **Connections → Embeddings** and choose Ollama with `bge-m3`, or set `embeddings_provider = "ollama:bge-m3"` in `config.toml`.
-
-### 5. Test that it answers
-
-Send a short message on a workload you routed locally, or use the model test in the LLM panel. A coherent reply means the path works end to end (endpoint reachable, model present, inference running). For Ollama you can also watch `ollama ps` while the request runs.
-
-***
-
-## Success checks
-
-Local AI is working when:
-
-* [ ] The local provider shows as connected under **Connections → LLM**, and its model list contains the models you pulled.
-* [ ] A turn routed to the local provider returns a real reply.
-* [ ] For embeddings: after the next memory sync, new summaries keep appearing in the **Memory** tab with the runtime running.
-
-## Common failures
-
-| What you see | Meaning | Fix |
-| --------------------------------------------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
-| Provider won't save; the endpoint is reported unreachable | OpenHuman can't reach the runtime at that address | Start the runtime; check the port with `curl`; correct the endpoint |
-| The model you want isn't in the picker | The runtime doesn't have it | `ollama pull <model>`, or download and load it in LM Studio, then reopen the picker |
-| A request fails saying the model is not found | The workload names a model the runtime no longer has | Pull it again, or route the workload to a model you have |
-| Ollama answers but every model call fails | Ollama's model runner is broken | Quit and relaunch Ollama, then retry |
-| Embeddings fail with a dimension error | The embedding model doesn't produce 1024-dimension vectors | Use `bge-m3` |
-| Agent turns lose context on Ollama | Ollama's default context window is small | Set `local_ai.num_ctx` (for example `8192`) |
-| Answers feel cloud-quality | The runtime was unreachable and a lightweight hint fell back to remote | Fix reachability; use `local_only` privacy mode if fallback is unacceptable |
-
-## Recovery
-
-* **Back to cloud:** set the routed workloads back to the default route in **Custom routing**, or remove the local provider. No data is lost.
-* **Stuck runtime:** quit the runtime fully and relaunch it. OpenHuman reconnects on the next request.
-* **Disk pressure:** model pulls happen in your runtime, not in OpenHuman. Free space and pull again with the runtime's own command.
-
-***
-
-## Notes on what stays cloud anyway
-
-Some workloads use the backend unless you configure something else: speech-to-text and web search go through the backend proxy, and text-to-speech uses the hosted voice unless you install Piper yourself and set `PIPER_BIN`. See [what stays in the cloud](../../features/model-routing/local-ai.md#what-stays-in-the-cloud-by-default).
-
-## See also
-
-* [Local AI (optional)](../../features/model-routing/local-ai.md): the config reference.
-* [Keep sensitive data private](privacy-sensitive-data.md): the plain-language version of local vs external.
-* [Automatic Model Routing](../../features/model-routing/): how tasks get matched to models.
diff --git a/docs/gitbooks/en/guides/guides/move-to-new-pc.md b/docs/gitbooks/en/guides/guides/move-to-new-pc.md
deleted file mode 100644
index a5a52daadd..0000000000
--- a/docs/gitbooks/en/guides/guides/move-to-new-pc.md
+++ /dev/null
@@ -1,122 +0,0 @@
----
-description: >-
- Carry your OpenHuman persona, memory, workspace, and model/provider config to
- a new computer, and understand which secrets travel and which you re-enter.
-icon: truck
----
-
-# Move OpenHuman to a new PC
-
-**Goal:** set up OpenHuman on a new machine so it picks up where the old one left off (same memory, same persona, same settings), with credentials handled at a safe level of detail.
-
-The short version: **copy one folder, sign back in.** The nuance is in what a folder copy does and does not carry, which this guide makes explicit so you're not surprised.
-
-***
-
-## Prerequisites
-
-* Both computers available (or a backup of the old one's data folder).
-* Your OpenHuman sign-in credentials.
-* A way to move files between them (external drive, secure file transfer, etc.).
-
-## What lives where
-
-Everything OpenHuman persists is in a single folder:
-
-| Platform | Data folder |
-| ------------- | --------------------------- |
-| macOS / Linux | `~/.openhuman/` |
-| Windows | `%USERPROFILE%\.openhuman\` |
-
-Inside it, the things you care about migrating:
-
-| What | Where (inside the data folder) | Travels with a folder copy? |
-| ------------------------------------------------------ | --------------------------------------------- | -------------------------------- |
-| **Memory items** | In your engine (TinyHumans or CortexDB) | Sign in again / re-enter the key |
-| **Persona & behavior** | `SOUL.md`, `IDENTITY.md`, `ROLE.md` | Yes |
-| **Config** (models, providers, routing, autonomy) | `config.toml` | Yes |
-| **Session history** | `sessions/`, `session_raw/` | Yes |
-| **Approval history** | `approval/approval.db` | Yes |
-| **OS-stored secrets** (session token, some local keys) | Your OS keychain, **not** in this folder | No (re-established on sign-in) |
-| **Integration access** (Gmail, Slack, …) | Brokered by the backend, tied to your account | No (reconnects on sign-in) |
-
-{% hint style="info" %}
-**Why some things don't travel, and why that's fine.** OpenHuman deliberately keeps secrets out of loose files. Your session token and certain local secrets live in the operating system's secure store (Keychain / Credential Manager / Secret Service), and your integration tokens are held by the backend against your account. So the folder copy carries your _data and persona_; **signing in on the new machine re-establishes the secrets and integrations.** You never hand-copy raw tokens between machines.
-{% endhint %}
-
-***
-
-## Steps
-
-### 1. Quit OpenHuman on the old machine
-
-Fully close the app so nothing is mid-write to the database. A clean copy needs a quiet source.
-
-### 2. Copy the data folder
-
-Copy the **entire** data folder from the old machine to the same location on the new one:
-
-* macOS / Linux: copy `~/.openhuman/` → `~/.openhuman/`
-* Windows: copy `%USERPROFILE%\.openhuman\` → `%USERPROFILE%\.openhuman\`
-
-Copy the whole folder rather than cherry-picking. It keeps memory, persona, config, and history consistent with each other.
-
-The data folder holds config and memory but **not** the files the agent created or edited in its action sandbox. Also copy your **projects/action folder**, by default `~/OpenHuman/projects` (or wherever you pointed the action directory). Otherwise those project files stay behind on the old PC. That folder also holds `Files` (`~/OpenHuman/projects/Files`), where the decks, documents and generated images and videos the agent delivers are saved.
-
-{% hint style="warning" %}
-Copy it somewhere secure. This folder contains your personal memory in readable form. Treat the transfer like moving personal documents.
-{% endhint %}
-
-### 3. Install OpenHuman on the new machine
-
-Install the current build from [tinyhumans.ai/openhuman](https://tinyhumans.ai/openhuman). If the data folder is already in place, the app will find it on launch. (Order doesn't strictly matter; installing first and copying after works too, as long as the app isn't running while you copy.)
-
-### 4. Launch and sign in
-
-Open the app and sign in with the **same account**. Signing in:
-
-* Re-establishes your session token in the new machine's OS keychain.
-* Reconnects your account so backend-brokered integrations come back.
-
-### 5. Reconnect anything account-scoped
-
-* **Integrations** (Gmail, Slack, etc.): confirm they show as connected under **Settings**. If any need a fresh OAuth approval, re-approve them. Each takes a quick click.
-* **Bring-your-own keys:** if you had entered your own provider API key, a Composio direct key, or similar **local** secrets, re-enter them on the new machine. Those are stored in the OS keychain and don't come across in the folder.
-
-### 6. Re-check model / provider config
-
-Your `config.toml` came along, so model routing and provider choices should already match. If you used a [local model](local-model.md), remember that **Ollama/LM Studio is separate software** and the model weights live in its own store, not in the OpenHuman data folder. Install the runtime on the new machine and pull the same models yourself (for example `ollama pull bge-m3`); OpenHuman does not download them.
-
-***
-
-## Success checks
-
-The migration worked when:
-
-* [ ] The **Memory** tab on the new machine shows your existing summaries. Your memory came across.
-* [ ] The assistant replies in your configured style, and your display name/persona is intact.
-* [ ] Connected integrations show as connected under **Settings** (reconnect any that don't).
-* [ ] Your autonomy tier and settings match what you had (check **Settings → Agents → Agent access**).
-* [ ] If you use local AI: the runtime is installed and running on the new machine, you have pulled the models your workloads name, and a turn routed to the local provider answers.
-
-## Common failures
-
-| Symptom | Cause | Fix |
-| ------------------------------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
-| New machine starts fresh, no memory | Data folder wasn't in the right place, or app was running during the copy | Quit the app, place the folder at `~/.openhuman/` (or `%USERPROFILE%\.openhuman\`), relaunch |
-| Signed in but integrations are disconnected | Integration access is account/backend-scoped, not in the folder | Reconnect each integration in Settings (one OAuth click each) |
-| Local model doesn't work on the new PC | Ollama/LM Studio and the weights aren't on the new machine | Install the runtime and pull the models yourself; see [local model guide](local-model.md) |
-| Assistant lost its personality | `SOUL.md` / `IDENTITY.md` weren't copied | Copy the **whole** data folder, not just the database |
-| Sign-in stalls on the new machine | An auth/handler issue unrelated to migration | See [Troubleshooting Sign-In](../../overview/troubleshooting-sign-in.md) |
-
-## Recovery
-
-* **Keep the old machine's folder until you've verified the new one.** Don't wipe the source until every success check passes.
-* If the new machine won't start at all, treat it as a fresh-install problem: [Recover from a failed installation](recover-failed-installation.md). Your copied folder is safe to move aside and restore.
-
-## See also
-
-* [Recover from a failed installation](recover-failed-installation.md): same data folder, different problem.
-* [Keep sensitive data private](privacy-sensitive-data.md): why secrets are stored the way they are.
-* [Use OpenHuman with a local model](local-model.md): re-standing-up a runtime on the new machine.
-* [OS Keyring & Secret Storage](../../features/privacy-and-security/os-keyring-and-secret-storage.md): what the keychain holds instead of the folder.
diff --git a/docs/gitbooks/en/guides/guides/multiple-local-llm-servers.md b/docs/gitbooks/en/guides/guides/multiple-local-llm-servers.md
deleted file mode 100644
index c595576507..0000000000
--- a/docs/gitbooks/en/guides/guides/multiple-local-llm-servers.md
+++ /dev/null
@@ -1,152 +0,0 @@
----
-description: >-
- Route different OpenHuman workloads to models on different machines you own,
- behind one OpenAI-compatible gateway, with a Mac mini and Linux GPU PC worked
- example.
-icon: network-wired
----
-
-# Use multiple local LLM servers
-
-**Goal:** keep a small, fast model and a large, slow one on separate machines you own, and send each OpenHuman workload to the right one, without giving up the local provider path.
-
-OpenHuman talks to one endpoint per provider string. If your models live on more than one machine, put a gateway in front of them: it exposes a single OpenAI-compatible endpoint and uses a prefix on the model ID to choose the upstream. This guide uses [Model Router](https://github.com/tjm8874/model-router), an independent, MIT-licensed community project. OpenHuman does not bundle, install, or supervise it, and any compatible gateway can play the same part.
-
-The worked example puts the OpenHuman core, the gateway, and a small model on a **Mac mini**, and a larger model server on a **Linux GPU PC**:
-
-```
-OpenHuman core (Mac mini)
- └─ gateway, 127.0.0.1:18080/v1
- ├─ MacMini:small-model → local model server, 127.0.0.1:8080/v1
- └─ LinuxGPU:large-model → SSH tunnel → Linux PC, 127.0.0.1:8000/v1
-```
-
-***
-
-## Prerequisites
-
-* A single-server local setup you already understand. Start with [Use OpenHuman with a local model](local-model.md) if you have not routed one workload locally yet.
-* An OpenAI-compatible model server on each machine, which you install, start, and load models into yourself. OpenHuman does not do any of that, and neither does the gateway.
-* Enough memory and context headroom on each machine for the models you pick, including KV-cache and whatever concurrency you expect.
-* SSH access from the machine running the core to each remote machine.
-
-## Privacy implications
-
-* A loopback gateway is not the same thing as on-device inference. The gateway listens on `127.0.0.1`, but it forwards prompts to whatever upstream its own config names, which may be another machine.
-* OpenHuman classifies the `local-openai:` prefix as a local runtime and does not inspect the gateway's upstreams, so `local_only` privacy mode will not stop a prompt that the gateway relays off the box. Review those destinations yourself.
-* Keep authenticated remote inference behind SSH or HTTPS. Do not send bearer keys over plain HTTP across a network.
-* Changing inference destinations does not move the core's workspace, memory, or project files. Those stay where they were.
-
-***
-
-## Steps
-
-### 1. Start the model servers
-
-Run the small model on the Mac mini at `http://127.0.0.1:8080/v1`, for example under MLX or LM Studio. Run the larger model on the Linux PC at that machine's `http://127.0.0.1:8000/v1`, for example under vLLM. Use each runtime's own install and model-loading instructions.
-
-Then, on the Mac mini, forward the Linux endpoint over SSH and keep the tunnel up:
-
-```sh
-ssh -N -o ExitOnForwardFailure=yes -o ServerAliveInterval=30 \
- -L 127.0.0.1:18000:127.0.0.1:8000 [email protected]
-```
-
-The Linux server is now reachable as `http://127.0.0.1:18000/v1` on the Mac mini.
-
-### 2. Start the gateway
-
-Build and run the gateway following its own README. The backend mapping for this example looks like:
-
-```toml
-[server]
-host = "127.0.0.1"
-port = 18080
-
-[backends.MacMini]
-base_url = "http://127.0.0.1:8080/v1"
-endpoints = ["chat/completions"]
-
-[backends.LinuxGPU]
-base_url = "http://127.0.0.1:18000/v1"
-endpoints = ["chat/completions"]
-# For an authenticated upstream, name an environment variable the gateway reads:
-# api_key_env = "LINUX_LLM_API_KEY"
-```
-
-Check the config, start it, and read back the catalogue:
-
-```sh
-model-router --config router.toml --check-config
-model-router --config router.toml
-curl http://127.0.0.1:18080/v1/models
-```
-
-Use the binary's real path if it is not on `PATH`. A config check does not contact the upstreams, so read `router_errors` as well as `data`: one reachable backend does not mean every backend is ready. The catalogue prefixes each upstream model ID with its backend name, so `org/model:4bit` on the Mac mini appears as `MacMini:org/model:4bit`. Colons and slashes inside the upstream ID are left alone.
-
-### 3. Point OpenHuman at the gateway
-
-Merge the following into the active user's `config.toml`, keeping your other settings. Replace the placeholder model IDs with exact IDs from the gateway catalogue, and keep the workload keys at the top level, **before** the `[local_ai]` table, or TOML will read them as part of it:
-
-```toml
-chat_provider = "local-openai:MacMini:your-small-model-id"
-memory_provider = "local-openai:MacMini:your-small-model-id"
-reasoning_provider = "local-openai:LinuxGPU:your-large-model-id"
-agentic_provider = "local-openai:LinuxGPU:your-large-model-id"
-coding_provider = "local-openai:LinuxGPU:your-large-model-id"
-
-[local_ai]
-runtime_enabled = true
-opt_in_confirmed = true
-provider = "lm_studio"
-base_url = "http://127.0.0.1:18080/v1"
-chat_model_id = "MacMini:your-small-model-id"
-vision_model_id = ""
-```
-
-Three things are worth being precise about:
-
-| Key | What it actually does here |
-| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `local-openai:` prefix | Selects OpenHuman's generic OpenAI-compatible runtime (`crates/openhuman-core/src/inference/provider/factory/local_runtime.rs`). The rest of the string is passed to the endpoint unchanged, so `MacMini:your-small-model-id` reaches the gateway intact and the gateway strips `MacMini:` before forwarding. |
-| `local_ai.base_url` | The endpoint every `local-openai:` route falls back to. This is what points OpenHuman at the gateway. |
-| `local_ai.provider` | Selects which runtime the Local AI settings page talks to. It does not affect a `local-openai:` route, where the prefix decides. `lm_studio` is simply the existing identifier for a local OpenAI-compatible server. |
-
-`OPENHUMAN_LOCAL_INFERENCE_URL` and then `LOCAL_OPENAI_URL` in the core's environment both take priority over `local_ai.base_url`, so update or unset them when you change endpoints. The full precedence order is in [Local AI](../../features/model-routing/local-ai.md#supported-runtimes).
-
-Assign vision only to a vision-capable model, through `vision_provider` and `local_ai.vision_model_id`. This example is text-only and leaves vision and embeddings on their existing routes. Embeddings and the memory engine are configured separately, and adding a gateway does not reroute them: a gateway can forward an embeddings path to a compatible service, but it does not translate between APIs or start anything. Any workload you do not assign keeps the route it had.
-
-### 4. Verify each route
-
-Send a short chat message, which should land on the small model, then run a reasoning or agentic turn, which should land on the large one. Confirm the backend and model in the gateway's logs and the reply in OpenHuman. Model discovery and a `/health` probe are not proof of inference. If your models support streaming and tool calls, exercise both.
-
-***
-
-## Success checks
-
-* [ ] `curl http://127.0.0.1:18080/v1/models` lists models from every backend, with no entries in `router_errors`.
-* [ ] A chat turn answers, and the gateway log shows the Mac mini backend.
-* [ ] A reasoning or agentic turn answers, and the gateway log shows the Linux backend.
-* [ ] Killing the SSH tunnel makes the large-model workload fail rather than silently answer from somewhere else.
-
-## Common failures
-
-| What you see | Meaning | Fix |
-| ----------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
-| The model is not found | The workload names an ID that is not in the gateway catalogue | Copy the exact prefixed ID from `/v1/models` |
-| Only one backend answers | The other upstream is down, or its tunnel dropped | Check `router_errors`, then restart the server or the tunnel |
-| Every local route hits the wrong endpoint | An environment override is still set | Unset `OPENHUMAN_LOCAL_INFERENCE_URL` and `LOCAL_OPENAI_URL`, or point them at the gateway |
-| Workload keys are ignored | They were written after `[local_ai]`, so TOML read them as part of that table | Move them above the table |
-
-## Keeping it up
-
-Run the gateway under a per-user LaunchAgent or a systemd user service if you need it always available, and supervise the SSH tunnel separately. Re-check the gateway config and restart it after every change. This gateway returns an error on an upstream failure: there is no automatic retry and no fallback, which is the behaviour you want when the alternative is a silent reroute.
-
-The gateway listens only on loopback and has no inbound authentication of its own. It keeps upstream keys separate from the core's own `Authorization` header.
-
-## Next steps
-
-* [Use OpenHuman with a local model](local-model.md): the single-server version of this setup.
-* [Local AI (optional)](../../features/model-routing/local-ai.md): provider strings, endpoint precedence, and every `local_ai` field.
-* [Privacy Mode](../../features/privacy-and-security/privacy-mode.md): why `local_only` cannot vouch for a gateway's upstreams.
-* [Keep sensitive data private](privacy-sensitive-data.md): the broader picture of what leaves your machines.
diff --git a/docs/gitbooks/en/guides/guides/organize-project-folders.md b/docs/gitbooks/en/guides/guides/organize-project-folders.md
deleted file mode 100644
index 1c573c6cb8..0000000000
--- a/docs/gitbooks/en/guides/guides/organize-project-folders.md
+++ /dev/null
@@ -1,96 +0,0 @@
----
-description: >-
- Let OpenHuman tidy, rename, and restructure a folder of files safely, inside a
- boundary you set, with changes gated by your approval once the autonomy policy
- is on at the supervised tier.
-icon: folder-tree
----
-
-# Organize my project folders
-
-**Goal:** point the assistant at a folder and have it clean it up (sort files, rename consistently, remove clutter) without letting it roam your whole disk or make changes you didn't see.
-
-The core idea: the agent works inside a **boundary you define**, and with the autonomy policy on at the `supervised` tier, any file change that isn't provably read-only is **parked for your approval** before it runs. The tier is what decides that: at `full`, routine writes run on their own and only network, install and destructive actions stop to ask.
-
-***
-
-## Prerequisites
-
-* OpenHuman set up. See [Create my personal AI assistant](personal-assistant.md).
-* A specific folder you want organized. Ideally, make a copy first if the contents are irreplaceable.
-
-## Privacy implications
-
-* File organizing is **local**. Reading, moving, and renaming files happens on your machine.
-* If you ask the agent to _reason about_ file contents (e.g. "group these by topic"), it may send relevant snippets to the model to do that. Route inference to a [local model](local-model.md) if you want that reasoning on-device too.
-* The agent cannot touch system or credential folders (`~/.ssh`, `~/.gnupg`, `~/.aws`, OS directories). Those are blocked outright regardless of settings.
-
-***
-
-## Steps
-
-### 1. Decide where the agent may act
-
-{% hint style="warning" %}
-Everything in this step needs the autonomy policy switched on. It is **off by default**: set `[autonomy] enabled = true` in `config.toml` (`~/.openhuman/config.toml`, or `%USERPROFILE%\.openhuman\config.toml` on Windows). Without it, trusted roots, `workspace_only` and the approval gate are all inert and acting tool calls run unprompted. Credential stores and system roots stay blocked either way.
-{% endhint %}
-
-Confinement to the working folder has two preconditions: the policy enabled, and `workspace_only` on. With both, the agent's read/write root is its working folder and it has no ambient access to the rest of your disk. With either one off, that boundary is not enforced.
-
-A **trusted root** is the deliberate exception. Each one grants its subtree even though it sits outside the working folder, taking precedence over `workspace_only`. To let the agent work on a folder elsewhere, add that folder as a trusted root:
-
-* Open **Settings → Agent access**.
-* Add the target folder as a trusted root with read-write access.
-
-Keep the boundary as tight as the task: grant the one folder, not your home directory.
-
-### 2. Set the right autonomy tier
-
-In the same `[autonomy]` block, `level` decides how much runs without asking:
-
-* `supervised` _(recommended)_: the agent proposes each change and you approve moves, renames and deletes as they come, except where you have already put the tool on the always-allow list.
-* `full`: routine file writes run automatically. Still tighten the trusted root so "automatic" stays contained.
-
-Deleting and moving files are state-changing actions, so with `supervised` they are parked for your yes or no by the [Approval Gate](../../features/approval-gate.md). Answering **Always allow** to a prompt adds that tool to the always-allow list, and from then on its calls run without a fresh approval. Remove it from the list in **Settings → Agent access** when you want each call reviewed again.
-
-### 3. Ask for the reorganization
-
-Be concrete about the folder and the rules. For example:
-
-* "In my trusted `~/Documents/receipts` folder, rename every file to `YYYY-MM-DD-vendor.pdf` based on its contents, and move anything older than 2023 into an `archive/` subfolder."
-* "Group the loose files in this folder into subfolders by type, and show me the plan before doing anything."
-
-### 4. Review each proposed action
-
-When the agent wants to move, rename, or delete, an **Approval Request card** appears with the exact action. **Approve** one, **Always allow** a repetitive safe one, or **Deny**. You can also just type **yes** / **no**.
-
-***
-
-## Success checks
-
-* [ ] The policy is enabled and `workspace_only` is on, so the folder boundary is actually being enforced.
-* [ ] The agent only touched the folder you granted, and nothing outside your working folder and trusted roots changed.
-* [ ] Each move/rename/delete showed up as an approval prompt (unless you chose "Always allow" for that tool).
-* [ ] The folder matches the structure you asked for.
-* [ ] Files you didn't mention are untouched.
-
-## Common failures
-
-| Symptom | Cause | Fix |
-| ----------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
-| "I can't access that folder" | The folder isn't a trusted root, or `workspace_only` is confining the agent | Add it in **Settings → Agent access** as a read-write trusted root |
-| It asks for approval on every single file | The `supervised` tier gates each write | Use **Always allow** for the specific safe tool, or narrow the request so there are fewer actions |
-| It refuses to touch a path | The path is a blocked system/credential directory | That's by design; those paths are never accessible. Choose a normal working folder |
-| It reorganized more than you wanted | The instruction was broad | Ask it to "show the plan first"; approve selectively |
-
-## Recovery
-
-* **Nothing runs without approval** at the `supervised` tier, apart from the tools on your always-allow list. If a plan looks wrong, **Deny** and it doesn't happen.
-* **Undo is manual.** OpenHuman doesn't roll file operations back for you, so work on a **copy** of anything precious, or keep the folder under version control (e.g. `git`) so you can revert.
-* If the agent is doing too much, set both `enabled = true` and `level = "readonly"`. The level does nothing on its own: with `enabled = false` the whole policy is inert. With both set, the agent can still suggest a plan but can't change files.
-
-## See also
-
-* [Approval Gate](../../features/approval-gate.md): exactly what gets parked and why.
-* [Coder toolset](../../features/native-tools/coder.md): the filesystem/git tools the agent uses here.
-* [Privacy & Security](../../features/privacy-and-security/): workspace scoping and path hardening.
diff --git a/docs/gitbooks/en/guides/guides/personal-assistant.md b/docs/gitbooks/en/guides/guides/personal-assistant.md
deleted file mode 100644
index aed573c229..0000000000
--- a/docs/gitbooks/en/guides/guides/personal-assistant.md
+++ /dev/null
@@ -1,128 +0,0 @@
----
-description: >-
- Go from a fresh install to a working personal assistant that knows your
- context, respects the boundaries you set, and, at the supervised tier, acts
- only with your approval.
-icon: robot
----
-
-# Create my personal AI assistant
-
-**Goal:** a working assistant that has some memory of your world, replies in a style you like, and, once you put it on the supervised tier, takes no real-world action without your say-so.
-
-This is the "start here" guide. It assumes nothing beyond a downloaded app.
-
-***
-
-## Prerequisites
-
-* OpenHuman installed on macOS, Windows, or Linux. If you haven't installed yet, do [Getting Started](../../overview/getting-started.md) first, then come back.
-* 4 GB+ RAM (16 GB+ if you plan to connect very large mailboxes or run a [local model](local-model.md)).
-* An account to sign in with (social login works).
-* Optional: one account you'd like the assistant to know about (Gmail is the usual first one).
-
-## Privacy implications
-
-* Signing in **does not** grant ongoing access to anything. Every integration is a separate, explicit OAuth approval you can revoke later.
-* Your memory is stored by the engine you choose: hosted TinyHumans or your own CortexDB. With neither, memory is off.
-* By default, chat/reasoning runs through the OpenHuman-hosted [model router](../../features/model-routing/). If you want inference on-device instead, see [Use OpenHuman with a local model](local-model.md).
-* Full detail: [Keep sensitive data private](privacy-sensitive-data.md).
-
-***
-
-## Steps
-
-### 1. Sign in
-
-Launch the app. The first screen is **"Sign in! Let's Cook"**. Choose a login option. There is an **Advanced** panel for pointing at a custom core; most people ignore it.
-
-### 2. Choose how AI runs
-
-After sign-in you'll hit a **runtime choice**:
-
-* **Cloud**: one click, and the hosted model router handles inference. This is the fastest path to a working assistant.
-* **Custom**: walk through choosing your inference provider, voice, integrations (OAuth), web search, and embeddings yourself.
-
-If you're not sure, pick **Cloud**. You can change any of this later in **Settings**.
-
-### 3. Give it something to remember
-
-An assistant with no memory is just a chatbot. Connect at least one source so it has context to draw on:
-
-* Open **Settings** and connect an integration (Gmail is the common starting point). Each connection is a one-click OAuth approval.
-* Add folders, files or links as sources under **Connections → Memory** so they sync into [Memory](../../features/memory.md) on a schedule.
-
-### 4. Set your boundaries
-
-Open `config.toml` in your data folder (`~/.openhuman/config.toml`, or `%USERPROFILE%\.openhuman\config.toml` on Windows) and turn the policy on:
-
-```toml
-[autonomy]
-enabled = true
-level = "supervised" # "readonly" | "supervised" | "full"
-```
-
-| Tier | What it means |
-| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `readonly` | The assistant can observe and answer, but never acts (no sending, no file writes, no commands). |
-| `supervised` | It can act, but any state-changing, network, install, or destructive action is **parked for your approval** first, unless its tool is on your always-allow list. |
-| `full` | Routine actions run automatically; network, install and destructive actions still ask. |
-
-{% hint style="warning" %}
-**The policy is off until you set `enabled = true`.** It is not on out of the box, and there is no user-facing switch for the tier: the panel that holds the radios is a developer-only deep link. Until you turn it on, acting tool calls run without a prompt. Credential stores (`~/.ssh`, `~/.gnupg`, `~/.aws`) and system roots stay blocked either way.
-{% endhint %}
-
-`supervised` is the right starting point. With it on, nothing with an external effect happens in a chat without you saying yes: that is the [Approval Gate](../../features/approval-gate.md). The one exception is a tool you put on the always-allow list, by answering **Always allow** to a prompt. That tool runs from then on without a fresh approval. Remove it from the list in **Settings → Agent access** when you want per-call review back.
-
-**Settings → Agent access** holds the rest of the boundary once the policy is on: the trusted roots, the always-allow list, the action timeout and the workspace-only switch.
-
-### 5. Shape its personality (optional)
-
-How the assistant talks and behaves is defined by an editable prompt called **`SOUL.md`** (its mission and values live in a companion **`IDENTITY.md`**). You don't have to touch these (they ship with sensible defaults), but you can:
-
-* Set a display name and short description in **Settings → Personality**.
-* Edit the behavior itself via the **Brain** page (the raised center button in the bottom bar, `/brain`), where memory, goals, and intelligence live.
-
-OpenHuman also **learns** durable preferences from how you correct it over time. See [Personalization & Self-Learning](../../features/personalization.md).
-
-### 6. Run your first real request
-
-Once a source has been ingested, try:
-
-* "What do I need to know from the last 12 hours?"
-* "What's waiting on me?"
-* "Summarize what I missed today."
-
-***
-
-## Success checks
-
-You have a working assistant when **all** of these are true:
-
-* [ ] The app is signed in (you're past the welcome screen and in the chat/home view).
-* [ ] At least one integration shows as **connected** in Settings.
-* [ ] A briefing prompt ("what's waiting on me?") returns something drawn from your actual data, not a generic answer.
-* [ ] Opening **Connections → Memory → Brain** shows your source with an item count after it syncs.
-* [ ] When you ask it to do something with an external effect (e.g. "draft and send an email"), you see an **Approval Request card** appear above the chat box rather than it silently acting.
-
-## Common failures
-
-| Symptom | What it means | Fix |
-| ------------------------------------------------ | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
-| Sign-in returns to the welcome screen | The OAuth callback didn't reach the app | Follow [Troubleshooting Sign-In](../../overview/troubleshooting-sign-in.md) |
-| Connected a source but memory stays empty | Source not added or not synced yet, or the OAuth scope is too narrow | Press sync on the source; re-check the connection in Settings |
-| Assistant answers generically, ignores your data | It answered without recalling memory | Ask again and reference the source explicitly ("from my email…"); confirm the source is connected |
-| It performed an action you didn't expect | The autonomy policy is off, or `level` is `full` | Set `[autonomy] enabled = true` and `level = "supervised"` in `config.toml` |
-
-## Recovery
-
-* **Reset boundaries fast:** if the assistant is doing too much, set both `enabled = true` and `level = "readonly"` in `config.toml`. The level alone changes nothing while `enabled` is `false`, because the whole policy is inert then. With both set, it takes effect on the next turn and blocks all acting immediately.
-* **Nothing you connect is permanent:** revoke any integration from Settings; items already stored in your memory engine stay until you forget them (or tick **Also delete memory from this source** when disconnecting), and the next sync tick stops pulling that source.
-* **If the app itself won't start,** see [Recover from a failed installation](recover-failed-installation.md). Your configuration is preserved by default.
-
-***
-
-## Next steps
-
-* [Use OpenHuman with a local model](local-model.md): keep inference on-device.
-* [Keep sensitive data private](privacy-sensitive-data.md): understand exactly what leaves your machine.
diff --git a/docs/gitbooks/en/guides/guides/privacy-sensitive-data.md b/docs/gitbooks/en/guides/guides/privacy-sensitive-data.md
deleted file mode 100644
index 726ec9a3b0..0000000000
--- a/docs/gitbooks/en/guides/guides/privacy-sensitive-data.md
+++ /dev/null
@@ -1,107 +0,0 @@
----
-description: >-
- A plain-language map of what OpenHuman keeps on your computer versus what it
- sends out, and the settings that let you keep sensitive work local.
-icon: lock
----
-
-# Keep sensitive data private
-
-**Goal:** understand, in everyday language rather than architecture, what stays on your machine and what leaves it, so you can decide what OpenHuman should touch.
-
-If you want the engineering detail, read [Privacy & Security](../../features/privacy-and-security/). This guide is the version you can act on in five minutes.
-
-***
-
-## The one-sentence version
-
-**Your settings and local secrets stay on your computer; your memory is stored in CortexDB (hosted by TinyHumans for your account, or your own). The OpenHuman backend handles what has to be brokered: signing you in, hosted memory, routing model requests, and talking to the services you connect.**
-
-Everything below is an expansion of that sentence.
-
-***
-
-## What stays on your machine
-
-These never leave your computer as raw data:
-
-| Thing | Plain meaning |
-| ----------------------------- | -------------------------------------------------------------------------------------- |
-| **Audio you speak** | Captured to transcribe, then discarded. |
-| **Local model state** | If you use [local AI](local-model.md), your own runtime and its models stay on-device. |
-| **Your persona and settings** | The files that define how your assistant behaves and what it's allowed to do. |
-
-## Where your memory is stored
-
-When memory is on, documents, conversations, learnings and the beliefs built from them are stored in **CortexDB**. With TinyHumans-hosted memory they are not stored on your computer; a CortexDB you self-host may keep them on your own machine (with no engine available, memory is off and nothing is stored):
-
-* **TinyHumans engine (default when signed in):** stored in the hosted CortexDB that TinyHumans runs, through the TinyHumans backend. Each account gets its own isolated tenant, so other users cannot see your memory. TinyHumans operates that service.
-* **CortexDB engine:** stored in your own CortexDB account or self-hosted CortexDB, reached directly with your key. A CortexDB you run on your own machine keeps the data on that machine.
-
-Secrets and personal identifiers are scrubbed before an item is sent. You can forget single items or whole sources from the Memory page; see [Deleting memory](../../features/privacy-and-security/#deleting-memory) for erasing everything.
-
-## What the backend handles (and why)
-
-These leave your machine because they can't work otherwise, but note _what_ is sent:
-
-| Thing | What's actually sent |
-| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **Hosted memory** | With the TinyHumans engine, every item stored and every recall goes through the backend to hosted CortexDB. |
-| **Model requests** | Only what the assistant needs for that turn: your prompt plus the memory recalled for it. Not your whole memory. |
-| **Web search** | Your search query goes to the backend proxy (so you don't need your own search key). |
-| **Connected services** | When you connect Gmail, Slack, etc., the backend brokers each request. Your login tokens for those services are held by the backend, **not written in plain text on your laptop**. |
-| **Text-to-speech** | The words to be spoken are streamed to generate audio, then discarded. They are not retained. |
-
-{% hint style="info" %}
-**Memory is not local, so scrubbing and scoping matter.** Your memory engine stores items in CortexDB and answers recall there. What protects you is that items are scrubbed before they are sent, tool-call arguments are never stored, hosted memory is isolated per account, and a model turn sees only what was recalled for it.
-{% endhint %}
-
-## Two promises worth knowing
-
-* **No training on your data.** Your conversations, memory, and personal information are never used to train models.
-* **Secrets are stored by your operating system.** Local secrets are kept in your platform's secure store (macOS Keychain, Windows Credential Manager, or the Linux Secret Service), not lying around in app files. See [OS Keyring & Secret Storage](../../features/privacy-and-security/os-keyring-and-secret-storage.md).
-
-***
-
-## Turning the dial toward "more local"
-
-You have real controls. From most to least private:
-
-1. **Route inference on-device.** Run a local runtime such as Ollama yourself, pull the models, and [add it as a provider](local-model.md) so embeddings, summarization, and optionally chat/reasoning happen on your machine. OpenHuman doesn't install the runtime or download models for you. _(Speech and web search still use the backend proxy even then.)_
-2. **Tighten what the assistant can do.** Set `[autonomy] enabled = true` and `level = "readonly"` in `config.toml`: it can then observe and answer but never act or reach the network on its own. The policy is **off by default**, so this is a switch you have to throw, not one to leave alone. See the [Approval Gate](../../features/approval-gate.md).
-3. **Keep it in one folder.** The filesystem boundary has two preconditions: the policy enabled, and `workspace_only` on. With both, the agent is confined to its working folder and cannot read the rest of your disk. With either one off, that boundary is not enforced. A **trusted root** is the deliberate exception: each one you add grants its subtree outside the working folder, taking precedence over `workspace_only`. System and credential folders (`~/.ssh`, `~/.gnupg`, `~/.aws`, and OS directories) are blocked outright regardless of all three.
-4. **Connect only what you need.** Every integration is a separate OAuth approval you grant (and can revoke) individually. Revoking stops the next sync; memory already collected stays in your memory engine until you forget it.
-
-## Built-in protections you didn't have to configure
-
-* **Prompt-injection screening.** Incoming content is screened for attempts to hijack the assistant's instructions before it acts on them.
-* **Secret & PII redaction on save.** When content is written into long-lived memory, OpenHuman strips things like API keys, tokens, private-key blocks, and personal identifiers so they don't get stored.
-* **Encrypted in transit.** All traffic between the app and the backend is TLS. Nothing travels in plain text.
-
-***
-
-## Success checks
-
-You know your privacy posture when you can answer these:
-
-* [ ] Is the autonomy policy on, and do you know its tier? (Check `[autonomy]` in `config.toml`.)
-* [ ] If you are relying on the filesystem boundary, is `workspace_only` on as well, and do you know which trusted roots grant access outside the working folder?
-* [ ] Do you know which integrations are connected? (Check **Settings**; disconnect any you don't need.)
-* [ ] If locality matters for a workload, is it routed to a [local provider](local-model.md) that is running and answering?
-* [ ] Are you comfortable that model turns send _retrieved snippets_, not your whole memory?
-
-## Common misunderstandings
-
-| Belief | Reality |
-| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
-| "My memory is stored on my laptop." | It is stored in CortexDB (hosted by TinyHumans, or yours). Only bookkeeping is local. |
-| "OpenHuman uploads my whole memory to the model to answer." | The model gets only what was recalled for that specific turn. |
-| "My service passwords are on my laptop." | Integration tokens are held by the backend; local secrets go in your OS keychain. |
-| "Turning on local AI makes _everything_ local." | Speech-to-text, text-to-speech, and web search still use the backend proxy by default, and memory is still stored in CortexDB. |
-| "Revoking an integration deletes what it already gathered." | Already-ingested memory stays in your memory engine until you forget it; revoking only stops future syncing. |
-
-## See also
-
-* [Privacy & Security](../../features/privacy-and-security/): the detailed architecture.
-* [Use OpenHuman with a local model](local-model.md): keep inference on-device.
-* [Create a safe companion for a child](child-safe-companion.md): the strictest lockdown, composed from these controls.
diff --git a/docs/gitbooks/en/guides/guides/recover-failed-installation.md b/docs/gitbooks/en/guides/guides/recover-failed-installation.md
deleted file mode 100644
index 995eb67161..0000000000
--- a/docs/gitbooks/en/guides/guides/recover-failed-installation.md
+++ /dev/null
@@ -1,124 +0,0 @@
----
-description: >-
- Get a broken or half-installed OpenHuman running again without losing your
- memory, personas, or settings. Configuration is preserved by default.
-icon: life-ring
----
-
-# Recover from a failed installation
-
-**Goal:** the app won't install, won't start, or starts broken, and you want it working again **without wiping your data**.
-
-The guiding rule of this guide: **your configuration and memory are preserved by default.** Recovery means fixing the runtime around your data, not deleting the data. We only touch your data folder as an explicit, backed-up last resort.
-
-***
-
-## Prerequisites
-
-* Nothing special. You can do all of this from the app plus a file manager and, occasionally, a terminal.
-* Know where your data lives. **Everything OpenHuman persists is in one folder:**
-
- | Platform | Data folder |
- | ------------- | --------------------------- |
- | macOS / Linux | `~/.openhuman/` |
- | Windows | `%USERPROFILE%\.openhuman\` |
-
- Leave that folder alone unless a step here explicitly says to touch it.
-
-## Privacy implications
-
-* Recovery is local. You're restarting or reinstalling software; your memory never gets uploaded as part of this.
-* If you file a bug report, **redact secrets**. Attach status codes, app version, OS, and log lines, never tokens or JWTs.
-
-***
-
-## First: read the logs
-
-Almost every failure names itself in the log. Get to the logs first; it turns guessing into fixing.
-
-* **In the app (if it opens):** **Settings → About → App Logs Folder**. There's a button to reveal the folder in your file manager.
-* **On disk:** logs are under your data folder, e.g. `~/.openhuman/logs/openhuman.<date>.log` (Windows: `%USERPROFILE%\.openhuman\logs\openhuman.*.log`). They rotate daily.
-
-Open the most recent log and read the last error lines. Match the message to the tables below.
-
-***
-
-## Recovery ladder
-
-Work top to bottom. **Stop as soon as it works.** Each rung is more disruptive than the last, and the early rungs never touch your data.
-
-### Rung 1: Restart cleanly
-
-* Fully quit OpenHuman (make sure no leftover process is running) and reopen it.
-* Only **one** instance should run at a time. A second copy can hold a lock the first one needs.
-
-### Rung 2: Reinstall the app over your data
-
-Reinstalling the **application** does not delete your **data folder**; they're separate. This fixes a corrupted or partial install while preserving everything.
-
-* Download the current build from [tinyhumans.ai/openhuman](https://tinyhumans.ai/openhuman) and install over the top.
-* On macOS, install the real `.app` bundle (some features need the bundle, not a dev build).
-* Reopen. Your memory, personas, and settings are still there because they live in `~/.openhuman/`, which you didn't touch.
-
-### Rung 3: Fix the specific error
-
-Match your symptom:
-
-| Symptom in logs / UI | Cause | Fix |
-| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Sign-in stalls after the provider step; log mentions `openhuman://` scheme **not registered** (Windows) | The URL handler didn't register, or the install was moved after first launch | Follow the repair steps in [Troubleshooting Sign-In](../../overview/troubleshooting-sign-in.md#windows-openhuman-handler-not-registered) |
-| App won't render, or the window opens blank | A previous instance is still holding the port or the webview data directory | Ensure no other OpenHuman is running; if it persists, close all instances and relaunch |
-| Local AI / Ollama errors | The local runtime you configured isn't running, or a model isn't pulled | This does **not** block the app. OpenHuman doesn't install or start the runtime; start it yourself, see [Use OpenHuman with a local model](local-model.md#common-failures) |
-| "Low disk space" warning, or writes failing | The workspace can't be written | Free up space (the app wants a healthy margin, a few hundred MB minimum) and restart |
-
-### Rung 4: Move the data folder aside (non-destructive reset)
-
-If the app still won't start and you suspect the **data folder** itself is the problem, **rename** it rather than delete it. This gives you a clean start while keeping a full backup you can restore from.
-
-{% hint style="warning" %}
-Quit OpenHuman completely before moving its folder.
-{% endhint %}
-
-```bash
-# macOS / Linux
-mv ~/.openhuman ~/.openhuman.backup-$(date +%Y%m%d)
-```
-
-```powershell
-# Windows (PowerShell)
-Rename-Item "$env:USERPROFILE\.openhuman" ".openhuman.backup"
-```
-
-Relaunch. OpenHuman recreates a fresh data folder and you sign in again.
-
-* If the fresh start **works**, the old folder was the issue, but your data is safe in the backup. You can copy specific pieces back (your workspace files such as `SOUL.md` or `config.toml`) and test after each.
-* If it **still fails**, the data folder wasn't the cause. **Restore your backup** by renaming it back, so you lose nothing, and escalate (below).
-
-***
-
-## Success checks
-
-You've recovered when:
-
-* [ ] The app launches to the sign-in or chat screen without crashing.
-* [ ] You can sign in and reach your home/chat view.
-* [ ] Your **Memory** tab still shows your existing summaries (confirming your data survived).
-* [ ] The most recent log file shows a clean startup with no repeating error.
-
-## What "preserved by default" means here
-
-At no point in Rungs 1 to 3 do you delete anything. Rung 4 **renames** your data folder; it never removes it. Even the most aggressive step is fully reversible. Reinstalling the app and reinstalling the OS-level runtime never target your `~/.openhuman/` data.
-
-## If you're still stuck
-
-Gather this and open an issue on [GitHub](https://github.com/tinyhumansai/openhuman) or ask on [Discord](https://guild.tinyhumans.ai):
-
-* App version and OS.
-* The last error lines from the log (**tokens/JWTs redacted**).
-* Which rung you reached and what happened.
-* Whether moving the data folder aside changed anything.
-
-## See also
-
-* [Troubleshooting Sign-In](../../overview/troubleshooting-sign-in.md): the deep dive for auth-specific failures.
-* [Move OpenHuman to a new PC](move-to-new-pc.md): the same data folder is what you carry over.
diff --git a/docs/gitbooks/en/guides/local-model.md b/docs/gitbooks/en/guides/local-model.md
new file mode 100644
index 0000000000..87738902a0
--- /dev/null
+++ b/docs/gitbooks/en/guides/local-model.md
@@ -0,0 +1,109 @@
+---
+description: >-
+ Run a local model runtime yourself (Ollama, LM Studio, MLX or any
+ OpenAI-compatible server), pull your own models, and add the endpoint to
+ OpenHuman as a provider.
+icon: microchip
+---
+
+# Use OpenHuman with a local model
+
+This guide moves some or all of OpenHuman's model work onto your own computer, so the data for those workloads never leaves the machine.
+
+OpenHuman does not install a runtime, start it or download models. You run the runtime and pull the models, and OpenHuman calls the endpoint you give it. Local AI is opt-in: adding a local provider reroutes nothing until you point workloads at it.
+
+For the config reference (provider strings, endpoint overrides and every workload field), see [Local AI](../features/model-routing/local-ai.md). This page is the task-oriented version.
+
+## Prerequisites
+
+- A local runtime you install and run yourself:
+ - [Ollama](https://ollama.com), default address `http://localhost:11434`.
+ - [LM Studio](https://lmstudio.ai) with its local server enabled, default `http://localhost:1234/v1`.
+ - MLX (`mlx_lm.server`), OMLX, or any other OpenAI-compatible server.
+- Disk and RAM for the models you pick. A small chat model plus `bge-m3` for embeddings takes a few GB on disk. 8 GB of RAM is a sensible minimum.
+
+## Privacy implications
+
+- Workloads you route locally run on-device, and nothing about that work is sent out.
+- Anything you leave on the default route still goes through the OpenHuman [model router](../features/model-routing/README.md). Local AI changes only the workloads you move.
+- Without [Privacy mode](../features/privacy-mode.md), lightweight hints routed locally can fall back to the remote provider if the runtime is unreachable. Turn on `local_only` privacy mode if strict locality matters. An unreachable runtime then makes the request fail instead.
+
+## Steps
+
+### 1. Start the runtime
+
+Install and launch the runtime so its server is running. For Ollama, confirm from a terminal:
+
+```bash
+curl http://localhost:11434/api/tags
+```
+
+A JSON list of models, even an empty one, means the server is reachable. For LM Studio or another OpenAI-compatible server, `curl http://localhost:1234/v1/models` (adjust the port) should return a model list.
+
+### 2. Pull the models yourself
+
+OpenHuman never pulls models. Pull every model you plan to use before you configure it. For Ollama:
+
+```bash
+ollama pull gemma3:4b-it-qat # chat, and vision from 4B up
+ollama pull bge-m3 # memory embeddings (1024 dimensions)
+```
+
+In LM Studio, download the model in LM Studio and load it. For MLX or another server, start it with the model you want served.
+
+See [Local models and bring your own key](../features/model-routing/local-and-byok-models.md) for which models can do chat, vision and embeddings.
+
+### 3. Add the endpoint as a provider
+
+Open **Connections → LLM** and choose **Add a provider**:
+
+- For Ollama, LM Studio or OMLX, pick it under **Local runtimes**. The default endpoint is filled in. Change it if your runtime listens elsewhere.
+- For MLX or another server, choose **Add a custom provider** and enter its OpenAI-compatible endpoint, for example `http://127.0.0.1:8080/v1`.
+
+When you save, OpenHuman asks the endpoint for its model list. If the runtime is not reachable, the provider is not saved. Fix step 1 and try again.
+
+### 4. Route workloads to it
+
+Use **Custom routing** on the workloads you want local (chat, reasoning, vision and so on) and pick a model the runtime reported. Only models you have pulled or loaded appear.
+
+For memory embeddings, open **Connections → Embeddings** and choose Ollama with `bge-m3`, or set `embeddings_provider = "ollama:bge-m3"` in `config.toml`.
+
+### 5. Test that it answers
+
+Send a short message on a workload you routed locally, or use the model test in the LLM panel. A coherent reply means the path works end to end: the endpoint is reachable, the model is present and inference runs. For Ollama you can also watch `ollama ps` while the request runs.
+
+## Success checks
+
+Local AI is working when:
+
+- [ ] The local provider shows as connected under **Connections → LLM**, and its model list contains the models you pulled.
+- [ ] A turn routed to the local provider returns a real reply.
+- [ ] For embeddings, new summaries keep appearing in the Memory tab after the next memory sync, with the runtime running.
+
+## Common failures
+
+| What you see | Meaning | Fix |
+| --------------------------------------------------------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
+| The provider will not save and the endpoint is reported unreachable | OpenHuman cannot reach the runtime at that address | Start the runtime, check the port with `curl`, and correct the endpoint |
+| The model you want is not in the picker | The runtime does not have it | `ollama pull <model>`, or download and load it in LM Studio, then reopen the picker |
+| A request fails saying the model is not found | The workload names a model the runtime no longer has | Pull it again, or route the workload to a model you have |
+| Ollama answers but every model call fails | Ollama's model runner is broken | Quit and relaunch Ollama, then retry |
+| Embeddings fail with a dimension error | The embedding model does not produce 1024-dimension vectors | Use `bge-m3` |
+| Agent turns lose context on Ollama | Ollama's default context window is small | Set `local_ai.num_ctx` (for example `8192`) |
+| Answers feel cloud-quality | The runtime was unreachable and a lightweight hint fell back to remote | Fix reachability. Use `local_only` privacy mode if fallback is unacceptable |
+
+## Recovery
+
+- **Back to cloud.** Set the routed workloads back to the default route in **Custom routing**, or remove the local provider. No data is lost.
+- **Stuck runtime.** Quit the runtime fully and relaunch it. OpenHuman reconnects on the next request.
+- **Disk pressure.** Model pulls happen in your runtime, not in OpenHuman. Free space and pull again with the runtime's own command.
+
+## What stays in the cloud anyway
+
+Some workloads use the backend unless you configure something else. Speech-to-text and web search go through the backend proxy. Text-to-speech uses the hosted voice unless you install Piper yourself and set `PIPER_BIN`. See [what stays in the cloud](../features/model-routing/local-ai.md#what-stays-in-the-cloud-by-default).
+
+## See also
+
+- [Local AI](../features/model-routing/local-ai.md): the config reference.
+- [Keep sensitive data private](privacy-sensitive-data.md): what stays local and what leaves.
+- [Automatic model routing](../features/model-routing/README.md): how tasks get matched to models.
diff --git a/docs/gitbooks/en/guides/move-to-new-pc.md b/docs/gitbooks/en/guides/move-to-new-pc.md
new file mode 100644
index 0000000000..f946aa0ff8
--- /dev/null
+++ b/docs/gitbooks/en/guides/move-to-new-pc.md
@@ -0,0 +1,114 @@
+---
+description: >-
+ Carry your OpenHuman persona, workspace and model config to a new computer,
+ and learn which secrets travel and which you re-enter.
+icon: truck
+---
+
+# Move OpenHuman to a new PC
+
+This guide sets up OpenHuman on a new machine so it picks up where the old one left off, with the same persona and settings and your memory reconnected. In short, copy one folder and sign back in. The details below cover what a folder copy does and does not carry.
+
+## Prerequisites
+
+- Both computers, or a backup of the old one's data folder.
+- Your OpenHuman sign-in credentials.
+- A way to move files between them, such as an external drive or a secure file transfer.
+
+## What lives where
+
+Everything OpenHuman keeps on disk is in one folder:
+
+| Platform | Data folder |
+| --- | --- |
+| macOS and Linux | `~/.openhuman/` |
+| Windows | `%USERPROFILE%\.openhuman\` |
+
+These are the parts you care about moving:
+
+| What | Where | Travels with a folder copy? |
+| --- | --- | --- |
+| Memory items | In your engine (TinyHumans or CortexDB) | No. Sign in again or re-enter the key |
+| Persona and behavior | `SOUL.md`, `IDENTITY.md`, `ROLE.md` | Yes |
+| Config (models, providers, routing, autonomy) | `config.toml` | Yes |
+| Session history | `sessions/`, `session_raw/` | Yes |
+| Approval history | `approval/approval.db` | Yes |
+| OS-stored secrets (session token, some local keys) | Your OS keychain, not this folder | No. Re-established on sign-in |
+| Integration access (Gmail, Slack, and so on) | Held by the backend against your account | No. Reconnects on sign-in |
+
+{% hint style="info" %}
+OpenHuman keeps secrets out of loose files on purpose. Your session token and some local secrets live in the operating system's secure store (Keychain, Credential Manager or Secret Service), and the backend holds your integration tokens against your account. The folder copy carries your data and persona, and signing in on the new machine restores the secrets and integrations. You never copy raw tokens by hand.
+{% endhint %}
+
+## Steps
+
+### 1. Quit OpenHuman on the old machine
+
+Close the app fully so nothing is mid-write to the database. A clean copy needs a quiet source.
+
+### 2. Copy the data folder
+
+Copy the entire data folder from the old machine to the same location on the new one:
+
+- macOS and Linux: copy `~/.openhuman/` to `~/.openhuman/`.
+- Windows: copy `%USERPROFILE%\.openhuman\` to `%USERPROFILE%\.openhuman\`.
+
+Copy the whole folder instead of picking files. That keeps persona, config and history consistent with each other.
+
+The data folder holds config but not the files the agent created or edited in its action sandbox. Also copy your projects folder, by default `~/OpenHuman/projects`, or wherever you pointed the action directory. Otherwise those project files stay on the old PC. That folder also holds `Files` (`~/OpenHuman/projects/Files`), where the agent saves the decks, documents, images and videos it delivers.
+
+{% hint style="warning" %}
+Copy it somewhere secure. The folder contains your personal data in readable form, so treat the transfer like moving personal documents.
+{% endhint %}
+
+### 3. Install OpenHuman on the new machine
+
+Install the current build from [tinyhumans.ai/openhuman](https://tinyhumans.ai/openhuman) or the [latest release](https://github.com/tinyhumansai/openhuman/releases/latest). If the data folder is already in place, the app finds it on launch. The order does not matter much. You can install first and copy after, as long as the app is not running during the copy.
+
+### 4. Launch and sign in
+
+Open the app and sign in with the same account. Signing in:
+
+- Re-establishes your session token in the new machine's OS keychain.
+- Reconnects your account, so integrations held by the backend come back.
+
+### 5. Reconnect anything tied to your account
+
+- **Integrations** (Gmail, Slack and so on): confirm they show as connected under **Settings**. If one needs a fresh OAuth approval, approve it again. It takes one click.
+- **Your own keys:** if you entered your own provider API key, a Composio direct key or similar local secrets, enter them again. They live in the OS keychain and do not travel in the folder.
+
+### 6. Re-check model and provider config
+
+Your `config.toml` came along, so model routing and provider choices should already match. If you used a [local model](local-model.md), remember that Ollama or LM Studio is separate software, and the model weights live in its own store, not in the OpenHuman data folder. Install the runtime on the new machine and pull the same models yourself, for example `ollama pull bge-m3`. OpenHuman does not download them.
+
+## Success checks
+
+The move worked when:
+
+- [ ] The Memory tab on the new machine shows your existing summaries.
+- [ ] The assistant replies in your configured style, and your display name and persona are intact.
+- [ ] Connected integrations show as connected under **Settings**. Reconnect any that do not.
+- [ ] Your autonomy tier and settings match what you had (check **Settings → Agents → Agent access**).
+- [ ] If you use local AI, the runtime is installed and running, you have pulled the models your workloads name, and a turn routed to the local provider answers.
+
+## Common failures
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| The new machine starts fresh with no memory | The data folder was in the wrong place, or the app was running during the copy | Quit the app, place the folder at `~/.openhuman/` (or `%USERPROFILE%\.openhuman\`), and relaunch |
+| Signed in but integrations are disconnected | Integration access is tied to your account, not the folder | Reconnect each integration in Settings. Each takes one OAuth click |
+| The local model does not work on the new PC | Ollama or LM Studio and the weights are not on the new machine | Install the runtime and pull the models yourself. See the [local model guide](local-model.md) |
+| The assistant lost its personality | `SOUL.md` and `IDENTITY.md` were not copied | Copy the whole data folder, not just the database |
+| Sign-in stalls on the new machine | An auth or handler issue unrelated to the move | See [Troubleshooting sign-in](../overview/troubleshooting-sign-in.md) |
+
+## Recovery
+
+- Keep the old machine's folder until you have verified the new one. Do not wipe the source until every success check passes.
+- If the new machine will not start at all, treat it as a fresh-install problem and follow [Recover from a failed installation](recover-failed-installation.md). Your copied folder is safe to move aside and restore.
+
+## See also
+
+- [Recover from a failed installation](recover-failed-installation.md): the same data folder, a different problem.
+- [Keep sensitive data private](privacy-sensitive-data.md): why secrets are stored the way they are.
+- [Use OpenHuman with a local model](local-model.md): setting up a runtime on the new machine.
+- [OS keyring and secret storage](../features/os-keyring-and-secret-storage.md): what the keychain holds instead of the folder.
diff --git a/docs/gitbooks/en/guides/multiple-local-llm-servers.md b/docs/gitbooks/en/guides/multiple-local-llm-servers.md
new file mode 100644
index 0000000000..2da8fde28e
--- /dev/null
+++ b/docs/gitbooks/en/guides/multiple-local-llm-servers.md
@@ -0,0 +1,146 @@
+---
+description: >-
+ Send different OpenHuman workloads to models on different machines you own,
+ behind one OpenAI-compatible gateway, with a Mac mini and Linux GPU PC
+ example.
+icon: network-wired
+---
+
+# Use multiple local LLM servers
+
+This guide shows how to keep a small, fast model and a large, slow one on separate machines you own, and send each OpenHuman workload to the right one.
+
+OpenHuman talks to one endpoint per provider string. If your models live on more than one machine, put a gateway in front of them. The gateway exposes a single OpenAI-compatible endpoint and uses a prefix on the model ID to pick the upstream. This guide uses [Model Router](https://github.com/tjm8874/model-router), an independent, MIT-licensed community project. OpenHuman does not bundle, install or supervise it, and any compatible gateway works the same way.
+
+The example puts the OpenHuman core, the gateway and a small model on a Mac mini, and a larger model server on a Linux GPU PC:
+
+```text
+OpenHuman core (Mac mini)
+ └─ gateway, 127.0.0.1:18080/v1
+ ├─ MacMini:small-model → local model server, 127.0.0.1:8080/v1
+ └─ LinuxGPU:large-model → SSH tunnel → Linux PC, 127.0.0.1:8000/v1
+```
+
+## Prerequisites
+
+- A single-server local setup you already understand. Start with [Use OpenHuman with a local model](local-model.md) if you have not routed one workload locally yet.
+- An OpenAI-compatible model server on each machine. You install it, start it and load models yourself. Neither OpenHuman nor the gateway does that.
+- Enough memory and context room on each machine for your models, including KV cache and the concurrency you expect.
+- SSH access from the machine running the core to each remote machine.
+
+## Privacy implications
+
+- A gateway on loopback is not on-device inference. It listens on `127.0.0.1`, but it forwards prompts to whatever upstream its config names, which may be another machine.
+- OpenHuman treats the `local-openai:` prefix as a local runtime and does not inspect the gateway's upstreams. `local_only` privacy mode will not stop a prompt that the gateway relays off the box, so review those destinations yourself.
+- Keep authenticated remote inference behind SSH or HTTPS. Do not send bearer keys over plain HTTP across a network.
+- Changing inference destinations does not move the core's workspace, memory or project files.
+
+## Steps
+
+### 1. Start the model servers
+
+Run the small model on the Mac mini at `http://127.0.0.1:8080/v1`, for example under MLX or LM Studio. Run the larger model on the Linux PC at its own `http://127.0.0.1:8000/v1`, for example under vLLM. Follow each runtime's install and model-loading instructions.
+
+Then, on the Mac mini, forward the Linux endpoint over SSH and keep the tunnel up:
+
+```sh
+ssh -N -o ExitOnForwardFailure=yes -o ServerAliveInterval=30 \
+ -L 127.0.0.1:18000:127.0.0.1:8000 [email protected]
+```
+
+The Linux server is now reachable on the Mac mini as `http://127.0.0.1:18000/v1` on the Mac mini.
+
+### 2. Start the gateway
+
+Build and run the gateway following its README. The backend mapping for this example looks like this:
+
+```toml
+[server]
+host = "127.0.0.1"
+port = 18080
+
+[backends.MacMini]
+base_url = "http://127.0.0.1:8080/v1"
+endpoints = ["chat/completions"]
+
+[backends.LinuxGPU]
+base_url = "http://127.0.0.1:18000/v1"
+endpoints = ["chat/completions"]
+# For an authenticated upstream, name an environment variable the gateway reads:
+# api_key_env = "LINUX_LLM_API_KEY"
+```
+
+Check the config, start it, and read back the catalogue:
+
+```sh
+model-router --config router.toml --check-config
+model-router --config router.toml
+curl http://127.0.0.1:18080/v1/models
+```
+
+Use the binary's real path if it is not on `PATH`. A config check does not contact the upstreams, so read `router_errors` as well as `data`, because one reachable backend does not mean every backend is ready. The catalogue prefixes each upstream model ID with its backend name, so `org/model:4bit` on the Mac mini appears as `MacMini:org/model:4bit`. Colons and slashes inside the upstream ID are left alone.
+
+### 3. Point OpenHuman at the gateway
+
+Merge the following into the active user's `config.toml`, keeping your other settings. Replace the placeholder model IDs with exact IDs from the gateway catalogue. Keep the workload keys at the top level, before the `[local_ai]` table, or TOML reads them as part of it:
+
+```toml
+chat_provider = "local-openai:MacMini:your-small-model-id"
+memory_provider = "local-openai:MacMini:your-small-model-id"
+reasoning_provider = "local-openai:LinuxGPU:your-large-model-id"
+agentic_provider = "local-openai:LinuxGPU:your-large-model-id"
+coding_provider = "local-openai:LinuxGPU:your-large-model-id"
+
+[local_ai]
+runtime_enabled = true
+opt_in_confirmed = true
+provider = "lm_studio"
+base_url = "http://127.0.0.1:18080/v1"
+chat_model_id = "MacMini:your-small-model-id"
+vision_model_id = ""
+```
+
+Three keys need care:
+
+| Key | What it does here |
+| --- | --- |
+| `local-openai:` prefix | Selects OpenHuman's generic OpenAI-compatible runtime (`crates/openhuman-core/src/inference/provider/factory/local_runtime.rs`). The rest of the string is passed to the endpoint unchanged, so `MacMini:your-small-model-id` reaches the gateway intact and the gateway strips `MacMini:` before forwarding. |
+| `local_ai.base_url` | The endpoint every `local-openai:` route falls back to. This is what points OpenHuman at the gateway. |
+| `local_ai.provider` | Selects which runtime the Local AI settings page talks to. It does not affect a `local-openai:` route, where the prefix decides. `lm_studio` is simply the existing identifier for a local OpenAI-compatible server. |
+
+`OPENHUMAN_LOCAL_INFERENCE_URL` and `LOCAL_OPENAI_URL` in the core's environment both take priority over `local_ai.base_url`, in that order. Update or unset them when you change endpoints. The full precedence order is in [Local AI](../features/model-routing/local-ai.md#supported-runtimes).
+
+Assign vision only to a vision-capable model, through `vision_provider` and `local_ai.vision_model_id`. This example is text-only and leaves vision and embeddings on their existing routes. Embeddings and the memory engine are configured separately, and a gateway does not reroute them. A gateway can forward an embeddings path to a compatible service, but it does not translate between APIs or start anything. Any workload you do not assign keeps its route.
+
+### 4. Verify each route
+
+Send a short chat message, which should land on the small model. Then run a reasoning or agentic turn, which should land on the large one. Confirm the backend and model in the gateway logs and the reply in OpenHuman. Model discovery and a `/health` probe do not prove inference works. If your models support streaming and tool calls, test both.
+
+## Success checks
+
+- [ ] `curl http://127.0.0.1:18080/v1/models` lists models from every backend, with no entries in `router_errors`.
+- [ ] A chat turn answers, and the gateway log shows the Mac mini backend.
+- [ ] A reasoning or agentic turn answers, and the gateway log shows the Linux backend.
+- [ ] Killing the SSH tunnel makes the large-model workload fail instead of silently answering from somewhere else.
+
+## Common failures
+
+| What you see | Meaning | Fix |
+| --- | --- | --- |
+| The model is not found | The workload names an ID that is not in the gateway catalogue | Copy the exact prefixed ID from `/v1/models` |
+| Only one backend answers | The other upstream is down, or its tunnel dropped | Check `router_errors`, then restart the server or the tunnel |
+| Every local route hits the wrong endpoint | An environment override is still set | Unset `OPENHUMAN_LOCAL_INFERENCE_URL` and `LOCAL_OPENAI_URL`, or point them at the gateway |
+| Workload keys are ignored | They were written after `[local_ai]`, so TOML read them as part of that table | Move them above the table |
+
+## Keeping it up
+
+Run the gateway under a per-user LaunchAgent or a systemd user service if you need it always available, and supervise the SSH tunnel separately. Re-check the gateway config and restart it after every change. This gateway returns an error when an upstream fails. It has no automatic retry and no fallback, which is what you want when the alternative is a silent reroute.
+
+The gateway listens only on loopback and has no inbound authentication of its own. It keeps upstream keys separate from the core's `Authorization` header.
+
+## Next steps
+
+- [Use OpenHuman with a local model](local-model.md): the single-server version of this setup.
+- [Local AI](../features/model-routing/local-ai.md): provider strings, endpoint precedence and every `local_ai` field.
+- [Privacy mode](../features/privacy-mode.md): why `local_only` cannot vouch for a gateway's upstreams.
+- [Keep sensitive data private](privacy-sensitive-data.md): what leaves your machines.
diff --git a/docs/gitbooks/en/guides/organize-project-folders.md b/docs/gitbooks/en/guides/organize-project-folders.md
new file mode 100644
index 0000000000..52af8d8b06
--- /dev/null
+++ b/docs/gitbooks/en/guides/organize-project-folders.md
@@ -0,0 +1,89 @@
+---
+description: >-
+ Let OpenHuman tidy, rename and restructure a folder inside a boundary you
+ set, with changes held for your approval at the supervised tier.
+icon: folder-tree
+---
+
+# Organize my project folders
+
+This guide points the assistant at a folder and has it clean up: sort files, rename them consistently and remove clutter. It cannot roam your whole disk, and it cannot make changes you did not see.
+
+The agent works inside a boundary you define. With the autonomy policy on at the `supervised` tier, any file change that is not provably read-only waits for your approval. At `full`, routine writes run on their own and only network, install and destructive actions stop to ask.
+
+## Prerequisites
+
+- OpenHuman set up. See [Create my personal AI assistant](personal-assistant.md).
+- A specific folder you want organized. If the contents are irreplaceable, copy the folder first.
+
+## Privacy implications
+
+- File organizing is local. Reading, moving and renaming files happens on your machine.
+- If you ask the agent to reason about file contents (for example, "group these by topic"), it may send relevant snippets to the model. Route inference to a [local model](local-model.md) if you want that reasoning on-device too.
+- The agent cannot touch system or credential folders (`~/.ssh`, `~/.gnupg`, `~/.aws`, OS directories). They are blocked regardless of settings.
+
+## Steps
+
+### 1. Decide where the agent may act
+
+{% hint style="warning" %}
+Everything in this step needs the autonomy policy switched on. It is off by default. Set `[autonomy] enabled = true` in `config.toml` (`~/.openhuman/config.toml`, or `%USERPROFILE%\.openhuman\config.toml` on Windows). Without it, trusted roots, `workspace_only` and the approval gate do nothing, and acting tool calls run unprompted. Credential stores and system roots stay blocked either way.
+{% endhint %}
+
+Confining the agent to its working folder needs two things: the policy enabled and `workspace_only` on. With both, the agent reads and writes only in its working folder and has no access to the rest of your disk. If either is off, the boundary is not enforced.
+
+A trusted root is a deliberate exception. It grants access to a folder outside the working folder and takes precedence over `workspace_only`. To let the agent work in a folder elsewhere, add it as a trusted root:
+
+1. Open **Settings → Agent access**.
+2. Add the target folder as a trusted root with read-write access.
+
+Keep the boundary as tight as the task. Grant the one folder, not your home directory.
+
+### 2. Set the autonomy tier
+
+In the same `[autonomy]` block, `level` decides how much runs without asking:
+
+- `supervised` (recommended): the agent proposes each change, and you approve moves, renames and deletes as they come, except for tools on the always-allow list.
+- `full`: routine file writes run automatically. Still keep the trusted root tight so "automatic" stays contained.
+
+Deleting and moving files change state, so at `supervised` the [Approval Gate](../features/approval-gate.md) holds them for your yes or no. If you answer **Always allow** to a prompt, that tool goes on the always-allow list and its calls run without a fresh approval. Remove it from the list in **Settings → Agent access** to review each call again.
+
+### 3. Ask for the reorganization
+
+Be concrete about the folder and the rules. For example:
+
+- "In my trusted `~/Documents/receipts` folder, rename every file to `YYYY-MM-DD-vendor.pdf` based on its contents, and move anything older than 2023 into an `archive/` subfolder."
+- "Group the loose files in this folder into subfolders by type, and show me the plan before doing anything."
+
+### 4. Review each proposed action
+
+When the agent wants to move, rename or delete, an Approval Request card shows the exact action. You can **Approve** it, **Always allow** a safe, repetitive one, or **Deny** it. You can also type "yes" or "no".
+
+## Success checks
+
+- [ ] The policy is enabled and `workspace_only` is on, so the folder boundary is enforced.
+- [ ] The agent touched only the folder you granted, and nothing outside your working folder and trusted roots changed.
+- [ ] Each move, rename and delete showed up as an approval prompt, unless you chose Always allow for that tool.
+- [ ] The folder matches the structure you asked for.
+- [ ] Files you did not mention are untouched.
+
+## Common failures
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| "I can't access that folder" | The folder is not a trusted root, or `workspace_only` is confining the agent | Add it in **Settings → Agent access** as a read-write trusted root |
+| It asks for approval on every file | The `supervised` tier gates each write | Use **Always allow** for the specific safe tool, or narrow the request so there are fewer actions |
+| It refuses to touch a path | The path is a blocked system or credential directory | This is by design. Choose a normal working folder |
+| It reorganized more than you wanted | The instruction was broad | Ask it to show the plan first, and approve selectively |
+
+## Recovery
+
+- At the `supervised` tier nothing runs without approval, apart from tools on your always-allow list. If a plan looks wrong, **Deny** it and it does not happen.
+- Undo is manual. OpenHuman does not roll back file operations, so work on a copy of anything precious, or keep the folder under version control such as `git`.
+- If the agent is doing too much, set both `enabled = true` and `level = "readonly"`. The level does nothing on its own, because with `enabled = false` the whole policy is off. With both set, the agent can still suggest a plan but cannot change files.
+
+## See also
+
+- [Approval Gate](../features/approval-gate.md): what gets held and why.
+- [Coder toolset](../features/native-tools/coder.md): the filesystem and git tools the agent uses here.
+- [Privacy and security](../features/privacy-and-security.md): workspace scoping and path hardening.
diff --git a/docs/gitbooks/en/guides/personal-assistant.md b/docs/gitbooks/en/guides/personal-assistant.md
new file mode 100644
index 0000000000..15f7d0fd19
--- /dev/null
+++ b/docs/gitbooks/en/guides/personal-assistant.md
@@ -0,0 +1,118 @@
+---
+description: >-
+ Go from a fresh install to a personal assistant that knows your context,
+ respects the boundaries you set, and acts only with your approval at the
+ supervised tier.
+icon: robot
+---
+
+# Create my personal AI assistant
+
+This is the start-here guide. By the end you have an assistant that remembers part of your world, replies in a style you like, and, on the supervised tier, takes no real-world action without your say-so. It assumes nothing beyond a downloaded app.
+
+## Prerequisites
+
+- OpenHuman installed on macOS, Windows, or Linux. If you have not installed yet, do [Getting started](../overview/getting-started.md) first, then come back.
+- 4 GB+ RAM (16 GB or more if you plan to connect very large mailboxes or run a [local model](local-model.md)).
+- An account to sign in with (social login works).
+- Optional: one account you'd like the assistant to know about (Gmail is the usual first one).
+
+## Privacy implications
+
+- Signing in does not grant ongoing access to anything. Every integration is a separate OAuth approval that you can revoke later.
+- Your memory is stored by the engine you choose: hosted TinyHumans or your own CortexDB. With neither, memory is off.
+- By default, chat and reasoning run through the OpenHuman-hosted [model router](../features/model-routing/README.md). If you want inference on-device instead, see [Use OpenHuman with a local model](local-model.md).
+- For the full picture, see [Keep sensitive data private](privacy-sensitive-data.md).
+
+## Steps
+
+### 1. Sign in
+
+Launch the app. The first screen is **Sign in! Let's Cook**. Choose a login option. An **Advanced** panel lets you point at a custom core, which most people can ignore.
+
+### 2. Choose how AI runs
+
+After sign-in you choose how AI runs:
+
+- **Cloud** takes one click, and the hosted model router handles inference. It is the fastest way to a working assistant.
+- **Custom** lets you choose your inference provider, voice, integrations (OAuth), web search and embeddings yourself.
+
+If you are not sure, pick Cloud. You can change any of this later in **Settings**.
+
+### 3. Give it something to remember
+
+An assistant with no memory is a chatbot. Connect at least one source so it has context:
+
+- Open **Settings** and connect an integration (Gmail is the common starting point). Each connection is a one-click OAuth approval.
+- Add folders, files or links as sources under **Connections → Memory** so they sync into [Memory](../features/memory.md) on a schedule.
+
+### 4. Set your boundaries
+
+Open `config.toml` in your data folder (`~/.openhuman/config.toml`, or `%USERPROFILE%\.openhuman\config.toml` on Windows) and turn the policy on:
+
+```toml
+[autonomy]
+enabled = true
+level = "supervised" # "readonly" | "supervised" | "full"
+```
+
+| Tier | What it means |
+| --- | --- |
+| `readonly` | The assistant can observe and answer, but never acts: no sending, no file writes, no commands. |
+| `supervised` | It can act, but any state-changing, network, install or destructive action waits for your approval first, unless its tool is on your always-allow list. |
+| `full` | Routine actions run automatically. Network, install and destructive actions still ask. |
+
+{% hint style="warning" %}
+The policy is off until you set `enabled = true`. There is no user-facing switch for the tier, because the panel that holds the radios is a developer-only deep link. Until you turn the policy on, acting tool calls run without a prompt. Credential stores (`~/.ssh`, `~/.gnupg`, `~/.aws`) and system roots stay blocked either way.
+{% endhint %}
+
+`supervised` is the right starting point. With it on, nothing with an external effect happens in a chat unless you say yes. That check is the [Approval Gate](../features/approval-gate.md). The one exception is a tool you add to the always-allow list by answering **Always allow** to a prompt. That tool then runs without a fresh approval. Remove it from the list in **Settings → Agent access** to get per-call review back.
+
+Once the policy is on, **Settings → Agent access** holds the rest of the boundary: the trusted roots, the always-allow list, the action timeout and the workspace-only switch.
+
+### 5. Shape its personality (optional)
+
+An editable prompt called `SOUL.md` defines how the assistant talks and behaves. Its mission and values live in a companion file, `IDENTITY.md`. Both ship with sensible defaults, so you do not have to touch them, but you can:
+
+- Set a display name and short description in **Settings → Personality**.
+- Edit the behavior on the **Brain** page (the raised center button in the bottom bar, `/brain`), where memory, goals and intelligence live.
+
+OpenHuman also learns lasting preferences from how you correct it. See [Personalization and self-learning](../features/personalization.md).
+
+### 6. Run your first real request
+
+Once a source has synced, try:
+
+- "What do I need to know from the last 12 hours?"
+- "What's waiting on me?"
+- "Summarize what I missed today."
+
+## Success checks
+
+You have a working assistant when all of these are true:
+
+- [ ] The app is signed in (you are past the welcome screen and in the chat or home view).
+- [ ] At least one integration shows as connected in Settings.
+- [ ] A briefing prompt ("what's waiting on me?") returns something drawn from your actual data, not a generic answer.
+- [ ] Connections → Memory → Brain shows your source with an item count after it syncs.
+- [ ] When you ask it to do something with an external effect (for example "draft and send an email"), an Approval Request card appears above the chat box instead of the assistant acting silently.
+
+## Common failures
+
+| Symptom | What it means | Fix |
+| ------------------------------------------------ | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| Sign-in returns to the welcome screen | The OAuth callback did not reach the app | Follow [Troubleshooting sign-in](../overview/troubleshooting-sign-in.md) |
+| Connected a source but memory stays empty | Source not added or not synced yet, or the OAuth scope is too narrow | Press sync on the source; re-check the connection in Settings |
+| Assistant answers generically, ignores your data | It answered without recalling memory | Ask again and name the source ("from my email"). Confirm the source is connected |
+| It did something you did not expect | The autonomy policy is off, or `level` is `full` | Set `[autonomy] enabled = true` and `level = "supervised"` in `config.toml` |
+
+## Recovery
+
+- **Reset boundaries fast.** If the assistant is doing too much, set both `enabled = true` and `level = "readonly"` in `config.toml`. The level alone changes nothing while `enabled` is `false`, because the whole policy is off then. With both set, it takes effect on the next turn and blocks all acting.
+- **Nothing you connect is permanent.** Revoke any integration from Settings. Items already in your memory engine stay until you forget them, or until you tick **Also delete memory from this source** when disconnecting. The next sync stops pulling that source.
+- **If the app will not start,** see [Recover from a failed installation](recover-failed-installation.md). Your configuration is preserved by default.
+
+## Next steps
+
+- [Use OpenHuman with a local model](local-model.md): keep inference on-device.
+- [Keep sensitive data private](privacy-sensitive-data.md): see what leaves your machine.
diff --git a/docs/gitbooks/en/guides/privacy-sensitive-data.md b/docs/gitbooks/en/guides/privacy-sensitive-data.md
new file mode 100644
index 0000000000..d53e5fd5cb
--- /dev/null
+++ b/docs/gitbooks/en/guides/privacy-sensitive-data.md
@@ -0,0 +1,95 @@
+---
+description: >-
+ A plain-language map of what OpenHuman keeps on your computer and what it
+ sends out, and the settings that keep sensitive work local.
+icon: lock
+---
+
+# Keep sensitive data private
+
+This guide explains in everyday language what stays on your machine and what leaves it, so you can decide what OpenHuman should touch. For the engineering detail, read [Privacy and security](../features/privacy-and-security.md). This page is the version you can act on in five minutes.
+
+## The short version
+
+Your settings and local secrets stay on your computer. Your memory is stored in CortexDB, either hosted by TinyHumans for your account or your own. The OpenHuman backend handles what has to be brokered: signing you in, hosted memory, routing model requests, and talking to the services you connect.
+
+## What stays on your machine
+
+These never leave your computer as raw data:
+
+| Thing | Plain meaning |
+| --- | --- |
+| Audio you speak | Captured to transcribe, then discarded. |
+| Local model state | If you use [local AI](local-model.md), your runtime and its models stay on-device. |
+| Your persona and settings | The files that define how your assistant behaves and what it may do. |
+
+## Where your memory is stored
+
+When memory is on, documents, conversations, learnings and the beliefs built from them are stored in CortexDB. With TinyHumans-hosted memory they are not stored on your computer. A CortexDB you host yourself can keep them on your own machine. With no engine available, memory is off and nothing is stored.
+
+- **TinyHumans engine (the default when signed in).** Items are stored in the hosted CortexDB that TinyHumans runs, through the TinyHumans backend. Each account gets its own isolated tenant, so other users cannot see your memory.
+- **CortexDB engine.** Items are stored in your own CortexDB account or self-hosted CortexDB, reached directly with your key. A CortexDB on your own machine keeps the data on that machine.
+
+Secrets and personal identifiers are scrubbed before an item is sent. You can forget single items or whole sources from the Memory page. See [Deleting memory](../features/privacy-and-security.md#deleting-memory) for erasing everything.
+
+## What the backend handles
+
+These leave your machine because they cannot work otherwise. Here is what is sent:
+
+| Thing | What is sent |
+| --- | --- |
+| Hosted memory | With the TinyHumans engine, every item stored and every recall goes through the backend to hosted CortexDB. |
+| Model requests | Only what the assistant needs for that turn: your prompt plus the memory recalled for it. Not your whole memory. |
+| Web search | Your search query goes to the backend proxy, so you do not need your own search key. |
+| Connected services | When you connect Gmail, Slack and so on, the backend brokers each request. It holds your login tokens for those services, so they are not written in plain text on your laptop. |
+| Text-to-speech | The words to be spoken are streamed to generate audio, then discarded. They are not retained. |
+
+{% hint style="info" %}
+Memory is not local, so scrubbing and scoping matter. Items are scrubbed before they are sent, tool-call arguments are never stored, hosted memory is isolated per account, and a model turn sees only what was recalled for it.
+{% endhint %}
+
+## Two promises
+
+- **No training on your data.** Your conversations, memory and personal information are never used to train models.
+- **Secrets live in your operating system's store.** Local secrets are kept in macOS Keychain, Windows Credential Manager or the Linux Secret Service, not in app files. See [OS keyring and secret storage](../features/os-keyring-and-secret-storage.md).
+
+## Making it more local
+
+You have real controls. These run from most to least private:
+
+1. **Route inference on-device.** Run a local runtime such as Ollama yourself, pull the models, and [add it as a provider](local-model.md). Embeddings, summaries and, optionally, chat and reasoning then happen on your machine. OpenHuman does not install the runtime or download models for you. Speech and web search still use the backend proxy.
+2. **Tighten what the assistant can do.** Set `[autonomy] enabled = true` and `level = "readonly"` in `config.toml`. The assistant can then observe and answer but never act or reach the network on its own. The policy is off by default, so you have to turn this on. See the [Approval Gate](../features/approval-gate.md).
+3. **Keep it in one folder.** The filesystem boundary needs two things: the policy enabled and `workspace_only` on. With both, the agent is confined to its working folder and cannot read the rest of your disk. If either is off, the boundary is not enforced. A trusted root is the deliberate exception. Each one you add grants its subtree outside the working folder and takes precedence over `workspace_only`. System and credential folders (`~/.ssh`, `~/.gnupg`, `~/.aws` and OS directories) are always blocked.
+4. **Connect only what you need.** Each integration is a separate OAuth approval that you grant and can revoke. Revoking stops the next sync. Memory already collected stays in your memory engine until you forget it.
+
+## Built-in protections
+
+- **Prompt-injection screening.** Incoming content is screened for attempts to hijack the assistant's instructions before it acts on them.
+- **Secret and personal-data redaction on save.** When content is written into long-lived memory, OpenHuman strips API keys, tokens, private-key blocks and personal identifiers.
+- **Encryption in transit.** All traffic between the app and the backend uses TLS.
+
+## Success checks
+
+You know your privacy posture when you can answer these:
+
+- [ ] Is the autonomy policy on, and do you know its tier? Check `[autonomy]` in `config.toml`.
+- [ ] If you rely on the filesystem boundary, is `workspace_only` on too, and do you know which trusted roots grant access outside the working folder?
+- [ ] Do you know which integrations are connected? Check **Settings** and disconnect any you do not need.
+- [ ] If a workload must stay local, is it routed to a [local provider](local-model.md) that is running and answering?
+- [ ] Are you comfortable that model turns send retrieved snippets, not your whole memory?
+
+## Common misunderstandings
+
+| Belief | Reality |
+| --- | --- |
+| "My memory is stored on my laptop." | It is stored in CortexDB, hosted by TinyHumans or run by you. Only bookkeeping is local. |
+| "OpenHuman uploads my whole memory to the model to answer." | The model gets only what was recalled for that turn. |
+| "My service passwords are on my laptop." | The backend holds integration tokens, and local secrets go in your OS keychain. |
+| "Turning on local AI makes everything local." | Speech-to-text, text-to-speech and web search still use the backend proxy by default, and memory is still stored in CortexDB. |
+| "Revoking an integration deletes what it already gathered." | Memory already ingested stays in your memory engine until you forget it. Revoking only stops future syncing. |
+
+## See also
+
+- [Privacy and security](../features/privacy-and-security.md): the detailed architecture.
+- [Use OpenHuman with a local model](local-model.md): keep inference on-device.
+- [Create a safe companion for a child](child-safe-companion.md): the strictest lockdown, built from these controls.
diff --git a/docs/gitbooks/en/guides/recover-failed-installation.md b/docs/gitbooks/en/guides/recover-failed-installation.md
new file mode 100644
index 0000000000..89fb5d3f6a
--- /dev/null
+++ b/docs/gitbooks/en/guides/recover-failed-installation.md
@@ -0,0 +1,116 @@
+---
+description: >-
+ Get a broken or half-installed OpenHuman running again without losing your
+ memory, personas or settings.
+icon: life-ring
+---
+
+# Recover from a failed installation
+
+Use this guide when the app will not install, will not start, or starts broken, and you want it working again without wiping your data.
+
+Your configuration and memory are preserved by default. Recovery means fixing the app around your data, not deleting the data. The only step that touches your data folder is a last resort, and it keeps a backup.
+
+## Prerequisites
+
+- Nothing special. You need the app, a file manager and, occasionally, a terminal.
+- Know where your data lives. Everything OpenHuman keeps is in one folder:
+
+ | Platform | Data folder |
+ | ------------- | --------------------------- |
+ | macOS / Linux | `~/.openhuman/` |
+ | Windows | `%USERPROFILE%\.openhuman\` |
+
+ Leave that folder alone unless a step here explicitly says to touch it.
+
+## Privacy implications
+
+- Recovery is local. You restart or reinstall software, and your memory is not uploaded.
+- If you file a bug report, redact secrets. Share status codes, app version, OS and log lines, never tokens or JWTs.
+
+## First: read the logs
+
+Almost every failure names itself in the log, so start there.
+
+- In the app, if it opens: **Settings → About → App Logs Folder** reveals the folder in your file manager.
+- On disk: logs are under your data folder, for example `~/.openhuman/logs/openhuman.<date>.log` (Windows: `%USERPROFILE%\.openhuman\logs\openhuman.*.log`). They rotate daily.
+
+Open the most recent log, read the last error lines, and match the message to the table below.
+
+## Recovery ladder
+
+Work from the top and stop as soon as it works. Each rung is more disruptive than the last, and the early rungs never touch your data.
+
+### Rung 1: Restart cleanly
+
+- Quit OpenHuman fully, make sure no process is left running, and reopen it.
+- Run only one instance at a time. A second copy can hold a lock the first needs.
+
+### Rung 2: Reinstall the app over your data
+
+Reinstalling the application does not delete your data folder, because they are separate. This fixes a corrupted or partial install and keeps everything.
+
+- Download the current build from [tinyhumans.ai/openhuman](https://tinyhumans.ai/openhuman) or the [latest release](https://github.com/tinyhumansai/openhuman/releases/latest) and install over the top.
+- On macOS, install the real `.app` bundle. Some features need the bundle, not a dev build.
+- Reopen the app. Your memory, personas and settings are still there, because they live in `~/.openhuman/`.
+
+### Rung 3: Fix the specific error
+
+Match your symptom to a fix:
+
+| Symptom in logs / UI | Cause | Fix |
+| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
+| Sign-in stalls after the provider step; log mentions `openhuman://` scheme not registered (Windows) | The URL handler didn't register, or the install was moved after first launch | Follow the repair steps in [Troubleshooting sign-in](../overview/troubleshooting-sign-in.md#windows-openhuman-handler-not-registered) |
+| App won't render, or the window opens blank | A previous instance is still holding the port or the webview data directory | Ensure no other OpenHuman is running; if it persists, close all instances and relaunch |
+| Local AI / Ollama errors | The local runtime you configured isn't running, or a model isn't pulled | This does not block the app. OpenHuman does not install or start the runtime, so start it yourself. See [Use OpenHuman with a local model](local-model.md#common-failures) |
+| "Low disk space" warning, or writes failing | The workspace can't be written | Free up space (the app wants a healthy margin, a few hundred MB minimum) and restart |
+
+### Rung 4: Move the data folder aside (non-destructive reset)
+
+If the app still will not start and you suspect the data folder itself, rename it instead of deleting it. You get a clean start and keep a full backup you can restore.
+
+{% hint style="warning" %}
+Quit OpenHuman completely before moving its folder.
+{% endhint %}
+
+```bash
+# macOS / Linux
+mv ~/.openhuman ~/.openhuman.backup-$(date +%Y%m%d)
+```
+
+```powershell
+# Windows (PowerShell)
+Rename-Item "$env:USERPROFILE\.openhuman" ".openhuman.backup"
+```
+
+Relaunch. OpenHuman creates a fresh data folder and you sign in again.
+
+- If the fresh start works, the old folder was the problem, and your data is safe in the backup. Copy specific pieces back, such as workspace files like `SOUL.md` or `config.toml`, and test after each.
+- If it still fails, the data folder was not the cause. Rename the backup back so you lose nothing, and ask for help (below).
+
+## Success checks
+
+You have recovered when:
+
+- [ ] The app launches to the sign-in or chat screen without crashing.
+- [ ] You can sign in and reach your home or chat view.
+- [ ] Your Memory tab still shows your existing summaries, which confirms your data survived.
+- [ ] The most recent log file shows a clean startup with no repeating error.
+
+## Why your data is safe
+
+Rungs 1 to 3 delete nothing. Rung 4 renames your data folder and never removes it, so even the most aggressive step is reversible. Reinstalling the app never touches `~/.openhuman/`.
+
+## If you are still stuck
+
+Open an issue on [GitHub](https://github.com/tinyhumansai/openhuman) or ask on [Discord](https://guild.tinyhumans.ai). Include:
+
+- App version and OS.
+- The last error lines from the log (with tokens and JWTs redacted).
+- Which rung you reached and what happened.
+- Whether moving the data folder aside changed anything.
+
+## See also
+
+- [Troubleshooting sign-in](../overview/troubleshooting-sign-in.md): the deep dive for auth-specific failures.
+- [Move OpenHuman to a new PC](move-to-new-pc.md): the same data folder is what you carry over.
diff --git a/docs/gitbooks/en/overview/auto-update.md b/docs/gitbooks/en/overview/auto-update.md
index c88c289942..1ddd50659e 100644
--- a/docs/gitbooks/en/overview/auto-update.md
+++ b/docs/gitbooks/en/overview/auto-update.md
@@ -1,55 +1,55 @@
---
description: >-
How OpenHuman updates itself: one signed manifest, a bounded download retry,
- and a shell update that carries the core with it.
+ and a single update that covers the app and its core.
icon: arrows-rotate
---
# Auto-update
-OpenHuman updates the whole app in one step. The core is linked into the desktop shell rather than shipped beside it, so there is no separate core update to think about: a shell update upgrades both.
+OpenHuman updates the whole app in one step. The core is linked into the desktop shell, so there is no separate core update. Updating the shell upgrades both.
## What you see
-When a newer build is available, the app checks for it and downloads it in the background. The prompt appears once the download is ready, then moves through **ready to install**, **installing** and **restarting**. If you are already current you see **up to date**, and a failure says so rather than silently retrying forever.
+When a newer build is available, the app downloads it in the background. A prompt appears once the download is ready and moves through **ready to install**, **installing** and **restarting**. If you are current you see **up to date**. A failure says so instead of retrying forever.
-Installing shuts the in-process core down first, under the same restart lock the app uses elsewhere, so replacing the bundle never races a core still holding file handles. On macOS that is what keeps a `.app` replacement clean.
+Before installing, the app shuts down the in-process core under the same restart lock it uses elsewhere. That way replacing the bundle never races a core that still holds file handles, which keeps a `.app` replacement on macOS clean.
## Where updates come from
-A single endpoint, a manifest published with every release:
+There is one endpoint, a manifest published with every release:
```text
https://github.com/tinyhumansai/openhuman/releases/latest/download/latest.json
```
-Every artifact is signed, and the public key is compiled into the app. A build whose signature does not verify is refused. That is the whole trust story: no update server to trust, no second channel.
+Every artifact is signed, and the public key is compiled into the app. A build whose signature does not verify is refused. There is no update server to trust and no second channel.
-## Retry policy, and what is deliberately not retried
+## Retries
-Downloads get **three attempts** (one try plus two retries) with a linear backoff of two seconds times the attempt number.
+A download gets three attempts: one try plus two retries, with a delay of two seconds times the attempt number.
-Only transient network failures are retried. Signature failures, filesystem errors and "no artifact for this target" are **not**, and that asymmetry is the point: re-downloading cannot fix a bad signature, and looping on a verification failure would both waste the user's bandwidth and mask tampering. The policy lives in `crates/openhuman-app/src/app_update.rs`, where `classify` and `is_transient_updater_err` are the two functions that decide.
+Only transient network failures are retried. Signature failures, filesystem errors and "no artifact for this target" are not. Downloading again cannot fix a bad signature, and looping on a failed verification would waste bandwidth and could hide tampering. The policy lives in `crates/openhuman-app/src/app_update.rs`, where `classify` and `is_transient_updater_err` decide.
## Periodic checks
-The core runs the schedule, under `[update]` in `config.toml`:
+The core runs the schedule, set under `[update]` in `config.toml`:
| Key | Default | What it does |
| --- | --- | --- |
-| `enabled` | `true` | Turn periodic checks off entirely. |
-| `interval_minutes` | `60` | How often to check. The runtime floor is 10 minutes. |
-| `restart_strategy` | `self_replace` | `self_replace` restarts in place after staging; `supervisor` stages and leaves the restart to whatever is managing the process. |
-| `rpc_mutations_enabled` | `true` | Whether a bearer-authenticated RPC client may call the mutating update methods at all. |
+| `enabled` | `true` | Turns periodic checks off when set to `false`. |
+| `interval_minutes` | `60` | How often to check. The minimum is 10 minutes. |
+| `restart_strategy` | `self_replace` | `self_replace` restarts in place after staging. `supervisor` stages the update and leaves the restart to whatever manages the process. |
+| `rpc_mutations_enabled` | `true` | Whether a bearer-authenticated RPC client may call the mutating update methods. |
-`supervisor` is the setting for a headless or containerised core: something else owns the process lifecycle, and the update should not decide to restart on its own.
+Use `supervisor` for a headless or containerized core, where something else owns the process lifecycle and the update should not restart it.
## Headless and self-hosted cores
-A core you run yourself (`openhuman-core serve`) checks and stages through the `update` namespace rather than the desktop prompt, which is why `rpc_mutations_enabled` exists as a separate switch. The desktop commands that used to update a core binary separately (`check_core_update`, `apply_core_update`) are kept as explicit no-ops for frontend compatibility and do nothing.
+A core you run yourself (`openhuman-core serve`) checks and stages updates through the `update` namespace instead of the desktop prompt. That is why `rpc_mutations_enabled` is a separate switch. The old desktop commands `check_core_update` and `apply_core_update` still exist for frontend compatibility but do nothing.
## See also
-- [Platform & Availability](../features/platform.md): what ships on each OS.
-- [Release Policy](../developing/release-policy.md): how a release is cut, and the OAuth minimum-version gate.
-- [Cloud Deploy](../features/cloud-deploy.md): running the core somewhere else.
+- [Platform and availability](../features/platform.md): what ships on each OS.
+- [Release policy](../developing/release-policy.md): how a release is cut, and the OAuth minimum-version gate.
+- [Cloud deploy](../features/cloud-deploy.md): running the core somewhere else.
diff --git a/docs/gitbooks/en/overview/getting-started.md b/docs/gitbooks/en/overview/getting-started.md
index 17ae455f22..a0ecda0ea5 100644
--- a/docs/gitbooks/en/overview/getting-started.md
+++ b/docs/gitbooks/en/overview/getting-started.md
@@ -1,91 +1,93 @@
---
description: >-
- Install OpenHuman, walk through the in-app onboarding (sign in, choose how AI
- runs, connect an app), and run your first request against your own memory.
+ Install OpenHuman, sign in, choose how AI runs, connect an app, and make your
+ first request against your own memory.
icon: play
---
-# Getting Started
+# Getting started
-This page walks you through installing OpenHuman, going through the in-app onboarding, and running your first request.
-
-OpenHuman is open source under the GNU GPL3 license. The codebase is at [github.com/tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman).
+This page takes you from install to your first request. OpenHuman is open source under the GNU GPL3 license, and the code is at [github.com/tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman).
{% hint style="info" %}
-**Want a specific outcome?** If you're here to accomplish something concrete (set up a private assistant, run a local model, recover a broken install, or move to a new machine), the [Guides](../guides/guides/) section has task-by-task walkthroughs.
+If you want a specific outcome, such as a private assistant, a local model, a broken install fixed, or a move to a new machine, the [Guides](../guides/README.md) have task-by-task walkthroughs.
{% endhint %}
-***
-
## System requirements
-OpenHuman runs on **macOS, Windows and Linux** desktops. 4 GB+ RAM is recommended; 16 GB+ if you intend to ingest very large mailboxes or repos, or run a [local model](../features/model-routing/local-ai.md) on the same machine (you install the runtime, such as Ollama, and pull the models yourself).
+OpenHuman runs on macOS, Windows and Linux desktops. 4 GB of RAM is recommended. Plan for 16 GB or more if you will ingest very large mailboxes or repos, or run a [local model](../features/model-routing/local-ai.md) on the same machine. For a local model you install the runtime (such as Ollama) and pull the models yourself.
+
+The first time you launch the app, your OS asks for the permissions it needs: Accessibility on macOS, and Input Monitoring for the voice hotkey. You can review them any time under **Settings**.
-### Permissions
+## 1. Download and install
-The first time you launch OpenHuman, the OS will prompt for the permissions the app needs (Accessibility on macOS, Input Monitoring for the voice hotkey). You can review and adjust these any time under **Settings**.
+Download the desktop app from [tinyhumans.ai/openhuman](https://tinyhumans.ai/openhuman) or the [latest GitHub release](https://github.com/tinyhumansai/openhuman/releases/latest). You can also use the install scripts, which download the release and check its SHA-256 before installing:
-***
+```bash
+# macOS and Linux
+curl -fsSL https://raw.githubusercontent.com/tinyhumansai/openhuman/main/scripts/install.sh | bash
+```
-## 1. Download and install
+```powershell
+# Windows (PowerShell)
+irm https://raw.githubusercontent.com/tinyhumansai/openhuman/main/scripts/install.ps1 | iex
+```
-Get the OpenHuman desktop app from [tinyhumans.ai/openhuman](https://tinyhumans.ai/openhuman) or via your platform's package manager. Open the app once it's installed.
+A Homebrew cask also exists, but it can lag the latest release. Open the app once it is installed.
## 2. Sign in
-The first screen is **"Sign in! Let's Cook"**. Multiple sign-in options are available, including social login. There's also an **Advanced** panel for pointing the app at a custom core RPC URL if you're running your own backend; most users can ignore it.
+The first screen is **Sign in! Let's Cook**. You can sign in with social login or other options. An **Advanced** panel lets you point the app at a custom core RPC URL if you run your own backend. Most people can ignore it.
{% hint style="info" %}
-**No permanent lock-in.** Signing in does not grant OpenHuman ongoing access to anything. All third-party access requires explicit OAuth approval per integration in the steps below.
+Signing in does not give OpenHuman ongoing access to anything. Each third-party integration needs its own OAuth approval in the steps below.
{% endhint %}
{% hint style="warning" %}
-**Know what is local and what is managed.** Your workspace config, and local runtime state live on your machine. The default setup still uses OpenHuman-hosted services for sign-in, model routing, managed integration OAuth/tool calls, and web search proxying. Use the custom setup paths if you want to bring your own model, search, or Composio credentials. Some hosted features and real-time integration triggers still require the managed backend.
+Your workspace config and runtime state live on your machine. The default setup still uses OpenHuman-hosted services for sign-in, model routing, managed integration OAuth and tool calls, and web search. Use the custom setup paths to bring your own model, search or Composio credentials. Some hosted features and real-time integration triggers need the managed backend.
{% endhint %}
-## 3. Connect something, and set up memory
+## 3. Connect something and set up memory
-Onboarding offers a runtime choice (the managed TinyHumans route, or a custom setup where you bring your own model, search, embeddings and connector keys) and then drops you into the app. Two things make the first request worth making:
+Onboarding asks how AI should run. You can use the managed TinyHumans route, or a custom setup where you bring your own model, search, embeddings and connector keys. Then it drops you into the app. Two things make your first request worth making:
-* **An integration.** Open [Connections](../features/connections.md) → Apps and connect one. Gmail is the usual first choice; each connection is a one-click OAuth approval you can revoke.
-* **A memory engine.** Connections → Memory. Signed in, the hosted engine is already there; otherwise point it at your own CortexDB. With neither, [memory](../features/memory.md) is off and the agent starts from zero every chat.
+- **An integration.** Open [Connections](../features/connections.md), then Apps, and connect one. Gmail is a common first choice. Each connection is a one-click OAuth approval that you can revoke.
+- **A memory engine.** Open Connections, then Memory. When you are signed in, the hosted engine is already there. Otherwise point it at your own CortexDB. With neither, [memory](../features/memory.md) is off and the agent starts from zero every chat.
Add the integration as a memory source on the Brain tab to sync it on a schedule.
## 4. Run your first request
-Once a memory source has synced, try prompts like:
-
-**Briefings**
+Once a memory source has synced, try prompts like these.
-* "What do I need to know from the last 12 hours?"
-* "What's waiting on me?"
+Briefings:
-**Cross-source queries**
+- "What do I need to know from the last 12 hours?"
+- "What's waiting on me?"
-* "Summarize what I missed today."
-* "What are the key decisions from this week?"
-* "Extract action items from my recent conversations."
-* "What did Sarah say about the project across email and chat?"
+Cross-source questions:
-OpenHuman picks the right model for each task automatically. See [Automatic Model Routing](../features/model-routing/).
+- "Summarize what I missed today."
+- "What are the key decisions from this week?"
+- "Extract action items from my recent conversations."
+- "What did Sarah say about the project across email and chat?"
-***
+OpenHuman picks the right model for each task. See [Automatic model routing](../features/model-routing/README.md).
## 5. Keep going
-Now that the agent has memory and a model, the rest of the product is about giving it more surfaces:
+Now that the agent has memory and a model, the rest of the product gives it more to work with:
-* [**Chat**](../features/chat.md): what a turn can actually do, and the four ways it stops to ask you something.
-* [**Connections**](../features/connections.md): everything the agent plugs into, on one page.
-* [**Memory**](../features/memory.md): connect more sources; they sync on a schedule into your memory engine.
-* [**Workflows**](../features/workflows.md): describe an automation and review the graph the agent proposes.
-* [**Native Voice**](../features/native-tools/voice.md): dictation and spoken replies, or a live voice agent.
-* [**Roadmap**](roadmap.md): what is coming, and what was removed.
+- [Chat](../features/chat.md): what a turn can do, and the four ways it stops to ask you something.
+- [Connections](../features/connections.md): everything the agent plugs into, on one page.
+- [Memory](../features/memory.md): connect more sources and sync them on a schedule.
+- [Workflows](../features/workflows.md): describe an automation and review the graph the agent proposes.
+- [Native voice](../features/native-tools/voice.md): dictation, spoken replies, or a live voice agent.
+- [Roadmap](roadmap.md): what is coming, and what was removed.
## Join the community
-OpenHuman is in early beta. Feedback and contributions make a real difference at this stage.
+OpenHuman is in early beta, and feedback and contributions matter.
-* **GitHub:** [github.com/tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman)
-* **Discord:** [guild.tinyhumans.ai](https://guild.tinyhumans.ai)
+- GitHub: [github.com/tinyhumansai/openhuman](https://github.com/tinyhumansai/openhuman)
+- Discord: [guild.tinyhumans.ai](https://guild.tinyhumans.ai)
diff --git a/docs/gitbooks/en/overview/roadmap.md b/docs/gitbooks/en/overview/roadmap.md
index 292d0200d2..b5f5a3d646 100644
--- a/docs/gitbooks/en/overview/roadmap.md
+++ b/docs/gitbooks/en/overview/roadmap.md
@@ -1,57 +1,54 @@
---
description: >-
- What is being worked on next, and the known gaps. Tracked in public issues
- rather than promised here.
+ What is being worked on next, and the known gaps, tracked in public issues.
icon: map
---
# Roadmap
-This page is a reading of the open issue tracker, not a commitment. Dates are deliberately absent. Everything below links to the issue that owns it, so if this page goes stale the issue is still the truth.
-
-Checked 2026-10-07.
+This page is a reading of the open issue tracker, not a commitment. It has no dates. Each item links to the issue that owns it, so the issue stays the source of truth if this page goes stale.
## Taking off the early-beta badge
-[#6047](https://github.com/tinyhumansai/openhuman/issues/6047) is the checklist, with an explicit definition of done: the badge comes off when the boxes are closed, the memory smoke test passes on macOS, Windows and Linux, and the release workflow can publish without hand-holding. Read the boxes against the text beside them: a ticked box is not always a passing test.
+[This checklist](https://github.com/tinyhumansai/openhuman/issues/6047) defines done. The badge comes off when its boxes are closed, the memory smoke test passes on macOS, Windows and Linux, and the release workflow can publish without hand-holding. A ticked box is not always a passing test, so read each box against the text beside it.
| Area | State |
| --- | --- |
-| Memory end to end (store, restart, recall, and the agent actually uses it) | Two of three items ticked ([#6041](https://github.com/tinyhumansai/openhuman/issues/6041), [#6040](https://github.com/tinyhumansai/openhuman/issues/6040)); the third is the end-to-end smoke test, which the checklist itself records as not currently passing |
-| Reply persistence: a completed reply can never vanish | Done |
-| Clean-install sign-in on all three platforms | Open, [#6020](https://github.com/tinyhumansai/openhuman/issues/6020) |
-| Windows: native modules refused when `%TEMP%` grants Modify to a non-owner group, leaving memory and connectors unavailable | Open, [#6008](https://github.com/tinyhumansai/openhuman/issues/6008) |
+| Memory end to end (store, restart, recall, and the agent actually uses it) | Two of three items ticked ([one](https://github.com/tinyhumansai/openhuman/issues/6041), [two](https://github.com/tinyhumansai/openhuman/issues/6040)). The third is the end-to-end smoke test, which the checklist records as not passing yet. |
+| Reply persistence: a completed reply never vanishes | Done |
+| Clean-install sign-in on all three platforms | [Open](https://github.com/tinyhumansai/openhuman/issues/6020) |
+| Windows: native modules are refused when `%TEMP%` grants Modify to a non-owner group, which leaves memory and connectors unavailable | [Open](https://github.com/tinyhumansai/openhuman/issues/6008) |
-The release-pipeline and Windows path-length blockers the checklist also lists have since been closed, even though the boxes are still unticked there.
+The release-pipeline and Windows path-length blockers on the checklist have since been closed, though their boxes are still unticked.
-## Programmes with several issues behind them
+## Larger efforts
-- **Agent to agent.** [#3463](https://github.com/tinyhumansai/openhuman/issues/3463) is the umbrella over five phases: an agent-card endpoint and discovery, accepting tasks, delegating to an external agent as a tool, streaming and push notifications, and multi-instance coordination.
-- **Pluggable memory adapters.** [#5390](https://github.com/tinyhumansai/openhuman/issues/5390) adds the adapters directory and the dependency rule; supermemory, mem0, agentmemory and cognee follow behind it. Today [memory](../features/memory.md) has two engines and no adapter directory exists yet.
-- **External agent runtimes.** [#4731](https://github.com/tinyhumansai/openhuman/issues/4731) is an abstraction layer for driving Cursor, Windsurf and Codex, with a shared ACP transport for several more and per-session model and effort selection. Session import from one of them is the live edge of this work.
-- **Local and self-hosted.** [#6130](https://github.com/tinyhumansai/openhuman/issues/6130) would bring back a managed local runtime with model downloads and a compute-backend selector, deliberately re-adding something that was removed: local inference today means an endpoint you run yourself. [#4844](https://github.com/tinyhumansai/openhuman/issues/4844) is a no-UI Linux build for a server or a Raspberry Pi.
-- **Observability.** [#4496](https://github.com/tinyhumansai/openhuman/issues/4496) adds scores to traces, so user feedback and automated quality signals land next to the run they describe.
+- **Agent to agent.** [This umbrella issue](https://github.com/tinyhumansai/openhuman/issues/3463) covers five phases: an agent-card endpoint and discovery, accepting tasks, delegating to an external agent as a tool, streaming and push notifications, and multi-instance coordination.
+- **Pluggable memory adapters.** [This issue](https://github.com/tinyhumansai/openhuman/issues/5390) adds an adapters directory and the dependency rule. Supermemory, mem0, agentmemory and cognee would follow. Today [memory](../features/memory.md) has two engines and no adapter directory.
+- **External agent runtimes.** [This issue](https://github.com/tinyhumansai/openhuman/issues/4731) adds a layer for driving Cursor, Windsurf and Codex, with a shared ACP transport for more and per-session model and effort selection. Session import from one of them is the active part.
+- **Local and self-hosted.** [One issue](https://github.com/tinyhumansai/openhuman/issues/6130) would bring back a managed local runtime with model downloads and a compute-backend selector. Today local inference means an endpoint you run yourself. [Another](https://github.com/tinyhumansai/openhuman/issues/4844) is a no-UI Linux build for a server or a Raspberry Pi.
+- **Observability.** [This issue](https://github.com/tinyhumansai/openhuman/issues/4496) adds scores to traces, so user feedback and automated quality signals sit next to the run they describe.
-## Shipped but inert
+## Built but not working yet
-Two surfaces exist in the build and do nothing, which is worth knowing before you go looking for them:
+Two surfaces exist in the build and do nothing:
-- **Follow-up suggestion chips** are built and unreachable: nothing produces them, so the row is always empty ([#6465](https://github.com/tinyhumansai/openhuman/issues/6465)).
-- **SearXNG** is configurable and reachable over the MCP server, but `searxng_search` is not registered as an agent tool, so the agent in chat cannot use it ([#6127](https://github.com/tinyhumansai/openhuman/issues/6127)).
+- Follow-up suggestion chips are built but nothing produces them, so the row is always empty ([issue](https://github.com/tinyhumansai/openhuman/issues/6465)).
+- SearXNG is configurable and reachable over the MCP server, but `searxng_search` is not registered as an agent tool, so the agent in chat cannot use it ([issue](https://github.com/tinyhumansai/openhuman/issues/6127)).
-The app also ships its own maturity ledger: **Settings → About** lists every capability with a status of stable, beta or coming soon, which is a better answer than this page for "is X finished".
+The app also lists its own maturity. **Settings → About** shows every capability as stable, beta or coming soon. It is a better answer than this page to "is X finished".
## Recently removed
-Things the docs used to describe that are gone, so you are not hunting for them:
+These features were once documented and are gone:
-- The **live Google Meet agent**. It joined a call through the old embedded Chromium webview and spoke back as a camera stream. The frontend, the domain and the join path were all removed. See [Voice](../features/native-tools/voice.md).
-- The **embedded Chromium (CEF) runtime**. The shell runs on Tauri's native webview; browser control is a real Chrome driven over the DevTools protocol. See [Browser & Computer Control](../features/native-tools/browser-and-computer.md) and the historical [CEF notes](../developing/cef.md).
-- **In-app model downloads** and runtime lifecycle management for local models. Point OpenHuman at a server you run.
-- The **skills sandbox**. Skills are a catalogue you browse and install plus a run surface, not code executing inside a JavaScript sandbox in the app.
-- The **memory tree, graph view, people list and `MEMORY.md`**, replaced by the per-turn memory pack. [Memory](../features/memory.md) has the full list.
+- The live Google Meet agent. It joined a call through the old embedded Chromium webview and spoke back as a camera stream. See [Voice](../features/native-tools/voice.md).
+- The embedded Chromium (CEF) runtime. The shell now uses Tauri's native webview, and browser control drives a real Chrome over the DevTools protocol. See [Browser and computer control](../features/native-tools/browser-and-computer.md) and the historical [CEF notes](../developing/cef.md).
+- In-app model downloads and runtime management for local models. Point OpenHuman at a server you run.
+- The skills sandbox. Skills are now a catalogue you browse and install, plus a run surface, not code running in a JavaScript sandbox in the app.
+- The memory tree, graph view, people list and `MEMORY.md`, replaced by the per-turn memory pack. [Memory](../features/memory.md) has the full list.
## See also
-- [Release Policy](../developing/release-policy.md): how a release is cut and what the version gate does.
-- [Platform & Availability](../features/platform.md): what runs where today.
+- [Release policy](../developing/release-policy.md): how a release is cut and what the version gate does.
+- [Platform and availability](../features/platform.md): what runs where today.
diff --git a/docs/gitbooks/en/overview/troubleshooting-sign-in.md b/docs/gitbooks/en/overview/troubleshooting-sign-in.md
index 04df78bbac..5bb3f89547 100644
--- a/docs/gitbooks/en/overview/troubleshooting-sign-in.md
+++ b/docs/gitbooks/en/overview/troubleshooting-sign-in.md
@@ -5,20 +5,20 @@ description: >-
icon: key
---
-# Troubleshooting Sign-In
+# Troubleshooting sign-in
Use this checklist when social sign-in hangs, returns to the welcome screen, or the core logs an unauthorized `/auth` request.
## Check backend reachability
-From the same network as the desktop app, verify the public OpenHuman endpoints:
+From the same network as the desktop app, check the public OpenHuman endpoints:
```bash
curl -I https://tinyhumans.ai/
curl -I https://api.tinyhumans.ai/health
```
-If the website loads but the API endpoint fails, the desktop app may not be able to exchange OAuth callbacks for a session. Capture the HTTP status, region, and DNS result in the issue report.
+If the website loads but the API endpoint fails, the desktop app may not be able to exchange OAuth callbacks for a session. Note the HTTP status, region and DNS result for any bug report.
## Check the selected core
@@ -31,28 +31,28 @@ curl -sS https://your-core.example/rpc \
-d '{"jsonrpc":"2.0","id":1,"method":"core.ping","params":{}}'
```
-A `401` response means the desktop token and remote core token do not match. Fix that before retrying Google or GitHub sign-in.
+A `401` means the desktop token and the remote core token do not match. Fix that before you retry Google or GitHub sign-in.
## Check the deep-link callback
-Successful desktop OAuth ends with an `openhuman://auth?...` callback. If the browser shows that URL but the app stays on the welcome screen:
+A successful desktop sign-in ends with an `openhuman://auth?...` callback. If the browser shows that URL but the app stays on the welcome screen:
1. Make sure only one OpenHuman desktop instance is running.
2. Restart the app, keep the same remote-core settings, and retry sign-in.
-3. If using a remote core, check whether the core receives `openhuman.auth_set_credential` (the desktop shell validates the session against the backend first, then hands the credential to the core).
+3. With a remote core, check whether the core receives `openhuman.auth_set_credential`. The desktop shell checks the session against the backend first, then hands the credential to the core.
## Windows: `openhuman://` handler not registered
-On Windows the `openhuman://` URL scheme is registered to the running executable via `HKEY_CURRENT_USER\Software\Classes\openhuman\shell\open\command` at first launch. If that registration silently failed, or if the install was moved/copied after first launch, the browser cannot hand the OAuth callback back to the app, and sign-in stalls after the provider step (issue #2699).
+On Windows, the app registers the `openhuman://` URL scheme at first launch under `HKEY_CURRENT_USER\Software\Classes\openhuman\shell\open\command`. If that registration failed, or you moved or copied the install after first launch, the browser cannot hand the OAuth callback back to the app. Sign-in then stalls after the provider step.
-The Tauri shell now emits a `log::error!` line at startup when this happens. Look for it in your log file (default `%USERPROFILE%\.openhuman\logs\openhuman.*.log`):
+The app logs an error at startup when this happens. Look for it in your log file (by default `%USERPROFILE%\.openhuman\logs\openhuman.*.log`):
```text
-[deep-link] openhuman:// scheme registration unhealthy — OAuth callbacks may never reach the app.
-register_all_error=…, hkcu_status=NotRegistered|MissingCommand|Stale { … }|ReadError(…)
+[deep-link] openhuman:// scheme registration unhealthy: OAuth callbacks may never reach the app.
+register_all_error=..., hkcu_status=NotRegistered|MissingCommand|Stale { ... }|ReadError(...)
```
-To repair manually, open PowerShell **as the same user that runs OpenHuman** (no admin required; HKCU is per-user) and replace the path with your actual install location:
+To repair it, open PowerShell as the same user that runs OpenHuman. You do not need admin rights, because HKCU is per user. Replace the path with your install location:
```powershell
$exe = 'C:\Path\To\OpenHuman.exe' # update this
@@ -63,9 +63,9 @@ New-Item -Path 'HKCU:\Software\Classes\openhuman\shell\open\command' -Force | Ou
Set-ItemProperty -Path 'HKCU:\Software\Classes\openhuman\shell\open\command' -Name '(Default)' -Value ('"' + $exe + '" "%1"')
```
-Restart OpenHuman afterwards and retry sign-in. If `register_all_error` is non-`None` in the log (for example because antivirus or a locked-down image is blocking writes to `HKCU\Software\Classes`), fixing the underlying policy is required; the manual script above will hit the same block.
+Restart OpenHuman and retry sign-in. If `register_all_error` is not `None` in the log, something is blocking writes to `HKCU\Software\Classes`, such as antivirus or a locked-down image. You must fix that policy first, because the script above hits the same block.
-For a remote core, a temporary manual injection can confirm the core is otherwise healthy (the core stores the credential as given; supply the user id the token belongs to unless the JWT carries a subject claim):
+With a remote core, you can inject a credential by hand to confirm the core is otherwise healthy. The core stores the credential as given, so supply the user id the token belongs to unless the JWT carries a subject claim:
```bash
curl -sS https://your-core.example/rpc \
@@ -74,13 +74,13 @@ curl -sS https://your-core.example/rpc \
-d '{"jsonrpc":"2.0","id":1,"method":"openhuman.auth_set_credential","params":{"token":"JWT_FROM_CALLBACK","userId":"YOUR_USER_ID"} }'
```
-Do not paste real JWTs into public GitHub issues. Redact tokens and attach only status codes, hostnames, app version, OS, and the relevant log lines.
+Never paste real JWTs into public GitHub issues. Redact tokens and share only status codes, hostnames, app version, OS and the relevant log lines.
## What to include in a bug report
- App version and OS.
-- Whether the core mode is local or remote.
-- The RPC URL host, redacted token status, and `core.ping` result.
+- Whether the core is local or remote.
+- The RPC URL host, whether a token was set (not the token), and the `core.ping` result.
- The OAuth provider used.
- Whether an `openhuman://auth` URL appeared in the browser.
- The first unauthorized log line, if present.