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
feat(memory): add a disabled engine to turn memory off
Steven Enamakel0db1fc1db1d7
diff --git a/crates/openhuman-core/src/memory/engine.rs b/crates/openhuman-core/src/memory/engine.rsindex f65688f204..3c0dc94e11 100644--- a/crates/openhuman-core/src/memory/engine.rs+++ b/crates/openhuman-core/src/memory/engine.rs@@ -54,6 +54,10 @@ pub const TINYHUMANS_ENGINE: &str = tinymemory_integrations::cortex::TINYHUMANS_/// Engine id of CortexDB reached directly.pub const CORTEXDB_ENGINE: &str = tinymemory_integrations::cortex::CORTEXDB_ENGINE_ID;+/// Pseudo-engine id for memory turned off on purpose: nothing is bound, so+/// nothing is stored or recalled until another engine is selected.+pub const DISABLED_ENGINE: &str = "none";+/// A bound engine. Its writes are scrubbed ([`super::guard`]).#[derive(Clone)]pub struct BoundEngine {@@ -288,6 +292,7 @@ fn resolve_configured(config: &Config, root: Option<&str>) -> Binding {match engine_id.as_str() {TINYHUMANS_ENGINE => resolve_tinyhumans(config, root),CORTEXDB_ENGINE => resolve_cortexdb(config, root),+ DISABLED_ENGINE => off(None, None, "memory is disabled"),"" => {let reason = if config.memory.legacy_backend_unsupported|| config.memory.legacy_backend.is_some()diff --git a/crates/openhuman-core/src/memory/ops.rs b/crates/openhuman-core/src/memory/ops.rsindex e796b05cc9..81e6bbc5d7 100644--- a/crates/openhuman-core/src/memory/ops.rs+++ b/crates/openhuman-core/src/memory/ops.rs@@ -14,7 +14,9 @@ use tinymemory_api::{use crate::config::Config;-use super::engine::{self, Binding, BoundEngine, CORTEXDB_ENGINE, TINYHUMANS_ENGINE};+use super::engine::{+ self, Binding, BoundEngine, CORTEXDB_ENGINE, DISABLED_ENGINE, TINYHUMANS_ENGINE,+};use super::error::{MemoryError, MemoryResult};use super::types::{clamp_limit, EngineSetParams, EngineStatus, EngineView, EnginesListView, EraseAllParams,@@ -85,6 +87,19 @@ pub async fn engine_get(config: &Config) -> EngineView {/// store for a key). The caller persists `config`.pub fn apply_engine_set(config: &mut Config, params: &EngineSetParams) -> MemoryResult<()> {let engine_id = params.engine.trim();+ if engine_id == DISABLED_ENGINE {+ // Turning memory off keeps every engine's endpoint and key, so+ // switching back needs no re-entry.+ if params.endpoint.is_some() || params.api_key.is_some() {+ return Err(MemoryError::invalid(+ "disabling memory takes no endpoint or API key",+ ));+ }+ config.memory.engine = DISABLED_ENGINE.to_string();+ engine::invalidate();+ tracing::info!("[memory:ops] memory disabled");+ return Ok(());+ }if !tinymemory_integrations::list_engines().iter().any(|descriptor| descriptor.id == engine_id)