Skip to content

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

feat(user_agents): expose user-scoped memory methods to user agents

Steven Enamakelf94bfe880b80
diff --git a/crates/openhuman-core/src/core/runtime/boot_guard_tests.rs b/crates/openhuman-core/src/core/runtime/boot_guard_tests.rs
index abdade1412..88ee238897 100644
--- a/crates/openhuman-core/src/core/runtime/boot_guard_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/boot_guard_tests.rs
@@ -92,16 +92,18 @@ fn domain_families_are_refused_until_they_are_isolated() {
let mut i = inputs(&f, &[]);
i.domains = DomainSet::harness();
let found = violations(&i);
- for name in ["agent", "memory", "config", "security"] {
+ for name in ["agent", "config", "security"] {
assert!(
found.contains(&Violation::Domain(name)),
"{name}: {found:?}"
);
}
- assert!(
- !found.contains(&Violation::Domain("threads")),
- "threads is isolated per user: {found:?}"
- );
+ for isolated in ["threads", "memory"] {
+ assert!(
+ !found.contains(&Violation::Domain(isolated)),
+ "{isolated} is isolated per user: {found:?}"
+ );
+ }
}
#[test]
diff --git a/crates/openhuman-core/src/core/runtime/saas.rs b/crates/openhuman-core/src/core/runtime/saas.rs
index b3ced1e26f..144859b406 100644
--- a/crates/openhuman-core/src/core/runtime/saas.rs
+++ b/crates/openhuman-core/src/core/runtime/saas.rs
@@ -148,6 +148,7 @@ impl DomainSet {
operator: true,
threads: true,
channels: true,
+ memory: true,
..Self::none()
}
}
diff --git a/crates/openhuman-core/src/core/runtime/saas_tests.rs b/crates/openhuman-core/src/core/runtime/saas_tests.rs
index 3e751a1aa6..adc62803c6 100644
--- a/crates/openhuman-core/src/core/runtime/saas_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/saas_tests.rs
@@ -88,6 +88,7 @@ fn the_saas_presets_are_closed() {
operator: true,
threads: true,
channels: true,
+ memory: true,
..DomainSet::none()
},
"the operator plane plus the user families isolated so far"
diff --git a/crates/openhuman-core/src/user_agents/host.rs b/crates/openhuman-core/src/user_agents/host.rs
index 14033312ce..f175a7e013 100644
--- a/crates/openhuman-core/src/user_agents/host.rs
+++ b/crates/openhuman-core/src/user_agents/host.rs
@@ -70,6 +70,7 @@ pub fn user_domains() -> DomainSet {
DomainSet {
threads: true,
channels: true,
+ memory: true,
..DomainSet::none()
}
}
diff --git a/crates/openhuman-core/src/user_agents/surface.rs b/crates/openhuman-core/src/user_agents/surface.rs
index 551abf5f24..04ac63d9d9 100644
--- a/crates/openhuman-core/src/user_agents/surface.rs
+++ b/crates/openhuman-core/src/user_agents/surface.rs
@@ -48,6 +48,16 @@ pub const USER_METHODS: &[&str] = &[
"openhuman.channel_web_queue_status",
"openhuman.channel_web_queue_clear",
"openhuman.channel_web_queue_remove",
+ // Memory: reads and writes confined to the user's own tree
+ // (`memory::user_scope`). Engine and policy changes, sources, imports and
+ // backfills stay closed: they reach the host or change where memory lives.
+ "openhuman.memory_recall",
+ "openhuman.memory_fetch",
+ "openhuman.memory_learn",
+ "openhuman.memory_forget",
+ "openhuman.memory_items_list",
+ "openhuman.memory_explore",
+ "openhuman.memory_engine_get",
];
/// Whether `method` (of an operator-plane controller or not) may be
diff --git a/crates/openhuman-core/src/user_agents/surface_tests.rs b/crates/openhuman-core/src/user_agents/surface_tests.rs
index e7a85fe700..e52aed5813 100644
--- a/crates/openhuman-core/src/user_agents/surface_tests.rs
+++ b/crates/openhuman-core/src/user_agents/surface_tests.rs
@@ -47,7 +47,12 @@ fn chat_is_open_but_other_channel_methods_are_not() {
"openhuman.threads_regenerate",
false
));
+ assert!(visible_in(true, true, "openhuman.memory_recall", false));
for method in [
+ "openhuman.memory_engine_set",
+ "openhuman.memory_policy_set",
+ "openhuman.memory_sources_add",
+ "openhuman.memory_import_start",
"openhuman.channels_list",
"openhuman.channels_connect",
"openhuman.config_update_autonomy_settings",