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(agent): invert shared_memory to dedicated_memory
Steven Enamakel9393e3c69dc0
diff --git a/crates/openhuman-embed/src/agent/build.rs b/crates/openhuman-embed/src/agent/build.rsindex be5f99f09b..f5181e1dc4 100644--- a/crates/openhuman-embed/src/agent/build.rs+++ b/crates/openhuman-embed/src/agent/build.rs@@ -80,7 +80,7 @@ pub(crate) fn instantiate(runtime: &Runtime, spec: AgentSpec) -> Result<AgentInn// ── profile ──────────────────────────────────────────────────────────let mut profile = super::spec::blank_profile(&id);- profile.dedicated_memory = !parts.shared_memory;+ profile.dedicated_memory = parts.dedicated_memory;profile.allowed_tools = parts.allowed_tools;profile.allowed_skills = parts.allowed_skills;profile.system_prompt_suffix = parts.system_prompt_suffix;diff --git a/crates/openhuman-embed/src/agent/layout.rs b/crates/openhuman-embed/src/agent/layout.rsindex 63bad756bb..9d6aeb4d5d 100644--- a/crates/openhuman-embed/src/agent/layout.rs+++ b/crates/openhuman-embed/src/agent/layout.rs@@ -10,8 +10,8 @@//! workspace///! session_db/sessions.db runtime-wide run ledger//! personalities/<id>/{SOUL.md, MEMORY.md, skills/} the agent's home-//! session_raw-<id>/ its transcripts-//! memory-<id>/, memory_tree-<id>/ its memory (dedicated)+//! session_raw/<ts>_<id>.jsonl its transcripts+//! session_raw-<id>/, memory-<id>/ with dedicated_memory//! agents/<id>/action/ its default action_dir//! ```//!diff --git a/crates/openhuman-embed/src/agent/mod.rs b/crates/openhuman-embed/src/agent/mod.rsindex 01e9e1a41a..0ea32701e6 100644--- a/crates/openhuman-embed/src/agent/mod.rs+++ b/crates/openhuman-embed/src/agent/mod.rs@@ -161,9 +161,9 @@ impl Agent {&self.inner.layout.skills}- /// Where this agent's transcripts are written- /// (`<workspace>/session_raw-<id>/`, or the shared `session_raw/` when- /// [`AgentSpec::shared_memory`] was set).+ /// Where this agent's transcripts are written: the workspace's shared+ /// `session_raw/` (files are keyed by agent name), or+ /// `session_raw-<id>/` with [`AgentSpec::dedicated_memory`].pub fn transcripts_dir(&self) -> &Path {&self.inner.layout.transcripts}diff --git a/crates/openhuman-embed/src/agent/spec.rs b/crates/openhuman-embed/src/agent/spec.rsindex 51c49fbc09..f20257dcf0 100644--- a/crates/openhuman-embed/src/agent/spec.rs+++ b/crates/openhuman-embed/src/agent/spec.rs@@ -49,7 +49,7 @@ pub struct AgentSpec {include_user_skills: bool,action_dir: Option<PathBuf>,trusted: Vec<(String, TrustedAccess)>,- shared_memory: bool,+ dedicated_memory: bool,config_fn: Option<Box<dyn FnOnce(&mut Config) + Send>>,}@@ -81,7 +81,7 @@ impl AgentSpec {include_user_skills: false,action_dir: None,trusted: Vec::new(),- shared_memory: false,+ dedicated_memory: false,config_fn: None,}}@@ -220,13 +220,19 @@ impl AgentSpec {self}- /// Share the workspace's global memory and transcript tree instead of a- /// dedicated `memory-<id>` / `session_raw-<id>` subtree.+ /// Give this agent its own memory store and transcript tree+ /// (`memory-<id>`, `session_raw-<id>`) instead of the workspace's shared+ /// ones.///- /// Off by default: two agents sharing a transcript root would resume each- /// other's histories.- pub fn shared_memory(mut self, shared: bool) -> Self {- self.shared_memory = shared;+ /// Off by default. Transcripts are already kept apart without it — they+ /// are keyed by agent name and every turn resumes only its own thread —+ /// and a dedicated store is opened through the memory module, which a+ /// library runtime only has when its host preloads modules+ /// (`ServiceSet::memory_queue`). Without the module the open times out+ /// on every turn. Turn this on only when memory itself must not be+ /// shared between agents and the module is running.+ pub fn dedicated_memory(mut self, dedicated: bool) -> Self {+ self.dedicated_memory = dedicated;self}@@ -262,7 +268,7 @@ impl AgentSpec {include_user_skills: self.include_user_skills,action_dir: self.action_dir,trusted: self.trusted,- shared_memory: self.shared_memory,+ dedicated_memory: self.dedicated_memory,config_fn: self.config_fn,}}@@ -288,7 +294,7 @@ pub(crate) struct AgentSpecParts {pub(crate) include_user_skills: bool,pub(crate) action_dir: Option<PathBuf>,pub(crate) trusted: Vec<(String, TrustedAccess)>,- pub(crate) shared_memory: bool,+ pub(crate) dedicated_memory: bool,pub(crate) config_fn: Option<Box<dyn FnOnce(&mut Config) + Send>>,}@@ -299,7 +305,7 @@ impl std::fmt::Debug for AgentSpec {.field("id", &self.id).field("access", &self.access).field("action_dir", &self.action_dir)- .field("shared_memory", &self.shared_memory)+ .field("dedicated_memory", &self.dedicated_memory).finish_non_exhaustive()}}diff --git a/crates/openhuman-embed/tests/harness_embed.rs b/crates/openhuman-embed/tests/harness_embed.rsindex aabcec966a..47be498d70 100644--- a/crates/openhuman-embed/tests/harness_embed.rs+++ b/crates/openhuman-embed/tests/harness_embed.rs@@ -186,7 +186,7 @@ fn a_harness_runs_a_turn_against_the_provider_it_was_given() {assert_eq!(harness.runtime().agent_ids(), vec!["harness".to_string()]);assert!(harness.agent().transcripts_dir().is_dir(),- "the harness agent's transcripts land in its own subtree"+ "the harness agent's transcripts were written");// A second harness — a second runtime — in this process must bediff --git a/crates/openhuman-embed/tests/public_api.rs b/crates/openhuman-embed/tests/public_api.rsindex ac099f589f..a1748f34e1 100644--- a/crates/openhuman-embed/tests/public_api.rs+++ b/crates/openhuman-embed/tests/public_api.rs@@ -54,7 +54,7 @@ fn exposes_the_host_facing_embedding_contract() {.access(Access::readonly()).action_dir("/tmp/embed-public-api").include_user_skills(false)- .shared_memory(false)+ .dedicated_memory(false).config(|_config| {});let _ = DomainSet::embedded;let _ = ServiceSet::none;diff --git a/crates/openhuman-embed/tests/runtime_agents.rs b/crates/openhuman-embed/tests/runtime_agents.rsindex ab58a85863..0ba7218c88 100644--- a/crates/openhuman-embed/tests/runtime_agents.rs+++ b/crates/openhuman-embed/tests/runtime_agents.rs@@ -149,8 +149,7 @@ fn one_runtime_hosts_independently_configured_agents() {// Layout: every agent has its own home, transcripts and action dir.assert_eq!(alpha.home_dir(), workspace_dir.join("personalities/alpha"));- assert_eq!(alpha.transcripts_dir(), workspace_dir.join("session_raw-alpha"));- assert_eq!(beta.transcripts_dir(), workspace_dir.join("session_raw-beta"));+ assert_eq!(alpha.transcripts_dir(), workspace_dir.join("session_raw"));assert_eq!(alpha.action_dir(), root_dir.join("agents/alpha/action"));assert!(alpha.action_dir().is_dir());assert_eq!(beta.action_dir(), beta_action.path());@@ -221,12 +220,19 @@ fn one_runtime_hosts_independently_configured_agents() {);}- // Transcripts are per agent, and a thread resumes its own history.- assert!(alpha.transcripts_dir().is_dir(), "alpha wrote a transcript");- assert!(beta.transcripts_dir().is_dir(), "beta wrote a transcript");+ // Transcripts are keyed by agent, and a thread resumes its own history.+ let transcripts: Vec<String> = std::fs::read_dir(alpha.transcripts_dir())+ .expect("transcript dir")+ .flatten()+ .map(|e| e.file_name().to_string_lossy().into_owned())+ .collect();+ assert!(+ transcripts.iter().any(|f| f.ends_with("_alpha.jsonl")),+ "alpha's transcript carries its id: {transcripts:?}"+ );assert!(- !workspace_dir.join("session_raw").exists(),- "no agent writes to the shared transcript root"+ transcripts.iter().any(|f| f.ends_with("_beta.jsonl")),+ "beta's transcript carries its id: {transcripts:?}");let a2 = alpha.turn("and again")