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(memory): apply rustfmt formatting across memory modules
Steven Enamakel930c3bec7907
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rsindex 6813d0a275..09584a2179 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs@@ -122,7 +122,9 @@ impl OpenHumanTurnPrelude {// The identity the turn's run context carries: the host environment's// (a team member's), narrowed to this agent.let acting = self.host_env.memory_identity.clone().unwrap_or_default();- let mut identity = acting.child(&self.agent_definition_id).resolve(&crate::memory::scope::identity_pins(&config));+ let mut identity = acting+ .child(&self.agent_definition_id)+ .resolve(&crate::memory::scope::identity_pins(&config));if self.omit_memory_context {identity.recall = false;}diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rsindex 125ef692b0..5297652fe2 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs@@ -576,18 +576,21 @@ async fn the_approval_context_survives_await_points_and_a_move_between_tasks() {/// an environment without one leaves the run's own alone.#[test]fn the_memory_identity_rides_the_run_and_its_children() {-let mut context = OpenHumanRunContext::new();assert_eq!(context.memory_identity, None);let env = crate::agent::turn_env::HostTurnEnv {- memory_identity: Some(tinymemory_tools::layout::identity::Identity::team_member("acme", "lead")),+ memory_identity: Some(tinymemory_tools::layout::identity::Identity::team_member(+ "acme", "lead",+ )),..Default::default()};context = context.with_host_env(&env);assert_eq!(context.memory_identity,- Some(tinymemory_tools::layout::identity::Identity::team_member("acme", "lead"))+ Some(tinymemory_tools::layout::identity::Identity::team_member(+ "acme", "lead"+ )));let child = context.child();@@ -600,7 +603,9 @@ fn the_memory_identity_rides_the_run_and_its_children() {let unchanged = context.with_host_env(&crate::agent::turn_env::HostTurnEnv::default());assert_eq!(unchanged.memory_identity,- Some(tinymemory_tools::layout::identity::Identity::team_member("acme", "lead"))+ Some(tinymemory_tools::layout::identity::Identity::team_member(+ "acme", "lead"+ )));}@@ -691,7 +696,8 @@ fn the_turns_still_in_the_prompt_reach_the_runs_tools() {let mut host = OpenHumanRunContext::new();host.memory_turn = Some(std::sync::Arc::new(crate::memory::lifecycle::hooks::MemoryTurn {- identity: tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config)),+ identity: tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config)),config: std::sync::Arc::new(config),thread_id: "thread-long".into(),pack: None,diff --git a/crates/openhuman-core/src/agent/tinyagents/memory_summarizer_tests.rs b/crates/openhuman-core/src/agent/tinyagents/memory_summarizer_tests.rsindex dbbc8bc6d1..9081c99632 100644--- a/crates/openhuman-core/src/agent/tinyagents/memory_summarizer_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/memory_summarizer_tests.rs@@ -20,7 +20,8 @@ impl Summarizer for Failing {async fn bound_turn(tmp: &tempfile::TempDir) -> Arc<MemoryTurn> {let config = config_in(tmp);bind_reference(&config);- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));pre_turn_work(&crate::core::runtime::DispatchCtx::ambient(),&config,@@ -249,7 +250,8 @@ async fn a_held_memory_engine_does_not_delay_transcript_compaction() {inner: tinymemory_api::conformance::ReferenceEngine::new(),}),);- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));let turn = Arc::new(MemoryTurn {config: Arc::new(config),identity,diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/memory_pack_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/memory_pack_tests.rsindex 89a09cd1ba..8f9c07d84e 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/memory_pack_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/memory_pack_tests.rs@@ -14,7 +14,8 @@ fn context(pack: Option<TurnPack>) -> RunContext<OpenHumanRunContext> {let config = crate::config::Config::default();let mut data = OpenHumanRunContext::new();data.memory_turn = Some(Arc::new(MemoryTurn {- identity: tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config)),+ identity: tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config)),config: Arc::new(config),thread_id: "t".into(),pack,diff --git a/crates/openhuman-core/src/memory/backfill.rs b/crates/openhuman-core/src/memory/backfill.rsindex 41810991c5..19a90b41d5 100644--- a/crates/openhuman-core/src/memory/backfill.rs+++ b/crates/openhuman-core/src/memory/backfill.rs@@ -38,10 +38,10 @@ use serde::{Deserialize, Serialize};use crate::config::Config;use crate::memory::engine::{self, BoundEngine};-use tinymemory_tools::layout::identity::ResolvedIdentity;use crate::threads::store::blocking as threads;use tinymemory_api::{Error, Result};use tinymemory_integrations::import::ImportPhase;+use tinymemory_tools::layout::identity::ResolvedIdentity;use tinymemory_tools::backfill::{first_live_turn, group_items, turn_groups, ThreadMessage};pub use tinymemory_tools::backfill::{pending_range, turns_of, PastTurn, BACKFILL_TAG, MAIN_AGENT};@@ -254,7 +254,8 @@ pub async fn start(turns = pending_turns,"[memory:backfill] started");- let identity = tinymemory_tools::layout::identity::Identity::agent(MAIN_AGENT).resolve(&crate::memory::scope::identity_pins(config));+ let identity = tinymemory_tools::layout::identity::Identity::agent(MAIN_AGENT)+ .resolve(&crate::memory::scope::identity_pins(config));tokio::spawn(async move {run(&workspace_dir, &bound, &identity, file, plans).await;release(&workspace_dir);diff --git a/crates/openhuman-core/src/memory/backfill_tests.rs b/crates/openhuman-core/src/memory/backfill_tests.rsindex 7c6c066a3d..d5afe7b5a5 100644--- a/crates/openhuman-core/src/memory/backfill_tests.rs+++ b/crates/openhuman-core/src/memory/backfill_tests.rs@@ -114,7 +114,8 @@ async fn stores_past_chats_once_and_skips_what_live_logging_took() {).await;// The lifecycle logged live-thread's second turn (user index 2).- let identity = tinymemory_tools::layout::identity::Identity::agent(MAIN_AGENT).resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent(MAIN_AGENT)+ .resolve(&crate::memory::scope::identity_pins(&config));crate::memory::lifecycle::hooks::pre_turn_work(&crate::core::runtime::DispatchCtx::ambient(),&config,diff --git a/crates/openhuman-core/src/memory/brain.rs b/crates/openhuman-core/src/memory/brain.rsindex a9f72b19df..fbb99b9735 100644--- a/crates/openhuman-core/src/memory/brain.rs+++ b/crates/openhuman-core/src/memory/brain.rs@@ -51,11 +51,19 @@ pub fn brain_node(}/// The layout the brain RPCs act on: `identity`'s.-fn layout(config: &Config, identity: &tinymemory_tools::layout::identity::Identity) -> MemoryLayout {- identity.resolve(&crate::memory::scope::identity_pins(config)).layout+fn layout(+ config: &Config,+ identity: &tinymemory_tools::layout::identity::Identity,+) -> MemoryLayout {+ identity+ .resolve(&crate::memory::scope::identity_pins(config))+ .layout}-fn brain(config: &Config, identity: &tinymemory_tools::layout::identity::Identity) -> Result<Brain> {+fn brain(+ config: &Config,+ identity: &tinymemory_tools::layout::identity::Identity,+) -> Result<Brain> {let bound = engine::resolve(config).engine()?;Ok(Brain::new(bound.engine, layout(config, identity)))}@@ -86,7 +94,10 @@ pub struct BrainSourcesView {}/// `memory_brain_sources`: the brain's sources and their sizes.-pub async fn sources(config: &Config, identity: &tinymemory_tools::layout::identity::Identity) -> Result<BrainSourcesView> {+pub async fn sources(+ config: &Config,+ identity: &tinymemory_tools::layout::identity::Identity,+) -> Result<BrainSourcesView> {let bound = engine::resolve(config).engine()?;let layout = layout(config, identity);let page = bounddiff --git a/crates/openhuman-core/src/memory/brain_tests.rs b/crates/openhuman-core/src/memory/brain_tests.rsindex 4b840d2ef5..0b995b64bb 100644--- a/crates/openhuman-core/src/memory/brain_tests.rs+++ b/crates/openhuman-core/src/memory/brain_tests.rs@@ -56,7 +56,12 @@ async fn a_sources_collections_count_and_forget_with_it() {};engine.store(StoreItem::document(text, meta)).await.unwrap();}- let view = sources(&config, &tinymemory_tools::layout::identity::Identity::root()).await.unwrap();+ let view = sources(+ &config,+ &tinymemory_tools::layout::identity::Identity::root(),+ )+ .await+ .unwrap();let counts: Vec<(&str, u64)> = view.sources.iter()@@ -125,7 +130,12 @@ async fn text_is_ingested_searched_counted_and_forgotten_per_source() {"one belief build per source");- let counts = sources(&config, &tinymemory_tools::layout::identity::Identity::root()).await.unwrap();+ let counts = sources(+ &config,+ &tinymemory_tools::layout::identity::Identity::root(),+ )+ .await+ .unwrap();assert_eq!(counts.root, "root");assert_eq!(counts.sources.len(), 2);assert_eq!(counts.unfiled, 0);@@ -187,7 +197,12 @@ async fn ingest_refuses_bad_input() {},] {assert!(matches!(- ingest(&config, &tinymemory_tools::layout::identity::Identity::root(), params).await,+ ingest(+ &config,+ &tinymemory_tools::layout::identity::Identity::root(),+ params+ )+ .await,Err(Error::InvalidRequest(_))));}@@ -288,7 +303,12 @@ async fn ingest_refuses_a_credential_store_a_system_root_traversal_and_null_byteformat!("{}/../guide.md", notes.display()),format!("{}\0.md", tmp.path().join("guide").display()),] {- let result = ingest(&config, &tinymemory_tools::layout::identity::Identity::root(), path_params(path.clone())).await;+ let result = ingest(+ &config,+ &tinymemory_tools::layout::identity::Identity::root(),+ path_params(path.clone()),+ )+ .await;assert!(matches!(result, Err(Error::InvalidRequest(_))),"{path:?}: {result:?}"diff --git a/crates/openhuman-core/src/memory/confinement_tests.rs b/crates/openhuman-core/src/memory/confinement_tests.rsindex fd2fff580f..bf98d178da 100644--- a/crates/openhuman-core/src/memory/confinement_tests.rs+++ b/crates/openhuman-core/src/memory/confinement_tests.rs@@ -9,9 +9,7 @@ use tinymemory_tools::layout::identity::Identity;use crate::memory::explore::{self, ItemsGetParams, PathStep};use crate::memory::test_fixtures::{bind_reference, config_in};-use crate::memory::types::{- FetchParams, ForgetParams, ItemsListParams, LearnParams, RecallParams,-};+use crate::memory::types::{FetchParams, ForgetParams, ItemsListParams, LearnParams, RecallParams};fn ns(raw: &str) -> Namespace {raw.parse().unwrap()@@ -86,10 +84,7 @@ fn rpc_refuse_uses_the_identity_subtree_and_rejects_wider_reaches() {));}- let team = confinement(- &config_in(&tmp),- &Identity::team_member("acme", "scout"),- );+ let team = confinement(&config_in(&tmp), &Identity::team_member("acme", "scout"));assert_eq!(team.allowed, Reach::subtree(ns("team:acme")));}@@ -206,12 +201,26 @@ async fn rpc_items_get_and_forget_cannot_reach_another_root() {.unwrap();assert_eq!(forgotten.forgotten, 0);- let engine: Arc<dyn MemoryEngine> = crate::memory::engine::resolve(&config).engine().unwrap().engine;- assert_eq!(ids(&engine.list(tinymemory_api::ListRequest {- filter: MetaFilter { reach: Some(Reach::subtree(ns("team:other"))), ..MetaFilter::default() },- limit: 10,- cursor: None,- }).await.unwrap().items).as_slice(), [theirs]);+ let engine: Arc<dyn MemoryEngine> = crate::memory::engine::resolve(&config)+ .engine()+ .unwrap()+ .engine;+ assert_eq!(+ ids(&engine+ .list(tinymemory_api::ListRequest {+ filter: MetaFilter {+ reach: Some(Reach::subtree(ns("team:other"))),+ ..MetaFilter::default()+ },+ limit: 10,+ cursor: None,+ })+ .await+ .unwrap()+ .items)+ .as_slice(),+ [theirs]+ );}#[tokio::test]@@ -222,9 +231,7 @@ async fn rpc_learn_uses_the_layout_default_and_refuses_an_explicit_outside_nameslet engine = bind_reference(&config);let identity = Identity::root().resolve(&crate::memory::scope::identity_pins(&config));let rpc = confinement(&config, &Identity::root());- let default_meta = rpc- .learn_meta(None, identity.layout.learnings())- .unwrap();+ let default_meta = rpc.learn_meta(None, identity.layout.learnings()).unwrap();let result = crate::memory::ops::learn(&config,LearnParams {diff --git a/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs b/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rsindex 350490b10f..51b73c890b 100644--- a/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs+++ b/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs@@ -145,7 +145,8 @@ async fn pre_turn_logs_the_user_turn_and_injects_what_memory_holds() {)).await.unwrap();- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));let pack = run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),@@ -188,7 +189,8 @@ async fn recall_off_still_logs_and_logging_off_still_recalls() {.unwrap();config.memory.recall.enabled = false;- let quiet = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let quiet = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));assert!(run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config,@@ -206,7 +208,8 @@ async fn recall_off_still_logs_and_logging_off_still_recalls() {config.memory.recall.enabled = true;config.memory.conversations.enabled = false;- let reader = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let reader = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));let pack = run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config,@@ -224,7 +227,8 @@ async fn recall_off_still_logs_and_logging_off_still_recalls() {);config.memory.recall.enabled = false;- let none = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let none = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));assert!(run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config,@@ -239,7 +243,8 @@ async fn recall_off_still_logs_and_logging_off_still_recalls() {async fn pre_turn_without_an_engine_runs_the_turn_without_a_pack() {let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));assert!(run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config,@@ -257,7 +262,8 @@ async fn post_turn_logs_the_reply_and_queues_belief_builds() {let mut config = config_in(&tmp);config.memory.recall.build_beliefs_every = 2;let engine = bind_reference(&config);- let identity = tinymemory_tools::layout::identity::Identity::agent("writer").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("writer")+ .resolve(&crate::memory::scope::identity_pins(&config));let mut first = reply("t", 1, "Here is the draft.");first.3.push(ToolCallSummary {@@ -293,7 +299,8 @@ async fn compaction_recalls_from_the_dropped_turns() {let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);bind_reference(&config);- let identity = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));let _ = run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config,@@ -319,7 +326,8 @@ async fn an_out_of_credits_recall_tells_the_turn_memory_is_unavailable() {let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);crate::memory::test_fixtures::RefusingEngine::out_of_credits().bind(&config);- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));let pack = run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),@@ -349,7 +357,8 @@ async fn an_unreachable_engine_is_named_as_unreachable() {"connection refused".into(),)).bind(&config);- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));let pack = run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),@@ -376,7 +385,8 @@ async fn an_engine_fault_that_is_not_account_wide_injects_nothing() {"index corrupt".into(),)).bind(&config);- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));assert!(run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),@@ -466,7 +476,8 @@ async fn a_turn_pack_stays_within_its_budget_against_a_large_store() {let config = config_in(&tmp);let engine = bind_reference(&config);fill_with_learnings(&engine, 1500).await;- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));let pack = run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),@@ -505,7 +516,8 @@ async fn a_resumed_session_pack_stays_within_one_budget_and_repeats_nothing() {let config = config_in(&tmp);let engine = bind_reference(&config);fill_with_learnings(&engine, 1500).await;- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));// Earlier turns of the thread, logged the way a session logs them. Each// line is distinct, so a repeat can only be one item injected twice.for turn in 0..6u32 {@@ -575,7 +587,8 @@ async fn a_resumed_session_without_logging_still_opens_with_the_thread() {let tmp = tempfile::tempdir().unwrap();let mut config = config_in(&tmp);let _engine = bind_reference(&config);- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));let _ = run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config,@@ -591,7 +604,8 @@ async fn a_resumed_session_without_logging_still_opens_with_the_thread() {.await;config.memory.conversations.enabled = false;- let reader = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let reader = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));let mut resumed = input("t-quiet", 2, "remind me where the offsite is");resumed.5 = true;resumed.3 = 2;@@ -612,7 +626,8 @@ async fn a_blank_turn_is_refused_without_a_pack_with_or_without_logging() {let tmp = tempfile::tempdir().unwrap();let mut config = config_in(&tmp);let engine = bind_reference(&config);- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));assert!(run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config,@@ -629,7 +644,8 @@ async fn a_blank_turn_is_refused_without_a_pack_with_or_without_logging() {);config.memory.conversations.enabled = false;- let reader = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let reader = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));assert!(run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config,@@ -676,7 +692,8 @@ async fn a_date_hint_asks_the_model_in_the_users_zone_and_never_costs_the_pack())).await.unwrap();- let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("orchestrator")+ .resolve(&crate::memory::scope::identity_pins(&config));let pack = run_pre_turn(&crate::core::runtime::DispatchCtx::ambient(),diff --git a/crates/openhuman-core/src/memory/lifecycle/mod.rs b/crates/openhuman-core/src/memory/lifecycle/mod.rsindex 05b107899d..c6a1b184ce 100644--- a/crates/openhuman-core/src/memory/lifecycle/mod.rs+++ b/crates/openhuman-core/src/memory/lifecycle/mod.rs@@ -32,8 +32,8 @@ use crate::config::schema::MemoryRecallConfig;use crate::config::Config;use super::engine;-use tinymemory_tools::layout::identity::ResolvedIdentity;use tinymemory_api::{Error, Result};+use tinymemory_tools::layout::identity::ResolvedIdentity;/// TinyMemory's recall policy from `[memory.recall]`.#[must_use]diff --git a/crates/openhuman-core/src/memory/lifecycle/mod_tests.rs b/crates/openhuman-core/src/memory/lifecycle/mod_tests.rsindex 1b81523f2a..6c04b6fbc8 100644--- a/crates/openhuman-core/src/memory/lifecycle/mod_tests.rs+++ b/crates/openhuman-core/src/memory/lifecycle/mod_tests.rs@@ -40,7 +40,8 @@ fn the_policy_mirrors_the_recall_config() {async fn agent_memory_needs_an_engine_and_follows_the_identity() {let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::team_member("acme", "writer").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::team_member("acme", "writer")+ .resolve(&crate::memory::scope::identity_pins(&config));assert!(matches!(agent_memory(&config, &identity),Err(Error::Off(_))@@ -51,10 +52,18 @@ async fn agent_memory_needs_an_engine_and_follows_the_identity() {assert_eq!(memory.agent_id(), "writer");assert_eq!(memory.namespace().to_string(), "team:acme/agent:writer");- let (named, _) = named_agent_memory(&config, &tinymemory_tools::layout::identity::Identity::root(), Some("auditor")).unwrap();+ let (named, _) = named_agent_memory(+ &config,+ &tinymemory_tools::layout::identity::Identity::root(),+ Some("auditor"),+ )+ .unwrap();assert_eq!(named.namespace().to_string(), "agent:auditor");- let (current, resolved) =- current_agent_memory(&config, &tinymemory_tools::layout::identity::Identity::root().child("planner")).unwrap();+ let (current, resolved) = current_agent_memory(+ &config,+ &tinymemory_tools::layout::identity::Identity::root().child("planner"),+ )+ .unwrap();assert_eq!(current.agent_id(), "planner");assert_eq!(resolved.agent_id, "planner");}diff --git a/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs b/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rsindex 702b569977..55e0962c7d 100644--- a/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs+++ b/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs@@ -32,7 +32,8 @@ async fn held_refresh_returns_immediately_and_later_turn_reads_completed_contextlet _guard = TEST_LOCK.lock().await;let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));let key = Key::new(&config, &identity, "t", false);let cache = Arc::new(Cache::default());let release = Arc::new(tokio::sync::Notify::new());@@ -59,7 +60,8 @@ async fn identity_config_thread_workspace_and_context_are_isolated() {let _guard = TEST_LOCK.lock().await;let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));let key = Key::new(&config, &identity, "t", false);let cache = Arc::new(Cache::default());enqueue(@@ -92,7 +94,8 @@ async fn identity_config_thread_workspace_and_context_are_isolated() {fn prefetch_key_tracks_memory_config_without_hashing_unrelated_config() {let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));let key = Key::new(&config, &identity, "t", false);let mut memory_changed = config.clone();@@ -117,7 +120,8 @@ async fn invalidation_rejects_late_results_and_preserves_bounded_pending_logs()let _guard = TEST_LOCK.lock().await;let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));let key = Key::new(&config, &identity, "t", false);let cache = Arc::new(Cache::default());CACHES.lock().unwrap().push(Arc::downgrade(&cache));@@ -166,7 +170,8 @@ async fn expiration_failure_and_oversized_packs_are_not_reused() {let _guard = TEST_LOCK.lock().await;let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));let key = Key::new(&config, &identity, "t", false);let cache = Arc::new(Cache::default());enqueue(@@ -193,7 +198,8 @@ async fn credential_invalidation_removes_ready_and_rejects_late_inflight_resultslet _guard = TEST_LOCK.lock().await;let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));let key = Key::new(&config, &identity, "t", false);let cache = Arc::new(Cache::default());CACHES.lock().unwrap().push(Arc::downgrade(&cache));@@ -325,7 +331,8 @@ async fn slow_engine_results_survive_the_manual_pre_turn_cutoff() {.await.unwrap();crate::memory::engine::install_test_engine(&config.workspace_dir, engine.clone());- let identity = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));let input = |index| {("slow".to_string(),@@ -400,7 +407,8 @@ async fn queued_work_keeps_the_callers_core_context() {Some(config.workspace_dir.clone()),);crate::core::runtime::CoreContext::scope(ctx.clone(), async {- let identity = tinymemory_tools::layout::identity::Identity::agent("scoped-agent").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("scoped-agent")+ .resolve(&crate::memory::scope::identity_pins(&config));let key = Key::new(&config, &identity, "t", false);let cache = cache(&crate::core::runtime::DispatchCtx::ambient());let expected = ctx.clone();@@ -428,7 +436,8 @@ fn runtime_shutdown_releases_worker_and_pending_work() {let _guard = TEST_LOCK.blocking_lock();let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::agent("a").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("a")+ .resolve(&crate::memory::scope::identity_pins(&config));let key = Key::new(&config, &identity, "t", false);let cache = Arc::new(Cache::default());let runtime = tokio::runtime::Builder::new_current_thread()@@ -467,7 +476,8 @@ async fn an_erase_retires_queued_automatic_work_and_allows_later_work() {use std::sync::atomic::{AtomicUsize, Ordering};let tmp = tempfile::tempdir().unwrap();let config = crate::memory::test_fixtures::config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::agent("erase-prefetch").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("erase-prefetch")+ .resolve(&crate::memory::scope::identity_pins(&config));let key = Key::new(&config, &identity, "erase-prefetch", false);let cache = Arc::new(Cache::default());let earlier = Arc::new(AtomicUsize::new(0));@@ -518,7 +528,8 @@ async fn an_erase_retires_queued_automatic_work_and_allows_later_work() {async fn erase_waits_for_current_automatic_work_before_returning_its_barrier() {let tmp = tempfile::tempdir().unwrap();let config = crate::memory::test_fixtures::config_in(&tmp);- let identity = tinymemory_tools::layout::identity::Identity::agent("erase-active").resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::agent("erase-active")+ .resolve(&crate::memory::scope::identity_pins(&config));let key = Key::new(&config, &identity, "erase-active", false);let cache = Arc::new(Cache::default());let started = Arc::new(tokio::sync::Notify::new());diff --git a/crates/openhuman-core/src/memory/lifecycle/views.rs b/crates/openhuman-core/src/memory/lifecycle/views.rsindex 8aa41c5db7..4188d7de80 100644--- a/crates/openhuman-core/src/memory/lifecycle/views.rs+++ b/crates/openhuman-core/src/memory/lifecycle/views.rs@@ -30,7 +30,8 @@ pub struct PolicyView {/// `memory_policy_get`.#[must_use]pub fn policy_view(config: &Config) -> PolicyView {- let resolved = tinymemory_tools::layout::identity::Identity::root().resolve(&crate::memory::scope::identity_pins(config));+ let resolved = tinymemory_tools::layout::identity::Identity::root()+ .resolve(&crate::memory::scope::identity_pins(config));PolicyView {log_conversations: config.memory.conversations.enabled,recall: config.memory.recall.clone(),@@ -251,7 +252,10 @@ pub struct AgentsView {}/// `memory_agents_list`: the agents with conversations under the root.-pub async fn agents_list(config: &Config, identity: &tinymemory_tools::layout::identity::Identity) -> Result<AgentsView> {+pub async fn agents_list(+ config: &Config,+ identity: &tinymemory_tools::layout::identity::Identity,+) -> Result<AgentsView> {let (memory, identity) = super::current_agent_memory(config, identity)?;let page = memory.engine()diff --git a/crates/openhuman-core/src/memory/lifecycle/views_tests.rs b/crates/openhuman-core/src/memory/lifecycle/views_tests.rsindex d6c1faa431..30a4f9fb55 100644--- a/crates/openhuman-core/src/memory/lifecycle/views_tests.rs+++ b/crates/openhuman-core/src/memory/lifecycle/views_tests.rs@@ -123,7 +123,8 @@ async fn the_preview_reads_without_logging_and_agents_are_listed() {)).await.unwrap();- let writer = tinymemory_tools::layout::identity::Identity::agent("writer").resolve(&crate::memory::scope::identity_pins(&config));+ let writer = tinymemory_tools::layout::identity::Identity::agent("writer")+ .resolve(&crate::memory::scope::identity_pins(&config));pre_turn_work(&crate::core::runtime::DispatchCtx::ambient(),&config,@@ -162,7 +163,12 @@ async fn the_preview_reads_without_logging_and_agents_are_listed() {.unwrap();assert_eq!(session.mode, "session");- let agents = agents_list(&config, &tinymemory_tools::layout::identity::Identity::root()).await.unwrap();+ let agents = agents_list(+ &config,+ &tinymemory_tools::layout::identity::Identity::root(),+ )+ .await+ .unwrap();assert_eq!(agents.agents,[AgentCount {diff --git a/crates/openhuman-core/src/memory/ops.rs b/crates/openhuman-core/src/memory/ops.rsindex 6a4a55ec1c..93cc858fac 100644--- a/crates/openhuman-core/src/memory/ops.rs+++ b/crates/openhuman-core/src/memory/ops.rs@@ -9,8 +9,8 @@use chrono::Utc;use tinymemory_api::{EraseRequest, FetchRequest, ForgetTarget, ItemId, LearningKind, ListRequest, MemoryMeta,- MetaFilter, Namespace, Reach, RecallMode, RecallRequest, StoreItem, StoreReceipt,- ThreadWindow, TimeHint, WriteOptions,+ MetaFilter, Namespace, Reach, RecallMode, RecallRequest, StoreItem, StoreReceipt, ThreadWindow,+ TimeHint, WriteOptions,};use tinymemory_tools::confine::{Confinement, Policy};diff --git a/crates/openhuman-core/src/memory/ops_tests.rs b/crates/openhuman-core/src/memory/ops_tests.rsindex fe62372380..94e24bc7ab 100644--- a/crates/openhuman-core/src/memory/ops_tests.rs+++ b/crates/openhuman-core/src/memory/ops_tests.rs@@ -15,7 +15,8 @@ use tinymemory_api::{#[test]fn invalid_saas_root_is_refused_before_store_reaches_the_engine() {const CHILD: &str = "OPENHUMAN_TEST_SAAS_MEMORY_STORE_GUARD";- const TEST_NAME: &str = "memory::ops::tests::invalid_saas_root_is_refused_before_store_reaches_the_engine";+ const TEST_NAME: &str =+ "memory::ops::tests::invalid_saas_root_is_refused_before_store_reaches_the_engine";if std::env::var_os(CHILD).is_none() {let output = std::process::Command::new(std::env::current_exe().unwrap())@@ -271,18 +272,12 @@ impl MemoryEngine for CountingEngine {self.inner.store(item).await}- async fn forget(- &self,- target: ForgetTarget,- ) -> tinymemory_api::Result<ForgetReport> {+ async fn forget(&self, target: ForgetTarget) -> tinymemory_api::Result<ForgetReport> {self.calls.fetch_add(1, Ordering::SeqCst);self.inner.forget(target).await}- async fn list(- &self,- request: ListRequest,- ) -> tinymemory_api::Result<tinymemory_api::ListPage> {+ async fn list(&self, request: ListRequest) -> tinymemory_api::Result<tinymemory_api::ListPage> {self.calls.fetch_add(1, Ordering::SeqCst);self.inner.list(request).await}diff --git a/crates/openhuman-core/src/memory/schemas/handlers.rs b/crates/openhuman-core/src/memory/schemas/handlers.rsindex 7c12593c0b..1338a725c2 100644--- a/crates/openhuman-core/src/memory/schemas/handlers.rs+++ b/crates/openhuman-core/src/memory/schemas/handlers.rs@@ -115,35 +115,50 @@ pub(super) fn engine_set(ctx: DispatchCtx, params: Map<String, Value>) -> Contro}pub(super) fn recall(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {- rpc::<RecallParams, _>(ctx, params, |_, config, mut params: RecallParams| async move {- params.filter = Some(rpc_confinement(&config).filter(params.filter)?);- ops::recall(&config, params).await- })+ rpc::<RecallParams, _>(+ ctx,+ params,+ |_, config, mut params: RecallParams| async move {+ params.filter = Some(rpc_confinement(&config).filter(params.filter)?);+ ops::recall(&config, params).await+ },+ )}pub(super) fn fetch(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {- rpc::<FetchParams, _>(ctx, params, |_, config, mut params: FetchParams| async move {- params.filter = Some(rpc_confinement(&config).filter(params.filter)?);- ops::fetch(&config, params).await- })+ rpc::<FetchParams, _>(+ ctx,+ params,+ |_, config, mut params: FetchParams| async move {+ params.filter = Some(rpc_confinement(&config).filter(params.filter)?);+ ops::fetch(&config, params).await+ },+ )}pub(super) fn learn(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {- rpc::<LearnParams, _>(ctx, params, |_, config, mut params: LearnParams| async move {- let identity = Identity::root().resolve(&scope::identity_pins(&config));- params.meta = Some(- rpc_confinement(&config)- .learn_meta(params.meta, identity.layout.learnings())?,- );- ops::learn(&config, params, None).await- })+ rpc::<LearnParams, _>(+ ctx,+ params,+ |_, config, mut params: LearnParams| async move {+ let identity = Identity::root().resolve(&scope::identity_pins(&config));+ params.meta = Some(+ rpc_confinement(&config).learn_meta(params.meta, identity.layout.learnings())?,+ );+ ops::learn(&config, params, None).await+ },+ )}pub(super) fn forget(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {- rpc::<ForgetParams, _>(ctx, params, |_, config, mut params: ForgetParams| async move {- params.reach = Some(rpc_confinement(&config).reach(params.reach)?);- ops::forget(&config, params).await- })+ rpc::<ForgetParams, _>(+ ctx,+ params,+ |_, config, mut params: ForgetParams| async move {+ params.reach = Some(rpc_confinement(&config).reach(params.reach)?);+ ops::forget(&config, params).await+ },+ )}pub(super) fn erase_all(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {@@ -153,28 +168,40 @@ pub(super) fn erase_all(ctx: DispatchCtx, params: Map<String, Value>) -> Control}pub(super) fn items_list(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {- rpc::<ItemsListParams, _>(ctx, params, |_, config, mut params: ItemsListParams| async move {- let narrowed = explore::narrowed(params.filter.take(), ¶ms.path)?;- params.filter = Some(rpc_confinement(&config).filter(Some(narrowed))?);- params.path.clear();- ops::items_list(&config, params).await- })+ rpc::<ItemsListParams, _>(+ ctx,+ params,+ |_, config, mut params: ItemsListParams| async move {+ let narrowed = explore::narrowed(params.filter.take(), ¶ms.path)?;+ params.filter = Some(rpc_confinement(&config).filter(Some(narrowed))?);+ params.path.clear();+ ops::items_list(&config, params).await+ },+ )}pub(super) fn explore(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {- rpc::<ExploreParams, _>(ctx, params, |_, config, mut params: ExploreParams| async move {- let narrowed = explore::narrowed(params.filter.take(), ¶ms.path)?;- params.filter = Some(rpc_confinement(&config).filter(Some(narrowed))?);- params.path.clear();- explore::explore(&config, params).await- })+ rpc::<ExploreParams, _>(+ ctx,+ params,+ |_, config, mut params: ExploreParams| async move {+ let narrowed = explore::narrowed(params.filter.take(), ¶ms.path)?;+ params.filter = Some(rpc_confinement(&config).filter(Some(narrowed))?);+ params.path.clear();+ explore::explore(&config, params).await+ },+ )}pub(super) fn items_get(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {- rpc::<ItemsGetParams, _>(ctx, params, |_, config, mut params: ItemsGetParams| async move {- params.reach = Some(rpc_confinement(&config).reach(params.reach)?);- explore::items_get(&config, params).await- })+ rpc::<ItemsGetParams, _>(+ ctx,+ params,+ |_, config, mut params: ItemsGetParams| async move {+ params.reach = Some(rpc_confinement(&config).reach(params.reach)?);+ explore::items_get(&config, params).await+ },+ )}pub(super) fn policy_get(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {diff --git a/crates/openhuman-core/src/memory/schemas_tests.rs b/crates/openhuman-core/src/memory/schemas_tests.rsindex a252fc6d08..3cdcf0d509 100644--- a/crates/openhuman-core/src/memory/schemas_tests.rs+++ b/crates/openhuman-core/src/memory/schemas_tests.rs@@ -357,10 +357,7 @@ async fn rpc_memory_handlers_apply_the_refuse_boundary_before_operations() {"forget",json!({"ids": ["not-present"], "reach": outside.clone()}),),- (- "items_list",- json!({"filter": {"reach": outside.clone()}}),- ),+ ("items_list", json!({"filter": {"reach": outside.clone()}})),("explore",json!({@@ -539,7 +536,8 @@ async fn rpc_learn_invalidates_a_cached_prefetch_pack() {let ctx = CoreContext::for_test_with_config(DomainSet::full(), config.clone());let dispatch = DispatchCtx::new(ctx.clone());- let identity = tinymemory_tools::layout::identity::Identity::root().resolve(&crate::memory::scope::identity_pins(&config));+ let identity = tinymemory_tools::layout::identity::Identity::root()+ .resolve(&crate::memory::scope::identity_pins(&config));let thread = "rpc-learn-invalidates-prefetch";let input = || {(diff --git a/crates/openhuman-core/src/memory/scope_tests.rs b/crates/openhuman-core/src/memory/scope_tests.rsindex 3c9e6759df..cfbc8db41c 100644--- a/crates/openhuman-core/src/memory/scope_tests.rs+++ b/crates/openhuman-core/src/memory/scope_tests.rs@@ -34,7 +34,10 @@ fn config_identity_adapter_preserves_host_definition_recall_and_v3_pins() {assert!(!pins.recall);assert!(pins.v3);assert_eq!(pins.agents.len(), 1);- assert_eq!(pins.agents["planner"].agent_id.as_deref(), Some("planner-memory"));+ assert_eq!(+ pins.agents["planner"].agent_id.as_deref(),+ Some("planner-memory")+ );assert_eq!(pins.agents["planner"].root.as_deref(), Some("project:q4"));assert_eq!(pins.agents["planner"].recall, Some(true));@@ -42,7 +45,10 @@ fn config_identity_adapter_preserves_host_definition_recall_and_v3_pins() {assert_eq!(resolved.agent_id, "host-agent");assert_eq!(resolved.root(), &ns("team:host"));assert!(resolved.recall);- assert_eq!(resolved.layout.pooled_conversations_node(), Some(&ns("team:host/ws:main")));+ assert_eq!(+ resolved.layout.pooled_conversations_node(),+ Some(&ns("team:host/ws:main"))+ );}#[test]@@ -105,15 +111,19 @@ fn upstream_v3_identity_pools_at_the_account_root_workspace() {#[test]fn by_default_an_agent_is_its_definition_under_the_default_root() {let config = Config::default();- let researcher = tinymemory_tools::layout::identity::Identity::agent("researcher").resolve(&crate::memory::scope::identity_pins(&config));+ let researcher = tinymemory_tools::layout::identity::Identity::agent("researcher")+ .resolve(&crate::memory::scope::identity_pins(&config));assert_eq!(researcher.agent_id, "researcher");assert_eq!(researcher.root(), &Namespace::ROOT);assert!(researcher.recall);- let nobody = tinymemory_tools::layout::identity::Identity::root().resolve(&crate::memory::scope::identity_pins(&config));+ let nobody = tinymemory_tools::layout::identity::Identity::root()+ .resolve(&crate::memory::scope::identity_pins(&config));assert_eq!(nobody.agent_id, DEFAULT_AGENT_ID);assert_eq!(- tinymemory_tools::layout::identity::Identity::agent(" ").resolve(&crate::memory::scope::identity_pins(&config)).agent_id,+ tinymemory_tools::layout::identity::Identity::agent(" ")+ .resolve(&crate::memory::scope::identity_pins(&config))+ .agent_id,DEFAULT_AGENT_ID);}@@ -121,15 +131,22 @@ fn by_default_an_agent_is_its_definition_under_the_default_root() {#[test]fn a_team_member_shares_its_teams_root() {let config = Config::default();- let writer = tinymemory_tools::layout::identity::Identity::team_member("acme", "writer").resolve(&crate::memory::scope::identity_pins(&config));+ let writer = tinymemory_tools::layout::identity::Identity::team_member("acme", "writer")+ .resolve(&crate::memory::scope::identity_pins(&config));assert_eq!(writer.root(), &ns("team:acme"));assert_eq!(writer.agent_id, "writer");assert_eq!(writer.layout.conversations("writer").unwrap(),ns("team:acme/agent:writer"));- let child = tinymemory_tools::layout::identity::Identity::team_member("acme", "lead").child("scout");- assert_eq!(child.resolve(&crate::memory::scope::identity_pins(&config)).root(), &ns("team:acme"));+ let child =+ tinymemory_tools::layout::identity::Identity::team_member("acme", "lead").child("scout");+ assert_eq!(+ child+ .resolve(&crate::memory::scope::identity_pins(&config))+ .root(),+ &ns("team:acme")+ );}#[test]@@ -150,12 +167,15 @@ fn a_definition_pin_beats_the_team_and_the_default() {..MemoryAgentConfig::default()},);- let analyst = tinymemory_tools::layout::identity::Identity::team_member("acme", "analyst").resolve(&crate::memory::scope::identity_pins(&config));+ let analyst = tinymemory_tools::layout::identity::Identity::team_member("acme", "analyst")+ .resolve(&crate::memory::scope::identity_pins(&config));assert_eq!(analyst.agent_id, "q4-desk");assert_eq!(analyst.root(), &ns("project:q4"));assert!(!analyst.recall);assert_eq!(- tinymemory_tools::layout::identity::Identity::agent("broken").resolve(&crate::memory::scope::identity_pins(&config)).root(),+ tinymemory_tools::layout::identity::Identity::agent("broken")+ .resolve(&crate::memory::scope::identity_pins(&config))+ .root(),&Namespace::ROOT,"an invalid root falls back to the default");@@ -271,7 +291,8 @@ fn the_user_root_is_read_from_where_the_config_lives() {#[test]fn layout_v3_pools_every_agents_chats_at_ws_main() {let mut config = Config::default();- let legacy = tinymemory_tools::layout::identity::Identity::agent("researcher").resolve(&crate::memory::scope::identity_pins(&config));+ let legacy = tinymemory_tools::layout::identity::Identity::agent("researcher")+ .resolve(&crate::memory::scope::identity_pins(&config));assert_eq!(legacy.layout.conversations("researcher").unwrap(),ns("agent:researcher")@@ -280,8 +301,10 @@ fn layout_v3_pools_every_agents_chats_at_ws_main() {config.memory.layout = MemoryLayoutMode::V3;assert_eq!(config.memory.layout, MemoryLayoutMode::V3);- let researcher = tinymemory_tools::layout::identity::Identity::agent("researcher").resolve(&crate::memory::scope::identity_pins(&config));- let coder = tinymemory_tools::layout::identity::Identity::agent("coder").resolve(&crate::memory::scope::identity_pins(&config));+ let researcher = tinymemory_tools::layout::identity::Identity::agent("researcher")+ .resolve(&crate::memory::scope::identity_pins(&config));+ let coder = tinymemory_tools::layout::identity::Identity::agent("coder")+ .resolve(&crate::memory::scope::identity_pins(&config));assert_eq!(researcher.layout.conversations("researcher").unwrap(),ns("ws:main")@@ -291,7 +314,8 @@ fn layout_v3_pools_every_agents_chats_at_ws_main() {let history = researcher.layout.conversations_filter(Some("researcher"));assert_eq!(history.agent_id.as_deref(), Some("researcher"));- let team = tinymemory_tools::layout::identity::Identity::team_member("acme", "writer").resolve(&crate::memory::scope::identity_pins(&config));+ let team = tinymemory_tools::layout::identity::Identity::team_member("acme", "writer")+ .resolve(&crate::memory::scope::identity_pins(&config));assert_eq!(chat_node(&team.layout), ns("team:acme/ws:main"));}diff --git a/crates/openhuman-core/src/memory/tool_writes.rs b/crates/openhuman-core/src/memory/tool_writes.rsindex 6a45c5a6d0..1334ef5f8f 100644--- a/crates/openhuman-core/src/memory/tool_writes.rs+++ b/crates/openhuman-core/src/memory/tool_writes.rs@@ -558,7 +558,9 @@ fn schedule_partition(ctx: &crate::core::runtime::DispatchCtx, config: Arc<Confipub(crate) async fn drain(config: &Config) -> usize {let file = queue_path(config,- tinymemory_tools::layout::identity::Identity::root().resolve(&crate::memory::scope::identity_pins(config)).root(),+ tinymemory_tools::layout::identity::Identity::root()+ .resolve(&crate::memory::scope::identity_pins(config))+ .root(),);let owner = owner_state(config);let _owner = owner.barrier.read().await;diff --git a/crates/openhuman-core/src/memory/tool_writes_tests.rs b/crates/openhuman-core/src/memory/tool_writes_tests.rsindex 1d610653f1..3926b802cb 100644--- a/crates/openhuman-core/src/memory/tool_writes_tests.rs+++ b/crates/openhuman-core/src/memory/tool_writes_tests.rs@@ -5,7 +5,10 @@ use tinymemory_api::Reach;use tinymemory_api::{MetaFilter, Namespace};fn facts(config: &Config) -> CallFacts {- CallFacts::of(config, &tinymemory_tools::layout::identity::Identity::agent("outbox-agent"))+ CallFacts::of(+ config,+ &tinymemory_tools::layout::identity::Identity::agent("outbox-agent"),+ )}#[test]@@ -374,7 +377,10 @@ async fn model_supplied_forget_reach_cannot_remove_another_identitys_item() {let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);let engine = bind_reference(&config);- let other_facts = CallFacts::of(&config, &tinymemory_tools::layout::identity::Identity::agent("different-agent"));+ let other_facts = CallFacts::of(+ &config,+ &tinymemory_tools::layout::identity::Identity::agent("different-agent"),+ );let item = StoreItem::learning("Other identity's learning",LearningKind::Fact,diff --git a/crates/openhuman-core/src/memory/tools.rs b/crates/openhuman-core/src/memory/tools.rsindex 9e0b62ce33..fa9106d003 100644--- a/crates/openhuman-core/src/memory/tools.rs+++ b/crates/openhuman-core/src/memory/tools.rs@@ -98,9 +98,14 @@ impl CallFacts {crate::agent::tinyagents::host::run_context::memory_identity_for_tool(context).unwrap_or_else(|| {crate::agent::tinyagents::host::run_context::parent_agent_id_for_tool(context)- .map_or_else(tinymemory_tools::layout::identity::Identity::root, |parent_agent_id| {- tinymemory_tools::layout::identity::Identity::agent(&parent_agent_id)- })+ .map_or_else(+ tinymemory_tools::layout::identity::Identity::root,+ |parent_agent_id| {+ tinymemory_tools::layout::identity::Identity::agent(+ &parent_agent_id,+ )+ },+ )});Self {workspace: Some(workspace.display().to_string()),diff --git a/crates/openhuman-core/src/memory/tools_agent_tests.rs b/crates/openhuman-core/src/memory/tools_agent_tests.rsindex bee4550a3e..90c7958cfb 100644--- a/crates/openhuman-core/src/memory/tools_agent_tests.rs+++ b/crates/openhuman-core/src/memory/tools_agent_tests.rs@@ -19,9 +19,9 @@ fn tool_context_acting_as(#[test]fn gather_acts_as_the_identity_the_run_carries() {let config = Config::default();- let context = tool_context_acting_as(tinymemory_tools::layout::identity::Identity::team_member(- "acme", "scout",- ));+ let context = tool_context_acting_as(+ tinymemory_tools::layout::identity::Identity::team_member("acme", "scout"),+ );let facts = CallFacts::gather(&config, Some(&context));assert_eq!(facts.agent_id.as_deref(), Some("scout"));assert_eq!(facts.reach, Reach::subtree("team:acme".parse().unwrap()));diff --git a/crates/openhuman-core/src/memory/tools_read_tests.rs b/crates/openhuman-core/src/memory/tools_read_tests.rsindex 7ae83f4d67..987c548ad7 100644--- a/crates/openhuman-core/src/memory/tools_read_tests.rs+++ b/crates/openhuman-core/src/memory/tools_read_tests.rs@@ -9,7 +9,10 @@ fn facts() -> CallFacts {CallFacts {thread_id: Some("thread-tool-1".into()),agent_id: Some("orchestrator".into()),- ..CallFacts::of(&Config::default(), &tinymemory_tools::layout::identity::Identity::agent("orchestrator"))+ ..CallFacts::of(+ &Config::default(),+ &tinymemory_tools::layout::identity::Identity::agent("orchestrator"),+ )}}diff --git a/crates/openhuman-core/src/memory/tools_tests.rs b/crates/openhuman-core/src/memory/tools_tests.rsindex 0d65951303..46f9cd7d12 100644--- a/crates/openhuman-core/src/memory/tools_tests.rs+++ b/crates/openhuman-core/src/memory/tools_tests.rs@@ -27,7 +27,10 @@ fn facts() -> CallFacts {thread_id: Some("thread-tool-1".into()),agent_id: Some("orchestrator".into()),tool_call_id: Some("call-9".into()),- ..CallFacts::of(&Config::default(), &tinymemory_tools::layout::identity::Identity::agent("orchestrator"))+ ..CallFacts::of(+ &Config::default(),+ &tinymemory_tools::layout::identity::Identity::agent("orchestrator"),+ )}}@@ -35,7 +38,10 @@ fn facts() -> CallFacts {fn facts_of(agent_id: &str) -> CallFacts {CallFacts {thread_id: Some(format!("thread-{agent_id}")),- ..CallFacts::of(&Config::default(), &tinymemory_tools::layout::identity::Identity::agent(agent_id))+ ..CallFacts::of(+ &Config::default(),+ &tinymemory_tools::layout::identity::Identity::agent(agent_id),+ )}}@@ -331,7 +337,10 @@ async fn learnings_are_shared_under_a_root_and_a_team_root_is_kept_apart() {let engine = bind_reference(&config);let member = || CallFacts {thread_id: Some("thread-team".into()),- ..CallFacts::of(&config, &tinymemory_tools::layout::identity::Identity::team_member("acme", "writer"))+ ..CallFacts::of(+ &config,+ &tinymemory_tools::layout::identity::Identity::team_member("acme", "writer"),+ )};let learn = |facts: CallFacts, text: &'static str| {let config = config.clone();diff --git a/crates/openhuman-core/src/profiles/layout_tests.rs b/crates/openhuman-core/src/profiles/layout_tests.rsindex 9022865934..a5d4859da1 100644--- a/crates/openhuman-core/src/profiles/layout_tests.rs+++ b/crates/openhuman-core/src/profiles/layout_tests.rs@@ -68,7 +68,8 @@ fn a_profile_binds_its_user_root_never_an_org_root() {// and every operation is confined to `user:<id>`.assert_eq!(config.memory.layout, MemoryLayoutMode::Legacy);assert_ne!(config.memory.layout, MemoryLayoutMode::V3);- let bound = tinymemory_tools::layout::identity::Identity::root().resolve(&crate::memory::scope::identity_pins(&config));+ let bound = tinymemory_tools::layout::identity::Identity::root()+ .resolve(&crate::memory::scope::identity_pins(&config));assert_eq!(bound.root().to_string(), "user:65f1c0ffee0123456789abcd");assert_eq!(bound.agent_id, id.as_str());assert_eq!(bound.root().to_string(), "user:65f1c0ffee0123456789abcd");@@ -76,13 +77,14 @@ fn a_profile_binds_its_user_root_never_an_org_root() {#[test]fn the_memory_binding_wins_over_pins_and_teams() {- let layout = profile_layout(Path::new("/srv/oh"), &id());+ let layout = profile_layout(Path::new("/srv/oh"), &id());let mut config = profile_config(&layout, &id());config.memory.agents.insert("planner".into(),toml::from_str("agent_id = \"other\"\nroot = \"team:shared\"").unwrap(),);- let resolved = tinymemory_tools::layout::identity::Identity::team_member("shared", "planner").resolve(&crate::memory::scope::identity_pins(&config));+ let resolved = tinymemory_tools::layout::identity::Identity::team_member("shared", "planner")+ .resolve(&crate::memory::scope::identity_pins(&config));assert_eq!(resolved.agent_id, id().as_str());assert_eq!(resolved.root().to_string(), memory_root(&id()));}diff --git a/crates/openhuman-embed/src/memory.rs b/crates/openhuman-embed/src/memory.rsindex 4c01c94fb6..7591690816 100644--- a/crates/openhuman-embed/src/memory.rs+++ b/crates/openhuman-embed/src/memory.rs@@ -193,7 +193,11 @@ impl Memory {/// The agents with logged turns under the root, most first.pub async fn agents(&self) -> Result<AgentsView> {- lifecycle::views::agents_list(&self.config, &tinymemory_tools::layout::identity::Identity::root()).await+ lifecycle::views::agents_list(+ &self.config,+ &tinymemory_tools::layout::identity::Identity::root(),+ )+ .await}/// A page of items, newest first.@@ -377,7 +381,11 @@ impl Memory {/// The brain's sources under the root and their sizes.pub async fn brain_sources(&self) -> Result<BrainSourcesView> {- brain::sources(&self.config, &tinymemory_tools::layout::identity::Identity::root()).await+ brain::sources(+ &self.config,+ &tinymemory_tools::layout::identity::Identity::root(),+ )+ .await}/// Brain documents matching `query`, optionally of one source.@@ -401,7 +409,12 @@ impl Memory {/// Files a document (a file on disk, or text) in the root's brain.pub async fn brain_ingest(&self, params: BrainIngestParams) -> Result<BrainIngestView> {- brain::ingest(&self.config, &tinymemory_tools::layout::identity::Identity::root(), params).await+ brain::ingest(+ &self.config,+ &tinymemory_tools::layout::identity::Identity::root(),+ params,+ )+ .await}/// Forgets every brain document of one source under the root.