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
chore(scope): remove unused files from memory guard and platform about app
Steven Enamakele819d039cb57
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/scout_run.rs b/crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/scout_run.rsnew file mode 100644index 0000000000..4def664ccc--- /dev/null+++ b/crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/scout_run.rs@@ -0,0 +1,548 @@+//! The `context_scout` engine: running the sub-agent inline (blocking),+//! extracting its `[context_bundle]` envelope, classifying/logging failures,+//! and bootstrapping a thread goal from the scout's proposal.++use crate::agent::harness::definition::AgentDefinitionRegistry;+use crate::agent::harness::fork_context::{current_parent, AgentContextPreparedSource};+use crate::agent::harness::subagent_runner::{+ run_subagent, SubagentRunError, SubagentRunOptions, SubagentRunStatus,+};+use crate::agent::progress::AgentProgress;+use crate::agent::tinyagents::thread_context::current_thread_id;+use crate::core::bus::BUS;+use crate::core::events::DomainEvent;+use crate::tools::traits::ToolResult;+use tinyagents_harness::workspace::WorkspaceDescriptor;++use super::tool::AgentPrepareContextTool;++/// The sub-agent archetype this tool drives.+const SCOUT_AGENT_ID: &str = "context_scout";++/// Extract exactly one `[context_bundle] … [/context_bundle]` envelope from+/// `output`, tolerating surrounding prose, and return only the envelope+/// substring (tags included). Returns `None` when no usable envelope is+/// present.+///+/// The `context_scout` contract is "emit the single envelope and nothing+/// outside it", but the fast model may wrap the envelope in a preamble (`Sure,+/// here's what I found:\n[context_bundle]…`) or a closing line+/// (`…[/context_bundle]\nHope that helps!`). Requiring the *whole* trimmed+/// output to be the envelope would discard an otherwise-good bundle.+///+/// Pulling the envelope substring out of the surrounding text keeps the safety+/// property intact: callers receive only the bracketed envelope, never the+/// model's free-form prose. We still reject genuinely unusable output —+/// absent, unterminated/reversed, or duplicated (where we can't tell which+/// envelope is authoritative) — by returning `None`.+fn extract_context_bundle(output: &str) -> Option<String> {+ const OPEN: &str = "[context_bundle]";+ const CLOSE: &str = "[/context_bundle]";+ // Exactly one open + one close tag. Duplicates are a contract violation we+ // reject rather than guess which envelope is authoritative.+ if output.matches(OPEN).count() != 1 || output.matches(CLOSE).count() != 1 {+ return None;+ }+ let open_idx = output.find(OPEN)?;+ let close_idx = output.find(CLOSE)?;+ // Tags must appear in order (open before close) and not overlap.+ if close_idx < open_idx + OPEN.len() {+ return None;+ }+ let end = close_idx + CLOSE.len();+ Some(output[open_idx..end].trim().to_string())+}++pub(super) fn already_prepared_context_bundle(sources: &[AgentContextPreparedSource]) -> String {+ let source_names = if sources.is_empty() {+ "the OpenHuman harness".to_string()+ } else {+ sources+ .iter()+ .map(|source| source.source.as_str())+ .collect::<Vec<_>>()+ .join(", ")+ };+ let has_enough_context = if sources+ .iter()+ .any(|source| source.has_enough_context == Some(false))+ {+ false+ } else {+ sources+ .iter()+ .any(|source| source.has_enough_context == Some(true))+ };+ let sufficiency_note = if has_enough_context {+ "The earlier prepared context reported enough context."+ } else {+ "This no-op result does not assert that enough context is available; \+ inspect the earlier prepared-context blocks for sufficiency and recommended follow-up tools."+ };+ format!(+ "[context_bundle]\nhas_enough_context: {has_enough_context}\nproposed_goal: none\n\+ summary: Agent context has already been prepared once for this turn by {source_names}. \+ {sufficiency_note} Use the existing prepared-context blocks in the current user message; do not run \+ another context_scout pass.\nrecommended_tool_calls:\n[/context_bundle]"+ )+}++/// Run the `context_scout` sub-agent inline (blocking) for `question` and+/// return its bounded `[context_bundle]` envelope as a [`ToolResult`].+///+/// This is the engine behind [`AgentPrepareContextTool`], invoked autonomously+/// by the LLM when it decides to scout context mid-turn.+///+/// Must be called from within an active agent turn (i.e. with the+/// [`crate::agent::harness::fork_context::PARENT_CONTEXT`]+/// task-local installed) — it reads the parent's visible tool catalogue+/// and runs the scout against the parent's provider. Outside a turn the+/// `run_subagent` call surfaces a no-parent error as a [`ToolResult::error`].+pub async fn run_context_scout(question: &str, focus: Option<&str>) -> anyhow::Result<ToolResult> {+ let tool_catalog = AgentPrepareContextTool::render_parent_tool_catalog();+ run_context_scout_with_catalog(question, focus, &tool_catalog).await+}++/// Same as [`run_context_scout`] but with an **explicitly-supplied** tool+/// catalogue — for callers *outside* an agent turn that can't auto-derive the+/// parent's visible tool set from `current_parent()` (e.g. the subconscious+/// engine's structured tick).+///+/// The caller passes the catalogue of tools the eventual decision agent can+/// actually call (one `- name: description` per line), so the bundle's+/// `recommended_tool_calls` stay grounded in callable tools.+///+/// **A parent execution context is still required.** Like [`run_context_scout`]+/// this spawns `context_scout` via `run_subagent`, which resolves its provider /+/// tools / model from the `PARENT_CONTEXT` task-local and returns+/// `NoParentContext` when it is unset. A background surface with no enclosing+/// turn MUST establish a root parent first — call this *inside*+/// [`with_root_parent`](crate::agent::orchestration::parent_context::with_root_parent).+/// Skipping that is exactly the TAURI-RUST-HMW failure (#4337): every spawn+/// died with `NoParentContext` and the tick ran un-grounded. Only the+/// progress / subagent-lifecycle telemetry degrades gracefully without a+/// parent — `parent_session` falls back to `standalone` and the absent progress+/// sink no-ops — but the spawn itself does not.+pub async fn run_context_scout_with_catalog(+ question: &str,+ focus: Option<&str>,+ tool_catalog: &str,+) -> anyhow::Result<ToolResult> {+ run_context_scout_with_catalog_and_workspace(question, focus, tool_catalog, None).await+}++/// The text [`log_scout_failure`] classifies: a failed run flattened into one+/// string, `source` chain included.+///+/// The billing classifiers key on the **provider wire body**+/// (`… "errorCode":"USER_INSUFFICIENT_CREDITS"`), which arrives inside+/// [`SubagentRunError::Provider`]'s `anyhow` error — often as a *cause* under a+/// context layer, so `to_string()` alone renders only `"provider call failed:+/// <top-level context>"` and would miss the very failure this exists to demote.+/// Walk `anyhow`'s chain for that variant; every other variant is a flat+/// `thiserror` message already. Used for classification only — the+/// user-visible `message` stays `err.to_string()`, unchanged.+fn scout_failure_signal(err: &SubagentRunError) -> String {+ let SubagentRunError::Provider(inner) = err else {+ return err.to_string();+ };+ let mut chain = inner.to_string();+ for cause in inner.chain().skip(1) {+ chain.push_str(": ");+ chain.push_str(&cause.to_string());+ }+ chain+}++/// Is a failed `context_scout` run just the user being out of credits?+///+/// Two billing shapes reach here, both **user-state, not defects**:+/// * the managed OpenHuman backend's budget-exhausted 400+/// (`{"error":"Insufficient budget","errorCode":"USER_INSUFFICIENT_CREDITS"}`),+/// matched by [`crate::inference::provider::is_budget_exhausted_message`];+/// * a BYO provider's insufficient-credits 402, matched by+/// [`crate::core::observability::is_insufficient_credits_message`].+///+/// Both delegate to the crate's single-source classifiers so the phrase sets+/// can't drift from the cron halt / `before_send` nets that share them.+fn is_expected_billing_failure(message: &str) -> bool {+ crate::inference::provider::is_budget_exhausted_message(message)+ || crate::core::observability::is_insufficient_credits_message(message)+}++/// Log a failed `context_scout` run at the severity its cause deserves.+///+/// The scout is a **background/best-effort** pass: every caller already+/// degrades to the un-augmented message on failure. When the cause is the user+/// being out of credits (`USER_INSUFFICIENT_CREDITS`) that is a preventable+/// billing state OpenHuman has no lever over, yet `tracing::error!` maps to+/// `EventFilter::Event` in `core::logging::sentry_tracing_layer` — so every+/// tick of every out-of-credits user paged Sentry (TAURI-RUST-HMW: 8314 events+/// / 13 users, #5308). The existing `is_budget_event` `before_send` net cannot+/// catch it: that filter is tag-gated (`failure=non_2xx` + `status=400`) and+/// keys on the event *message*, but this event's message is the static+/// `"context_scout run failed"` with the wire body only in a breadcrumb.+///+/// So demote at the emit site: `warn!` maps to `EventFilter::Breadcrumb`, which+/// keeps the local log line (and the Sentry breadcrumb trail for any *real*+/// error that follows) without raising an issue. Every other cause still+/// `error!`s and keeps paging.+fn log_scout_failure(error_kind: &str, message: &str) {+ if is_expected_billing_failure(message) {+ // Metadata-only — never log the raw provider body (see CLAUDE.md).+ tracing::warn!(+ target: "agent_prepare_context",+ error_kind = %error_kind,+ "[agent_prepare_context] context_scout run skipped — account is out of credits (expected user-state, not reported)"+ );+ return;+ }+ tracing::error!(+ target: "agent_prepare_context",+ error_kind = %error_kind,+ "[agent_prepare_context] context_scout run failed"+ );+}++pub(super) async fn run_context_scout_with_catalog_and_workspace(+ question: &str,+ focus: Option<&str>,+ tool_catalog: &str,+ parent_workspace_descriptor: Option<WorkspaceDescriptor>,+) -> anyhow::Result<ToolResult> {+ let question = question.trim().to_string();+ let focus = focus.map(|s| s.to_string());++ tracing::info!(+ target: "agent_prepare_context",+ question_chars = question.chars().count(),+ has_focus = focus.as_deref().map(|f| !f.trim().is_empty()).unwrap_or(false),+ "[agent_prepare_context] invoked"+ );++ if question.is_empty() {+ return Ok(ToolResult::error(+ "agent_prepare_context: `question` is required",+ ));+ }++ let registry = match AgentDefinitionRegistry::global() {+ Some(reg) => reg,+ None => {+ return Ok(ToolResult::error(+ "agent_prepare_context: AgentDefinitionRegistry has not been initialised.",+ ));+ }+ };+ let definition = match registry.get(SCOUT_AGENT_ID) {+ Some(def) => def,+ None => {+ return Ok(ToolResult::error(format!(+ "agent_prepare_context: built-in agent `{SCOUT_AGENT_ID}` is not registered.",+ )));+ }+ };++ let catalog_tool_count = tool_catalog.lines().filter(|l| !l.is_empty()).count();+ let scout_prompt =+ AgentPrepareContextTool::build_scout_prompt(&question, focus.as_deref(), tool_catalog);++ tracing::debug!(+ target: "agent_prepare_context",+ catalog_tool_count,+ scout_prompt_chars = scout_prompt.chars().count(),+ "[agent_prepare_context] spawning context_scout (blocking)"+ );++ let task_id = format!("ctx-{}", uuid::Uuid::new_v4());+ let parent_session = current_parent()+ .map(|p| p.session_id.clone())+ .unwrap_or_else(|| "standalone".into());+ let progress_sink = current_parent().and_then(|p| p.on_progress.clone());++ // Surface the scout as a live subagent row in the parent thread. The+ // child's own iterations/tool-calls already stream to this sink from+ // inside run_subagent; we bookend them with spawned/completed so the+ // UI opens and closes the card. Best-effort — a closed sink is fine.+ crate::agent::orchestration::subagent_events::publish_subagent_spawned(+ parent_session.clone(),+ definition.id.clone(),+ "typed".to_string(),+ task_id.clone(),+ scout_prompt.chars().count(),+ );+ if let Some(ref tx) = progress_sink {+ let _ = tx+ .send(AgentProgress::SubagentSpawned {+ agent_id: definition.id.clone(),+ task_id: task_id.clone(),+ mode: "typed".to_string(),+ dedicated_thread: false,+ prompt_chars: scout_prompt.chars().count(),+ prompt: scout_prompt.clone(),+ worker_thread_id: None,+ display_name: Some(definition.display_name().to_string()),+ })+ .await;+ }++ let worktree_action_dir = parent_workspace_descriptor+ .as_ref()+ .map(|descriptor| descriptor.root.clone());+ if let Some(descriptor) = parent_workspace_descriptor.as_ref() {+ tracing::debug!(+ target: "agent_prepare_context",+ task_id = %task_id,+ workspace_root = %descriptor.root.display(),+ policy_id = %descriptor.policy_id,+ "[agent_prepare_context] using ToolExecutionContext workspace root"+ );+ }+ let options = SubagentRunOptions {+ task_id: Some(task_id.clone()),+ worktree_action_dir,+ workspace_descriptor: parent_workspace_descriptor,+ ..Default::default()+ };++ match run_subagent(definition, &scout_prompt, options).await {+ Ok(outcome) => match &outcome.status {+ SubagentRunStatus::Completed => {+ // Guard the contract: the scout MUST return exactly one+ // `[context_bundle] … [/context_bundle]` envelope. We tolerate+ // surrounding prose by extracting just the envelope (the harness+ // prepends any non-error result to turn 1 as "Prepared context",+ // so we still inject only the bracketed envelope, never the+ // model's free-form text). Genuinely unusable output — absent,+ // unterminated, or duplicated — is rejected so the caller falls+ // back to the un-augmented message.+ let Some(bundle) = extract_context_bundle(&outcome.output) else {+ tracing::warn!(+ target: "agent_prepare_context",+ task_id = %outcome.task_id,+ output_chars = outcome.output.chars().count(),+ "[agent_prepare_context] scout returned a malformed/absent context_bundle — rejecting"+ );+ crate::agent::orchestration::subagent_events::publish_subagent_completed(+ parent_session.clone(),+ outcome.task_id.clone(),+ outcome.agent_id.clone(),+ outcome.elapsed.as_millis() as u64,+ 0,+ outcome.iterations,+ );+ if let Some(ref tx) = progress_sink {+ let _ = tx+ .send(AgentProgress::SubagentCompleted {+ agent_id: outcome.agent_id.clone(),+ task_id: outcome.task_id.clone(),+ elapsed_ms: outcome.elapsed.as_millis() as u64,+ iterations: outcome.iterations as u32,+ output_chars: 0,+ output: String::new(),+ worktree_path: None,+ changed_files: Vec::new(),+ dirty_status: None,+ })+ .await;+ }+ return Ok(ToolResult::error(+ "agent_prepare_context: context_scout did not return a well-formed \+ [context_bundle] envelope",+ ));+ };+ // From here on use the extracted `bundle`, not the raw+ // `outcome.output`, so any prose the scout wrapped around the+ // envelope never reaches the parent's context.+ tracing::info!(+ target: "agent_prepare_context",+ task_id = %outcome.task_id,+ elapsed_ms = outcome.elapsed.as_millis() as u64,+ iterations = outcome.iterations,+ output_chars = bundle.chars().count(),+ raw_output_chars = outcome.output.chars().count(),+ "[agent_prepare_context] context bundle ready"+ );+ crate::agent::orchestration::subagent_events::publish_subagent_completed(+ parent_session.clone(),+ outcome.task_id.clone(),+ outcome.agent_id.clone(),+ outcome.elapsed.as_millis() as u64,+ bundle.chars().count(),+ outcome.iterations,+ );+ if let Some(ref tx) = progress_sink {+ let _ = tx+ .send(AgentProgress::SubagentCompleted {+ agent_id: outcome.agent_id.clone(),+ task_id: outcome.task_id.clone(),+ elapsed_ms: outcome.elapsed.as_millis() as u64,+ iterations: outcome.iterations as u32,+ output_chars: bundle.chars().count(),+ output: bundle.clone(),+ worktree_path: None,+ changed_files: Vec::new(),+ dirty_status: None,+ })+ .await;+ }++ // Bootstrap this thread's goal from the scout's proposal — but+ // ONLY when the thread has none yet. The orchestrator stays+ // authoritative (it sets/replaces via `goal_set`); the+ // context-gathering path just seeds a goal on the first scout of+ // a fresh chat so the harness has something to steer toward.+ // Best-effort — never fails the call.+ if let (Some(parent), Some(thread_id)) = (current_parent(), current_thread_id()) {+ if let Some(objective) = AgentPrepareContextTool::parse_proposed_goal(&bundle) {+ match crate::threads::goals::store::set_if_absent(+ &parent.workspace_dir,+ &thread_id,+ &objective,+ None,+ )+ .await+ {+ Ok(Some(goal)) => {+ tracing::info!(+ target: "agent_prepare_context",+ thread_id = %thread_id,+ goal_id = %goal.goal_id,+ "[agent_prepare_context] bootstrapped thread goal from scout proposal"+ );+ BUS.publish(DomainEvent::ThreadGoalUpdated {+ thread_id: goal.thread_id.clone(),+ goal_id: goal.goal_id.clone(),+ status: goal.status.as_str().to_string(),+ });+ }+ Ok(None) => {+ tracing::debug!(+ target: "agent_prepare_context",+ thread_id = %thread_id,+ "[agent_prepare_context] thread already has a goal — scout proposal not applied"+ );+ }+ Err(e) => {+ tracing::debug!(+ target: "agent_prepare_context",+ error = %e,+ "[agent_prepare_context] failed to persist scout-proposed goal"+ );+ }+ }+ }+ }++ Ok(ToolResult::success(bundle))+ }+ // The scout has no `ask_user_clarification` tool, so this+ // branch should not fire — handle defensively rather than+ // leaking a confusing checkpoint envelope to the parent.+ SubagentRunStatus::AwaitingUser { question, .. } => {+ tracing::warn!(+ target: "agent_prepare_context",+ task_id = %outcome.task_id,+ "[agent_prepare_context] scout unexpectedly awaited user input"+ );+ // Close the domain-event lifecycle too — a SubagentSpawned+ // was already published, so emit Completed to avoid a+ // dangling spawned state for event-bus consumers.+ crate::agent::orchestration::subagent_events::publish_subagent_completed(+ parent_session.clone(),+ outcome.task_id.clone(),+ outcome.agent_id.clone(),+ outcome.elapsed.as_millis() as u64,+ 0,+ outcome.iterations,+ );+ if let Some(ref tx) = progress_sink {+ let _ = tx+ .send(AgentProgress::SubagentCompleted {+ agent_id: outcome.agent_id.clone(),+ task_id: outcome.task_id.clone(),+ elapsed_ms: outcome.elapsed.as_millis() as u64,+ iterations: outcome.iterations as u32,+ output_chars: 0,+ output: String::new(),+ worktree_path: None,+ changed_files: Vec::new(),+ dirty_status: None,+ })+ .await;+ }+ Ok(ToolResult::success(format!(+ "[context_bundle]\nhas_enough_context: false\n\+ summary: The context scout could not complete without clarification: {question}\n\+ recommended_tool_calls:\n[/context_bundle]"+ )))+ }+ SubagentRunStatus::Incomplete { reason } => {+ // The scout stopped short (stuck halt / iteration cap) without a+ // well-formed bundle. Don't inject partial context — return a+ // has_enough_context:false bundle and close the lifecycle.+ tracing::warn!(+ target: "agent_prepare_context",+ task_id = %outcome.task_id,+ reason = %reason,+ "[agent_prepare_context] scout stopped incomplete — returning empty bundle"+ );+ crate::agent::orchestration::subagent_events::publish_subagent_completed(+ parent_session.clone(),+ outcome.task_id.clone(),+ outcome.agent_id.clone(),+ outcome.elapsed.as_millis() as u64,+ 0,+ outcome.iterations,+ );+ if let Some(ref tx) = progress_sink {+ let _ = tx+ .send(AgentProgress::SubagentCompleted {+ agent_id: outcome.agent_id.clone(),+ task_id: outcome.task_id.clone(),+ elapsed_ms: outcome.elapsed.as_millis() as u64,+ iterations: outcome.iterations as u32,+ output_chars: 0,+ output: String::new(),+ worktree_path: None,+ changed_files: Vec::new(),+ dirty_status: None,+ })+ .await;+ }+ Ok(ToolResult::success(format!(+ "[context_bundle]\nhas_enough_context: false\n\+ summary: The context scout stopped before finishing ({reason}).\n\+ recommended_tool_calls:\n[/context_bundle]"+ )))+ }+ },+ Err(err) => {+ let message = err.to_string();+ let error_kind = message+ .split(':')+ .next()+ .map(str::trim)+ .unwrap_or("unknown");+ log_scout_failure(error_kind, &scout_failure_signal(&err));+ crate::agent::orchestration::subagent_events::publish_subagent_failed(+ parent_session.clone(),+ task_id.clone(),+ definition.id.clone(),+ message.clone(),+ );+ if let Some(ref tx) = progress_sink {+ let _ = tx+ .send(AgentProgress::SubagentFailed {+ agent_id: definition.id.clone(),+ task_id: task_id.clone(),+ error: message.clone(),+ })+ .await;+ }+ Ok(ToolResult::error(format!(+ "agent_prepare_context failed: {message}"+ )))+ }+ }+}diff --git a/crates/openhuman-core/src/memory/guard/families_part_01.rs b/crates/openhuman-core/src/memory/guard/families_part_01.rsdeleted file mode 100644index fd78d7d229..0000000000--- a/crates/openhuman-core/src/memory/guard/families_part_01.rs+++ /dev/null@@ -1,722 +0,0 @@-use std::borrow::Cow;-use std::sync::Arc;--use crate::memory::api::capabilities::Capability;-use crate::memory::api::chunks::Chunk;-use crate::memory::api::error::MemoryError;-use crate::memory::api::goals::GoalsDoc;-use crate::memory::api::provider::chunks::{- ChunkDetail, ChunkEmbedding, ChunkListRow, ChunkQuery, ChunkScore, MemoryChunks,- SourceIngestQuery, SourceIngestStatus, SourceTotal,-};-use crate::memory::api::provider::content::{- RootSummary, SummaryContext, SummaryInput, SummaryOutput,-};-use crate::memory::api::provider::diagnosis::{DegradedCapabilities, Diagnosis};-use crate::memory::api::provider::episodic::{- ConversationSegment, EpisodicTurn, MemoryEpisodic,-};-use crate::memory::api::provider::people::{- AddressBookSeedOutcome, MemoryPeople, PersonHandle, PersonInteraction, PersonRecord,- PersonScore, RankedPerson, ResolvedPerson,-};-use crate::memory::api::provider::profile::{- FacetType, MemoryProfile, ProfileFacet, UserState,-};-use crate::memory::api::provider::retrieval::{- CoverWindowQuery, EntityMatch, FastRetrieveQuery, MemoryRetrieval, RetrievalHit,- RetrievalResponse, SourceRetrievalQuery,-};-use crate::memory::api::provider::scoring::MemoryScoring;-use crate::memory::api::provider::sessions::{- CodingSessionIngestReport, CodingSessionIngestRequest, CodingSessionSource,-};-use crate::memory::api::provider::sync::{- RawArchiveCoverage, RawRebuildOutcome, SourceSyncState, SourceSyncStatus, SyncAuditEntry,- SyncRunOutcome,-};-use crate::memory::api::provider::types::{- BackfillTreesOutcome, BackfillTreesRequest, ChunkEntityOccurrence, DiffReport, EntityHit,- EntityOccurrence, ForgetOutcome, ForgetSelector, IngestItem, IngestOutcome,- MaintenanceReport, PurgeOutcome, SnapshotRef, SourceItem, SourceScope,-};-use crate::memory::api::provider::{- EpisodicEvent, MemoryCodingSessions, MemoryDiff, MemoryDocuments, MemoryEntities, MemoryGoals,- MemoryGraph, MemoryIngest, MemoryMaintenance, MemoryProvider, MemorySourceSink,- MemorySourceSync, MemoryToolMemory, MemoryTree,-};-use crate::memory::api::tool_memory::ToolMemoryRule;-use crate::memory::api::tree::{- IngestRequest, QueryResult, SummaryForest, TreeLeaf, TreeNode, TreeStatus,-};-use crate::memory::api::types::NamespaceMemoryHit;-use crate::memory::api::types::{- GraphRelationRecord, MemoryKvRecord, MemoryTaint, NamespaceDocumentInput,- NamespaceRetrievalContext, StoredMemoryDocument,-};-use async_trait::async_trait;--use super::audit::{trace_allowed, NO_NAMESPACE};-use super::policy::GuardPolicy;--/// Declares one decorator: the two shared fields, a constructor, and the-/// `family()` re-derivation.-macro_rules! decorator {- ($(#[$meta:meta])* $name:ident, $fam:ty, $accessor:ident, $cap:ident) => {- $(#[$meta])*- pub struct $name {- inner: Arc<dyn MemoryProvider>,- policy: Arc<GuardPolicy>,- }-- impl $name {- pub(super) fn new(inner: Arc<dyn MemoryProvider>, policy: Arc<GuardPolicy>) -> Self {- Self { inner, policy }- }-- /// The underlying family handle.- ///- /// The `Err` arm is **structurally unreachable**: `MemoryGuard::new`- /// only builds this decorator when the inner provider answered- /// `provides(Capability::$cap)`, and the contract documents the- /// capability set as fixed at bind time. It is written as a real- /// error rather than `.expect(...)` because a panic inside a memory- /// call is a strictly worse failure than an `Unsupported` a caller- /// can already handle.- fn family(&self) -> Result<&$fam, MemoryError> {- self.inner- .$accessor()- .ok_or_else(|| MemoryError::unsupported(Capability::$cap))- }- }- };-}--decorator!(- /// Guarded [`MemoryIngest`].- GuardedIngest,- dyn MemoryIngest,- as_ingest,- Ingest-);-decorator!(- /// Guarded [`MemoryDocuments`].- GuardedDocuments,- dyn MemoryDocuments,- as_documents,- Documents-);-decorator!(- /// Guarded [`MemoryTree`] — the one family that carries step 2.- GuardedTree,- dyn MemoryTree,- as_tree,- Tree-);-decorator!(- /// Guarded [`MemoryEntities`].- GuardedEntities,- dyn MemoryEntities,- as_entities,- Entities-);-decorator!(- /// Guarded [`MemoryGraph`].- GuardedGraph,- dyn MemoryGraph,- as_graph,- Graph-);-decorator!(- /// Guarded [`MemoryDiff`].- GuardedDiff,- dyn MemoryDiff,- as_diff,- Diff-);-decorator!(- /// Guarded [`MemoryGoals`].- GuardedGoals,- dyn MemoryGoals,- as_goals,- Goals-);-decorator!(- /// Guarded [`MemoryToolMemory`].- GuardedToolMemory,- dyn MemoryToolMemory,- as_tool_memory,- ToolMemory-);-decorator!(- /// Guarded [`MemorySourceSink`].- GuardedSources,- dyn MemorySourceSink,- as_sources,- Sources-);-decorator!(- /// Guarded [`MemoryMaintenance`].- GuardedMaintenance,- dyn MemoryMaintenance,- as_maintenance,- Maintenance-);-decorator!(- /// Guarded [`MemoryPeople`].- GuardedPeople,- dyn MemoryPeople,- as_people,- People-);-decorator!(- /// Guarded [`MemoryChunks`].- GuardedChunks,- dyn MemoryChunks,- as_chunks,- Chunks-);-decorator!(- /// Guarded [`MemoryRetrieval`].- GuardedRetrieval,- dyn MemoryRetrieval,- as_retrieval,- Retrieval-);-decorator!(- /// Guarded [`MemoryEpisodic`].- GuardedEpisodic,- dyn MemoryEpisodic,- as_episodic,- Episodic-);-decorator!(- /// Guarded [`MemorySourceSync`].- GuardedSourceSync,- dyn MemorySourceSync,- as_source_sync,- SourceSync-);-decorator!(- /// Guarded [`MemoryCodingSessions`].- GuardedCodingSessions,- dyn MemoryCodingSessions,- as_coding_sessions,- CodingSessions-);-decorator!(- /// Guarded [`MemoryProfile`].- GuardedProfile,- dyn MemoryProfile,- as_profile,- Profile-);-decorator!(- /// Guarded [`MemoryScoring`].- GuardedScoring,- dyn MemoryScoring,- as_scoring,- Scoring-);--// ── Ingest ───────────────────────────────────────────────────────────────────--impl GuardedIngest {- /// Steps 3 + 4 over one ingest item: stamp provenance, redact on egress.- fn admit(&self, mut item: IngestItem) -> IngestItem {- item.taint = self.policy.stamp_taint(item.taint);- item.content = self.policy.redact_outbound(&item.content).into_owned();- item- }-}--#[async_trait]-impl MemoryIngest for GuardedIngest {- async fn ingest_document(&self, item: IngestItem) -> Result<IngestOutcome, MemoryError> {- let namespace = item.namespace.clone().unwrap_or_else(|| "-".to_string());- self.policy.admit_write(- Capability::Ingest,- "ingest.ingest_document",- &namespace,- true,- )?;- let item = self.admit(item);- trace_allowed(- &self.policy,- "ingest.ingest_document",- &namespace,- item.content.chars().count(),- );- self.family()?.ingest_document(item).await- }-- async fn ingest_chat(&self, messages: Vec<IngestItem>) -> Result<IngestOutcome, MemoryError> {- self.policy- .admit_write(Capability::Ingest, "ingest.ingest_chat", NO_NAMESPACE, true)?;- let messages: Vec<IngestItem> = messages.into_iter().map(|m| self.admit(m)).collect();- trace_allowed(- &self.policy,- "ingest.ingest_chat",- NO_NAMESPACE,- messages.iter().map(|m| m.content.chars().count()).sum(),- );- self.family()?.ingest_chat(messages).await- }-- async fn ingest_email(&self, messages: Vec<IngestItem>) -> Result<IngestOutcome, MemoryError> {- // Admitted exactly like chat: a thread is one conversation with no- // namespace of its own, and every message is taint-stamped and- // redacted before it reaches the driver.- self.policy.admit_write(- Capability::Ingest,- "ingest.ingest_email",- NO_NAMESPACE,- true,- )?;- let messages: Vec<IngestItem> = messages.into_iter().map(|m| self.admit(m)).collect();- trace_allowed(- &self.policy,- "ingest.ingest_email",- NO_NAMESPACE,- messages.iter().map(|m| m.content.chars().count()).sum(),- );- self.family()?.ingest_email(messages).await- }-}--// ── Documents ────────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryDocuments for GuardedDocuments {- async fn put_document(&self, mut input: NamespaceDocumentInput) -> Result<String, MemoryError> {- self.policy.admit_write(- Capability::Documents,- "documents.put_document",- &input.namespace,- true,- )?;- input.taint = self.policy.stamp_taint(input.taint);- input.title = self.policy.redact_outbound(&input.title).into_owned();- input.content = self.policy.redact_outbound(&input.content).into_owned();- input.metadata = self.policy.redact_outbound_json(input.metadata);- trace_allowed(- &self.policy,- "documents.put_document",- &input.namespace,- input.content.chars().count(),- );- self.family()?.put_document(input).await- }-- async fn get_document(- &self,- namespace: &str,- key: &str,- ) -> Result<Option<StoredMemoryDocument>, MemoryError> {- self.policy.admit_read(- Capability::Documents,- "documents.get_document",- namespace,- false,- )?;- self.family()?.get_document(namespace, key).await- }-- async fn list_documents(- &self,- namespace: Option<&str>,- ) -> Result<serde_json::Value, MemoryError> {- self.policy.admit_read(- Capability::Documents,- "documents.list_documents",- namespace.unwrap_or(NO_NAMESPACE),- false,- )?;- self.family()?.list_documents(namespace).await- }-- async fn list_namespaces(&self) -> Result<Vec<String>, MemoryError> {- self.policy.admit_read(- Capability::Documents,- "documents.list_namespaces",- NO_NAMESPACE,- false,- )?;- self.family()?.list_namespaces().await- }-- async fn delete_document(- &self,- namespace: &str,- document_id: &str,- ) -> Result<serde_json::Value, MemoryError> {- self.policy.admit_write(- Capability::Documents,- "documents.delete_document",- namespace,- false,- )?;- self.family()?.delete_document(namespace, document_id).await- }-- async fn clear_namespace(&self, namespace: &str) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::Documents,- "documents.clear_namespace",- namespace,- false,- )?;- self.family()?.clear_namespace(namespace).await- }-- async fn query_documents(- &self,- namespace: &str,- query: &str,- limit: usize,- ) -> Result<NamespaceRetrievalContext, MemoryError> {- // The query text itself crosses the boundary on an external driver.- self.policy.admit_read(- Capability::Documents,- "documents.query_documents",- namespace,- true,- )?;- let query = self.policy.redact_outbound(query).into_owned();- self.family()?- .query_documents(namespace, &query, limit)- .await- }-- async fn recall_documents(- &self,- namespace: &str,- limit: usize,- ) -> Result<NamespaceRetrievalContext, MemoryError> {- self.policy.admit_read(- Capability::Documents,- "documents.recall_documents",- namespace,- false,- )?;- self.family()?.recall_documents(namespace, limit).await- }-}--// ── Tree ─────────────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryTree for GuardedTree {- async fn append(&self, mut request: IngestRequest) -> Result<(), MemoryError> {- self.policy- .admit_write(Capability::Tree, "tree.append", &request.namespace, true)?;- request.content = self.policy.redact_outbound(&request.content).into_owned();- trace_allowed(- &self.policy,- "tree.append",- &request.namespace,- request.content.chars().count(),- );- self.family()?.append(request).await- }-- /// **Step 2 lives here.** This is the only contract method in the tree- /// today that both takes a [`SourceScope`] and applies it as a real query- /// predicate: the embedded driver pushes `scope.allow` into- /// `ListChunksQuery.source_scope`, which reaches SQL *before* `LIMIT`.- ///- /// The ambient allowlist- /// ([`source_scope::current_source_scope`](crate::memory::source_scope::current_source_scope))- /// is therefore read at this boundary and passed down, rather than being- /// applied to the returned rows. An explicit `scope` argument may only- /// *narrow* it: the two are intersected by- /// [`GuardPolicy::narrow_scope`](crate::memory::guard::GuardPolicy::narrow_scope),- /// so a caller that computed a tighter scope than the task-local still wins,- /// while one that names a collection outside the ambient allowlist cannot- /// widen the turn back out.- ///- /// There is **no double application**: the embedded `query_source` does not- /// itself read the task-local (only the deeper `tree::retrieval` and- /// `list_chunks` paths do, and the guard does not sit in front of those),- /// so this fills a predicate that would otherwise be `None`.- async fn query_source(- &self,- namespace: &str,- source_id: &str,- limit: usize,- scope: Option<&SourceScope>,- ) -> Result<Vec<Chunk>, MemoryError> {- self.policy- .admit_read(Capability::Tree, "tree.query_source", namespace, false)?;- let ambient = self.policy.ambient_scope();- let effective = self.policy.narrow_scope(scope);- log::debug!(- "[memory:guard] tree.query_source namespace={namespace} limit={limit} \- scoped={} scope_from={}",- effective.is_some(),- match (scope.is_some(), ambient.is_some()) {- (true, true) => "argument∩ambient",- (true, false) => "argument",- (false, true) => "ambient",- (false, false) => "none",- }- );- self.family()?- .query_source(namespace, source_id, limit, effective.as_ref())- .await- }-- async fn drill_down(&self, namespace: &str, node_id: &str) -> Result<QueryResult, MemoryError> {- self.policy- .admit_read(Capability::Tree, "tree.drill_down", namespace, false)?;- self.family()?.drill_down(namespace, node_id).await- }-- async fn seal(&self, namespace: &str) -> Result<TreeStatus, MemoryError> {- self.policy- .admit_write(Capability::Tree, "tree.seal", namespace, false)?;- self.family()?.seal(namespace).await- }-- async fn cascade(&self, namespace: &str) -> Result<TreeStatus, MemoryError> {- self.policy- .admit_write(Capability::Tree, "tree.cascade", namespace, false)?;- self.family()?.cascade(namespace).await- }-- /// Enumerates the sealed forest, so it narrows by the ambient scope for the- /// same reason [`Self::query_source`] does: a summary is derived from the- /// chunks beneath it, and handing back a node built from sources the caller- /// may not read discloses their contents in condensed form.- async fn summary_forest(- &self,- limit: usize,- scope: Option<&SourceScope>,- ) -> Result<SummaryForest, MemoryError> {- self.policy- .admit_read(Capability::Tree, "tree.summary_forest", NO_NAMESPACE, false)?;- let effective = self.policy.narrow_scope(scope);- self.family()?- .summary_forest(limit, effective.as_ref())- .await- }-- /// Sealing one source's tree is a write, and it names the scope it acts on- /// — so unlike the reads above it is admitted against that scope rather- /// than `NO_NAMESPACE`. `carries_content: false`: the caller supplies a- /// scope label, never prose, and the seals it fires write content the- /// driver already holds.- async fn flush_source_tree(&self, source_scope: &str) -> Result<u64, MemoryError> {- self.policy.admit_write(- Capability::Tree,- "tree.flush_source_tree",- source_scope,- false,- )?;- self.family()?.flush_source_tree(source_scope).await- }-- /// Leaves are chunks, so this is the same disclosure as- /// [`Self::query_source`] with a different ordering, and takes the same- /// intersection.- async fn recent_leaves(- &self,- limit: usize,- scope: Option<&SourceScope>,- ) -> Result<Vec<TreeLeaf>, MemoryError> {- self.policy- .admit_read(Capability::Tree, "tree.recent_leaves", NO_NAMESPACE, false)?;- let effective = self.policy.narrow_scope(scope);- self.family()?- .recent_leaves(limit, effective.as_ref())- .await- }-- /// A **read** tier check even though the fold costs a provider call: it- /// writes nothing. `seal` and `cascade` take the write tier because they- /// persist the nodes they produce; this hands the summary back and leaves- /// the tree exactly as it found it, so refusing it under `readonly` would- /// stop a recap that stores nothing.- ///- /// It is nevertheless the only member of this family besides- /// [`Self::append`] that carries prose *outbound* — every input's body- /// crosses to the driver's own chat provider — so it declares- /// `carries_content: true` and applies `append`'s scrub to each of them.- /// Admitted against [`SummaryContext::tree_id`] rather than- /// `NO_NAMESPACE` for the reason [`Self::flush_source_tree`] gives: it- /// names the tree it acts on.- async fn summarise(- &self,- inputs: &[SummaryInput],- context: &SummaryContext,- ) -> Result<SummaryOutput, MemoryError> {- self.policy- .admit_read(Capability::Tree, "tree.summarise", &context.tree_id, true)?;- // `redact_outbound` borrows for every driver class but `External`, so- // the re-owned slice is built only when the scrubber actually rewrote- // something — a recap folds every turn of a segment, and cloning them- // to hand back the same bytes is the one cost this can avoid.- let mut scrubbed: Option<Vec<SummaryInput>> = None;- for (index, input) in inputs.iter().enumerate() {- if let Cow::Owned(content) = self.policy.redact_outbound(&input.content) {- scrubbed.get_or_insert_with(|| inputs.to_vec())[index].content = content;- }- }- let effective = scrubbed.as_deref().unwrap_or(inputs);- trace_allowed(- &self.policy,- "tree.summarise",- &context.tree_id,- effective- .iter()- .map(|input| input.content.chars().count())- .sum(),- );- self.family()?.summarise(effective, context).await- }-- /// The markdown time tree's roots, one body per namespace.- ///- /// Takes no [`SourceScope`], so unlike [`Self::summary_forest`] there is- /// nothing here to intersect with the ambient allowlist — the contract- /// member has no scope parameter and the guard does not invent one. Both- /// caps are the caller's and cross unchanged: they bound the *response*,- /// and clipping them here would produce a body the driver did not choose- /// the truncation point of.- async fn root_summaries_with_caps(- &self,- per_namespace_cap: usize,- total_cap: usize,- ) -> Result<Vec<RootSummary>, MemoryError> {- self.policy.admit_read(- Capability::Tree,- "tree.root_summaries_with_caps",- NO_NAMESPACE,- false,- )?;- self.family()?- .root_summaries_with_caps(per_namespace_cap, total_cap)- .await- }-- // ── The runtime-tree and flavour doors ──────────────────────────────────- //- // **Forwarding these is not optional.** All seven are defaulted on- // [`MemoryTree`], so a decorator that omits one still compiles — and then- // answers `Err(Unsupported)` for a driver that serves the member perfectly- // well, because the guard *is* the handle every product caller holds and- // its own default is what runs. That exact bug shipped once, on- // `MemoryMaintenance::diagnose`. The rule this family follows: a new- // defaulted member on a wrapped trait is a new override here, in the same- // change.- //- // None of them takes a [`SourceScope`], so step 2 does not apply — the- // contract members carry no scope parameter and the guard does not invent- // one; see [`Self::root_summaries_with_caps`] for the same reasoning.-- /// Buffering raw content is [`Self::append`]'s write at a finer grain, so- /// it takes `append`'s admission exactly: the write tier, against the- /// namespace it names, `carries_content: true`, and the same outbound- /// scrub applied to the body before it crosses.- async fn runtime_buffer_write(- &self,- namespace: &str,- content: &str,- timestamp: chrono::DateTime<chrono::Utc>,- metadata: Option<serde_json::Value>,- ) -> Result<String, MemoryError> {- self.policy.admit_write(- Capability::Tree,- "tree.runtime_buffer_write",- namespace,- true,- )?;- let content = self.policy.redact_outbound(content);- trace_allowed(- &self.policy,- "tree.runtime_buffer_write",- namespace,- content.chars().count(),- );- self.family()?- .runtime_buffer_write(namespace, &content, timestamp, metadata)- .await- }-- /// A single node read, admitted like [`Self::drill_down`] — the same tree- /// at the same grain, minus the child list.- async fn runtime_read_node(- &self,- namespace: &str,- node_id: &str,- ) -> Result<Option<TreeNode>, MemoryError> {- self.policy- .admit_read(Capability::Tree, "tree.runtime_read_node", namespace, false)?;- self.family()?.runtime_read_node(namespace, node_id).await- }-- /// The other half of [`Self::drill_down`], admitted identically.- async fn runtime_read_children(- &self,- namespace: &str,- parent_id: &str,- ) -> Result<Vec<TreeNode>, MemoryError> {- self.policy.admit_read(- Capability::Tree,- "tree.runtime_read_children",- namespace,- false,- )?;- self.family()?- .runtime_read_children(namespace, parent_id)- .await- }-- /// Counts and timestamps for one namespace: a read, and one that carries- /// no prose either way.- async fn runtime_tree_status(&self, namespace: &str) -> Result<TreeStatus, MemoryError> {- self.policy.admit_read(- Capability::Tree,- "tree.runtime_tree_status",- namespace,- false,- )?;- self.family()?.runtime_tree_status(namespace).await- }-- /// The **write** tier, unlike [`Self::summarise`]: this drains the buffer- /// into hour leaves and persists them, which is what [`Self::seal`] does- /// and why `seal` takes the write tier too. `summarise` hands a fold back- /// and leaves the tree as it found it; this one does not.- ///- /// `carries_content: false`: the caller supplies a namespace and an- /// instant, never prose. The content the pass folds is already in the- /// driver's own buffer, put there by [`Self::runtime_buffer_write`], which- /// scrubbed it on the way in.- async fn runtime_summarize(- &self,- namespace: &str,- timestamp: chrono::DateTime<chrono::Utc>,- ) -> Result<Option<TreeNode>, MemoryError> {- self.policy- .admit_write(Capability::Tree, "tree.runtime_summarize", namespace, false)?;- self.family()?.runtime_summarize(namespace, timestamp).await- }-- /// As [`Self::runtime_summarize`], on [`Self::cascade`]'s terms.- async fn runtime_rebuild(&self, namespace: &str) -> Result<TreeStatus, MemoryError> {- self.policy- .admit_write(Capability::Tree, "tree.runtime_rebuild", namespace, false)?;- self.family()?.runtime_rebuild(namespace).await- }-- /// A compiled profile read. The scope is the caller's naming scheme rather- /// than a namespace, and it is what this call acts on, so it is what the- /// admission names — the reasoning [`Self::flush_source_tree`] gives for- /// admitting against its own label instead of `NO_NAMESPACE`.- async fn flavour_profile(&self, scope: &str) -> Result<Option<String>, MemoryError> {- self.policy- .admit_read(Capability::Tree, "tree.flavour_profile", scope, false)?;- self.family()?.flavour_profile(scope).await- }-}diff --git a/crates/openhuman-core/src/memory/guard/families_part_02.rs b/crates/openhuman-core/src/memory/guard/families_part_02.rsdeleted file mode 100644index 83d952e40f..0000000000--- a/crates/openhuman-core/src/memory/guard/families_part_02.rs+++ /dev/null@@ -1,587 +0,0 @@-// ── Entities ─────────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryEntities for GuardedEntities {- async fn entities(- &self,- namespace: &str,- query: Option<&str>,- limit: usize,- ) -> Result<Vec<EntityHit>, MemoryError> {- self.policy.admit_read(- Capability::Entities,- "entities.entities",- namespace,- query.is_some(),- )?;- let redacted = query.map(|q| self.policy.redact_outbound(q).into_owned());- self.family()?- .entities(namespace, redacted.as_deref(), limit)- .await- }-- async fn entity_edges(- &self,- namespace: &str,- entity_id: &str,- limit: usize,- ) -> Result<Vec<GraphRelationRecord>, MemoryError> {- self.policy.admit_read(- Capability::Entities,- "entities.entity_edges",- namespace,- false,- )?;- self.family()?- .entity_edges(namespace, entity_id, limit)- .await- }-- async fn touch_entities(- &self,- namespace: &str,- entity_ids: &[String],- ) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::Entities,- "entities.touch_entities",- namespace,- false,- )?;- self.family()?.touch_entities(namespace, entity_ids).await- }-- /// The occurrence index has no namespace and the contract gives this member- /// no scope argument, so there is nothing to intersect — the tier check is- /// the whole gate. Worth stating rather than leaving as an apparent- /// omission beside the scoped members above.- async fn top_entities(- &self,- kind: Option<&str>,- limit: usize,- ) -> Result<Vec<EntityOccurrence>, MemoryError> {- self.policy.admit_read(- Capability::Entities,- "entities.top_entities",- NO_NAMESPACE,- false,- )?;- self.family()?.top_entities(kind, limit).await- }-- /// Scoped by the chunk ids the caller already holds: it can only name- /// chunks a previous, scoped read handed it, so this adds no reach beyond- /// the read that produced them.- async fn chunk_entities(- &self,- chunk_ids: &[String],- kinds: Option<&[String]>,- ) -> Result<Vec<ChunkEntityOccurrence>, MemoryError> {- self.policy.admit_read(- Capability::Entities,- "entities.chunk_entities",- NO_NAMESPACE,- false,- )?;- self.family()?.chunk_entities(chunk_ids, kinds).await- }-- /// Returns ids only, never content. A caller still has to read those chunks- /// through [`MemoryChunks`] to see anything, and that path applies the- /// scope intersection.- async fn entity_chunk_ids(- &self,- entity_id: &str,- limit: usize,- ) -> Result<Vec<String>, MemoryError> {- self.policy.admit_read(- Capability::Entities,- "entities.entity_chunk_ids",- NO_NAMESPACE,- false,- )?;- self.family()?.entity_chunk_ids(entity_id, limit).await- }-}--// ── Graph ────────────────────────────────────────────────────────────────────--/// Namespace label for the graph family's `Option<&str>` namespace — `None`-/// addresses the global, namespace-less slice.-fn graph_ns(namespace: Option<&str>) -> &str {- namespace.unwrap_or(NO_NAMESPACE)-}--#[async_trait]-impl MemoryGraph for GuardedGraph {- async fn kv_get(- &self,- namespace: Option<&str>,- key: &str,- ) -> Result<Option<MemoryKvRecord>, MemoryError> {- self.policy.admit_read(- Capability::Graph,- "graph.kv_get",- graph_ns(namespace),- false,- )?;- self.family()?.kv_get(namespace, key).await- }-- async fn kv_put(- &self,- namespace: Option<&str>,- key: &str,- value: serde_json::Value,- ) -> Result<(), MemoryError> {- self.policy- .admit_write(Capability::Graph, "graph.kv_put", graph_ns(namespace), true)?;- let value = self.policy.redact_outbound_json(value);- self.family()?.kv_put(namespace, key, value).await- }-- async fn kv_delete(&self, namespace: Option<&str>, key: &str) -> Result<bool, MemoryError> {- self.policy.admit_write(- Capability::Graph,- "graph.kv_delete",- graph_ns(namespace),- false,- )?;- self.family()?.kv_delete(namespace, key).await- }-- async fn kv_list(- &self,- namespace: Option<&str>,- prefix: Option<&str>,- limit: usize,- ) -> Result<Vec<MemoryKvRecord>, MemoryError> {- self.policy.admit_read(- Capability::Graph,- "graph.kv_list",- graph_ns(namespace),- false,- )?;- self.family()?.kv_list(namespace, prefix, limit).await- }-- async fn relations(- &self,- namespace: Option<&str>,- subject: Option<&str>,- predicate: Option<&str>,- limit: usize,- ) -> Result<Vec<GraphRelationRecord>, MemoryError> {- self.policy.admit_read(- Capability::Graph,- "graph.relations",- graph_ns(namespace),- false,- )?;- self.family()?- .relations(namespace, subject, predicate, limit)- .await- }-- async fn put_relation(&self, relation: GraphRelationRecord) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::Graph,- "graph.put_relation",- graph_ns(relation.namespace.as_deref()),- true,- )?;- self.family()?.put_relation(relation).await- }-}--// ── Diff ─────────────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryDiff for GuardedDiff {- async fn capture_snapshot(&self, source_id: &str) -> Result<SnapshotRef, MemoryError> {- self.policy.admit_write(- Capability::Diff,- "diff.capture_snapshot",- NO_NAMESPACE,- false,- )?;- self.family()?.capture_snapshot(source_id).await- }-- async fn snapshots(- &self,- source_id: &str,- limit: usize,- ) -> Result<Vec<SnapshotRef>, MemoryError> {- self.policy- .admit_read(Capability::Diff, "diff.snapshots", NO_NAMESPACE, false)?;- self.family()?.snapshots(source_id, limit).await- }-- async fn diff(- &self,- source_id: &str,- from: Option<&str>,- to: &str,- ) -> Result<DiffReport, MemoryError> {- self.policy- .admit_read(Capability::Diff, "diff.diff", NO_NAMESPACE, false)?;- self.family()?.diff(source_id, from, to).await- }-}--// ── Goals ────────────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryGoals for GuardedGoals {- async fn goals(&self) -> Result<GoalsDoc, MemoryError> {- self.policy- .admit_read(Capability::Goals, "goals.goals", NO_NAMESPACE, false)?;- self.family()?.goals().await- }-- async fn set_goals(&self, goals: GoalsDoc) -> Result<(), MemoryError> {- self.policy- .admit_write(Capability::Goals, "goals.set_goals", NO_NAMESPACE, true)?;- // The goals document's own validating mutation surface (the PII and- // secret predicates) is host policy that already runs in- // `memory::goals` before a document reaches the contract, so the guard- // does not re-scrub item text here. If an external driver ever binds,- // M6 must decide whether that upstream scrub is sufficient for egress- // or whether item bodies need the same `redact_outbound` treatment the- // document and ingest paths get.- self.family()?.set_goals(goals).await- }-}--// ── Tool memory ──────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryToolMemory for GuardedToolMemory {- async fn tool_rules(&self, tool_name: &str) -> Result<Vec<ToolMemoryRule>, MemoryError> {- self.policy.admit_read(- Capability::ToolMemory,- "tool_memory.tool_rules",- NO_NAMESPACE,- false,- )?;- self.family()?.tool_rules(tool_name).await- }-- async fn put_tool_rule(&self, rule: ToolMemoryRule) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::ToolMemory,- "tool_memory.put_tool_rule",- NO_NAMESPACE,- true,- )?;- self.family()?.put_tool_rule(rule).await- }-- async fn delete_tool_rule(&self, tool_name: &str, rule_id: &str) -> Result<bool, MemoryError> {- self.policy.admit_write(- Capability::ToolMemory,- "tool_memory.delete_tool_rule",- NO_NAMESPACE,- false,- )?;- self.family()?.delete_tool_rule(tool_name, rule_id).await- }-}--// ── Sources ──────────────────────────────────────────────────────────────────--#[async_trait]-impl MemorySourceSink for GuardedSources {- async fn accept_source_items(- &self,- source_id: &str,- source_kind: &str,- items: Vec<SourceItem>,- taint: MemoryTaint,- ) -> Result<IngestOutcome, MemoryError> {- self.policy.admit_write(- Capability::Sources,- "sources.accept_source_items",- NO_NAMESPACE,- true,- )?;- // Step 3: the batch taint is the guard's to decide. `stamp_taint` never- // downgrades, so a sync path that already asked for `ExternalSync` keeps- // it whether or not a source scope is active.- let taint = self.policy.stamp_taint(taint);- let items: Vec<SourceItem> = items- .into_iter()- .map(|mut item| {- item.title = self.policy.redact_outbound(&item.title).into_owned();- item.content = self.policy.redact_outbound(&item.content).into_owned();- item- })- .collect();- trace_allowed(- &self.policy,- "sources.accept_source_items",- NO_NAMESPACE,- items.iter().map(|i| i.content.chars().count()).sum(),- );- self.family()?- .accept_source_items(source_id, source_kind, items, taint)- .await- }-- async fn forget_source(&self, source_id: &str) -> Result<u64, MemoryError> {- self.policy.admit_write(- Capability::Sources,- "sources.forget_source",- NO_NAMESPACE,- false,- )?;- self.family()?.forget_source(source_id).await- }-- /// The one door for every scoped forget, so it takes the same write tier as- /// [`Self::forget_source`]. The selector names what to remove rather than- /// carrying content, which is why the egress flag is `false` — the same- /// reading its single-source sibling makes.- async fn forget_matching(- &self,- selector: &ForgetSelector,- ) -> Result<ForgetOutcome, MemoryError> {- self.policy.admit_write(- Capability::Sources,- "sources.forget_matching",- NO_NAMESPACE,- false,- )?;- self.family()?.forget_matching(selector).await- }-}--// ── Maintenance ──────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryMaintenance for GuardedMaintenance {- async fn reembed(&self) -> Result<MaintenanceReport, MemoryError> {- self.policy.admit_write(- Capability::Maintenance,- "maintenance.reembed",- NO_NAMESPACE,- false,- )?;- self.family()?.reembed().await- }-- async fn compact(&self) -> Result<MaintenanceReport, MemoryError> {- self.policy.admit_write(- Capability::Maintenance,- "maintenance.compact",- NO_NAMESPACE,- false,- )?;- self.family()?.compact().await- }-- async fn consolidate(&self) -> Result<MaintenanceReport, MemoryError> {- self.policy.admit_write(- Capability::Maintenance,- "maintenance.consolidate",- NO_NAMESPACE,- false,- )?;- self.family()?.consolidate().await- }-- /// Tiered by what the call actually does, not by what the member could do.- ///- /// Executing writes memory-tree rows for documents already stored, so it- /// takes the **write** tier like every other mutating maintenance member: a- /// `readonly` operator may inspect a store, and re-filing thousands of its- /// documents is not inspection.- ///- /// A **dry run writes nothing** — it counts what a pass would examine — so- /// it takes the **read** tier, the same trade [`Self::doctor`] makes below.- /// Gating it behind the write tier would withhold the one safe way to size- /// the job from precisely the tier that should be sizing rather than- /// executing, and the preview is what the expensive control exists to be- /// asked for first (review finding).- async fn backfill_connector_trees(- &self,- request: BackfillTreesRequest,- ) -> Result<BackfillTreesOutcome, MemoryError> {- if request.dry_run {- self.policy.admit_read(- Capability::Maintenance,- "maintenance.backfill_connector_trees",- NO_NAMESPACE,- false,- )?;- } else {- self.policy.admit_write(- Capability::Maintenance,- "maintenance.backfill_connector_trees",- NO_NAMESPACE,- false,- )?;- }- self.family()?.backfill_connector_trees(request).await- }-- /// Read-only by contract, so this takes the **read** tier check: a- /// `readonly` operator must still be able to run `doctor`, which is exactly- /// the tier where diagnosing without mutating matters most.- async fn doctor(&self) -> Result<MaintenanceReport, MemoryError> {- self.policy.admit_read(- Capability::Maintenance,- "maintenance.doctor",- NO_NAMESPACE,- false,- )?;- self.family()?.doctor().await- }-- /// Empties the whole store, so it takes the write tier rather than- /// `doctor`'s read one — and deliberately carries no scope, because there- /// is no scoped reading of "purge everything". A source-restricted caller- /// that reached this would be destroying rows it is not even allowed to- /// read; the write tier is what stops it.- async fn purge_all(&self) -> Result<PurgeOutcome, MemoryError> {- self.policy.admit_write(- Capability::Maintenance,- "maintenance.purge_all",- NO_NAMESPACE,- false,- )?;- self.family()?.purge_all().await- }-- /// [`Self::doctor`]'s findings in full, and read-only on the same terms —- /// it inspects configuration, persisted state and counters and mutates- /// nothing, so it takes the read tier for the reason `doctor` gives.- ///- /// Forwarded here rather than left to the trait's default: a defaulted- /// method on a decorator answers `Unsupported` even when the driver below- /// serves it, so the default would refuse every diagnosis reached through- /// the guard.- async fn diagnose(&self) -> Result<Diagnosis, MemoryError> {- self.policy.admit_read(- Capability::Maintenance,- "maintenance.diagnose",- NO_NAMESPACE,- false,- )?;- self.family()?.diagnose().await- }-- /// The degradation flags without the diagnosis around them — three- /// booleans and at most one cause. Read tier for the same reason- /// [`Self::doctor`] takes it, and for one more: this is what a status- /// light polls, so refusing it under `readonly` would leave the surface- /// that reports a reduced pipeline unable to say so.- async fn degraded_state(&self) -> Result<DegradedCapabilities, MemoryError> {- self.policy.admit_read(- Capability::Maintenance,- "maintenance.degraded_state",- NO_NAMESPACE,- false,- )?;- self.family()?.degraded_state().await- }-}--// ── People ───────────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryPeople for GuardedPeople {- async fn list_people(&self, limit: Option<usize>) -> Result<Vec<RankedPerson>, MemoryError> {- self.policy.admit_read(- Capability::People,- "people.list_people",- NO_NAMESPACE,- false,- )?;- self.family()?.list_people(limit).await- }-- async fn get_person(&self, person_id: &str) -> Result<Option<PersonRecord>, MemoryError> {- self.policy- .admit_read(Capability::People, "people.get_person", NO_NAMESPACE, false)?;- self.family()?.get_person(person_id).await- }-- /// A read *unless* it may mint a person, which is a write.- ///- /// The tier check follows what the call can actually do rather than what it- /// is named: with `create_if_missing` set this inserts a row, so a- /// `readonly` operator must be refused. Classifying the whole method as a- /// read would have handed `readonly` a working insert through the back- /// door.- async fn resolve_handle(- &self,- handle: &PersonHandle,- create_if_missing: bool,- ) -> Result<Option<ResolvedPerson>, MemoryError> {- if create_if_missing {- self.policy.admit_write(- Capability::People,- "people.resolve_handle",- NO_NAMESPACE,- true,- )?;- } else {- self.policy.admit_read(- Capability::People,- "people.resolve_handle",- NO_NAMESPACE,- false,- )?;- }- self.family()?- .resolve_handle(handle, create_if_missing)- .await- }-- async fn add_handle_alias(- &self,- person_id: &str,- handle: &PersonHandle,- ) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::People,- "people.add_handle_alias",- NO_NAMESPACE,- true,- )?;- self.family()?.add_handle_alias(person_id, handle).await- }-- async fn score_person(&self, person_id: &str) -> Result<Option<PersonScore>, MemoryError> {- self.policy.admit_read(- Capability::People,- "people.score_person",- NO_NAMESPACE,- false,- )?;- self.family()?.score_person(person_id).await- }-- async fn record_interaction(&self, interaction: &PersonInteraction) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::People,- "people.record_interaction",- NO_NAMESPACE,- true,- )?;- self.family()?.record_interaction(interaction).await- }-- /// A write: it reads the platform address book and inserts what it finds.- async fn seed_from_address_book(&self) -> Result<AddressBookSeedOutcome, MemoryError> {- self.policy.admit_write(- Capability::People,- "people.seed_from_address_book",- NO_NAMESPACE,- true,- )?;- self.family()?.seed_from_address_book().await- }-}diff --git a/crates/openhuman-core/src/memory/guard/families_part_03.rs b/crates/openhuman-core/src/memory/guard/families_part_03.rsdeleted file mode 100644index 0c2bc19279..0000000000--- a/crates/openhuman-core/src/memory/guard/families_part_03.rs+++ /dev/null@@ -1,668 +0,0 @@-// ── Chunks ───────────────────────────────────────────────────────────────────--// ── Retrieval ────────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryRetrieval for GuardedRetrieval {- async fn fast_retrieve(- &self,- query: &str,- options: FastRetrieveQuery,- scope: Option<&SourceScope>,- ) -> Result<RetrievalResponse, MemoryError> {- self.policy.admit_read(- Capability::Retrieval,- "retrieval.fast_retrieve",- NO_NAMESPACE,- false,- )?;- let effective = self.policy.narrow_scope(scope);- self.family()?- .fast_retrieve(query, options, effective.as_ref())- .await- }-- async fn cover_window(- &self,- window: &CoverWindowQuery,- scope: Option<&SourceScope>,- ) -> Result<RetrievalResponse, MemoryError> {- self.policy.admit_read(- Capability::Retrieval,- "retrieval.cover_window",- NO_NAMESPACE,- false,- )?;- let effective = self.policy.narrow_scope(scope);- self.family()?- .cover_window(window, effective.as_ref())- .await- }-- async fn retrieve_source(- &self,- query: &SourceRetrievalQuery,- scope: Option<&SourceScope>,- ) -> Result<RetrievalResponse, MemoryError> {- self.policy.admit_read(- Capability::Retrieval,- "retrieval.retrieve_source",- NO_NAMESPACE,- false,- )?;- let effective = self.policy.narrow_scope(scope);- self.family()?- .retrieve_source(query, effective.as_ref())- .await- }-- async fn retrieve_children(- &self,- node_id: &str,- max_depth: u32,- query: Option<&str>,- limit: Option<usize>,- scope: Option<&SourceScope>,- ) -> Result<Vec<RetrievalHit>, MemoryError> {- self.policy.admit_read(- Capability::Retrieval,- "retrieval.retrieve_children",- NO_NAMESPACE,- false,- )?;- // Intersected with the ambient allowlist, never passed through — same- // rule as `list_chunks`. See `GuardPolicy::narrow_scope`.- let effective = self.policy.narrow_scope(scope);- self.family()?- .retrieve_children(node_id, max_depth, query, limit, effective.as_ref())- .await- }-- async fn retrieve_leaves(- &self,- chunk_ids: &[String],- scope: Option<&SourceScope>,- ) -> Result<Vec<RetrievalHit>, MemoryError> {- self.policy.admit_read(- Capability::Retrieval,- "retrieval.retrieve_leaves",- NO_NAMESPACE,- false,- )?;- let effective = self.policy.narrow_scope(scope);- self.family()?- .retrieve_leaves(chunk_ids, effective.as_ref())- .await- }-- /// Namespace-scoped, so the namespace reaches the tier check — unlike the- /// other retrieval primitives, which span the store.- async fn recall_namespace_scored(- &self,- namespace: &str,- query: &str,- limit: usize,- exclude_session_id: Option<&str>,- ) -> Result<Vec<NamespaceMemoryHit>, MemoryError> {- self.policy.admit_read(- Capability::Retrieval,- "retrieval.recall_namespace_scored",- namespace,- false,- )?;- self.family()?- .recall_namespace_scored(namespace, query, limit, exclude_session_id)- .await- }-- /// Namespace-scoped like its scored sibling, and admitted under the same- /// capability: recency versus ranking is a retrieval mode, not a policy- /// boundary.- async fn recall_namespace_recent(- &self,- namespace: &str,- limit: usize,- ) -> Result<Vec<NamespaceMemoryHit>, MemoryError> {- self.policy.admit_read(- Capability::Retrieval,- "retrieval.recall_namespace_recent",- namespace,- false,- )?;- self.family()?- .recall_namespace_recent(namespace, limit)- .await- }-- async fn search_entities(- &self,- query: &str,- kinds: Option<&[String]>,- limit: usize,- ) -> Result<Vec<EntityMatch>, MemoryError> {- self.policy.admit_read(- Capability::Retrieval,- "retrieval.search_entities",- NO_NAMESPACE,- false,- )?;- self.family()?.search_entities(query, kinds, limit).await- }-}--// ── Profile ──────────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryEpisodic for GuardedEpisodic {- async fn insert_turn(&self, turn: &EpisodicTurn) -> Result<i64, MemoryError> {- // A recorded turn is user-authored conversation content, so this is a- // write and is admitted as one — the read/write split here is about- // what the tier permits, not about how much data moves.- // `carries_content: true`, unlike the tier note above, which is about- // what the tier permits rather than how much data moves. This flag is a- // different question: it decides whether the egress record classifies- // the transfer as `FileContent` or `Metadata`. A turn IS the user's- // prose, and an audit trail that calls a transcript "metadata"- // understates what left the process — the one thing that record exists- // to get right. `tree.append` has always passed `true` for this shape.- self.policy.admit_write(- Capability::Episodic,- "episodic.insert_turn",- NO_NAMESPACE,- true,- )?;- let mut turn = turn.clone();- turn.content = self.policy.redact_outbound(&turn.content).into_owned();- self.family()?.insert_turn(&turn).await- }-- async fn session_turns(&self, session_id: &str) -> Result<Vec<EpisodicTurn>, MemoryError> {- self.policy.admit_read(- Capability::Episodic,- "episodic.session_turns",- NO_NAMESPACE,- false,- )?;- self.family()?.session_turns(session_id).await- }-- async fn open_segment(- &self,- session_id: &str,- ) -> Result<Option<ConversationSegment>, MemoryError> {- self.policy.admit_read(- Capability::Episodic,- "episodic.open_segment",- NO_NAMESPACE,- false,- )?;- self.family()?.open_segment(session_id).await- }-- #[allow(- clippy::too_many_arguments,- reason = "trait signature; see the contract's rationale"- )]- async fn create_segment(- &self,- segment_id: &str,- session_id: &str,- namespace: &str,- start_episodic_id: i64,- start_seq: Option<u32>,- start_timestamp: f64,- now: f64,- ) -> Result<(), MemoryError> {- // One of the two episodic calls that names a namespace — `insert_event`- // is the other — so it is admitted against that namespace rather than- // `NO_NAMESPACE`. The rest of this family addresses a segment by id and- // has no namespace to check.- self.policy.admit_write(- Capability::Episodic,- "episodic.create_segment",- namespace,- false,- )?;- self.family()?- .create_segment(- segment_id,- session_id,- namespace,- start_episodic_id,- start_seq,- start_timestamp,- now,- )- .await- }-- async fn append_turn(- &self,- segment_id: &str,- episodic_id: i64,- seq: Option<u32>,- timestamp: f64,- now: f64,- ) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::Episodic,- "episodic.append_turn",- NO_NAMESPACE,- false,- )?;- self.family()?- .append_turn(segment_id, episodic_id, seq, timestamp, now)- .await- }-- /// Admitted like its sibling writes; the event's namespace is the- /// admission subject, since it is the one the record is scoped to.- async fn insert_event(&self, event: &EpisodicEvent) -> Result<(), MemoryError> {- // `carries_content: true` for the same reason as `insert_turn`: an- // extracted event is the user's prose, not a descriptor of it.- self.policy.admit_write(- Capability::Episodic,- "episodic.insert_event",- &event.namespace,- true,- )?;- let mut event = event.clone();- event.content = self.policy.redact_outbound(&event.content).into_owned();- self.family()?.insert_event(&event).await- }-- async fn close_segment(&self, segment_id: &str, now: f64) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::Episodic,- "episodic.close_segment",- NO_NAMESPACE,- false,- )?;- self.family()?.close_segment(segment_id, now).await- }-- async fn set_segment_summary(- &self,- segment_id: &str,- summary: &str,- now: f64,- ) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::Episodic,- "episodic.set_segment_summary",- NO_NAMESPACE,- false,- )?;- self.family()?- .set_segment_summary(segment_id, summary, now)- .await- }-- /// A read: it selects rows, it changes none. Admitted as one so a- /// read-only policy can still drive the re-summarisation pass (#6186) —- /// the write it leads to is `set_segment_summary`, which is admitted- /// separately on its own terms.- async fn segments_pending_summary(- &self,- limit: u32,- ) -> Result<Vec<ConversationSegment>, MemoryError> {- self.policy.admit_read(- Capability::Episodic,- "episodic.segments_pending_summary",- NO_NAMESPACE,- false,- )?;- self.family()?.segments_pending_summary(limit).await- }-- async fn upsert_segment_embedding(- &self,- segment_id: &str,- model_signature: &str,- embedding: &[f32],- created_at: f64,- ) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::Episodic,- "episodic.upsert_segment_embedding",- NO_NAMESPACE,- false,- )?;- self.family()?- .upsert_segment_embedding(segment_id, model_signature, embedding, created_at)- .await- }-}--#[async_trait]-impl MemoryProfile for GuardedProfile {- async fn list_active_facets(&self) -> Result<Vec<ProfileFacet>, MemoryError> {- self.policy.admit_read(- Capability::Profile,- "profile.list_active_facets",- NO_NAMESPACE,- false,- )?;- self.family()?.list_active_facets().await- }-- async fn list_all_facets(&self) -> Result<Vec<ProfileFacet>, MemoryError> {- self.policy.admit_read(- Capability::Profile,- "profile.list_all_facets",- NO_NAMESPACE,- false,- )?;- self.family()?.list_all_facets().await- }-- async fn get_facet(&self, key: &str) -> Result<Option<ProfileFacet>, MemoryError> {- self.policy.admit_read(- Capability::Profile,- "profile.get_facet",- NO_NAMESPACE,- false,- )?;- self.family()?.get_facet(key).await- }-- async fn facets_by_type(- &self,- facet_type: FacetType,- ) -> Result<Vec<ProfileFacet>, MemoryError> {- self.policy.admit_read(- Capability::Profile,- "profile.facets_by_type",- NO_NAMESPACE,- false,- )?;- self.family()?.facets_by_type(facet_type).await- }-- async fn upsert_facet(&self, facet: &ProfileFacet) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::Profile,- "profile.upsert_facet",- NO_NAMESPACE,- true,- )?;- self.family()?.upsert_facet(facet).await- }-- async fn upsert_provider_facet(- &self,- facet_id: &str,- facet_type: FacetType,- key: &str,- value: &str,- confidence: f64,- segment_id: Option<&str>,- observed_at: f64,- ) -> Result<(), MemoryError> {- self.policy.admit_write(- Capability::Profile,- "profile.upsert_provider_facet",- NO_NAMESPACE,- true,- )?;- self.family()?- .upsert_provider_facet(- facet_id,- facet_type,- key,- value,- confidence,- segment_id,- observed_at,- )- .await- }-- async fn set_facet_user_state(- &self,- key: &str,- user_state: UserState,- ) -> Result<bool, MemoryError> {- self.policy.admit_write(- Capability::Profile,- "profile.set_facet_user_state",- NO_NAMESPACE,- true,- )?;- self.family()?.set_facet_user_state(key, user_state).await- }-- async fn delete_facet(&self, key: &str) -> Result<bool, MemoryError> {- self.policy.admit_write(- Capability::Profile,- "profile.delete_facet",- NO_NAMESPACE,- true,- )?;- self.family()?.delete_facet(key).await- }-- async fn delete_facet_by_id(&self, facet_id: &str) -> Result<bool, MemoryError> {- self.policy.admit_write(- Capability::Profile,- "profile.delete_facet_by_id",- NO_NAMESPACE,- true,- )?;- self.family()?.delete_facet_by_id(facet_id).await- }-- async fn drop_facets_below(&self, threshold: f64) -> Result<usize, MemoryError> {- self.policy.admit_write(- Capability::Profile,- "profile.drop_facets_below",- NO_NAMESPACE,- true,- )?;- self.family()?.drop_facets_below(threshold).await- }-- /// Refused reads answer `false`, matching the trait's "an error reads as- /// no". A tier refusal is not evidence that the row matches.- async fn workflow_identity_matches(&self, key_pattern: &str, canonical_value: &str) -> bool {- if self- .policy- .admit_read(- Capability::Profile,- "profile.workflow_identity_matches",- NO_NAMESPACE,- false,- )- .is_err()- {- return false;- }- match self.family() {- Ok(family) => {- family- .workflow_identity_matches(key_pattern, canonical_value)- .await- }- Err(_) => false,- }- }-}--// ── Source sync ──────────────────────────────────────────────────────────────--#[async_trait]-impl MemorySourceSync for GuardedSourceSync {- /// A write: it fetches from an upstream connector and ingests what it finds.- /// The tier check is what stops a `readonly` operator triggering one.- async fn run_connection_sync(- &self,- toolkit: &str,- connection_id: &str,- ) -> Result<SyncRunOutcome, MemoryError> {- self.policy.admit_write(- Capability::SourceSync,- "source_sync.run_connection_sync",- NO_NAMESPACE,- false,- )?;- self.family()?- .run_connection_sync(toolkit, connection_id)- .await- }-- async fn source_sync_state(- &self,- toolkit: &str,- connection_id: &str,- ) -> Result<Option<SourceSyncState>, MemoryError> {- self.policy.admit_read(- Capability::SourceSync,- "source_sync.source_sync_state",- NO_NAMESPACE,- false,- )?;- self.family()?- .source_sync_state(toolkit, connection_id)- .await- }-- async fn sync_audit_log(- &self,- limit: Option<usize>,- ) -> Result<Vec<SyncAuditEntry>, MemoryError> {- self.policy.admit_read(- Capability::SourceSync,- "source_sync.sync_audit_log",- NO_NAMESPACE,- false,- )?;- self.family()?.sync_audit_log(limit).await- }-- /// Arithmetic over the driver's own price table — no stored content is read,- /// so this is the lightest check in the family.- async fn estimate_sync_cost_usd(- &self,- input_tokens: u64,- output_tokens: u64,- ) -> Result<f64, MemoryError> {- self.policy.admit_read(- Capability::SourceSync,- "source_sync.estimate_sync_cost_usd",- NO_NAMESPACE,- false,- )?;- self.family()?- .estimate_sync_cost_usd(input_tokens, output_tokens)- .await- }-- async fn sync_statuses(&self) -> Result<Vec<SourceSyncStatus>, MemoryError> {- self.policy.admit_read(- Capability::SourceSync,- "source_sync.sync_statuses",- NO_NAMESPACE,- false,- )?;- self.family()?.sync_statuses().await- }-- async fn raw_archive_coverage(- &self,- tree_scope: &str,- archive_source_id: &str,- ) -> Result<RawArchiveCoverage, MemoryError> {- self.policy.admit_read(- Capability::SourceSync,- "source_sync.raw_archive_coverage",- NO_NAMESPACE,- false,- )?;- self.family()?- .raw_archive_coverage(tree_scope, archive_source_id)- .await- }-- /// Rebuilds a summary tree from the raw archive, so it writes.- async fn rebuild_from_raw_archive(- &self,- tree_scope: &str,- archive_source_id: &str,- ) -> Result<RawRebuildOutcome, MemoryError> {- self.policy.admit_write(- Capability::SourceSync,- "source_sync.rebuild_from_raw_archive",- NO_NAMESPACE,- false,- )?;- self.family()?- .rebuild_from_raw_archive(tree_scope, archive_source_id)- .await- }-}--// ── Scoring ──────────────────────────────────────────────────────────────────--#[async_trait]-impl MemoryScoring for GuardedScoring {- async fn extract_entities(&self, query: &str) -> Result<Vec<String>, MemoryError> {- self.policy.admit_read(- Capability::Scoring,- "scoring.extract_entities",- NO_NAMESPACE,- true,- )?;- self.family()?.extract_entities(query).await- }-- async fn embed_text(&self, text: &str) -> Result<Vec<f32>, MemoryError> {- self.policy.admit_read(- Capability::Scoring,- "scoring.embed_text",- NO_NAMESPACE,- true,- )?;- self.family()?.embed_text(text).await- }-- async fn embedder_slug(&self) -> Result<String, MemoryError> {- self.policy.admit_read(- Capability::Scoring,- "scoring.embedder_slug",- NO_NAMESPACE,- false,- )?;- self.family()?.embedder_slug().await- }-}--// ── Coding sessions ──────────────────────────────────────────────────────────--#[async_trait]-impl MemoryCodingSessions for GuardedCodingSessions {- async fn coding_session_status(&self) -> Result<Vec<CodingSessionSource>, MemoryError> {- self.policy.admit_read(- Capability::CodingSessions,- "coding_sessions.coding_session_status",- NO_NAMESPACE,- false,- )?;- self.family()?.coding_session_status().await- }-- /// `carries_content: true` — the request carries the session transcripts- /// themselves, which is the case the egress record exists to classify- /// correctly.- async fn ingest_coding_sessions(- &self,- request: CodingSessionIngestRequest,- ) -> Result<CodingSessionIngestReport, MemoryError> {- self.policy.admit_write(- Capability::CodingSessions,- "coding_sessions.ingest_coding_sessions",- NO_NAMESPACE,- true,- )?;- self.family()?.ingest_coding_sessions(request).await- }-}diff --git a/crates/openhuman-core/src/memory/guard/families_part_04.rs b/crates/openhuman-core/src/memory/guard/families_part_04.rsdeleted file mode 100644index 3a26cc362d..0000000000--- a/crates/openhuman-core/src/memory/guard/families_part_04.rs+++ /dev/null@@ -1,318 +0,0 @@-// ── The v1.13.7 typed-ingestion round + Answer ──────────────────────────────-//-// Five families the ingestion round added to the contract, wired the day the-// registry pinned the release: the guard's audit invariant (advertised ==-// reachable-through-the-guard) is what forced this file to exist alongside-// the re-pin rather than after it.--use crate::memory::api::provider::operations::{- AnswerRequest, AnswerResponse, MemoryAnswer, MemoryConversationIngest,- MemoryDocumentIngest, MemoryEventIngest, MemoryLearningIngest, RawMemoryEvent,-};-use tinymemory_api::learning::LearningCandidate;--decorator!(- /// Guarded [`MemoryDocumentIngest`].- GuardedDocumentIngest,- dyn MemoryDocumentIngest,- as_document_ingest,- DocumentIngest-);-decorator!(- /// Guarded [`MemoryConversationIngest`].- GuardedConversationIngest,- dyn MemoryConversationIngest,- as_conversation_ingest,- ConversationIngest-);-decorator!(- /// Guarded [`MemoryLearningIngest`].- GuardedLearningIngest,- dyn MemoryLearningIngest,- as_learning_ingest,- LearningIngest-);-decorator!(- /// Guarded [`MemoryEventIngest`].- GuardedEventIngest,- dyn MemoryEventIngest,- as_event_ingest,- EventIngest-);-decorator!(- /// Guarded [`MemoryAnswer`].- GuardedAnswer,- dyn MemoryAnswer,- as_answer,- Answer-);--/// Steps 3 + 4 over one ingest item, shared by the typed-ingest decorators:-/// stamp provenance, redact on egress — the same admission-/// [`GuardedIngest::admit`] applies on the legacy family.-fn admit_typed_item(policy: &GuardPolicy, mut item: IngestItem) -> IngestItem {- item.taint = policy.stamp_taint(item.taint);- item.content = policy.redact_outbound(&item.content).into_owned();- item-}--#[async_trait]-impl MemoryDocumentIngest for GuardedDocumentIngest {- async fn ingest_document(&self, document: IngestItem) -> Result<IngestOutcome, MemoryError> {- let namespace = document.namespace.clone().unwrap_or_else(|| "-".to_string());- self.policy.admit_write(- Capability::DocumentIngest,- "document_ingest.ingest_document",- &namespace,- true,- )?;- let document = admit_typed_item(&self.policy, document);- trace_allowed(- &self.policy,- "document_ingest.ingest_document",- &namespace,- document.content.chars().count(),- );- self.family()?.ingest_document(document).await- }-}--#[async_trait]-impl MemoryConversationIngest for GuardedConversationIngest {- async fn ingest_conversation(- &self,- messages: Vec<IngestItem>,- ) -> Result<IngestOutcome, MemoryError> {- self.policy.admit_write(- Capability::ConversationIngest,- "conversation_ingest.ingest_conversation",- NO_NAMESPACE,- true,- )?;- let messages: Vec<IngestItem> = messages- .into_iter()- .map(|m| admit_typed_item(&self.policy, m))- .collect();- trace_allowed(- &self.policy,- "conversation_ingest.ingest_conversation",- NO_NAMESPACE,- messages.iter().map(|m| m.content.chars().count()).sum(),- );- self.family()?.ingest_conversation(messages).await- }-}--#[async_trait]-impl MemoryLearningIngest for GuardedLearningIngest {- async fn ingest_learning(- &self,- learning: LearningCandidate,- ) -> Result<IngestOutcome, MemoryError> {- // No content redaction: a learning candidate is already extracted- // structure, not raw user text — provenance is the driver's to stamp- // from the evidence pointer it carries.- self.policy.admit_write(- Capability::LearningIngest,- "learning_ingest.ingest_learning",- NO_NAMESPACE,- true,- )?;- trace_allowed(- &self.policy,- "learning_ingest.ingest_learning",- NO_NAMESPACE,- 0,- );- self.family()?.ingest_learning(learning).await- }-}--#[async_trait]-impl MemoryEventIngest for GuardedEventIngest {- async fn ingest_event(&self, event: RawMemoryEvent) -> Result<IngestOutcome, MemoryError> {- self.policy.admit_write(- Capability::EventIngest,- "event_ingest.ingest_event",- NO_NAMESPACE,- true,- )?;- trace_allowed(&self.policy, "event_ingest.ingest_event", NO_NAMESPACE, 0);- self.family()?.ingest_event(event).await- }-}--#[async_trait]-impl MemoryAnswer for GuardedAnswer {- async fn answer(&self, request: AnswerRequest) -> Result<AnswerResponse, MemoryError> {- // A read-shaped family: retrieval plus synthesis, no persistence.- self.policy- .admit_read(Capability::Answer, "answer.answer", NO_NAMESPACE, false)?;- trace_allowed(&self.policy, "answer.answer", NO_NAMESPACE, 0);- self.family()?.answer(request).await- }-}--#[async_trait]-impl MemoryChunks for GuardedChunks {- async fn list_chunks(- &self,- query: &ChunkQuery,- scope: Option<&SourceScope>,- ) -> Result<Vec<Chunk>, MemoryError> {- self.policy.admit_read(- Capability::Chunks,- "chunks.list_chunks",- NO_NAMESPACE,- false,- )?;- // Intersected with the ambient allowlist, never passed through. The- // ambient scope is an upper bound: forwarding the caller's scope- // unchanged would let a source-restricted turn widen itself back out by- // naming a collection the restriction excluded. See- // `GuardPolicy::narrow_scope`.- let effective = self.policy.narrow_scope(scope);- self.family()?.list_chunks(query, effective.as_ref()).await- }-- /// The count that labels a [`Self::list_chunks`] page, and it must be- /// narrowed by exactly the same rule. A total computed against a wider- /// scope than the page it labels leaks the existence of rows the caller may- /// not read — "showing 20 of 4000" tells a source-restricted turn how much- /// it is not being shown.- async fn count_chunks(- &self,- query: &ChunkQuery,- scope: Option<&SourceScope>,- ) -> Result<u64, MemoryError> {- self.policy.admit_read(- Capability::Chunks,- "chunks.count_chunks",- NO_NAMESPACE,- false,- )?;- let effective = self.policy.narrow_scope(scope);- self.family()?.count_chunks(query, effective.as_ref()).await- }-- /// Same rows as [`Self::list_chunks`] with the stored facts beside them, so- /// the same intersection applies for the same reason.- async fn list_chunk_details(- &self,- query: &ChunkQuery,- scope: Option<&SourceScope>,- ) -> Result<Vec<ChunkListRow>, MemoryError> {- self.policy.admit_read(- Capability::Chunks,- "chunks.list_chunk_details",- NO_NAMESPACE,- false,- )?;- let effective = self.policy.narrow_scope(scope);- self.family()?- .list_chunk_details(query, effective.as_ref())- .await- }-- /// Per-source totals are computed from the chunks the scope admits, not- /// filtered afterwards — so a restricted caller must not learn that a- /// forbidden source exists by seeing its row, nor see a permitted source- /// carrying a count that includes rows it cannot read.- async fn source_totals(- &self,- limit: usize,- scope: Option<&SourceScope>,- ) -> Result<Vec<SourceTotal>, MemoryError> {- self.policy.admit_read(- Capability::Chunks,- "chunks.source_totals",- NO_NAMESPACE,- false,- )?;- let effective = self.policy.narrow_scope(scope);- self.family()?- .source_totals(limit, effective.as_ref())- .await- }-- async fn get_chunk(&self, chunk_id: &str) -> Result<Option<Chunk>, MemoryError> {- self.policy- .admit_read(Capability::Chunks, "chunks.get_chunk", NO_NAMESPACE, false)?;- self.family()?.get_chunk(chunk_id).await- }-- async fn chunk_detail(&self, chunk_id: &str) -> Result<Option<ChunkDetail>, MemoryError> {- self.policy.admit_read(- Capability::Chunks,- "chunks.chunk_detail",- NO_NAMESPACE,- false,- )?;- self.family()?.chunk_detail(chunk_id).await- }-- /// The catalog is not user content, so it takes no namespace and the- /// lightest read check — refusing it under `readonly` would stop an- /// operator finding out what the store can even hold.- async fn storage_kinds(&self) -> Result<Vec<String>, MemoryError> {- self.policy.admit_read(- Capability::Chunks,- "chunks.storage_kinds",- NO_NAMESPACE,- false,- )?;- self.family()?.storage_kinds().await- }-- /// Vectors, not content — but still a read of stored material, so it takes- /// the same tier check rather than being waved through as metadata.- async fn chunk_embeddings(- &self,- chunk_ids: &[String],- model_signature: &str,- ) -> Result<Vec<ChunkEmbedding>, MemoryError> {- self.policy.admit_read(- Capability::Chunks,- "chunks.chunk_embeddings",- NO_NAMESPACE,- false,- )?;- self.family()?- .chunk_embeddings(chunk_ids, model_signature)- .await- }-- /// One chunk's admission verdict, read by chunk id exactly as- /// [`Self::chunk_detail`] is — so it takes that member's check, not- /// [`Self::list_chunks`]'s scope intersection. There is no scope to narrow:- /// the caller already holds the id.- async fn chunk_score(&self, chunk_id: &str) -> Result<Option<ChunkScore>, MemoryError> {- self.policy.admit_read(- Capability::Chunks,- "chunks.chunk_score",- NO_NAMESPACE,- false,- )?;- self.family()?.chunk_score(chunk_id).await- }-- /// Ingest progress for the sources the caller names, one row per query.- ///- /// Unlike [`Self::source_totals`], which enumerates the groups that exist- /// and therefore has to be narrowed to the ambient allowlist, this answers- /// only about prefixes the caller supplied — it discloses no source the- /// caller did not already name — and the contract member carries no- /// [`SourceScope`] for the guard to intersect anything into.- async fn source_ingest_status(- &self,- source_prefixes: &[SourceIngestQuery],- ) -> Result<Vec<SourceIngestStatus>, MemoryError> {- self.policy.admit_read(- Capability::Chunks,- "chunks.source_ingest_status",- NO_NAMESPACE,- false,- )?;- self.family()?.source_ingest_status(source_prefixes).await- }-}diff --git a/crates/openhuman-core/src/platform/about_app/catalog_auth_channels_team.rs b/crates/openhuman-core/src/platform/about_app/catalog_auth_channels_team.rsnew file mode 100644index 0000000000..f830b17810--- /dev/null+++ b/crates/openhuman-core/src/platform/about_app/catalog_auth_channels_team.rs@@ -0,0 +1,259 @@+//! Auth, Channels, and Team capability entries.++use super::*;++pub(super) const CAPABILITIES: &[Capability] = &[+{+ id: "team.create",+ name: "Create Teams",+ domain: "team",+ category: CapabilityCategory::Team,+ description: "Create a team and start collaborating with shared billing and members.",+ how_to: "Settings > Team",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "team.join_via_invite_code",+ name: "Join Teams via Invite Code",+ domain: "team",+ category: CapabilityCategory::Team,+ description: "Join an existing team using an invite code.",+ how_to: "Invites > Redeem an Invite Code",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "team.switch_active_team",+ name: "Switch Active Team",+ domain: "team",+ category: CapabilityCategory::Team,+ description: "Switch which team is currently active in the app.",+ how_to: "Settings > Team",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "team.leave",+ name: "Leave Teams",+ domain: "team",+ category: CapabilityCategory::Team,+ description: "Leave a team that you no longer want to participate in.",+ how_to: "Settings > Team",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "team.manage_members",+ name: "Manage Team Members",+ domain: "team",+ category: CapabilityCategory::Team,+ description: "Review members and change team roles when you have permission.",+ how_to: "Settings > Team > Manage team > Members",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "team.generate_invite_codes",+ name: "Generate Invite Codes",+ domain: "team",+ category: CapabilityCategory::Team,+ description: "Create invite codes to bring new members into a team.",+ how_to: "Settings > Team > Manage team > Invites",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "team.track_invite_usage",+ name: "Track Invite Usage",+ domain: "team",+ category: CapabilityCategory::Team,+ description: "View invite usage counts, limits, and revoke team invites.",+ how_to: "Settings > Team > Manage team > Invites",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "auth.login_oauth",+ name: "Login via OAuth",+ domain: "auth",+ category: CapabilityCategory::Auth,+ description: "Sign in with the app's supported provider-based authentication flow.",+ how_to: "Welcome",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "auth.onboarding_setup",+ name: "Onboarding Setup",+ domain: "auth",+ category: CapabilityCategory::Auth,+ description: "Walk through onboarding to configure initial permissions and preferences.",+ how_to: "Onboarding",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "auth.configure_tool_access",+ name: "Configure Tool Access",+ domain: "auth",+ category: CapabilityCategory::Auth,+ description: "Choose which built-in tools OpenHuman can use on your behalf during setup.",+ how_to: "Onboarding > Enable Tools",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "auth.backup_recovery_phrase",+ name: "Back Up Recovery Phrase",+ domain: "auth",+ category: CapabilityCategory::Auth,+ description: "Generate and save a recovery phrase used to secure and restore encrypted app data.",+ how_to: "Onboarding > Recovery Phrase",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "auth.import_recovery_phrase",+ name: "Import Recovery Phrase",+ domain: "auth",+ category: CapabilityCategory::Auth,+ description: "Import an existing recovery phrase to restore encrypted app data.",+ how_to: "Onboarding > Recovery Phrase > I already have a recovery phrase",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "auth.logout",+ name: "Logout",+ domain: "auth",+ category: CapabilityCategory::Auth,+ description: "Sign out of the current session.",+ how_to: "Settings > Log out",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "channels.connect_platform",+ name: "Connect Messaging Platforms",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Connect supported messaging platforms such as Telegram or Discord.",+ how_to: "Connections > Channels",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "channels.telegram_remote_control",+ name: "Telegram Remote Control",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description:+ "Operate OpenHuman from Telegram with slash commands: /status, /sessions, /new, and /help.",+ how_to: "Connections > Channels > Telegram (connect), then message the bot",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "channels.disconnect_platform",+ name: "Disconnect Messaging Platforms",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Disconnect a previously configured messaging platform.",+ how_to: "Connections > Channels",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "channels.test_credentials",+ name: "Test Channel Credentials",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Validate platform credentials or connection state before using a channel.",+ how_to: "Connections > Channels",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "channels.set_default_channel",+ name: "Set Default Messaging Channel",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Choose which messaging channel should be used by default.",+ how_to: "Connections > Channels",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "channels.whatsapp_read_messages",+ name: "Read WhatsApp Messages",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Read and search WhatsApp Web conversations and messages after connecting WhatsApp in OpenHuman. Data is stored locally only and never transmitted.",+ how_to: "Connect WhatsApp Web via Channels, then ask the agent to read or summarise your messages.",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "channels.mcp_registry_browse",+ name: "Browse MCP Server Registry",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Search and discover MCP servers from the Smithery.ai and official modelcontextprotocol registries.",+ how_to: "Skills > MCP > Browse catalog",+ status: CapabilityStatus::Beta,+ privacy: Some(CapabilityPrivacy {+ leaves_device: true,+ data_kind: PrivacyDataKind::Metadata,+ destinations: &["Smithery.ai registry API", "modelcontextprotocol registry API"],+ }),+ },+{+ id: "channels.mcp_server_install",+ name: "Install MCP Servers",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Install MCP servers locally — both local stdio subprocesses and hosted HTTP-remote servers. Required env vars are stored encrypted and never included in logs or responses. Can also be done conversationally via the MCP setup assistant.",+ how_to: "Skills > MCP > Browse catalog > Install, or ask the assistant to \"set up the <name> MCP server\"",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_CREDENTIALS,+ },+{+ id: "channels.mcp_server_connect",+ name: "Connect / Reconfigure MCP Servers",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Spawn and manage MCP server connections (stdio subprocess or HTTP-remote). Reconfigure stored env vars and reconnect without uninstalling.",+ how_to: "Skills > MCP > select a server > Connect / Reconfigure",+ status: CapabilityStatus::Beta,+ privacy: Some(CapabilityPrivacy {+ leaves_device: true,+ data_kind: PrivacyDataKind::Derived,+ destinations: &["Configured MCP endpoint(s)"],+ }),+ },+{+ id: "channels.mcp_connection_alerts",+ name: "MCP Connection Health Alerts",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Watch installed MCP servers in the background. Each non-nominal liveness-probe outcome (a slow answer, a dropped transport, a reconnect that succeeded or failed) is recorded in the developer Event Log — an answered probe is not, so a healthy server stays silent — and a server that stays down, comes back after failing, or cannot start because its launcher runtime is missing raises a notification.",+ how_to: "Automatic. Settings > Developer > Event Log (filter: mcp) for the stream; Notifications for the alerts",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "channels.mcp_tool_call",+ name: "Invoke MCP Server Tools",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Call tools exposed by connected MCP servers. Tools are surfaced to the agent and runnable from the tool playground.",+ how_to: "Skills > MCP > select a connected server > Tools > Try, or ask the assistant in Chat",+ status: CapabilityStatus::Beta,+ privacy: Some(CapabilityPrivacy {+ leaves_device: true,+ data_kind: PrivacyDataKind::Derived,+ destinations: &["Configured MCP endpoint(s)"],+ }),+ },+];diff --git a/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs b/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rsnew file mode 100644index 0000000000..157d79445a--- /dev/null+++ b/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs@@ -0,0 +1,613 @@+//! Conversation and Intelligence capability entries.++use super::*;++pub(super) const CAPABILITIES: &[Capability] = &[+{+ id: "conversation.create",+ name: "Create Conversations",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Start a new conversation thread with the assistant.",+ how_to: "Conversations",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "conversation.send_text",+ name: "Send Text Messages",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Send typed messages to the assistant in a conversation.",+ how_to: "Conversations > Message composer",+ status: CapabilityStatus::Stable,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "conversation.prompt_injection_guard",+ name: "Prompt Injection Guard",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Detect and block prompt-injection attempts before agent/model execution.",+ how_to: "Conversations > Message composer",+ status: CapabilityStatus::Stable,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "conversation.send_voice",+ name: "Send Voice Messages",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Record or attach voice input and send it as a message.",+ how_to: "Conversations > Voice input",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "voice.stt_engine",+ name: "Speech Recognition Engine",+ domain: "voice",+ category: CapabilityCategory::Conversation,+ description: "Choose which hosted engine transcribes your speech. \"Backend\" uses \+ OpenHuman's transcription proxy and needs no setup; ElevenLabs and OpenAI \+ call the provider directly with your own API key. Audio always leaves the \+ device — the bundled offline whisper.cpp engine was removed, so there is \+ no local option.",+ how_to: "Settings → Voice → Speech recognition engine",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "voice.ptt",+ name: "Global push-to-talk",+ domain: "voice",+ category: CapabilityCategory::Conversation,+ description: "Hold a global hotkey from anywhere on the desktop to dictate into the \+ active chat thread. Press opens the mic, release commits the transcript, \+ and an always-on-top overlay shows listening/idle state without stealing \+ focus. Cross-platform via tauri-plugin-global-shortcut (macOS, Windows, \+ Linux/X11); requires microphone access and a global shortcut binding. \+ Optional speak_reply plays the agent's response through local TTS.",+ how_to: "Settings → Voice → Push-to-Talk: pick a shortcut, grant microphone access, \+ then hold the configured hotkey from any window.",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "conversation.copy_messages",+ name: "Copy Messages",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Copy individual assistant or user messages for reuse elsewhere.",+ how_to: "Conversations > Message actions",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "conversation.delete_conversations",+ name: "Delete Conversations",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Remove existing conversation threads from the app.",+ how_to: "Conversations > Thread actions",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "conversation.terminal_chat",+ name: "Tabbed Terminal UI",+ domain: "tui",+ category: CapabilityCategory::Conversation,+ description: "Operate OpenHuman from a terminal through four tabs: live core logs, \+ orchestrator chat, safe configuration, and account settings. The standalone \+ `openhuman-tui` executable owns this interface. The chat streams replies, \+ thinking, and tools live.",+ how_to: "Run `openhuman-tui`. Use Tab/Shift+Tab or Alt+1-4 \+ to switch Logs, Chat, Config, and Settings. `--thread <id>` resumes a chat and \+ `--new` starts one. Settings accepts a one-time login token and supports account \+ refresh and logout.",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "conversation.suggested_questions",+ name: "Suggested Questions",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Offer prompt suggestions to help continue a conversation.",+ how_to: "Home or Conversations > Suggested prompts",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "conversation.tool_execution_timeline",+ name: "Tool Execution Timeline",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Show the sequence of tool calls and actions used to answer a request.",+ how_to: "Conversations > Tool timeline",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "conversation.plan_review",+ name: "Plan Review",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Pause an interactive turn for review whenever the assistant proposes a thread-scoped plan (a multi-step to-do list with its objective). Review the whole plan once above the composer, then Approve to run it, Reject to discard it, or send feedback to have the assistant revise and re-propose — nothing executes until you approve. Background and scheduled runs are never gated.",+ how_to: "Conversations > review the plan card above the composer when the assistant lays out a multi-step plan",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "conversation.subagent_mascots",+ name: "Subagent Mascots",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Show delegated sub-agents as colored mascots with compact activity bubbles and running, completed, or failed states.",+ how_to: "Human > ask the assistant to delegate work to sub-agents",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "intelligence.vision_subagent",+ name: "Vision Sub-agent",+ domain: "agent",+ category: CapabilityCategory::Intelligence,+ description: "Delegate image / screenshot understanding to a dedicated vision sub-agent — describe, OCR, read charts/diagrams, compare images, or locate UI elements. Rides the multimodal `vision-v1` tier so attached images are always analyzed.",+ how_to: "Attach an image in chat, or ask the assistant to look at a screenshot / image file",+ status: CapabilityStatus::Beta,+ privacy: IMAGE_TO_BACKEND,+ },+{+ id: "intelligence.image_generation",+ name: "Image Generation",+ domain: "agent",+ category: CapabilityCategory::Intelligence,+ description: "Delegate image creation to a dedicated image sub-agent — generate images from a text prompt, or edit/restyle reference images, using hosted GMI models (Seedream / SeedEdit). Results are saved to the workspace.",+ how_to: "Ask the assistant to generate, draw, or edit an image",+ status: CapabilityStatus::Beta,+ privacy: MEDIA_GEN_TO_BACKEND,+ },+{+ id: "intelligence.video_generation",+ name: "Video Generation",+ domain: "agent",+ category: CapabilityCategory::Intelligence,+ description: "Delegate short-video creation to a dedicated video sub-agent — text-to-video or animate a reference image using hosted GMI models (Seedance / Veo). Generation is asynchronous; the finished clip is saved to the workspace.",+ how_to: "Ask the assistant to generate a video or animate an image",+ status: CapabilityStatus::Beta,+ privacy: MEDIA_GEN_TO_BACKEND,+ },+{+ id: "conversation.label_filter",+ name: "Thread Label Filters",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "Filter the thread list by label (Work, Briefing, Notification) using the tab bar at the top of the thread list.",+ how_to: "Conversations > Label tabs",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "intelligence.analyze_actionable_items",+ name: "Analyze Actionable Items",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Extract and summarize actionable items from your activity and conversations.",+ how_to: "Intelligence",+ status: CapabilityStatus::Stable,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "intelligence.filter_actionable_items",+ name: "Filter Actionable Items",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Search and filter actionable items to focus on what matters now.",+ how_to: "Intelligence > Filters and search",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "intelligence.mark_actionable_item_complete",+ name: "Mark Items Complete",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Mark an actionable item as completed.",+ how_to: "Intelligence > Item actions",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "intelligence.dismiss_actionable_item",+ name: "Dismiss Items",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Dismiss irrelevant or already handled actionable items.",+ how_to: "Intelligence > Item actions",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "intelligence.snooze_actionable_item",+ name: "Snooze Items",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Temporarily hide an actionable item until later.",+ how_to: "Intelligence > Item actions",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "intelligence.undo_action",+ name: "Undo Item Actions",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Undo a recent complete, dismiss, or snooze action.",+ how_to: "Intelligence > Undo snackbar or item history",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "intelligence.agentmemory_backend",+ name: "agentmemory Memory Backend",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Opt-in Memory trait backend that delegates every store/recall/get/list/forget \+ call to a locally-running agentmemory REST server. Selected via \+ `memory.backend = \"agentmemory\"` in config.toml. Allows users who self-host \+ agentmemory across Claude Code, Cursor, Codex, and OpenCode to share a single durable \+ memory store. Default backend remains sqlite; selecting agentmemory is non-breaking.",+ how_to: "Set `memory.backend = \"agentmemory\"` in config.toml. \+ See gitbooks/features/obsidian-wiki/agentmemory-backend.md for setup and config keys.",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "intelligence.memory_workspace",+ name: "Memory Workspace",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Inspect or debug the app's memory workspace and stored knowledge.",+ how_to: "Settings > Memory Debug",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "intelligence.agents_md_instructions",+ name: "AGENTS.md Project Instructions",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Load configurable standing instructions from AGENTS.md files into the agent's \+ system prompt — OpenHuman's analog of Claude Code's CLAUDE.md / Codex's AGENTS.md. Two \+ layers are read once at session start: a global layer from the OpenHuman workspace \+ (<workspace_dir>/AGENTS.md) and a project layer from the folder the agent is operating \+ in (<action_dir>/AGENTS.md, or a sub-agent's isolated worktree). The global layer is \+ injected first, the project layer second (project instructions take precedence). \+ Missing or empty files are silently skipped, and each layer is capped so a large file \+ can't crowd out the rest of the prompt. On by default; disable via \+ `agent.agents_md_enabled = false`.",+ how_to: "Create an AGENTS.md file in your OpenHuman workspace and/or your project's action \+ directory. Toggle off with `agent.agents_md_enabled = false` in config.toml.",+ status: CapabilityStatus::Stable,+ privacy: AGENTS_MD_TO_INFERENCE_PROVIDER,+ },+{+ id: "intelligence.tool_scoped_memory",+ name: "Tool-Scoped Memory Rules",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Store durable, tool-specific rules and corrections that survive context \+ compression. Critical-priority rules (e.g. 'never email Sarah') are pinned into the \+ system prompt at session start. Captured automatically from user edicts and repeated \+ tool failures; also writable programmatically via the memory.tool_rule_* RPC surface.",+ how_to: "Automatic — user edicts are captured after every turn. Manage via \+ memory.tool_rule_put / memory.tool_rule_list / memory.tool_rule_delete (RPC).",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "intelligence.long_term_goals",+ name: "Long-term Goals",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "An editable list of the assistant's durable long-term goals for working with \+ you, stored locally in MEMORY_GOALS.md (capped ~500 tokens). A background goals agent \+ keeps the list fresh: it runs when the conversation context is summarized, and on first \+ run populates initial goals from context. Items can be added/edited/deleted explicitly \+ via RPC or agent tools.",+ how_to: "Automatic — refreshed on context summarization. Manage via \+ memory_goals.list / memory_goals.add / memory_goals.edit / memory_goals.delete / \+ memory_goals.reflect (RPC), or the goals_* agent tools.",+ status: CapabilityStatus::Beta,+ // Enrichment runs a cloud agentic model, so goal/context text can leave+ // the device during a reflect pass (CRUD/storage stays local).+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "conversation.thread_goal",+ name: "Thread Goal",+ domain: "conversation",+ category: CapabilityCategory::Conversation,+ description: "A single, thread-scoped goal (Codex-style \"completion contract\") the \+ assistant keeps pursuing across turns, interrupts, resumes, and budget boundaries — \+ distinct from the long-term goals list and the per-thread task board. Stored locally \+ (one goal per thread), with a lifecycle (active/paused/budget_limited/complete) and an \+ optional token budget. The active goal is injected into context each turn; the context \+ scout proposes a goal on a fresh thread (only if none is set) and the orchestrator can \+ set/refine it. When enabled, idle threads can autonomously continue toward the goal.",+ how_to: "Set/edit via the goal chip above the composer in Conversations, or the \+ thread_goals.* RPC (get/set/complete/pause/resume/clear); the assistant manages it via \+ the goal_set / goal_get / goal_complete tools. Autonomous continuation is opt-in via \+ heartbeat.goal_continuation_enabled.",+ status: CapabilityStatus::Beta,+ // Goal CRUD/storage is local; autonomous continuation (opt-in) runs a+ // cloud agentic model, so objective/context can leave the device then.+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "intelligence.memory_tree_retrieval",+ name: "Memory Tree Retrieval (chat)",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Ask questions about your ingested email/chat/document memory in chat. The orchestrator can resolve names to canonical ids, query summaries by source/topic/global window, drill into details, and cite raw chunks.",+ how_to: "Chat > ask the assistant about people, conversations, or windows",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "intelligence.memory_pipeline_doctor",+ name: "Memory Pipeline Doctor",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Diagnose why the memory tree / wiki is empty or stalled. Walks each pipeline stage (embeddings config, scheduler gate, job queue, extraction/recall degradation, summary-tree precondition) and reports the single first blocking cause with an actionable fix, plus counters and extraction coverage. The agent can run it on itself; a typed 'first blocking cause' is surfaced in the Memory status panel, and jobs that failed under a now-fixed config can be requeued on demand via the `memory_tree_retry_failed` RPC.",+ how_to: "Memory status panel shows the cause + fix; or ask the agent to diagnose memory; or `openhuman-core` RPC `memory_tree_doctor`",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "intelligence.github_repo_memory_source",+ name: "GitHub Repo Memory Source",+ domain: "memory_sources",+ category: CapabilityCategory::Intelligence,+ description: "Sync a GitHub repository's project activity — commits, issues, and \+ pull requests (not source code) — into your memory. Items are archived verbatim \+ under a browsable, repo-grouped vault layout \+ (raw/github-com-<owner>-<repo>/{commits,issues,prs}/) and ingested into the \+ memory tree for recall. Contributors are surfaced as @handle entities, and \+ commit messages plus closed/merged issues & PRs get a priority boost so \+ high-signal history leads at summary time. Pulls up to 2000 items of each type \+ per sync by default, overridable per source via max_commits / max_issues / \+ max_prs.",+ how_to: "Settings > Memory & Data > Memory Sources — add a GitHub repository URL. \+ Programmatic: openhuman.memory_sources_add (RPC).",+ status: CapabilityStatus::Beta,+ privacy: GITHUB_REPO_SOURCE,+ },+{+ id: "intelligence.memory_source_sync_controls",+ name: "Memory Source Sync Defaults & Controls",+ domain: "memory_sources",+ category: CapabilityCategory::Intelligence,+ description: "Connected memory sources are enabled by default with conservative, \+ per-kind sync caps so the first sync stays cheap (e.g. Gmail ~100 recent emails, \+ GitHub repo 10 PRs / 10 issues / 50 commits, RSS 20 items). Each source row exposes \+ an inline settings panel to adjust the limit fields that apply to its kind \+ (max_items, sync_depth_days, max_prs/issues/commits, since_days). \+ An \"All In\" action enables every source and removes the caps to build the richest \+ memory graph, then triggers a full sync. Already-connected sources are migrated to \+ the new defaults once.",+ how_to: "Intelligence > Memory Sources — toggle a source, open its gear for per-source \+ limits, or use \"All In\". Programmatic: openhuman.memory_sources_update and \+ openhuman.memory_sources_apply_all_in (RPC).",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "intelligence.coding_session_memory",+ name: "Coding-Agent Session Memory",+ domain: "memory_sources",+ category: CapabilityCategory::Intelligence,+ description: "Discover local Codex and Claude Code session histories, retain only human-authored decisions and corrections, and distill them into a durable TinyCortex persona memory pack. Tool output, reasoning, developer prompts, and subagent traffic are excluded before inference.",+ how_to: "Brain > Sources > Coding-agent sessions > Ingest new sessions. Programmatic: openhuman.memory_sources_coding_session_status and openhuman.memory_sources_ingest_coding_sessions (RPC).",+ status: CapabilityStatus::Beta,+ privacy: CODING_SESSION_TO_BACKEND,+ },+{+ id: "intelligence.memory_sync_schedule",+ name: "Memory Sync Schedule",+ domain: "config",+ category: CapabilityCategory::Intelligence,+ description: "Pick a single global cadence for how often all opted-in memory sources \+ auto-sync, presented like a backup schedule (\"Last synced … · Sync every …\"). \+ Presets are every 4h / 12h / 24h, plus \"Manual only\" which disables background \+ auto-sync entirely (you can still sync on demand). The chosen interval overrides each \+ provider's built-in cadence but is floored at it, so syncs never run more often than \+ the provider intends — handy for keeping credit spend predictable. Unset defaults to \+ every 24h.",+ how_to: "Intelligence > Memory Sources — choose a Sync every… preset or Manual only. \+ Programmatic: openhuman.config_get_memory_sync_settings / \+ openhuman.config_update_memory_sync_settings (RPC); ops override via the \+ OPENHUMAN_MEMORY_SYNC_INTERVAL_SECS env var (0 = manual).",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "intelligence.embedding_provider_config",+ name: "Configure Embedding Provider",+ domain: "embeddings",+ category: CapabilityCategory::Intelligence,+ description:+ "Pick which embedding provider drives semantic search across your memory: \+ managed cloud (default, Voyage-backed via api.tinyhumans.ai), OpenAI, \+ Cohere, local Ollama, or a custom OpenAI-compatible endpoint. API keys \+ are stored encrypted via the local keyring under `embeddings:<slug>`; \+ model name and embedding dimensions are tunable per provider. The \+ legacy `inference_embed` RPC is aliased to `embeddings_embed` so \+ existing callers continue to work.",+ how_to: "Connections → API keys → Embeddings",+ status: CapabilityStatus::Beta,+ // Privacy depends on the selected provider — see+ // `intelligence.embedding_provider_test` for the per-provider data+ // destinations. The configuration surface itself only writes to the+ // local keyring and config, so leaving this `None` (treat-as-unknown)+ // would under-report; we annotate the credential side here and the+ // network side on the test action.+ privacy: LOCAL_CREDENTIALS,+ },+{+ id: "intelligence.embedding_provider_test",+ name: "Test Embedding Provider",+ domain: "embeddings",+ category: CapabilityCategory::Intelligence,+ description:+ "Verify a configured embedding provider before committing it to \+ memory ingestion. Sends a small one-shot embed request and reports \+ the model, dimensions, and any auth/error surface so a \+ misconfigured key doesn't get discovered halfway through a 50k \+ chunk backfill.",+ how_to: "Connections → API keys → Embeddings → Test Connection",+ // The probe payload routes to whichever provider the user has+ // selected — managed cloud (default), OpenAI, Cohere, or a custom+ // OpenAI-compatible endpoint. Using `DERIVED_TO_BACKEND` here would+ // under-report by only listing the managed path; the dedicated+ // constant enumerates every reachable destination so the Privacy+ // surface renders the full set.+ status: CapabilityStatus::Beta,+ privacy: EMBEDDING_PROBE_TO_CONFIGURED_PROVIDER,+ },+{+ id: "intelligence.mcp_server",+ name: "MCP Server",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Expose a curated OpenHuman tool surface over stdio MCP or Streamable HTTP/SSE for MCP-compatible clients.",+ how_to: "Run `openhuman-core mcp` (stdio) or `openhuman-core mcp --transport http --port 9300` for remote clients.",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "intelligence.searxng_search",+ name: "SearXNG Search",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Search a configured self-hosted SearXNG instance from agent and MCP tools, returning normalized title, URL, snippet, and source results.",+ how_to: "Set `[searxng] enabled = true` and `base_url` in config.toml, or use OPENHUMAN_SEARXNG_* environment variables.",+ status: CapabilityStatus::Beta,+ privacy: SEARXNG_RAW_TO_CONFIGURED_INSTANCE,+ },+{+ id: "intelligence.tool_registry",+ name: "Tool Registry",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Discover OpenHuman's MCP stdio tools and controller-backed tools from one local registry, including versions, routes, input/output schemas, allowed agents, and health state.",+ how_to: "Call openhuman.tool_registry_list over core JSON-RPC, or openhuman.tool_registry_get with a tool_id such as memory.search.",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "intelligence.orchestrator_worker_thread",+ name: "Worker Thread Delegation",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "When a delegated sub-task is long or complex, the orchestrator can route it into a fresh worker-labeled conversation thread instead of flooding the parent thread. The user opens the worker thread from the thread list (or via the reference card in the parent) to read the sub-agent's full transcript.",+ how_to: "Conversations > tap the worker reference card in the parent thread, or open the worker-labeled thread from the thread list",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "intelligence.workflow_orchestration",+ name: "Workflow Orchestration",+ domain: "workflow_runs",+ category: CapabilityCategory::Intelligence,+ description: "Run declarative multi-agent workflows such as parallel research with cross-checking: a question is decomposed into angles, researched in parallel, adversarially cross-checked, and synthesized into one cited report. Watch each phase progress with its child agent results, stop or resume a run, and read the final synthesis. High-cost / high-concurrency runs require explicit approval before starting.",+ how_to: "Intelligence > Orchestration > pick a workflow and Start",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "intelligence.agent_library",+ name: "Agents Library",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Browse safe display metadata for registered agent definitions, compare worker capabilities, and start a one-off task with an explicitly selected agent.",+ how_to: "Intelligence > Agent Tasks > Agents Library",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "intelligence.worktree_manager",+ name: "Agent Worktrees",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Inspect and clean up the isolated git worktrees that parallel sub-agents check out under <repo>/.claude/worktrees. Each row shows the worktree's branch, dirty state, and changed files, plus a cross-worktree overlap warning when two workers touched the same file. Open, diff, or remove a worktree (a dirty worktree requires an explicit discard confirmation; the worker branch is preserved).",+ how_to: "Intelligence > Worktrees",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "intelligence.slack_memory_ingest",+ name: "Slack Memory Ingestion",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Backfill the last 6 days of Slack history into the memory tree and keep it up to date by flushing each closed 6-hour UTC bucket. Driven by an authenticated Slack connection (OAuth via Composio).",+ how_to: "Connections > OAuth > Slack",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "intelligence.clickup_memory_ingest",+ name: "ClickUp Memory Ingestion",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Incrementally sync ClickUp tasks assigned to the authenticated user into the Memory Tree on a 30-minute cadence, with an initial backfill on first connect. Only tasks the user is directly assigned to are ingested. Driven by an authenticated ClickUp connection (OAuth via Composio).",+ how_to: "Connections > OAuth > ClickUp",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "intelligence.notifications_dismiss",+ name: "Dismiss Notifications",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Dismiss low-value notifications from the intelligence inbox.",+ how_to: "Notifications > Item actions",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "intelligence.notifications_mark_acted",+ name: "Mark Notifications Acted",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Mark a notification as acted upon after taking follow-up action.",+ how_to: "Notifications > Item actions",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "intelligence.notifications_stats",+ name: "View Notification Stats",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "View aggregate unread, unscored, and provider/action notification stats.",+ how_to: "Notifications > Summary cards",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "intelligence.remember_preferences",+ name: "Remember Preferences",+ domain: "memory",+ category: CapabilityCategory::Intelligence,+ description: "Remember preferences you state in chat and apply them automatically — \+ general preferences shape every reply (tone, language, standing habits); \+ situational ones surface only when relevant to your current message.",+ how_to: "State a preference in chat, e.g. \"always reply in British English\" or \+ \"when writing Rust, prefer Result over unwrap\".",+ status: CapabilityStatus::Stable,+ privacy: LOCAL_RAW,+ },+];diff --git a/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs b/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rsnew file mode 100644index 0000000000..4c94c6880e--- /dev/null+++ b/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs@@ -0,0 +1,428 @@+//! LocalAI, Settings, and Mobile capability entries.++use super::*;++pub(super) const CAPABILITIES: &[Capability] = &[+{+ id: "local_ai.download_model",+ name: "Download Local Models",+ domain: "local_ai",+ category: CapabilityCategory::LocalAI,+ description: "Download and bootstrap local AI runtimes and model bundles.",+ how_to: "Settings > Local AI Model",+ status: CapabilityStatus::Beta,+ privacy: MODEL_DOWNLOAD,+ },+{+ id: "local_ai.configure_provider",+ name: "Configure Local Provider",+ domain: "local_ai",+ category: CapabilityCategory::LocalAI,+ description: "Select Ollama, LM Studio, MLX, or a generic local OpenAI-compatible server as the local model provider and configure the endpoint.",+ how_to: "Connections → API keys → LLM, or use provider strings: ollama:<model>, lmstudio:<model>, mlx:<model>, local-openai:<model>",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "local_ai.manage_model_assets",+ name: "Manage Model Assets",+ domain: "local_ai",+ category: CapabilityCategory::LocalAI,+ description: "Inspect asset status and download specific chat, vision, embedding, STT, or TTS assets.",+ how_to: "Settings > Local AI Model > Advanced > Capability Assets",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "local_ai.model_context_check",+ name: "Model Context Requirement Check",+ domain: "local_ai",+ category: CapabilityCategory::LocalAI,+ description: "Diagnostics report each installed Ollama model's native context window and reject any model below the minimum the memory layer requires (so short-context models can't silently truncate and corrupt recall).",+ how_to: "Settings > Local AI Model > Run Diagnostics",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "local_ai.embed_text",+ name: "Generate Text Embeddings",+ domain: "local_ai",+ category: CapabilityCategory::LocalAI,+ description: "Create local vector embeddings for text input.",+ how_to: "Settings > Local AI Model > Advanced > Test Embeddings",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "local_ai.text_to_speech",+ name: "Text to Speech (Local)",+ domain: "local_ai",+ category: CapabilityCategory::LocalAI,+ description:+ "Synthesize speech locally with Piper via the voice TTS factory. PIPER_BIN points \+ at the binary; the voice .onnx ships with the installer. Returns a synthetic \+ viseme timeline (full forced-alignment lives behind the cloud provider for now).",+ how_to: "Settings > Voice > TTS Provider = Piper",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "local_ai.vision_processing",+ name: "Vision Processing",+ domain: "local_ai",+ category: CapabilityCategory::LocalAI,+ description: "Run vision prompts against images using a local multimodal model.",+ how_to: "Settings > Local AI Model > Advanced > Test Vision Prompt",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "local_ai.direct_prompting",+ name: "Direct Model Prompting",+ domain: "local_ai",+ category: CapabilityCategory::LocalAI,+ description: "Send a direct prompt to the local model without using the cloud API.",+ how_to: "Settings > Local AI Model > Advanced > Test Custom Prompt",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "local_ai.piper_installer",+ name: "Piper Installer (Local TTS)",+ domain: "local_ai",+ category: CapabilityCategory::LocalAI,+ description:+ "One-click download of the Piper binary archive and the bundled en_US-lessac-medium \+ voice (.onnx + .onnx.json) into the workspace so local Text-to-Speech runs without \+ manual setup. Atomic rename guarantees no half-written voice files are ever read \+ by the runtime.",+ how_to: "Settings > Voice > Voice Providers > Install Piper",+ status: CapabilityStatus::Beta,+ privacy: MODEL_DOWNLOAD,+ },+{+ id: "local_ai.python_runtime_installer",+ name: "Managed Python Runtime",+ domain: "runtime_python",+ category: CapabilityCategory::LocalAI,+ description:+ "Download and reuse an OpenHuman-managed CPython runtime for Python-backed local integrations such as MCP servers, with a system-Python override reserved for development.",+ how_to: "Configured by the core `runtime_python` module; future UI surfaces can expose install state and overrides.",+ status: CapabilityStatus::Beta,+ privacy: MODEL_DOWNLOAD,+ },+{+ id: "settings.configure_ai",+ name: "Configure AI",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Configure managed, local, custom, and built-in BYOK LLM providers, including SumoPod and other OpenAI-compatible gateways, plus per-workload routing preferences.",+ how_to: "Connections → API keys → LLM",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "settings.core_connection",+ name: "Run the Core Somewhere Else",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Choose where the OpenHuman core runs: inside this app, at a URL \+ you point it at, in a Docker container, on another machine over SSH, or in a \+ container on another machine. OpenHuman starts the core, connects to it, and \+ shuts it down when you switch away. Where it runs and what contains it are \+ separate choices, so SSH and Docker combine without being a third option.",+ how_to: "Settings > Core connection",+ status: CapabilityStatus::Beta,+ privacy: Some(CapabilityPrivacy {+ leaves_device: true,+ data_kind: PrivacyDataKind::Raw,+ // `Raw`, because everything the core holds - the conversations+ // themselves, memory, stored credentials - lives wherever the core+ // runs. Choosing a machine over SSH is choosing to put all of it+ // there. That is the disclosure that matters here and the one a+ // hostname field makes easy to overlook, so it is stated at the+ // strongest kind rather than softened to `Derived`.+ destinations: &["The machine you configure, when the core runs off this device"],+ }),+ },+{+ id: "settings.persona_pack",+ name: "Persona Pack",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Personalize the assistant across one or more agent profiles: set a display name and description, edit or reset each profile's SOUL.md identity (kept in its own home under personalities/<id>/ and re-read every message), give a profile its own dedicated memory subtree or its own working directory, drop private skills under personalities/<id>/skills/ that only that profile can discover, attribute a scheduled cron job to a profile so it runs with that profile's identity, memory, and permissions, and reach mascot avatar and voice settings. Multiple profiles can run with isolated identity, memory, skills, and workspace state.",+ how_to: "Settings > Persona",+ status: CapabilityStatus::Beta,+ privacy: GITHUB_MASCOT_MANIFEST,+ },+{+ id: "settings.manage_privacy_analytics",+ name: "Manage Privacy and Analytics",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Control privacy, analytics, and related data handling preferences. \+ When enabled, anonymous crash reports are sent to Sentry and anonymous usage \+ analytics (page views, feature engagement) are sent to Google Analytics. \+ No personal data, messages, or credentials are ever included.",+ how_to: "Settings > Privacy (direct route)",+ status: CapabilityStatus::Stable,+ privacy: DIAGNOSTICS_TO_BACKEND,+ },+{+ id: "settings.view_billing",+ name: "View Billing",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Open subscription, included usage, and pay-as-you-go billing views for your active team.",+ how_to: "Settings > Billing & Usage",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "settings.manage_subscription_plan",+ name: "Manage Subscription Plan",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Upgrade plans or open the billing portal to manage subscription-backed usage tiers.",+ how_to: "Settings > Billing & Usage",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "settings.manage_credits",+ name: "Manage Credits",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "View pay-as-you-go credit balances, top up overage credits, and configure auto-recharge.",+ how_to: "Settings > Billing & Usage",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "settings.add_payment_methods",+ name: "Add Payment Methods",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Add or manage saved payment methods for billing and auto-recharge.",+ how_to: "Settings > Billing & Usage > Payment Methods",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "settings.developer_options",+ name: "Developer Options",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Open developer-focused panels for diagnostics, workflows, AI config, and memory tools.",+ how_to: "Settings > Developer Options",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "settings.debug_webhooks",+ name: "Debug Webhooks",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description:+ "Inspect Composio trigger history and find the daily JSONL archive files stored by the app.",+ how_to: "Settings > Developer Options > Webhooks",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "settings.manage_service",+ name: "Manage Desktop Service",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Install, start, stop, restart, uninstall, or inspect the optional desktop background service.",+ how_to: "Settings > Developer Options > Tauri Commands",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "settings.clear_app_data",+ name: "Log Out and Clear App Data",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Sign out and permanently clear local app data, including workflow data.",+ how_to: "Settings > Log Out & Clear App Data",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "settings.delete_all_data",+ name: "Delete All Data",+ domain: "settings",+ category: CapabilityCategory::Settings,+ description: "Delete all local data and reset the app from the destructive settings section.",+ how_to: "Settings > Delete All Data",+ status: CapabilityStatus::ComingSoon,+ privacy: None,+ },+{+ id: "mobile.device_pairing",+ name: "Device Pairing",+ domain: "devices",+ category: CapabilityCategory::Mobile,+ description: "Pair iOS phones with the desktop core via QR code. The desktop generates a \+ short-lived pairing token; the iOS app scans the QR, completes an X25519 \+ key agreement, and stores the session for reconnects.",+ how_to: "Settings > Devices > Pair iPhone",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "mobile.ios_client",+ name: "iOS Client",+ domain: "devices",+ category: CapabilityCategory::Mobile,+ description: "iOS app for chatting with your assistant on the go. Connects to the desktop \+ core via LAN HTTP, an E2E-encrypted socket.io tunnel, or a cloud HTTP \+ fallback — no Rust core ships on the device.",+ how_to: "Pair via Settings > Devices, then open the OpenHuman iOS app.",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "mobile.push_to_talk",+ name: "Push-to-Talk",+ domain: "devices",+ category: CapabilityCategory::Mobile,+ description: "Hold-to-talk voice input on iOS. Activates AVAudioEngine and \+ SFSpeechRecognizer on the device; partial transcripts appear while \+ speaking and the final transcript is sent as a chat message.",+ how_to: "Hold the microphone button on the iOS mascot screen.",+ status: CapabilityStatus::Beta,+ privacy: Some(CapabilityPrivacy {+ leaves_device: false,+ data_kind: PrivacyDataKind::Raw,+ destinations: &[],+ }),+ },+{+ id: "update.check",+ name: "Check for Core Updates",+ domain: "update",+ category: CapabilityCategory::Settings,+ description: "Query GitHub Releases to see if a newer core binary is available. \+ Available to the orchestrator agent as the `update_check` tool so the \+ user can ask 'am I up to date?' in chat.",+ how_to: "Settings > Developer Options > Check for Updates, or ask the orchestrator in chat.",+ status: CapabilityStatus::Beta,+ privacy: GITHUB_RELEASES_METADATA,+ },+{+ id: "update.apply",+ name: "Apply Core Update",+ domain: "update",+ category: CapabilityCategory::Settings,+ description: "Download and stage a newer core binary. Desktop builds can self-restart; \+ headless deployments can hand restart off to a supervisor. Exposed to \+ the orchestrator agent as the `update_apply` tool, gated behind explicit \+ user consent (the agent must confirm via `ask_user_clarification` before \+ invoking) and the `config.update.rpc_mutations_enabled` policy switch.",+ how_to: "Settings > Developer Options > Apply Update, or confirm an in-chat update prompt from the orchestrator.",+ status: CapabilityStatus::Beta,+ privacy: GITHUB_RELEASES_METADATA,+ },+{+ id: "filesystem.access_mode",+ name: "Agent OS Access Mode",+ domain: "security",+ category: CapabilityCategory::Settings,+ description: "Choose how much filesystem and shell access the agent has: Read-Only, \+ Workspace, Trusted Roots (grant specific folders outside the workspace), \+ or Full Access. Credential stores stay blocked in every mode.",+ how_to: "Settings → Agent OS access",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "agent.action_timeout",+ name: "Action Timeout",+ domain: "agent",+ category: CapabilityCategory::Settings,+ description: "Set how long a single tool or action may run before it is cancelled \+ (1–3600 seconds, default 120). Increase it when a large local model is \+ interrupted before finishing its response. Applies to the next tool call \+ without a restart; the OPENHUMAN_TOOL_TIMEOUT_SECS env var still overrides it.",+ how_to: "Settings → Agent OS access → Action timeout",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "security.always_allow_tool",+ name: "Always Allow a Tool",+ domain: "security",+ category: CapabilityCategory::Settings,+ description: "On an approval prompt, choose \"Always allow\" to stop being asked for that \+ tool. The choice is saved to your allow-list and persists across restarts; \+ remove it any time under Settings → Agent OS access to be prompted again. \+ Policy still blocks forbidden paths and high-risk commands regardless.",+ how_to: "Click \"Always allow\" on an approval prompt; manage the list in Settings → Agent OS access.",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "security.approval_history",+ name: "Approval History",+ domain: "security",+ category: CapabilityCategory::Settings,+ description: "Review a read-only audit trail of past tool-approval decisions \+ (Approve once / Always allow / Deny), newest first. Summaries are \+ scrubbed of chat content and arguments are shown as redacted shape only.",+ how_to: "Settings → Agent OS access → View approval history",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "tool.detect_tools",+ name: "Detect Installed Tools",+ domain: "tools",+ category: CapabilityCategory::Settings,+ description: "Probe the host PATH to report which developer tools and language \+ runtimes are installed (node, python, cargo, docker, git, …).",+ how_to: "Used by the agent automatically; gated by the tool toggle list.",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "tool.install_tool",+ name: "Install OS Packages",+ domain: "tools",+ category: CapabilityCategory::Settings,+ description: "Install OS or language packages (apt/dnf/brew/winget/pipx/npm/cargo). \+ High impact: only available when Full access / tool installation is enabled.",+ how_to: "Enable in Settings → Agent OS access (Full access mode).",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "security.action_sandbox",+ name: "Action Sandbox",+ domain: "security",+ category: CapabilityCategory::Settings,+ description: "Dedicated action directory for agent tools (shell, file, git), separate \+ from internal application state. Agent tools default their working directory \+ and path resolution to the action sandbox, preventing accidental modification \+ of memory databases, session transcripts, tokens, and other internal state.",+ how_to: "Settings → Agent OS access",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "security.sandbox_backends",+ name: "Sandbox Execution Backends",+ domain: "security",+ category: CapabilityCategory::Settings,+ description: "Route agent tool execution (shell, filesystem, process) through sandbox \+ backends — Docker containers or OS-level jails (Landlock/Seatbelt) — for \+ reduced blast radius on remote, channel, cron, or background sessions. \+ Configurable per agent/session/channel with safe defaults for non-main sessions.",+ how_to: "Set sandbox_mode = \"sandboxed\" in agent.toml, or configure runtime.kind = \+ \"docker\" in the TOML config. Use openhuman.sandbox_status / \+ openhuman.sandbox_resolve_policy RPC to inspect.",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+];diff --git a/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rs b/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rsnew file mode 100644index 0000000000..49edf119f2--- /dev/null+++ b/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rs@@ -0,0 +1,307 @@+//! Workflows and Automation capability entries.++use super::*;++pub(super) const CAPABILITIES: &[Capability] = &[+{+ id: "workflows.discover",+ name: "Discover Workflows",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "Browse available workflows that can extend the app.",+ how_to: "Intelligence > Workflows",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "workflows.install",+ name: "Install Workflows",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "Install a workflow into the local workspace.",+ how_to: "Intelligence > Workflows > Install",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "workflows.configure",+ name: "Configure Workflows",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "Open workflow setup and update workflow-specific configuration.",+ how_to: "Intelligence > Workflows > Setup or Connections",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "workflows.connection_status",+ name: "Monitor Workflow Connection Status",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "See whether a workflow-backed integration is connected, offline, or needs setup.",+ how_to: "Intelligence > Workflows or Connections",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "workflows.sync_manual",+ name: "Manually Sync Workflow Data",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "Trigger a manual data sync for a workflow integration.",+ how_to: "Intelligence > Workflows > Workflow card > Sync",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "workflows.tinyfish_web_automation",+ name: "TinyFish Web Automation",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description:+ "Search the web, render JavaScript-heavy pages, and run goal-based browser automations through TinyFish.",+ how_to: "Conversations > Ask the assistant to search, fetch, or automate a website with TinyFish",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "workflows.toggle_enabled",+ name: "Enable or Disable Workflows",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "Turn individual workflows on or off without uninstalling them.",+ how_to: "Settings > Developer Options > Workflows",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "workflows.open_connections_hub",+ name: "Open Connections Hub",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "Browse the dedicated connections hub for external workflow-backed integrations.",+ how_to: "Connections",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "composio.direct_mode",+ name: "Composio Direct Mode (BYO API Key)",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description:+ "Route Composio tool calls directly to backend.composio.dev with your own API key, \+ bypassing the OpenHuman backend proxy. Tool execution only — trigger webhooks still \+ require backend mode.",+ how_to: "Settings > Skills > Composio > Direct mode",+ status: CapabilityStatus::Beta,+ privacy: COMPOSIO_DIRECT_CREDENTIALS,+ },+{+ id: "composio.direct_mode_triggers_gap",+ name: "Composio Triggers (Direct Mode — Limited)",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description:+ "Composio real-time trigger webhooks (Gmail new-message, Slack new-message, …) \+ currently arrive over wss://api.tinyhumans.ai/socket.io and require backend mode. \+ Direct-mode users get synchronous tool execution but not async trigger push in \+ this release.",+ how_to: "Switch to Backend mode to receive triggers, or wait for the direct trigger sink follow-up",+ status: CapabilityStatus::ComingSoon,+ privacy: None,+ },+{+ id: "workflows.connect_google",+ name: "Connect Google",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "Connect Google services for email, contacts, and calendar workflows.",+ how_to: "Connections > OAuth",+ status: CapabilityStatus::ComingSoon,+ privacy: LOCAL_CREDENTIALS,+ },+{+ id: "workflows.connect_notion",+ name: "Connect Notion",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "Connect Notion for workspace sync and productivity workflows.",+ how_to: "Connections > OAuth",+ status: CapabilityStatus::ComingSoon,+ privacy: LOCAL_CREDENTIALS,+ },+{+ id: "workflows.connect_web3_wallet",+ name: "Connect Web3 Wallet",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "Set up local EVM, BTC, Solana, and Tron wallet identities from one recovery phrase.",+ how_to: "Settings > Crypto > Recovery Phrase or Connections",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_CREDENTIALS,+ },+{+ id: "workflows.wallet_execution",+ name: "Wallet Execution Tools",+ domain: "wallet",+ category: CapabilityCategory::Workflows,+ description: "Read addresses and balances, prepare/confirm/execute native + token transfers (ERC20/SPL/TRC20/BEP20), and inspect transactions (status, receipt, lookup) across the connected wallet (EVM, BTC, Solana, Tron). Quote-first; signing stays local.",+ how_to: "Use wallet.* RPC methods (balances, prepare_transfer, execute_prepared, tx_status, tx_receipt, lookup_tx) via the agent or core_rpc_relay, or via Settings > Crypto > Wallet Balances.",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_CREDENTIALS,+ },+{+ id: "workflows.web3_defi",+ name: "Web3 Swaps & Bridges",+ domain: "web3",+ category: CapabilityCategory::Workflows,+ description: "Quote and execute cross-chain swaps and bridges (deBridge) plus generic EVM dapp contract calls, built on the local wallet's signing. EVM/Solana(/BTC); signing stays local.",+ how_to: "Use web3_swap.* / web3_bridge.* / web3_dapp.* RPC methods (quote/execute, web3_swap.routes) via the agent or core_rpc_relay.",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_CREDENTIALS,+ },+{+ id: "workflows.x402_payments",+ name: "x402 Machine Payments",+ domain: "x402",+ category: CapabilityCategory::Workflows,+ description: "Automatic HTTP 402 payment handling for machine-payable APIs via the x402 protocol. When an API returns 402 Payment Required, the agent pays with USDC on Solana using the local wallet and retries. Budget enforcement with per-request, daily, and monthly caps.",+ how_to: "Use x402.* RPC methods (get_summary, list_payments, update_budget) to manage spending. Payments happen automatically when the http_request tool encounters a 402 with a PAYMENT-REQUIRED header.",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_CREDENTIALS,+ },+{+ id: "workflows.connect_crypto_exchange",+ name: "Connect Crypto Exchange",+ domain: "workflows",+ category: CapabilityCategory::Workflows,+ description: "Connect supported exchanges for trading and portfolio workflows.",+ how_to: "Connections",+ status: CapabilityStatus::ComingSoon,+ privacy: None,+ },+{+ id: "automation.task_sources",+ name: "Task Sources",+ domain: "automation",+ category: CapabilityCategory::Automation,+ description: "Pull work items from GitHub, Notion, Linear, and ClickUp using per-source \+ filters, then enrich them onto the agent's todo board and (for proactive \+ sources) start an agent working on them.",+ how_to: "Settings > Task Sources",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "automation.discover_workflows",+ name: "Suggested Workflows (Flow Scout)",+ domain: "flows",+ category: CapabilityCategory::Automation,+ description: "A read-only discovery agent (\"Flow Scout\") reads your memory, past \+ conversations, known people, connected apps, and existing flows to figure \+ out which automations would actually help you, then proposes a handful of \+ concrete, buildable workflow suggestions. Each card explains why it was \+ suggested; \"Build this\" hands it to the workflow builder to author a real \+ flow you review and save. Discovery never creates, enables, or runs a flow.",+ how_to: "Flows > Suggested for you > Discover",+ status: CapabilityStatus::Beta,+ privacy: DERIVED_TO_BACKEND,+ },+{+ id: "automation.flow_memory_node",+ name: "Memory Node (Flows)",+ domain: "flows",+ category: CapabilityCategory::Automation,+ description: "A `memory` node inside a saved workflow graph, giving the flow direct, \+ in-graph memory access with no agent turn involved. It can recall/search/ \+ read style-flavour/look up people from your durable, cross-flow memory \+ (read-only — a flow can never write there) or from other flows' own \+ memory (also read-only), and can remember/forget entries in its OWN \+ private, flow-scoped memory namespace — never the user's personal memory, \+ never another flow's. Every operation is gated by the flow's autonomy \+ tier; a flow-scoped write can require human approval.",+ how_to: "Flows editor > add a `memory` node; set `config.operation` and `config.scope`.",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "automation.flow_dedup_node",+ name: "Dedup Node (Flows)",+ domain: "flows",+ category: CapabilityCategory::Automation,+ description: "A `dedup` node inside a saved workflow graph, giving the flow durable \+ exactly-once processing per item with no agent turn or extra plumbing \+ involved. It drops an item whose per-item key was already committed by a \+ prior successful run, and otherwise passes it through. Committing happens \+ automatically: keys the node passes through are marked done only once the \+ whole run finishes successfully; a failed/cancelled/interrupted/unknown (or \+ any other non-success) run leaves them unmarked so the same items retry next \+ time. Only the resolved per-item key value is stored, locally, in the flow's \+ own private, flow-scoped state — never the item's full content, and never \+ the user's personal memory. The key is whatever the workflow author's \+ `config.key` expression resolves to, so it can carry item-derived data if \+ keyed off a sensitive field — author flows to key off an opaque, \+ non-sensitive stable id (an issue number, message id, url) rather than \+ personal data.",+ how_to: "Flows editor > add a `dedup` node right after the item source; set config.key \+ to a stable per-item id expression, e.g. \"=item.id\".",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_RAW,+ },+{+ id: "automation.view_cron_jobs",+ name: "View Cron Jobs",+ domain: "automation",+ category: CapabilityCategory::Automation,+ description: "Review scheduled jobs available to the runtime.",+ how_to: "Settings > Cron Jobs",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "automation.set_job_intervals",+ name: "Set Job Intervals",+ domain: "automation",+ category: CapabilityCategory::Automation,+ description: "Configure how often a scheduled job should run.",+ how_to: "Settings > Cron Jobs",+ status: CapabilityStatus::Stable,+ privacy: None,+ },+{+ id: "automation.view_execution_history",+ name: "View Execution History",+ domain: "automation",+ category: CapabilityCategory::Automation,+ description: "Inspect past runs and results for scheduled jobs.",+ how_to: "Settings > Cron Jobs",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "automation.morning_briefing",+ name: "Morning Briefing",+ domain: "automation",+ category: CapabilityCategory::Automation,+ description: "Daily proactive agent that reviews calendar, tasks, emails, and market context to deliver a morning summary.",+ how_to: "Automatic after onboarding (runs daily at 7 AM). Adjust schedule via Settings > Cron Jobs.",+ status: CapabilityStatus::Beta,+ privacy: None,+ },+{+ id: "automation.crypto_agent",+ name: "Crypto Agent",+ domain: "automation",+ category: CapabilityCategory::Automation,+ description: "Dedicated wallet & market specialist sub-agent. The orchestrator \+ routes transfers, swaps, contract calls, balance lookups, and \+ exchange trading requests here. The agent enforces a read → \+ simulate → confirm → execute flow, refuses to fabricate chain ids \+ or token addresses, and gates every write call behind explicit \+ user confirmation.",+ how_to: "Automatic — invoked by the orchestrator when a crypto wallet or market action is requested. Connect a wallet via Settings > Recovery Phrase first.",+ status: CapabilityStatus::Beta,+ privacy: LOCAL_CREDENTIALS,+ },+];