Skip to content

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

Merge remote-tracking branch 'origin/main' into memory-bus-only

Steven Enamakel9b122aa42c59
diff --cc src/openhuman/memory/direct_engine_refs_tests.rs
index 99e9dd4c2a,2a8fe68b3f..720c493ff4
--- a/src/openhuman/memory/direct_engine_refs_tests.rs
+++ b/src/openhuman/memory/direct_engine_refs_tests.rs
@@@ -52,64 -52,99 +52,139 @@@
//!
//! ## The concrete gaps, for whoever picks the upstream work up
//!
-//! The seam's tree family is `query_source(namespace, source_id, limit, scope)
-//! -> Vec<Chunk>`, `drill_down(namespace, node_id) -> QueryResult`, `append`,
-//! `seal`, `cascade`. What the host actually calls is richer in four ways, and
-//! each is a distinct upstream ask:
+//! **This list was drained on 2026-08-23 and the shape of the problem changed.**
+//! It used to enumerate four things the seam could not express — retrieval
+//! filters, chunk reads, an entity-kind filter, and source listing — plus the
+//! people domain and the `source_scope` task-local. Every one of those now has
+//! a home:
//!
-//! 1. **Retrieval takes filters the seam has no room for** — a time window, a
-//! free-text query, a `SourceKind`, a depth and a limit
-//! (`query::backend`, `query::cover_window`, `query::fast_walk`).
-//! 2. **Chunk reads have no family at all.** `store::chunks::store::{get_chunk,
-//! list_chunks}` with a nine-field `ListChunksQuery` backs three agent tools
-//! (`memory_chunk_context`, `raw_chunks`, `vector_search`); the seam's only
-//! chunk door is `query_source`, keyed on a single source id.
-//! 3. **Entity search has no kind filter.** `MemoryEntities::entities` takes
-//! `(namespace, query, limit)`; `memory_tree_search_entities` additionally
-//! filters on `Vec<EntityKind>`.
-//! 4. **Sources cannot be listed.** `MemorySourceSink` is
-//! `accept_source_items` + `forget_source`; `memory_diff` needs
-//! `sources::{get_source, list_sources}`.
+//! - **Retrieval filters, chunk reads, entity-kind search** — `MemoryRetrieval`
+//! (`fast_retrieve`, `cover_window`, `retrieve_source`, `retrieve_children`,
+//! `retrieve_leaves`, `recall_namespace_scored`, `search_entities`) and
+//! `MemoryChunks` (`list_chunks`, `get_chunk`, `chunk_detail`,
+//! `storage_kinds`, `chunk_embeddings`).
+//! - **The people domain** — `MemoryPeople`, seven methods.
+//! - **Profile/facets** — `MemoryProfile`, eleven methods, which
+//! `memory::guard`'s docs separately described as a missing "fourteenth
+//! family".
+//! - **`source_scope`** — not a seam gap at all. It is host policy; it lives in
+//! `memory::source_scope`, and the scope crosses the bus as a `SourceScope`
+//! value on every scoped method.
//!
-//! Two more sit outside the tree families entirely: the `people` domain has no
-//! capability family (`PeopleStore`, `Handle`, `PersonId`), and
-//! `source_scope::{current_source_scope, chunk_source_allowed}` is a
-//! task-local the host sets and the engine reads — it is host policy that
-//! happens to live in the engine crate, and it should probably move to
-//! `tinymemory-api` rather than gain a bus method.
+//! `ModuleMemoryProvider` implements all of these bar `as_episodic`, and
+//! `MemoryGuard` wraps all fifteen families.
+//!
+//! **So what blocks the migration is release lag, not seam width.**
+//! `modules::registry` pins a SHA-256-verified artifact, and the five families
+//! above shipped in no release until v1.2.0. Before migrating a call site onto
+//! one, check the *tag* rather than the vendored source — the submodule is
+//! routinely ahead of what is pinned. A method the pinned artifact does not
+//! serve answers `Unsupported` at run time, which is strictly worse than the
+//! direct call it replaced.
+//!
+//! What genuinely has no bus representation yet, and is the next upstream ask:
+//! the ingest `queue`, the `chat` runtime seam, the composio sync pipelines,
+//! and **recency recall**. The first three live inside `tinymemory-core` and
+//! would each need a design pass, not just a trait method.
+//!
+//! Recency recall is the subtle one, and it is worth spelling out because the
+//! obvious migration is wrong. `MemoryRetrieval::recall_namespace_scored` looks
+//! like the twin for `memory.recall_context` and `memory.recall_memories`, and
+//! it is not:
+//!
+//! - `recall_namespace_scored` resolves to
+//! `query_namespace_hits_excluding_session(ns, query, limit, exclude)` — the
+//! **query-ranked** path.
+//! - Both handlers call `recall_namespace_memories(ns, limit)` — a distinct
+//! **recency** path. `recall_namespace_context_data` is just that plus a
+//! rendered `context_text` wrapper.
+//!
+//! Passing an empty query to the scored method does not degrade to recency; it
+//! runs the ranking path with nothing to rank against. The two share a prefix
+//! (`load_documents_for_scope` + `kv_records_for_scope`) and diverge after it,
+//! so the swap compiles, returns plausible hits, and quietly changes what the
+//! user gets back. `memory.query_namespace` *is* safely expressible, because it
+//! has a real query — pass `exclude_session_id: None` there to preserve the
+//! current no-exclusion behaviour, since an RPC handler is not an agent turn.
+//!
+//! The upstream ask is a `RecallNamespaceRecent`-shaped method on
+//! `MemoryRetrieval`.
//!
+ //! ## What the 2026-08-22 audit added to that list
+ //!
+ //! Draining `FacadeRevealed` turned 82 unexamined files into evidence, and it
+ //! widened the ask rather than narrowing it. Grouped by what blocks them, so
+ //! the upstream work can be sized per gap instead of per file:
+ //!
+ //! - **The engine handle itself** (~28 files) — `global::{init, client,
+ //! client_if_ready}`, `store::{UnifiedMemory, MemoryClient, MemoryClientRef}`
+ //! and `store::factories::create_memory`. These construct or hold the
+ //! in-process engine. Nothing routes here: the seam has no door onto a live
+ //! client, and it should not grow one — this is `memory::binding`'s job, and
+ //! the ask is that every caller take the binding's provider instead.
+ //! - **Chunk writes and transactions** (~21 files) —
+ //! `store::chunks::store::{with_connection, upsert_chunks,
+ //! upsert_staged_chunks_tx, get_or_init_connection}`, plus `store::{fts5,
+ //! segments, profile, events, content}`. `MemoryChunks` is a read family;
+ //! this is the write half, and `with_connection` hands out a SQLite handle,
+ //! which no engine-neutral contract can promise. **Moving these subsystems
+ //! behind the bus is the only shape that keeps a supermemory/mem0/cognee
+ //! driver implementable** — a contract with `with_connection` in it is a
+ //! SQLite contract wearing a trait.
+ //! - **Host policy reached through the engine crate** (~14 files) —
+ //! `store::safety::{sanitize_text, sanitize_json, has_likely_secret}`,
+ //! `util::redact::redact`, `source_scope::*`. This looked like the cheapest
+ //! item on the list and mostly is not, which is worth stating so the next
+ //! person does not re-derive it: `store::safety` is a **shim over
+ //! `crate::engine::backend::store::safety`**, so those scrubbers live in
+ //! tinycortex and relocating them is engine work rather than a contract
+ //! move. `source_scope` is a `tokio::task_local`, so hosting it in
+ //! `tinymemory-api` means adding tokio to a crate whose whole point is that
+ //! a caller can depend on it and compile almost nothing. Only
+ //! `util::redact` (136 lines over `sha2`) is the clean case, and it costs
+ //! `sha2` in the contract crate.
+ //! - **The re-embed queue** (~8 files) — `queue::{start, store, types,
+ //! ensure_reembed_backfill, requeue_failed_after_provider_change,
+ //! drain_until_idle, wake_workers, backfill_in_progress}`. No family.
+ //! - **Engine-shaped integration internals** (~11 files) —
+ //! `tinycortex::{memory_config_from, run_composio_connection,
+ //! load_composio_sync_state, HostSyncAdapter, CodingSession*}`. Named after
+ //! the engine, so no engine-neutral family can express them as they stand.
-//! - **Engine-owned types** — `store::trees::types::TreeKind`,
-//! `store::chunks::types::SourceKind`, `store::{NamespaceDocumentInput,
-//! NamespaceRetrievalContext, GraphRelationRecord}`. A type import links the
++//! - **Engine-owned types** — `store::trees::types::TreeKind`, and
++//! `store::{NamespaceDocumentInput, NamespaceRetrievalContext,
++//! GraphRelationRecord}` (`store::chunks::types::SourceKind`/`SourceRef`
++//! were on this list and are **done** — see below). A type import links the
+ //! crate exactly as a call does, so the shed needs these in
+ //! `tinymemory-api`. `MemoryCategory`/`MemoryEntry`/`MemoryTaint` already
+ //! are — `tinymemory_core::traits` re-exports them — so those call sites can
+ //! name the contract today.
+ //!
+ //! `rpc_models` was on this list and is **done**: all forty-five types were
+ //! named by this host and by nothing inside `tinymemory`, so they moved to
+ //! `memory::rpc_models` rather than into the contract. That is the shape to
+ //! look for first in what remains — a type the engine crate defines but only
+ //! the host uses does not need a contract to live in, it needs to come home.
-//! `SourceKind` is emphatically **not** such a case (see the trap below).
++//! `SourceKind`/`SourceRef` were called out here as emphatically **not**
++//! such a case, on the grounds that the engine path resolved to a
++//! `tinycortex-api` type distinct from the contract's. That is no longer
++//! true: `tinycortex-api` is a deprecated re-export of `tinymemory-bus` and
++//! the two paths resolve to the **same item**, verified by a compile-time
++//! identity probe and then by repointing every call site. Prefer
++//! `tinymemory_api::chunks::…` in new code. The general warning still holds
++//! for *other* near-identical pairs — probe before assuming, either way.
+ //! - **Chat, ingest pipeline and preferences** (~12 files) —
+ //! `chat::{ChatProvider, build_chat_provider, test_override}`,
+ //! `ingest_pipeline::{ingest_chat, ingest_document_with_scope}`,
+ //! `preferences::{STANDING_PREFS_LIMIT, load_general_preferences,
+ //! recall_situational_preferences}`.
+ //!
+ //! The order that follows from this: relocate the pure helpers and types to
+ //! `tinymemory-api` (no bus surface, no release coupling), then move the
+ //! queue and chunk-write subsystems behind the module, and only then can the
+ //! handle-holding callers take the binding's provider and the crate leave the
+ //! build. Nothing here is a host-side routing pass, which is what the original
+ //! scope assumed.
+ //!
//! # Known weaknesses, stated rather than hidden
//!
//! - **The lint sees text, not types.** A reference reached through a
@@@ -291,13 -340,18 +380,13 @@@ const ALLOWED: &[(&str, Verdict, &str)
),
(
"src/openhuman/agent/learning/startup.rs",
- Verdict::FacadeRevealed,
- "engine dependency predates this branch; the facade deletion made it visible",
+ Verdict::NeedsWiderSeam,
+ "holds or boots the in-process engine handle (global::client_if_ready, store::MemoryClient); driver construction belongs to memory::binding and the seam has no door onto the live client",
),
- (
- "src/openhuman/agent/task_dispatcher/executor.rs",
- Verdict::NeedsWiderSeam,
- "task-local host policy living in the engine crate (source_scope::with_source_scope); belongs in tinymemory-api, not a bus method",
- ),
(
"src/openhuman/agent/tinyagents/host/agent_memory.rs",
- Verdict::FacadeRevealed,
- "engine dependency predates this branch; the facade deletion made it visible",
+ Verdict::NeedsWiderSeam,
+ "holds or boots the in-process engine handle (store::factories::create_memory, store::safety::sanitize_text); driver construction belongs to memory::binding and the seam has no door onto the live client",
),
(
"src/openhuman/agent/tools/remember_preference.rs",
@@@ -331,13 -385,18 +420,13 @@@
),
(
"src/openhuman/config/ops/model.rs",
- Verdict::FacadeRevealed,
- "engine dependency predates this branch; the facade deletion made it visible",
+ Verdict::NeedsWiderSeam,
+ "the re-embed queue (queue::ensure_reembed_backfill, queue::requeue_failed_after_provider_change) has no capability family",
),
- (
- "src/openhuman/cron/scheduler.rs",
- Verdict::NeedsWiderSeam,
- "task-local host policy living in the engine crate (source_scope::with_source_scope); belongs in tinymemory-api, not a bus method",
- ),
(
"src/openhuman/desktop/app_state/ops.rs",
- Verdict::FacadeRevealed,
- "engine dependency predates this branch; the facade deletion made it visible",
+ Verdict::NeedsWiderSeam,
+ "holds or boots the in-process engine handle (global::init); driver construction belongs to memory::binding and the seam has no door onto the live client",
),
(
"src/openhuman/flows/memory_tools.rs",
@@@ -381,13 -440,18 +470,13 @@@
),
(
"src/openhuman/integrations/composio/schemas.rs",
- Verdict::FacadeRevealed,
- "engine dependency predates this branch; the facade deletion made it visible",
+ Verdict::NeedsWiderSeam,
+ "holds or boots the in-process engine handle (global::client_if_ready); driver construction belongs to memory::binding and the seam has no door onto the live client",
),
- (
- "src/openhuman/memory/guard/audit.rs",
- Verdict::NeedsWiderSeam,
- "pure host-policy helper genuinely owned by the engine crate (util::redact::redact — 136 lines over `sha2` alone); relocatable to tinymemory-api, at the cost of adding `sha2` there, unlike its `store::safety` neighbours which only shim the engine's own scrubbers",
- ),
(
"src/openhuman/memory/guard/policy.rs",
- Verdict::FacadeRevealed,
- "engine dependency predates this branch; the facade deletion made it visible",
+ Verdict::NeedsWiderSeam,
+ "task-local host policy living in the engine crate (source_scope::current_source_scope, store::safety::sanitize_json/sanitize_text); belongs in tinymemory-api, not a bus method",
),
(
"src/openhuman/memory/ops/documents.rs",
@@@ -526,14 -590,19 +615,9 @@@
),
(
"src/openhuman/security/credentials/ops.rs",
- Verdict::FacadeRevealed,
- "engine dependency predates this branch; the facade deletion made it visible",
- ),
- (
- "src/openhuman/tools/registry/ops.rs",
- Verdict::FacadeRevealed,
- "engine dependency predates this branch; the facade deletion made it visible",
+ Verdict::NeedsWiderSeam,
+ "two blockers: the re-embed queue (queue::ensure_reembed_backfill), which has no capability family; and the in-process engine handle (global::init), which belongs to memory::binding",
),
- (
- "src/openhuman/skills/runtime/run_machinery.rs",
- Verdict::NeedsWiderSeam,
- "task-local host policy living in the engine crate (source_scope::current_source_scope, source_scope::with_source_scope); belongs in tinymemory-api, not a bus method",
- ),
- (
- "src/openhuman/web_chat/run_task.rs",
- Verdict::NeedsWiderSeam,
- "task-local host policy living in the engine crate (source_scope::with_source_scope); belongs in tinymemory-api, not a bus method",
- ),
// ── Re-export shims: `pub use tinymemory_core::<domain>::*;` ────────────
//
// These are the historical-path aliases `memory/mod.rs` documents. They
diff --cc src/openhuman/memory/store_golden.rs
index e19af0b979,47e1d82788..fd001c265c
--- a/src/openhuman/memory/store_golden.rs
+++ b/src/openhuman/memory/store_golden.rs
@@@ -48,9 -48,9 +48,9 @@@ use crate::openhuman::memory::ops::
doc_list, doc_put, graph_query, graph_upsert, kv_get, memory_query_namespace, GraphQueryParams,
GraphUpsertParams, KvGetDeleteParams, KvSetParams, NamespaceOnlyParams, PutDocParams,
};
+ use crate::openhuman::memory::rpc_models::QueryNamespaceRequest;
+use tinymemory_api::chunks::{Chunk, Metadata, SourceKind, SourceRef};
- use tinymemory_core::rpc_models::QueryNamespaceRequest;
use tinymemory_core::store::chunks;
-use tinymemory_core::store::chunks::types::{Chunk, Metadata, SourceKind, SourceRef};
use tinymemory_core::store::namespace_store::{events, fts5, profile, segments};
use tinymemory_core::store::trees;
use tinymemory_core::store::trees::types::{SummaryNode, Tree, TreeKind, TreeStatus};