Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed crates/openhuman-core/src/memory/engine.rs,crates/openhuman-core/src/memory/ops

Steven Enamakelf62a79f4e268
diff --git a/crates/openhuman-core/src/memory/engine.rs b/crates/openhuman-core/src/memory/engine.rs
index 5fd564fec7..b2e9916974 100644
--- a/crates/openhuman-core/src/memory/engine.rs
+++ b/crates/openhuman-core/src/memory/engine.rs
@@ -40,7 +40,7 @@ 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;
-/// A bound engine.
+/// A bound engine. Its writes are scrubbed ([`super::guard`]).
#[derive(Clone)]
pub struct BoundEngine {
/// The engine.
@@ -125,7 +125,7 @@ pub fn resolve(config: &Config) -> Binding {
return Binding::On(BoundEngine {
id: engine.descriptor().id.to_string(),
endpoint: "test://engine".to_string(),
- engine,
+ engine: super::guard::ScrubbingEngine::wrap(engine),
});
}
}
@@ -249,7 +249,7 @@ fn build_cached(
Ok(engine) => {
tracing::info!(engine = %id, "[memory:engine] engine bound");
let bound = BoundEngine {
- engine,
+ engine: super::guard::ScrubbingEngine::wrap(engine),
id: id.to_string(),
endpoint: endpoint.to_string(),
};
diff --git a/crates/openhuman-core/src/memory/ops.rs b/crates/openhuman-core/src/memory/ops.rs
index 8a3045d153..ed2cb068f2 100644
--- a/crates/openhuman-core/src/memory/ops.rs
+++ b/crates/openhuman-core/src/memory/ops.rs
@@ -3,9 +3,8 @@
//!
//! Every operation takes the [`Config`] it runs against, so the RPC handlers
//! (which load config per call) and the agent tool (which carries its
-//! session's config) share one implementation. Writes go through
-//! [`store_item`], which scrubs secrets and PII before anything leaves the
-//! process.
+//! session's config) share one implementation. Every write is
+//! scrubbed of secrets and PII by the bound engine itself ([`super::guard`]).
use chrono::Utc;
use tinymemory_api::{FetchRequest, ForgetTarget, ItemId, LearningKind, ListRequest, MemoryMeta, RecallRequest, StoreItem, StoreReceipt};
@@ -273,17 +272,10 @@ pub async fn store_item(config: &Config, item: StoreItem) -> MemoryResult<StoreR
store_on(&bound, item).await
}
-/// Scrubs `item` and stores it on `bound`.
+/// Stores `item` on `bound`; the bound engine scrubs it ([`super::guard`]).
pub async fn store_on(bound: &BoundEngine, item: StoreItem) -> MemoryResult<StoreReceipt> {
let kind = item.kind();
- let scrubbed = tinymemory_integrations::safety::scrub_item_with(item, crate::security::scrub::host_policy());
- if scrubbed.report.changed() {
- tracing::debug!(
- kind = kind.as_str(),
- "[memory:ops] item scrubbed before store"
- );
- }
- let receipt = bound.engine.store(scrubbed.value).await?;
+ let receipt = bound.engine.store(item).await?;
tracing::debug!(
engine = %bound.id,
kind = kind.as_str(),
@@ -293,20 +285,15 @@ pub async fn store_on(bound: &BoundEngine, item: StoreItem) -> MemoryResult<Stor
Ok(receipt)
}
-/// Scrubs `items` and stores them on `bound` in one bulk call
-/// (`MemoryEngine::store_many`): each is listed on return, ranked recall
-/// may lag behind for all but the last. For imports and backfills.
+/// Stores `items` on `bound` in one bulk call (`MemoryEngine::store_many`):
+/// each is listed on return, ranked recall may lag behind for all but the
+/// last. For imports and backfills.
pub async fn store_many_on(
bound: &BoundEngine,
items: Vec<StoreItem>,
) -> MemoryResult<Vec<StoreReceipt>> {
let count = items.len();
- let policy = crate::security::scrub::host_policy();
- let scrubbed: Vec<StoreItem> = items
- .into_iter()
- .map(|item| tinymemory_integrations::safety::scrub_item_with(item, policy).value)
- .collect();
- let receipts = bound.engine.store_many(scrubbed).await?;
+ let receipts = bound.engine.store_many(items).await?;
tracing::debug!(
engine = %bound.id,
count,