Skip to content

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

docs(config): add README files for core modules

Steven Enamakel3e74c66859ec
diff --git a/crates/openhuman-core/src/config/README.md b/crates/openhuman-core/src/config/README.md
index 20b4f626a6..f479c9a184 100644
--- a/crates/openhuman-core/src/config/README.md
+++ b/crates/openhuman-core/src/config/README.md
@@ -1,34 +1,48 @@
# Config
-Authoritative TOML-backed configuration layer. Owns the `Config` schema (every domain section: agent, channels, memory, autonomy, voice, scheduler, observability, etc.), env-variable overrides, the per-user openhuman directory layout, runtime proxy settings, the daemon descriptor, and the settings CLI. Roughly 177 internal consumers — almost every other domain reads `Config` here.
+Authoritative TOML-backed configuration layer. Owns the `Config` schema (every domain section: agent, channels, memory, autonomy, voice, scheduler, observability, etc.), env-variable overrides, the per-user openhuman directory layout, runtime proxy settings, the daemon descriptor, and the settings CLI. ~870 files across the workspace reference `crate::config` — almost every other domain reads `Config` here.
+
+## Layout
+
+| Path | Purpose |
+| --- | --- |
+| `schema/` | The `Config` struct, every section type, loading/saving, env overrides, migrations trigger point — see [schema/README.md](schema/README.md) |
+| `ops/` | RPC/CLI mutation surface (`config::rpc`) built on the schema — see [ops/README.md](ops/README.md) |
+| `schemas/` | Controller schemas + thin RPC handlers for the `config` namespace |
+| `migrations/` | Automatic, schema-version-gated startup data migrations — see [migrations/README.md](migrations/README.md) |
+| `migration_helpers/` | User-triggered `migrate.{openclaw,hermes}` RPCs importing memory from other assistants — see [migration_helpers/README.md](migration_helpers/README.md) |
+| `workspace/` | Workspace bootstrap + editable Persona Pack (`SOUL.md`/`IDENTITY.md`) file RPCs — see [workspace/README.md](workspace/README.md) |
+| `daemon.rs` | `DaemonConfig` — sidecar lifecycle / port descriptor |
+| `settings_cli.rs` | `openhuman settings ...` CLI section-slicing helper |
+| `tools.rs` | Read-only LLM-callable wrappers over config (snapshot, autonomy, search, runtime flags, data paths) |
+| `workspace_handle.rs` | Opaque, stable digest identity for a workspace directory, used on the wire (Event Log, notification broadcast) so paths never leak |
## Public surface
-- `pub struct Config` — `schema/types.rs` (re-exported `mod.rs:28`) — top-level user settings.
-- Per-domain config structs (re-exported `mod.rs:28-39`): `AgentConfig`, `AuditConfig`, `AutocompleteConfig`, `AutonomyConfig`, `BrowserComputerUseConfig`, `BrowserConfig`, `CapabilityProviderConfig`, `ChannelsConfig`, `ComposioConfig`, `ContextConfig`, `CostConfig`, `CronConfig`, `CurlConfig`, `DelegateAgentConfig`, `DictationConfig`, `DiscordConfig`, `DockerRuntimeConfig`, `EmbeddingRouteConfig`, `GitbooksConfig`, `HeartbeatConfig`, `HttpRequestConfig`, `IMessageConfig`, `IntegrationsConfig`, `LarkConfig`, `LearningConfig`, `LocalAiConfig`, `MatrixConfig`, `MemoryConfig`, `ModelRouteConfig`, `MultimodalConfig`, `ObservabilityConfig`, `ProxyConfig`, `ReliabilityConfig`, `ResourceLimitsConfig`, `RuntimeConfig`, `SandboxConfig`, `SchedulerConfig`, `SecretsConfig`, `SecurityConfig`, `SlackConfig`, `StorageConfig`, `TelegramConfig`, `UpdateConfig`, `VoiceServerConfig`, `WebSearchConfig`, `WebhookConfig`.
-- Enums: `CapabilityProviderTrustState`, `DictationActivationMode`, `IntegrationToggle`, `ProxyScope`, `ReflectionSource`, `SandboxBackend`, `StorageProviderConfig`, `StorageProviderSection`, `StreamMode`, `VoiceActivationMode`.
-- Model constants: `DEFAULT_MODEL`, `MODEL_AGENTIC_V1`, `MODEL_CODING_V1`, `MODEL_REASONING_V1`.
+- `pub struct Config` — `schema/types.rs` (re-exported from `mod.rs`) — top-level user settings.
+- Per-domain config structs and enums — re-exported from `mod.rs`; see [schema/README.md](schema/README.md) for the full section → struct table.
+- Model constants: `DEFAULT_MODEL`, `MODEL_AGENTIC_V1`, `MODEL_CODING_V1`, `MODEL_REASONING_V1`, and others in `schema/types_part_01.rs`.
- `pub struct DaemonConfig` — `daemon.rs` — sidecar lifecycle / port descriptor.
- `pub fn apply_runtime_proxy_to_builder` / `pub fn build_runtime_proxy_client` / `pub fn build_runtime_proxy_client_with_timeouts` / `pub fn runtime_proxy_config` / `pub fn set_runtime_proxy_config` — `schema/proxy.rs`.
-- Workspace identity helpers: `pub fn clear_active_user`, `default_root_openhuman_dir`, `pre_login_user_dir`, `read_active_user_id`, `user_openhuman_dir`, `write_active_user_id`, `PRE_LOGIN_USER_ID` — `schema/identity_cost.rs`.
-- `pub mod ops` (re-exported as `rpc`) — `ops.rs` — RPC handlers and settings mutation.
+- Workspace identity helpers: `pub fn clear_active_user`, `default_root_openhuman_dir`, `pre_login_user_dir`, `read_active_user_id`, `user_openhuman_dir`, `write_active_user_id`, `PRE_LOGIN_USER_ID` — `schema/load/dirs.rs`.
+- `pub mod ops` (re-exported as `rpc`) — `ops/` — RPC handlers and settings mutation; see [ops/README.md](ops/README.md).
- `pub mod settings_cli` — `settings_cli.rs` — `openhuman settings ...` CLI surface.
-- RPC `config.{get_config, update_model_settings, update_memory_settings, update_runtime_settings, update_browser_settings, resolve_api_url, get_runtime_flags, set_browser_allow_all, workspace_onboarding_flag_exists, workspace_onboarding_flag_set, update_analytics_settings, get_analytics_settings, update_meet_settings, get_meet_settings, agent_server_status, reset_local_data, get_onboarding_completed, get_dictation_settings, update_dictation_settings, get_voice_server_settings, update_voice_server_settings, set_onboarding_completed}` — `schemas.rs`.
+- RPC `config.{get_config, update_model_settings, update_memory_settings, update_runtime_settings, update_browser_settings, resolve_api_url, get_runtime_flags, set_browser_allow_all, workspace_onboarding_flag_exists, workspace_onboarding_flag_set, update_analytics_settings, get_analytics_settings, update_meet_settings, get_meet_settings, agent_server_status, reset_local_data, get_onboarding_completed, get_dictation_settings, update_dictation_settings, get_voice_server_settings, update_voice_server_settings, set_onboarding_completed}` — `schemas/`.
## Calls into
- Std + serde TOML for serialization.
-- `crates/openhuman-core/src/security/encryption/` indirectly when secrets sections need at-rest crypto (read direction only).
-- Filesystem under `~/.openhuman/<user-id>/` via `schema/identity_cost.rs`.
+- `crates/openhuman-core/src/security/keyring/` indirectly when secrets sections need at-rest crypto (`schema/load/secrets.rs`).
+- Filesystem under `~/.openhuman/<user-id>/` via `schema/load/dirs.rs`.
## Called by
-- ~177 sites across the workspace — every domain pulls `Config` for its slice.
-- Hot consumers: `crates/openhuman-core/src/agent/` (model + autonomy), `crates/openhuman-core/src/channels/` (provider tokens), `crates/openhuman-core/src/memory/` (storage paths), `crates/openhuman-core/src/cron/` (scheduler poll), `crates/openhuman-core/src/inference/local/` (Ollama / device routing), `crates/openhuman-core/src/security/` (sandbox backend), `crates/openhuman-core/src/voice/`, `crates/openhuman-core/src/desktop/notifications/`, `crates/openhuman-core/src/tools/`, `crates/openhuman-core/src/security/encryption/`, `crates/openhuman-core/src/tree_summarizer/`, `crates/openhuman-core/src/hosted/referral/`.
+- ~870 files across the workspace pull `Config` for their slice.
+- Hot consumers: `crates/openhuman-core/src/agent/` (model + autonomy), `crates/openhuman-core/src/channels/` (provider tokens), `crates/openhuman-core/src/memory/` (storage paths), `crates/openhuman-core/src/cron/` (scheduler poll), `crates/openhuman-core/src/inference/local/` (Ollama / device routing), `crates/openhuman-core/src/security/` (sandbox backend, autonomy policy), `crates/openhuman-core/src/voice/`, `crates/openhuman-core/src/desktop/notifications/`, `crates/openhuman-core/src/tools/`.
- `crates/openhuman-core/src/core/all.rs` — registers `all_config_*`.
## Tests
-- Unit: `ops_tests.rs`, `schemas_tests.rs`, plus per-section `*_tests.rs` under `schema/` (`channels_tests.rs`, `load_tests.rs`, `proxy_tests.rs`).
-- Cross-test serialization: `schema/load.rs` round-trips against `schema/defaults.rs`.
-- `TEST_ENV_LOCK` (`mod.rs:55`) is shared with sibling test modules that mutate `OPENHUMAN_WORKSPACE`.
+- Unit: `ops_tests.rs` (+ `ops_tests_part_0N_tests.rs`), `schemas_tests.rs`, plus per-section `*_tests.rs` under `schema/` (`channels_tests.rs`, `proxy_tests.rs`, etc.) and `load_tests.rs` (+ `load_tests_part_0N_tests.rs`).
+- Cross-test serialization: `schema/load/impl_load.rs` round-trips against `schema/defaults.rs`.
+- `TEST_ENV_LOCK` (`mod.rs`) is shared with sibling test modules that mutate `OPENHUMAN_WORKSPACE`.
diff --git a/crates/openhuman-core/src/desktop/accessibility/README.md b/crates/openhuman-core/src/desktop/accessibility/README.md
index 45ad4363e5..267c1fe447 100644
--- a/crates/openhuman-core/src/desktop/accessibility/README.md
+++ b/crates/openhuman-core/src/desktop/accessibility/README.md
@@ -1,15 +1,15 @@
# Accessibility
-Cross-platform accessibility middleware. Owns macOS AX / CGEvent / IOKit FFI, the unified Swift helper-process bridge, focused-text inspection, system-permission detection (Accessibility, Input Monitoring, Microphone), the Globe-key listener, the floating overlay window, paste / backspace key synthesis, terminal heuristics, and AX-string normalization. Centralises platform-specific code so that `voice` never touches FFI directly.
+Cross-platform accessibility middleware. Owns macOS AX / CGEvent / IOKit FFI, the unified Swift helper-process bridge, focused-text inspection, system-permission detection (Accessibility, Input Monitoring, Microphone), the Globe-key listener, "System Events" automation-denial tracking, terminal heuristics, and AX-string normalization. Centralises platform-specific code so that `voice` never touches FFI directly.
## Public surface
+Re-exported from `mod.rs`:
+
+- `pub fn clear_automation_denial` / `mark_system_events_denied` / `system_events_denied` — `automation_state.rs` — tracks whether macOS has denied AppleScript "System Events" automation, so callers can stop retrying until the user re-grants it.
- `pub fn focused_text_context` / `focused_text_context_verbose` / `validate_focused_target` — `focus.rs` — query the OS for the currently focused text field.
- `pub fn globe_listener_start` / `globe_listener_stop` / `globe_listener_poll` / `pub struct GlobeHotkeyPollResult` / `pub enum GlobeHotkeyStatus` — `globe.rs` — macOS Globe-key (Fn) hotkey monitor.
-- `pub fn precompile_helper_background` — `helper.rs` — warm the Swift helper process at startup.
-- `pub fn any_modifier_down` / `is_escape_key_down` / `is_tab_key_down` — `keys.rs` — modifier polling for cancellation gestures.
-- `pub fn show_overlay` / `hide_overlay` / `quit_overlay` — `overlay.rs` — floating completion overlay control.
-- `pub fn apply_text_to_focused_field` / `pub fn send_backspace` — `paste.rs` — programmatic text insertion.
+- `pub fn precompile_helper_background` — split across `helper_part_01.rs` and `helper_part_02.rs` (re-exported via `helper.rs`) — warm the Swift helper process at startup.
- Permission detection: `detect_permissions`, `detect_microphone_permission`, `microphone_denied_message`, `permission_to_str`, `request_microphone_access` (cross-platform); macOS-only `detect_accessibility_permission`, `detect_input_monitoring_permission`, `open_macos_privacy_pane`, `request_accessibility_access` — `permissions.rs`.
- `pub fn extract_terminal_input_context` / `is_terminal_app` / `is_text_role` / `looks_like_terminal_buffer` — `terminal.rs` — terminal-window heuristics.
- `pub fn normalize_ax_value` / `parse_ax_number` / `truncate_tail` — `text_util.rs` — AX value normalization.
diff --git a/crates/openhuman-core/src/hosted/announcements/README.md b/crates/openhuman-core/src/hosted/announcements/README.md
new file mode 100644
index 0000000000..c539bf1929
--- /dev/null
+++ b/crates/openhuman-core/src/hosted/announcements/README.md
@@ -0,0 +1,61 @@
+# announcements
+
+Thin RPC adapter for the product-announcements feed. Like its `hosted`
+siblings (`billing`, `referral`, `team`) it owns no business logic, state, or
+authorization — it forwards an authenticated request to the TinyHumans
+backend and passes the response through verbatim.
+
+## Responsibilities
+
+- Fetch the latest active announcement for the signed-in user via
+ `GET /announcements/latest`.
+- Resolve and require a live backend session token before calling out; fail
+ closed with a clear error when none is stored.
+- Fold the backend's 404 (`BackendApiError::AnnouncementNotFound`, no
+ qualifying announcement) into the same "no announcement" success outcome
+ instead of surfacing it as an error — this is a best-effort/cosmetic
+ feature and treating the 404 as a failure only flooded Sentry with no
+ actionable signal.
+
+## Key files
+
+| File | Role |
+| --- | --- |
+| `mod.rs` | Re-exports `ops::*` and the schema/controller pair. |
+| `ops.rs` | `require_token`, `get_latest_announcement`. Builds a `BackendOAuthClient` against the effective backend URL and issues the authed GET. |
+| `schemas.rs` | Controller schema + handler that loads `Config` and delegates to `ops`. |
+
+## RPC / controllers
+
+One controller in the `announcements` namespace, registered into the global
+registry via `crates/openhuman-core/src/core/all.rs`:
+
+| Method | Inputs | Output | Backend call |
+| --- | --- | --- | --- |
+| `announcements_get_latest` (`announcements.get_latest`) | none | `announcement` (JSON, may be `null`) | `GET /announcements/latest` |
+
+## Persistence
+
+None. The domain reads the stored session token but does not persist
+anything; the UI is responsible for tracking dismissal locally by
+announcement id — this module has no notion of "dismissed".
+
+## Dependencies
+
+- `crate::security::credentials::session_support::require_live_session_token`
+ — rejects an expired token locally instead of firing a doomed backend 401
+ (same guard as `billing/ops.rs`).
+- `crate::api::config::effective_backend_api_url`, `crate::api::BackendOAuthClient`
+ — resolve the backend base URL and issue the authed JSON request, carrying
+ the sanitized `x-sdk-name` product identity (`crate::api::product`) on every
+ call.
+- `crate::api::flatten_authed_error` — flattens any non-404 backend/session
+ error for the RPC caller.
+- `crate::rpc::RpcOutcome` — return wrapper carrying value + log line.
+
+## Gating
+
+`announcements` is part of `DomainGroup::Hosted` (`crates/openhuman-core/src/core/all.rs`).
+A build that never dials the managed backend — including `DomainSet::embedded` —
+drops the whole `Hosted` group together, so this controller and its
+`hosted` siblings simply don't register.
diff --git a/crates/openhuman-core/src/security/keyring_consent/README.md b/crates/openhuman-core/src/security/keyring_consent/README.md
new file mode 100644
index 0000000000..87dead1f48
--- /dev/null
+++ b/crates/openhuman-core/src/security/keyring_consent/README.md
@@ -0,0 +1,93 @@
+# keyring_consent
+
+Gates the fallback from the OS keyring to local encrypted storage behind
+explicit user consent. All code that reads or writes secrets should call
+`policy::check_secret_access()` instead of `keyring::is_available()` directly,
+so the app never silently drops to local storage without the user agreeing.
+
+## Responsibilities
+
+- Decide, from backend identity and cached consent, whether secret access may
+ proceed (`PolicyDecision::Proceed` / `ConsentRequired` / `Declined`).
+- Report `KeyringStatus` (`available`, `failure_reason`, `active_mode`,
+ `backend_name`) for the settings UI.
+- Persist and cache the user's consent decision (`ConsentPreference`).
+- Publish `DomainEvent::KeyringConsentRequired` /
+ `KeyringDecryptFailed` when the frontend needs to prompt or warn the user.
+
+## Key files
+
+| File | Purpose |
+| --- | --- |
+| `types.rs` | `StorageMode`, `KeyringFailureReason`, `KeyringStatus`, `ConsentPreference`, `PolicyDecision` |
+| `policy.rs` | `check_secret_access`, `current_status`, `active_mode_for`, `record_consent`/`build_consent_preference`/`apply_consent`, `retry_probe`, `notify_master_key_unavailable`, `notify_decrypt_failure` |
+| `ops.rs` | RPC handler bodies: `keyring_status`, `keyring_consent_decide`, `keyring_retry_probe` |
+| `schemas.rs` | Controller registration for the `keyring_consent` RPC namespace |
+| `mod.rs` | Module doc + re-exports |
+
+## Public surface
+
+- `StorageMode` — where secrets actually live: `OsKeyring` (no consent
+ needed); the consent outcomes `LocalEncrypted` / `ConsentPending` /
+ `Declined` (only reachable when the `os` backend was intended and could not
+ be used); and the operator-configured backends `LocalEncryptedFile`
+ (`encrypted_file`) / `LocalPlaintextFile` (`file`/`mock`), for which no
+ consent was ever asked. The last two groups are kept distinct from
+ `LocalEncrypted` because they are not the same storage — see the type's
+ doc comment.
+- `KeyringStatus` — `available`, `failure_reason: Option<KeyringFailureReason>`,
+ `active_mode: StorageMode`, `backend_name: String`. `active_mode` is derived
+ from `backend_name` first and availability second (`policy::active_mode_for`)
+ — deriving it from `available` alone previously made every non-`os` backend
+ report `OsKeyring` (#6076).
+- `ConsentPreference { storage_mode, consented_at_ms }` — the persisted
+ decision.
+- `PolicyDecision::{Proceed, ConsentRequired, Declined}` — returned by
+ `check_secret_access()`.
+- `policy::check_secret_access() -> PolicyDecision` — the gate every secret
+ read/write path should call. Returns `Proceed` immediately if
+ `keyring::is_available()`; otherwise consults the cached consent
+ (`local_encrypted` → `Proceed`, `declined` → `Declined`, none → publishes
+ `KeyringConsentRequired` once and returns `ConsentRequired`).
+- `policy::current_status() -> KeyringStatus` — snapshot for RPC/UI.
+- `policy::record_consent(mode)` / `build_consent_preference` +
+ `apply_consent` — record a decision; the RPC handler persists to disk
+ *before* updating the in-memory cache so cache and disk never diverge on a
+ failed persist.
+- `policy::retry_probe()` — resets the keyring availability cache and
+ re-evaluates status; only the `os` backend can change here, since file
+ backends always probe available.
+
+## RPC / controllers
+
+Namespace `keyring_consent`, three functions (`schemas.rs`):
+
+- `keyring_consent.status` — current `KeyringStatus`.
+- `keyring_consent.decide` — record `mode` (`"local_encrypted"` or
+ `"declined"`); persists via `desktop::app_state::update_local_state` then
+ updates the cache.
+- `keyring_consent.retry_probe` — reset and re-run the OS keyring probe.
+
+## Persistence
+
+The consent decision is persisted through
+`desktop::app_state::StoredAppStatePatch { keyring_consent, .. }` /
+`update_local_state` (app-state snapshot), and mirrored into a process-wide
+in-memory cache (`policy::CONSENT_CACHE`) so `check_secret_access` never
+touches disk on the hot path. `policy::initialize` re-populates the cache from
+a loaded app-state snapshot; it is change-gated so repeated snapshots with an
+unchanged value are a silent no-op.
+
+## Relates to
+
+[`../keyring/README.md`](../keyring/README.md) owns backend selection
+(`os` / `encrypted_file` / `file` / `mock`) and the actual secret storage
+(`get`/`set`/`delete`, `SecretStore`, `encrypted_file_backend.rs`). This
+domain never stores a secret itself — it only gates and reports on *which*
+backend is active and whether the user consented to it. `active_mode_for`
+matches on `keyring::backend_name()`'s identifiers (`"os"`,
+`"encrypted_file"`, `"file"`, `"mock"`) to answer that question.
+
+## Tests
+
+- `types_tests.rs`, `policy_tests.rs`, `ops_tests.rs`, `schemas_tests.rs`.