Skip to content

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

feat(memory): delete the three engine glob shims; correct the seam inventory

Shanu0df1f27ed512
diff --git a/Cargo.toml b/Cargo.toml
index 4408a7754c..866480c876 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -306,6 +306,27 @@ tinyconnectors-bus = { path = "vendor/tinyconnectors/crates/tinyconnectors-bus"
# directly (EXTRACT_ENTITIES, EMBED_TEXT, EMBEDDER_SLUG) — prefer compile
# errors on renaming over MemberNotFound at runtime.
tinymemory-bus = { path = "vendor/tinymemory/crates/tinymemory-bus" }
+# MEASURED 2026-08-31, and it changes the endgame of #5560: this entry has **no
+# production consumer**. Every `tinymemory_tinycortex::` reference in the tree is
+# test code — `memory::test_support` (a `#[cfg(test)] pub(crate) mod`),
+# `agent::harness::archivist_tests`, and `tests/raw_coverage/` — and
+# `cargo tree -e normal -i tinymemory-tinycortex` reports `openhuman` as its only
+# parent. cargo-machete already flags it, which is why it sits in `ignored` at
+# the top of this file.
+#
+# It matters because it is a **second, independent normal edge onto
+# `tinymemory-core`**: `cargo tree -e normal -i tinymemory-core` reports two
+# parents, `openhuman` and this crate. So dropping the `tinymemory-core` entry
+# below on the day `memory/host_impls.rs` and `memory/tree/tree_runtime/mod.rs`
+# stop naming the engine will **not** take the engine out of the shipped graph —
+# this line will still pull it. Moving this to `[dev-dependencies]` (which is
+# where its consumers already live) is what actually sheds it, and it is a
+# prerequisite for #5560, not a tidy-up after it.
+#
+# Deliberately NOT done in this change: it lowers the normal-graph package count,
+# and `scripts/check-kernel-floor.sh` fails on a shed that was not written back
+# to `scripts/kernel-floor.limits`. That write-back belongs with the manifest
+# flip, which is gated on a module release and a registry re-pin.
tinymemory-tinycortex = { path = "vendor/tinymemory/crates/tinymemory-tinycortex" }
# `tinymemory-core` is the *substance* of the memory subsystem, extracted out of
# `src/openhuman/memory/` — the SQLite/vector store, the markdown summary tree,
@@ -1300,6 +1321,25 @@ file-logging = ["dep:tracing-appender", "dep:tracing-log"]
scheduler-gate = ["dep:starship-battery"]
bin-tools = ["dep:clap", "dep:env_logger"]
+# `rss-bench = []` is correct today and must NOT stay empty through #5560.
+#
+# `src/bin/library_profile/scenarios/{cold_phases,memory_ingest}.rs` name
+# `tinymemory_core::` on purpose — they measure the in-process engine, and
+# routing them through `memory::binding` would measure the *null* driver instead
+# — and **a `[[bin]]` cannot use a dev-dependency**. So on the day
+# `tinymemory-core` stops being a normal dependency, this has to become
+# `rss-bench = ["dep:tinymemory-core"]` with that entry marked `optional = true`,
+# or `--features rss-bench` breaks in a configuration no CI lane compiles.
+#
+# Doing it AHEAD of that day is a measured no-op, not an early win. Tried
+# 2026-08-31: the product lib still compiles with the entry optional and this
+# list still empty, because the non-optional `[dev-dependencies]` entry activates
+# the optional normal one — `cargo tree -e normal -i tinymemory-core` is
+# byte-identical before and after, so nothing is shed. What the marker would buy
+# is the appearance of a shed plus a production build whose only reason for
+# having the crate is a dev-dependency side effect. Keep the honest non-optional
+# entry until the two files that still name the engine are clean, then flip both
+# halves together.
rss-bench = []
# Adds dhat heap profiling on top of `rss-bench` for the `library-profile`
# binary. Default-OFF, dev-only: installs dhat's global allocator, which
diff --git a/app/src/features/human/voice/readbackPrefix.contract.test.ts b/app/src/features/human/voice/readbackPrefix.contract.test.ts
index 80d1c5d873..344804e819 100644
--- a/app/src/features/human/voice/readbackPrefix.contract.test.ts
+++ b/app/src/features/human/voice/readbackPrefix.contract.test.ts
@@ -16,7 +16,7 @@ import { describe, expect, it } from 'vitest';
import { READBACK_PREFIX } from './useRealtimeVoiceSession';
-const HARNESS_RELATIVE = 'src/openhuman/voice/realtime_harness.rs';
+const HARNESS_RELATIVE = 'src/openhuman/voice/realtime_harness_part_01.rs';
/**
* Walk up from the working directory to the repo root. `import.meta.url` is not a
diff --git a/app/src/services/__tests__/rpcMethods.test.ts b/app/src/services/__tests__/rpcMethods.test.ts
index d0d83d16f8..6435051abf 100644
--- a/app/src/services/__tests__/rpcMethods.test.ts
+++ b/app/src/services/__tests__/rpcMethods.test.ts
@@ -128,6 +128,22 @@ describe('rpcMethods catalog', () => {
path.resolve(__dirname, '../../../../src/openhuman/config/schemas/schema_defs.rs'),
'utf8'
),
+ // The config controller registrations split out of schema_defs.rs; the
+ // `function: "…"` strings this guard greps live in the parts now.
+ fs.readFileSync(
+ path.resolve(
+ __dirname,
+ '../../../../src/openhuman/config/schemas/controllers_part_01.rs'
+ ),
+ 'utf8'
+ ),
+ fs.readFileSync(
+ path.resolve(
+ __dirname,
+ '../../../../src/openhuman/config/schemas/controllers_part_02.rs'
+ ),
+ 'utf8'
+ ),
fs.readFileSync(
path.resolve(__dirname, '../../../../src/openhuman/inference/provider/schemas.rs'),
'utf8'
diff --git a/src/bin/library_profile/mock.rs b/src/bin/library_profile/mock.rs
index 49ec2b897b..9e7c3fbef2 100644
--- a/src/bin/library_profile/mock.rs
+++ b/src/bin/library_profile/mock.rs
@@ -319,7 +319,7 @@ impl ChatModel<()> for SubagentMock {
&self,
_state: &(),
request: ModelRequest,
- ) -> tinyagents_harness::Result<ModelResponse> {
+ ) -> Result<ModelResponse, tinyinference::Error> {
Ok(model_response(
self.dispatch(&joined_request(&request)).await,
))
@@ -376,7 +376,7 @@ impl ChatModel<()> for LatencyMock {
&self,
_state: &(),
request: ModelRequest,
- ) -> tinyagents_harness::Result<ModelResponse> {
+ ) -> Result<ModelResponse, tinyinference::Error> {
self.latency.sleep_sampled().await;
let joined = joined_request(&request);
record(&self.prompts, &joined);
@@ -406,7 +406,7 @@ impl ChatModel<()> for PlainTextMock {
&self,
_state: &(),
request: ModelRequest,
- ) -> tinyagents_harness::Result<ModelResponse> {
+ ) -> Result<ModelResponse, tinyinference::Error> {
let joined = joined_request(&request);
record(&self.prompts, &joined);
Ok(model_response(response(&self.text)))
@@ -492,7 +492,7 @@ impl ChatModel<()> for SkillRunMock {
&self,
_state: &(),
request: ModelRequest,
- ) -> tinyagents_harness::Result<ModelResponse> {
+ ) -> Result<ModelResponse, tinyinference::Error> {
Ok(model_response(self.reply(&joined_request(&request))))
}
}
diff --git a/src/bin/library_profile/scenarios/memory_ingest.rs b/src/bin/library_profile/scenarios/memory_ingest.rs
index 252afe9c34..9ddf890ae9 100644
--- a/src/bin/library_profile/scenarios/memory_ingest.rs
+++ b/src/bin/library_profile/scenarios/memory_ingest.rs
@@ -23,7 +23,6 @@
use anyhow::Result;
use chrono::{TimeZone, Utc};
-use openhuman_core::core::bus::init as init_global;
use tinycortex::memory::ingest::canonicalize::chat::{ChatBatch, ChatMessage};
use tinymemory_core::ingest_pipeline::ingest_chat;
use tinymemory_core::queue::drain_until_idle;
diff --git a/src/bin/rss_bench.rs b/src/bin/rss_bench.rs
index db302d604e..e5f27c24ca 100644
--- a/src/bin/rss_bench.rs
+++ b/src/bin/rss_bench.rs
@@ -64,7 +64,7 @@ impl ChatModel<()> for MockModel {
&self,
_state: &(),
_request: ModelRequest,
- ) -> tinyagents_harness::Result<ModelResponse> {
+ ) -> Result<ModelResponse, tinyinference::Error> {
Ok(ModelResponse::assistant("ok"))
}
}
diff --git a/src/core/events.rs b/src/core/events.rs
index fd5ed6e2f1..5c17fea933 100644
--- a/src/core/events.rs
+++ b/src/core/events.rs
@@ -1009,7 +1009,7 @@ pub enum DomainEvent {
/// A document (chat batch, email thread, or standalone document) was
/// fully canonicalised and its chunks written to the memory tree.
///
- /// Emitted by `memory::tree::ingest::persist()` after the chunk upsert
+ /// Emitted by `tinymemory_core::tree::ingest::persist()` after the chunk upsert
/// and extract-job enqueue complete. Subscribers (Phase 2 producers such
/// as the email-signature parser) react to this to inspect the
/// canonicalised content.
diff --git a/src/openhuman/agent/harness/archivist/lifecycle.rs b/src/openhuman/agent/harness/archivist/lifecycle.rs
index 9a32fdb1dc..05eca97fe3 100644
--- a/src/openhuman/agent/harness/archivist/lifecycle.rs
+++ b/src/openhuman/agent/harness/archivist/lifecycle.rs
@@ -54,7 +54,7 @@ impl ArchivistHook {
/// This used to call `tinymemory_core::chat::build_chat_provider(&config)`
/// and store the `Arc<dyn ChatProvider>` it returned. Nothing ever called
/// that handle: the summariser the archivist drives is
- /// `memory::tree::summarise::summarise`, which builds
+ /// `tinymemory_core::tree::summarise::summarise`, which builds
/// its own provider from the same `Config` on every call. So the stored
/// value was only ever read as `is_some()`, and what it actually asserted
/// was "a chat model for the summarise role can be constructed".
diff --git a/src/openhuman/agent/harness/archivist/recap.rs b/src/openhuman/agent/harness/archivist/recap.rs
index feda88c392..2b06bbbac8 100644
--- a/src/openhuman/agent/harness/archivist/recap.rs
+++ b/src/openhuman/agent/harness/archivist/recap.rs
@@ -12,13 +12,15 @@ use crate::openhuman::memory::api::provider::{
// The engine `summarise` survives under `cfg(test)` only, where the recap
// tests install a deterministic chat provider through the engine's own
// task-local; see [`ArchivistHook::summarize_entries`] for why that arm cannot
-// go through the driver.
+// go through the driver. Named on the engine crate directly: the host's
+// `memory::tree` re-export shim stopped serving production and was deleted
+// (#5560), so a test-only reach into the engine spells the crate out.
#[cfg(test)]
-use crate::openhuman::memory::tree::summarise::summarise;
+use std::sync::Arc;
#[cfg(test)]
-use crate::openhuman::memory::tree::tree::TreeKind;
+use tinymemory_core::tree::summarise::summarise;
#[cfg(test)]
-use std::sync::Arc;
+use tinymemory_core::tree::tree::TreeKind;
/// Total input/context budget for one summarisation fold.
///
@@ -292,20 +294,18 @@ impl ArchivistHook {
let summary_result = {
let engine_inputs: Vec<_> = corpus_inputs
.iter()
- .map(
- |input| crate::openhuman::memory::tree::summarise::SummaryInput {
- id: input.id.clone(),
- content: input.content.clone(),
- token_count: input.token_count,
- entities: input.entities.clone(),
- topics: input.topics.clone(),
- time_range_start: input.time_range_start,
- time_range_end: input.time_range_end,
- score: input.score,
- },
- )
+ .map(|input| tinymemory_core::tree::summarise::SummaryInput {
+ id: input.id.clone(),
+ content: input.content.clone(),
+ token_count: input.token_count,
+ entities: input.entities.clone(),
+ topics: input.topics.clone(),
+ time_range_start: input.time_range_start,
+ time_range_end: input.time_range_end,
+ score: input.score,
+ })
.collect();
- let engine_ctx = crate::openhuman::memory::tree::summarise::SummaryContext {
+ let engine_ctx = tinymemory_core::tree::summarise::SummaryContext {
tree_id: &summary_ctx.tree_id,
tree_kind: TreeKind::parse(&summary_ctx.tree_kind)
.expect("summarize_entries builds a tree_kind the engine knows"),
diff --git a/src/openhuman/agent/harness/archivist/types.rs b/src/openhuman/agent/harness/archivist/types.rs
index 6512859cb6..8bde2aa139 100644
--- a/src/openhuman/agent/harness/archivist/types.rs
+++ b/src/openhuman/agent/harness/archivist/types.rs
@@ -35,7 +35,7 @@ pub struct ArchivistHook {
/// This was `chat_provider.is_some()` — the archivist built a chat provider
/// in [`ArchivistHook::with_config`], stored it, and then never called it.
/// It could not: the summariser it drives is
- /// `memory::tree::summarise::summarise`, which builds
+ /// `tinymemory_core::tree::summarise::summarise`, which builds
/// its **own** provider from the same `Config`. The stored handle was a
/// probe result wearing the shape of a dependency, so it is recorded as
/// what it always was — a yes/no — and the probe now runs against the
diff --git a/src/openhuman/agent/harness/subagent_runner/ops/runner.rs b/src/openhuman/agent/harness/subagent_runner/ops/runner.rs
index 567bec401d..0fabdf7b8b 100644
--- a/src/openhuman/agent/harness/subagent_runner/ops/runner.rs
+++ b/src/openhuman/agent/harness/subagent_runner/ops/runner.rs
@@ -245,18 +245,15 @@ async fn try_deterministic_memory_retrieval(
return None;
}
};
- // Relevance guard (Codex review): require entity/topic grounding before we
- // let a deterministic pass stand in for the model's relevance judgement. The
- // extraction here is deterministic and cheap (regex, or one spaCy call);
- // `fast_retrieve` repeats it internally, which is the same work its first
- // model-driven tool call would have done.
- //
- // Extraction goes through the provider's scoring family so the host no longer
- // calls `tinymemory_core::` directly. Any failure (binding unavailable,
- // scoring not exposed, extraction error) is fail-safe: treat as entities_empty
- // = true so the fast path is skipped and the model-driven walk runs instead.
- // This preserves the pre-scoring behavior where an unavailable extractor
- // returned empty entities, keeping the guard conservative.
+ // Relevance guard (Codex review): require entity/topic grounding before a
+ // deterministic pass stands in for the model's relevance judgement — the
+ // extraction is cheap (regex or one spaCy call) and `fast_retrieve` repeats
+ // it internally anyway. It goes through the provider's scoring family so
+ // the host no longer calls `tinymemory_core::` directly, and every failure
+ // (binding unavailable, scoring not exposed, extraction error) is fail-safe
+ // as entities_empty = true: the fast path is skipped and the model-driven
+ // walk runs — the same conservative outcome an unavailable extractor
+ // produced before scoring existed.
let entities_empty = match crate::openhuman::memory::binding::for_config(config) {
Ok(binding) => match binding.provider().as_scoring() {
Some(scoring) => match scoring.extract_entities(query).await {
diff --git a/src/openhuman/agent/tinyagents/thread_context.rs b/src/openhuman/agent/tinyagents/thread_context.rs
index 4752c01823..469398f718 100644
--- a/src/openhuman/agent/tinyagents/thread_context.rs
+++ b/src/openhuman/agent/tinyagents/thread_context.rs
@@ -74,8 +74,8 @@ where
Some(trimmed.to_string())
};
log::debug!(
- "[thread-context] entering scope thread_id={}",
- value.as_deref().unwrap_or("<none>")
+ "[thread-context] entering scope has_thread_id={}",
+ value.is_some()
);
THREAD_ID.scope(value, fut).await
}
diff --git a/src/openhuman/integrations/composio/ops_tests_part_02_tests.rs b/src/openhuman/integrations/composio/ops_tests_part_02_tests.rs
index f7c161a932..6cfcf51193 100644
--- a/src/openhuman/integrations/composio/ops_tests_part_02_tests.rs
+++ b/src/openhuman/integrations/composio/ops_tests_part_02_tests.rs
@@ -8,13 +8,13 @@ use super::*;
#[tokio::test]
async fn composio_delete_connection_clear_memory_cascades_live_sealed_tree_and_file() {
let _serialised = module_guard().await;
- use crate::openhuman::memory::tree::tree::bucket_seal::{seal_one_level, LabelStrategy};
use tinymemory_core::store::chunks::store::{
get_summary_content_pointers, upsert_staged_chunks_tx,
};
use tinymemory_core::store::content::stage_chunks;
use tinymemory_core::store::trees::store as tree_store;
use tinymemory_core::store::trees::types::{Buffer, TreeKind};
+ use tinymemory_core::tree::tree::bucket_seal::{seal_one_level, LabelStrategy};
use tinymemory_core::tree_source::registry::get_or_create_source_tree;
let app = Router::new()
diff --git a/src/openhuman/memory/direct_engine_refs_tests.rs b/src/openhuman/memory/direct_engine_refs_tests.rs
index 86816eb122..168d91fa71 100644
--- a/src/openhuman/memory/direct_engine_refs_tests.rs
+++ b/src/openhuman/memory/direct_engine_refs_tests.rs
@@ -287,7 +287,7 @@ const ALLOWED: &[(&str, Verdict, &str)] = &[
(
"src/openhuman/agent/harness/archivist/recap.rs",
Verdict::NeedsWiderSeam,
- "the engine-side chat provider seam (chat::test_override), named only from the `#[cfg(test)]` recap arm: the deterministic provider those tests install is a task-local inside this binary's copy of the engine, which a module in its own process cannot see. The production fold is MemoryTree::summarise",
+ "the engine-side chat provider seam (chat::test_override) plus the engine fold it scopes (tree::summarise::{summarise, SummaryInput, SummaryContext}, tree::tree::TreeKind), all named only from the `#[cfg(test)]` recap arm: the deterministic provider those tests install is a task-local inside this binary's copy of the engine, which a module in its own process cannot see. Named engine-direct since the memory::tree shims were deleted. The production fold is MemoryTree::summarise",
),
(
"src/openhuman/agent/harness/archivist/test_constructors.rs",
@@ -317,28 +317,20 @@ const ALLOWED: &[(&str, Verdict, &str)] = &[
(
"src/openhuman/memory/read_rpc/mod.rs",
Verdict::NeedsWiderSeam,
- "reaches engine storage below the contract (store::chunks::store::with_connection, store::chunks::types::SourceKind); MemoryChunks is read-only (list_chunks/get_chunk/chunk_detail/storage_kinds/chunk_embeddings) with no write or transaction door",
+ "one `#[cfg(test)]` re-export of store::chunks::store::with_connection, the raw SQLite door the read_rpc tests assert written rows through — asserting storage rather than re-reading through the handler under test. MemoryChunks is read-only (list_chunks/get_chunk/chunk_detail/storage_kinds/chunk_embeddings) with no transaction door, and a contract that had one would be a SQLite contract wearing a trait. Nothing production-side in read_rpc names the engine: SourceKind is tinymemory_api::chunks::SourceKind, and wipe_all/delete_source/flush_source_tree are purge_all, forget_matching and Tree::flush_source_tree",
),
// ── Re-export shims: `pub use tinymemory_core::<domain>::*;` ────────────
//
// 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/memory/tree/health/mod.rs",
- Verdict::HostSide,
- "re-export shim: pub use tinymemory_core::tree::health::*; no production caller left — the doctor and the degradation snapshot are MemoryMaintenance::{diagnose, degraded_state} — so what it carries is `test_guard` and the flag setters four *_tests.rs files drive",
- ),
- (
- "src/openhuman/memory/tree/mod.rs",
- Verdict::HostSide,
- "re-export shim: pub use tinymemory_core::tree::*; no production caller left — `score` is MemoryChunks::chunk_score and `summarise` is MemoryTree::summarise — so what it carries is `score::*`, `summarise::*` and `ingest` for this crate's *_tests.rs and tests/raw_coverage/",
- ),
- (
- "src/openhuman/memory/tree/tree/mod.rs",
- Verdict::HostSide,
- "re-export shim: pub use tinymemory_core::tree::tree::*",
- ),
+ //
+ // Three siblings used to sit here — `tree/mod.rs`, `tree/health/mod.rs`,
+ // `tree/tree/mod.rs` — whose globs had no production consumer left, only
+ // tests. Those tests name the engine crates directly now (served by the
+ // `[dev-dependencies]` tinymemory-core entry) and the globs are deleted,
+ // so the files no longer reference the engine at all. `tree_runtime` is
+ // the one still production-live; a parallel round is building its doors.
(
"src/openhuman/memory/tree/tree_runtime/mod.rs",
Verdict::HostSide,
@@ -354,7 +346,7 @@ const ALLOWED: &[(&str, Verdict, &str)] = &[
(
"src/openhuman/memory/host_impls.rs",
Verdict::HostSide,
- "installs the seven host seams (embedding, chat, config, nlp, scheduler gate, shutdown, error reporter); mirrored over the bus by modules/memory_host.rs — composio had an eighth seam here until tinymemory v1.13.4 deleted ComposioHost with the rest of the in-process pipeline",
+ "installs the seven host seams (embedding, chat, config, nlp, scheduler gate, shutdown, error reporter), plus the in-process chunk-store recovery door modules/memory_host.rs calls on StoreCorruptQuarantined — only this process can drop this process's cached handle. The seams are mirrored over the bus by modules/memory_host.rs, and since the tree/health/tree-tree globs were deleted their last in-process caller is the tree_runtime glob below. Composio had an eighth seam here until tinymemory v1.13.4 deleted ComposioHost with the rest of the in-process pipeline",
),
// ── Retrieval: filters the seam's tree family has no room for ───────────
// ── Agent tools: chunk reads, source listing, people, source scope ──────
@@ -449,8 +441,8 @@ fn direct_reference_scanner_is_not_vacuous() {
if allowed.contains("src/openhuman/memory/host_impls.rs") {
assert!(
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"
+ "scanner found no direct engine reference in memory/host_impls.rs, which installs \
+ the host seams; the scanner is broken"
);
}
diff --git a/src/openhuman/memory/host_impls.rs b/src/openhuman/memory/host_impls.rs
index 0723efe4d9..ec5cebfb00 100644
--- a/src/openhuman/memory/host_impls.rs
+++ b/src/openhuman/memory/host_impls.rs
@@ -35,38 +35,59 @@
//! reading once and had to be reverted. **The driver class is the wrong thing
//! to check.** It governs what answers a `MemoryProvider` call; it says nothing
//! about the free-function engine surface this crate still reaches through the
-//! `memory::tree` re-export facade, which bypasses the binding entirely — the
-//! "second unpoliced door" `memory::direct_engine_refs` is a ratchet over.
+//! surviving `memory::tree::tree_runtime` re-export, which bypasses the binding
+//! entirely — the "second unpoliced door" `memory::direct_engine_refs` is a
+//! ratchet over.
//!
-//! Two production paths through that door land on a seam today, both on
-//! [`ChatHost`]:
+//! **Both production paths this section used to name are gone, and the reason
+//! the installs survive has moved with them.** `agent::harness::archivist::
+//! recap` folds through `MemoryTree::summarise` and `memory::tools::doctor`
+//! through `MemoryMaintenance::diagnose`, so neither reaches [`ChatHost`]
+//! in-process any more; the `memory::tree::summarise` path they went through
+//! does not resolve at all now that the glob carrying it is deleted.
//!
-//! - `agent::harness::archivist::recap` calls `memory::tree::summarise::
-//! summarise` on every recap fold — the `#[cfg(not(test))]` arm, so no test
-//! override is involved — and that is `tinymemory_core::tree::summarise`,
-//! which builds its provider through `chat::build_chat_provider` →
-//! `chat_host::{provider_for_role, create_chat_model_with_model_id}`;
-//! - `memory::tools::doctor` and the `memory_tree_doctor` RPC call
-//! `memory::tree::health::async_run_doctor`, whose `doctor.rs` asks
-//! `chat_host::summarizer_available(config)` for the report's summariser row.
+//! What keeps the in-process engine live is **`memory::tree::tree_runtime`**,
+//! the last production glob (`pub use tinymemory_core::tree::tree_runtime::*`).
+//! Its five `tree_summarizer_*` RPC handlers, the `openhuman tree-summarizer`
+//! CLI subcommand, `memory::ops::learn` and the channels-startup event
+//! subscriber all run the markdown time-tree in **this** process, and that fold
+//! builds its provider through `chat::build_chat_provider` →
+//! `chat_host::{provider_for_role, create_chat_model_with_model_id}`. It is
+//! also why [`ChatHost::summarizer_available`] is implemented below by
+//! delegating straight back into `tree_runtime::ops`: the seam and its last
+//! remaining caller are two ends of the same module.
//!
//! The seams fail **loudly** when unwired rather than degrading, so removing
-//! the installs would not silently misbehave — it would break every recap and
-//! every doctor run with "no ChatHost installed". That is the failure #5560
-//! shipped once, as "no EmbeddingHost installed" on the chat hot path.
+//! the installs would not silently misbehave — it would break every summariser
+//! run with "no ChatHost installed". That is the failure #5560 shipped once, as
+//! "no EmbeddingHost installed" on the chat hot path.
//!
-//! [`reset_in_process_chunk_store`] is live for a different reason and survives
-//! independently: `memory::sources::status` reaches the engine's chunk store
-//! over raw SQLite, and `openhuman.memory_sources_status_list` — polled every
-//! five seconds by the sources UI — is what keeps that connection cached here.
+//! [`reset_in_process_chunk_store`] survives independently, and its reason has
+//! moved too. It was justified by `memory::sources::status` reading the
+//! engine's chunk store over raw SQLite; that handler asks
+//! `MemoryChunks::source_ingest_status` now and names no engine. What keeps the
+//! function is `modules::memory_host`'s `StoreCorruptQuarantined` arm — only
+//! this process can drop **this** process's cached handle, so no contract
+//! method can stand in for it however small the in-process reader set becomes.
//!
//! **So the question to re-ask is not "is the driver embedded" but "does any
//! production caller still reach an engine free function".** `grep -rn
-//! 'tinymemory_core::' src --include='*.rs'` outside comments, plus the
-//! `memory::{tree, sources}` re-export shims, is the whole inventory; when that
-//! is empty this file's installs are dead and go with the manifest entry, in
+//! 'tinymemory_core::' src --include='*.rs'` outside comments is the inventory
+//! for *this* file's installs, now that `tree_runtime` is the only re-export
+//! shim left; when it is empty they are dead and go with the manifest entry, in
//! the same change.
//!
+//! **That grep is not the inventory for #5560 as a whole, and the difference
+//! matters.** #5560 sheds two crates, and `memory::direct_engine_refs` ratchets
+//! one needle. `tinycortex` is a direct dependency of this crate in its own
+//! right — not something reached through `tinymemory-core` — so repointing a
+//! file from `tinymemory_core::x` to `tinycortex::x` drops it out of that lint
+//! while the engine stays linked. `memory::tree::health` did exactly that, on
+//! the sound reasoning that the taxonomy was always `tinycortex`'s and the
+//! engine crate only re-exported it; it is still a production `tinycortex`
+//! reference afterwards, as is `memory::tools::flavour`. Add `tinycortex::` to
+//! the grep before concluding the engine has left the build.
+//!
//! # Composio no longer has a seam here
//!
//! `tinymemory_core::composio_host` was deleted in tinymemory v1.13.4 along
@@ -80,11 +101,13 @@
use std::sync::Arc;
use async_trait::async_trait;
-use tinymemory_api::host::{EmbeddingHost, EmbeddingProvider, ErrorReporter, UsageInfo};
+use tinymemory_api::host::{
+ EmbeddingHost, EmbeddingProvider, ErrorReporter, Policy, SpacyResponse, UsageInfo,
+};
use tinymemory_core::chat_host::ChatHost;
use tinymemory_core::config_loader::ConfigLoader;
-use tinymemory_core::nlp_host::{NlpHost, SpacyResponse};
-use tinymemory_core::scheduler_gate::{Policy, SchedulerGate};
+use tinymemory_core::nlp_host::NlpHost;
+use tinymemory_core::scheduler_gate::SchedulerGate;
use tinymemory_core::shutdown::{ShutdownHook, ShutdownHost};
use tokio::sync::Notify;
@@ -96,9 +119,21 @@ use crate::openhuman::config::Config;
/// 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).
+/// in this file is a *seam trait*, a *seam installation* or the in-process
+/// recovery door, so the direct-reference inventory reads as what actually
+/// keeps the engine linked here rather than as a mix of those and inert
+/// aliases (#5560).
+///
+/// `SpacyResponse` and `Policy` were the two aliases that still broke that
+/// rule, and they are imported from `tinymemory_api::host` above for the same
+/// reason. It is the identical item either way — `tinymemory_core::nlp_host`
+/// and `::scheduler_gate` are each a `pub use` of the contract's type — so the
+/// repoint is free, and what it buys is that a reader counting engine
+/// references in this file counts only things that would have to be *replaced*
+/// rather than merely *renamed*. The traits themselves (`ChatHost`,
+/// `ConfigLoader`, `NlpHost`, `SchedulerGate`, `ShutdownHost`) have no contract
+/// declaration and cannot follow: they are the in-process embedding seam, which
+/// is the half of `tinymemory_api::host` that never crosses the bus.
type SeamConfig = dyn tinymemory_api::host::MemoryHostConfig;
// ── Embeddings ──────────────────────────────────────────────────────────────
diff --git a/src/openhuman/memory/ingestion_models.rs b/src/openhuman/memory/ingestion_models.rs
new file mode 100644
index 0000000000..ba91a58d78
--- /dev/null
+++ b/src/openhuman/memory/ingestion_models.rs
@@ -0,0 +1,145 @@
+//! See the section comment below — split out of `rpc_models.rs` for the
+//! file-layout gate; every name is re-exported from there.
+
+use serde::{Deserialize, Serialize};
+
+// ── Document-ingestion wire shapes ──────────────────────────────────────────
+//
+// These were `pub use tinycortex::memory::ingest::{…}` in `memory/mod.rs` —
+// the last re-export shim standing between this crate and dropping the engine
+// from `[dependencies]`. `doc_ingest` routes through `MemoryDocuments::
+// put_document` and fills the result with host-known facts, so nothing here
+// drives the engine any more; what survives is the WIRE SHAPE the dashboard
+// already parses. Copied field-for-field (camelCase, defaults, required
+// `modelName`) from `tinycortex::memory::ingest::extract::types`; the serde
+// tests below pin the shape literal-for-literal so drift is a test failure,
+// not a silent contract change.
+
+/// The granularity of heuristic extraction. Accepted for wire compatibility;
+/// extraction itself is driver-owned behind `put_document`.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
+#[serde(rename_all = "snake_case")]
+pub enum ExtractionMode {
+ /// Extract from each individual sentence (higher precision).
+ #[default]
+ Sentence,
+ /// Extract from the entire chunk at once (faster, better for context).
+ Chunk,
+}
+
+/// Ingestion tuning accepted on `memory.doc_ingest`. The driver owns
+/// extraction, so the host validates the shape and passes nothing on — but a
+/// payload the old engine accepted must still deserialize here.
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MemoryIngestionConfig {
+ /// Extraction backend label recorded in metadata/results.
+ pub model_name: String,
+ /// The granularity of heuristic extraction.
+ #[serde(default)]
+ pub extraction_mode: ExtractionMode,
+ /// Minimum confidence threshold for entity extraction (0.0 to 1.0).
+ #[serde(default = "default_entity_threshold")]
+ pub entity_threshold: f32,
+ /// Minimum confidence threshold for relation extraction (0.0 to 1.0).
+ #[serde(default = "default_relation_threshold")]
+ pub relation_threshold: f32,
+ /// Threshold for adjacency-based heuristics.
+ #[serde(default = "default_adjacency_threshold")]
+ pub adjacency_threshold: f32,
+ /// Reserved batch-size knob kept for config compatibility.
+ #[serde(default = "default_batch_size")]
+ pub batch_size: usize,
+}
+
+fn default_entity_threshold() -> f32 {
+ 0.45
+}
+
+fn default_relation_threshold() -> f32 {
+ 0.30
+}
+
+fn default_adjacency_threshold() -> f32 {
+ 0.50
+}
+
+fn default_batch_size() -> usize {
+ 16
+}
+
+/// An entity identified during ingestion. Always empty in module-driver
+/// responses (extraction details are driver-internal); the field type stays so
+/// the response keeps its `entities: []` array.
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ExtractedEntity {
+ /// Normalized name of the entity (all-caps).
+ pub name: String,
+ /// Classification (e.g., PERSON, ORGANIZATION).
+ pub entity_type: String,
+ /// Known aliases for this entity.
+ #[serde(default)]
+ pub aliases: Vec<String>,
+}
+
+/// A relation identified during ingestion. Same story as [`ExtractedEntity`].
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ExtractedRelation {
+ /// Name of the subject entity.
+ pub subject: String,
+ /// Classification of the subject.
+ pub subject_type: String,
+ /// Relationship type (e.g., OWNS, WORKS_ON).
+ pub predicate: String,
+ /// Name of the object entity.
+ pub object: String,
+ /// Classification of the object.
+ pub object_type: String,
+ /// Extraction confidence (0.0 to 1.0).
+ pub confidence: f32,
+ /// Number of distinct occurrences of this relation.
+ pub evidence_count: u32,
+ /// IDs of the chunks where this relation was found.
+ pub chunk_ids: Vec<String>,
+ /// Sequential order index for reconstruction.
+ pub order_index: Option<i64>,
+ /// Additional metadata about the extraction.
+ pub metadata: serde_json::Value,
+}
+
+/// The `memory.doc_ingest` response. Counts are zero and labels read
+/// `driver-managed` under the module driver — `put_document` owns chunking and
+/// extraction, and a module boundary cannot observe their details.
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MemoryIngestionResult {
+ /// ID of the document that was ingested.
+ pub document_id: String,
+ /// Namespace containing the document.
+ pub namespace: String,
+ /// Extraction backend label recorded for the ingestion run.
+ pub model_name: String,
+ /// Mode used for extraction.
+ pub extraction_mode: String,
+ /// Total number of chunks processed.
+ pub chunk_count: usize,
+ /// Total number of distinct entities found.
+ pub entity_count: usize,
+ /// Total number of distinct relations found.
+ pub relation_count: usize,
+ /// Number of identified user preferences.
+ pub preference_count: usize,
+ /// Number of identified decisions.
+ pub decision_count: usize,
+ /// Auto-generated tags for the document.
+ #[serde(default)]
+ pub tags: Vec<String>,
+ /// Complete list of identified entities.
+ #[serde(default)]
+ pub entities: Vec<ExtractedEntity>,
+ /// Complete list of identified relations.
+ #[serde(default)]
+ pub relations: Vec<ExtractedRelation>,
+}
diff --git a/src/openhuman/memory/mod.rs b/src/openhuman/memory/mod.rs
index 6380952a20..d43ccf28fd 100644
--- a/src/openhuman/memory/mod.rs
+++ b/src/openhuman/memory/mod.rs
@@ -72,9 +72,11 @@ pub(crate) mod test_support;
pub mod tools;
// Domains that are *mostly* extracted but keep their JSON-RPC surface here.
-// Each of these is a thin wrapper: `pub use tinymemory_core::<domain>::*;`
-// plus the handler/schema modules that name `RpcOutcome` and
-// `ControllerSchema`. See the module docs on each for the split.
+// Each of these started as a thin wrapper: `pub use tinymemory_core::
+// <domain>::*;` plus the handler/schema modules that name `RpcOutcome` and
+// `ControllerSchema`. The globs are being deleted as their production
+// consumers drain — `tree`, `tree::health` and `tree::tree` no longer carry
+// one (#5560) — so see the module docs on each for where its split stands.
pub mod conversations;
pub mod goals;
pub mod people;
@@ -142,20 +144,15 @@ pub use schemas::{
all_tool_memory_controller_schemas as all_memory_tool_memory_controller_schemas,
all_tool_memory_registered_controllers as all_memory_tool_memory_registered_controllers,
};
-// The ingestion vocabulary, split by who actually defines it (#5560).
-//
-// It was one `pub use tinymemory_core::ingestion::{…}` line of eleven names,
-// which read as eleven engine types. Seven of them are not: `tinymemory-core`'s
-// `ingestion` module re-exports them out of `engine::backend::ingest`, which is
-// `pub use tinycortex::memory::ingest`. So the line below names the **same
-// items** at the crate that defines them — `tinycortex` stays a direct
-// dependency of this crate, `tinymemory-core` is the one being shed — and no
-// type, wire byte or call site changes. Same move as `memory::people`,
-// `memory::tool_memory` and `memory::tree::health`'s taxonomy half.
-pub use tinycortex::memory::ingest::{
- ExtractedEntity, ExtractedRelation, ExtractionMode, MemoryIngestionConfig,
- MemoryIngestionRequest, MemoryIngestionResult, DEFAULT_MEMORY_EXTRACTION_MODEL,
-};
+// The ingestion vocabulary is host-owned now (#5560). What this block used to
+// re-export from `tinycortex::memory::ingest` was, by the end, pure WIRE
+// SHAPE: `doc_ingest` routes through `MemoryDocuments::put_document` and
+// nothing here drives the engine's extractor. The five shapes with live
+// consumers (`ExtractionMode`, `MemoryIngestionConfig`, `ExtractedEntity`,
+// `ExtractedRelation`, `MemoryIngestionResult`) live in `rpc_models.rs`,
+// which the `pub use rpc_models::*` below re-exports at the same paths —
+// consumers did not move. `MemoryIngestionRequest` and
+// `DEFAULT_MEMORY_EXTRACTION_MODEL` had no code consumers left and are gone.
// The other four — `IngestionJob`, `IngestionQueue`, `IngestionState` and
// `IngestionStatusSnapshot` — are genuinely `tinymemory-core`'s own: the
// in-process ingest queue and its status snapshot, which `direct_engine_refs`
@@ -182,6 +179,7 @@ pub use tinycortex::memory::ingest::{
// in `tinymemory` ever named one, so the engine crate was carrying this host's
// RPC surface (#5560). Same glob, same paths, same wire bytes — the definitions
// are simply ours now. See `rpc_models`'s module docs.
+pub mod ingestion_models;
pub mod rpc_models;
pub use rpc_models::*;
// Named on the crate directly — `traits` is engine scaffolding, not bus
diff --git a/src/openhuman/memory/read_rpc/admin.rs b/src/openhuman/memory/read_rpc/admin.rs
index 12191c3d42..504dfae394 100644
--- a/src/openhuman/memory/read_rpc/admin.rs
+++ b/src/openhuman/memory/read_rpc/admin.rs
@@ -284,19 +284,21 @@ pub async fn reset_tree_rpc(config: &Config) -> Result<RpcOutcome<ResetTreeRespo
/// Force a flush of one source's summary tree.
///
-/// # The last engine reference in this module (#5560)
+/// # Served by the driver, and `TreeFactory` is not a seam gap (#5560)
///
-/// **The upstream half of this is done. What is left is two host forwarders,
-/// and until they land migrating here would be a regression — read on before
-/// changing it.**
-///
-/// Served by the bound driver's `MemoryTree::flush_source_tree` (#5560).
+/// Served by the bound driver's `MemoryTree::flush_source_tree`. The wire
+/// member is `tinymemory_bus::names::FLUSH_SOURCE_TREE`, which the pinned
+/// 131-method contract carries, so this is a contract call and not a method
+/// that answers `Unsupported` at run time.
///
/// This used to hold a live `Tree` object from the engine's
/// `tree_source::get_or_create_source_tree`, because both things it did next
/// wanted the object rather than a namespace: `TreeFactory::from_tree(&tree)
/// .label_strategy(&cfg)` picked the labelling policy from the tree's own
-/// kind and scope, and `force_flush_tree` took `&tree.id`.
+/// kind and scope, and `force_flush_tree` took `&tree.id`. **Neither is an
+/// upstream ask** — they are not narrower doors waiting to be opened, they are
+/// the two halves of a handle-passing shape the contract deliberately does not
+/// have, and the member below replaces both.
///
/// tinymemory v1.7.0 replaced that with a member answering the seal count and
/// making the labelling decision driver-side — which is where it came from
diff --git a/src/openhuman/memory/read_rpc_tests_part_02_tests.rs b/src/openhuman/memory/read_rpc_tests_part_02_tests.rs
index 2a3b1d8391..f70d6a02d0 100644
--- a/src/openhuman/memory/read_rpc_tests_part_02_tests.rs
+++ b/src/openhuman/memory/read_rpc_tests_part_02_tests.rs
@@ -464,7 +464,7 @@ async fn vault_health_check_reports_missing_content_root_for_fresh_workspace() {
// `pipeline_status_rpc` → `current_degraded_state`), which sibling
// `memory_tree` tests set and never clear. Serialise + reset to a clean
// baseline so the assertion is deterministic. See #4691.
- let _g = crate::openhuman::memory::tree::health::test_guard();
+ let _g = tinymemory_core::tree::health::test_guard();
let (_tmp, cfg) = test_config();
// `vault_health_check_rpc` folds in `pipeline_status_rpc`, which reads
// through the bound driver. Bind an empty one explicitly: resolving the
diff --git a/src/openhuman/memory/rpc_models.rs b/src/openhuman/memory/rpc_models.rs
index ff3e994c7d..a1fe6f206c 100644
--- a/src/openhuman/memory/rpc_models.rs
+++ b/src/openhuman/memory/rpc_models.rs
@@ -612,3 +612,8 @@ pub(crate) fn default_memory_relative_dir() -> String {
#[cfg(test)]
#[path = "rpc_models_tests.rs"]
mod tests;
+
+// The document-ingestion wire shapes live in `ingestion_models.rs` (split for
+// the file-layout gate) and are re-exported here so `memory::…` paths keep
+// resolving.
+pub use super::ingestion_models::*;
diff --git a/src/openhuman/memory/rpc_models_tests.rs b/src/openhuman/memory/rpc_models_tests.rs
index 22207e2dc2..e878570b22 100644
--- a/src/openhuman/memory/rpc_models_tests.rs
+++ b/src/openhuman/memory/rpc_models_tests.rs
@@ -237,3 +237,64 @@ fn default_memory_relative_dir_is_memory() {
// Empty string == the memory root itself (`<workspace>/memory`).
assert_eq!(super::default_memory_relative_dir(), "");
}
+
+use crate::openhuman::memory::ingestion_models::{
+ ExtractionMode, MemoryIngestionConfig, MemoryIngestionResult,
+};
+
+/// The shapes came home from `tinycortex::memory::ingest` — this pins the
+/// JSON literal-for-literal so the move can never drift the wire.
+#[test]
+fn ingestion_result_serialises_the_engine_shape() {
+ let result = MemoryIngestionResult {
+ document_id: "doc-1".into(),
+ namespace: "global".into(),
+ model_name: "driver-managed".into(),
+ extraction_mode: "driver-managed".into(),
+ chunk_count: 0,
+ entity_count: 0,
+ relation_count: 0,
+ preference_count: 0,
+ decision_count: 0,
+ tags: vec!["t".into()],
+ entities: Vec::new(),
+ relations: Vec::new(),
+ };
+ let value = serde_json::to_value(&result).expect("serialise");
+ assert_eq!(
+ value,
+ serde_json::json!({
+ "documentId": "doc-1",
+ "namespace": "global",
+ "modelName": "driver-managed",
+ "extractionMode": "driver-managed",
+ "chunkCount": 0,
+ "entityCount": 0,
+ "relationCount": 0,
+ "preferenceCount": 0,
+ "decisionCount": 0,
+ "tags": ["t"],
+ "entities": [],
+ "relations": []
+ })
+ );
+}
+
+/// A config the old engine accepted must still deserialize: `modelName`
+/// required, everything else defaulted — including the mode's
+/// `snake_case` spelling.
+#[test]
+fn ingestion_config_defaults_match_the_engine() {
+ let config: MemoryIngestionConfig =
+ serde_json::from_value(serde_json::json!({ "modelName": "heuristic-only" }))
+ .expect("minimal config deserialises");
+ assert_eq!(config.extraction_mode, ExtractionMode::Sentence);
+ assert!((config.entity_threshold - 0.45).abs() < f32::EPSILON);
+ assert!((config.relation_threshold - 0.30).abs() < f32::EPSILON);
+ assert!((config.adjacency_threshold - 0.50).abs() < f32::EPSILON);
+ assert_eq!(config.batch_size, 16);
+ let chunk: ExtractionMode =
+ serde_json::from_value(serde_json::json!("chunk")).expect("snake_case mode");
+ assert_eq!(chunk, ExtractionMode::Chunk);
+ assert!(serde_json::from_value::<MemoryIngestionConfig>(serde_json::json!({})).is_err());
+}
diff --git a/src/openhuman/memory/seam_integration_tests_tests.rs b/src/openhuman/memory/seam_integration_tests_tests.rs
index 6757980287..e5fec6a758 100644
--- a/src/openhuman/memory/seam_integration_tests_tests.rs
+++ b/src/openhuman/memory/seam_integration_tests_tests.rs
@@ -145,6 +145,7 @@ fn local_ai_off_reports_no_provider_without_cloud_opt_in() {
}
#[tokio::test]
+#[cfg(feature = "modules")] // `modules::connectors` — and the route it resolves — exist only with the gate on
async fn direct_mode_config_resolves_via_module_config_at_call_time() {
// The seam this pinned moved. `ProviderContext::execute` — the engine's
// Composio dispatch, which routed through the host's `ComposioHost` seam
diff --git a/src/openhuman/memory/sync_pipeline_e2e_tests.rs b/src/openhuman/memory/sync_pipeline_e2e_tests.rs
index 78faf32e64..a18e7ba7fd 100644
--- a/src/openhuman/memory/sync_pipeline_e2e_tests.rs
+++ b/src/openhuman/memory/sync_pipeline_e2e_tests.rs
@@ -23,13 +23,12 @@ use tempfile::TempDir;
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
use crate::openhuman::config::Config;
+use tinybus::EventHandler;
+use tinybus::SubscriptionHandle;
// 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;
use tinycortex::memory::ingest::canonicalize::chat::{ChatBatch, ChatMessage};
use tinymemory_api::sync_events::{emit_sync_stage, MemorySyncStage, MemorySyncTrigger};
use tinymemory_core::ingest_pipeline::ingest_chat;
@@ -39,6 +38,7 @@ use tinymemory_core::store::chunks::store::{
};
use tinymemory_core::store::trees::{store as tree_store, types::TreeKind};
use tinymemory_core::tree::retrieval::{query_source, search_entities};
+use tinymemory_core::tree::score::store::lookup_entity;
// ── helpers ─────────────────────────────────────────────────────────────
diff --git a/src/openhuman/memory/tool_memory/store.rs b/src/openhuman/memory/tool_memory/store.rs
index 22a4d20ba2..61ebd3d6de 100644
--- a/src/openhuman/memory/tool_memory/store.rs
+++ b/src/openhuman/memory/tool_memory/store.rs
@@ -279,8 +279,10 @@ impl ToolMemoryStore {
/// `tools` constrains which tool namespaces to inspect; an empty slice
/// scans every known tool namespace via [`Self::list_tool_names`].
///
- /// Every `Critical` rule is retained and [`TOOL_MEMORY_PROMPT_CAP`] limits
- /// only the `High` remainder, so the result can exceed the cap.
+ /// Sorted Critical-first then freshest-first, and truncated at
+ /// [`TOOL_MEMORY_PROMPT_CAP`] exactly as the engine did — which means a
+ /// Critical rule CAN fall off once that many fresher Critical+High rules
+ /// exist. That is the engine's documented trade-off, preserved.
///
/// # Errors
///
@@ -311,11 +313,13 @@ impl ToolMemoryStore {
.cmp(&a.priority)
.then_with(|| b.updated_at.cmp(&a.updated_at))
});
- let critical_count = collected
- .iter()
- .take_while(|rule| rule.priority == ToolMemoryPriority::Critical)
- .count();
- collected.truncate(TOOL_MEMORY_PROMPT_CAP.max(critical_count));
+ // The engine enforced this cap with a plain `truncate` after sorting —
+ // its own doc on `TOOL_MEMORY_PROMPT_CAP` admits a Critical rule can be
+ // excluded once that many fresher Critical+High rules exist. The port
+ // briefly "improved" this to keep every Critical, which was a silent
+ // behaviour change in a behaviour-pinned move; the engine's semantics
+ // are restored, and the cap doc no longer overpromises.
+ collected.truncate(TOOL_MEMORY_PROMPT_CAP);
let mut out: HashMap<String, Vec<ToolMemoryRule>> = HashMap::new();
for rule in collected {
diff --git a/src/openhuman/memory/tool_memory/store_tests.rs b/src/openhuman/memory/tool_memory/store_tests.rs
index e17c85ff7d..735727cba5 100644
--- a/src/openhuman/memory/tool_memory/store_tests.rs
+++ b/src/openhuman/memory/tool_memory/store_tests.rs
@@ -166,9 +166,14 @@ async fn rules_for_prompt_keeps_only_eager_rules() {
assert_eq!(rules[0].rule, "critical constraint");
}
-/// The cap bounds the High remainder; it never drops a safety constraint.
+/// The cap is a plain truncate at [`TOOL_MEMORY_PROMPT_CAP`], exactly as the
+/// engine enforced it — Critical sorts first, so Criticals are the LAST to
+/// fall, but past the cap they do fall. The port briefly kept every Critical
+/// (`cap.max(critical_count)`), which was a silent behaviour change in a
+/// behaviour-pinned move; this test now pins the engine's trade-off instead,
+/// the same one the engine documents on the constant itself.
#[tokio::test]
-async fn rules_for_prompt_never_drops_a_critical_rule_to_fit_the_cap() {
+async fn rules_for_prompt_truncates_at_the_cap_exactly_as_the_engine_did() {
let store = store();
let critical_count = TOOL_MEMORY_PROMPT_CAP + 5;
for i in 0..critical_count {
@@ -201,12 +206,16 @@ async fn rules_for_prompt_never_drops_a_critical_rule_to_fit_the_cap() {
let rules = grouped.get("shell").expect("shell has eager rules");
assert_eq!(
rules.len(),
- critical_count,
- "every Critical survives; the High remainder is what the cap trims"
+ TOOL_MEMORY_PROMPT_CAP,
+ "the cap is a hard truncate, engine semantics"
+ );
+ assert!(
+ rules
+ .iter()
+ .all(|r| r.priority == ToolMemoryPriority::Critical),
+ "Critical sorts first, so the surviving page is all-Critical; the \
+ overflow Criticals and the High are what fell"
);
- assert!(rules
- .iter()
- .all(|r| r.priority == ToolMemoryPriority::Critical));
}
#[tokio::test]
diff --git a/src/openhuman/memory/tools/doctor_tests.rs b/src/openhuman/memory/tools/doctor_tests.rs
index fb24d10967..2c9330e9b2 100644
--- a/src/openhuman/memory/tools/doctor_tests.rs
+++ b/src/openhuman/memory/tools/doctor_tests.rs
@@ -21,7 +21,7 @@ fn name_and_schema() {
#[tokio::test]
async fn execute_returns_a_report_for_a_misconfigured_workspace() {
- let _g = crate::openhuman::memory::tree::health::test_guard();
+ let _g = tinymemory_core::tree::health::test_guard();
let (_tmp, cfg) = test_config();
// No embeddings provider, local AI off → unhealthy with a typed cause.
let tool = MemoryDoctorTool::new(cfg);
diff --git a/src/openhuman/memory/tools/goals_tests.rs b/src/openhuman/memory/tools/goals_tests.rs
index d1d03dc792..95f7f871cd 100644
--- a/src/openhuman/memory/tools/goals_tests.rs
+++ b/src/openhuman/memory/tools/goals_tests.rs
@@ -45,6 +45,27 @@ impl Drop for WorkspaceEnvGuard {
}
}
+/// Reset the shared goals document, and say why that has to happen at all.
+///
+/// `OPENHUMAN_WORKSPACE` does NOT isolate these tests: the test module
+/// provider deliberately pins every binding to
+/// `ops::shared_memory_test_workspace()` (see `memory/binding.rs`'s test
+/// `module_provider` — a native module is loaded once per process and captures
+/// its first workspace), so goals written here land in the SHARED subtree and
+/// outlive the tempdir. Each test therefore clears the document itself, while
+/// it holds `GLOBAL_MEMORY_TEST_LOCK`, instead of trusting the env guard.
+async fn reset_shared_goals() {
+ let guard = crate::openhuman::memory::ops::guard::active_memory_guard()
+ .await
+ .expect("resolve the shared test memory guard");
+ if let Some(goals) = guard.as_goals() {
+ goals
+ .set_goals(crate::openhuman::memory::api::goals::GoalsDoc::default())
+ .await
+ .expect("reset the shared goals document");
+ }
+}
+
#[tokio::test]
async fn add_then_list_reflects_change() {
let _serial = crate::openhuman::memory::ops::GLOBAL_MEMORY_TEST_LOCK
@@ -52,6 +73,7 @@ async fn add_then_list_reflects_change() {
.await;
let tmp = TempDir::new().expect("tempdir");
let _workspace = WorkspaceEnvGuard::set(tmp.path());
+ reset_shared_goals().await;
let add = GoalsAddTool::new(tmp.path().to_path_buf());
let res = add
@@ -72,6 +94,7 @@ async fn edit_and_delete_unknown_id_error() {
.await;
let tmp = TempDir::new().expect("tempdir");
let _workspace = WorkspaceEnvGuard::set(tmp.path());
+ reset_shared_goals().await;
let edit = GoalsEditTool::new(tmp.path().to_path_buf());
let res = edit
@@ -95,6 +118,7 @@ async fn add_refuses_pii_bearing_text_with_the_specific_reason() {
.await;
let tmp = TempDir::new().expect("tempdir");
let _workspace = WorkspaceEnvGuard::set(tmp.path());
+ reset_shared_goals().await;
let add = GoalsAddTool::new(tmp.path().to_path_buf());
let res = add
diff --git a/src/openhuman/memory/tree/health/mod.rs b/src/openhuman/memory/tree/health/mod.rs
index 3f0a7a1fc4..6a706257df 100644
--- a/src/openhuman/memory/tree/health/mod.rs
+++ b/src/openhuman/memory/tree/health/mod.rs
@@ -11,20 +11,28 @@
//! `DegradedState` — and `tinycortex::memory::health`'s own docs call the
//! confusion out by name. A swap would compile at neither end.
//!
-//! What this file re-exports splits cleanly in two, and the two halves are now
-//! named apart rather than mixed into one `pub use`:
+//! What this file re-exported used to split cleanly in two; only one half is
+//! left, and the other is documented so nobody re-derives where it went:
//!
//! - **The taxonomy** (`FailureCode`, `FailureClass`, `PipelineFailure`,
//! `DegradedState`, `classify_embed_error{,_str}`) is `tinycortex`'s; the
//! engine crate only re-exported it. It follows the
//! `memory::sync::sync_status` precedent and is named on `tinycortex`
//! directly below — same items, so no call site changed and none has to when
-//! the engine crate leaves the build.
-//! - **The process-global degradation flags** (`mark_*` / `clear_*` /
-//! `current_degraded_state`), the `doctor` report and its `test_guard` are
-//! defined *in* `tinymemory-core`. They have no home to be repointed at, so
-//! they are what actually pins this file — and the reason mixing the two
-//! halves into one `pub use` line hides which is which.
+//! the engine crate leaves the build. `rpc_part_02.rs` / `rpc_part_03.rs`
+//! and [`report`] still take these from here, so this half is production
+//! surface and stays.
+//! - **The engine half is gone.** The process-global degradation flags
+//! (`mark_*` / `clear_*` / `current_degraded_state`), the engine's `doctor`
+//! report and its `test_guard` rode a `pub use tinymemory_core::tree::
+//! health::*;` glob here. Production stopped reading it in #5560 — the
+//! doctor and the degradation snapshot are `MemoryMaintenance::{diagnose,
+//! degraded_state}`, served host-side by [`report`] — which left `test_guard`
+//! as its only consumer, from four test files. A production `pub use` that
+//! exists only to serve a test is exactly what keeps a crate in
+//! `[dependencies]`, so those tests name
+//! `tinymemory_core::tree::health::test_guard` directly now (the
+//! `[dev-dependencies]` entry serves them) and the glob is deleted.
//!
//! Worth knowing before trusting a reading of `current_degraded_state()`: the
//! flags are process statics, and the loaded module links its **own** copy of
@@ -48,28 +56,13 @@ pub use tinycortex::memory::health::{
PipelineFailure,
};
-// The half that genuinely pins the engine crate: the process-global
-// degradation flags (`mark_*` / `clear_*` / `current_degraded_state`, plus the
-// `test_guard` that serialises tests touching them) and the engine's own
-// `doctor` report, all *defined in* `tinymemory-core`. Left as a glob
-// deliberately — narrowing it would enumerate the flag set here and go stale
-// the first time one is added, and it carries nothing else.
-//
-// **Nothing in production reads this glob any more.** `current_degraded_state`
-// and `async_run_doctor` were its two live callers and both went to the driver
-// in #5560 — see [`report`]. What is left is `test_guard`, which four test
-// files use to serialise the process statics, and the flag setters those tests
-// drive. So this line is now a test-only pin, and it goes when those tests stop
-// needing an in-process engine to mark a flag on.
-pub use tinymemory_core::tree::health::*;
-
/// The doctor report and the degradation snapshot, read from the bound driver
/// rather than from this process's copy of the engine.
///
/// Its [`DoctorReport`](report::DoctorReport) shadows nothing: it is reached as
/// `health::report::DoctorReport`, deliberately kept out of this module's own
-/// namespace so that "the host's response type" and "the engine's struct the
-/// glob above still carries" cannot be confused for one another at a call site.
+/// namespace so that "the host's response type" and "the engine's same-named
+/// struct" cannot be confused for one another at a call site.
pub mod report;
pub(crate) mod user_error;
diff --git a/src/openhuman/memory/tree/mod.rs b/src/openhuman/memory/tree/mod.rs
index ebbc773912..745e699033 100644
--- a/src/openhuman/memory/tree/mod.rs
+++ b/src/openhuman/memory/tree/mod.rs
@@ -1,63 +1,31 @@
-//! Host layer over [`tinymemory_core::tree`].
+//! Host layer over what used to be an embedded memory tree.
//!
-//! The domain itself lives in the extracted crate; what stays here is its
-//! JSON-RPC surface — handlers and controller schemas name OpenHuman's
+//! The domain itself lives in the extracted engine crates; what stays here is
+//! its JSON-RPC surface — handlers and controller schemas name OpenHuman's
//! `RpcOutcome` and `ControllerSchema`, which the engine crate cannot see.
-//! The glob re-export keeps every historical `memory::tree::…` path resolving.
//!
-//! # What the glob still carries, re-measured rather than assumed (#5560)
+//! # The `pub use tinymemory_core::tree::*` shim is gone (#5560)
//!
-//! Four of the nine module names it supplies (`health`, `retrieval`, `tree`,
-//! `tree_runtime`) are shadowed by the `pub mod` declarations below — an
-//! explicit item beats a glob import — so its live contribution is narrower
-//! than it looks. **Measured by deleting the line and reading the compiler**,
-//! rather than by grepping for the paths, the production surface is now
-//! **empty**. The two names that pinned it are both gone:
+//! This file carried a glob re-export so that every historical
+//! `memory::tree::…` path kept resolving. Measured by deleting the line and
+//! reading the compiler, its production surface was **empty**: `score` is
+//! `MemoryChunks::chunk_score` and the contract's own `DEFAULT_DROP_THRESHOLD`,
+//! `summarise` is `MemoryTree::summarise` with the contract's owned DTOs, the
+//! seven `Tree{LabelStrategy, LeafPayload, ReadHit, ReadRequest, ReadResult,
+//! WriteOutcome, WriteRequest}` I/O types went unnamed in `src/`, and `nlp` and
+//! `graph` had no caller under this path at all. What the glob still served
+//! was tests — this crate's `*_tests.rs`, the recap's `#[cfg(test)]` arm and
+//! `tests/raw_coverage/` reaching `score`, `summarise` and `ingest`.
//!
-//! - `score` — `read_rpc::entities` reached `score::store` and
-//! `score::DEFAULT_DROP_THRESHOLD` for the chunk-score RPC. That is
-//! `MemoryChunks::chunk_score` and the contract's own
-//! `DEFAULT_DROP_THRESHOLD` since #5560.
-//! - `summarise` — `agent::harness::archivist::recap` reached
-//! `summarise::{summarise, SummaryContext, SummaryInput}`. That is
-//! `MemoryTree::summarise` and the contract's owned DTOs now; only the
-//! recap's `#[cfg(test)]` arm still names the engine's, because the
-//! deterministic chat provider those tests install is a task-local *inside*
-//! the engine crate this binary links for tests.
-//!
-//! So everything the glob still carries is test-only. `ingest`
-//! (`ingest_summary` / `SummaryIngestInput`) survives for
-//! `tests/memory_sync_pipeline_e2e.rs`, `score::{embed, extract, resolver,
-//! signals, store}` and `summarise::{summarise, fallback_summary}` for the
-//! raw-coverage suites and this crate's own `*_tests.rs`, and `nlp` and
-//! `graph` have no caller under this path at all — `nlp` **used** to be
-//! reached from `retrieval/rpc.rs` and no longer is. A glob is all-or-nothing,
-//! so the unused names ride along.
-//!
-//! Nothing left here has a contract equivalent, and none is wanted:
-//! `tinymemory_api::tree` is the summary-node vocabulary, not an embedder and
-//! not an entity extractor. This shim is now pinned purely by test targets, and
-//! it goes when those stop asserting against an in-process engine — which is a
-//! decision about how the raw-coverage suites are written, not a routing pass.
-//!
-//! The seven `Tree{LabelStrategy, LeafPayload, ReadHit, ReadRequest,
-//! ReadResult, WriteOutcome, WriteRequest}` I/O types were re-exported here
-//! explicitly until #5560's shed pass. **They are gone**: nothing in `src/`
-//! named them, and the one consumer —
-//! `tests/raw_coverage/memory_threads_raw_coverage_e2e.rs` — names
-//! `tinycortex::memory::tree::…` directly now. A production `pub use` that
-//! exists only to serve a test is exactly what keeps a crate in
-//! `[dependencies]`, which is the thing this issue is removing.
-
-// What is left of the glob is the scoring and summarisation half, and it is
-// `tinymemory-core`'s own code rather than a re-export: `score` (embed /
-// extract / store / resolver / signals), `summarise`, `nlp` and `ingest`, plus
-// `graph`, which the glob carries because a glob is all-or-nothing.
-// `tinymemory_api::tree` is the summary-node vocabulary — not an embedder and
-// not an entity extractor — so there is nothing on the contract to route these
-// at. **No production file pins it any more**; see the module docs above for
-// what does.
-pub use tinymemory_core::tree::*;
+//! A production `pub use` that exists only to serve a test is exactly what
+//! keeps a crate in `[dependencies]`, which is the thing #5560 is removing. So
+//! those tests name the engine crates directly now —
+//! `tinymemory_core::tree::{score, summarise, ingest}` and
+//! `tinycortex::memory::tree::Tree*`, served by the `[dev-dependencies]`
+//! `tinymemory-core` entry the way the earlier-repointed `tests/` targets
+//! already were — and the glob is deleted. What resolves under
+//! `memory::tree::…` is the host's own surface: the four `pub mod`s and the
+//! controller registries below.
pub mod health;
pub mod retrieval;
diff --git a/src/openhuman/memory/tree/tree/canonicalize_types.rs b/src/openhuman/memory/tree/tree/canonicalize_types.rs
new file mode 100644
index 0000000000..b6e78cc98c
--- /dev/null
+++ b/src/openhuman/memory/tree/tree/canonicalize_types.rs
@@ -0,0 +1,289 @@
+//! The canonical ingest payload shapes — chat, email, document — exactly as
+//! they came home from `tinycortex::memory::ingest::canonicalize` (#5560),
+//! plus the `invalid_payload_message` formatter their handlers share.
+//!
+//! Split out of `rpc_part_01.rs` purely for the file-layout gate; every name
+//! is re-exported from there, so no import path changed. The serde behaviour
+//! in here is wire contract: the timestamp leniency, the provider default,
+//! and the epoch-ms/RFC-3339 dual parse are what deployed producers already
+//! send.
+
+use chrono::{DateTime, Utc};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_json::Value;
+use tinymemory_api::chunks::SourceKind;
+
+// ── The `memory_tree_ingest` payload shapes (#5560) ──────────────────────────
+//
+// `ChatBatch`, `EmailThread` and `DocumentInput` were imported from
+// `tinycortex::memory::ingest::canonicalize`. They are defined here now, and
+// the reason is that **this host is their only reader**: they are the request
+// half of an OpenHuman JSON-RPC method, deserialised by [`ingest_rpc`] below
+// and turned into contract [`IngestItem`]s by the three mappers further down.
+// Nothing on this side ever hands one of these structs to the engine — the
+// items are what cross the bus, and the driver rebuilds its own copy of these
+// shapes on the far end from those items. Two independent readers of one JSON
+// wire format, which is the same arrangement `memory::rpc_models`,
+// `memory::safety` and `memory::source_scope` already landed on.
+//
+// So there is no contract door to route this at, and asking for one would be
+// asking `tinymemory-api` to carry a payload that never crosses the bus. What
+// pins the *shape* is the wire, not the type: the driver's reconstruction is
+// documented field-for-field on [`email_items`] and [`chat_items`], and
+// `rpc_tests_part_01_tests` pins the serde tolerances. Change a field name
+// here and the round trip breaks in exactly the way those tests describe —
+// which is the same exposure the import had, since a rename upstream would
+// have reshaped this RPC's published request body without anything here
+// failing to compile.
+//
+// `Serialize` is derived alongside `Deserialize` because the engine derived
+// both and the round-trip is what the tests assert; nothing in `src/`
+// serialises one.
+
+/// Serde default for the two chat/mail message timestamps.
+///
+/// A payload missing the field falls back to `now()` rather than rejecting the
+/// whole batch, so a client with version skew (or a third-party integration
+/// that never sent one) does not lose an entire thread to one absent key.
+fn ingest_timestamp_now() -> DateTime<Utc> {
+ Utc::now()
+}
+
+/// Serde default for [`DocumentInput::provider`].
+fn default_document_provider() -> String {
+ "unknown".to_string()
+}
+
+/// Accept a timestamp as epoch-milliseconds, an RFC 3339 / ISO-8601 string, or
+/// `null`.
+///
+/// Three shapes because three generations of clients send three shapes, and
+/// the alternative to accepting all of them is silently dropping whichever the
+/// caller happens to use.
+///
+/// The near-epoch rejection is the load-bearing part: contemporary epoch
+/// *seconds* are ten digits and epoch *milliseconds* are thirteen, so a
+/// seconds value passed here would decode to 1970 and quietly poison ordering
+/// and staleness. Rejecting the ambiguous range makes that a loud error at the
+/// seam instead.
+fn deserialize_flexible_timestamp<'de, D>(deserializer: D) -> Result<DateTime<Utc>, D::Error>
+where
+ D: Deserializer<'de>,
+{
+ #[derive(Deserialize)]
+ #[serde(untagged)]
+ enum RawTs {
+ Millis(i64),
+ Text(String),
+ Null,
+ }
+
+ fn epoch_millis<E: serde::de::Error>(ms: i64) -> Result<DateTime<Utc>, E> {
+ const MIN_PLAUSIBLE_EPOCH_MILLIS: u64 = 100_000_000_000;
+ if ms.unsigned_abs() < MIN_PLAUSIBLE_EPOCH_MILLIS {
+ return Err(E::custom(format!(
+ "epoch-ms value {ms} is too small; pass milliseconds, not seconds"
+ )));
+ }
+ chrono::TimeZone::timestamp_millis_opt(&Utc, ms)
+ .single()
+ .ok_or_else(|| E::custom(format!("invalid epoch-ms: {ms}")))
+ }
+
+ let raw = RawTs::deserialize(deserializer)?;
+ match raw {
+ RawTs::Null => Ok(Utc::now()),
+ RawTs::Millis(ms) => epoch_millis(ms),
+ RawTs::Text(s) => {
+ if let Ok(dt) = DateTime::parse_from_rfc3339(&s) {
+ return Ok(dt.with_timezone(&Utc));
+ }
+ if let Ok(ms) = s.parse::<i64>() {
+ return epoch_millis(ms);
+ }
+ Err(serde::de::Error::custom(format!(
+ "cannot parse '{s}' as RFC 3339 or epoch-ms"
+ )))
+ }
+ }
+}
+
+/// One chat message in a channel/group.
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct ChatMessage {
+ /// Author display name or id.
+ pub author: String,
+ /// When the message was sent (epoch-ms integer or RFC 3339 string).
+ /// When absent from the payload, defaults to `Utc::now()` — see
+ /// [`ingest_timestamp_now`].
+ #[serde(
+ default = "ingest_timestamp_now",
+ serialize_with = "chrono::serde::ts_milliseconds::serialize",
+ deserialize_with = "deserialize_flexible_timestamp"
+ )]
+ pub timestamp: DateTime<Utc>,
+ /// Plain text / markdown body.
+ pub text: String,
+ /// Optional per-message provenance pointer (permalink or `platform://...`).
+ #[serde(default)]
+ pub source_ref: Option<String>,
+}
+
+/// Adapter input — a batch of messages from one logical channel.
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct ChatBatch {
+ /// Platform name (e.g. `slack`, `discord`, `telegram`). Crosses verbatim
+ /// as [`IngestItem::platform`]; see [`chat_data_source`] for how it is
+ /// additionally mapped onto a [`DataSource`].
+ pub platform: String,
+ /// Human-readable channel / group name.
+ pub channel_label: String,
+ /// Ordered messages (chronological; the adapter sorts defensively).
+ pub messages: Vec<ChatMessage>,
+}
+
+/// One email in a thread.
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct EmailMessage {
+ /// Sender address; rendered as the `From:` header and used as the
+ /// participant key when bucketing a thread.
+ pub from: String,
+ /// Primary recipient addresses; the `To:` header (omitted when empty).
+ #[serde(default)]
+ pub to: Vec<String>,
+ /// Carbon-copy recipient addresses; the `Cc:` header (omitted when empty).
+ #[serde(default)]
+ pub cc: Vec<String>,
+ /// Per-message subject; the `Subject:` header.
+ pub subject: String,
+ /// When the message was sent (epoch-ms integer or RFC 3339 string).
+ /// When absent, defaults to `Utc::now()` so one missing key does not
+ /// reject the whole thread.
+ #[serde(
+ default = "ingest_timestamp_now",
+ serialize_with = "chrono::serde::ts_milliseconds::serialize",
+ deserialize_with = "deserialize_flexible_timestamp"
+ )]
+ pub sent_at: DateTime<Utc>,
+ /// Plain-text or markdown body.
+ pub body: String,
+ /// Message-id header or provider URL; used for citation back to source.
+ #[serde(default)]
+ pub source_ref: Option<String>,
+ /// `List-Unsubscribe` header. Carried through because an unsubscribe flow
+ /// reads it back out of stored mail — dropping it makes that flow
+ /// impossible, not merely poorer (see [`email_items`]).
+ #[serde(default)]
+ pub list_unsubscribe: Option<String>,
+}
+
+/// A whole email thread.
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct EmailThread {
+ /// Provider name (e.g. `gmail`, `outlook`). See [`email_data_source`].
+ pub provider: String,
+ /// Thread subject (usually the subject of the first message).
+ pub thread_subject: String,
+ /// Ordered messages (chronological; the adapter sorts defensively).
+ pub messages: Vec<EmailMessage>,
+}
+
+/// Adapter input for a single document.
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct DocumentInput {
+ /// Provider name (e.g. `notion`, `drive`, `meeting_notes`). Defaults to
+ /// `"unknown"` when absent. See [`document_data_source`].
+ #[serde(default = "default_document_provider")]
+ pub provider: String,
+ /// Document title. Read only to decide whether the payload was wholly
+ /// empty — it does not cross to the driver; see [`document_item`].
+ pub title: String,
+ /// Document body (markdown preferred; plain text also accepted).
+ pub body: String,
+ /// When the document was last modified at the source.
+ ///
+ /// Accepts an epoch-milliseconds integer (back-compat), an RFC 3339 /
+ /// ISO-8601 string, or absent → `Utc::now()`.
+ #[serde(
+ default = "ingest_timestamp_now",
+ deserialize_with = "deserialize_flexible_timestamp"
+ )]
+ pub modified_at: DateTime<Utc>,
+ /// Optional pointer back to source (URL, file path, Notion page id).
+ #[serde(default)]
+ pub source_ref: Option<String>,
+}
+
+/// Unified ingest request. The `payload` shape is adapter-specific and is
+/// validated inside the dispatch based on `source_kind`.
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct IngestRequest {
+ /// Which kind of source the payload represents.
+ pub source_kind: SourceKind,
+ /// Logical source id (channel/group for chat, thread for email, doc id).
+ pub source_id: String,
+ /// Account/user this content belongs to.
+ #[serde(default)]
+ pub owner: String,
+ /// Optional labels/tags carried through.
+ #[serde(default)]
+ pub tags: Vec<String>,
+ /// Adapter-specific payload — shape matches the canonicaliser for
+ /// `source_kind`:
+ /// - `chat` → [`ChatBatch`]
+ /// - `email` → [`EmailThread`]
+ /// - `document` → [`DocumentInput`]
+ pub payload: Value,
+}
+
+/// Response body of the `memory_tree_ingest` RPC.
+///
+/// Declared here rather than returned as the engine's own summary type,
+/// because this is a wire shape the frontend reads: a body owned by a foreign
+/// crate is one an upstream field rename can reshape without anything in this
+/// repository failing to compile. Every key and JSON type is what that summary
+/// serialised and must stay that way —
+/// `the_response_body_serialises_exactly_as_the_engine_summary` is the pin, and
+/// it is what the chat and document arms' move onto the driver contract had to
+/// keep true. Those two build this body from an `IngestOutcome` now, mail still
+/// from the pipeline's summary, and both spell the same six keys.
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct IngestResponse {
+ /// Logical source id the ingest was scoped to — the one the caller
+ /// supplied, echoed back so a batched caller can pair a reply with its
+ /// request.
+ pub source_id: String,
+ /// Units persisted by this call.
+ pub chunks_written: usize,
+ /// Units produced and not admitted. Dropped units only: a call refused
+ /// outright is [`Self::already_ingested`], not a drop of everything.
+ pub chunks_dropped: usize,
+ /// Ids of the units this call produced. A caller fetches a chunk back by
+ /// these, so a write that names none is unusable even when the count is
+ /// right.
+ pub chunk_ids: Vec<String>,
+ /// Follow-up extraction jobs this call scheduled. Read next to
+ /// [`Self::chunks_written`] it answers whether the material just handed
+ /// over will be picked up at all — rows can land with nothing scheduled to
+ /// derive from them, and the write count alone reports that as success.
+ pub extract_jobs_enqueued: usize,
+ /// True when the call was a no-op because `(source_kind, source_id)` had
+ /// been ingested before.
+ ///
+ /// Distinct from a zero-write result, and the distinction is the point:
+ /// only a refusal is a reason to go and clear the source gate. The gate is
+ /// keyed on the logical source rather than on the content, so re-sending
+ /// *changed* material under a claimed `source_id` also writes nothing.
+ pub already_ingested: bool,
+}
+
+/// Build the validation error returned when an ingest payload does not match
+/// the canonicaliser schema for its `source_kind`.
+///
+/// Kept as the single construction site so the wording cannot drift away from
+/// [`is_invalid_ingest_payload_message`], which the transport layer uses to
+/// pick the Sentry severity. Same emit-site/classifier pairing as
+/// `dispatch::UNKNOWN_METHOD_PREFIX` / `dispatch::unknown_method_name`.
+pub(crate) fn invalid_payload_message(source_kind: SourceKind, err: &serde_json::Error) -> String {
+ format!("invalid {} payload: {err}", source_kind.as_str())
+}
diff --git a/src/openhuman/memory/tree/tree/mod.rs b/src/openhuman/memory/tree/tree/mod.rs
index 93884a5fd7..f769a7b3d2 100644
--- a/src/openhuman/memory/tree/tree/mod.rs
+++ b/src/openhuman/memory/tree/tree/mod.rs
@@ -1,25 +1,37 @@
-//! Host layer over [`tinymemory_core::tree::tree`].
+//! Host layer over what used to be `tinymemory_core::tree::tree`.
//!
//! The domain itself lives in the extracted crate; what stays here is its
//! JSON-RPC surface — handlers and controller schemas name OpenHuman's
//! `RpcOutcome` and `ControllerSchema`, which the engine crate cannot see.
-//! The glob re-export keeps every historical `memory::tree::tree::…` path resolving.
-
-// Engine-owned persistence types (`Tree`, `SummaryNode`, `Buffer`, `TreeKind`,
-// the seal/flush/registry mechanics). None of them is a contract item, and the
-// `TreeStatus` re-exported here is the engine's `store::trees` one — a
-// different type from the contract's `TreeStatus`, which the sibling
-// `tree_runtime` module exports. Two same-named types one module apart, so
-// check which one a call site means before moving it.
-//
-// What keeps this line alive (#5560), so the next reader does not re-derive it:
-// `read_rpc::admin`'s `flush_source_tree` needs `TreeFactory` and
-// `flush::force_flush_tree`, and `integrations::composio::ops_tests` +
-// `tests/raw_coverage/` reach `bucket_seal::{seal_one_level, LabelStrategy}`,
-// `store::get_tree_by_scope`, `registry::is_unique_violation` and
-// `set_summary_embedding`. `MemoryTree` on the contract is namespace-addressed
-// (append / query_source / drill_down / seal / cascade / summary_forest /
-// recent_leaves) and has no door onto a tree *object*, which is the ask.
-pub use tinymemory_core::tree::tree::*;
+//!
+//! # The `pub use tinymemory_core::tree::tree::*` shim is gone (#5560)
+//!
+//! This file carried a glob re-export so every historical
+//! `memory::tree::tree::…` path kept resolving — the engine-owned persistence
+//! types (`Tree`, `SummaryNode`, `Buffer`, `TreeKind`, the seal/flush/registry
+//! mechanics). Its production surface was re-measured at empty: the doc claim
+//! that `read_rpc::admin`'s `flush_source_tree` needed `TreeFactory` and
+//! `force_flush_tree` had gone stale — that handler asks the bound driver's
+//! `MemoryTree::flush_source_tree` now, and the `TreeFactory` mentions left in
+//! `admin.rs` are prose about the old shape, not code. What the glob still
+//! served was tests (`integrations::composio::ops_tests`, the recap's
+//! `#[cfg(test)]` arm, `tests/raw_coverage/`) reaching `bucket_seal`,
+//! `store`, `registry`, `flush` and `TreeKind`/`TreeStatus`.
+//!
+//! A production `pub use` that exists only to serve a test is exactly what
+//! keeps a crate in `[dependencies]`, so those tests name
+//! `tinymemory_core::tree::tree::…` directly now — served by the
+//! `[dev-dependencies]` entry, the way the earlier-repointed `tests/` targets
+//! already were — and the glob is deleted. `MemoryTree` on the contract stays
+//! namespace-addressed (append / query_source / drill_down / seal / cascade /
+//! summary_forest / recent_leaves) with no door onto a tree *object*, which is
+//! why the tests still want the engine crate rather than the driver.
+//!
+//! Worth keeping from the old comment, because two same-named types sit one
+//! module apart: the engine's `tree::tree::TreeStatus` (`store::trees`) is a
+//! **different type** from the contract's `TreeStatus`, which the sibling
+//! `tree_runtime` module exports. Check which one a call site means before
+//! moving it.
+pub mod canonicalize_types;
pub mod rpc;
diff --git a/src/openhuman/memory/tree/tree/rpc_part_01.rs b/src/openhuman/memory/tree/tree/rpc_part_01.rs
index fcdc5315bf..12fa8dc22f 100644
--- a/src/openhuman/memory/tree/tree/rpc_part_01.rs
+++ b/src/openhuman/memory/tree/tree/rpc_part_01.rs
@@ -1,6 +1,4 @@
-use chrono::{DateTime, Utc};
-use serde::{Deserialize, Deserializer, Serialize};
-use serde_json::Value;
+use serde::{Deserialize, Serialize};
use crate::openhuman::config::Config;
use crate::openhuman::memory::api::provider::ChunkQuery;
@@ -8,281 +6,10 @@ use crate::rpc::RpcOutcome;
use tinymemory_api::chunks::{Chunk, DataSource, SourceKind, SourceRef};
use tinymemory_api::provider::types::{IngestItem, IngestOutcome};
use tinymemory_api::types::MemoryTaint;
-
-// ── The `memory_tree_ingest` payload shapes (#5560) ──────────────────────────
-//
-// `ChatBatch`, `EmailThread` and `DocumentInput` were imported from
-// `tinycortex::memory::ingest::canonicalize`. They are defined here now, and
-// the reason is that **this host is their only reader**: they are the request
-// half of an OpenHuman JSON-RPC method, deserialised by [`ingest_rpc`] below
-// and turned into contract [`IngestItem`]s by the three mappers further down.
-// Nothing on this side ever hands one of these structs to the engine — the
-// items are what cross the bus, and the driver rebuilds its own copy of these
-// shapes on the far end from those items. Two independent readers of one JSON
-// wire format, which is the same arrangement `memory::rpc_models`,
-// `memory::safety` and `memory::source_scope` already landed on.
-//
-// So there is no contract door to route this at, and asking for one would be
-// asking `tinymemory-api` to carry a payload that never crosses the bus. What
-// pins the *shape* is the wire, not the type: the driver's reconstruction is
-// documented field-for-field on [`email_items`] and [`chat_items`], and
-// `rpc_tests_part_01_tests` pins the serde tolerances. Change a field name
-// here and the round trip breaks in exactly the way those tests describe —
-// which is the same exposure the import had, since a rename upstream would
-// have reshaped this RPC's published request body without anything here
-// failing to compile.
-//
-// `Serialize` is derived alongside `Deserialize` because the engine derived
-// both and the round-trip is what the tests assert; nothing in `src/`
-// serialises one.
-
-/// Serde default for the two chat/mail message timestamps.
-///
-/// A payload missing the field falls back to `now()` rather than rejecting the
-/// whole batch, so a client with version skew (or a third-party integration
-/// that never sent one) does not lose an entire thread to one absent key.
-fn ingest_timestamp_now() -> DateTime<Utc> {
- Utc::now()
-}
-
-/// Serde default for [`DocumentInput::provider`].
-fn default_document_provider() -> String {
- "unknown".to_string()
-}
-
-/// Accept a timestamp as epoch-milliseconds, an RFC 3339 / ISO-8601 string, or
-/// `null`.
-///
-/// Three shapes because three generations of clients send three shapes, and
-/// the alternative to accepting all of them is silently dropping whichever the
-/// caller happens to use.
-///
-/// The near-epoch rejection is the load-bearing part: contemporary epoch
-/// *seconds* are ten digits and epoch *milliseconds* are thirteen, so a
-/// seconds value passed here would decode to 1970 and quietly poison ordering
-/// and staleness. Rejecting the ambiguous range makes that a loud error at the
-/// seam instead.
-fn deserialize_flexible_timestamp<'de, D>(deserializer: D) -> Result<DateTime<Utc>, D::Error>
-where
- D: Deserializer<'de>,
-{
- #[derive(Deserialize)]
- #[serde(untagged)]
- enum RawTs {
- Millis(i64),
- Text(String),
- Null,
- }
-
- fn epoch_millis<E: serde::de::Error>(ms: i64) -> Result<DateTime<Utc>, E> {
- const MIN_PLAUSIBLE_EPOCH_MILLIS: u64 = 100_000_000_000;
- if ms.unsigned_abs() < MIN_PLAUSIBLE_EPOCH_MILLIS {
- return Err(E::custom(format!(
- "epoch-ms value {ms} is too small; pass milliseconds, not seconds"
- )));
- }
- chrono::TimeZone::timestamp_millis_opt(&Utc, ms)
- .single()
- .ok_or_else(|| E::custom(format!("invalid epoch-ms: {ms}")))
- }
-
- let raw = RawTs::deserialize(deserializer)?;
- match raw {
- RawTs::Null => Ok(Utc::now()),
- RawTs::Millis(ms) => epoch_millis(ms),
- RawTs::Text(s) => {
- if let Ok(dt) = DateTime::parse_from_rfc3339(&s) {
- return Ok(dt.with_timezone(&Utc));
- }
- if let Ok(ms) = s.parse::<i64>() {
- return epoch_millis(ms);
- }
- Err(serde::de::Error::custom(format!(
- "cannot parse '{s}' as RFC 3339 or epoch-ms"
- )))
- }
- }
-}
-
-/// One chat message in a channel/group.
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct ChatMessage {
- /// Author display name or id.
- pub author: String,
- /// When the message was sent (epoch-ms integer or RFC 3339 string).
- /// When absent from the payload, defaults to `Utc::now()` — see
- /// [`ingest_timestamp_now`].
- #[serde(
- default = "ingest_timestamp_now",
- serialize_with = "chrono::serde::ts_milliseconds::serialize",
- deserialize_with = "deserialize_flexible_timestamp"
- )]
- pub timestamp: DateTime<Utc>,
- /// Plain text / markdown body.
- pub text: String,
- /// Optional per-message provenance pointer (permalink or `platform://...`).
- #[serde(default)]
- pub source_ref: Option<String>,
-}
-
-/// Adapter input — a batch of messages from one logical channel.
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct ChatBatch {
- /// Platform name (e.g. `slack`, `discord`, `telegram`). Crosses verbatim
- /// as [`IngestItem::platform`]; see [`chat_data_source`] for how it is
- /// additionally mapped onto a [`DataSource`].
- pub platform: String,
- /// Human-readable channel / group name.
- pub channel_label: String,
- /// Ordered messages (chronological; the adapter sorts defensively).
- pub messages: Vec<ChatMessage>,
-}
-
-/// One email in a thread.
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct EmailMessage {
- /// Sender address; rendered as the `From:` header and used as the
- /// participant key when bucketing a thread.
- pub from: String,
- /// Primary recipient addresses; the `To:` header (omitted when empty).
- #[serde(default)]
- pub to: Vec<String>,
- /// Carbon-copy recipient addresses; the `Cc:` header (omitted when empty).
- #[serde(default)]
- pub cc: Vec<String>,
- /// Per-message subject; the `Subject:` header.
- pub subject: String,
- /// When the message was sent (epoch-ms integer or RFC 3339 string).
- /// When absent, defaults to `Utc::now()` so one missing key does not
- /// reject the whole thread.
- #[serde(
- default = "ingest_timestamp_now",
- serialize_with = "chrono::serde::ts_milliseconds::serialize",
- deserialize_with = "deserialize_flexible_timestamp"
- )]
- pub sent_at: DateTime<Utc>,
- /// Plain-text or markdown body.
- pub body: String,
- /// Message-id header or provider URL; used for citation back to source.
- #[serde(default)]
- pub source_ref: Option<String>,
- /// `List-Unsubscribe` header. Carried through because an unsubscribe flow
- /// reads it back out of stored mail — dropping it makes that flow
- /// impossible, not merely poorer (see [`email_items`]).
- #[serde(default)]
- pub list_unsubscribe: Option<String>,
-}
-
-/// A whole email thread.
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct EmailThread {
- /// Provider name (e.g. `gmail`, `outlook`). See [`email_data_source`].
- pub provider: String,
- /// Thread subject (usually the subject of the first message).
- pub thread_subject: String,
- /// Ordered messages (chronological; the adapter sorts defensively).
- pub messages: Vec<EmailMessage>,
-}
-
-/// Adapter input for a single document.
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct DocumentInput {
- /// Provider name (e.g. `notion`, `drive`, `meeting_notes`). Defaults to
- /// `"unknown"` when absent. See [`document_data_source`].
- #[serde(default = "default_document_provider")]
- pub provider: String,
- /// Document title. Read only to decide whether the payload was wholly
- /// empty — it does not cross to the driver; see [`document_item`].
- pub title: String,
- /// Document body (markdown preferred; plain text also accepted).
- pub body: String,
- /// When the document was last modified at the source.
- ///
- /// Accepts an epoch-milliseconds integer (back-compat), an RFC 3339 /
- /// ISO-8601 string, or absent → `Utc::now()`.
- #[serde(
- default = "ingest_timestamp_now",
- deserialize_with = "deserialize_flexible_timestamp"
- )]
- pub modified_at: DateTime<Utc>,
- /// Optional pointer back to source (URL, file path, Notion page id).
- #[serde(default)]
- pub source_ref: Option<String>,
-}
-
-/// Unified ingest request. The `payload` shape is adapter-specific and is
-/// validated inside the dispatch based on `source_kind`.
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct IngestRequest {
- /// Which kind of source the payload represents.
- pub source_kind: SourceKind,
- /// Logical source id (channel/group for chat, thread for email, doc id).
- pub source_id: String,
- /// Account/user this content belongs to.
- #[serde(default)]
- pub owner: String,
- /// Optional labels/tags carried through.
- #[serde(default)]
- pub tags: Vec<String>,
- /// Adapter-specific payload — shape matches the canonicaliser for
- /// `source_kind`:
- /// - `chat` → [`ChatBatch`]
- /// - `email` → [`EmailThread`]
- /// - `document` → [`DocumentInput`]
- pub payload: Value,
-}
-
-/// Response body of the `memory_tree_ingest` RPC.
-///
-/// Declared here rather than returned as the engine's own summary type,
-/// because this is a wire shape the frontend reads: a body owned by a foreign
-/// crate is one an upstream field rename can reshape without anything in this
-/// repository failing to compile. Every key and JSON type is what that summary
-/// serialised and must stay that way —
-/// `the_response_body_serialises_exactly_as_the_engine_summary` is the pin, and
-/// it is what the chat and document arms' move onto the driver contract had to
-/// keep true. Those two build this body from an `IngestOutcome` now, mail still
-/// from the pipeline's summary, and both spell the same six keys.
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct IngestResponse {
- /// Logical source id the ingest was scoped to — the one the caller
- /// supplied, echoed back so a batched caller can pair a reply with its
- /// request.
- pub source_id: String,
- /// Units persisted by this call.
- pub chunks_written: usize,
- /// Units produced and not admitted. Dropped units only: a call refused
- /// outright is [`Self::already_ingested`], not a drop of everything.
- pub chunks_dropped: usize,
- /// Ids of the units this call produced. A caller fetches a chunk back by
- /// these, so a write that names none is unusable even when the count is
- /// right.
- pub chunk_ids: Vec<String>,
- /// Follow-up extraction jobs this call scheduled. Read next to
- /// [`Self::chunks_written`] it answers whether the material just handed
- /// over will be picked up at all — rows can land with nothing scheduled to
- /// derive from them, and the write count alone reports that as success.
- pub extract_jobs_enqueued: usize,
- /// True when the call was a no-op because `(source_kind, source_id)` had
- /// been ingested before.
- ///
- /// Distinct from a zero-write result, and the distinction is the point:
- /// only a refusal is a reason to go and clear the source gate. The gate is
- /// keyed on the logical source rather than on the content, so re-sending
- /// *changed* material under a claimed `source_id` also writes nothing.
- pub already_ingested: bool,
-}
-
-/// Build the validation error returned when an ingest payload does not match
-/// the canonicaliser schema for its `source_kind`.
-///
-/// Kept as the single construction site so the wording cannot drift away from
-/// [`is_invalid_ingest_payload_message`], which the transport layer uses to
-/// pick the Sentry severity. Same emit-site/classifier pairing as
-/// `dispatch::UNKNOWN_METHOD_PREFIX` / `dispatch::unknown_method_name`.
-fn invalid_payload_message(source_kind: SourceKind, err: &serde_json::Error) -> String {
- format!("invalid {} payload: {err}", source_kind.as_str())
-}
+// The canonical payload shapes (and `invalid_payload_message`) live in
+// `canonicalize_types.rs`, split for the file-layout gate; re-exported here so
+// every existing path keeps resolving.
+pub use super::canonicalize_types::*;
/// Returns `true` when `message` is an ingest-payload schema-validation
/// failure produced by `invalid_payload_message`.
diff --git a/src/openhuman/memory/tree/tree/rpc_tests_part_02_tests.rs b/src/openhuman/memory/tree/tree/rpc_tests_part_02_tests.rs
index 8c84445ddd..280c698ad3 100644
--- a/src/openhuman/memory/tree/tree/rpc_tests_part_02_tests.rs
+++ b/src/openhuman/memory/tree/tree/rpc_tests_part_02_tests.rs
@@ -461,7 +461,7 @@ async fn pipeline_status_returns_idle_for_empty_store() {
// #002: the degraded flags are process-global; reset+serialise so a
// parallel test (factory None-path, extract transport-fail) can't leak
// a "degraded" signal into this fresh-workspace assertion.
- let _g = crate::openhuman::memory::tree::health::test_guard();
+ let _g = tinymemory_core::tree::health::test_guard();
let (_tmp, cfg) = test_config();
// An empty driver, bound explicitly. Without a binding installed this
// resolves the real one, which means loading the compiled module — and
@@ -512,7 +512,7 @@ async fn pipeline_status_renders_the_drivers_chunk_aggregates() {
// #002: reset+serialise the process-global degraded flags so this
// "running" assertion isn't flipped to "degraded" by a parallel test.
- let _g = crate::openhuman::memory::tree::health::test_guard();
+ let _g = tinymemory_core::tree::health::test_guard();
let (_tmp, cfg) = test_config();
let ingested_at = 1_800_000_000_000_i64;
diff --git a/src/openhuman/memory/tree_e2e_tests.rs b/src/openhuman/memory/tree_e2e_tests.rs
index db0f727e28..4550ba03d1 100644
--- a/src/openhuman/memory/tree_e2e_tests.rs
+++ b/src/openhuman/memory/tree_e2e_tests.rs
@@ -21,12 +21,12 @@ use crate::openhuman::config::Config;
// 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};
+use tinymemory_core::tree::score::embed::build_embedder_from_config;
fn test_config() -> (TempDir, Config) {
let tmp = TempDir::new().unwrap();
diff --git a/src/openhuman/tools/ops.rs b/src/openhuman/tools/ops.rs
index 5bb42d2b77..0c491ffc44 100644
--- a/src/openhuman/tools/ops.rs
+++ b/src/openhuman/tools/ops.rs
@@ -1435,21 +1435,16 @@ fn tool_group(name: &str) -> crate::core::all::DomainGroup {
/// wrong default is worse than no rule. Hence enumeration plus two narrow
/// prefix rules, backed by the drift guard.
///
-/// ## Honesty clause — two assignments still run ahead of the plumbing
-///
-/// `tool_stats` reads the legacy `Arc<dyn Memory>` plus
-/// `agent::learning::tool_tracker`, not `MemoryToolMemory`; `memory_diff` reads
-/// `memory::diff::ops`, not `MemoryDiff`. Filtering them on the driver's
-/// advertised set is nevertheless the correct M5 behaviour: §3.3 is a contract
-/// about what the *model is told exists*, and the later re-point onto
-/// `MemoryGuard` must not change the advertised surface. Assigning them `None`
-/// to dodge the mismatch would bake the wrong contract in.
-///
-/// `goals_*` was the third and is no longer: it was filesystem-backed through
-/// `tinycortex::memory::goals::store`, and openhuman#5560 routed it onto the
-/// guarded `MemoryGoals` family. The advertised capability did not have to
-/// change when the plumbing caught up, which is the property this clause was
-/// written to protect.
+/// ## Honesty clause — two assignments still run ahead of the plumbing:
+/// `tool_stats` reads the legacy `Arc<dyn Memory>` + `tool_tracker`, not
+/// `MemoryToolMemory`; `memory_diff` reads `memory::diff::ops`, not
+/// `MemoryDiff`. Filtering both on the driver's advertised set is still the
+/// correct M5 behaviour: §3.3 contracts what the *model is told exists*, so
+/// the later re-point onto `MemoryGuard` must not change the advertised
+/// surface, and `None` to dodge the mismatch would bake the wrong contract in.
+/// `goals_*` was the third until #5560 routed it onto the guarded
+/// `MemoryGoals` family — the advertised capability did not change when
+/// the plumbing caught up: the exact property this clause protects.
fn tool_capability(name: &str) -> Option<tinymemory_api::capabilities::Capability> {
use tinymemory_api::capabilities::Capability;
diff --git a/tests/memory_graph_sync_e2e.rs b/tests/memory_graph_sync_e2e.rs
index d77d785b0c..a303fda213 100644
--- a/tests/memory_graph_sync_e2e.rs
+++ b/tests/memory_graph_sync_e2e.rs
@@ -15,10 +15,13 @@ use serde_json::json;
use tempfile::tempdir;
use openhuman_core::openhuman::inference::embeddings::NoopEmbedding;
-use openhuman_core::openhuman::memory::{
- MemoryIngestionConfig, MemoryIngestionRequest, NamespaceDocumentInput,
-};
-// Engine handles named on the crate — see the note in `personality_e2e.rs`.
+use openhuman_core::openhuman::memory::NamespaceDocumentInput;
+// Engine handles and the engine's own ingest request/config named on the
+// crates that define them — `memory::MemoryIngestion{Request,Config}` are the
+// host's WIRE shapes now (`rpc_models`), a different type from what
+// `UnifiedMemory::ingest_document` takes (#5560). See the note in
+// `personality_e2e.rs`.
+use tinycortex::memory::ingest::{MemoryIngestionConfig, MemoryIngestionRequest};
use tinymemory_core::store::{MemoryClient, UnifiedMemory};
/// Test config for the heuristic-only pipeline.
diff --git a/tests/memory_sync_pipeline_e2e.rs b/tests/memory_sync_pipeline_e2e.rs
index 7d2ad7b965..ffdb90315a 100644
--- a/tests/memory_sync_pipeline_e2e.rs
+++ b/tests/memory_sync_pipeline_e2e.rs
@@ -47,7 +47,6 @@ use openhuman_core::openhuman::config::Config;
// carries only `derive_scopes`; `sync_source` stayed upstream because nothing in
// `src/` calls it any more (#5560).
use openhuman_core::openhuman::memory::sources::types::{MemorySourceEntry, SourceKind};
-use openhuman_core::openhuman::memory::tree::ingest::{ingest_summary, SummaryIngestInput};
use tinymemory_core::sources::sync::sync_source;
use tinymemory_core::store::content::raw::{raw_kind_dir, raw_source_dir, RawKind};
use tinymemory_core::store::trees::store as tree_store;
@@ -55,6 +54,7 @@ use tinymemory_core::store::trees::types::SUMMARY_FANOUT;
use tinymemory_core::tinycortex::read_audit_log;
use tinymemory_core::tinycortex::run_github_sync;
use tinymemory_core::tinycortex::{needs_rebuild, rebuild_tree_from_raw};
+use tinymemory_core::tree::ingest::{ingest_summary, SummaryIngestInput};
use tinymemory_core::tree_source::get_or_create_source_tree;
// ── Shared harness ────────────────────────────────────────────────────────
diff --git a/tests/raw_coverage/memory_core_threads_raw_coverage_e2e.rs b/tests/raw_coverage/memory_core_threads_raw_coverage_e2e.rs
index 49c794dd55..21cb28f1a4 100644
--- a/tests/raw_coverage/memory_core_threads_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_core_threads_raw_coverage_e2e.rs
@@ -17,11 +17,6 @@ use openhuman_core::openhuman::memory::conversations::{
ensure_thread, list_threads, CreateConversationThread,
};
use openhuman_core::openhuman::memory::read_rpc::{self, ChunkFilter, GraphMode};
-use openhuman_core::openhuman::memory::tree::score::embed::pack_embedding;
-use openhuman_core::openhuman::memory::tree::score::extract::EntityKind;
-use openhuman_core::openhuman::memory::tree::score::resolver::CanonicalEntity;
-use openhuman_core::openhuman::memory::tree::score::signals::ScoreSignals;
-use openhuman_core::openhuman::memory::tree::score::store::{index_entity, upsert_score, ScoreRow};
use openhuman_core::openhuman::memory::{
AppendConversationMessageRequest, ConversationMessageRecord, ConversationMessagesRequest,
CreateConversationThreadRequest, DeleteConversationThreadRequest, EmptyRequest,
@@ -41,6 +36,11 @@ use tinymemory_core::store::chunks::types::{
use tinymemory_core::store::content;
use tinymemory_core::store::trees::store as tree_store;
use tinymemory_core::store::trees::types::{SummaryNode, TreeKind};
+use tinymemory_core::tree::score::embed::pack_embedding;
+use tinymemory_core::tree::score::extract::EntityKind;
+use tinymemory_core::tree::score::resolver::CanonicalEntity;
+use tinymemory_core::tree::score::signals::ScoreSignals;
+use tinymemory_core::tree::score::store::{index_entity, upsert_score, ScoreRow};
use tinymemory_core::tree_source::get_or_create_source_tree;
struct EnvGuard {
diff --git a/tests/raw_coverage/memory_raw_coverage_e2e.rs b/tests/raw_coverage/memory_raw_coverage_e2e.rs
index 5038b1daa1..638a5368fc 100644
--- a/tests/raw_coverage/memory_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_raw_coverage_e2e.rs
@@ -9,9 +9,11 @@ use serde_json::json;
use tempfile::TempDir;
use openhuman_core::openhuman::config::Config;
-use openhuman_core::openhuman::memory::{
- ExtractionMode, MemoryIngestionConfig, MemoryIngestionRequest, NamespaceDocumentInput,
-};
+use openhuman_core::openhuman::memory::NamespaceDocumentInput;
+// The engine's own ingest request/config — what `UnifiedMemory::ingest_document`
+// takes. `memory::MemoryIngestion*` are the host's WIRE shapes now
+// (`rpc_models`), distinct types (#5560).
+use tinycortex::memory::ingest::{ExtractionMode, MemoryIngestionConfig, MemoryIngestionRequest};
// The in-process ingest queue is the engine's and has no bus representation, so
// `memory::mod` stopped re-exporting it for a consumer that was only ever this
// test (#5560). Named on the crate directly, exactly as `upsert_chunks` below
@@ -43,7 +45,7 @@ use openhuman_core::openhuman::integrations::composio::providers::{
classify_unknown, find_curated, toolkit_from_slug, CuratedTool, ToolScope,
};
use tinycortex::memory::sync::{SyncOutcome, SyncPipelineKind};
-use openhuman_core::openhuman::memory::tree::summarise::{
+use tinymemory_core::tree::summarise::{
fallback_summary, SummaryContext, SummaryInput,
};
use openhuman_core::openhuman::memory::tree::tree_runtime::store as tree_store;
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 e5f9b88697..fe59dd0f63 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,9 +68,6 @@ use openhuman_core::openhuman::integrations::composio::periodic::record_sync_suc
use openhuman_core::openhuman::memory::sync::composio::providers::slack::rpc::{
sync_status_rpc, SyncStatusRequest,
};
-// 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::{
AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME,
};
@@ -81,6 +78,9 @@ 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;
+// Engine-direct for the same reason as the other retrieval e2e suites (#5560).
+use tinymemory_core::tree::tree::store as tree_store;
+use tinymemory_core::tree::tree::TreeStatus;
static ENV_LOCK: &OnceLock<Mutex<()>> = &crate::SHARED_ENV_LOCK;
static MEMORY_SEAMS_INIT: OnceLock<()> = OnceLock::new();
diff --git a/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs b/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs
index 6f13e08b9d..75fb9809b5 100644
--- a/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs
@@ -112,24 +112,24 @@ 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::{
+use tinymemory_core::tree::score::embed;
+use tinymemory_core::tree::score::embed::Embedder;
+use tinymemory_core::tree::score::extract::{
CompositeExtractor, EntityExtractor, EntityKind, ExtractedEntities, ExtractedEntity,
ExtractedTopic,
};
-use openhuman_core::openhuman::memory::tree::score::resolver::CanonicalEntity;
-use openhuman_core::openhuman::memory::tree::score::signals::{
+use tinymemory_core::tree::score::resolver::CanonicalEntity;
+use tinymemory_core::tree::score::signals::{
combine, combine_cheap_only, compute as compute_score_signals, entity_density_score,
interaction, metadata_weight, source_weight, token_count, unique_words, ScoreSignals,
SignalWeights,
};
-use openhuman_core::openhuman::memory::tree::score::store as score_store;
-use openhuman_core::openhuman::memory::tree::score::{resolver, ScoringConfig};
-use openhuman_core::openhuman::memory::tree::summarise::{
+use tinymemory_core::tree::score::store as score_store;
+use tinymemory_core::tree::score::{resolver, ScoringConfig};
+use tinymemory_core::tree::summarise::{
fallback_summary, SummaryContext, SummaryInput,
};
-use openhuman_core::openhuman::memory::tree::tree::bucket_seal::LeafRef;
+use tinymemory_core::tree::tree::bucket_seal::LeafRef;
use openhuman_core::openhuman::memory::tree::tree_runtime::store as tree_runtime_store;
use openhuman_core::openhuman::memory::tree::tree_runtime::{
all_tree_summarizer_controller_schemas, all_tree_summarizer_registered_controllers,
@@ -138,15 +138,21 @@ use openhuman_core::openhuman::memory::tree::tree_runtime::{
};
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.
+// re-exporting it in #5560. The `tree::score` / `tree::summarise` /
+// `tree::tree` imports above went engine-direct the same way once their host
+// re-export shims stopped serving production (#5560).
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,
};
+// The engine's own ingest request/config — what `UnifiedMemory::
+// ingest_document` and `extract_graph` take. `memory::MemoryIngestion*` are
+// the host's WIRE shapes now (`rpc_models`), distinct types (#5560).
+use tinycortex::memory::ingest::{MemoryIngestionConfig, MemoryIngestionRequest};
use tinymemory_core::tree::retrieval;
use tinymemory_core::tree_policy::TreePolicy;
use tinymemory_core::tree_source;
@@ -679,7 +685,7 @@ Kitchen is north of Garden.
taint: openhuman_core::openhuman::memory::MemoryTaint::Internal,
},
&MemoryIngestionConfig {
- extraction_mode: openhuman_core::openhuman::memory::ExtractionMode::Chunk,
+ extraction_mode: tinycortex::memory::ingest::ExtractionMode::Chunk,
..Default::default()
},
)
@@ -1462,7 +1468,7 @@ fn memory_tree_scoring_signal_helpers_cover_boundaries_and_serialization() {
assert!(!EntityKind::Person.is_mechanical());
assert!(EntityKind::parse("unknown").is_err());
- let regex_entities = openhuman_core::openhuman::memory::tree::score::extract::regex::extract(
+ let regex_entities = tinymemory_core::tree::score::extract::regex::extract(
"Alice emailed [email protected] from https://example.test and mentioned #coverage.",
);
assert!(regex_entities
@@ -1748,12 +1754,12 @@ fn memory_tree_runtime_store_buffers_and_retrieval_wire_helpers() {
0
);
- let source_factory = openhuman_core::openhuman::memory::tree::tree::TreeFactory::source(
+ let source_factory = tinymemory_core::tree::tree::TreeFactory::source(
);
assert_eq!(
source_factory.profile(),
- openhuman_core::openhuman::memory::tree::tree::TreeProfile::Source
+ tinymemory_core::tree::tree::TreeProfile::Source
);
assert_eq!(
source_factory.scope_slug(),
@@ -1763,10 +1769,10 @@ fn memory_tree_runtime_store_buffers_and_retrieval_wire_helpers() {
.get_or_create(&config)
.expect("source tree from factory");
assert_eq!(
- openhuman_core::openhuman::memory::tree::tree::TreeFactory::from_tree(&source_tree).kind(),
+ tinymemory_core::tree::tree::TreeFactory::from_tree(&source_tree).kind(),
TreeKind::Source
);
- let topic_factory = openhuman_core::openhuman::memory::tree::tree::TreeFactory::topic(
+ let topic_factory = tinymemory_core::tree::tree::TreeFactory::topic(
);
assert!(matches!(
@@ -1778,12 +1784,12 @@ fn memory_tree_runtime_store_buffers_and_retrieval_wire_helpers() {
.expect("topic tree from factory");
assert_ne!(source_tree.id, topic_tree.id);
assert!(
- openhuman_core::openhuman::memory::tree::tree::new_tree_id(TreeKind::Global)
+ tinymemory_core::tree::tree::new_tree_id(TreeKind::Global)
.starts_with("global:")
);
- assert!(openhuman_core::openhuman::memory::tree::tree::new_summary_id(2).contains(":L2-"));
+ assert!(tinymemory_core::tree::tree::new_summary_id(2).contains(":L2-"));
assert!(
- openhuman_core::openhuman::memory::tree::tree::registry::is_unique_violation(
+ tinymemory_core::tree::tree::registry::is_unique_violation(
&anyhow::anyhow!("UNIQUE constraint failed: mem_trees.kind, mem_trees.scope")
)
);
@@ -1791,7 +1797,7 @@ fn memory_tree_runtime_store_buffers_and_retrieval_wire_helpers() {
.archive(&config)
.expect("archive source tree");
assert_eq!(
- openhuman_core::openhuman::memory::tree::tree::store::get_tree_by_scope(
+ tinymemory_core::tree::tree::store::get_tree_by_scope(
&config,
TreeKind::Source,
@@ -2007,13 +2013,13 @@ async fn memory_read_rpc_score_index_and_summary_helpers_cover_dashboard_paths()
ask: None,
};
let empty =
- openhuman_core::openhuman::memory::tree::summarise::summarise(&config, &[], &empty_ctx)
+ tinymemory_core::tree::summarise::summarise(&config, &[], &empty_ctx)
.await
.expect("empty summarise avoids provider");
assert_eq!(empty.token_count, 0);
let embedder =
- openhuman_core::openhuman::memory::tree::score::embed::factory::build_embedder_from_config(
+ tinymemory_core::tree::score::embed::factory::build_embedder_from_config(
&config,
)
.expect("inert embedder");
@@ -2761,7 +2767,7 @@ async fn memory_source_sync_entrypoint_rejects_disabled_and_ingests_folder_items
#[test]
fn memory_tree_io_contract_types_round_trip_leaf_read_and_write_shapes() {
let now = Utc.with_ymd_and_hms(2026, 5, 29, 16, 0, 0).unwrap();
- let payload = openhuman_core::openhuman::memory::tree::TreeLeafPayload {
+ let payload = tinycortex::memory::tree::TreeLeafPayload {
chunk_id: "chunk-contract-1".into(),
token_count: 42,
timestamp: now,
@@ -2774,12 +2780,12 @@ fn memory_tree_io_contract_types_round_trip_leaf_read_and_write_shapes() {
assert_eq!(leaf_ref.chunk_id, payload.chunk_id);
assert_eq!(leaf_ref.entities, payload.entities);
let round_trip =
- openhuman_core::openhuman::memory::tree::TreeLeafPayload::from(leaf_ref.clone());
+ tinycortex::memory::tree::TreeLeafPayload::from(leaf_ref.clone());
assert_eq!(round_trip.content, payload.content);
assert_eq!(round_trip.score, payload.score);
let write_default_json =
- serde_json::to_value(openhuman_core::openhuman::memory::tree::TreeWriteRequest {
+ serde_json::to_value(tinycortex::memory::tree::TreeWriteRequest {
tree_id: "tree-contract".into(),
tree_kind: TreeKind::Source,
leaf: round_trip.clone(),
@@ -2790,7 +2796,7 @@ fn memory_tree_io_contract_types_round_trip_leaf_read_and_write_shapes() {
assert_eq!(write_default_json["label_strategy"], "inherit");
assert_eq!(write_default_json["deferred"], false);
- let decoded_write: openhuman_core::openhuman::memory::tree::TreeWriteRequest =
+ let decoded_write: tinycortex::memory::tree::TreeWriteRequest =
serde_json::from_value(json!({
"tree_id": "tree-contract",
"tree_kind": "global",
@@ -2807,12 +2813,12 @@ fn memory_tree_io_contract_types_round_trip_leaf_read_and_write_shapes() {
assert_eq!(decoded_write.tree_kind, TreeKind::Global);
assert_eq!(
decoded_write.label_strategy,
- openhuman_core::openhuman::memory::tree::TreeLabelStrategy::Empty
+ tinycortex::memory::tree::TreeLabelStrategy::Empty
);
assert!(decoded_write.leaf.entities.is_empty());
assert!(decoded_write.deferred);
- let outcome = openhuman_core::openhuman::memory::tree::TreeWriteOutcome {
+ let outcome = tinycortex::memory::tree::TreeWriteOutcome {
new_summary_ids: vec!["summary-1".into()],
seal_pending: true,
};
@@ -2820,7 +2826,7 @@ fn memory_tree_io_contract_types_round_trip_leaf_read_and_write_shapes() {
assert_eq!(outcome_json["new_summary_ids"][0], "summary-1");
assert_eq!(outcome_json["seal_pending"], true);
- let read_request: openhuman_core::openhuman::memory::tree::TreeReadRequest =
+ let read_request: tinycortex::memory::tree::TreeReadRequest =
serde_json::from_value(json!({
"tree_id": "tree-contract",
"max_depth": 2,
@@ -2832,14 +2838,14 @@ fn memory_tree_io_contract_types_round_trip_leaf_read_and_write_shapes() {
assert_eq!(read_request.max_depth, 2);
assert_eq!(read_request.limit, Some(3));
- let hit = openhuman_core::openhuman::memory::tree::TreeReadHit {
+ let hit = tinycortex::memory::tree::TreeReadHit {
node_id: "summary-1".into(),
node_kind: "summary".into(),
level: 1,
content: "Summary text".into(),
score: 0.42,
};
- let result = openhuman_core::openhuman::memory::tree::TreeReadResult {
+ let result = tinycortex::memory::tree::TreeReadResult {
hits: vec![hit],
total: 4,
tree_id: "tree-contract".into(),
@@ -2859,7 +2865,7 @@ fn memory_tree_io_contract_types_round_trip_leaf_read_and_write_shapes() {
created_at: now,
last_sealed_at: None,
};
- let empty = openhuman_core::openhuman::memory::tree::TreeReadResult::empty(&tree);
+ let empty = tinycortex::memory::tree::TreeReadResult::empty(&tree);
assert_eq!(empty.tree_id, "empty-tree");
assert!(empty.hits.is_empty());
}
@@ -4486,18 +4492,18 @@ async fn memory_query_backend_and_tree_flush_wrappers_cover_public_edges() {
assert!(leaves.is_empty());
let no_stale =
- openhuman_core::openhuman::memory::tree::tree::flush::flush_stale_buffers_default(
+ tinymemory_core::tree::tree::flush::flush_stale_buffers_default(
&config,
- &openhuman_core::openhuman::memory::tree::tree::LabelStrategy::Empty,
+ &tinymemory_core::tree::tree::LabelStrategy::Empty,
)
.await
.expect("flush empty buffers");
assert_eq!(no_stale, 0);
- let missing_flush = openhuman_core::openhuman::memory::tree::tree::flush::force_flush_tree(
+ let missing_flush = tinymemory_core::tree::tree::flush::force_flush_tree(
&config,
"tree:missing",
None,
- &openhuman_core::openhuman::memory::tree::tree::LabelStrategy::Empty,
+ &tinymemory_core::tree::tree::LabelStrategy::Empty,
)
.await
.unwrap_err();
diff --git a/tests/raw_coverage/memory_tree_embed_round25_raw_coverage_e2e.rs b/tests/raw_coverage/memory_tree_embed_round25_raw_coverage_e2e.rs
index 829875302c..2933015b4b 100644
--- a/tests/raw_coverage/memory_tree_embed_round25_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_tree_embed_round25_raw_coverage_e2e.rs
@@ -2,7 +2,7 @@ use axum::extract::Json;
use axum::http::StatusCode;
use axum::routing::post;
use axum::Router;
-use openhuman_core::openhuman::memory::tree::score::embed::EMBEDDING_DIM;
+use tinymemory_core::tree::score::embed::EMBEDDING_DIM;
use tinyinference::embeddings::{
EmbeddingModel, OllamaEmbeddingModel, RECOMMENDED_OLLAMA_CONTEXT_TOKENS,
};
diff --git a/tests/raw_coverage/memory_tree_memory_round23_raw_coverage_e2e.rs b/tests/raw_coverage/memory_tree_memory_round23_raw_coverage_e2e.rs
index 4fef082e74..5600580159 100644
--- a/tests/raw_coverage/memory_tree_memory_round23_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_tree_memory_round23_raw_coverage_e2e.rs
@@ -14,9 +14,10 @@ use tempfile::TempDir;
use openhuman_core::openhuman::config::Config;
use openhuman_core::openhuman::inference::embeddings::NoopEmbedding;
-use openhuman_core::openhuman::memory::{
- ExtractionMode, MemoryIngestionConfig, MemoryIngestionRequest,
-};
+// The engine's own ingest request/config — what `UnifiedMemory::ingest_document`
+// takes. `memory::MemoryIngestion*` are the host's WIRE shapes now
+// (`rpc_models`), distinct types (#5560).
+use tinycortex::memory::ingest::{ExtractionMode, MemoryIngestionConfig, MemoryIngestionRequest};
use tinymemory_core::store::{NamespaceDocumentInput, UnifiedMemory};
use openhuman_core::openhuman::memory::tree::tree_runtime::{
all_tree_summarizer_registered_controllers, engine, rpc as tree_runtime_rpc,
diff --git a/tests/raw_coverage/memory_tree_sync_deep_raw_coverage_e2e.rs b/tests/raw_coverage/memory_tree_sync_deep_raw_coverage_e2e.rs
index a42576d7fe..23c9bf53a8 100644
--- a/tests/raw_coverage/memory_tree_sync_deep_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_tree_sync_deep_raw_coverage_e2e.rs
@@ -18,23 +18,23 @@ use serde_json::json;
use tempfile::TempDir;
use openhuman_core::openhuman::config::{Config, SchedulerGateMode};
-use openhuman_core::openhuman::memory::tree::score::embed::EMBEDDING_DIM;
-use openhuman_core::openhuman::memory::tree::score::extract::{
- EntityExtractor, EntityKind, ExtractedEntities, LlmEntityExtractor, LlmExtractorConfig,
-};
-use openhuman_core::openhuman::memory::tree::score::resolver::{canonicalise, CanonicalEntity};
-use openhuman_core::openhuman::memory::tree::score::store::{index_entity, lookup_entity};
use openhuman_core::openhuman::memory::tree::tree::rpc::{
get_chunk_rpc, ingest_rpc, list_chunks_rpc, set_enabled_rpc, GetChunkRequest, IngestRequest,
ListChunksRequest, SetEnabledRequest,
};
-use openhuman_core::openhuman::memory::tree::tree::set_summary_embedding;
-use openhuman_core::openhuman::memory::tree::tree::store as tree_store;
-use openhuman_core::openhuman::memory::tree::tree::TreeStatus;
use tinymemory_core::chat::{ChatPrompt, ChatProvider};
use tinymemory_core::store::chunks::store::{set_chunk_embedding, upsert_chunks, with_connection};
use tinymemory_core::store::chunks::types::{chunk_id, Chunk, Metadata, SourceKind, SourceRef};
use tinymemory_core::store::trees::types::{SummaryNode, Tree, TreeKind};
+use tinymemory_core::tree::score::embed::EMBEDDING_DIM;
+use tinymemory_core::tree::score::extract::{
+ EntityExtractor, EntityKind, ExtractedEntities, LlmEntityExtractor, LlmExtractorConfig,
+};
+use tinymemory_core::tree::score::resolver::{canonicalise, CanonicalEntity};
+use tinymemory_core::tree::score::store::{index_entity, lookup_entity};
+use tinymemory_core::tree::tree::set_summary_embedding;
+use tinymemory_core::tree::tree::store as tree_store;
+use tinymemory_core::tree::tree::TreeStatus;
struct EnvVarGuard {
key: &'static str,
diff --git a/tests/raw_coverage/memory_tree_sync_raw_coverage_e2e.rs b/tests/raw_coverage/memory_tree_sync_raw_coverage_e2e.rs
index 5ee823a995..e861d58e3c 100644
--- a/tests/raw_coverage/memory_tree_sync_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_tree_sync_raw_coverage_e2e.rs
@@ -38,10 +38,10 @@ use openhuman_core::openhuman::integrations::composio::providers::{
agent_ready_toolkits, catalog_for_toolkit, classify_unknown, find_curated, has_native_provider,
is_action_visible_with_pref, toolkit_from_slug, toolkit_has_scope, ToolScope, UserScopePref,
};
-use openhuman_core::openhuman::memory::tree::score::extract::{EntityKind, ExtractedEntities};
-use openhuman_core::openhuman::memory::tree::score::resolver::canonicalise;
-use openhuman_core::openhuman::memory::tree::tree::bucket_seal::append_leaf;
-use openhuman_core::openhuman::memory::tree::tree::{
+use tinymemory_core::tree::score::extract::{EntityKind, ExtractedEntities};
+use tinymemory_core::tree::score::resolver::canonicalise;
+use tinymemory_core::tree::tree::bucket_seal::append_leaf;
+use tinymemory_core::tree::tree::{
append_leaf_deferred, get_or_create_tree, store as tree_store, LabelStrategy, LeafRef,
};
use openhuman_core::openhuman::memory::tree::tree_runtime::{
@@ -446,14 +446,14 @@ async fn composio_providers_sync_state_and_bus_surfaces_cover_read_write_edges()
async fn memory_tree_entity_canonicalisation_covers_email_and_person_kinds() {
let extracted = ExtractedEntities {
entities: vec![
- openhuman_core::openhuman::memory::tree::score::extract::ExtractedEntity {
+ tinymemory_core::tree::score::extract::ExtractedEntity {
kind: EntityKind::Email,
text: "[email protected]".into(),
span_start: 0,
span_end: 19,
score: 0.9,
},
- openhuman_core::openhuman::memory::tree::score::extract::ExtractedEntity {
+ tinymemory_core::tree::score::extract::ExtractedEntity {
kind: EntityKind::Person,
text: "Round Fourteen".into(),
span_start: 20,