Skip to content

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

chore: files changed crates/openhuman-core/Cargo.toml,crates/openhuman-core/src/memory/ops/tool_memo

Steven Enamakel05fe6d1ad5f0
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index 6287b0cbeb..cfcf290475 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -294,6 +294,12 @@ tinymemory-guard = { path = "../../vendor/tinymemory/crates/tinymemory-guard" }
# opens (`target_memory_backend`, which refuses a null driver) and adds no
# dependency beyond rusqlite, already linked here.
tinymemory-import = { path = "../../vendor/tinymemory/crates/tinymemory-import" }
+# `tinymemory-tools` holds the memory agent tools (tree retrieval, raw chunk and
+# entity search, hybrid and vector search, tool-scoped rules) as
+# `tinytools::Tool`s generic over a host; `memory::tools::host` is this host.
+# Its one extra dependency is `tinytools`, which the root `[patch]` points at
+# the copy vendored through tinyagents, so there is still exactly one `Tool`.
+tinymemory-tools = { path = "../../vendor/tinymemory/crates/tinymemory-tools" }
# `tinymemory-safety` is the secret and PII scrubber (credential patterns,
# sensitive-key classifier, checksum-gated multilingual national-ID redaction)
# that `memory::safety` used to carry a private copy of. `regex`, `serde_json`
diff --git a/crates/openhuman-core/src/memory/ops/tool_memory.rs b/crates/openhuman-core/src/memory/ops/tool_memory.rs
index cb3d0ec700..42956c44c6 100644
--- a/crates/openhuman-core/src/memory/ops/tool_memory.rs
+++ b/crates/openhuman-core/src/memory/ops/tool_memory.rs
@@ -121,7 +121,7 @@ pub async fn tool_rule_get(
///
/// Shared with the `memory_tools_list` / `memory_tools_put` agent tools, which
/// route through the same family.
-pub(crate) const NO_TOOL_MEMORY: &str = "memory driver does not support the tool_memory family";
+pub(crate) use tinymemory_tools::NO_TOOL_MEMORY;
/// List every tool-scoped rule for a tool.
///
diff --git a/crates/openhuman-core/src/memory/query/mod.rs b/crates/openhuman-core/src/memory/query/mod.rs
index 01333f2fce..966bf721ea 100644
--- a/crates/openhuman-core/src/memory/query/mod.rs
+++ b/crates/openhuman-core/src/memory/query/mod.rs
@@ -1,174 +1,33 @@
//! Consolidated memory query tool — dispatches to the correct memory-tree
//! retrieval primitive based on the `mode` argument.
//!
-//! The individual per-mode structs are still re-exported for callers that
-//! need them directly (e.g. tool registration in ops.rs for agents that
-//! prefer the individual tools). The consolidated [`MemoryQueryTool`] is
-//! the recommended single entry point for the `memory` orchestration layer.
+//! The tools are `tinymemory-tools`' (`query`); the aliases here run them under
+//! this host, so `MemoryQueryTool` keeps its name and the per-mode structs stay
+//! importable. `ingest_document` is the one mode that is the host's: it writes
+//! through the host's own tree-ingest path, so its tool lives here and the
+//! dispatcher reaches it through [`HostMemoryTools`].
-mod backend;
-mod cover_window;
-mod drill_down;
-mod fast_walk;
-mod fetch_leaves;
mod ingest_document;
-mod query_source;
-mod search_entities;
-#[cfg(test)]
-mod test_workspace;
-// Re-export individual tool types for callers that need them directly
-// (e.g. tool registration in ops.rs).
-pub use cover_window::MemoryTreeCoverWindowTool;
-pub use drill_down::MemoryTreeDrillDownTool;
-pub use fetch_leaves::MemoryTreeFetchLeavesTool;
-pub use ingest_document::MemoryTreeIngestDocumentTool;
-pub use query_source::MemoryTreeQuerySourceTool;
-pub use search_entities::MemoryTreeSearchEntitiesTool;
-pub use MemoryTreeTool as MemoryQueryTool;
-
-use async_trait::async_trait;
-use serde_json::json;
-use tinytools::{Tool, ToolResult};
-
-/// Single multi-mode tool that consolidates all six memory-tree retrieval
-/// primitives behind one LLM-facing entry. The `mode` field routes to the
-/// appropriate underlying implementation.
-pub struct MemoryTreeTool;
-
-#[async_trait]
-impl Tool for MemoryTreeTool {
- fn name(&self) -> &str {
- "memory_tree"
- }
+use crate::memory::tools::host::HostMemoryTools;
- fn description(&self) -> &str {
- "Query the user's ingested email/chat/document memory tree. \
- Set `mode` to one of: `search_entities` (resolve a name to a \
- canonical id — call first when the user mentions someone by name), \
- `query_source` (filter by source type + time window), \
- `drill_down` (expand a coarse summary one level), \
- `cover_window` (minimum node set covering a time window [since_ms, until_ms] — use for last-24h / time-bounded recaps), \
- `fetch_leaves` (pull raw chunks for citation), `ingest_document` (write a document into the tree for future retrieval), \
- `walk` / `smart_walk` (deterministic E2GraphRAG retrieval — extracts query entities, routes between \
- entity-graph (local) and dense-summary (global) search with no LLM, and returns ranked evidence \
- hits for a natural-language query)."
- }
-
- fn parameters_schema(&self) -> serde_json::Value {
- json!({
- "type": "object",
- "properties": {
- "mode": {
- "type": "string",
- "enum": ["search_entities", "query_source",
- "drill_down", "cover_window", "fetch_leaves", "ingest_document", "walk",
- "smart_walk"],
- "description": "Which operation to run (retrieval or write)."
- },
- // cover_window params (epoch-milliseconds)
- "since_ms": {
- "type": "integer",
- "description": "cover_window: inclusive window start, epoch-milliseconds."
- },
- "until_ms": {
- "type": "integer",
- "description": "cover_window: inclusive window end, epoch-milliseconds."
- },
- // search_entities params
- "query": {
- "type": "string",
- "description": "search_entities: substring to match. query_source: semantic rerank query (optional). walk: natural-language question to answer by walking the memory tree."
- },
- "kinds": {
- "type": "array",
- "items": {"type": "string"},
- "description": "search_entities: optional entity kind filter (email, url, handle, person, ...)."
- },
- // query_source params
- "source_kind": {
- "type": "string",
- "description": "query_source: source type to filter (chat, email, document, ...)."
- },
- "time_window_days": {
- "type": "integer",
- "description": "query_source / walk / smart_walk: look-back window in days (applied to the dense/global branch for walk)."
- },
- // walk / smart_walk params
- "max_hops": {
- "type": "integer",
- "description": "walk / smart_walk: entity-graph relatedness hop threshold for E2GraphRAG routing (default 2, capped at 4)."
- },
- // drill_down params
- "node_id": {
- "type": "string",
- "description": "drill_down: id of the summary node to expand."
- },
- "max_depth": {
- "type": "integer",
- "description": "drill_down: how many levels to expand (default 1, max 3)."
- },
- // fetch_leaves params
- // ingest_document params
- "title": {
- "type": "string",
- "description": "ingest_document: document title."
- },
- "body": {
- "type": "string",
- "description": "ingest_document: document body (markdown or plain text)."
- },
- "source_id": {
- "type": "string",
- "description": "ingest_document / query_source: stable source identifier. For ingest, re-ingesting same id replaces old chunks."
- },
- "provider": {
- "type": "string",
- "description": "ingest_document: source provider (e.g. github, web, root_docs). Defaults to agent."
- },
- "source_ref": {
- "type": "string",
- "description": "ingest_document: optional URL back to original source."
- },
- "chunk_ids": {
- "type": "array",
- "items": {"type": "string"},
- "description": "fetch_leaves: list of chunk ids to pull."
- },
- // shared
- "limit": {
- "type": "integer",
- "description": "Max results (default varies by mode)."
- }
- },
- "required": ["mode"]
- })
- }
-
- async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
- let mode = args
- .get("mode")
- .and_then(|v| v.as_str())
- .ok_or_else(|| anyhow::anyhow!("memory_tree: `mode` is required"))?;
- log::debug!("[tool][memory_tree] mode={mode}");
- match mode {
- "search_entities" => MemoryTreeSearchEntitiesTool.execute(args).await,
- "query_source" => MemoryTreeQuerySourceTool.execute(args).await,
- "drill_down" => MemoryTreeDrillDownTool.execute(args).await,
- "cover_window" => MemoryTreeCoverWindowTool.execute(args).await,
- "fetch_leaves" => MemoryTreeFetchLeavesTool.execute(args).await,
- "ingest_document" => MemoryTreeIngestDocumentTool.execute(args).await,
- "walk" | "smart_walk" => fast_walk::run_fast_walk(args).await,
- other => {
- log::debug!("[tool][memory_tree] unknown_mode mode={other}");
- Err(anyhow::anyhow!(
- "memory_tree: unknown mode `{other}`. Valid: search_entities, query_source, drill_down, cover_window, fetch_leaves, ingest_document, walk, smart_walk"
- ))
- }
- }
- }
-}
+pub use ingest_document::MemoryTreeIngestDocumentTool;
-#[cfg(test)]
-#[path = "mod_memory_tree_dispatcher_tests_tests.rs"]
-mod memory_tree_dispatcher_tests;
+/// `memory_tree_cover_window` over this host.
+pub type MemoryTreeCoverWindowTool =
+ tinymemory_tools::query::MemoryTreeCoverWindowTool<HostMemoryTools>;
+/// `memory_tree_drill_down` over this host.
+pub type MemoryTreeDrillDownTool = tinymemory_tools::query::MemoryTreeDrillDownTool<HostMemoryTools>;
+/// `memory_tree_fetch_leaves` over this host.
+pub type MemoryTreeFetchLeavesTool =
+ tinymemory_tools::query::MemoryTreeFetchLeavesTool<HostMemoryTools>;
+/// `memory_tree_query_source` over this host.
+pub type MemoryTreeQuerySourceTool =
+ tinymemory_tools::query::MemoryTreeQuerySourceTool<HostMemoryTools>;
+/// `memory_tree_search_entities` over this host.
+pub type MemoryTreeSearchEntitiesTool =
+ tinymemory_tools::query::MemoryTreeSearchEntitiesTool<HostMemoryTools>;
+/// The consolidated `memory_tree` tool over this host.
+pub type MemoryTreeTool = tinymemory_tools::query::MemoryTreeTool<HostMemoryTools>;
+/// Alias of [`MemoryTreeTool`].
+pub type MemoryQueryTool = MemoryTreeTool;
diff --git a/crates/openhuman-core/src/memory/query/test_workspace.rs b/crates/openhuman-core/src/memory/query/test_workspace.rs
deleted file mode 100644
index 5e9ff8dc99..0000000000
--- a/crates/openhuman-core/src/memory/query/test_workspace.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-//! Shared test-only workspace isolation for `memory::query` tests.
-//!
-//! Any test in this module tree that reaches
-//! `config_rpc::load_config_with_timeout()` MUST hold one of these guards.
-//! Without it the test reads whatever `OPENHUMAN_WORKSPACE` a concurrently
-//! running sibling has set, and fails when that sibling's `TempDir` is
-//! dropped out from under it ("Failed to create temporary config file ...
-//! No such file or directory").
-
-use std::ffi::OsString;
-
-use tempfile::TempDir;
-
-use crate::config::Config;
-use crate::config::TEST_ENV_LOCK;
-
-pub(crate) struct WorkspaceEnvGuard {
- _lock: std::sync::MutexGuard<'static, ()>,
- previous: Option<OsString>,
-}
-
-impl WorkspaceEnvGuard {
- pub(crate) fn set(path: &std::path::Path) -> Self {
- let lock = TEST_ENV_LOCK.lock().unwrap_or_else(|err| err.into_inner());
- let previous = std::env::var_os("OPENHUMAN_WORKSPACE");
- std::env::set_var("OPENHUMAN_WORKSPACE", path);
- Self {
- _lock: lock,
- previous,
- }
- }
-}
-
-impl Drop for WorkspaceEnvGuard {
- fn drop(&mut self) {
- if let Some(previous) = self.previous.as_ref() {
- std::env::set_var("OPENHUMAN_WORKSPACE", previous);
- } else {
- std::env::remove_var("OPENHUMAN_WORKSPACE");
- }
- }
-}
-
-pub(crate) async fn isolated_config(tmp: &TempDir) -> (WorkspaceEnvGuard, Config) {
- let guard = WorkspaceEnvGuard::set(tmp.path());
- let config = Config::load_or_init().await.expect("load config");
- (guard, config)
-}
diff --git a/crates/openhuman-core/src/memory/tools.rs b/crates/openhuman-core/src/memory/tools.rs
index 1c2d1f7c11..d89720e0df 100644
--- a/crates/openhuman-core/src/memory/tools.rs
+++ b/crates/openhuman-core/src/memory/tools.rs
@@ -7,6 +7,7 @@ mod doctor;
// path — see `lookup_flavour`'s doc comment.
pub(crate) mod flavour;
mod forget;
+pub mod host;
mod recall;
mod store;
diff --git a/crates/openhuman-core/src/memory/tools/host.rs b/crates/openhuman-core/src/memory/tools/host.rs
new file mode 100644
index 0000000000..bcc7f66902
--- /dev/null
+++ b/crates/openhuman-core/src/memory/tools/host.rs
@@ -0,0 +1,68 @@
+//! This host's [`MemoryToolHost`]: what `tinymemory-tools` needs that only
+//! OpenHuman can answer.
+//!
+//! The memory agent tools (tree retrieval, raw chunk and entity search, hybrid
+//! and vector search, tool-scoped rules) live in `tinymemory-tools`, generic
+//! over a host. This is the one host they run under here:
+//!
+//! - the **guarded** driver, so the seven policy steps (tier, source scope,
+//! taint, budgets, redaction, audit) run inside every call the tools make;
+//! - the per-turn memory-source allowlist, read from the host's task-local;
+//! - the embedding model, resolved from the current `Config`;
+//! - `memory_tree`'s `ingest_document` mode, which writes through the host's own
+//! tree-ingest path.
+
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use tinymemory_tools::{MemoryToolHost, QueryEmbedder};
+use tinytools::{Tool, ToolResult};
+
+use crate::config::rpc as config_rpc;
+use crate::inference::embedding_host::{provider_from_config, EmbeddingProvider};
+use crate::memory::api::provider::MemoryProvider;
+use crate::memory::ops::guard::active_memory_guard;
+use crate::memory::query::MemoryTreeIngestDocumentTool;
+
+/// The host the memory agent tools run under in this process.
+#[derive(Clone, Copy, Debug, Default)]
+pub struct HostMemoryTools;
+
+/// The host's embedding provider, in the tools' vocabulary.
+struct HostEmbedder(Box<dyn EmbeddingProvider>);
+
+#[async_trait]
+impl QueryEmbedder for HostEmbedder {
+ async fn embed_one(&self, text: &str) -> Result<Vec<f32>, String> {
+ self.0.embed_one(text).await.map_err(|e| e.to_string())
+ }
+
+ fn signature(&self) -> String {
+ self.0.signature()
+ }
+}
+
+#[async_trait]
+impl MemoryToolHost for HostMemoryTools {
+ async fn provider(&self) -> Result<Arc<dyn MemoryProvider>, String> {
+ let guard = active_memory_guard().await?;
+ Ok(guard)
+ }
+
+ fn chunk_source_allowed(&self, tags: &[String], source_id: &str) -> bool {
+ crate::memory::source_scope::chunk_source_allowed(tags, source_id)
+ }
+
+ async fn embedder(&self) -> Result<Box<dyn QueryEmbedder>, String> {
+ let config = config_rpc::load_config_with_timeout()
+ .await
+ .map_err(|e| format!("load config failed: {e}"))?;
+ let provider = provider_from_config(&config)
+ .map_err(|e| format!("embedding provider failed: {e}"))?;
+ Ok(Box::new(HostEmbedder(provider)))
+ }
+
+ async fn ingest_document(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
+ MemoryTreeIngestDocumentTool.execute(args).await
+ }
+}
diff --git a/crates/openhuman-core/src/memory/tools/raw_store/mod.rs b/crates/openhuman-core/src/memory/tools/raw_store/mod.rs
new file mode 100644
index 0000000000..8277b64c65
--- /dev/null
+++ b/crates/openhuman-core/src/memory/tools/raw_store/mod.rs
@@ -0,0 +1,16 @@
+//! Raw search/retrieve tools surfaced to the agent harness.
+//!
+//! These tools expose the storage layer directly — no policy, no scoring
+//! beyond what the underlying backend already applies. They are
+//! `tinymemory-tools`' (`raw_store`); these aliases run them under this host.
+
+use crate::memory::tools::host::HostMemoryTools;
+
+/// `memory_store_kinds` over this host.
+pub type MemoryStoreKindsTool = tinymemory_tools::raw_store::MemoryStoreKindsTool<HostMemoryTools>;
+/// `memory_store_raw_chunks` over this host.
+pub type MemoryStoreRawChunksTool =
+ tinymemory_tools::raw_store::MemoryStoreRawChunksTool<HostMemoryTools>;
+/// `memory_store_raw_search` over this host.
+pub type MemoryStoreRawSearchTool =
+ tinymemory_tools::raw_store::MemoryStoreRawSearchTool<HostMemoryTools>;
diff --git a/crates/openhuman-core/src/memory/tools/search/mod.rs b/crates/openhuman-core/src/memory/tools/search/mod.rs
index c9c5f3bb45..4d50ce321a 100644
--- a/crates/openhuman-core/src/memory/tools/search/mod.rs
+++ b/crates/openhuman-core/src/memory/tools/search/mod.rs
@@ -1,69 +1,27 @@
//! Memory search tools — all agent-facing retrieval tools consolidated here.
//!
-//! New tools are defined here. Existing tools from `memory::query` and
-//! `memory_store::tools` are re-exported for a unified import path.
+//! The tools themselves are `tinymemory-tools`'; these are the aliases that run
+//! them under this host ([`HostMemoryTools`]), so the registration sites in
+//! `tools/ops.rs` and every historical import path keep their names. Construct
+//! one with `::default()`.
-mod chunk_context;
-mod hybrid_search;
-mod vector_search;
+use crate::memory::tools::host::HostMemoryTools;
-// New tools
-pub use chunk_context::MemoryChunkContextTool;
-pub use hybrid_search::MemoryHybridSearchTool;
-pub use vector_search::MemoryVectorSearchTool;
+/// `memory_chunk_context` over this host.
+pub type MemoryChunkContextTool = tinymemory_tools::search::MemoryChunkContextTool<HostMemoryTools>;
+/// `memory_hybrid_search` over this host.
+pub type MemoryHybridSearchTool = tinymemory_tools::search::MemoryHybridSearchTool<HostMemoryTools>;
+/// `memory_vector_search` over this host.
+pub type MemoryVectorSearchTool = tinymemory_tools::search::MemoryVectorSearchTool<HostMemoryTools>;
-// Re-export existing tools from memory_store::tools (previously unregistered)
pub use crate::memory::tools::raw_store::{
MemoryStoreKindsTool, MemoryStoreRawChunksTool, MemoryStoreRawSearchTool,
};
-// Re-export existing tools from memory::query. The former agentic `walk` /
-// `smart_walk` tools are gone — retrieval is now the deterministic
-// `fast_retrieve` exposed via the `memory_tree` tool's `walk`/`smart_walk`
-// modes (see `memory_tree::retrieval::fast`).
+// The former agentic `walk` / `smart_walk` tools are gone — retrieval is now
+// the deterministic `fast_retrieve` exposed via the `memory_tree` tool's
+// `walk`/`smart_walk` modes.
pub use crate::memory::query::{
MemoryTreeDrillDownTool, MemoryTreeFetchLeavesTool, MemoryTreeIngestDocumentTool,
MemoryTreeQuerySourceTool, MemoryTreeSearchEntitiesTool,
};
-
-#[cfg(test)]
-mod zz_dump_contracts {
- use tinytools::Tool;
- #[test]
- fn dump_contracts() {
- let tools: Vec<Box<dyn Tool>> = vec![
- Box::new(super::MemoryChunkContextTool),
- Box::new(super::MemoryHybridSearchTool),
- Box::new(super::MemoryVectorSearchTool),
- Box::new(super::MemoryStoreKindsTool),
- Box::new(super::MemoryStoreRawChunksTool),
- Box::new(super::MemoryStoreRawSearchTool),
- Box::new(crate::memory::tools::tool_memory::MemoryToolsListTool),
- Box::new(crate::memory::tools::tool_memory::MemoryToolsPutTool),
- Box::new(super::MemoryTreeDrillDownTool),
- Box::new(super::MemoryTreeFetchLeavesTool),
- Box::new(super::MemoryTreeQuerySourceTool),
- Box::new(super::MemoryTreeSearchEntitiesTool),
- Box::new(crate::memory::query::MemoryTreeCoverWindowTool),
- Box::new(crate::memory::query::MemoryTreeTool),
- ];
- let mut out = serde_json::Map::new();
- for t in tools {
- out.insert(
- t.name().to_string(),
- serde_json::json!({
- "name": t.name(),
- "description": t.description(),
- "parameters_schema": t.parameters_schema(),
- "exposure": format!("{:?}", t.exposure()),
- "permission_level": format!("{:?}", t.permission_level()),
- }),
- );
- }
- std::fs::write(
- "/tmp/claude-1000/-home-enamakel-work-openhuman/9e4bbe5d-dfd3-4283-bb6a-e34995c22b9c/scratchpad/tool_contracts.json",
- serde_json::to_string_pretty(&serde_json::Value::Object(out)).unwrap(),
- )
- .unwrap();
- }
-}
diff --git a/crates/openhuman-core/src/memory/tools/tool_memory/mod.rs b/crates/openhuman-core/src/memory/tools/tool_memory/mod.rs
index 85626eb3c6..4f4163270c 100644
--- a/crates/openhuman-core/src/memory/tools/tool_memory/mod.rs
+++ b/crates/openhuman-core/src/memory/tools/tool_memory/mod.rs
@@ -2,14 +2,15 @@
//!
//! The agent uses these to introspect what rules / learnings exist for a
//! specific tool and to record new ones discovered mid-session. They are
-//! the user-facing read/write surface on top of [`ToolMemoryStore`].
+//! `tinymemory-tools`' (`tool_memory`); these aliases run them under this host.
-mod list;
-mod put;
+use crate::memory::tools::host::HostMemoryTools;
-pub use list::MemoryToolsListTool;
-pub use put::MemoryToolsPutTool;
+/// `memory_tools_list` over this host.
+pub type MemoryToolsListTool = tinymemory_tools::tool_memory::MemoryToolsListTool<HostMemoryTools>;
+/// `memory_tools_put` over this host.
+pub type MemoryToolsPutTool = tinymemory_tools::tool_memory::MemoryToolsPutTool<HostMemoryTools>;
#[cfg(test)]
-#[path = "mod_tests.rs"]
+#[path = "guard_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/memory/tree/retrieval/rpc.rs b/crates/openhuman-core/src/memory/tree/retrieval/rpc.rs
index 3d9bb24552..e421a85ca5 100644
--- a/crates/openhuman-core/src/memory/tree/retrieval/rpc.rs
+++ b/crates/openhuman-core/src/memory/tree/retrieval/rpc.rs
@@ -55,6 +55,11 @@
use serde::{Deserialize, Serialize};
+pub use tinymemory_tools::requests::{
+ CoverWindowRequest, DrillDownRequest, FetchLeavesRequest, QuerySourceRequest,
+ SearchEntitiesRequest,
+};
+
use crate::config::Config;
// The contract's retrieval vocabulary, not the engine's: these handlers return
// what the driver handed back. The two encode identically (see the module
@@ -68,28 +73,6 @@ use tinymemory_api::chunks::SourceKind;
// ── query_source ──────────────────────────────────────────────────────
-/// Request body for `memory_tree_query_source`. All fields are optional;
-/// see [`MemoryRetrieval::retrieve_source`] for selection semantics.
-///
-/// [`MemoryRetrieval::retrieve_source`]: crate::memory::api::provider::retrieval::MemoryRetrieval::retrieve_source
-#[derive(Clone, Debug, Default, Serialize, Deserialize)]
-pub struct QuerySourceRequest {
- #[serde(default)]
- pub source_id: Option<String>,
- #[serde(default)]
- pub source_kind: Option<String>,
- #[serde(default)]
- pub time_window_days: Option<u32>,
- /// Phase 4 (#710) — optional natural-language query string. When
- /// provided, candidates are reranked by cosine similarity to the
- /// query's embedding rather than sorted by recency. Legacy rows
- /// with no stored embedding fall to the bottom.
- #[serde(default)]
- pub query: Option<String>,
- #[serde(default)]
- pub limit: Option<usize>,
-}
-
/// JSON-RPC handler body for `memory_tree_query_source`. Parses the request,
/// reads through the bound driver's `MemoryRetrieval` family, and wraps the
/// outcome with a PII-redacted log line.
@@ -151,23 +134,6 @@ pub async fn query_source_rpc(
// ── cover_window ──────────────────────────────────────────────────────
-/// Request body for `memory_tree_cover_window`. `since_ms`/`until_ms` are the
-/// inclusive window bounds in epoch-milliseconds; the source filter mirrors
-/// `query_source`. See [`MemoryRetrieval::cover_window`] for cover semantics.
-///
-/// [`MemoryRetrieval::cover_window`]: crate::memory::api::provider::retrieval::MemoryRetrieval::cover_window
-#[derive(Clone, Debug, Default, Serialize, Deserialize)]
-pub struct CoverWindowRequest {
- pub since_ms: i64,
- pub until_ms: i64,
- #[serde(default)]
- pub source_id: Option<String>,
- #[serde(default)]
- pub source_kind: Option<String>,
- #[serde(default)]
- pub limit: Option<usize>,
-}
-
/// JSON-RPC handler body for `memory_tree_cover_window`. Parses the request,
/// reads through the bound driver, logs PII-redacted counts.
///
@@ -247,16 +213,6 @@ pub async fn cover_window_rpc(
// ── search_entities ───────────────────────────────────────────────────
-/// Request body for `memory_tree_search_entities`.
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct SearchEntitiesRequest {
- pub query: String,
- #[serde(default)]
- pub kinds: Option<Vec<String>>,
- #[serde(default)]
- pub limit: Option<usize>,
-}
-
/// Response envelope for `memory_tree_search_entities`.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SearchEntitiesResponse {
@@ -322,23 +278,6 @@ pub async fn search_entities_rpc(
// ── drill_down ────────────────────────────────────────────────────────
-/// Request body for `memory_tree_drill_down`.
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct DrillDownRequest {
- pub node_id: String,
- #[serde(default)]
- pub max_depth: Option<u32>,
- /// When set, visited children are reranked by cosine similarity between
- /// the query embedding and each child's stored embedding. Legacy children
- /// without an embedding sort to the bottom.
- #[serde(default)]
- pub query: Option<String>,
- /// Optional cap on the returned hit count, applied AFTER rerank so the
- /// top-K is relevance-based when `query` is provided.
- #[serde(default)]
- pub limit: Option<usize>,
-}
-
/// Response envelope for `memory_tree_drill_down`.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct DrillDownResponse {
@@ -404,12 +343,6 @@ pub async fn drill_down_rpc(
// ── fetch_leaves ──────────────────────────────────────────────────────
-/// Request body for `memory_tree_fetch_leaves`.
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct FetchLeavesRequest {
- pub chunk_ids: Vec<String>,
-}
-
/// Response envelope for `memory_tree_fetch_leaves`.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct FetchLeavesResponse {
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 85be1dba19..937e5f1101 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -431,15 +431,15 @@ pub fn all_tools_with_runtime(
// anti_preferences) that persona ingestion builds but nothing
// previously surfaced to the agent loop.
Box::new(MemoryFlavourTool::new(config.clone())),
- Box::new(MemoryQueryTool),
+ Box::new(MemoryQueryTool::default()),
// memory_search tools — vector search, chunk context, hybrid search,
// and previously unregistered raw store tools.
- Box::new(MemoryVectorSearchTool),
- Box::new(MemoryChunkContextTool),
- Box::new(MemoryHybridSearchTool),
- Box::new(MemoryStoreRawSearchTool),
- Box::new(MemoryStoreRawChunksTool),
- Box::new(MemoryStoreKindsTool),
+ Box::new(MemoryVectorSearchTool::default()),
+ Box::new(MemoryChunkContextTool::default()),
+ Box::new(MemoryHybridSearchTool::default()),
+ Box::new(MemoryStoreRawSearchTool::default()),
+ Box::new(MemoryStoreRawChunksTool::default()),
+ Box::new(MemoryStoreKindsTool::default()),
// Explicit user-preference pinning — always registered so the model
// can save user-stated preferences regardless of whether the full
// inference-based learning subsystem is enabled. The preference