Skip to content

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

docs(core): update READMEs to reflect current module structure and crate paths

Steven Enamakelb32f43e56a17
diff --git a/crates/openhuman-core/README.md b/crates/openhuman-core/README.md
new file mode 100644
index 0000000000..c227546000
--- /dev/null
+++ b/crates/openhuman-core/README.md
@@ -0,0 +1,123 @@
+# `openhuman-core`
+
+Cargo package `openhuman`, library `openhuman_core`, binary `openhuman-core`
+(`src/main.rs`). Owns business rules, persistence, execution policy, the
+JSON-RPC/Socket.IO server, and the CLI for OpenHuman. Hosted in-process by
+`crates/openhuman-app` (the Tauri shell, in-process), `crates/openhuman-embed`
+(the typed facade for third-party embedders such as Medulla and OpenCompany),
+and `crates/openhuman-tui` (in-process).
+
+See `crates/openhuman-core/src/lib.rs` for the crate-level doc comment and
+AGENTS.md ("Rust domain structure") for the preferred per-domain module shape.
+
+## Layout
+
+Business logic lives one directory per domain under `src/<domain>/`. `*` marks
+modules gated behind a Cargo feature of the same (or noted) name in
+`lib.rs`; see the `[features]` block in `Cargo.toml` for what each gate pulls
+in.
+
+| Domain | Purpose | README |
+| --- | --- | --- |
+| `agent` | Multi-agent orchestration, tool execution, session management | [README](src/agent/README.md) |
+| `api` | HTTP and Socket.IO helpers for the TinyHumans / AlphaHuman hosted API | |
+| `channels` | Channel implementations and runtime orchestration | [README](src/channels/README.md) |
+| `config` | Configuration management for the core | [README](src/config/README.md) |
+| `core` | Transport, dispatch, controller registry (`core::all`), CLI, event bus, runtime composition — not a domain | |
+| `cron` | Scheduled work and host-condition ("may this job run now?") policy | [README](src/cron/README.md) |
+| `desktop` | Desktop-shell-facing surfaces | |
+| `flows`* | Saved automation workflows (tinyflows graphs) | |
+| `hooks` | User-authored scripts that observe and gate the agent | |
+| `hosted` | Clients of the hosted TinyHumans backend | |
+| `hosting`* | Putting a workspace on the internet | [README](src/hosting/README.md) |
+| `http_host`* (feature `http-server`) | Static directory hosting over ad-hoc HTTP listeners | [README](src/http_host/README.md) |
+| `inference` | Unified inference domain | [README](src/inference/README.md) |
+| `integrations` | Agent integration tools | [README](src/integrations/README.md) |
+| `json_schema` | Vendor-neutral JSON Schema and JSON value walking | |
+| `mcp` | Host half of Model Context Protocol support | [README](src/mcp/README.md) |
+| `media`* | Media generation and image tool contracts | |
+| `medulla` | Medulla cloud client and its wire vocabulary | |
+| `memory` | Memory orchestration — the host layer over `tinymemory-core` | [README](src/memory/README.md) |
+| `modules`* | Loadable native modules — capabilities that live outside this binary | |
+| `platform` | Host-platform services: process lifecycle, self-update, diagnostics | |
+| `sandbox` | Sandbox execution backends for agent tool isolation | |
+| `search` | Unified search domain | [README](src/search/README.md) |
+| `security` | Autonomy/risk policy, sandbox selection, audit log, secret store | [README](src/security/README.md) |
+| `skills` | Skills metadata: discovery, parse, install, run | [README](src/skills/README.md) |
+| `test_support`* (feature `e2e-test-support`) | Wipe-and-reset hooks for E2E specs | [README](src/test_support/README.md) |
+| `threads` | Conversation thread and message management | [README](src/threads/README.md) |
+| `tools` | Agent tool implementations and policy | [README](src/tools/README.md) |
+| `util` | Utility functions | |
+| `voice`* | Hosted speech-to-text and text-to-speech (local piper / hosted) | [README](src/voice/README.md) |
+| `web3`* | High-level web3 surface built on the wallet layer | [README](src/web3/README.md) |
+| `web_chat` | Web-channel delivery formatting | |
+
+RPC contract types (`RpcOutcome`, `StructuredRpcError`, the HTTP client) live
+in `crates/openhuman-rpc` and are re-exported here as `openhuman_core::rpc` —
+they are not redefined in this crate.
+
+## Binaries
+
+| Binary | Path | Required features |
+| --- | --- | --- |
+| `openhuman-core` | `src/main.rs` | (default set) |
+| `test-mcp-stub` | `src/bin/test_mcp_stub.rs` | (default set) |
+| `openhuman-fleet` | `src/bin/fleet.rs` | `http-server`, `bin-tools` |
+| `rss-bench` | `src/bin/rss_bench.rs` | `rss-bench` |
+| `library-profile` | `src/bin/library_profile/main.rs` | `rss-bench` |
+
+`openhuman-fleet` is a process-per-user supervisor and reverse proxy, part of
+the pluggable-core work (see `crates/openhuman-core/src/core/runtime`).
+`rss-bench` and `library-profile` are dev-only profiling harnesses; see
+`scripts/profile/`.
+
+## Feature flags
+
+`[features] default` in `Cargo.toml` is the **contributor set** — what a bare
+`cargo check`/`cargo test`/rust-analyzer compile — and is deliberately smaller
+than what the desktop app ships. The **product set** lives in
+`scripts/ci/product-features.txt` and is forwarded by
+`crates/openhuman-app/Cargo.toml`; `scripts/ci/check-feature-forwarding.mjs`
+asserts the two stay in sync. Slim or headless-embedding builds use
+`--no-default-features --features "<explicit list>"`.
+
+Gate names (see `Cargo.toml` for the full rationale behind each): `http-server`,
+`inference`, `documents`, `hosting`, `modules`, `voice`, `web3`,
+`runtime-node`, `contacts`, `media`, `flows`, `skills`, `mcp`,
+`crash-reporting`, `medulla`, `channels`, `sandbox-landlock`,
+`sandbox-bubblewrap`, `peripheral-rpi`, `browser-native`, `fantoccini`,
+`landlock`, `whatsapp-web`, `e2e-test-support`, `rss-bench`,
+`rss-bench-dhat`, `file-logging`, `scheduler-gate`, `bin-tools`. Do not
+paraphrase the policy comments above `[features]` in `Cargo.toml` — read them
+before changing either feature list.
+
+## Build and test
+
+```bash
+cargo check --manifest-path Cargo.toml
+cargo build --manifest-path Cargo.toml --bin openhuman-core
+cargo test -p openhuman
+pnpm debug rust [filter]
+scripts/test-rust-with-mock.sh # tests that need the shared mock backend
+```
+
+Auto-discovery (`autotests`, `autoexamples`, `autobins`) is off. Integration
+tests and examples live at the repo root (`../../tests/*.rs`,
+`../../examples/*.rs`) with explicit `[[test]]`/`[[example]]` targets in
+`Cargo.toml`. `tests/raw_coverage/*.rs` is the one exception: `../../build.rs`
+globs those files into the single `raw_coverage_all` target instead of one
+target per file. Four product-gated targets (`json_rpc_e2e`,
+`observability_smoke`, `raw_coverage_all`, `x402_twit_sh_live`) declare
+`required-features` and are silently skipped, not failed, under the
+contributor default set — run them with the product feature set to exercise
+what ships.
+
+## Public entry points
+
+- [`run_core_from_args`](src/lib.rs) — the CLI entry point used by both
+ `src/main.rs` and the desktop shell.
+- [`CoreBuilder`] → [`CoreRuntime`] — the embeddable composition API
+ (`crates/openhuman-core/src/core/runtime/`); `openhuman-embed` layers a
+ typed facade over it.
+- `openhuman-core serve` — the standalone JSON-RPC/Socket.IO server. Public
+ endpoints: `GET /health`, `GET /schema`, `GET /events`.
diff --git a/crates/openhuman-core/src/skills/runtime/README.md b/crates/openhuman-core/src/skills/runtime/README.md
index cf114da4a2..f858ca4116 100644
--- a/crates/openhuman-core/src/skills/runtime/README.md
+++ b/crates/openhuman-core/src/skills/runtime/README.md
@@ -1,19 +1,43 @@
-# Skill Runtime
+# skills/runtime
-`skill_runtime` owns execution of installed `SKILL.md` workflows.
+`crate::skills::runtime` owns execution of installed `SKILL.md` skills.
+`skill_runtime` is the stable RPC/CLI namespace for this module (registered
+in `core/all.rs`).
Responsibilities:
- Start and cancel skill runs.
- Read recent run metadata and run logs.
- Resolve reusable language runtimes before script-backed skills run.
-- Host the built-in `skill_executor` agent.
+- Host the built-in `skill_executor` sub-agent that carries out a run.
It deliberately reuses:
-- `runtime_node` for Node.js, npm, npx, and PATH injection.
-- `runtime_python` for Python interpreter resolution and process launching.
-- `workflows` for installed skill discovery, metadata, resources, and run logs.
+- `crate::runtime::node` for Node.js, npm, npx, and PATH injection.
+- `crate::runtime::python` for Python interpreter resolution and process
+ launching.
+- `crate::skills` (`ops_discover`, `run_log`) for installed skill discovery,
+ metadata, resources, and run-log storage.
+
+## Key files
+
+| File | Purpose |
+| --- | --- |
+| `mod.rs` | Feature gate for the `skills` Cargo feature; re-exports the real module or [`stub`] |
+| `ops.rs` | `RuntimeRequirement` and `resolve_runtimes` — checks Node/Python availability |
+| `run_machinery.rs` | Spawns and awaits background skill runs (`spawn_workflow_run_background[_with_profile]`, `await_run_outcome`) |
+| `schemas.rs` | Controller schemas and handlers for `skill_runtime_*` (`run`, `cancel`, `recent_runs`, `read_run_log`, `resolve_runtimes`, `schemas`) |
+| `tools.rs` | LLM-callable tool wrapping `resolve_runtimes` |
+| `stub.rs` | Disabled-feature facade matching the public surface with empty bodies |
+| `agent/skill_executor/` | Built-in `skill_executor` agent archetype that carries out a run |
+
+## Compile-time gate (`skills` feature)
+
+`pub mod runtime;` in `skills/mod.rs` is always compiled — it is a facade.
+The real implementation is gated behind the default-ON `skills` Cargo
+feature (the same gate as `skills` and `skills::catalog`). When the feature
+is off, [`stub`](stub.rs) takes its place with disabled-error / empty
+bodies. See `crates/openhuman-core/src/skills/mod.rs` for the pattern.
Production smoke examples:
@@ -23,9 +47,3 @@ openhuman skill_runtime resolve_runtimes --runtime all
openhuman skill_runtime run --skill_id git-helper --inputs '{}'
openhuman skill_runtime recent_runs --limit 10
```
-
-Compatibility:
-
-- Existing `openhuman workflows run`, `workflows cancel`, and run-log RPCs remain available.
-- New scripts should prefer the `skill_runtime` namespace for execution.
-
diff --git a/crates/openhuman-core/src/threads/goals/README.md b/crates/openhuman-core/src/threads/goals/README.md
new file mode 100644
index 0000000000..59c0d539a5
--- /dev/null
+++ b/crates/openhuman-core/src/threads/goals/README.md
@@ -0,0 +1,39 @@
+# goals
+
+Compatibility surface for OpenHuman thread-goal callers.
+
+The goal model and behavior are owned by `tinyagents_graph::goals`: types,
+lifecycle (active / paused / budget-limited / complete), the durable KV store,
+budget accounting, and prompt rendering. Types and business logic are not
+redeclared here — `ThreadGoal` and `ThreadGoalStatus` are re-exported from the
+crate.
+
+OpenHuman keeps this module to preserve app-specific integration:
+
+- `store.rs` adapts the historical `store::*(workspace_dir, …)` call surface
+ (RPC ops, the harness turn loop, the heartbeat continuation runtime, the
+ agent tools, and post-turn accounting) onto the crate's `graph.goals` KV
+ store, converting the crate's `ThreadGoal`/error types to the local ones.
+- `schemas.rs` exposes `openhuman.thread_goals_<function>` JSON-RPC: `get`,
+ `set`, `complete`, `pause`, `resume`, `clear`.
+- `tools.rs` adapts tinyagents' model-facing goal controls to OpenHuman's
+ `Tool` trait: `goal_get`, `goal_set`, `goal_complete` (asymmetric ownership —
+ pause/resume/budget-limit are system-driven, with no model tool). Each tool
+ resolves its target thread from the ambient `current_thread_id`, never from
+ an argument.
+- `continuation.rs` is the heartbeat adapter that injects one autonomous
+ continuation turn when an active goal's thread goes idle, gated by
+ `heartbeat.goal_continuation_enabled`, one-shot suppression, and a
+ process-wide `Semaphore(1)`.
+- `runtime.rs` folds completed-turn usage into the active goal
+ (`account_turn_against_goal`) and implements `GoalBudgetStopHook`, a
+ `StopHook` that pauses an in-flight turn once running usage would exceed the
+ goal's budget.
+- `migration.rs` imports the retired file-backed `thread_goals/<hex>.json`
+ store into the crate's `graph.goals` namespace at startup; existing
+ tinyagents values are never replaced.
+
+Callers: `agent::harness::session::turn`, `agent::orchestration::tools`
+(context preparation), `tools::ops`, and controller wiring in `core::all` and
+`core::runtime::services`. The external `thread_goals.*` RPC namespace and
+`goal_*` tool names remain stable.
diff --git a/crates/openhuman-core/src/tools/README.md b/crates/openhuman-core/src/tools/README.md
index 9cadc83dc5..7069822fe0 100644
--- a/crates/openhuman-core/src/tools/README.md
+++ b/crates/openhuman-core/src/tools/README.md
@@ -1,18 +1,19 @@
# tools
-The agent tool layer. Defines the core [`Tool`] trait every agent-callable capability implements, assembles the **default tool registry** consumed by the agent harness, hosts the cross-cutting built-in tool implementations (filesystem, browser/computer, generic system/network), and exposes a small allowlist of tool operations over JSON-RPC for the Tauri shell. Domain-owned tools (cron, memory, wallet, composio, codegraph, etc.) live in their own domains and are re-exported here so a single `openhuman::tools::*` import surfaces the full set.
+The agent tool layer. Defines the core [`Tool`] trait every agent-callable capability implements, assembles the **default tool registry** consumed by the agent harness, hosts the cross-cutting built-in tool implementations (filesystem, browser, generic system/network/document/presentation), and exposes a small allowlist of tool operations over JSON-RPC for the Tauri shell. Domain-owned tools (cron, memory, wallet, composio, skills, etc.) live in their own domains and are re-exported here so a single `crate::tools::*` import surfaces the full set. The crate's lib target is `openhuman_core` (`[lib] name = "openhuman_core"`), so external callers (e.g. `openhuman-embed`) reach this module as `openhuman_core::tools::*`; everything below uses in-crate `crate::` paths.
## Responsibilities
-- Define the [`Tool`] async trait and its supporting value types (`ToolResult`, `ToolSpec`, `PermissionLevel`, `ToolScope`, `ToolCategory`, `ToolCallOptions`).
+- Define the [`Tool`] async trait and its supporting value types (`ToolResult`, `ToolSpec`, `PermissionLevel`, `ToolScope`, `ToolCategory`, `ToolCallOptions`, `ToolExposure`) — sourced from `tinytools` and re-exported through `traits.rs`.
- Assemble the registry the agent loop runs against — `default_tools[_with_runtime]` (minimal: shell + file read/write) and `all_tools[_with_runtime]` (full, config-gated set).
-- Gate registration on config flags / env (`browser.enabled`, `node.enabled`, `computer_control.enabled`, `learning.*`, `integrations.*`, `search.engine`, `gitbooks.enabled`, MCP registry presence, `OPENHUMAN_LSP_ENABLED`).
-- Own the cross-cutting built-in tool impls under `impl/` (filesystem, browser, computer, generic system, generic network).
+- Gate registration on config flags / env (`browser.enabled`, `node.enabled`, `learning.*`, `integrations.*`, `search.engine`, `gitbooks.enabled`, MCP registry presence, `OPENHUMAN_LSP_ENABLED`).
+- Own the cross-cutting built-in tool impls under `impl/` (filesystem, browser, generic system, generic network, meta, and the `documents`-gated document/presentation tools).
- Provide the pre-execution [`ToolPolicy`] middleware (allow/deny gate) and the default allow-all policy.
- Normalize tool JSON schemas for provider compatibility (`SchemaCleanr`).
- Synthesize per-subagent orchestrator tools at agent-build time (`orchestrator_tools`).
- Wrap runtime-generated capability tools (`generated`).
- Filter the registry by user tool-toggle preferences (`user_filter`).
+- Own tool-call lifecycle state and failure classification (`status`), on-demand schema disclosure (`toolpacks`), the process-wide tool execution timeout (`timeout`), the read-only cross-surface discovery registry (`registry`), and per-session tool-boundary policy (`agent_policy`) — each documented in its own sibling README.
- Expose a JSON-RPC `tools.*` controller allowlist for Tauri-driven flows (onboarding-style orchestration in the renderer).
- Browser-allowlist derivation: narrow the browser host list from the unified fetch allowlist (`browser_allowed_domains`, strips `"*"`).
@@ -20,32 +21,39 @@ The agent tool layer. Defines the core [`Tool`] trait every agent-callable capab
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/tools/mod.rs` | Export hub. Declares submodules, re-exports built-in impls and the domain-owned tool sets (`agent`, `voice::audio_toolkit`, `codegraph`, `composio`, `cron`, `integrations`, `memory`, `wallet`), and the `all_tools_*` controller pair. |
-| `crates/openhuman-core/src/tools/traits.rs` | The `Tool` trait + `ToolResult`/`ToolContent` re-export, `ToolSpec`, `PermissionLevel`, `ToolScope`, `ToolCategory`, `ToolCallOptions`. Defines per-tool hooks: permission level (incl. args-aware), scope, category, concurrency safety, `external_effect[_with_args]` (drives approval gating), `max_result_size_chars`, markdown preference, generated-runtime context. |
+| `crates/openhuman-core/src/tools/mod.rs` | Export hub. Declares submodules, re-exports the built-in impls and every domain-owned tool set, and the `all_tools_*` controller pair. |
+| `crates/openhuman-core/src/tools/traits.rs` | The `Tool` trait + `ToolResult`/`ToolContent`/`ToolExposure` re-export from `tinytools`, `ToolSpec`, `PermissionLevel`, `ToolScope`, `ToolCategory`, `ToolCallOptions`. Defines per-tool hooks: permission level (incl. args-aware), scope, category, concurrency safety, `external_effect[_with_args]` (drives approval gating), `max_result_size_chars`, markdown preference, generated-runtime context. |
| `crates/openhuman-core/src/tools/ops.rs` | Registry assembly: `default_tools`, `default_tools_with_runtime`, `all_tools`, `all_tools_with_runtime`, `browser_allowed_domains`. All config-gating logic lives here. |
-| `crates/openhuman-core/src/tools/schemas.rs` | JSON-RPC `tools` namespace controllers + `handle_*` fns. `all_controller_schemas` / `all_registered_controllers` (re-exported as `all_tools_*`). |
+| `crates/openhuman-core/src/tools/schemas.rs` (+ `schemas_part_01.rs`, `schemas_part_02.rs`) | JSON-RPC `tools` namespace controllers + `handle_*` fns. `all_controller_schemas` / `all_registered_controllers` (re-exported as `all_tools_*`). |
| `crates/openhuman-core/src/tools/policy.rs` | `ToolPolicy` trait + `PolicyDecision` (`Allow`/`Deny`) + allow-all `DefaultToolPolicy`. Evaluated on the agent hot path before each `execute()`. |
| `crates/openhuman-core/src/tools/schema.rs` | `SchemaCleanr` / `CleaningStrategy` — per-provider JSON-Schema normalization (Gemini keyword stripping, `$ref` resolution, union flattening, cycle detection). |
| `crates/openhuman-core/src/tools/orchestrator_tools.rs` | Synthesizes named per-subagent tools from the orchestrator's `subagents = [...]` definition; collapses skill wildcards into `delegate_to_integrations_agent`. |
| `crates/openhuman-core/src/tools/generated.rs` | `GeneratedToolDefinition` + wrapper for runtime/profile-supplied generated capability tools (provider/capability/risk metadata for policy). |
| `crates/openhuman-core/src/tools/user_filter.rs` | `filter_tools_by_user_preference` + UI-toggle-ID → Rust-tool-name map. Unmapped tools are always retained. |
+| [`crates/openhuman-core/src/tools/status/`](status/mod.rs) | Tool-call lifecycle state (`ToolLifecycleState`) and human-readable failure classification (`ToolFailureClass`, `classify`). Pure data/logic; no persistence, no RPC. |
+| [`crates/openhuman-core/src/tools/toolpacks/`](toolpacks/mod.rs) | On-demand tool disclosure: keeps a pack's tools constructed but unadvertised until `UseSkillTool` renders or invokes one, trimming per-turn schema token cost. |
+| [`crates/openhuman-core/src/tools/timeout/`](timeout/README.md) | Process-wide tool execution timeout (env override → config → `120`s default); scripting tools (`shell`/`node_exec`/`npm_exec`) opt out and run unbounded. |
+| [`crates/openhuman-core/src/tools/registry/`](registry/README.md) | Unified read-only discovery registry across MCP stdio, JSON-RPC controller, and connected MCP client tools, plus policy/tool-visibility diagnostics. |
+| [`crates/openhuman-core/src/tools/agent_policy/`](agent_policy/README.md) | Per-session tool boundary: classifies every tool against a channel's permission ceiling into allow/require-approval/deny/hide, and renders the prompt-visible boundary section. |
| `crates/openhuman-core/src/tools/impl/mod.rs` | Aggregates and re-exports the built-in tool families. |
-| `crates/openhuman-core/src/tools/impl/filesystem/` | `file_read`, `file_write`, `edit_file`, `apply_patch`, `grep`, `glob_search`, `list_files`, `read_diff`, `csv_export`, `git_operations`, `run_linter`, `run_tests`, `update_memory_md`. |
-| `crates/openhuman-core/src/tools/impl/browser/` | `browser` (DOM-snapshot automation, pluggable backend), `browser_open`, `image_info`, action parser, native backend, security. |
-| `crates/openhuman-core/src/tools/impl/computer/` | `mouse`, `keyboard` (native control, default-off), human-path resolution. |
-| `crates/openhuman-core/src/tools/impl/network/` | `http_request`, `web_fetch`, `curl`, `gitbooks` (search/get-page), `mcp` (list servers/tools, call), `mcp_setup` (5 setup-agent tools), `gmail_unsubscribe`, `url_guard`. |
+| `crates/openhuman-core/src/tools/impl/filesystem/` | `file_read`, `file_write`, `edit_file`, `apply_patch`, `grep`, `glob_search`, `list_files`, `read_diff`, `csv_export`, `git_operations` (+ `git_operations_config`/`git_operations_render`), `run_linter`, `run_tests`, `update_memory_md`, `write_sink`. |
+| `crates/openhuman-core/src/tools/impl/browser/` | `browser` (DOM-snapshot automation, pluggable backend), `browser_open`, `image_info`, Playwright backend. |
+| `crates/openhuman-core/src/tools/impl/system/` | `shell`, `node_exec`, `npm_exec`, `python_exec`, `install_tool`, `detect_tools`, `current_time`, `resolve_time`, `schedule`, `proxy_config`, `pushover`, `lsp`, `tool_stats`, `update_check`, `update_apply`, `insert_sql_record`, `workspace_state`, `command_output`, `retrieve_tool_output`. |
+| `crates/openhuman-core/src/tools/impl/network/` | `http_request`, `web_fetch`, `curl`, `gitbooks` (search/get-page), `mcp` (list servers/tools, call, `mcp`-feature gated), `mcp_setup` (setup-agent tools, `mcp`-feature gated), `gmail_unsubscribe`, `url_guard`. |
+| `crates/openhuman-core/src/tools/impl/meta/` | Tools *about* the tool surface itself: `tool_search` (the lookup half of `ToolExposure::Deferred`) and `collapse` (multi-action schema/permission merging helpers). |
+| `crates/openhuman-core/src/tools/impl/document/` (`documents` feature) | `DocumentTool` — structured document generation/editing engine. |
+| `crates/openhuman-core/src/tools/impl/presentation/` (`documents` feature) | `PresentationTool` — structured slide-deck generation engine. |
| `crates/openhuman-core/src/search/` | Search engine registry and search-owned agent tools such as `web_search`. |
-| `crates/openhuman-core/src/tools/impl/system/` | `shell`, `node_exec`, `npm_exec`, `install_tool`, `detect_tools`, `current_time`, `schedule`, `proxy_config`, `pushover`, `lsp`, `tool_stats`, `update_check`, `update_apply`, `insert_sql_record`, `workspace_state`. |
| `*_tests.rs` / `#[cfg(test)] mod tests` | Co-located/sibling unit tests across the module. |
## Public surface
-- Trait + types: `Tool`, `ToolSpec`, `ToolResult`, `ToolContent`, `PermissionLevel`, `ToolScope`, `ToolCategory`, `ToolCallOptions`.
+- Trait + types: `Tool`, `ToolSpec`, `ToolResult`, `ToolContent`, `ToolExposure`, `PermissionLevel`, `ToolScope`, `ToolCategory`, `ToolCallOptions`.
- Registry constructors: `default_tools`, `default_tools_with_runtime`, `all_tools`, `all_tools_with_runtime` (via `pub use ops::*`).
- Policy: `ToolPolicy`, `DefaultToolPolicy`, `PolicyDecision`.
- Schema: `SchemaCleanr`, `CleaningStrategy`.
- Controllers: `all_tools_controller_schemas`, `all_tools_registered_controllers`.
-- All built-in tool structs (e.g. `ShellTool`, `FileReadTool`, `EditFileTool`, `GrepTool`, `BrowserTool`, `HttpRequestTool`, `CurlTool`, `WebSearchTool`, `LspTool`, …) via `pub use implementations::*`, plus re-exported domain tool sets such as `openhuman::search::tools::*`.
+- All built-in tool structs (e.g. `ShellTool`, `FileReadTool`, `EditFileTool`, `GrepTool`, `BrowserTool`, `HttpRequestTool`, `CurlTool`, `DocumentTool`, `PresentationTool`, …) via `pub use implementations::*`, plus every re-exported domain tool set listed in `mod.rs` (agent, config, cron, desktop dashboard, flows, integrations, mcp registry, memory, platform, search, security, skills, threads todos, voice audio toolkit, web3 wallet).
- `filter_tools_by_user_preference` (crate-internal).
## RPC / controllers
@@ -54,30 +62,32 @@ Namespace `tools` (wired into `crates/openhuman-core/src/core/all.rs` via `all_t
| Method | Purpose |
| --- | --- |
-| `openhuman.tools_composio_execute` | Run a Composio action via the mode-aware factory (backend-proxied or direct). |
-| `openhuman.tools_web_search` | Web search via the backend Parallel proxy; structured results. |
-| `openhuman.tools_seltz_search` | Seltz web search (gated on `seltz.enabled`). |
-| `openhuman.tools_querit_search` | Querit web search (gated on a configured Querit key). |
-| `openhuman.tools_searxng_search` | Self-hosted SearXNG search (gated on `searxng.enabled`). |
-| `openhuman.tools_apify_linkedin_scrape` | Apify LinkedIn profile scrape → raw JSON + rendered markdown. |
+| `tools.composio_execute` | Run a Composio action via the mode-aware factory (backend-proxied or direct). |
+| `tools.web_search` | Web search via the backend Parallel proxy; structured results. |
+| `tools.seltz_search` | Seltz web search (gated on `seltz.enabled`). |
+| `tools.querit_search` | Querit web search (gated on a configured Querit key). |
+| `tools.searxng_search` | Self-hosted SearXNG search (gated on `searxng.enabled`). |
+| `tools.apify_linkedin_scrape` | Apify LinkedIn profile scrape → raw JSON + rendered markdown. |
-Handlers load config via `config::rpc::load_config_with_timeout`, build the backend integration client where needed, and return `RpcOutcome`.
+Handlers load config via `config::rpc::load_config_with_timeout`, build the backend integration client where needed, and return `RpcOutcome`. The legacy `openhuman.tools_*` spellings (e.g. `openhuman.tools_web_search`) are rewritten to the canonical names above by the server-side alias table in `crates/openhuman-core/src/core/legacy_aliases.rs`, which is kept in sync with `app/src/services/rpcMethods.ts:LEGACY_METHOD_ALIASES`.
## Agent tools
This module **owns** the cross-cutting built-in tools (the only ones that belong here per the repo's tool-ownership rule):
-- **Filesystem**: `file_read`, `file_write`, `edit_file`, `apply_patch`, `grep`, `glob`/`glob_search`, `list_files`, `read_diff`, `csv_export`, `git_operations`, `run_linter`, `run_tests`, `update_memory_md`.
-- **System/process**: `shell`, `node_exec`, `npm_exec`, `install_tool`, `detect_tools`, `current_time`, `schedule`, `proxy_config`, `pushover`, `lsp`, `tool_stats`, `update_check`, `update_apply`.
-- **Browser/computer**: `browser`, `browser_open`, `image_info`, `mouse`, `keyboard`.
+- **Filesystem**: `file_read`, `file_write`, `edit_file`, `apply_patch`, `grep`, `glob`/`glob_search`, `list_files`, `read_diff`, `csv_export`, `git_operations`, `run_linter`, `run_tests`, `update_memory_md`, `write_sink`.
+- **System/process**: `shell`, `node_exec`, `npm_exec`, `python_exec`, `install_tool`, `detect_tools`, `current_time`, `resolve_time`, `schedule`, `proxy_config`, `pushover`, `lsp`, `tool_stats`, `update_check`, `update_apply`, `command_output`, `retrieve_tool_output`.
+- **Browser**: `browser`, `browser_open`, `image_info`.
- **Generic network**: `http_request`, `web_fetch`, `curl`, `gitbooks_search`/`gitbooks_get_page`, MCP bridge (`mcp` list/call), `mcp_setup` tools, `gmail_unsubscribe`.
-- **Search**: `web_search` and provider-specific search families are registered by `openhuman::search::registry`; `search.engine = "disabled"` suppresses this surface entirely.
+- **Meta**: `tool_search` (deferred-tool lookup) and the `collapse` multi-action helpers used by other tools' schema merging.
+- **Documents** (`documents` feature): `DocumentTool`, `PresentationTool`.
+- **Search**: `web_search` and provider-specific search families are registered by `crate::search`; `search.engine = "disabled"` suppresses this surface entirely.
-Domain-owned tools (memory, cron, wallet, composio, codegraph, integrations, voice::audio_toolkit, agent sub-dispatch like `spawn_subagent`/`spawn_async_subagent`/`delegate`/`todo`/`plan_exit`/`run_skill`) are **registered** in `all_tools` but implemented in their respective domains and only re-exported through this module.
+Domain-owned tools (memory, cron, wallet, composio, integrations, skills, voice::audio_toolkit, agent sub-dispatch like `spawn_subagent`/`spawn_async_subagent`/`delegate`/`todo`/`plan_exit`/`run_skill`) are **registered** in `all_tools` but implemented in their respective domains and only re-exported through this module.
## Events
-None. This module has no `bus.rs` and registers no `EventHandler`. Approval coordination is via the `Tool::external_effect[_with_args]` hooks that the agent harness reads to route calls through the `ApprovalGate`; the gate itself lives in `openhuman::security::approval`.
+None. This module has no `bus.rs` and registers no `EventHandler`. Approval coordination is via the `Tool::external_effect[_with_args]` hooks that the agent harness reads to route calls through the `ApprovalGate`; the gate itself lives in `crate::security::approval`.
## Persistence
@@ -85,38 +95,39 @@ None. No `store.rs`; the module holds no persisted state. Tools that persist (me
## Dependencies
-- `openhuman::agent` — `host_runtime` (`RuntimeAdapter`/`NativeRuntime`), `tool_policy::GeneratedToolRuntimeContext`, harness definitions (`AgentDefinition`, `SubagentEntry`) for orchestrator tool synthesis, and the agent-owned dispatch tools re-exported here.
-- `openhuman::config` — `Config`, `BrowserConfig`, `HttpRequestConfig`, `SearchEngine`, `DelegateAgentConfig`; drives all registration gating and `config::rpc::load_config_with_timeout` in RPC handlers.
-- `openhuman::search` — active search engine registry and search-owned tool implementations.
-- `openhuman::security` — `SecurityPolicy` (host/path/command gating threaded into nearly every tool) + `AuditLogger`.
-- `openhuman::memory` — `Memory` trait, injected into memory/preference/stats tools.
-- `openhuman::integrations` — `build_client` backend HTTP client + the integration tool structs (apify, brave, parallel, stock, twilio, tinyfish, google_places, querit, seltz, searxng).
-- `openhuman::integrations::composio` — `all_composio_agent_tools`, mode-aware client for `tools.composio_execute`.
-- `openhuman::runtime::javascript` — `NodeBootstrap` shared by shell/node_exec/npm_exec.
-- `openhuman::mcp::config_servers` / `openhuman::mcp::registry` — generic remote MCP server registry + bridge tools.
-- `openhuman::skills` — `skills::types::{ToolResult, ToolContent}` (the unified result type) + skill-run spawning.
-- `openhuman::agent::learning` — LinkedIn enrichment scrape/render for the Apify RPC handler.
-- `openhuman::web3::wallet`, `openhuman::cron`, `openhuman::codegraph`, `openhuman::voice::audio_toolkit` — domain-owned tools re-exported and registered.
-- `openhuman::security::approval`, `openhuman::agent::context`, `openhuman::security::credentials`, `openhuman::platform::update`, `openhuman::util` — supporting types used by individual tools.
+- `crate::agent` — `host_runtime` (`RuntimeAdapter`/`NativeRuntime`), `tool_policy::GeneratedToolRuntimeContext`, harness definitions (`AgentDefinition`, `SubagentEntry`) for orchestrator tool synthesis, and the agent-owned dispatch tools re-exported here.
+- `crate::config` — `Config`, `BrowserConfig`, `HttpRequestConfig`, `SearchEngine`, `DelegateAgentConfig`; drives all registration gating and `config::rpc::load_config_with_timeout` in RPC handlers.
+- `crate::search` — active search engine registry and search-owned tool implementations.
+- `crate::security` — `SecurityPolicy` (host/path/command gating threaded into nearly every tool) + `AuditLogger`.
+- `crate::memory` — `Memory` trait, injected into memory/preference/stats tools.
+- `crate::integrations` — `build_client` backend HTTP client + the integration tool structs (apify, brave, parallel, stock, twilio, tinyfish, google_places, querit, seltz, searxng).
+- `crate::integrations::composio` — `all_composio_agent_tools`, mode-aware client for `tools.composio_execute`.
+- `crate::runtime::javascript` — `NodeBootstrap` shared by shell/node_exec/npm_exec.
+- `crate::mcp::config_servers` / `crate::mcp::registry` — generic remote MCP server registry + bridge tools (`mcp` feature).
+- `tinytools` (vendored via `vendor/tinyagents/`) — the `Tool` trait itself and its vocabulary, re-exported through `traits.rs`.
+- `crate::skills` — skill-run spawning and skill-owned tools (`skills` feature).
+- `crate::agent::learning` — LinkedIn enrichment scrape/render for the Apify RPC handler.
+- `crate::web3::wallet`, `crate::cron`, `crate::voice::audio_toolkit` — domain-owned tools re-exported and registered (behind their respective features).
+- `crate::security::approval`, `crate::agent::context`, `crate::security::credentials`, `crate::platform::update`, `crate::util` — supporting types used by individual tools.
- `core::all` — `ControllerSchema`, `FieldSchema`, `TypeSchema`, `RegisteredController`, `ControllerFuture` for the RPC controller surface.
## Used by
- `crates/openhuman-core/src/core/all.rs` — registers the `tools` RPC controllers + schemas.
-- `openhuman::agent` harness (`session/builder`, `dispatcher`, `subagent_runner`, `agent/tools/*`) and the `openhuman::agent::tinyagents` seam (`SharedToolAdapter`, `ToolPolicyMiddleware`) — primary consumers; build the registry and execute/police tools on the tinyagents harness path.
-- `openhuman::channels`, `openhuman::routing`, `openhuman::inference::provider` — build tool sets / clean schemas per provider.
-- `openhuman::tools::agent_policy`, `openhuman::security::approval` — read tool metadata (category, external-effect) for policy/approval decisions.
-- `openhuman::tools::registry`, `openhuman::runtime::node`, `openhuman::mcp::server` — registry/exposure consumers.
-- Many domains re-export their own tools through this module (cron, memory, wallet, composio, integrations, codegraph, voice::audio_toolkit).
+- `crate::agent` harness (`agent/harness/session/builder/`, `dispatcher`, `subagent_runner`, `agent/tools/*`) and the `crate::agent::tinyagents` seam (`SharedToolAdapter`, `ToolPolicyMiddleware`) — primary consumers; build the registry and execute/police tools on the tinyagents harness path.
+- `crate::channels::runtime::dispatch::routing` — calls `orchestrator_tools::collect_orchestrator_tools` to build per-subagent orchestrator tool sets, and `crate::inference::provider` cleans tool schemas per provider.
+- `crate::tools::agent_policy`, `crate::security::approval` — read tool metadata (category, external-effect) for policy/approval decisions.
+- `crate::tools::registry`, `crate::mcp::server` — registry/exposure consumers.
+- Many domains re-export their own tools through this module (cron, memory, wallet, composio, integrations, skills, voice::audio_toolkit).
## Notes / gotchas
-- **Ownership rule**: only genuinely cross-cutting tool families (filesystem, browser/computer, generic system/network) belong in `impl/`. New domain tools go in the owning domain's `tools.rs` and are re-exported via `mod.rs` — do not add them under `impl/`.
-- **One unified `ToolResult`**: `traits.rs` re-exports it from `skills::types` so every tool uses the same type.
+- **Ownership rule**: only genuinely cross-cutting tool families (filesystem, browser, generic system/network, meta, and the `documents`-gated document/presentation tools) belong in `impl/`. New domain tools go in the owning domain's `tools.rs` and are re-exported via `mod.rs` — do not add them under `impl/`.
+- **One unified `ToolResult`**: `traits.rs` re-exports it from `tinytools`, so every tool uses the same type.
- **Browser allowlist is fail-safe**: the browser shares `http_request.allowed_domains` but `browser_allowed_domains` strips the `"*"` wildcard — unifying can only narrow browser reach. Allow-all stays behind `OPENHUMAN_BROWSER_ALLOW_ALL`.
- **Node tools are co-gated**: `shell`, `node_exec`, and `npm_exec` share one memoised `NodeBootstrap`; with `node.enabled = false`, node/npm tools are not registered and shell skips PATH injection.
- **`external_effect_with_args`** is the hook the harness checks at the gate-decision point (not the arg-less variant) — override it for per-call gating (e.g. composio `execute` vs `list`).
- **`PermissionLevel` ordering is load-bearing**: the runtime compares `<` to reject tools above a channel's max; `permission_level()` should return the *minimum* level across a multi-action tool, with `permission_level_with_args` doing the per-call check.
- **`is_concurrency_safe` is advisory today**: the harness tool loop currently runs calls serially regardless; annotating tools is forward-prep for the parallel-dispatch refactor.
-- **RPC surface is intentionally tiny** (7 methods) — anything not in `schemas.rs` is agent-only.
+- **RPC surface is intentionally tiny** (6 methods) — anything not in `schemas.rs` is agent-only; legacy `openhuman.tools_*` callers are rewritten transparently by `core::legacy_aliases`.
- **Search engine is a single selector**: `search.engine` (`managed`/`parallel`/`brave`/`querit`) chooses which `web_search`-family tools register; legacy `seltz`/`searxng` blocks are parsed but no longer auto-register agent tools (they remain reachable via their RPC handlers).
diff --git a/gitbooks/developing/architecture/agent-harness.md b/gitbooks/developing/architecture/agent-harness.md
index e2952f721a..2a0e1ffef1 100644
--- a/gitbooks/developing/architecture/agent-harness.md
+++ b/gitbooks/developing/architecture/agent-harness.md
@@ -312,7 +312,7 @@ Custom archetypes ship as TOML files under `$OPENHUMAN_WORKSPACE/agents/*.toml`
### Running a reusable sub-agent
-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, toolkit scope, model override, sandbox mode, action root, and normalized task key/title. It then checks `agent_orchestration::subagent_sessions` before spawning:
+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, toolkit scope, 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.
@@ -560,7 +560,7 @@ Every agent turn (chat via `harness/session/turn/core.rs`, channel/CLI via `harn
- **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/graph.rs`) is a conditional-routing graph (`execute → complete|fail → done`).
-- **Multi-stage delegation** (`agent_orchestration::delegation` + the `delegate` tool) runs `delegation.rs`, checkpointed to the session DB.
+- **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):