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
Adopt tinymemory's automatic consolidation and chunked documents
M3gA-Mind886f60136f92
diff --git a/crates/openhuman-core/src/memory/brain.rs b/crates/openhuman-core/src/memory/brain.rsindex 135b968924..5c023e4800 100644--- a/crates/openhuman-core/src/memory/brain.rs+++ b/crates/openhuman-core/src/memory/brain.rs@@ -251,7 +251,12 @@ pub async fn ingest(config: &Config, params: BrainIngestParams) -> MemoryResult<let ingested = brain(config)?.ingest_with(document, WriteOptions::accepted()).await?;- jobs::enqueue(config, layout(config).root(), vec![ingested.job]).await;+ jobs::enqueue(+ config,+ layout(config).root(),+ ingested.job.into_iter().collect(),+ )+ .await;tracing::debug!(source = %filed, replayed = ingested.receipt.replayed, "[memory:brain] ingested");Ok(BrainIngestView {id: ingested.receipt.id.to_string(),diff --git a/crates/openhuman-core/src/memory/engine.rs b/crates/openhuman-core/src/memory/engine.rsindex e9369fddf3..05d8e3c0e3 100644--- a/crates/openhuman-core/src/memory/engine.rs+++ b/crates/openhuman-core/src/memory/engine.rs@@ -245,6 +245,7 @@ fn resolve_tinyhumans(config: &Config) -> Binding {EngineSettings {endpoint: Some(endpoint),headers,+ ..EngineSettings::default()},fingerprint,EngineCredential::Dynamic(source),diff --git a/crates/openhuman-core/src/memory/guard_tests.rs b/crates/openhuman-core/src/memory/guard_tests.rsindex 10d3871c5f..c7c2fb861b 100644--- a/crates/openhuman-core/src/memory/guard_tests.rs+++ b/crates/openhuman-core/src/memory/guard_tests.rs@@ -116,3 +116,19 @@ async fn every_read_passes_through_the_timer_unchanged() {1);}++#[test]+fn scrubbing_keeps_the_page_breaks_a_document_is_chunked_by() {+ let body = format!("Page one key={SECRET}\u{c}Page two.\u{c}Page three.");+ let scrubbed = scrub(StoreItem::document(body, MemoryMeta::default()));+ let StoreItem::Document {+ body: tinymemory_api::DocumentBody::Text(text),+ ..+ } = scrubbed+ else {+ panic!("a document");+ };+ assert!(!text.contains(SECRET), "{text}");+ assert_eq!(text.matches('\u{c}').count(), 2, "{text:?}");+ assert!(text.ends_with("\u{c}Page two.\u{c}Page three."), "{text:?}");+}diff --git a/crates/openhuman-core/src/memory/sources/sync.rs b/crates/openhuman-core/src/memory/sources/sync.rsindex e179d938cd..15cdc91e6d 100644--- a/crates/openhuman-core/src/memory/sources/sync.rs+++ b/crates/openhuman-core/src/memory/sources/sync.rs@@ -132,8 +132,13 @@ pub(crate) async fn store_all(}}}+ // An engine that rebuilds beliefs on its own needs no build job, as+ // `Brain::ingest` hands back none for it.+ let automatic =+ bound.engine.descriptor().consolidation == tinymemory_api::Consolidation::Automatic;let jobs = touched.iter()+ .filter(|_| !automatic).filter_map(|source| layout.brain(source).ok()).map(|node| tinymemory_tools::BackgroundJob::BuildBeliefs {request: tinymemory_api::ConsolidateRequest::new(tinymemory_api::Reach::exact(node))diff --git a/docs/specs/memory-v2.md b/docs/specs/memory-v2.mdindex a2ad2b10bc..9dcee71516 100644--- a/docs/specs/memory-v2.md+++ b/docs/specs/memory-v2.md@@ -127,8 +127,17 @@ its own schedule (`scheduled`); an engine that cannot consolidate answers`markdown`). A source's `namespace` names the layout root it files under.- **Ingest** (`memory_brain_ingest`) files a local file (converted, itssource picked from its format) or text, accepted without waiting for- indexing.-- Each ingest or sync queues one belief build per brain source it touched.+ indexing. Files are capped at 25 MB (`MAX_INGEST_BYTES`).+- **A long document is several writes.** CortexDB refuses an event over+ 1 MiB, so tinymemory writes a document whose text is over about 256 KiB as+ pieces of about 256 KiB each, cut at page breaks and headings (PDF pages+ are joined with a form feed, U+000C, which the scrubber keeps). Each piece+ is one write, and the hosted engine bills per write: a 25 MB text file is+ about 100 billed writes. It still reads back as one item, and a search hit+ on it is the matching piece, tagged `page:`/`section:`.+- Each ingest or sync queues one belief build per brain source it touched,+ unless the engine rebuilds beliefs on its own (`Consolidation::Automatic`),+ which needs none.## Config (`config.toml`)