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: files changed crates/openhuman-core/src/channels/controllers/ops/connect/memory.rs,crates/ope
Steven Enamakel9be4ceffa8b8
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/memory.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/memory.rsindex b7ab353808..90043b69e4 100644--- a/crates/openhuman-core/src/channels/controllers/ops/connect/memory.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/memory.rs@@ -2,8 +2,8 @@use crate::config::Config;-/// Forgets every conversation memory v2 stored from this channel (items-/// tagged `channel:<channel_id>`), and reports how many items went.+/// Forgets every conversation memory logged from this channel (the threads+/// `memory::channels` recorded for it), and reports how many items went.////// The count is reported to the caller as `memory_chunks_deleted` (the/// disconnect reply's field name predates memory v2 and is kept as a wire@@ -14,7 +14,7 @@ pub(super) async fn clear_channel_memory(config: &Config,channel_id: &str,) -> anyhow::Result<usize> {- let forgotten = crate::memory::conversations::forget_channel(config, channel_id)+ let forgotten = crate::memory::channels::forget_channel(config, channel_id).await.map_err(|e| anyhow::anyhow!("clear_channel_memory: {e} (code {})", e.code()))?;tracing::debug!(diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rsindex bcfd750e15..8bf030eb22 100644--- a/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rs@@ -3,11 +3,11 @@ use std::sync::Arc;use tinymemory_api::conformance::ReferenceEngine;use tinymemory_api::{MemoryEngine, MemoryMeta, Role, SourceKind, StoreItem, Turn};-fn conversation(channel: &str) -> StoreItem {- let mut meta = MemoryMeta::from_source(SourceKind::Conversation, None);- meta.tags = vec![crate::memory::conversations::buffer::channel_tag(channel)];+fn conversation(thread: &str) -> StoreItem {+ let mut meta = MemoryMeta::from_source(SourceKind::Conversation, Some(thread.to_string()));+ meta.thread_id = Some(thread.to_string());StoreItem::Conversation {- turns: vec![Turn::new(Role::User, format!("hello from {channel}"))],+ turns: vec![Turn::new(Role::User, format!("hello from {thread}"))],meta,}}@@ -19,11 +19,14 @@ async fn clears_only_the_channels_conversations() {config.workspace_dir = tmp.path().to_path_buf();let engine = Arc::new(ReferenceEngine::new());crate::memory::engine::install_test_engine(&config.workspace_dir, engine.clone());- engine.store(conversation("discord")).await.unwrap();- engine.store(conversation("telegram")).await.unwrap();+ engine.store(conversation("discord-1")).await.unwrap();+ engine.store(conversation("telegram-1")).await.unwrap();+ crate::memory::channels::record(&config.workspace_dir, "Discord", "discord-1");+ crate::memory::channels::record(&config.workspace_dir, "telegram", "telegram-1");assert_eq!(clear_channel_memory(&config, "discord").await.unwrap(), 1);assert_eq!(engine.len(), 1);+ assert!(crate::memory::channels::threads_of(&config.workspace_dir, "discord").is_empty());}#[tokio::test]diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rsindex 484cbbd1c7..27462c0f50 100644--- a/crates/openhuman-core/src/config/schema/mod.rs+++ b/crates/openhuman-core/src/config/schema/mod.rs@@ -92,8 +92,8 @@ pub use dictation::{DictationActivationMode, DictationConfig};pub use identity_cost::{CostConfig, ModelPricing};pub use local_ai::{LocalAiConfig, LocalAiUsage};pub use memory::{- migrate_legacy_source, MemoryAgentConfig, MemoryConfig, MemoryContextConfig,- MemoryConversationsConfig, MemoryEngineSettings, MemorySourceConfig, MemorySourceKind,+ migrate_legacy_source, MemoryAgentConfig, MemoryConfig, MemoryConversationsConfig,+ MemoryEngineSettings, MemoryRecallConfig, MemorySourceConfig, MemorySourceKind,MEMORY_CORTEXDB_KEY_NAME,};pub use modules::{ModuleOverride, ModulesConfig};diff --git a/crates/openhuman-core/src/core/runtime/builder.rs b/crates/openhuman-core/src/core/runtime/builder.rsindex 3b73fb1118..26349589d1 100644--- a/crates/openhuman-core/src/core/runtime/builder.rs+++ b/crates/openhuman-core/src/core/runtime/builder.rs@@ -769,17 +769,11 @@ impl CoreRuntime {/// Cleanup to run once a transport has stopped serving, whether it ended/// cleanly or with an error.///- /// Memory goes first. The engine's queue worker holds leases on in-flight- /// jobs, and releasing them is a write to the store, so it has to happen- /// while the store is still open and before anything else on the way out- /// (tinymemory#133). Bounded inside, on one shared deadline: a wedged- /// store costs at most that budget, never the exit. There is no local- /// model runtime to stop: the user runs Ollama / LM Studio / MLX- /// themselves and OpenHuman never spawns it.+ /// Memory holds nothing to flush: turns are logged as they happen and+ /// queued background jobs are persisted. There is no local model runtime+ /// to stop either: the user runs Ollama / LM Studio / MLX themselves and+ /// OpenHuman never spawns it.pub async fn exit_cleanup(&self) {- if let Some(config) = &self.config {- let _ = crate::memory::exit::run(config).await;- }log::debug!("[core] shutdown: exit cleanup done (no owned local runtime to stop)");}diff --git a/crates/openhuman-core/src/memory/channels_tests.rs b/crates/openhuman-core/src/memory/channels_tests.rsnew file mode 100644index 0000000000..6041c58089--- /dev/null+++ b/crates/openhuman-core/src/memory/channels_tests.rs@@ -0,0 +1,13 @@+use super::*;++#[test]+fn records_threads_per_channel_case_insensitively() {+ let tmp = tempfile::tempdir().unwrap();+ record(tmp.path(), "Telegram", "t-1");+ record(tmp.path(), "telegram", "t-1");+ record(tmp.path(), "telegram", "t-2");+ record(tmp.path(), "", "t-3");+ record(tmp.path(), "web", " ");+ assert_eq!(threads_of(tmp.path(), "TELEGRAM"), ["t-1", "t-2"]);+ assert!(threads_of(tmp.path(), "web").is_empty());+}diff --git a/crates/openhuman-core/src/memory/lifecycle/jobs.rs b/crates/openhuman-core/src/memory/lifecycle/jobs.rsindex d5326c5d73..89e0ae41e9 100644--- a/crates/openhuman-core/src/memory/lifecycle/jobs.rs+++ b/crates/openhuman-core/src/memory/lifecycle/jobs.rs@@ -197,11 +197,11 @@ pub async fn run(config: &Config, selection: Selection) -> MemoryResult<Vec<JobRSelection::All => true,Selection::One(id) => &queued.id == id,});- if let Selection::One(id) = &selection- && take.is_empty()- {- queue.pending = keep;- return Err(MemoryError::invalid(format!("no queued job `{id}`")));+ if let Selection::One(id) = &selection {+ if take.is_empty() {+ queue.pending = keep;+ return Err(MemoryError::invalid(format!("no queued job `{id}`")));+ }}queue.pending = keep;let mut runs = Vec::new();diff --git a/crates/openhuman-core/src/memory/mod.rs b/crates/openhuman-core/src/memory/mod.rsindex b152b4081d..e3674d68df 100644--- a/crates/openhuman-core/src/memory/mod.rs+++ b/crates/openhuman-core/src/memory/mod.rs@@ -10,6 +10,7 @@//! | [`ops`] | Engine selection, recall, fetch, learn, forget, list, the pack preview |//! | [`brain`] | The shared brain: documents by source type |//! | [`sources`] | The `[[memory.sources]]` registry and sync into the brain (folder, file, link, github, rss, composio) |+//! | [`channels`] | Which channel each logged thread arrived on, for forgetting a channel |//! | [`backfill`] | Consent-gated storing of chats from before turns were logged |//! | [`import`] | Consent-gated, resumable import of a v1 store |//! | [`tools`] | The single `memory` agent tool |@@ -21,6 +22,7 @@pub mod backfill;pub mod brain;pub mod bus;+pub mod channels;pub mod engine;pub mod error;pub mod explore;