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 documentation for core modules
Steven Enamakele75968e30a20
diff --git a/crates/openhuman-core/src/http_host/README.md b/crates/openhuman-core/src/http_host/README.mdindex 60c9a8ec70..c463ea2984 100644--- a/crates/openhuman-core/src/http_host/README.md+++ b/crates/openhuman-core/src/http_host/README.md@@ -24,7 +24,8 @@ Static directory hosting over ad-hoc, in-process HTTP listeners owned by the cor| `crates/openhuman-core/src/http_host/path_utils.rs` | Path safety + URL/HTML helpers: directory canonicalization, request-path traversal resolution, bind-host/label sanitization, href builders, `escape_html`, `content_type_for_path`, `redact_path_for_log`. || `crates/openhuman-core/src/http_host/rpc.rs` | RPC adapters wrapping ops into `RpcOutcome<T>` (`start`/`stop`/`get`/`list`). || `crates/openhuman-core/src/http_host/schemas.rs` | `ControllerSchema`s + `handle_*` controller handlers; `all_controller_schemas` / `all_registered_controllers`. |-| `crates/openhuman-core/src/http_host/tests.rs` | `#[cfg(test)]` test module. |+| `crates/openhuman-core/src/http_host/http_host_tests.rs` | Module-level tests (registry, path safety, auth defaults). |+| `crates/openhuman-core/src/http_host/schemas_tests.rs` | Controller-schema/handler tests. |## Public surface@@ -61,8 +62,8 @@ None on disk. Running servers are held in a process-global `HostedDirRegistry` (## Used by-- `crates/openhuman-core/src/core/all.rs` — registers `all_http_host_registered_controllers()` (line ~145) and `all_http_host_controller_schemas()` (line ~309) into the core controller registry, exposing the RPC/CLI surface.-- `crates/openhuman-core/src/mod.rs` — declares `pub mod http_host`.+- `crates/openhuman-core/src/core/all.rs` — registers `all_http_host_registered_controllers()` into the core controller registry, exposing the RPC/CLI surface.+- `crates/openhuman-core/src/lib.rs` — declares `pub mod http_host;`, gated by `#[cfg(feature = "http-server")]`; a slim build without that feature has no `http_host.*` controllers (see the `default` feature list and `http-server` feature notes in `crates/openhuman-core/Cargo.toml`).- `crates/openhuman-core/src/core/observability.rs` references `http_host::path_utils` paths in error-classification docs/tests (`http_host` directory-not-found maps to a filesystem user-path-invalid class).## Notes / gotchasdiff --git a/crates/openhuman-core/src/inference/provider/README.md b/crates/openhuman-core/src/inference/provider/README.mdnew file mode 100644index 0000000000..42e82fc84c--- /dev/null+++ b/crates/openhuman-core/src/inference/provider/README.md@@ -0,0 +1,97 @@+# provider++Native TinyAgents `ChatModel` construction plus cloud/local inference policy,+auth, error taxonomy, and RPC helpers for every chat-model transport OpenHuman+supports. Was previously `providers/` (pre-consolidation `src/openhuman/`+layout); see `../README.md` for how this fits into the wider `inference`+domain.++## Public surface++- **Factory** (`factory.rs` + `factory_part_0{1..4}.rs`) — `create_chat_model`,+ `create_chat_model_from_string[_with_model_id]`,+ `create_chat_model_with_model_id`, `provider_for_role`, `role_for_model_tier`,+ `probe_inference_readiness`, `BYOK_INCOMPLETE_SENTINEL`. Parses the+ provider-string grammar (`openhuman`, `cloud`, `ollama:<model>`,+ `lmstudio:<model>`, `mlx:<model>`, `omlx:<model>`, `local-openai:<model>`,+ `claude_agent_sdk[:<model>]`, `claude-code:<model>`, `<slug>:<model>[@<temp>]`)+ and applies BYOK/access gates before building a model.+- **Models** — `OpenHumanBackendModel` + `PROVIDER_LABEL`+ (`openhuman_backend_model.rs`), plus the OpenAI-compatible and Anthropic+ crate-native builders (`crate_openai.rs`, `crate_anthropic.rs`).+- **DTOs** (`types.rs`) — `ChatRequest`, `ChatResponse`, `ProviderDelta`,+ `ToolCall`, `UsageInfo`, `AGENT_TURN_MAX_OUTPUT_TOKENS`.+- **Error classifiers** — `billing_error::is_budget_exhausted_message`,+ `chat_template::is_chat_template_rejection_message`,+ `config_rejection::{is_openai_compatible_unknown_model_message,+ is_provider_config_rejection_message}`, `error_code::{BackendErrorCode,+ extract_backend_error_code*, backend_error_code_skips_sentry, ...}`.++## Transports++| Transport | File | Provider-string prefix |+| --- | --- | --- |+| Managed OpenHuman backend | `openhuman_backend_model.rs` | `openhuman` / `cloud` (session JWT + billing metadata) |+| OpenAI-compatible (BYOK cloud slugs, local runtimes) | `crate_openai.rs` | `<slug>:<model>`, `ollama:<model>`, `lmstudio:<model>`, `mlx:<model>`, `omlx:<model>`, `local-openai:<model>` |+| Anthropic Messages API (prompt caching) | `crate_anthropic.rs` | `<anthropic-slug>:<model>` |+| Codex OAuth / Responses API | `openai_codex.rs` (`pub(crate)`) | resolved from the `openai` cloud slug once Codex OAuth is connected |+| Claude Agent SDK subprocess | `claude_agent_sdk/` (`protocol.rs`, `subprocess.rs`) | `claude_agent_sdk` / `claude_agent_sdk:<model>` |+| Claude Code CLI subprocess | `claude_code/` — see its own [README](claude_code/README.md) | `claude-code:<model>` |++## Calls into++- `tinyinference::model::ChatModel` (`vendor/tinyagents/vendor/tinyinference`)+ — the trait every transport implements.+- `crate::config` — cloud-provider schema (`AuthStyle`, slug reservation),+ `Config::claude_agent_sdk`, abstract tier model constants.+- `crate::security::credentials` — auth-profile store for BYOK keys and OAuth+ tokens.+- `crate::agent::tinyagents::{routes, thread_context}` — workload routing and+ ambient thread-context plumbing consumed while building a model.+- `crate::inference::auth_error_registry` — surfaces per-provider auth errors+ back to the UI.+- `crate::core::bus` (`BUS.publish`) / `crate::core::events::DomainEvent` —+ `ops/http_error_part_02.rs::publish_backend_session_expired` publishes+ `DomainEvent::SessionExpired` when the managed backend reports an auth+ failure, so the credentials layer can clear/refresh the session.+- `crate::mcp::server::local` (via `claude_code/driver.rs`) — the Claude Code+ provider points the sandboxed `claude` subprocess at the in-process MCP+ server so it can reach OpenHuman's memory/tools over loopback without the+ MCP server inheriting CC's OS jail.++## Called by++`grep -rn 'inference::provider::' crates/openhuman-core/src` shows the main+consumers: the agent harness (`agent/harness/session/builder/factory.rs`,+`agent/harness/session/runtime*.rs`, `agent/harness/subagent_runner/ops/*`),+`web_chat/session.rs`, `voice/factory/{helpers,mod}.rs`,+`inference/ops.rs`/`inference/schemas_part_0{1,2}.rs`, and+`inference/embeddings` (through the shared model-resolution helpers).++## Sub-modules with their own docs++- [`ops/`](ops) — `sanitize` (secret scrubbing), `http_error` (HTTP error+ classification, Sentry routing, `api_error`), `models`+ (`list_configured_models`), `provider_factory` (`ProviderRuntimeOptions`,+ `list_providers`, China-provider alias helpers). Preserves the original+ `pub use ops::*` contract split out of a single `ops.rs`.+- [`claude_code/`](claude_code/README.md) — Claude Code CLI provider.+- `claude_agent_sdk/` — Claude Agent SDK subprocess provider+ (`protocol.rs` wire types, `subprocess.rs` process management).++## Tests++- `factory_tests*.rs`, `factory_tests_part_0{1,2,3}_tests.rs`,+ `factory_test_provider_override_tests.rs` — provider-string parsing, access+ gates, and model construction.+- `ops_tests*.rs`, `ops/http_error_tests.rs`, `ops/models_tests.rs` — error+ classification and model listing.+- `error_classify_tests.rs`, `error_code_tests.rs`, `config_rejection_tests.rs`,+ `billing_error_tests.rs`, `chat_template_tests.rs`,+ `fallback_diagnostics_tests.rs` — per-classifier behavior.+- `claude_code/*_tests.rs` — per-file coverage of the CC provider (auth,+ driver, event mapper, stream parser, session store, settings, version+ check).+- `crate_openai_tests.rs`, `crate_anthropic_tests.rs`,+ `openhuman_backend_model_tests.rs`, `openai_codex_tests.rs` — per-transport+ model builders.diff --git a/crates/openhuman-core/src/memory/guard/README.md b/crates/openhuman-core/src/memory/guard/README.mdnew file mode 100644index 0000000000..5fa6dbec45--- /dev/null+++ b/crates/openhuman-core/src/memory/guard/README.md@@ -0,0 +1,84 @@+# guard++The taint/scope/budget policy gate over every memory-provider call+(`docs/specs/plan-memory.md` §3.4, `docs/specs/kernel.md` §3.4,+`docs/specs/memory-guard-allowlist.md`). [`MemoryGuard`] implements+`MemoryProvider` over the bound driver, so it is the only handle product code+should hold — a caller writes the same code against the guard as against the+raw driver, and there is no second, unguarded shape to reach for instead.++## Public surface++- `pub struct MemoryGuard` (`provider.rs`) — the decorator. Fourteen `as_*`+ overrides hand back guarded family handles instead of the inner driver's;+ see `families.rs` for why that has to be an owned field per family rather+ than a value built on demand.+- `pub struct GuardPolicy` (`policy.rs`) — the resolved policy bundle the+ guard and all family decorators share: `enforce_read` / `enforce_write`+ (the `SecurityPolicy` tier check), `ambient_scope` (source-scope query+ predicate), `stamp_taint`, `redact_outbound`, `check_egress`. Binding facts+ (driver id, `DriverClass`, hook budgets, trust state) are cached at bind+ time; the `SecurityPolicy` itself is re-read live on every call so an+ autonomy change takes effect immediately.+- Family decorators (`families.rs` + `families_part_0{1..4}.rs`) — ten+ optional-capability decorators (e.g. `GuardedTree`, `GuardedProfile`,+ `GuardedGraph`), present exactly when the bound driver advertises that+ family.+- `mandatory.rs` — the three families every driver has (`MemoryCore`,+ `MemoryRecall`, `MemoryPortability`), where steps 3, 4 and 6 land for the+ always-present surface.+- `budget.rs` — pure char-budget truncation, step 6.+- `audit.rs` — the tracing span and audit event, step 7.+- `in_memory.rs` — `#[doc(hidden)]` in-memory `MemoryProvider` fake for tests+ that need a genuine round trip. Not `#[cfg(test)]`: integration tests link+ it too.+- `test_support*.rs` — a recording fake that proves a call was made without+ storing data.++## The seven enforcement steps++| # | Step | Where |+| - | ---- | ----- |+| 1 | `SecurityPolicy` tier | `GuardPolicy::enforce_read` / `enforce_write` |+| 1b | path rules | no-op — no contract method carries a path |+| 2 | source scope as a query predicate | `GuardPolicy::ambient_scope`, applied in `GuardedTree::query_source` (not recall — the bound driver refuses a scoped recall) |+| 3 | taint stamping | `GuardPolicy::stamp_taint` (raises, never overrides) |+| 4 | redaction | `GuardPolicy::redact_outbound` — a no-op for embedded drivers |+| 5 | egress + trust | `GuardPolicy::check_egress` |+| 6 | char budgets | `budget.rs`, driven by `MemoryHooksConfig` |+| 7 | audit + tracing | `audit.rs` |++See `mod.rs` for the full argument behind each departure from a naive reading+of the milestone brief, and its "Honesty clause" section for what is+deliberately *not* covered yet (`ProfileStore`'s direct SQL access to+`user_profile` has no guarded family).++## Calls into++- `crate::memory::api::provider::MemoryProvider` (the `tinymemory-api`+ contract) — what the guard decorates.+- `crate::security::SecurityPolicy` — the tier check in step 1.+- `crate::memory::source_scope` — the ambient per-turn source allowlist read+ in step 2.+- `crate::config`'s `MemoryHooksConfig` — the budgets read in step 6.++## Called by++- `crate::memory::ops::guard::active_memory_guard` — the guarded-driver+ lookup RPC handlers use instead of `ops::helpers::active_memory_client`+ when the operation has a typed contract twin.+- `CoreContext::memory` (`crate::core::runtime::context`) — resolves+ `memory_binding()` and returns its `.guard()`; this is additive next to+ `CoreContext::memory_binding()`, which still hands out the bare driver for+ callers (like the health probe) that must not run through the tier check.+- `crate::memory::binding` — constructs the `MemoryGuard` at bind time+ (`MemoryGuard::new`).++## Tests++- `budget_tests.rs`, `families_tests.rs`, `policy_tests.rs`,+ `provider_tests.rs` — unit coverage per file above.+- `../bypass_allowlist_tests.rs` — the ratchet lint: enumerates the production+ files that still reach the driver around the guard (all of them into+ `ProfileStore`/`MemoryClient`, none of them into a `MemoryProvider` family)+ and fails if that set grows.diff --git a/crates/openhuman-core/src/security/egress/README.md b/crates/openhuman-core/src/security/egress/README.mdnew file mode 100644index 0000000000..8ae6ed56c8--- /dev/null+++ b/crates/openhuman-core/src/security/egress/README.md@@ -0,0 +1,78 @@+# Security / Egress++The privacy epic's "egress spine" (#4436, #4441): a single, uniform answer to+"what leaves the device, to where, and why" for every external data transfer,+plus the `LocalOnly` enforcement chokepoint built on top of it.++## Key files++| File | Purpose |+| --- | --- |+| `types.rs` | `EgressDescriptor`, `DataKind`, `EgressReason`, `IdentificationRisk` — the descriptor contract |+| `emit.rs` | `emit_external_transfer`, the single publish chokepoint, plus per-turn dedup |+| `enforce.rs` | `local_only_blocks` (pure decision) and its two side-effecting wrappers, `enforce_egress` / `local_only_tool_block` |++## Public surface++- `EgressDescriptor` — `provider_slug` (destination, e.g. `"openai"`,+ `"composio"`, `"openhuman_backend"`, `"network"`), `service` (endpoint/model/+ host), `is_external` (false for local runtimes — never published),+ `reason: EgressReason`, `data_kinds: Vec<DataKind>`, and the S5 forward-compat+ fields `risk_level: IdentificationRisk` / `risk_categories: Vec<String>`+ (default `Unknown`/empty until the PII/identification-risk detector+ populates them). Built via semantic constructors —+ `EgressDescriptor::inference`, `::composio`, `::integration`, `::embedding`,+ `::network_fetch` — rather than the struct literal.+- `emit_external_transfer(descriptor)` — the one call every external-egress+ point makes right before a transfer leaves the device. It drops non-external+ transfers, attaches best-effort chat routing from+ `security::approval::APPROVAL_CHAT_CONTEXT`, and fire-and-forget publishes+ `DomainEvent::ExternalTransferPending` on `crate::core::bus::BUS` — this+ never blocks or fails the caller.+- `dedup_turn_scope(f)` — runs `f` with a per-turn dedup ledger so a single+ managed chat turn's multi-model fan-out (primary + workload-tier + summarizer+ builds) collapses repeated disclosures of the same destination into one+ event; every other call path emits unconditionally.+- `local_only_blocks(mode, desc) -> bool` — pure decision: blocks only when+ `mode == PrivacyMode::LocalOnly`, `desc.is_external`, and the transfer is not+ an exempt backend control-plane round-trip (`is_control_plane`, private).+ `Standard` and `Sensitive` never block here.+- `enforce_egress(desc) -> anyhow::Result<()>` — thin wrapper for+ `anyhow`-returning egress sites (composio, integrations, cloud embeddings);+ `Err` with a clean, non-sensitive message when blocked.+- `local_only_tool_block(desc) -> Option<String>` — thin wrapper for agent+ tools that return `Ok(ToolResult::error(..))` on denial; the message is+ prefixed with `POLICY_BLOCKED_MARKER` so the harness treats it as a+ permanent, non-retryable block.++Both `enforce_egress` and `local_only_tool_block` read the live mode via+`security::live_policy::current_privacy_mode`, which defaults to+`PrivacyMode::Standard` (no restriction) when no session policy is installed+(CLI / cron / background), so enforcement is a correct no-op there.++## Relates to++- `config/schema/privacy.rs` — `PrivacyMode` (`Standard` / `Sensitive` /+ `LocalOnly`), the config-facing enum `local_only_blocks` matches on.+- [`../pii/README.md`](../pii/README.md) — the identification-risk detector+ that will eventually populate `EgressDescriptor::risk_level` /+ `risk_categories` via `EgressDescriptor::with_risk`.+- `core/events.rs` — `DomainEvent::ExternalTransferPending { descriptor,+ thread_id, client_id }`, the event `emit_external_transfer` publishes.++## Used by++- `memory/guard/policy.rs` — memory-write egress guard.+- `integrations/client_part_01.rs`, `integrations/composio/client_part_01.rs`,+ `integrations/composio/execute_dispatch.rs` — backend and Composio calls.+- `tools/impl/network/{curl,http_request,web_fetch}.rs` — agent network-fetch+ tools.+- `search/tools/{tavily_part_01,exa}.rs`, `inference/embeddings/cloud_adapter.rs`,+ `inference/provider/factory_part_0{1,2,3,4}.rs` — search and cloud+ inference/embedding providers.+- `web_chat` surfaces the disclosed descriptor to the frontend (see the+ `ExternalTransferPending` chat-routed fields).++## Tests++- `types_tests.rs`, `emit_tests.rs`, `enforce_tests.rs`.