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(agent): add README files for context, experience, channels, and config modules
Steven Enamakel4a5d5387e5c1
diff --git a/crates/openhuman-core/src/agent/context/README.md b/crates/openhuman-core/src/agent/context/README.mdindex 7143370549..7fb1655c1d 100644--- a/crates/openhuman-core/src/agent/context/README.md+++ b/crates/openhuman-core/src/agent/context/README.md@@ -39,11 +39,11 @@ Live history reduction/summarization moved out of this directory into the tinyagFrom `mod.rs` re-exports:-- **Manager**: `ContextManager`, `ContextStats`.-- **Microcompact config**: `CLEARED_PLACEHOLDER`, `DEFAULT_KEEP_RECENT_TOOL_RESULTS`.-- **Prompt**: `SystemPromptBuilder`, `PromptSection`, `PromptContext`, `PromptTool`, `ArchetypePromptSection`, `DateTimeSection`, `IdentitySection`, `LearnedContextData`, `RuntimeSection`, `SafetySection`, `ToolsSection`, and `WorkspaceSection` are imported directly from `agent::prompts`.-- **Session memory**: `SessionMemoryConfig`, `SessionMemoryState`, `ARCHIVIST_EXTRACTION_PROMPT`, `DEFAULT_MIN_TOKEN_GROWTH`, `DEFAULT_MIN_TOOL_CALLS`, `DEFAULT_MIN_TURNS_BETWEEN`.-- **Tool-result budget**: `DEFAULT_TOOL_RESULT_BUDGET_BYTES` config default only; live truncation is owned by `ToolOutputMiddleware` / `tool_result_artifacts`.+- Manager: `ContextManager`, `ContextStats`.+- Microcompact config: `CLEARED_PLACEHOLDER`, `DEFAULT_KEEP_RECENT_TOOL_RESULTS`.+- Prompt: `SystemPromptBuilder`, `PromptSection`, `PromptContext`, `PromptTool`, `ArchetypePromptSection`, `DateTimeSection`, `IdentitySection`, `LearnedContextData`, `RuntimeSection`, `SafetySection`, `ToolsSection`, and `WorkspaceSection` are imported directly from `agent::prompts`.+- Session memory: `SessionMemoryConfig`, `SessionMemoryState`, `ARCHIVIST_EXTRACTION_PROMPT`, `DEFAULT_MIN_TOKEN_GROWTH`, `DEFAULT_MIN_TOOL_CALLS`, `DEFAULT_MIN_TURNS_BETWEEN`.+- Tool-result budget: `DEFAULT_TOOL_RESULT_BUDGET_BYTES` config default only; live truncation is owned by `ToolOutputMiddleware` / `tool_result_artifacts`.`ContextStatsState` and `SessionMemoryHandle` are `pub(crate)` and not re-exported.@@ -77,18 +77,18 @@ The durable substrate session-memory targets is the workspace `MEMORY.md` file,## Used by-- **`agent::harness`**: the primary consumer: `session/builder/builder_build.rs` constructs the `ContextManager`; `session/turn/core_turn.rs` drives the session-memory counters and spawns the archivist extraction when `should_extract_session_memory` says so; `session/turn/core/harness_turn.rs` reads the budget/compaction getters into the tinyagents turn config; `session/turn/session_io/{transcript_persist,background_tasks}.rs` read `stats()`; `fork_context.rs` and `../subagent_host/` consume prompt types.-- **`agent::tinyagents`**: `harness_assembly.rs` reads `CLEARED_PLACEHOLDER` when configuring `MicrocompactMiddleware`; `payload_summarizer.rs` and `host/context_composer.rs` build `PromptContext`s through `agent::prompts`.+- `agent::harness`: the primary consumer: `session/builder/builder_build.rs` constructs the `ContextManager`; `session/turn/core_turn.rs` drives the session-memory counters and spawns the archivist extraction when `should_extract_session_memory` says so; `session/turn/core/harness_turn.rs` reads the budget/compaction getters into the tinyagents turn config; `session/turn/session_io/{transcript_persist,background_tasks}.rs` read `stats()`; `fork_context.rs` and `../subagent_host/` consume prompt types.+- `agent::tinyagents`: `harness_assembly.rs` reads `CLEARED_PLACEHOLDER` when configuring `MicrocompactMiddleware`; `payload_summarizer.rs` and `host/context_composer.rs` build `PromptContext`s through `agent::prompts`.- **`agent::registry::agents/*/prompt.rs`**, `flows/agents/*/prompt.rs`, `memory/agent/agent/prompt.rs`, `skills/*/agent/*/prompt.rs`: archetype prompt modules pull prompt sections/builder through `agent::prompts`.-- **`channels`**: `channels/system_prompt.rs` (`ChannelSystemPrompt`, used by `channels/runtime/startup/start_channels.rs`) calls `channels_prompt::build_system_prompt_with_identity`; `channels/mod.rs` re-exports `build_system_prompt`; the `channels/tests/*` prompt/identity tests call it directly.-- **`agent::triage`, `agent::debug`, `agent::orchestration::tools` (spawn_subagent and friends), `agent::learning::prompt_sections`, `memory::tool_memory::prompt`, `tools::orchestrator_tools`, `integrations::composio`**: consume prompt types (`PromptContext`, `PromptSection`, `ToolCallFormat`, `ConnectedIntegration`, …) via `agent::prompts`.-- **`config::schema`**: `context.rs` embeds `SessionMemoryConfig`.+- `channels`: `channels/system_prompt.rs` (`ChannelSystemPrompt`, used by `channels/runtime/startup/start_channels.rs`) calls `channels_prompt::build_system_prompt_with_identity`; `channels/mod.rs` re-exports `build_system_prompt`; the `channels/tests/*` prompt/identity tests call it directly.+- `agent::triage`, `agent::debug`, `agent::orchestration::tools` (spawn_subagent and friends), `agent::learning::prompt_sections`, `memory::tool_memory::prompt`, `tools::orchestrator_tools`, `integrations::composio`: consume prompt types (`PromptContext`, `PromptSection`, `ToolCallFormat`, `ConnectedIntegration`, …) via `agent::prompts`.+- `config::schema`: `context.rs` embeds `SessionMemoryConfig`.## Notes / gotchas- **The context stats state issues no LLM calls and does not mutate history.** Live reduction is owned by the tinyagents middleware stack.- **Tool-result budgeting is not a context pipeline stage.** The tinyagents path applies per-result budgets in `ToolOutputMiddleware` (`agent/tinyagents/middleware/tool_output.rs`), and artifact-preview fallback truncation lives in `agent/harness/tool_result_artifacts`.- **`autocompact_enabled()` is `config.enabled && config.autocompact_enabled`**, and `microcompact_keep_recent()` is `0` when `microcompact_enabled` is off: the manager folds the config gates so the turn reads one value per knob.-- **Session memory is separate from compaction**: it does not mutate in-flight history; it gates a *persistent* `MEMORY.md` extraction. All three thresholds (token growth, tool calls, turns) must be crossed and no extraction may be in flight. `mark_extraction_failed` keeps deltas so the next turn retries; `mark_extraction_complete` resets them. The handle is `Arc`-cloned so a detached background task can flip completion state after the synchronous borrow is released.+- Session memory is separate from compaction: it does not mutate in-flight history; it gates a *persistent* `MEMORY.md` extraction. All three thresholds (token growth, tool calls, turns) must be crossed and no extraction may be in flight. `mark_extraction_failed` keeps deltas so the next turn retries; `mark_extraction_complete` resets them. The handle is `Arc`-cloned so a detached background task can flip completion state after the synchronous borrow is released.- Prompt rendering does not belong in this module; add it to `agent::prompts`.- **`channels_prompt::build_system_prompt` deliberately bypasses `SystemPromptBuilder`** to keep production channel prompt bytes stable for prefix-cache hits; it is a standalone free function despite living under `context/`.diff --git a/crates/openhuman-core/src/agent/experience/README.md b/crates/openhuman-core/src/agent/experience/README.mdindex f9ba2ef861..fe972c4cf0 100644--- a/crates/openhuman-core/src/agent/experience/README.md+++ b/crates/openhuman-core/src/agent/experience/README.md@@ -42,9 +42,9 @@ Namespace `agent_experience` (registered into `crates/openhuman-core/src/core/al## Agent hooks (not a tool)-- **Multi-tool success**: ≥2 successful tool calls → `ExperienceOutcome::Success`, confidence 0.72.-- **Repeated failure**: a tool that failed ≥2 times in one turn → `Failure`, confidence 0.68, with an error class parsed from the output summary (`...(error_class)`).-- **Partial success**: a failure followed by a later success (≥2 calls total) → `Partial`, confidence 0.62; skipped when it would duplicate an earlier candidate's id or outcome.+- Multi-tool success: ≥2 successful tool calls → `ExperienceOutcome::Success`, confidence 0.72.+- Repeated failure: a tool that failed ≥2 times in one turn → `Failure`, confidence 0.68, with an error class parsed from the output summary (`...(error_class)`).+- Partial success: a failure followed by a later success (≥2 calls total) → `Partial`, confidence 0.62; skipped when it would duplicate an earlier candidate's id or outcome.## Events@@ -75,7 +75,7 @@ Records are stored through the `Memory` trait (no dedicated DB), served by `Driv## Notes / gotchas-- **Two redaction layers at write time**: `capture::build_experience` masks `Bearer …`, `sk-…`, and `token=/password:` pairs with `types::redact_text`; `store::put` then runs the full `memory::safety::sanitize_text` scrubber (private keys, vendor secrets, national-ID / phone / card PII) over the free-text fields. The base64 payload means the memory layer's own content scrub is a no-op, so the store-level scrub is what preserves the invariant.+- Two redaction layers at write time: `capture::build_experience` masks `Bearer …`, `sk-…`, and `token=/password:` pairs with `types::redact_text`; `store::put` then runs the full `memory::safety::sanitize_text` scrubber (private keys, vendor secrets, national-ID / phone / card PII) over the free-text fields. The base64 payload means the memory layer's own content scrub is a no-op, so the store-level scrub is what preserves the invariant.- Retrieval scoring is **lexical, not embedding-based**: term sets keep only tokens length > 2, normalized lowercase; score combines tool overlap (weighted highest), tag overlap, query-term overlap over summary+lesson+hints, plus small agent/entrypoint match boosts and a confidence prior. `max_hits == 0` short-circuits to empty. The live-turn path additionally drops hits with no `match_reasons`.- `render_experience_hits` is hard byte-capped (`max_bytes`) with UTF-8-boundary-safe truncation, so the injected prompt block can't blow the context budget.- The capture hook is gated by an `enabled` flag passed at construction; when disabled `on_turn_complete` is a no-op, and capture failures only `log::warn!` (never fail the turn).diff --git a/crates/openhuman-core/src/channels/providers/README.md b/crates/openhuman-core/src/channels/providers/README.mdindex 34235a4e6a..12188b6bde 100644--- a/crates/openhuman-core/src/channels/providers/README.md+++ b/crates/openhuman-core/src/channels/providers/README.md@@ -28,9 +28,9 @@ Implementations live in `vendor/tinychannels/src/providers/`, not here. Every fl`providers/telegram/mod.rs` re-exports the transport (`session_store`, `TelegramChannel`) from `tinychannels::providers::telegram`, but keeps three pieces here because they depend on the OpenHuman event bus and runtime rather than on transport:-- `remote_control` — `/status /sessions /new` command handling (`TelegramRemoteCommand`), using the `ChannelRuntimeContext` and `web_chat::invalidate_thread_sessions`.-- `bus::TelegramRemoteSubscriber` — busy-state handler for `DomainEvent::ChannelMessageReceived` / `ChannelMessageProcessed`, subscribed to the process bus in `channels/runtime/startup/start_channels.rs`.-- `approval_surface::TelegramApprovalSurfaceSubscriber` (+ `TELEGRAM_APPROVAL_CLIENT_ID`) — the approval surface for Telegram, subscribed in the same place. `runtime/dispatch/processor.rs::channel_has_approval_surface` returns `true` only for `TELEGRAM_APPROVAL_CLIENT_ID`, so Telegram is currently the only channel whose yes/no replies reach the `ApprovalGate`.+- `remote_control`: `/status /sessions /new` command handling (`TelegramRemoteCommand`), using the `ChannelRuntimeContext` and `web_chat::invalidate_thread_sessions`.+- `bus::TelegramRemoteSubscriber`: busy-state handler for `DomainEvent::ChannelMessageReceived` / `ChannelMessageProcessed`, subscribed to the process bus in `channels/runtime/startup/start_channels.rs`.+- `approval_surface::TelegramApprovalSurfaceSubscriber` (plus `TELEGRAM_APPROVAL_CLIENT_ID`): the approval surface for Telegram, subscribed in the same place. `runtime/dispatch/processor.rs::channel_has_approval_surface` returns `true` only for `TELEGRAM_APPROVAL_CLIENT_ID`, so Telegram is currently the only channel whose yes/no replies reach the `ApprovalGate`.Ported providers reach host capabilities (voice, approvals, conversation history, shutdown, event sink) through the `tinychannels::host::ProviderContext` built by `channels::host::build_provider_context` instead of calling OpenHuman internals directly; see `channels/host/mod.rs`.diff --git a/crates/openhuman-core/src/config/schema/README.md b/crates/openhuman-core/src/config/schema/README.mdindex 37beb39dbb..07dbda4d6b 100644--- a/crates/openhuman-core/src/config/schema/README.md+++ b/crates/openhuman-core/src/config/schema/README.md@@ -73,6 +73,32 @@ Most sections have a matching `*_tests.rs` (some further split into several`*_tests.rs` siblings, e.g. `types_model_pin_tests.rs`); this is the repo'sfile-size-splitting convention, not separate modules.+### Engine selection keys++This is where a config file names which engine handles a given concern. The+keys that select an implementation, rather than tune one:++- `search.engine` (`SearchConfig.engine`, `tools/search.rs`): one of the+ string constants re-exported from `mod.rs` (`SEARCH_ENGINE_MANAGED`,+ `SEARCH_ENGINE_PARALLEL`, `SEARCH_ENGINE_BRAVE`, `SEARCH_ENGINE_QUERIT`,+ `SEARCH_ENGINE_EXA`, `SEARCH_ENGINE_TAVILY`, `SEARCH_ENGINE_DISABLED`), plus+ SearXNG through the separate toggle described above.+- `[subsystems.memory]` (`subsystems.rs`): re-exports+ `MemorySubsystemConfig` / `MemoryDriverConfig` / `SubsystemsConfig` from+ `tinymemory_api::host::subsystems`, since the driver-binding shape now lives+ with `tinymemory-core`. `OPENHUMAN_MEMORY_DRIVER` overrides it at the+ environment layer.+- `agent.tool_search.ranker` (`ToolSearchConfig`, `agent.rs`): `"jev"` by+ default, with `"auto"`, `"bm25"`, and `"compare"` as the other values. It+ picks which ranker answers a tool search over tools exposed as+ `ToolExposure::Deferred`; `top_k` (default 3) caps how many matches come+ back.+- `[storage]` / `[memory]` (`storage_memory.rs`, `LlmBackend`): selects the+ embedding and storage backend for the built-in memory engine.++`autonomy.rs` is not an engine selector; it is the config-side half of the+sandbox policy contract described under Workspace/identity helpers below.+## Loading`Config::load_or_init` (in `load/impl_load.rs`) is the entry point used by