Skip to content

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

feat(memory): shed the engine crates from the host's production surface

Shanua490aa9af706
diff --git a/src/openhuman/flows/tinyflows/memory_adapter.rs b/src/openhuman/flows/tinyflows/memory_adapter.rs
index 22c4eefb00..1b908f145d 100644
--- a/src/openhuman/flows/tinyflows/memory_adapter.rs
+++ b/src/openhuman/flows/tinyflows/memory_adapter.rs
@@ -63,7 +63,7 @@ const LOG_PREFIX: &str = "[memory-node-host]";
/// (`RecallOpts.namespace: None` falls back to this same constant inside the
/// store). Named here explicitly (rather than passing `None`) purely so it
/// shows up in the debug log.
-const USER_NAMESPACE: &str = tinycortex::memory::GLOBAL_NAMESPACE;
+const USER_NAMESPACE: &str = tinymemory_api::types::GLOBAL_NAMESPACE;
/// Host-injected memory access for `memory` nodes. See the module doc for the
/// security contract; see [`super::caps::OpenHumanAgentRunner`] for the
diff --git a/src/openhuman/memory/bypass_allowlist_tests.rs b/src/openhuman/memory/bypass_allowlist_tests.rs
index 4a265ce452..45fb6dabc9 100644
--- a/src/openhuman/memory/bypass_allowlist_tests.rs
+++ b/src/openhuman/memory/bypass_allowlist_tests.rs
@@ -227,31 +227,23 @@ const ALLOWED: &[(&str, &str, &str)] = &[
".profile_conn(",
"sole in-family call; wraps the raw handle in ProfileStore. profile_conn is pub(in crate::openhuman::memory), so the compiler — not this lint — is the primary enforcement",
),
- // ── Composio memory sync: profile_store + &MemoryClientRef ──
+ // ── Composio memory sync: the five entries here are gone ──
+ //
+ // tinymemory v1.13.4 deleted the whole in-process Composio pipeline
+ // (`ComposioProvider`, `ComposioHost`, the identity/toolkit registry), so
+ // `core/src/sync/composio/providers/` no longer exists at the vendored
+ // pin. What survived of the profile bypass moved down into
+ // `core/src/store/identity.rs`, which is the single entry below.
(
- "vendor/tinymemory/crates/tinymemory-core/src/sync/composio/providers/profile.rs",
+ "vendor/tinymemory/crates/tinymemory-core/src/store/identity.rs",
".profile_store(",
- "typed profile writes; the contract has no profile family, so still unguarded",
- ),
- (
- "vendor/tinymemory/crates/tinymemory-core/src/sync/composio/providers/profile.rs",
- "global::client_if_ready(",
- "resolved only to reach profile_store()",
+ "typed profile writes; the contract still has no profile-write family, so this stays \
+ unguarded — it is the surviving half of the deleted composio provider entries",
),
(
- "vendor/tinymemory/crates/tinymemory-core/src/sync/composio/providers/types.rs",
+ "vendor/tinymemory/crates/tinymemory-core/src/store/identity.rs",
"global::client_if_ready(",
- "same provider trait shape",
- ),
- (
- "vendor/tinymemory/crates/tinymemory-core/src/sync/composio/providers/types_test_support.rs",
- "MemoryClient::from_workspace_dir(",
- "#[cfg(test)] module, split out of the inline test blocks three earlier entries covered",
- ),
- (
- "vendor/tinymemory/crates/tinymemory-core/src/sync/composio/providers/user_scopes.rs",
- "global::client_if_ready(",
- "same provider trait shape",
+ "resolved only to reach profile_store(), same as the provider it replaced",
),
// ── Golden-workspace fixture seeder (test infrastructure) ──
//
@@ -276,12 +268,6 @@ const ALLOWED: &[(&str, &str, &str)] = &[
"global::client_if_ready(",
"the TinyCortex engine seam; it sits beneath the contract, not above it",
),
- (
- "vendor/tinymemory/crates/tinymemory-core/src/sync/pipelines/host.rs",
- "global::client_if_ready(",
- "the engine-free sync runner's seam over the bound client; beneath the contract, \
- the same way the engine seam beside it is",
- ),
];
/// True for source files the lint deliberately does not scan.
diff --git a/src/openhuman/memory/direct_engine_refs_tests.rs b/src/openhuman/memory/direct_engine_refs_tests.rs
index 7a6ad49617..76c316c43e 100644
--- a/src/openhuman/memory/direct_engine_refs_tests.rs
+++ b/src/openhuman/memory/direct_engine_refs_tests.rs
@@ -324,33 +324,11 @@ const ALLOWED: &[(&str, Verdict, &str)] = &[
// These are the historical-path aliases `memory/mod.rs` documents. They
// name the crate once each and call nothing. Removing them is the
// re-export problem, not the direct-call problem.
- (
- "src/openhuman/agent/learning/candidate.rs",
- Verdict::HostSide,
- "re-export shim for learning_candidate types",
- ),
- (
- "src/openhuman/agent/tinyagents/thread_context.rs",
- Verdict::HostSide,
- "re-export shim for the thread-id task-local",
- ),
- (
- "src/openhuman/memory/mod.rs",
- Verdict::HostSide,
- "the re-export block itself — twenty-five engine modules under their historical paths",
- ),
(
"src/openhuman/memory/sources/mod.rs",
Verdict::HostSide,
"re-export shim: pub use tinymemory_core::sources::*",
),
- (
- "src/openhuman/memory/sources/reconcile.rs",
- Verdict::HostSide,
- "calls the engine's still-live apply_composio_source_caps_migration() after this host's \
- own tinyconnectors-backed ensure_composio_sources() reconcile pass — see the module docs \
- for why the reconcile itself moved but this one migration call did not",
- ),
(
"src/openhuman/memory/tree/health/mod.rs",
Verdict::HostSide,
@@ -361,11 +339,6 @@ const ALLOWED: &[(&str, Verdict, &str)] = &[
Verdict::HostSide,
"re-export shim: pub use tinymemory_core::tree::*",
),
- (
- "src/openhuman/memory/tree/retrieval/mod.rs",
- Verdict::HostSide,
- "re-export shim: pub use tinymemory_core::tree::retrieval::*",
- ),
(
"src/openhuman/memory/tree/tree/mod.rs",
Verdict::HostSide,
@@ -465,9 +438,11 @@ fn render(paths: impl IntoIterator<Item = String>) -> String {
/// A scanner that silently found nothing would turn every other test here into
/// a rubber stamp, so refuse to pass vacuously.
///
-/// `memory/mod.rs` is the most stable pin available: it is the re-export block
-/// itself, so it names the crate by construction. If the scanner stops seeing
-/// it, the scanner is broken — fix it, do not relax this assertion.
+/// `memory/host_impls.rs` is the most stable pin available now that the
+/// `memory/mod.rs` re-export block has been drained: it installs the seven host
+/// seams, so it names the crate by construction for as long as the engine is
+/// linked at all. If the scanner stops seeing it, the scanner is broken — fix
+/// it, do not relax this assertion.
#[test]
fn direct_reference_scanner_is_not_vacuous() {
let found = scan();
@@ -476,9 +451,9 @@ fn direct_reference_scanner_is_not_vacuous() {
// The canary only holds while the allowlist still names it. Asserting it
// unconditionally would turn the last migration in this file into a
// failure, which is backwards: draining the list is the goal.
- if allowed.contains("src/openhuman/memory/mod.rs") {
+ if allowed.contains("src/openhuman/memory/host_impls.rs") {
assert!(
- found.contains("src/openhuman/memory/mod.rs"),
+ found.contains("src/openhuman/memory/host_impls.rs"),
"scanner found no direct engine reference in memory/mod.rs, which is the re-export \
block; the scanner is broken"
);
diff --git a/src/openhuman/memory/goals/doc_tests.rs b/src/openhuman/memory/goals/doc_tests.rs
index ec3975a475..f222b0b274 100644
--- a/src/openhuman/memory/goals/doc_tests.rs
+++ b/src/openhuman/memory/goals/doc_tests.rs
@@ -52,7 +52,11 @@ fn add_and_edit_reject_multiline_text() {
fn add_and_edit_reject_secret_or_pii_text() {
let mut doc = GoalsDoc::default();
assert!(add_item(&mut doc, "follow up with [email protected] about launch").is_err());
- assert!(add_item(&mut doc, "rotate api_key=sk-abcdefghijklmnopqrstuvwxyz123456").is_err());
+ assert!(add_item(
+ &mut doc,
+ "rotate api_key=sk-abcdefghijklmnopqrstuvwxyz123456"
+ )
+ .is_err());
let id = add_item(&mut doc, "ship the memory engine").unwrap();
assert!(edit_item(&mut doc, &id, "call +14155551212 tomorrow").is_err());
@@ -116,6 +120,9 @@ fn host_guards_agree_with_the_engine_choke_point() {
add_item(&mut doc, rejected).is_err(),
"host validation must reject {rejected:?} before `set_goals` sees it"
);
- assert!(doc.is_empty(), "a rejected add must not mutate the document");
+ assert!(
+ doc.is_empty(),
+ "a rejected add must not mutate the document"
+ );
}
}
diff --git a/src/openhuman/memory/goals/ops.rs b/src/openhuman/memory/goals/ops.rs
index 0645897523..0ad8041924 100644
--- a/src/openhuman/memory/goals/ops.rs
+++ b/src/openhuman/memory/goals/ops.rs
@@ -148,7 +148,10 @@ pub async fn delete(goals: &dyn MemoryGoals, id: &str) -> Result<RpcOutcome<Goal
.await
.map_err(|e| format!("delete: {e}"))?;
let updated = read(goals, "delete").await?;
- Ok(RpcOutcome::single_log(updated, format!("deleted goal {id}")))
+ Ok(RpcOutcome::single_log(
+ updated,
+ format!("deleted goal {id}"),
+ ))
}
/// On-demand enrichment: run the turn-based goals agent now, then return the
diff --git a/src/openhuman/memory/host_impls.rs b/src/openhuman/memory/host_impls.rs
index a5bdfc5bca..0723efe4d9 100644
--- a/src/openhuman/memory/host_impls.rs
+++ b/src/openhuman/memory/host_impls.rs
@@ -91,7 +91,15 @@ use tokio::sync::Notify;
use crate::openhuman::config::Config;
/// Type alias for the seam's config trait object, to keep signatures readable.
-type SeamConfig = tinymemory_core::Config;
+///
+/// Named on the contract crate rather than on `tinymemory_core::Config`, which
+/// is nothing but `pub type Config = dyn tinymemory_api::host::
+/// MemoryHostConfig;` — the same trait object under a longer chain. Spelling it
+/// this way is not cosmetic: it means every remaining `tinymemory_core::` line
+/// in this file is a *seam installation*, so the direct-reference inventory
+/// reads as what actually keeps the engine linked here rather than as a mix of
+/// installs and inert aliases (#5560).
+type SeamConfig = dyn tinymemory_api::host::MemoryHostConfig;
// ── Embeddings ──────────────────────────────────────────────────────────────
diff --git a/src/openhuman/memory/sources/reconcile_tests.rs b/src/openhuman/memory/sources/reconcile_tests.rs
index cc5e408de0..b9b6e008ef 100644
--- a/src/openhuman/memory/sources/reconcile_tests.rs
+++ b/src/openhuman/memory/sources/reconcile_tests.rs
@@ -171,7 +171,10 @@ fn migration_fills_kind_defaults_without_counting_them() {
let count = apply_caps_defaults_to_entries(&mut sources);
assert_eq!(count, 0, "only composio entries count as migrated");
- assert!(!sources[0].enabled, "kind defaults must not enable a source");
+ assert!(
+ !sources[0].enabled,
+ "kind defaults must not enable a source"
+ );
assert_eq!(sources[0].max_prs, Some(10));
assert!(sources[0].max_issues.is_some());
}
diff --git a/src/openhuman/memory/sync_pipeline_e2e_tests.rs b/src/openhuman/memory/sync_pipeline_e2e_tests.rs
index c34e030f5f..78faf32e64 100644
--- a/src/openhuman/memory/sync_pipeline_e2e_tests.rs
+++ b/src/openhuman/memory/sync_pipeline_e2e_tests.rs
@@ -23,7 +23,10 @@ use tempfile::TempDir;
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
use crate::openhuman::config::Config;
-use crate::openhuman::memory::tree::retrieval::{query_source, search_entities};
+// Named on the engine crate directly: `memory::tree::retrieval` stopped
+// re-exporting the engine in #5560 because no production caller was left. A
+// test may still reach the engine — that is what keeps this a test-only
+// reference rather than a shipped one.
use crate::openhuman::memory::tree::score::store::lookup_entity;
use tinybus::EventHandler;
use tinybus::SubscriptionHandle;
@@ -35,6 +38,7 @@ use tinymemory_core::store::chunks::store::{
count_chunks, count_chunks_by_lifecycle_status, CHUNK_STATUS_BUFFERED,
};
use tinymemory_core::store::trees::{store as tree_store, types::TreeKind};
+use tinymemory_core::tree::retrieval::{query_source, search_entities};
// ── helpers ─────────────────────────────────────────────────────────────
diff --git a/src/openhuman/memory/tool_memory/store.rs b/src/openhuman/memory/tool_memory/store.rs
index 6fe96818e8..22a4d20ba2 100644
--- a/src/openhuman/memory/tool_memory/store.rs
+++ b/src/openhuman/memory/tool_memory/store.rs
@@ -225,6 +225,54 @@ impl ToolMemoryStore {
Ok(rules)
}
+ /// Fetch a single rule by `(tool_name, rule_id)`.
+ ///
+ /// `Ok(None)` means the rule is absent, which is not an error: the RPC
+ /// surface answers a missing rule with a null body rather than a failure.
+ ///
+ /// # Errors
+ ///
+ /// Backend failures only.
+ pub async fn get_rule(
+ &self,
+ tool_name: &str,
+ rule_id: &str,
+ ) -> Result<Option<ToolMemoryRule>, String> {
+ let namespace = tool_memory_namespace(tool_name);
+ let key = ToolMemoryRule::storage_key(rule_id);
+ self.fetch_rule(&namespace, &key).await
+ }
+
+ /// Delete a rule. Returns `true` when the rule existed.
+ ///
+ /// # Errors
+ ///
+ /// Backend failures only; deleting an absent rule is `Ok(false)`.
+ pub async fn delete_rule(&self, tool_name: &str, rule_id: &str) -> Result<bool, String> {
+ let namespace = tool_memory_namespace(tool_name);
+ let key = ToolMemoryRule::storage_key(rule_id);
+ self.memory
+ .forget(&namespace, &key)
+ .await
+ .map_err(|e| format!("forget tool rule: {e:#}"))
+ }
+
+ /// Render one tool's rules as JSON for an RPC envelope, priority
+ /// descending.
+ ///
+ /// The shape is `serde_json::to_value` over the same `Vec<ToolMemoryRule>`
+ /// [`Self::list_rules`] returns, so `tool_rules_json` stays byte-compatible
+ /// with what the dashboard already parses.
+ ///
+ /// # Errors
+ ///
+ /// Backend failures, or a serialisation failure that cannot occur for this
+ /// type but is surfaced rather than unwrapped.
+ pub async fn list_rules_json(&self, tool_name: &str) -> Result<serde_json::Value, String> {
+ let rules = self.list_rules(tool_name).await?;
+ serde_json::to_value(rules).map_err(|e| e.to_string())
+ }
+
/// The rules that must be surfaced eagerly (Critical + High), grouped by
/// tool name.
///
diff --git a/src/openhuman/memory/tool_memory/store_tests.rs b/src/openhuman/memory/tool_memory/store_tests.rs
index bbeaf7fe8a..e17c85ff7d 100644
--- a/src/openhuman/memory/tool_memory/store_tests.rs
+++ b/src/openhuman/memory/tool_memory/store_tests.rs
@@ -36,7 +36,10 @@ async fn record_lands_in_the_tool_scoped_namespace_under_a_rule_key() {
// cannot skew.
assert_eq!(stored.tool_name, "send_email");
- let entries = memory.list(Some("tool-send_email"), None, None).await.unwrap();
+ let entries = memory
+ .list(Some("tool-send_email"), None, None)
+ .await
+ .unwrap();
assert_eq!(entries.len(), 1, "one rule, in the tool-scoped namespace");
assert_eq!(entries[0].key, format!("rule/{}", stored.id));
@@ -201,7 +204,9 @@ async fn rules_for_prompt_never_drops_a_critical_rule_to_fit_the_cap() {
critical_count,
"every Critical survives; the High remainder is what the cap trims"
);
- assert!(rules.iter().all(|r| r.priority == ToolMemoryPriority::Critical));
+ assert!(rules
+ .iter()
+ .all(|r| r.priority == ToolMemoryPriority::Critical));
}
#[tokio::test]
diff --git a/src/openhuman/memory/tools/flavour.rs b/src/openhuman/memory/tools/flavour.rs
index 48ff4cd422..336fedfb85 100644
--- a/src/openhuman/memory/tools/flavour.rs
+++ b/src/openhuman/memory/tools/flavour.rs
@@ -1,6 +1,6 @@
//! Agent tool: read a compiled persona flavour profile (issue #5172).
//!
-//! Persona ingestion (`src/openhuman/memory/tinycortex/persona.rs`) distills a
+//! Persona ingestion (engine-side, `tinycortex::memory::persona`) distills a
//! person's coding-agent history into seven [`PersonaFacet`] flavoured trees
//! (communication, coding style, stack, workflow, environment, directives,
//! anti-preferences), each compiled into a small prompt-ready markdown
@@ -18,13 +18,109 @@ use std::sync::Arc;
use async_trait::async_trait;
use serde_json::json;
-use tinycortex::memory::persona::PersonaFacet;
use tinycortex::memory::tree::store::{get_tree_by_scope, TreeKind};
use tinycortex::memory::tree::{compile_flavoured_root, flavoured_root_abs_path};
use crate::openhuman::config::Config;
use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolResult};
+/// The seven persona facets, host-side (#5560).
+///
+/// This was `tinycortex::memory::persona::PersonaFacet`, and it came home
+/// because it is a pure value type: a field-less enum whose whole behaviour is
+/// three total string mappings. Nothing about it needs the engine — the engine
+/// functions this file calls take the resulting `String`/`&str`, never the enum
+/// — so a host copy is the same value under a different path, not a
+/// translation.
+///
+/// # The strings are an on-disk contract, not cosmetics
+///
+/// [`Self::tree_scope`] is the **key a flavoured tree is stored under**.
+/// Persona ingestion writes `persona/<facet>` into `mem_tree_trees`, and
+/// `get_tree_by_scope` finds it by exact string match. So the mappings below
+/// are reproduced verbatim from the engine, and a "tidy-up" that renames one
+/// (`coding_style` → `codingStyle`, say) does not fail a build or throw — it
+/// silently stops finding a tree that is still there, and `memory_flavour`
+/// starts answering "No profile built yet" forever.
+///
+/// [`Self::parse_loose`]'s alias table is the agent-facing half of the same
+/// contract: an LLM emits `tone` or `pet_peeves`, and dropping an alias
+/// narrows what the tool accepts. [`Self::heading`] is display-only and the one
+/// mapping here that is safe to reword.
+///
+/// The engine's enum carries three more members this host never reads — `ALL`
+/// (the pack's fixed compile order), `default_ask` (per-facet ingestion
+/// prompts) and its serde derives. They are ingestion concerns and are
+/// deliberately not copied: an unused copy is a second thing to keep in sync.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub(crate) enum PersonaFacet {
+ /// Tone, verbosity, directness, phrasing quirks, how they give feedback.
+ Communication,
+ /// Naming, structure, comments, error handling, testing habits.
+ CodingStyle,
+ /// Languages, frameworks, libraries, recurring architectural choices.
+ Stack,
+ /// Branching/commit granularity, plan-first vs. dive-in, PR habits.
+ Workflow,
+ /// Editors/harnesses, CLIs, package managers, OS.
+ Environment,
+ /// Explicit standing rules (mostly T0, near-verbatim).
+ Directives,
+ /// Pet peeves: things they correct agents for, revert, or forbid.
+ AntiPreferences,
+}
+
+impl PersonaFacet {
+ /// Stable string form. Verbatim from the engine — see the type's docs for
+ /// why this one is not free to change.
+ fn as_str(self) -> &'static str {
+ match self {
+ PersonaFacet::Communication => "communication",
+ PersonaFacet::CodingStyle => "coding_style",
+ PersonaFacet::Stack => "stack",
+ PersonaFacet::Workflow => "workflow",
+ PersonaFacet::Environment => "environment",
+ PersonaFacet::Directives => "directives",
+ PersonaFacet::AntiPreferences => "anti_preferences",
+ }
+ }
+
+ /// Human-facing section heading used in error and "not built" messages.
+ /// Display-only, so this is the one mapping here that may be reworded.
+ pub(crate) fn heading(self) -> &'static str {
+ match self {
+ PersonaFacet::Communication => "Communication style",
+ PersonaFacet::CodingStyle => "Coding style",
+ PersonaFacet::Stack => "Stack",
+ PersonaFacet::Workflow => "Workflow",
+ PersonaFacet::Environment => "Environment",
+ PersonaFacet::Directives => "Directives",
+ PersonaFacet::AntiPreferences => "Anti-preferences",
+ }
+ }
+
+ /// Flavoured-tree scope for this facet (`persona/<facet>`) — the exact key
+ /// the tree is persisted under.
+ pub(crate) fn tree_scope(self) -> String {
+ format!("persona/{}", self.as_str())
+ }
+
+ /// Parse the loose forms an LLM might emit.
+ pub(crate) fn parse_loose(s: &str) -> Option<Self> {
+ match s.trim().to_lowercase().replace([' ', '-'], "_").as_str() {
+ "communication" | "comms" | "tone" => Some(PersonaFacet::Communication),
+ "coding_style" | "code_style" | "coding" | "style" => Some(PersonaFacet::CodingStyle),
+ "stack" | "tech_stack" | "technology" => Some(PersonaFacet::Stack),
+ "workflow" | "process" => Some(PersonaFacet::Workflow),
+ "environment" | "env" | "tooling" => Some(PersonaFacet::Environment),
+ "directives" | "rules" | "directive" => Some(PersonaFacet::Directives),
+ "anti_preferences" | "anti_preference" | "antipreferences" | "dislikes"
+ | "pet_peeves" => Some(PersonaFacet::AntiPreferences),
+ _ => None,
+ }
+ }
+}
+
/// The seven valid `flavour` slugs, for error messages.
const VALID_FLAVOURS: &str =
"communication, coding_style, stack, workflow, environment, directives, anti_preferences";
diff --git a/src/openhuman/memory/tools/flavour_tests.rs b/src/openhuman/memory/tools/flavour_tests.rs
index 86da770825..5a415d6440 100644
--- a/src/openhuman/memory/tools/flavour_tests.rs
+++ b/src/openhuman/memory/tools/flavour_tests.rs
@@ -87,3 +87,98 @@ async fn aliases_are_accepted() {
assert!(result.output().contains("No profile built yet"));
}
}
+
+// ── PersonaFacet, brought home from the engine in #5560 ──────────────────────
+//
+// These pin the two mappings that are an on-disk / agent-facing contract
+// rather than cosmetics. `tree_scope` is the key a flavoured tree is stored
+// under, so a drifted string does not fail loudly — it silently stops finding
+// a tree that is still there. Asserting the literals is the point: a test that
+// re-derived them from the enum would drift with it.
+
+#[test]
+fn persona_facet_tree_scopes_match_the_persisted_keys() {
+ let expected = [
+ (PersonaFacet::Communication, "persona/communication"),
+ (PersonaFacet::CodingStyle, "persona/coding_style"),
+ (PersonaFacet::Stack, "persona/stack"),
+ (PersonaFacet::Workflow, "persona/workflow"),
+ (PersonaFacet::Environment, "persona/environment"),
+ (PersonaFacet::Directives, "persona/directives"),
+ (PersonaFacet::AntiPreferences, "persona/anti_preferences"),
+ ];
+ for (facet, scope) in expected {
+ assert_eq!(facet.tree_scope(), scope, "scope drift for {facet:?}");
+ }
+}
+
+#[test]
+fn persona_facet_parse_loose_accepts_every_documented_alias() {
+ let cases = [
+ ("communication", PersonaFacet::Communication),
+ ("comms", PersonaFacet::Communication),
+ ("tone", PersonaFacet::Communication),
+ ("coding_style", PersonaFacet::CodingStyle),
+ ("code_style", PersonaFacet::CodingStyle),
+ ("coding", PersonaFacet::CodingStyle),
+ ("style", PersonaFacet::CodingStyle),
+ ("stack", PersonaFacet::Stack),
+ ("tech_stack", PersonaFacet::Stack),
+ ("technology", PersonaFacet::Stack),
+ ("workflow", PersonaFacet::Workflow),
+ ("process", PersonaFacet::Workflow),
+ ("environment", PersonaFacet::Environment),
+ ("env", PersonaFacet::Environment),
+ ("tooling", PersonaFacet::Environment),
+ ("directives", PersonaFacet::Directives),
+ ("rules", PersonaFacet::Directives),
+ ("directive", PersonaFacet::Directives),
+ ("anti_preferences", PersonaFacet::AntiPreferences),
+ ("anti_preference", PersonaFacet::AntiPreferences),
+ ("antipreferences", PersonaFacet::AntiPreferences),
+ ("dislikes", PersonaFacet::AntiPreferences),
+ ("pet_peeves", PersonaFacet::AntiPreferences),
+ ];
+ for (input, want) in cases {
+ assert_eq!(
+ PersonaFacet::parse_loose(input),
+ Some(want),
+ "alias {input}"
+ );
+ }
+}
+
+#[test]
+fn persona_facet_parse_loose_normalises_case_spaces_and_dashes() {
+ // The normalisation the engine applied: trim, lowercase, then fold both
+ // spaces and dashes to underscores.
+ assert_eq!(
+ PersonaFacet::parse_loose(" Coding-Style "),
+ Some(PersonaFacet::CodingStyle)
+ );
+ assert_eq!(
+ PersonaFacet::parse_loose("PET PEEVES"),
+ Some(PersonaFacet::AntiPreferences)
+ );
+ assert_eq!(PersonaFacet::parse_loose("nonsense"), None);
+ assert_eq!(PersonaFacet::parse_loose(""), None);
+}
+
+#[test]
+fn persona_facet_headings_are_present_and_distinct() {
+ let facets = [
+ PersonaFacet::Communication,
+ PersonaFacet::CodingStyle,
+ PersonaFacet::Stack,
+ PersonaFacet::Workflow,
+ PersonaFacet::Environment,
+ PersonaFacet::Directives,
+ PersonaFacet::AntiPreferences,
+ ];
+ let mut seen = std::collections::HashSet::new();
+ for facet in facets {
+ let heading = facet.heading();
+ assert!(!heading.is_empty(), "empty heading for {facet:?}");
+ assert!(seen.insert(heading), "duplicate heading {heading}");
+ }
+}
diff --git a/src/openhuman/memory/tools/goals.rs b/src/openhuman/memory/tools/goals.rs
index d022971eac..5f778583bd 100644
--- a/src/openhuman/memory/tools/goals.rs
+++ b/src/openhuman/memory/tools/goals.rs
@@ -33,10 +33,10 @@ use std::path::PathBuf;
use async_trait::async_trait;
use serde_json::json;
+use crate::openhuman::memory::api::provider::MemoryProvider;
use crate::openhuman::memory::goals::ops;
use crate::openhuman::memory::guard::MemoryGuard;
use crate::openhuman::memory::ops::guard::active_memory_guard;
-use crate::openhuman::memory::api::provider::MemoryProvider;
use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolResult};
/// The guarded driver for this call, checked to serve the goals family.
diff --git a/src/openhuman/memory/tools/search/vector_search.rs b/src/openhuman/memory/tools/search/vector_search.rs
index fe322557e5..6109286872 100644
--- a/src/openhuman/memory/tools/search/vector_search.rs
+++ b/src/openhuman/memory/tools/search/vector_search.rs
@@ -106,7 +106,10 @@ struct MmrResult {
/// its MMR score, because the latter depends on selection order and would
/// read as an unstable percentage. Kept so the port stays a faithful copy
/// of the engine's shape rather than a narrowed re-derivation.
- #[allow(dead_code, reason = "faithful port; this tool reports the cosine score instead")]
+ #[allow(
+ dead_code,
+ reason = "faithful port; this tool reports the cosine score instead"
+ )]
score: f64,
}
diff --git a/src/openhuman/memory/tree_e2e_tests.rs b/src/openhuman/memory/tree_e2e_tests.rs
index 09886e2aca..db0f727e28 100644
--- a/src/openhuman/memory/tree_e2e_tests.rs
+++ b/src/openhuman/memory/tree_e2e_tests.rs
@@ -17,12 +17,16 @@ use chrono::{TimeZone, Utc};
use tempfile::TempDir;
use crate::openhuman::config::Config;
-use crate::openhuman::memory::tree::retrieval::{query_source, search_entities};
+// Named on the engine crate directly: `memory::tree::retrieval` stopped
+// re-exporting the engine in #5560 because no production caller was left. A
+// test may still reach the engine — that is what keeps this a test-only
+// reference rather than a shipped one.
use crate::openhuman::memory::tree::score::embed::build_embedder_from_config;
use tinycortex::memory::ingest::canonicalize::chat::{ChatBatch, ChatMessage};
use tinymemory_core::chat::{test_override, ChatProvider, StaticChatProvider};
use tinymemory_core::ingest_pipeline::ingest_chat;
use tinymemory_core::queue::drain_until_idle;
+use tinymemory_core::tree::retrieval::{query_source, search_entities};
fn test_config() -> (TempDir, Config) {
let tmp = TempDir::new().unwrap();
diff --git a/tests/memory_fast_retrieve_e2e.rs b/tests/memory_fast_retrieve_e2e.rs
index 7468f4b6ed..86e1c8ab86 100644
--- a/tests/memory_fast_retrieve_e2e.rs
+++ b/tests/memory_fast_retrieve_e2e.rs
@@ -24,9 +24,11 @@ use chrono::{TimeZone, Utc};
use tempfile::TempDir;
use openhuman_core::openhuman::config::Config;
-use openhuman_core::openhuman::memory::tree::retrieval::{fast_retrieve, FastRetrieveOptions};
+// Named on the engine crate directly: the host `memory::tree::retrieval`
+// dropped its engine glob in #5560 (no production caller remained).
use tinycortex::memory::ingest::canonicalize::chat::{ChatBatch, ChatMessage};
use tinymemory_core::ingest_pipeline::ingest_chat;
+use tinymemory_core::tree::retrieval::{fast_retrieve, FastRetrieveOptions};
static MEMORY_SEAMS_INIT: OnceLock<()> = OnceLock::new();
diff --git a/tests/raw_coverage/memory_sync_tree_round21_raw_coverage_e2e.rs b/tests/raw_coverage/memory_sync_tree_round21_raw_coverage_e2e.rs
index bead759743..e5f9b88697 100644
--- a/tests/raw_coverage/memory_sync_tree_round21_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_sync_tree_round21_raw_coverage_e2e.rs
@@ -68,7 +68,7 @@ use openhuman_core::openhuman::integrations::composio::periodic::record_sync_suc
use openhuman_core::openhuman::memory::sync::composio::providers::slack::rpc::{
sync_status_rpc, SyncStatusRequest,
};
-use openhuman_core::openhuman::memory::tree::retrieval::source::query_source;
+// Engine-direct for the same reason as the other retrieval e2e suites (#5560).
use openhuman_core::openhuman::memory::tree::tree::store as tree_store;
use openhuman_core::openhuman::memory::tree::tree::TreeStatus;
use openhuman_core::openhuman::security::credentials::{
@@ -80,6 +80,7 @@ use tinymemory_core::store::chunks::store::with_connection;
use tinymemory_core::store::content::atomic::stage_summary;
use tinymemory_core::store::content::{SummaryComposeInput, SummaryTreeKind};
use tinymemory_core::store::trees::types::{SummaryNode, Tree, TreeKind};
+use tinymemory_core::tree::retrieval::source::query_source;
static ENV_LOCK: &OnceLock<Mutex<()>> = &crate::SHARED_ENV_LOCK;
static MEMORY_SEAMS_INIT: OnceLock<()> = OnceLock::new();
@@ -90,9 +91,9 @@ fn ensure_memory_seams() {
.name("memory-sync-tree-round21-raw-coverage-seams".to_string())
.stack_size(8 * 1024 * 1024)
.spawn(|| {
- openhuman_core::openhuman::memory::host_impls::install_memory_host_seams(
- Arc::new(Config::default()),
- );
+ openhuman_core::openhuman::memory::host_impls::install_memory_host_seams(Arc::new(
+ Config::default(),
+ ));
})
.expect("spawn round21 memory tree seam installer")
.join()
@@ -271,7 +272,11 @@ async fn slack_sync_status_rpc_reports_the_degraded_zero_value_shape() {
let outcome = sync_status_rpc(&config, SyncStatusRequest::default())
.await
.expect("status rpc");
- assert_eq!(outcome.value.connections.len(), 1, "only the active slack connection qualifies");
+ assert_eq!(
+ outcome.value.connections.len(),
+ 1,
+ "only the active slack connection qualifies"
+ );
let row = &outcome.value.connections[0];
assert_eq!(row.connection_id, "conn-slack-round21");
assert_eq!(row.per_channel_cursors, "{}");
@@ -282,8 +287,7 @@ async fn slack_sync_status_rpc_reports_the_degraded_zero_value_shape() {
outcome
.logs
.iter()
- .any(|line| line.contains("connections=1")
- && line.contains("no longer available")),
+ .any(|line| line.contains("connections=1") && line.contains("no longer available")),
"status log should explain the degraded read: {:?}",
outcome.logs
);
diff --git a/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs b/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs
index bc15d259f7..ddda395567 100644
--- a/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs
@@ -29,11 +29,6 @@ use openhuman_core::openhuman::memory::query::{
MemoryQueryTool, MemoryTreeDrillDownTool, MemoryTreeFetchLeavesTool,
MemoryTreeIngestDocumentTool, MemoryTreeQuerySourceTool, MemoryTreeSearchEntitiesTool,
};
-use tinymemory_core::queue::types::ReembedBackfillPayload;
-use tinymemory_core::queue::{
- self as memory_queue, AppendBufferPayload, AppendTarget, ExtractChunkPayload,
- FlushStalePayload, JobKind, JobStatus, NewJob, NodeRef, SealPayload, DEFAULT_LOCK_DURATION_MS,
-};
use openhuman_core::openhuman::memory::sources::readers::reader_for;
use openhuman_core::openhuman::memory::sources::registry;
use openhuman_core::openhuman::memory::sources::rpc as memory_sources_rpc;
@@ -45,6 +40,12 @@ use openhuman_core::openhuman::memory::sources::types::{
use openhuman_core::openhuman::memory::sources::{
all_memory_sources_controller_schemas, all_memory_sources_registered_controllers,
};
+use openhuman_core::openhuman::memory::sync::composio;
+use tinymemory_core::queue::types::ReembedBackfillPayload;
+use tinymemory_core::queue::{
+ self as memory_queue, AppendBufferPayload, AppendTarget, ExtractChunkPayload,
+ FlushStalePayload, JobKind, JobStatus, NewJob, NodeRef, SealPayload, DEFAULT_LOCK_DURATION_MS,
+};
use tinymemory_core::store::chunks::store::{upsert_chunks, with_connection};
use tinymemory_core::store::chunks::types::{
approx_token_count, chunk_id, Chunk, DataSource, Metadata, SourceKind as ChunkSourceKind,
@@ -53,10 +54,7 @@ use tinymemory_core::store::chunks::types::{
use tinymemory_core::store::trees::types::{
SummaryNode, Tree, TreeKind, TreeStatus as StoredTreeStatus,
};
-use tinymemory_core::store::{
- MemoryClient, NamespaceDocumentInput, UnifiedMemory,
-};
-use openhuman_core::openhuman::memory::sync::composio;
+use tinymemory_core::store::{MemoryClient, NamespaceDocumentInput, UnifiedMemory};
// `memory::sync::composio::providers::slack::schemas` is this host's own real,
// current RPC schema module (`openhuman.slack_memory_sync_trigger` /
// `_status`) — unrelated to the deleted per-action `post_process` (see below).
@@ -69,16 +67,18 @@ use openhuman_core::openhuman::memory::sync::composio::providers::slack::schemas
use openhuman_core::openhuman::integrations::composio::identity_store::{
delete_connected_identity_facets, load_connected_identities,
};
-use openhuman_core::openhuman::integrations::composio::ops::{composio_get_user_profile, composio_sync};
+use openhuman_core::openhuman::integrations::composio::ops::{
+ composio_get_user_profile, composio_sync,
+};
use openhuman_core::openhuman::integrations::composio::profile_md::{
block_end, block_start, merge_provider_into_profile_md, remove_provider_from_profile_md,
replace_managed_block,
};
use openhuman_core::openhuman::integrations::composio::providers::{
agent_ready_toolkits, catalog_for_toolkit, classify_unknown, curated_scope_for, find_curated,
- is_action_visible_with_pref, toolkit_from_slug, toolkit_has_scope, CuratedTool,
- NormalizedTask, ProviderUserProfile, SyncOutcome as ComposioSyncOutcome, SyncReason,
- TaskFetchFilter, ToolScope, UserScopePref,
+ is_action_visible_with_pref, toolkit_from_slug, toolkit_has_scope, CuratedTool, NormalizedTask,
+ ProviderUserProfile, SyncOutcome as ComposioSyncOutcome, SyncReason, TaskFetchFilter,
+ ToolScope, UserScopePref,
};
use tinymemory_api::composio::{
canonicalize, extract_item_id, render_connected_identities_section, ConnectedIdentity,
@@ -90,7 +90,6 @@ use tinymemory_api::composio::{
// indexer was never scoped to one toolkit to begin with. Note this is a
// DIFFERENT (structurally identical) `IdentityKind` than
// `tinymemory_api::composio::IdentityKind` above.
-use tinymemory_core::store::identity::is_self_identity_any_toolkit;
use openhuman_core::openhuman::memory::sync::sync_status::{
rpc as memory_sync_status_rpc, schemas as memory_sync_status_schemas,
};
@@ -107,6 +106,7 @@ use openhuman_core::openhuman::memory::tools::tool_memory::{
use openhuman_core::openhuman::memory::tools::{
MemoryForgetTool, MemoryRecallTool, MemoryStoreTool,
};
+use openhuman_core::openhuman::memory::tree::score::embed;
use openhuman_core::openhuman::memory::tree::score::embed::Embedder;
use openhuman_core::openhuman::memory::tree::score::extract::{
CompositeExtractor, EntityExtractor, EntityKind, ExtractedEntities, ExtractedEntity,
@@ -130,18 +130,20 @@ use openhuman_core::openhuman::memory::tree::tree_runtime::{
derive_node_ids, derive_parent_id, estimate_tokens, level_from_node_id, node_id_to_path,
NodeLevel, TreeNode,
};
-use openhuman_core::openhuman::memory::tree::{retrieval, score::embed};
-use tinymemory_core::tree_policy::TreePolicy;
-use tinymemory_core::tree_source;
+use tinymemory_core::store::identity::is_self_identity_any_toolkit;
+// `retrieval` is the engine module, not the host wrapper: the host stopped
+// re-exporting it in #5560. `score::embed` above is still host-side.
use openhuman_core::openhuman::memory::{
all_memory_controller_schemas, all_memory_registered_controllers,
preferences::{
load_general_preferences, recall_related_preferences, recall_situational_preferences,
USER_PREF_GENERAL_NAMESPACE, USER_PREF_SITUATIONAL_NAMESPACE,
},
- read_rpc as memory_read_rpc,
- MemoryIngestionConfig, MemoryIngestionRequest,
+ read_rpc as memory_read_rpc, MemoryIngestionConfig, MemoryIngestionRequest,
};
+use tinymemory_core::tree::retrieval;
+use tinymemory_core::tree_policy::TreePolicy;
+use tinymemory_core::tree_source;
// `remember`, `rpc_models`, `traits` and `util` moved into the extracted engine
// crate with the rest of the memory implementation; the host re-exports some of
// their contents flat but not the modules themselves.
@@ -160,15 +162,6 @@ use openhuman_core::openhuman::memory::rpc_models::{
UpdateConversationMessageRequest, UpdateConversationThreadLabelsRequest,
UpdateConversationThreadTitleRequest, UpsertConversationThreadRequest, WriteMemoryFileRequest,
};
-use tinymemory_core::{
- remember::RememberSourceKind,
- rpc_models::{
- ApiEnvelope, ApiError, ApiMeta, PaginationMeta, QueryNamespaceRequest,
- RecallContextRequest, RecallMemoriesRequest,
- },
- traits::{Memory, MemoryCategory, MemoryEntry, NamespaceSummary, RecallOpts},
- util::redact::{redact, redact_endpoint},
-};
use openhuman_core::openhuman::security::{AutonomyLevel, SecurityPolicy};
use openhuman_core::openhuman::threads::ops as thread_ops;
use openhuman_core::openhuman::threads::title::{
@@ -196,6 +189,15 @@ use tinycortex::memory::ingest::canonicalize::email::{
};
use tinycortex::memory::ingest::canonicalize::email_clean;
use tinycortex::memory::sync::{SyncOutcome as PipelineSyncOutcome, SyncPipelineKind};
+use tinymemory_core::{
+ remember::RememberSourceKind,
+ rpc_models::{
+ ApiEnvelope, ApiError, ApiMeta, PaginationMeta, QueryNamespaceRequest,
+ RecallContextRequest, RecallMemoriesRequest,
+ },
+ traits::{Memory, MemoryCategory, MemoryEntry, NamespaceSummary, RecallOpts},
+ util::redact::{redact, redact_endpoint},
+};
struct EnvVarGuard {
key: &'static str,
@@ -2177,7 +2179,8 @@ async fn memory_preferences_remember_redaction_and_pipeline_traits_cover_public_
// are host policy over a driver, not engine calls. `guarded_in_memory`
// gives a real guard over a real store, so this still exercises the
// decorator production uses rather than reaching past it.
- let (_provider, memory) = openhuman_core::openhuman::memory::guard::in_memory::guarded_in_memory();
+ let (_provider, memory) =
+ openhuman_core::openhuman::memory::guard::in_memory::guarded_in_memory();
memory
.store(
@@ -3003,7 +3006,6 @@ async fn composio_get_user_profile_and_sync_refuse_cleanly_without_a_loaded_modu
);
}
-
#[test]
fn turn_state_mirror_persists_progress_edges_from_public_events() {
let tmp = TempDir::new().expect("tempdir");