Skip to content

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

docs: update inference, memory, security, web3, and web_chat documentation

Steven Enamakel51d5fdfa4829
diff --git a/crates/openhuman-core/src/inference/README.md b/crates/openhuman-core/src/inference/README.md
index 1fcc75a7f4..7e37284c87 100644
--- a/crates/openhuman-core/src/inference/README.md
+++ b/crates/openhuman-core/src/inference/README.md
@@ -30,30 +30,38 @@ Unified inference domain: the canonical home for everything LLM/STT/TTS/embeddin
| `presets.rs` | `ModelPreset`, `ModelTier`, `VisionMode`; tier recommendation + apply-to-config; MVP preset gating. |
| `sentiment.rs` | `SentimentResult` + emotion/valence analysis via the local model. |
| `parse.rs` / `paths.rs` | Output parsing helpers / on-disk model artifact paths. |
-| `local/` | Local runtime manager (was `local_ai/`). |
+| `local/` | Local runtime manager (was `local_ai/`). See `local/README.md`. |
| `local/core.rs` | `LocalAiService` singleton (`global`/`try_global`), `model_artifact_path`. |
| `local/ops.rs` | Local RPC entrypoints (`local_ai_status/prompt/summarize/vision_prompt/embed/should_react`, `ReactionDecision`); re-exported as `local::rpc`. |
| `local/schemas.rs` | Local-runtime `inference.*` controller schemas + handlers. |
| `local/ollama.rs`, `local/lm_studio.rs` | Provider-specific runtime drivers; base-url resolution. |
-| `local/install*.rs`, `local/voice_install_common.rs` | Ollama/Piper install + shared download logic. |
+| `local/install*.rs`, `local/voice_install_common.rs` | Ollama/Piper install + shared download logic. No Whisper install any more. |
| `local/model_requirements.rs` | `MIN_CONTEXT_TOKENS`, `evaluate_context`, `ContextEligibility`. |
-| `local/service/` | `LocalAiService` impl split: `bootstrap`, `ollama_admin`, `public_infer`, `speech`, `transcription`, `vision_embed`, `assets`, `spawn_marker`. |
-| `provider/` | Native TinyAgents model construction plus host provider configuration, auth, error taxonomy, DTOs, and RPC helpers (was `providers/`). |
+| `local/profile.rs` | `LocalProviderProfile` capability metadata (tool-dispatch strategy, context defaults, request-body quirks) per local provider type. |
+| `local/process_util.rs` | Shared subprocess helpers (e.g. Windows `CREATE_NO_WINDOW`), reused from `agent::host_runtime`. |
+| `local/provider.rs` | `LocalAiProvider` (Ollama / LM Studio) selection helpers. |
+| `local/service/` | `LocalAiService` impl split: `bootstrap`, `assets`, `lm_studio`, `model_rpc`, `public_infer`, `speech`, `transcription`, `vision_embed`, `spawn_marker`, `ollama_admin/`. |
+| `local/service/ollama_admin/` | Ollama daemon lifecycle split by concern: `binary`, `diagnostics`, `health`, `model_pull`, `server`, `util` (`test_ollama_connection`). |
+| `provider/` | Native TinyAgents model construction plus host provider configuration, auth, error taxonomy, DTOs, and RPC helpers (was `providers/`). See `provider/README.md`. |
| `provider/types.rs` | Host request/response, streaming delta, tool-call, and usage DTOs retained at product/RPC boundaries. |
-| `provider/factory.rs` | `create_chat_model*`, `provider_for_role`, provider-string grammar, access gates, and local/cloud/CLI model construction; `BYOK_INCOMPLETE_SENTINEL`. |
-| `provider/crate_openai.rs` | TinyAgents OpenAI-compatible model builders for managed, BYOK, and local endpoints. |
+| `provider/factory.rs` + `factory_part_0{1..4}.rs` | `create_chat_model*`, `provider_for_role`, provider-string grammar, access gates, and local/cloud/CLI model construction; `BYOK_INCOMPLETE_SENTINEL`. |
+| `provider/crate_openai.rs`, `provider/crate_anthropic.rs` | TinyAgents OpenAI-compatible and Anthropic Messages API model builders (managed, BYOK, and local endpoints; prompt caching). |
| `provider/openhuman_backend_model.rs` | Managed OpenHuman backend `ChatModel` with session JWT, billing metadata, and thread context. |
-| `provider/openai_codex.rs` | Codex OAuth/Responses transport as a host `ChatModel`. |
-| `provider/claude_agent_sdk/` | Claude Agent SDK subprocess provider (`protocol.rs`, `subprocess.rs`). |
-| `provider/config_rejection.rs`, `provider/billing_error.rs` | Error classifiers (unknown-model / config rejection / budget exhausted). |
-| `temperature.rs`, `tinyagents/thread_context.rs` | Per-workload temperature policy and ambient thread-context plumbing. |
-| `provider/ops.rs` | `list_configured_models`, SessionExpired publishing on auth failure. |
+| `provider/openai_codex.rs` | Codex OAuth/Responses transport as a host `ChatModel`. |
+| `provider/claude_agent_sdk/` | Claude Agent SDK subprocess provider (`protocol.rs`, `subprocess.rs`). |
+| `provider/claude_code/` | Claude Code CLI provider (`claude-code:<model>`). Drives the `claude` CLI over stream-json; see `provider/claude_code/README.md`. |
+| `provider/config_rejection.rs`, `provider/billing_error.rs`, `provider/error_classify.rs`, `provider/error_code.rs`, `provider/fallback_diagnostics.rs`, `provider/chat_template.rs` | Error classifiers (unknown-model / config rejection / budget exhausted / chat-template rejection / backend error codes / background-workload fallback diagnostics). |
+| `provider/auth.rs` | Provider auth-profile resolution shared across factory paths. |
+| `temperature.rs`, `agent/tinyagents/thread_context.rs` | Per-workload temperature policy and ambient thread-context plumbing (`crates/openhuman-core/src/agent/tinyagents/`). |
+| `provider/ops/` | Split from a single `ops.rs`: `sanitize` (secret scrubbing), `http_error` (HTTP error classification, Sentry routing, `api_error`), `models` (`list_configured_models`), `provider_factory` (`ProviderRuntimeOptions`, `list_providers`). |
| `provider/schemas.rs` | Provider-layer schemas. |
| `voice/` | Inference implementations imported by `crate::voice`. |
| `voice/cloud_transcribe.rs`, `voice/local_speech.rs` | Hosted STT and local Piper TTS. |
-| `voice/streaming.rs`, `voice/postprocess.rs`, `voice/hallucination.rs` | Streaming transcription, post-processing, hallucination filtering. |
+| `voice/streaming.rs`, `voice/postprocess.rs` | Streaming transcription and post-processing. |
| `openai_oauth/` | ChatGPT/Codex OAuth: `config.rs` (Codex OAuth config), `flow.rs` (start/complete/status/disconnect), `store.rs` (token persistence). |
| `http/` | OpenAI-compatible endpoint: `server.rs` (`router()`), `types.rs`; `EXTERNAL_OPENAI_COMPAT_PROVIDER` bearer id. |
+| `embeddings/` | Embedding provider selection/RPC. See `embeddings/README.md`. |
+| `tokenjuice/` | Host adapter for the separately released TinyJuice token-compression module. See `tokenjuice/README.md`. |
## Public surface
@@ -73,7 +81,7 @@ Provider-layer (via `provider::`): `ChatRequest`, `ChatResponse`, `ProviderDelta
One namespace is wired into the controller registry (`crates/openhuman-core/src/core/all.rs`).
-`inference.*` (`schemas.rs`, `local/schemas.rs`): `status`, `get_client_config`, `update_model_settings`, `update_local_settings`, `list_models`, `device_profile`, `presets`, `apply_preset`, `diagnostics`, `openai_oauth_start`, `openai_oauth_complete`, `openai_oauth_status`, `openai_oauth_disconnect`, `summarize`, `prompt`, `vision_prompt`, `test_provider_model`, `should_react`, `analyze_sentiment`, `agent_chat`, `agent_chat_simple`, `transcribe`, `transcribe_bytes`, `tts`, `assets_status`, `downloads_progress`, `download_asset`, `install_piper`, `piper_install_status`, `test_connection`.
+`inference.*` (`schemas.rs`, `local/schemas.rs`): `resolve_model`, `status`, `get_client_config`, `update_model_settings`, `update_local_settings`, `list_models`, `provider_auth_errors`, `device_profile`, `presets`, `apply_preset`, `diagnostics`, `openai_oauth_start`, `openai_oauth_complete`, `openai_oauth_import_codex_cli`, `openai_oauth_status`, `openai_oauth_disconnect`, `summarize`, `prompt`, `vision_prompt`, `test_provider_model`, `should_react`, `analyze_sentiment`, `claude_code_status`, `claude_code_auth_status`, `claude_code_settings`, `claude_code_set_full_access`, `agent_chat`, `agent_chat_simple`, `transcribe`, `transcribe_bytes`, `tts`, `assets_status`, `downloads_progress`, `download_asset`, `install_piper`, `piper_install_status`, `test_connection`.
Legacy `openhuman.local_ai_*` and `openhuman.update_local_ai_settings` method names are rewritten to canonical `openhuman.inference_*` methods by `crates/openhuman-core/src/core/legacy_aliases.rs` and `app/src/services/rpcMethods.ts`.
diff --git a/crates/openhuman-core/src/memory/guard/mod.rs b/crates/openhuman-core/src/memory/guard/mod.rs
index 1c2eca4500..6ddc89effe 100644
--- a/crates/openhuman-core/src/memory/guard/mod.rs
+++ b/crates/openhuman-core/src/memory/guard/mod.rs
@@ -34,12 +34,11 @@
//! would have been wrong against this tree; each departure is argued at its own
//! call site:
//!
-//! - **Step 2 is not applied to `recall`.** The embedded driver *refuses* a
-//! scoped recall (`SCOPE_UNAPPLIED` in `driver/embedded/recall.rs`), so
-//! filling the parameter from the task-local would turn every recall inside a
-//! `with_source_scope` into a hard error. The scope is filled on
-//! `MemoryTree::query_source`, which is the one method that pushes it into
-//! SQL before `LIMIT`.
+//! - **Step 2 is not applied to `recall`.** The bound driver *refuses* a
+//! scoped recall (`SCOPE_UNAPPLIED`), so filling the parameter from the
+//! task-local would turn every recall inside a `with_source_scope` into a
+//! hard error. The scope is filled on `MemoryTree::query_source`, which is
+//! the one method that pushes it into SQL before `LIMIT`.
//! - **Step 3 raises, it never overrides.** A plain override would rewrite a
//! caller's `ExternalSync` down to `Internal` outside a scope, which is the
//! laundering step the contract says the guard exists to prevent.
@@ -59,12 +58,12 @@
//! ## Honesty clause: "the guard is the only path" is NOT yet true
//!
//! `MemoryClient::profile_conn` no longer leaves the memory family: it is
-//! `pub(in crate::memory)` with one caller,
-//! [`MemoryClient::profile_store`](tinymemory_core::store::MemoryClient::profile_store),
-//! which wraps it in a typed
-//! [`ProfileStore`](tinymemory_core::store::ProfileStore). Every SQL
-//! statement against `user_profile` is now inside the family, and the compiler
-//! enforces that.
+//! `pub(in crate::memory)` with one caller, `MemoryClient::profile_store`,
+//! which wraps it in a typed `ProfileStore`. Every SQL statement against
+//! `user_profile` is now inside the family, and the compiler enforces that.
+//! (`MemoryClient` and `ProfileStore` are the extracted engine's, not named
+//! here as intra-doc links since this crate no longer depends on that crate
+//! — see `crates/openhuman-core/src/memory/README.md` for the split.)
//!
//! **That is confinement, not policy** — for the callers listed below, which
//! still reach `ProfileStore` directly and so run beneath every one of the
diff --git a/crates/openhuman-core/src/security/README.md b/crates/openhuman-core/src/security/README.md
index e7edd586bb..a28e0c774f 100644
--- a/crates/openhuman-core/src/security/README.md
+++ b/crates/openhuman-core/src/security/README.md
@@ -1,38 +1,137 @@
# Security
-Trust boundary for the autonomous core. Owns the autonomy / risk policy, sandbox backends (Docker, Bubblewrap, Firejail, Landlock, Noop), the audit log of agent actions, the encrypted secret store, the public-bind / pairing guard, and the `redact()` helper used for safe logging. Does NOT own the cross-domain `EncryptionEngine` (lives in `encryption/`) or per-channel credential storage (`credentials/`).
+Trust boundary for the autonomous core. This is the kernel security family
+(`security/mod.rs`): `SecurityPolicy`, the approval gate, taint/redaction,
+credentials, and the keychain are exactly the set a future `Guard<D>`
+decorator draws from, and a swapped driver must never see any of it. None of
+these submodules is feature-gated — the family is kernel, permanently.
+
+## Layout
+
+| Path | Purpose |
+| --- | --- |
+| `policy/` | `SecurityPolicy`, autonomy tiers, path/command gating — see [policy/README.md](policy/README.md) |
+| `approval/` | Human-in-the-loop approval gate for prompted tool calls — see [approval/README.md](approval/README.md) |
+| `credentials/` | Per-channel credential storage and profile-scoped secrets — see [credentials/README.md](credentials/README.md) |
+| `devices/` | Device pairing and cross-device tunnel security — see [devices/README.md](devices/README.md) |
+| `egress/` | Data-egress descriptors and `LocalOnly` enforcement chokepoint — see [egress/README.md](egress/README.md) |
+| `encryption/` | Cross-domain `EncryptionEngine` — see [encryption/README.md](encryption/README.md) |
+| `keyring/` | OS keyring backend and encrypted-file fallback secret store — see [keyring/README.md](keyring/README.md) |
+| `keyring_consent/` | Consent gate for falling back from OS keyring to local encrypted storage — see [keyring_consent/README.md](keyring_consent/README.md) |
+| `pii/` | Fully local PII scanner — see [pii/README.md](pii/README.md) |
+| `prompt_injection/` | Prompt-injection heuristics — see [prompt_injection/README.md](prompt_injection/README.md) |
+| `live_policy.rs` | Process-global, hot-swappable current `SecurityPolicy` (see its own `//!`) |
+| `secrets.rs` | One-line re-export of `keyring::encrypted_store` for legacy import paths |
+| `tools.rs` | `SecurityPolicyInfoTool`, the only LLM-callable surface of this domain (read-only, default-ON); command/path gating itself is enforced in-engine, never as an agent-callable tool |
+| `schemas.rs` | `security.policy_info` RPC controller |
+| `detect.rs` | `create_sandbox` — picks a `Sandbox` backend for the host |
+| `traits.rs` | `Sandbox` trait and `NoopSandbox` |
+| `docker.rs`, `bubblewrap.rs`, `firejail.rs`, `landlock.rs` | Legacy `Command`-wrapping sandbox backends implementing `Sandbox` (see below) |
+| `audit.rs` | Append-only audit log of agent actions |
+| `pairing.rs` | Pairing token / non-loopback bind guard |
+| `core.rs` | `redact()`, the uniform log-redaction helper |
+
+Sandbox note: `docker.rs` / `bubblewrap.rs` / `firejail.rs` / `landlock.rs`
+here wrap a `std::process::Command` per the `Sandbox` trait and are chosen by
+`detect::create_sandbox`. `crates/openhuman-core/src/sandbox/` is a separate,
+newer domain — see `sandbox/cwd_jail/mod.rs`'s rustdoc for why `cwd_jail`
+superseded these backends on macOS (no `bwrap`) and added a Windows
+AppContainer backend; the two domains are not interchangeable.
## Public surface
-- `pub struct SecurityPolicy` — `policy.rs` — assemble runtime policy from `AutonomyConfig` + workspace dir.
-- `pub enum AutonomyLevel` — `policy.rs` — `Supervised` / `SemiAutonomous` / `Autonomous`.
-- `pub enum CommandRiskLevel` / `pub enum ToolOperation` / `pub struct ActionTracker` — `policy.rs` — risk classification and per-session tracking.
-- `pub trait Sandbox` / `pub struct NoopSandbox` — `traits.rs` — pluggable sandbox abstraction.
-- `pub fn create_sandbox(config: &SecurityConfig) -> Arc<dyn Sandbox>` — `detect.rs:1` — pick the best backend for the host.
-- Sandbox backends: `pub mod docker`, `pub mod bubblewrap`, `pub mod firejail`, `pub mod landlock` — domain-specific implementations of `Sandbox`.
-- `pub struct SecretStore` — `keyring/encrypted_store.rs` (re-exported here) — encrypted-on-disk secret codec whose master key lives in keychain-backed storage.
-- `pub struct AuditLogger` / `pub enum AuditEventType` / `pub struct AuditEvent` / `pub struct Actor` / `pub struct Action` / `pub struct ExecutionResult` / `pub struct SecurityContext` / `pub struct CommandExecutionLog` — `audit.rs` — append-only audit trail.
-- `pub struct PairingGuard` / `pub fn constant_time_eq` / `pub fn is_public_bind` — `pairing.rs` — pairing-token check before binding the RPC server publicly.
-- `pub fn redact(value: &str) -> String` — `core.rs:3` — uniform 4-char-prefix redaction for logs.
-- `pub fn security_policy_info() -> RpcOutcome<serde_json::Value>` — `ops.rs` — RPC handler used by the doctor / settings UI.
+- `pub struct SecurityPolicy`, `pub enum AutonomyLevel`, `pub enum CommandClass`,
+ `pub enum GateDecision`, `pub struct TrustedRoot` /
+ `pub enum TrustedAccess`, `POLICY_BLOCKED_MARKER` / `POLICY_DENIED_MARKER` —
+ `policy/types.rs`, re-exported here — see [policy/README.md](policy/README.md).
+- `pub fn validate_path_within_root`, `pub fn openhuman_scratch_dir`,
+ `pub fn ensure_openhuman_scratch_dir` — `policy/enforcement.rs`.
+- `pub trait Sandbox` / `pub struct NoopSandbox` — `traits.rs` — pluggable
+ sandbox abstraction.
+- `pub fn create_sandbox(config: &SecurityConfig) -> Arc<dyn Sandbox>` —
+ `detect.rs` — auto-detects Landlock / Firejail / Bubblewrap / Docker or
+ falls back to `NoopSandbox`.
+- `pub use self::keyring::SecretStore` — encrypted-on-disk secret codec whose
+ master key lives in keychain-backed storage.
+- `pub use egress::{emit_external_transfer, enforce_egress, local_only_blocks, local_only_tool_block, DataKind, EgressDescriptor, EgressReason, IdentificationRisk}` —
+ see [egress/README.md](egress/README.md).
+- `pub use pii::{scan as scan_pii, CategoryHit, PiiCategory, PiiScanResult, RiskLevel}` —
+ see [pii/README.md](pii/README.md).
+- `pub struct AuditLogger` / `pub enum AuditEventType` / `pub struct AuditEvent`
+ / `pub struct Actor` / `pub struct Action` / `pub struct ExecutionResult` /
+ `pub struct SecurityContext` / `pub struct CommandExecutionLog` — `audit.rs`
+ — append-only audit trail.
+- `pub struct PairingGuard` / `pub fn constant_time_eq` / `pub fn is_public_bind`
+ / `pub fn ensure_core_rpc_token_for_bind` — `pairing.rs` — pairing-token
+ check before binding the RPC server publicly (backed by `tinychannels_bus`).
+- `pub fn redact(value: &str) -> String` — `core.rs` — uniform 4-char-prefix
+ redaction for logs.
+- `pub use ops as rpc` / `pub fn security_policy_info() -> RpcOutcome<serde_json::Value>` —
+ `ops.rs` — RPC handler behind `schemas.rs`'s `security.policy_info` function,
+ used by the doctor / settings UI.
+
+## Security invariants
-## Calls into
+These are the invariants AGENTS.md requires of the autonomy policy. Do not
+weaken any of the enforcing functions below, or the default-on approval
+behavior, to make a feature work:
-- `crates/openhuman-core/src/config/` — `SecurityConfig`, `AutonomyConfig` for policy + sandbox selection.
-- OS-level sandbox tools — `docker`, `bwrap`, `firejail`, `landlock` syscalls (per backend).
-- Filesystem under the workspace dir for the audit log + encrypted ciphertext payloads.
+- **`action_dir` is the agent's permitted read and write root.** Tools resolve
+ relative paths and default their cwd here (`SecurityPolicy::action_dir`,
+ `policy/types.rs`).
+- **`workspace_dir` stores internal state and is never an acting-tool target.**
+ Enforced by `SecurityPolicy::is_workspace_internal_path`
+ (`policy/path_checks.rs:420`) — memory DBs, sessions, tokens, and other core
+ persistence under `workspace_dir` (`WORKSPACE_INTERNAL_DIRS` /
+ `WORKSPACE_INTERNAL_FILES` and the `memory-`/`memory_tree-`/`session_raw-`
+ prefixes) are unwritable by agent tools even under a `trusted_root` grant.
+- **Unknown commands classify as writes.** `SecurityPolicy::classify_command`
+ (`policy/command_checks.rs:126`) is fail-closed: a command that is not
+ provably read-only is at least `CommandClass::Write`, the highest class
+ across `;`/`|`/`&&`/`||` segments wins, and a redirect (`>`, `>>`) or `tee`
+ lifts the class to at least `Write` no matter how benign the base command
+ looks.
+- **System and credential paths are always forbidden.**
+ `SecurityPolicy::is_always_forbidden` (`policy/path_checks.rs:471`) matches
+ case-insensitively by path segment (`.ssh`, `.gnupg`, `.aws`, `.azure`,
+ `.kube`, `keychains`, Windows `Microsoft\{Protect,Credentials,Crypto,Vault}`)
+ and by absolute prefix (`/etc`, `/root`, `/boot`, `/proc`, `/sys`, `/system`,
+ `C:\Windows`, `C:\Program Files`, `C:\ProgramData`). This check is
+ unconditional and is **not** overridable by a `trusted_root` grant.
+- **The approval gate is on by default and interactive requests expire as
+ denied after ten minutes.** `security/approval/gate.rs`'s
+ `DEFAULT_APPROVAL_TTL` is 10 minutes and the gate fails closed on timeout;
+ `core/types.rs::approval_gate_boot_decision` always installs the gate for
+ `HostKind::TauriShell` regardless of any `OPENHUMAN_APPROVAL_GATE=0`
+ override.
## Called by
-- `crates/openhuman-core/src/cron/scheduler.rs` — wraps shell jobs in `SecurityPolicy::from_config`.
-- `crates/openhuman-core/src/tools/local_cli.rs`, `tools/ops.rs`, and most `tools/impl/{system,network,memory,agent}/*.rs` — every executable tool consults `SecurityPolicy`.
-- `crates/openhuman-core/src/tools/impl/network/{curl,http_request,composio}.rs` — risk-classify outbound calls.
-- `crates/openhuman-core/src/memory/tools/{store,forget}.rs` — sensitive-write tracking.
-- `crates/openhuman-core/src/agent/tools/delegate.rs` — sub-agent dispatch goes through autonomy gate.
-- `crates/openhuman-core/src/security/credentials/` — uses `SecretStore` and `redact`.
+- `crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs` — bridges
+ `SecurityPolicy` into the tinyagents tool-call gate.
+- `crates/openhuman-core/src/agent/profiles/guard.rs`,
+ `agent/turn_workspace.rs` — profile and per-turn workspace grants.
+- `crates/openhuman-core/src/tools/ops.rs` and nearly every
+ `tools/impl/{filesystem,network,system,browser,document,presentation}/*.rs`
+ — every executable tool consults `SecurityPolicy` before acting.
+- `crates/openhuman-core/src/tools/impl/network/{curl,http_request,web_fetch}.rs`
+ — risk-classify outbound calls and call into `egress`.
+- `crates/openhuman-core/src/agent/tools/delegate.rs` — sub-agent dispatch
+ goes through the autonomy gate.
+- `crates/openhuman-core/src/cron/scheduler.rs` — wraps scheduled shell jobs in
+ `SecurityPolicy`.
+- `crates/openhuman-core/src/security/credentials/` — uses `SecretStore` and
+ `redact`.
## Tests
-- Unit: `pairing_tests.rs`, `policy_tests.rs`, `keyring/encrypted_store_tests.rs`.
-- `core.rs` `#[cfg(test)] mod tests` — round-trips `SecretStore` encrypt/decrypt, `redact()` cases, `PairingGuard` defaults.
-- Sandbox-backend smoke: each backend file has its own `#[cfg(test)]` blocks where the binary is available.
+- `policy/policy_tests*.rs`, `policy/proptest_tests.rs`,
+ `policy/enforcement_scratch_dir_tests_tests.rs` — see
+ [policy/README.md](policy/README.md).
+- Each other file has an adjacent `*_tests.rs` (`audit_tests.rs`,
+ `detect_tests.rs`, `live_policy_tests.rs`, `ops_tests.rs`, `pairing_tests.rs`,
+ `tools_tests.rs`, `traits_tests.rs`) and each sandbox backend has its own
+ `#[cfg(test)]` blocks where the binary is available
+ (`docker_tests.rs`, `bubblewrap_tests.rs`, `firejail_tests.rs`,
+ `landlock_tests.rs`).
+- `core_tests.rs` — round-trips `redact()` cases.
diff --git a/crates/openhuman-core/src/web3/README.md b/crates/openhuman-core/src/web3/README.md
index 778ec28336..b057b02421 100644
--- a/crates/openhuman-core/src/web3/README.md
+++ b/crates/openhuman-core/src/web3/README.md
@@ -14,13 +14,38 @@ the unsigned transaction to the wallet's crate-internal signing primitives —
`wallet::sign_and_broadcast_solana` (a hex `VersionedTransaction`) — so private
keys never leave the wallet.
-## Three sub-modules (three RPC namespaces + tool families)
+## Five family members
+
+The `web3` family has five members, three of them (`swap`, `bridge`, `dapp`)
+documented by this README and two with their own README each:
| Module | Namespace | Purpose |
| --- | --- | --- |
| `swap/` | `web3_swap` | Single-chain swaps via deBridge. Cross-chain requests are rejected with a pointer to `web3_bridge`. |
| `bridge/` | `web3_bridge` | Cross-chain bridges via deBridge DLN. Same-chain requests rejected. Signs+broadcasts on the **source** chain. |
| `dapp/` | `web3_dapp` | Generic EVM contract calls from caller-supplied calldata (no backend). |
+| [`wallet/`](wallet/README.md) | `wallet` | Basic multi-chain key/account management and primitive on-chain operations. |
+| [`x402/`](x402/README.md) | `x402` | HTTP-402 payment protocol: intercept, pay, retry, ledger. |
+
+`wallet` and `x402` are declared *ungated* in `mod.rs`, unlike `swap`/`bridge`/
+`dapp`/`ops`/etc., which are `#[cfg(feature = "web3")]`. As `mod.rs` puts it:
+
+> Ungated family members: `wallet` and `x402` are facades in their own
+> right — each keeps its own `stub.rs` and gates its real submodules on the
+> same default-ON `web3` feature. Always-compiled callers resolve through
+> those stubs (`tools/impl/network/http_request.rs` -> `x402`), so these
+> declarations must NOT carry a `#[cfg]`.
+
+## Compile-time gate (`web3` feature)
+
+`pub mod web3;` (declared in `crates/openhuman-core/src/lib.rs`) is ALWAYS
+compiled — it is a facade. The real swap/bridge/dapp implementation is gated
+behind the default-ON `web3` Cargo feature. When the feature is off,
+[`stub.rs`](mod.rs) takes its place and exposes
+`all_web3_registered_controllers` / `all_web3_controller_schemas` /
+`all_web3_agent_tools` returning empty collections, so `core/all.rs` and
+`tools/ops.rs` need no per-call `#[cfg]`. `cargo check --no-default-features`
+is the only thing that catches drift between the real and stub signatures.
## Key files
@@ -31,6 +56,9 @@ keys never leave the wallet.
| `client.rs` | `CryptoClient` — thin wrapper over the shared `IntegrationClient` for `/agent-integrations/crypto/*` (Bearer JWT auth, envelope unwrap). |
| `store.rs` | In-memory prepared-quote store (TTL'd, capped, chat-thread owner-bound like the wallet) + the shared confirm→execute path. |
| `ops.rs` | Shared op logic: `routes`, `quote_swap`, `quote_bridge`, `prepare_dapp_call` (address defaulting, backend call, unsigned-tx extraction). |
+| `stub.rs` | Disabled facade compiled when `web3` is off; empty `all_web3_registered_controllers` / `all_web3_controller_schemas` / `all_web3_agent_tools`. See Compile-time gate above. |
+| `web3_tests.rs` | `#[cfg(all(test, feature = "web3"))]` behavior tests for the swap/bridge/dapp aggregation logic in `mod.rs`. |
+| `ops_tests.rs` | Tests for the shared op logic in `ops.rs`. |
| `{swap,bridge,dapp}/schemas.rs` | Per-namespace RPC controllers + handlers. |
| `{swap,bridge,dapp}/tools.rs` | Per-namespace agent tools. |
diff --git a/crates/openhuman-core/src/web_chat/event_bus.rs b/crates/openhuman-core/src/web_chat/event_bus.rs
index b7036e7485..9721f3c67f 100644
--- a/crates/openhuman-core/src/web_chat/event_bus.rs
+++ b/crates/openhuman-core/src/web_chat/event_bus.rs
@@ -1,3 +1,7 @@
+//! In-process `WebChannelEvent` broadcast bus, plus the `DomainEvent`
+//! surface subscribers (approval/plan-review, artifact, egress) that bridge
+//! domain events onto it for Socket.IO and the JSON-RPC `/events` stream.
+
use async_trait::async_trait;
use once_cell::sync::Lazy;
use std::sync::{Arc, OnceLock};