Skip to content

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

docs: add README files for image, memory, and search modules and update MCP registry architecture do

Steven Enamakel4ac3835ed468
diff --git a/crates/openhuman-core/src/media/image/README.md b/crates/openhuman-core/src/media/image/README.md
index 42b0442ed5..6ec6bae503 100644
--- a/crates/openhuman-core/src/media/image/README.md
+++ b/crates/openhuman-core/src/media/image/README.md
@@ -35,7 +35,10 @@ Gated transitively by the `media` feature at
| `image_generation.rs` | `image_generation` schema and output-format contract. |
| `image_view.rs` | `view_image` schema and detail-level contract. |
| `prompt.rs` | Agent prompt guidance for enabled image tools. |
-| `tests.rs` | Contract-level e2e tests across config, schemas, and prompt output. |
+| `image_tests.rs` | Contract-level e2e tests across config, schemas, and prompt output. |
+
+Per-file tests also live alongside their subject: `image_generation_tests.rs`,
+`image_view_tests.rs`, `prompt_tests.rs`.
## Notes
diff --git a/crates/openhuman-core/src/memory/README.md b/crates/openhuman-core/src/memory/README.md
index 63cd471bb8..8074e06331 100644
--- a/crates/openhuman-core/src/memory/README.md
+++ b/crates/openhuman-core/src/memory/README.md
@@ -23,13 +23,37 @@ What stays here, per that split:
engine crate cannot name the `Tool` trait).
- **Guard** — [`guard/`](guard/), the taint/scope/budget policy gate over
every provider call.
-- **Driver binding** — [`driver/`](driver/), which provider backs a
- workspace.
+- **Driver binding** — [`binding.rs`](binding.rs) (`memory::binding::for_config`,
+ the workspace-keyed driver binding the Layer rules below reference) and
+ [`driver/`](driver/), which provider backs a workspace. The built-in driver
+ is the compiled TinyMemory TinyBus module; there is no in-process engine
+ driver any more.
- **Ops** — [`ops/`](ops/), RPC handlers that delegate into the core.
+- **Contract facade** — [`api.rs`](api.rs) (`memory::api`), the selective
+ re-export of `tinymemory-api` that is the bus vocabulary — see its own
+ module docs for what it excludes and why.
- **Seam impls** — [`host.rs`](host.rs) — `install_memory_event_sink` and
`MemoryHostConfig for Config`. Its sibling `host_impls.rs` held the half that
only an in-process engine could use, and went with the engine when the test
build stopped linking one (openhuman#6161).
+- **Host-owned wire shapes** — [`rpc_models.rs`](rpc_models.rs) /
+ [`ingestion_models.rs`](ingestion_models.rs), the RPC request/response
+ shapes that used to live in `tinymemory_core::rpc_models`, re-exported flat
+ from [`mod.rs`](mod.rs) (`pub use rpc_models::*`).
+- **Host-only policy modules**, each with its own reasoning for why it is not
+ the engine's:
+ - [`auto_recall/`](auto_recall/) — Lane C, the gated, bounded pre-turn
+ recall of facts about the user (#6040).
+ - [`safety.rs`](safety.rs) — the host-side secret/PII scrubbers applied to
+ anything this host persists or hands on.
+ - [`source_scope.rs`](source_scope.rs) — the host-side per-turn
+ memory-source allowlist.
+ - [`obsidian_registry.rs`](obsidian_registry.rs) — is the memory content
+ root a vault Obsidian already knows about.
+ - [`exit.rs`](exit.rs), [`sync_activity.rs`](sync_activity.rs),
+ [`sync_events_bridge.rs`](sync_events_bridge.rs),
+ [`preferences/`](preferences/) — smaller host-side seams; see each file's
+ own doc comment.
This module used to be mostly a **re-export** of the engine crate — a wall of
`pub use tinymemory_core::{chat, global, ingest_pipeline, ingestion,
diff --git a/crates/openhuman-core/src/search/README.md b/crates/openhuman-core/src/search/README.md
index cb5704ca9a..c5c44aae86 100644
--- a/crates/openhuman-core/src/search/README.md
+++ b/crates/openhuman-core/src/search/README.md
@@ -52,5 +52,5 @@ that constructs that engine's tool set — e.g. `managed::build` wraps a single
See [`tools/README.md`](tools/README.md) for the provider -> tool -> transport
table, and
-[`gitbooks/features/native-tools/web-search.md`](../../../../../gitbooks/features/native-tools/web-search.md)
+[`gitbooks/features/native-tools/web-search.md`](../../../../gitbooks/features/native-tools/web-search.md)
for the user-facing description of engine selection.
diff --git a/gitbooks/developing/architecture/mcp-registry.md b/gitbooks/developing/architecture/mcp-registry.md
index 4299aecbfd..bd94883dc8 100644
--- a/gitbooks/developing/architecture/mcp-registry.md
+++ b/gitbooks/developing/architecture/mcp-registry.md
@@ -46,31 +46,26 @@ All payload types (`InstalledServer`, `McpTool`, `ConnStatus`, the Smithery/offi
## Server transport model
-An `InstalledServer` carries a `transport: Transport` discriminator (`types.rs`) with two variants:
+An `InstalledServer` (from `tinymcp_bus`, re-exported as `registry::types::InstalledServer`) carries a `Transport` discriminator with stdio and HTTP-remote variants — a local subprocess (`npx`, `uvx`, or a direct binary) speaking stdio JSON-RPC, or a hosted server (the majority of what Smithery lists) dialled over streamable HTTP. `tinymcp` owns picking and building the connection for both the manual install path (`mcp_clients_install`) and the setup-agent path (`mcp_setup_install_and_connect`); this domain only wraps the two RPC surfaces around it.
-- **`Stdio`**: a local subprocess launched by `npx`, `uvx`, or a direct binary (see `types::CommandKind`), speaking **stdio JSON-RPC**.
-- **`HttpRemote { url }`**: a hosted server (the majority of what Smithery lists), dialled over streamable HTTP by `mcp::http_client::McpHttpClient`.
+## Boot-time spawn and the reconnect supervisor
-`connections.rs` dispatches on the transport. Both the manual install dialog (`mcp_clients_install`) and the setup-agent path (`mcp_setup_install_and_connect`) pick the best connection via `setup_ops::pick_connection` (published stdio → any stdio → published http_remote → any http_remote) and build the transport with `setup_ops::build_install_transport`, so the two paths behave identically.
-
-## Boot-time spawn
-
-`boot::spawn_installed_servers` is called from `bootstrap_core_runtime` so every installed server is connected as soon as the core comes up. Errors are logged per-server and **never block boot**; a broken MCP install should not gate the desktop app starting. The lifecycle log subscriber (`bus::init`) is registered alongside the other domain subscribers in `register_domain_subscribers` so those connect events are observed.
+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).
## Layout
-| Path | Role |
-| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `types.rs` | Data structures: `InstalledServer`, `McpTool`, `ConnStatus`, Smithery DTOs, etc. |
-| `store.rs` | SQLite persistence: `mcp_clients.db`, CRUD over `InstalledServer` rows. |
-| `registry.rs` | Smithery HTTP client with a 10-minute SQLite cache so re-browsing doesn't hammer the upstream registry. |
-| `registries/` | Adapters for the upstream registries this code can browse: Smithery (`smithery.rs`) + the official modelcontextprotocol registry (`mcp_official.rs`). Each reads optional auth config-first with an env-var fallback (`mcp_client.registry_auth` in TOML). |
-| `connections.rs` | Global in-process connection registry. Wraps `crate::mcp::config_servers::McpStdioClient` (there is no separate stdio client implementation here). |
-| `boot.rs` | Boot-time spawn (`spawn_installed_servers`) called from `bootstrap_core_runtime`. |
-| `setup.rs` / `setup_ops.rs` | "Setup agent" support: the small agent that walks a user through configuring a freshly installed server (env vars, secrets, first connect). |
-| `ops.rs` | RPC handler implementations (install, uninstall, list, browse, enable / disable, etc.). |
-| `schemas.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 for lifecycle logging. |
+| 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: `RpcOutcome` encoding, identifier guards, workspace-service resolution, credential-name injection — deduplicated out of `ops.rs`/`setup_ops.rs`. |
+| `ops.rs` | `mcp_clients_*` RPC handler implementations (install, uninstall, list, browse, connect/disconnect, tool call, registry settings). One-to-one with `schemas.rs` handlers; publishes `DomainEvent`s `tinymcp` does not. |
+| `setup_ops.rs` | `mcp_setup_*` RPC handlers for the guided setup flow: opaque `secret://…` handles, out-of-band prompting, `mcp_setup_install_and_connect`. |
+| `schemas.rs` (+ `schemas_part_0{1,2}.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, AI config help) — thin shims over `ops.rs`. Mutators (`mcp_registry_install`/`_uninstall`) ship default-OFF behind the `mcp_manage` toggle. Distinct from the generic `mcp_list_servers`/`mcp_call_tool` bridge tools and the `mcp_setup_*` tools. |
+| `stub.rs` | The disabled facade compiled when the `mcp` feature is off. |
## Public surface
@@ -86,28 +81,26 @@ pub use schemas::{
pub use types::{ConnStatus, InstalledServer, McpTool};
```
-Everything else (`boot`, `bus`, `connections`, `store`, `setup`, `setup_ops`) is `pub mod` for in-crate callers but not re-exported.
+`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`, `setup_ops`, `supervisor_events`, `tools`) is `pub mod` for in-crate callers but not re-exported from `mod.rs`.
## Calls into
-- `crate::mcp::config_servers::McpStdioClient`: the actual stdio transport.
+- `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.
-- `memory_store` / workspace SQLite, for `mcp_clients.db` persistence.
-- Smithery.ai HTTP, for registry browsing.
+- `crate::core::bus::BUS`: publishes `DomainEvent`s (`McpToolRejected`, lifecycle events, supervisor observations).
## Called by
-- `bootstrap_core_runtime` (via `boot::spawn_installed_servers`).
-- Frontend Skills UI: the **MCP** tab at `/skills?tab=mcp` (`McpServersTab`) dispatches through `ops.rs` over the `openhuman.mcp_clients_*` RPC namespace: browse, install (auto-connects), connect/disconnect, status, tool*call, `update_env` (reconfigure + reconnect), and `registry_settings_get` / `registry_settings_set` (Smithery / official-registry credentials; secret values are write-only). The agent-native flow uses `openhuman.mcp_setup*\*`via the`mcp_setup`sub-agent (orchestrator delegate`setup_mcp_server`).
-- The setup agent in `setup_ops.rs`, for first-connect onboarding.
-
-## Tests
-
-Unit tests are co-located inline under `#[cfg(test)]` blocks in `store.rs`, `connections.rs`, and `setup.rs`. There is no dedicated `*_tests.rs` sibling per file (the convention in this domain is inline).
+- Core startup, via `mcp::host::init` and the reconnect-supervisor loop.
+- Frontend Skills UI: the **MCP** tab at `/skills?tab=mcp` (`McpServersTab`) dispatches through `ops.rs` over the `openhuman.mcp_clients_*` RPC namespace: browse, install (auto-connects), connect/disconnect, status, tool call, `update_env` (reconfigure + reconnect), and `registry_settings_get` / `registry_settings_set` (Smithery / official-registry credentials; secret values are write-only). The agent-native flow uses `openhuman.mcp_setup_*` via the `mcp_setup` sub-agent (orchestrator delegate `setup_mcp_server`).
## Related
-- [`mcp/registry/mod.rs`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-core/src/mcp/registry/mod.rs): the authoritative rustdoc this page mirrors.
-- `crates/openhuman-core/src/mcp/config_servers/` + `crates/openhuman-core/src/mcp/http_client/`: the transport library + static config-declared server set.
+- [`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.