The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs: add README files for core modules and update building guide
Steven Enamakel1e543ffd0257
diff --git a/crates/openhuman-core/README.md b/crates/openhuman-core/README.mdindex 79e7826c1f..f26c74b2fc 100644--- a/crates/openhuman-core/README.md+++ b/crates/openhuman-core/README.md@@ -56,8 +56,15 @@ contents inside `mod.rs` behind the feature of the same name. See the| `web_chat` | Web/desktop channel turn runner (`channel.web_*` RPC, `WebChannelEvent` bus) | [README](src/web_chat/README.md) |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.+in `crates/openhuman-rpc` and are re-exported here as `openhuman_core::rpc`.+They are not redefined in this crate.++The `inference` domain is where the pluggable LLM and embedding providers+live; see+[`gitbooks/developing/engines.md`](../../gitbooks/developing/engines.md) for+the full provider list. Tool selection under `agent` includes the Jev+ranker's core-side integration point; see+[`gitbooks/developing/jev.md`](../../gitbooks/developing/jev.md).## Binaries@@ -73,9 +80,9 @@ Details for each are in [`src/bin/README.md`](src/bin/README.md).## 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+`[features] default` in `Cargo.toml` is the **contributor set**: what a bare+`cargo check`/`cargo test`/rust-analyzer compile builds, and 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 usediff --git a/crates/openhuman-core/src/agent/harness_init/README.md b/crates/openhuman-core/src/agent/harness_init/README.mdindex 4f756614bf..519a46ff1f 100644--- a/crates/openhuman-core/src/agent/harness_init/README.md+++ b/crates/openhuman-core/src/agent/harness_init/README.md@@ -8,15 +8,15 @@ tracks per-step progress in an in-memory snapshot, and exposes it over`openhuman.harness_init_status` / `openhuman.harness_init_run` for thefrontend's initialization screen (`app/src/services/harnessInitService.ts`).-Steps delegate to existing idempotent provisioning code — `runtime::python`+Steps delegate to existing idempotent provisioning code, `runtime::python`(`PythonBootstrap`), `runtime::node` (`NodeBootstrap`), and`runtime::python_server` (`ensure_spacy`, `ensure_kompress`, `ensure_started`)-— this module only orchestrates and reports; it does not reimplement downloads.+This module only orchestrates and reports; it does not reimplement downloads.## Files-- `mod.rs` — module doc and re-exports.-- `registry.rs` — the ordered `HarnessInitStep` list from `all_steps()`:+- `mod.rs`: module doc and re-exports.+- `registry.rs`: the ordered `HarnessInitStep` list from `all_steps()`:`python_runtime`, `spacy`, `kompress`, `runtime_python_server`, and`node_runtime` (only when the `runtime-node` feature is compiled in). Eachstep is a durable, network-free `is_done` probe plus a `run` closure, and a@@ -24,23 +24,23 @@ Steps delegate to existing idempotent provisioning code — `runtime::python`justify the blocking first-run overlay) or is routine startup that must runsilently (relaunching an already-installed local server). All steps are`required: false`; a failure degrades to a fallback.-- `ops.rs` — `run_harness_init` / `run_harness_init_with(config, force)`:+- `ops.rs`: `run_harness_init` / `run_harness_init_with(config, force)`:walks the registry, marks steps `Done` instantly when already satisfied,otherwise runs them. `provisioning_required` decides up front whether any*provisioning* step still needs work, so an already-provisioned host neverflashes the overlay on a warm restart (GH-5047). Also hosts the RPC handlers`handle_status` / `handle_run` (`force` re-runs satisfied steps).-- `store.rs` — process-lifetime `HarnessInitSnapshot` behind a mutex.+- `store.rs`: process-lifetime `HarnessInitSnapshot` behind a mutex.`set_overall` and `update_step` mutate it; `update_step` publishes`DomainEvent::HarnessInitProgress` and `publish_completed` publishes`DomainEvent::HarnessInitCompleted` (both in `core/events.rs`).-- `types.rs` — `HarnessInitSnapshot`, `StepStatus`, `OverallState`,+- `types.rs`: `HarnessInitSnapshot`, `StepStatus`, `OverallState`,`StepState` (serialized `snake_case`).-- `bus.rs` — placeholder; progress is published directly from `store`, so+- `bus.rs`: placeholder; progress is published directly from `store`, sothere is no subscriber today.-- `schemas.rs` — `harness_init` namespace controller schemas (`status`,+- `schemas.rs`: `harness_init` namespace controller schemas (`status`,`run`).-- `*_tests.rs` — focused behavior tests beside each file.+- `*_tests.rs`: focused behavior tests beside each file.## Wiringdiff --git a/crates/openhuman-core/src/agent/tinyagents/README.md b/crates/openhuman-core/src/agent/tinyagents/README.mdindex 83fdc1a77f..dd54e6d96a 100644--- a/crates/openhuman-core/src/agent/tinyagents/README.md+++ b/crates/openhuman-core/src/agent/tinyagents/README.md@@ -1,16 +1,17 @@# tinyagents-The **adapter seam** between OpenHuman and the vendored [`tinyagents`](../../../../../vendor/tinyagents/) crate family (issue #4249). Every agent turn runs on the crate's `AgentHarness` loop; this module bridges OpenHuman's `Provider`, `Tool`, and `ChatMessage` types onto the crate's `ChatModel`, `Tool`, and `Message` traits, assembles the per-turn harness, and enforces the OpenHuman-specific policy (approval, tool scope, budgets, credential scrubbing, compaction) as harness middleware on the way in and out. The chat, channel/CLI, and sub-agent routes all enter through one function, `run_turn_via_tinyagents_shared`, so they cannot drift from each other.+The adapter seam between OpenHuman and the vendored [`tinyagents`](../../../../../vendor/tinyagents/) crate family (issue #4249). Every agent turn runs on the crate's `AgentHarness` loop; this module bridges OpenHuman's `Provider`, `Tool`, and `ChatMessage` types onto the crate's `ChatModel`, `Tool`, and `Message` traits, assembles the per-turn harness, and enforces OpenHuman-specific policy (approval, tool scope, budgets, credential scrubbing, compaction) as harness middleware on the way in and out. The chat, channel/CLI, and sub-agent routes all enter through one function, `run_turn_via_tinyagents_shared`, so they cannot drift from each other.## Responsibilities- Assemble a per-turn harness (`assemble_turn_harness` in `harness_assembly.rs`): register the turn's `ChatModel`s, every shared tool, and the full middleware stack, then drive it via `AgentHarness::invoke_stream_in_context` (`turn_runner.rs`).-- Convert between OpenHuman and crate types: tiered `ChatModel` bundles from `(role, config)` (`turn_models.rs`, `model.rs`), direct TinyTools/TinyInference tool declarations at their consumers, and `ChatMessage`/`ConversationMessage` ↔ crate `Message` via `crate::agent::message_convert`.+- Convert between OpenHuman and crate types: tiered `ChatModel` bundles from `(role, config)` (`turn_models.rs`, `model.rs`), direct TinyTools/TinyInference tool declarations at their consumers, and `ChatMessage`/`ConversationMessage` to and from the crate's `Message` via `crate::agent::message_convert`.- Enforce cross-cutting policy as harness middleware: approval/security gating, tool policy and CLI/RPC-only denial, cost budgets, context compaction/summarization, credential scrubbing, malformed-argument recovery, and the repeated-tool-failure circuit breaker (`middleware*.rs`).- Route workloads to model tiers and record the resolved provider/model for audit (`routes.rs`, canonical TinyInference response metadata).- Let TinyAgents stop repetitive visible model streams in its agent loop; the OpenHuman session driver turns `GenerationStalled` into a bounded partial containing completed tool evidence.- Make turns durable and replayable: a JSONL event journal plus status store (`journal.rs`), a startup sweep for orphaned runs (`reaper.rs`), and a read-only RPC surface over both (`replay/`).- Provide graph-layer helpers for multi-stage sub-agent orchestration (`orchestration.rs`, `delegation.rs`) and expose graph structure for debugging (`topology.rs`).+- Pick which tools a turn even considers: `discovery/` holds the process-wide tool-search ranker slot (see [Tool search](#tool-search) below).- Host adapters (`host/`) for the crate's ten host-capability traits. Not yet wired into the live turn path; see [Host adapters](#host-adapters) below.## Key files@@ -26,6 +27,7 @@ The **adapter seam** between OpenHuman and the vendored [`tinyagents`](../../../| `turn_outcome.rs` | `TinyagentsTurnOutcome`, `HaltSummarySlot`, `ToolOutcomeSink`, and `record_unobserved_turn_usage`, the cost-tracker fallback for turns with no `on_progress` observer. || `turn_run_error.rs` | Maps a failed harness run onto the typed OpenHuman error `run_turn_via_tinyagents_shared` returns. || `turn_run_finalize.rs` | Turns a completed harness run into a `TinyagentsTurnOutcome` on the success path (journal completion, compaction diagnostics, the terminal `TurnCompleted` event). |+| `discovery/` | `install_tool_ranker` / `installed_tool_ranker`: the process-wide slot for the host's `ToolRanker` (a decision model such as Jev, installed by `openhuman-tinyhumans`; the core itself installs none), and `discovery_policy`, which turns the installed ranker plus `agent.tool_search` config into the `ToolDiscoveryPolicy` every turn harness runs with. A ranker that fails at search time falls back to BM25 in the harness. || `host/` | OpenHuman's implementations of the crate's ten host-capability traits: `agent_memory`, `budget_gate`, `context_composer`, `definition_registry`, `experience_store`, `learning_sink`, `model_resolver`, `progress_sink`, `security_gate`, `tool_outcome_classifier`. Each file adapts one trait onto the OpenHuman domain that implements it. || `replay/` | Read-only agent-run replay/status RPC (`mod.rs`, `ops.rs`, `schemas.rs`): three `agent`-namespace controllers over `journal.rs`. || `journal.rs` | `TurnJournal` and `FileStatusStore`: a crate `StoreEventJournal` over a JSONL append store plus a `HarnessStatusStore` writer under `{workspace}/tinyagents_store`. Attached alongside the live `observability` bridge as an independent `EventSink` subscriber, wrapped in `RedactingSink`; best-effort and non-fatal. |@@ -38,7 +40,7 @@ The **adapter seam** between OpenHuman and the vendored [`tinyagents`](../../../| `topology.rs` | `all_graph_topologies`: behaviour-free `GraphTopology` exports of every custom OpenHuman graph for debug/inspection. || `observability.rs` + `observability/` | `event_bridge.rs`: `OpenhumanEventBridge`, translating crate `AgentEvent`s into `AgentProgress` and feeding per-call usage into `crate::platform::cost`. `event_projection.rs`: its `EventListener` impl. `cap_pauser.rs`: `CapPauser` and `SubagentScope`. `graph_tracing.rs`: `GraphTracingSink`. || `host/steering.rs` | OpenHuman's steering allowlist and the shared `SteeringRegistry` for detached sub-agents. Task primitives are imported directly from `tinyagents_graph::orchestration`. |-| `host/delegation.rs` | Explicit tracing-bound execution helpers over `tinyagents_graph::delegation`'s plan → execute ⇄ review → finalize graph. |+| `host/delegation.rs` | Explicit tracing-bound execution helpers over `tinyagents_graph::delegation`'s plan, execute, review, finalize graph. || `payload_summarizer.rs` | `PayloadSummarizer` trait, `SummarizeOutcome`/`UnavailableReason`, and the default `SubagentPayloadSummarizer` that compresses oversized tool results through the `summarizer` sub-agent instead of hard-truncating them. || `policy_denial.rs` | `maybe_enrich_policy_block`: rewrites `[policy-blocked]` tool results into structured what/why/workaround messages that tell the model to relay the denial rather than fabricate output. Called from `ToolOutcomeCaptureMiddleware`. || `abort_guard.rs` | `AbortOnDrop`: ties a detached streaming-producer task's lifetime to its consumer stream so a dropped turn aborts the in-flight provider call (issue #4460). |@@ -48,11 +50,26 @@ The **adapter seam** between OpenHuman and the vendored [`tinyagents`](../../../| `summarize.rs` | `ModelSummarizer` / `FaultTolerantCachingSummarizer` plus a context-window-aware `SummarizationPolicy` driving the crate's `ContextCompressionMiddleware`. || `embeddings.rs` | `ProviderEmbeddingModel`: adapts `crate::inference::embedding_host::EmbeddingProvider` onto the crate's `EmbeddingModel` trait. || `retriever.rs` | `recall_through_facade` / `build_retriever`: wraps `Memory::recall`, projects onto the crate's `ScoredDoc`, applies the `path_scope` dedupe rule, emits `MemoryLoaded`. |-| `host/run_context.rs` | Explicit run-owned `thread_id` inherited by children and supplied to managed backend construction. || `todos.rs` | `todos_store` / `scratch_todos_store` (the crate `Store` behind per-thread agent todos, `tinyagents_graph::todos`). || `config.rs` | Maps OpenHuman's `Config` (including model pins) onto `tinyagents_harness::config` structs. || `*_tests.rs` | Sibling test suites for each file/part group above. |+## Tool search++`discovery/` is the host's side of the crate's `tool_search`/`tool_call`+bridge: the intrinsic BM25 catalogue over every `ToolExposure::Deferred`+registration, and a slot for a decision-model ranker on top of it. The core+itself installs nothing there; `openhuman-tinyhumans` installs the Jev+ranker when a decision-model credential is present. `discovery_policy` reads+that installed ranker together with `agent.tool_search`+(`ToolSearchConfig` in `crate::config::schema`) and builds the+`ToolDiscoveryPolicy` the harness runs with for that turn. The slot is+process-wide, like the backend transport, because the credential a+decision-model ranker needs belongs to the process's signed-in user rather+than to any one agent config. See+[the Jev page](../../../../../gitbooks/developing/jev.md) for the ranking+mechanism and its measured accuracy against plain BM25.+## Public surfaceMost of the module is `pub(crate)` or private. The `pub` items, per `mod.rs`:@@ -79,7 +96,7 @@ Responses project the crate's own `AgentObservation` and `HarnessRunStatus` serd## Dependencies- The vendored crates under `vendor/tinyagents/`: `tinyagents-harness`, `tinyagents-graph`, `tinyagents-registry`, plus `tinyinference` and `tinytools` from `vendor/tinyagents/vendor/`, all declared as path dependencies in `crates/openhuman-core/Cargo.toml`. Per AGENTS.md, use this vendored copy; a second path to the same crates creates incompatible Rust types.-- `crate::agent::message_convert` for `ChatMessage` ↔ crate `Message` conversion.+- `crate::agent::message_convert` for `ChatMessage` to/from crate `Message` conversion.- `crate::agent::harness::{run_queue, tool_result_artifacts}` and `crate::agent::{messages, progress, stop_hooks, cost, hooks, subagent_host}`: the OpenHuman-side turn plumbing this seam plugs into.- `crate::tools`: the canonical `tinytools::Tool` trait resolved by `CanonicalSharedToolAdapter`, and `tools::registry::denials` for recording policy blocks.- `crate::platform::cost`: the global cost tracker fed by `observability/event_bridge.rs` and `turn_outcome.rs`.diff --git a/crates/openhuman-core/src/config/migrations/README.md b/crates/openhuman-core/src/config/migrations/README.mdindex 451bbd1049..b209a59b69 100644--- a/crates/openhuman-core/src/config/migrations/README.md+++ b/crates/openhuman-core/src/config/migrations/README.md@@ -32,15 +32,15 @@ Startup data-migration runner gated by `Config::schema_version`. Each migration| `crates/openhuman-core/src/config/migrations/retire_local_whisper_stt.rs` | **9→10.** Rewrites `stt_provider` (top-level or legacy `local_ai`) values naming the removed local whisper engine (`"whisper"`, `"local"`) to `"cloud"`, which defers to `voice_server.stt_engine`. Pure in-memory. || *(inline in `mod.rs`)* | **10→11.** `reseed_cloud_providers`: backfills the managed `openhuman` entry for workspaces that were born past the `== 1` gate with `cloud_providers = []`; reuses `unify_ai_provider_settings::seed_cloud_providers`, which is a no-op on a populated list. On save failure rolls back both the version and the seeded entries. || `crates/openhuman-core/src/config/migrations/mod.rs` | **11→12.** Reserializes the retired subconscious engine name as `local` while preserving startup for old configuration files. |-| `crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs.rs` | **12→13.** Retires the managed tier slugs (`chat-v1`, `agentic-v1`, …): every persisted one — `default_model`, orchestrator/team/delegate pins, `model_routes[].model` — becomes the managed default model (`openrouter/deepseek/deepseek-v4-flash`). Concrete ids and `hint:*` markers are untouched. Pure in-memory. |+| `crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs.rs` | **12→13.** Retires the managed tier slugs (`chat-v1`, `agentic-v1`, …): every persisted one (`default_model`, orchestrator/team/delegate pins, `model_routes[].model`) becomes the managed default model (`openrouter/deepseek/deepseek-v4-flash`). Concrete ids and `hint:*` markers are untouched. Pure in-memory. || `crates/openhuman-core/src/config/migrations/mod_tests.rs` | Tests for `run_pending` ordering, gating, rollback-on-save-failure. || `crates/openhuman-core/src/config/migrations/*_tests.rs` | Per-migration unit tests; every migration module mounts its own `<name>_tests.rs` via `#[cfg(test)] #[path]`. |## Public surface-- `migrations::run_pending(config: &mut Config) -> impl Future<Output = ()>` — the only `pub` entry point; called by `Config::load_or_init`.-- `migrations::CURRENT_SCHEMA_VERSION: u32` — target schema version (`11`).-- `migrations::seed_new_workspace(config: &mut Config)` — `pub(crate)`; called by `Config::load_or_init` when it creates a fresh `config.toml`.+- `migrations::run_pending(config: &mut Config) -> impl Future<Output = ()>`: the only `pub` entry point; called by `Config::load_or_init`.+- `migrations::CURRENT_SCHEMA_VERSION: u32`: target schema version (`11`).+- `migrations::seed_new_workspace(config: &mut Config)`: `pub(crate)`; called by `Config::load_or_init` when it creates a fresh `config.toml`.All individual migration modules (`phase_out_profile_md`, `unify_ai_provider_settings`, …) are **private** to the module; each exposes a `run(...)` fn and a `*Stats` struct used internally by the runner for diagnostics logging.diff --git a/crates/openhuman-core/src/security/approval/README.md b/crates/openhuman-core/src/security/approval/README.mdindex 63b4569f34..fdaa4b3a14 100644--- a/crates/openhuman-core/src/security/approval/README.md+++ b/crates/openhuman-core/src/security/approval/README.md@@ -47,7 +47,7 @@ Namespace `approval` (registered via `all_approval_registered_controllers`, cons| --- | --- | --- || `approval.list_pending` | none | `pending: PendingApproval[]` || `approval.list_recent_decisions` | `limit?: u64` (1-500, default 50) | `decisions: ApprovalAuditEntry[]` |-| `approval.get_gate_state` | — | `state: ApprovalGateBootState` (installed / disabled-by-env / override-ignored / host tag) |+| `approval.get_gate_state` | none | `state: ApprovalGateBootState` (installed / disabled-by-env / override-ignored / host tag) || `approval.decide` | `request_id: string`, `decision: string` (`approve_once` / `approve_always_for_tool` / `approve_always_for_flow` / `deny`) | `decided: PendingApproval` || `approval.preauthorize_flow` | `flow_id: string`, `tool_names: string[]` | `result: FlowPreauthorizationResult` (idempotent flow-scoped trust grants; succeeds with `gate_installed=false` when the gate is off) |diff --git a/gitbooks/developing/building-rust-core.md b/gitbooks/developing/building-rust-core.mdindex 6ed19e554c..9ae2ae8000 100644--- a/gitbooks/developing/building-rust-core.md+++ b/gitbooks/developing/building-rust-core.md@@ -127,7 +127,7 @@ scripts/dev-setup-linker.shscripts/dev-setup-linker.sh --dry-run```-Install the linker first (`apt install mold` / `brew install llvm`) — the+Install the linker first (`apt install mold` / `brew install llvm`). Thescript detects it and exits with instructions if it's missing. It'sidempotent: 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