Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/whatsapp-data-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The scanner write-path RPCs are registered as **internal-only** in [`src/core/al
The agent surfaces are exclusively read-only:

- [`src/openhuman/tools/impl/whatsapp_data/`](../src/openhuman/tools/impl/whatsapp_data/) — `whatsapp_data_list_chats`, `whatsapp_data_list_messages`, `whatsapp_data_search_messages`. All three wrap their RPC counterparts and emit a `"provider": "whatsapp"` tag in the response so the agent can cite WhatsApp as the source.
- [`src/openhuman/tools/impl/memory/tree/`](../src/openhuman/tools/impl/memory/tree/) — generic `memory_tree_*` tools. Filter by `source_kind: "chat"` or query directly; WhatsApp chat-day transcripts are tagged `whatsapp` so they surface in cross-source flows.
- [`src/openhuman/memory_tree/tools/`](../src/openhuman/memory_tree/tools/) — generic `memory_tree_*` tools. Filter by `source_kind: "chat"` or query directly; WhatsApp chat-day transcripts are tagged `whatsapp` so they surface in cross-source flows.

## Why the orchestrator only lists three of these

Expand Down
6 changes: 3 additions & 3 deletions src/bin/gmail_backfill_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ use openhuman_core::openhuman::composio::providers::registry::{
get_provider, init_default_providers,
};
use openhuman_core::openhuman::config::Config;
use openhuman_core::openhuman::memory::tree::content_store::read::{
use openhuman_core::openhuman::memory_tree::content_store::read::{
verify_chunk_file, verify_summary_file, VerifyResult,
};
use openhuman_core::openhuman::memory::tree::jobs::drain_until_idle;
use openhuman_core::openhuman::memory::tree::store::{
use openhuman_core::openhuman::memory_tree::jobs::drain_until_idle;
use openhuman_core::openhuman::memory_tree::store::{
get_chunk_content_pointers, list_chunks, list_summaries_with_content_path, ListChunksQuery,
};

Expand Down
2 changes: 1 addition & 1 deletion src/bin/memory_tree_init_smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;

use openhuman_core::openhuman::config::Config;
use openhuman_core::openhuman::memory::tree::store::with_connection;
use openhuman_core::openhuman::memory_tree::store::with_connection;

fn main() -> ExitCode {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info"))
Expand Down
4 changes: 2 additions & 2 deletions src/bin/slack_backfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ async fn main() -> Result<()> {

if cli.seal_probe {
use chrono::{Duration, Utc};
use openhuman_core::openhuman::memory::tree::canonicalize::chat::{ChatBatch, ChatMessage};
use openhuman_core::openhuman::memory::tree::ingest::ingest_chat;
use openhuman_core::openhuman::memory_tree::canonicalize::chat::{ChatBatch, ChatMessage};
use openhuman_core::openhuman::memory_tree::ingest::ingest_chat;

let connection_id = cli.connection_id.clone().ok_or_else(|| {
anyhow::anyhow!(
Expand Down
13 changes: 6 additions & 7 deletions src/core/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ fn build_registered_controllers() -> Vec<RegisteredController> {
// Document and knowledge graph storage
controllers.extend(crate::openhuman::memory::all_memory_registered_controllers());
// Memory tree ingestion layer (#707 — canonicalised chunks with provenance)
controllers.extend(crate::openhuman::memory::all_memory_tree_registered_controllers());
controllers.extend(crate::openhuman::memory_tree::all_memory_tree_registered_controllers());
// Memory tree retrieval layer (#710 — LLM-callable read tools over the tree)
controllers.extend(crate::openhuman::memory::all_retrieval_registered_controllers());
controllers.extend(crate::openhuman::memory_tree::all_retrieval_registered_controllers());
// Slack → memory-tree ingestion engine (per-message ingest, no bucketing)
controllers.extend(
crate::openhuman::composio::providers::slack::all_slack_memory_registered_controllers(),
Expand Down Expand Up @@ -226,8 +226,7 @@ fn build_registered_controllers() -> Vec<RegisteredController> {
// Core binary update management
controllers.extend(crate::openhuman::update::all_update_registered_controllers());
// Hierarchical knowledge summarization
controllers
.extend(crate::openhuman::tree_summarizer::all_tree_summarizer_registered_controllers());
controllers.extend(crate::openhuman::memory_tree::all_tree_summarizer_registered_controllers());
// Self-learning and user context enrichment
controllers.extend(crate::openhuman::learning::all_learning_registered_controllers());
// Conversation thread and message management
Expand Down Expand Up @@ -314,8 +313,8 @@ fn build_declared_controller_schemas() -> Vec<ControllerSchema> {
schemas.extend(crate::openhuman::tools::all_tools_controller_schemas());
schemas.extend(crate::openhuman::tool_registry::all_tool_registry_controller_schemas());
schemas.extend(crate::openhuman::memory::all_memory_controller_schemas());
schemas.extend(crate::openhuman::memory::all_memory_tree_controller_schemas());
schemas.extend(crate::openhuman::memory::all_retrieval_controller_schemas());
schemas.extend(crate::openhuman::memory_tree::all_memory_tree_controller_schemas());
schemas.extend(crate::openhuman::memory_tree::all_retrieval_controller_schemas());
schemas.extend(
crate::openhuman::composio::providers::slack::all_slack_memory_controller_schemas(),
);
Expand All @@ -333,7 +332,7 @@ fn build_declared_controller_schemas() -> Vec<ControllerSchema> {
schemas.extend(crate::openhuman::subconscious::all_subconscious_controller_schemas());
schemas.extend(crate::openhuman::webhooks::all_webhooks_controller_schemas());
schemas.extend(crate::openhuman::update::all_update_controller_schemas());
schemas.extend(crate::openhuman::tree_summarizer::all_tree_summarizer_controller_schemas());
schemas.extend(crate::openhuman::memory_tree::all_tree_summarizer_controller_schemas());
schemas.extend(crate::openhuman::learning::all_learning_controller_schemas());
// Conversation thread and message management
schemas.extend(crate::openhuman::threads::all_threads_controller_schemas());
Expand Down
2 changes: 1 addition & 1 deletion src/core/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn run_from_cli_args(args: &[String]) -> Result<()> {
}
"text-input" => crate::openhuman::text_input::cli::run_text_input_command(&args[1..]),
"tree-summarizer" => {
crate::openhuman::tree_summarizer::cli::run_tree_summarizer_command(&args[1..])
crate::openhuman::memory_tree::summarizer::cli::run_tree_summarizer_command(&args[1..])
}
"memory" => crate::core::memory_cli::run_memory_command(&args[1..]),
"agent" => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/jsonrpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ fn register_domain_subscribers(
);
}

crate::openhuman::memory::tree::jobs::start(config.clone());
crate::openhuman::memory_tree::jobs::start(config.clone());
Comment thread
senamakel marked this conversation as resolved.

// Restart requests go through a subscriber so every trigger path shares
// the same respawn logic.
Expand Down
18 changes: 9 additions & 9 deletions src/openhuman/agent/harness/archivist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ use crate::openhuman::memory::store::profile::{self, FacetType};
use crate::openhuman::memory::store::segments::{
self, BoundaryConfig, BoundaryDecision, ConversationSegment,
};
use crate::openhuman::memory::tree::canonicalize::chat::{ChatBatch, ChatMessage};
use crate::openhuman::memory::tree::chat::{ChatConsumer, ChatProvider};
use crate::openhuman::memory::tree::ingest;
use crate::openhuman::memory::tree::score::embed::{build_embedder_from_config, Embedder};
use crate::openhuman::memory::tree::tree_source::summariser::llm::{
use crate::openhuman::memory_tree::canonicalize::chat::{ChatBatch, ChatMessage};
use crate::openhuman::memory_tree::chat::{ChatConsumer, ChatProvider};
use crate::openhuman::memory_tree::ingest;
use crate::openhuman::memory_tree::score::embed::{build_embedder_from_config, Embedder};
use crate::openhuman::memory_tree::tree_source::summariser::llm::{
LlmSummariser, LlmSummariserConfig,
};
use crate::openhuman::memory::tree::tree_source::summariser::{
use crate::openhuman::memory_tree::tree_source::summariser::{
Summariser, SummaryContext, SummaryInput,
};
use crate::openhuman::memory::tree::tree_source::types::TreeKind;
use crate::openhuman::memory_tree::tree_source::types::TreeKind;
use async_trait::async_trait;
use parking_lot::Mutex;
use rusqlite::Connection;
Expand Down Expand Up @@ -98,7 +98,7 @@ impl ArchivistHook {
pub fn with_config(mut self, config: Config) -> Self {
// Build the LLM chat provider for segment recap.
let chat_provider: Option<Arc<dyn ChatProvider>> =
match crate::openhuman::memory::tree::chat::build_chat_provider(
match crate::openhuman::memory_tree::chat::build_chat_provider(
&config,
ChatConsumer::Summarise,
) {
Expand Down Expand Up @@ -650,7 +650,7 @@ impl ArchivistHook {
.iter()
.filter(|e| !e.content.trim().is_empty())
.map(|e| {
use crate::openhuman::memory::tree::types::approx_token_count;
use crate::openhuman::memory_tree::types::approx_token_count;
let content = e.content.clone();
let token_count = approx_token_count(&content);
let ts = chrono::DateTime::from_timestamp(e.timestamp as i64, 0)
Expand Down
8 changes: 4 additions & 4 deletions src/openhuman/agent/harness/archivist_tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::*;
use crate::openhuman::agent::hooks::{ToolCallRecord, TurnContext};
use crate::openhuman::memory::store::{events as ev, fts5, segments as seg};
use crate::openhuman::memory::tree::chat::ChatPrompt;
use crate::openhuman::memory_tree::chat::ChatPrompt;

fn setup_conn() -> Arc<Mutex<Connection>> {
let conn = Connection::open_in_memory().unwrap();
Expand Down Expand Up @@ -343,7 +343,7 @@ async fn phase0_episodic_rows_and_segment_without_learning_enabled() {
struct StubChatProvider;

#[async_trait::async_trait]
impl crate::openhuman::memory::tree::chat::ChatProvider for StubChatProvider {
impl crate::openhuman::memory_tree::chat::ChatProvider for StubChatProvider {
fn name(&self) -> &str {
"stub:test"
}
Expand All @@ -361,7 +361,7 @@ impl crate::openhuman::memory::tree::chat::ChatProvider for StubChatProvider {
struct StubEmbedder;

#[async_trait::async_trait]
impl crate::openhuman::memory::tree::score::embed::Embedder for StubEmbedder {
impl crate::openhuman::memory_tree::score::embed::Embedder for StubEmbedder {
fn name(&self) -> &'static str {
"stub-embedder-v1"
}
Expand Down Expand Up @@ -546,7 +546,7 @@ async fn phase1_flush_open_segment_finalizes_trailing_segment() {
// g) flush_open_segment also triggers tree ingest.

use crate::openhuman::config::Config;
use crate::openhuman::memory::tree::store::{count_chunks, list_chunks, ListChunksQuery};
use crate::openhuman::memory_tree::store::{count_chunks, list_chunks, ListChunksQuery};
use tempfile::TempDir;

/// Build a Config that points at a temp workspace, suitable for tree-ingest tests.
Expand Down
2 changes: 1 addition & 1 deletion src/openhuman/agent/harness/payload_summarizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl PayloadSummarizer for SubagentPayloadSummarizer {
}

/// Rough token estimate: ~4 characters per token. Mirrors
/// [`crate::openhuman::tree_summarizer::types::estimate_tokens`] but
/// [`crate::openhuman::memory_tree::summarizer::types::estimate_tokens`] but
/// returns `usize` (not `u32`) and lives here to avoid a cross-module
/// dependency from the agent harness on the tree summarizer.
fn estimate_tokens(text: &str) -> usize {
Expand Down
4 changes: 2 additions & 2 deletions src/openhuman/agent/harness/session/turn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2150,7 +2150,7 @@ impl Agent {
}

/// Wrapper around
/// [`crate::openhuman::tree_summarizer::store::collect_root_summaries_with_caps`]
/// [`crate::openhuman::memory_tree::summarizer::store::collect_root_summaries_with_caps`]
/// that takes user-resolved per-namespace and total caps. The actual
/// limits are derived from the active
/// [`crate::openhuman::config::schema::agent::MemoryContextWindow`]
Expand All @@ -2160,7 +2160,7 @@ fn collect_tree_root_summaries(
per_namespace_cap: usize,
total_cap: usize,
) -> Vec<(String, String)> {
crate::openhuman::tree_summarizer::store::collect_root_summaries_with_caps(
crate::openhuman::memory_tree::summarizer::store::collect_root_summaries_with_caps(
workspace_dir,
per_namespace_cap,
total_cap,
Expand Down
2 changes: 1 addition & 1 deletion src/openhuman/agent/harness/subagent_runner/handoff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use std::sync::Mutex as StdMutex;
/// cache instead of being pushed into history raw. Token count is
/// estimated at ~4 chars/token (mirrors
/// `crate::openhuman::agent::harness::payload_summarizer` and
/// `crate::openhuman::tree_summarizer::types::estimate_tokens`).
/// `crate::openhuman::memory_tree::summarizer::types::estimate_tokens`).
///
/// Set at `50_000` so the clean Gmail / Notion envelopes emitted by provider
/// post-processing fit through unchanged for normal workloads — only
Expand Down
2 changes: 1 addition & 1 deletion src/openhuman/agent/tree_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! concatenate without branching.

use crate::openhuman::config::Config;
use crate::openhuman::memory::tree::retrieval::query_global;
use crate::openhuman::memory_tree::retrieval::query_global;

/// Default lookback window for the eager digest. Mirrors the language in
/// the orchestrator prompt ("7-day digest pre-loaded into session context").
Expand Down
2 changes: 1 addition & 1 deletion src/openhuman/channels/runtime/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ pub async fn start_channels(config: Config) -> Result<()> {
};
// Register the tree summarizer event subscriber for observability logging.
let _tree_summarizer_handle = bus.subscribe(Arc::new(
crate::openhuman::tree_summarizer::bus::TreeSummarizerEventSubscriber::new(),
crate::openhuman::memory_tree::summarizer::bus::TreeSummarizerEventSubscriber::new(),
));

let max_in_flight_messages = compute_max_in_flight_messages(channels.len());
Expand Down
4 changes: 2 additions & 2 deletions src/openhuman/composio/ops_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ async fn composio_execute_via_mock_propagates_backend_error() {
#[tokio::test]
async fn composio_sync_gmail_via_mock_archives_raw_email_and_updates_outcome() {
use crate::openhuman::config::TEST_ENV_LOCK;
use crate::openhuman::memory::tree::content_store::raw::{raw_rel_path, RawKind};
use crate::openhuman::memory::tree::rpc::{list_chunks_rpc, ListChunksRequest};
use crate::openhuman::memory_tree::content_store::raw::{raw_rel_path, RawKind};
use crate::openhuman::memory_tree::rpc::{list_chunks_rpc, ListChunksRequest};
let _cache_guard = CACHE_TEST_GUARD.lock().unwrap_or_else(|e| e.into_inner());
let _env_guard = TEST_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());

Expand Down
14 changes: 6 additions & 8 deletions src/openhuman/composio/providers/gmail/ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@ use anyhow::Result;
use serde_json::Value;

use crate::openhuman::config::Config;
use crate::openhuman::memory::tree::canonicalize::email::{EmailMessage, EmailThread};
use crate::openhuman::memory::tree::canonicalize::email_clean::{
extract_email, parse_message_date,
};
use crate::openhuman::memory::tree::content_store::raw::{
use crate::openhuman::memory_tree::canonicalize::email::{EmailMessage, EmailThread};
use crate::openhuman::memory_tree::canonicalize::email_clean::{extract_email, parse_message_date};
use crate::openhuman::memory_tree::content_store::raw::{
self as raw_store, raw_rel_path, slug_account_email, RawItem, RawKind,
};
use crate::openhuman::memory::tree::ingest::{ingest_email, IngestResult};
use crate::openhuman::memory::tree::store::{set_chunk_raw_refs, RawRef};
use crate::openhuman::memory::tree::util::redact::redact;
use crate::openhuman::memory_tree::ingest::{ingest_email, IngestResult};
use crate::openhuman::memory_tree::store::{set_chunk_raw_refs, RawRef};
use crate::openhuman::memory_tree::util::redact::redact;

/// Provider name embedded in the canonical email-thread header. Matches
/// the value `memory::tree::retrieval::source::PLATFORM_KINDS` expects.
Expand Down
2 changes: 1 addition & 1 deletion src/openhuman/composio/providers/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use std::collections::BTreeMap;

/// Shape of an identifier persisted against a connection. Mirrors the
/// matching dimensions of the memory tree's
/// `crate::openhuman::memory::tree::score::extract::EntityKind` so the
/// `crate::openhuman::memory_tree::score::extract::EntityKind` so the
/// self-check is a direct `(toolkit, kind, value)` lookup.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum IdentityKind {
Expand Down
14 changes: 7 additions & 7 deletions src/openhuman/composio/providers/slack/ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Owns the conversion from a page of [`SlackMessage`]s (post-processed
//! and enriched by [`super::sync`]) into per-channel [`ChatBatch`]es and
//! drives [`memory::tree::ingest::ingest_chat`] per message.
//! drives [`memory_tree::ingest::ingest_chat`] per message.
//!
//! ## Source-id scope
//!
Expand Down Expand Up @@ -30,16 +30,16 @@ use anyhow::Result;

use super::types::SlackMessage;
use crate::openhuman::config::Config;
use crate::openhuman::memory::tree::canonicalize::chat::{ChatBatch, ChatMessage};
use crate::openhuman::memory::tree::content_store::raw::{
use crate::openhuman::memory_tree::canonicalize::chat::{ChatBatch, ChatMessage};
use crate::openhuman::memory_tree::content_store::raw::{
self as raw_store, raw_rel_path, RawItem, RawKind,
};
use crate::openhuman::memory::tree::ingest::ingest_chat;
use crate::openhuman::memory::tree::store::{set_chunk_raw_refs, RawRef};
use crate::openhuman::memory::tree::util::redact::redact;
use crate::openhuman::memory_tree::ingest::ingest_chat;
use crate::openhuman::memory_tree::store::{set_chunk_raw_refs, RawRef};
use crate::openhuman::memory_tree::util::redact::redact;
Comment thread
coderabbitai[bot] marked this conversation as resolved.

/// Platform identifier embedded in the canonical chat transcript header.
/// Matches the value `memory::tree::retrieval::source::PLATFORM_KINDS` expects.
/// Matches the value `memory_tree::retrieval::source::PLATFORM_KINDS` expects.
pub const SLACK_PLATFORM: &str = "slack";

/// Tags attached to every Slack-ingested chunk. Stable list — retrieval
Expand Down
4 changes: 2 additions & 2 deletions src/openhuman/config/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ pub async fn apply_model_settings(
// so a UI embedder switch recovers prior memory under the new
// signature. Coverage-gated + non-fatal: if the active signature did
// not actually change, this enqueues nothing.
crate::openhuman::memory::tree::jobs::ensure_reembed_backfill(config);
crate::openhuman::memory_tree::jobs::ensure_reembed_backfill(config);
let snapshot = snapshot_config_json(config)?;
Ok(RpcOutcome::new(
snapshot,
Expand Down Expand Up @@ -623,7 +623,7 @@ pub async fn apply_memory_settings(
// dark. Idempotent + non-fatal (covered space enqueues nothing; errors
// are logged, never fail the settings save). §7's migration is
// one-shot so it does not cover a later switch — this does.
crate::openhuman::memory::tree::jobs::ensure_reembed_backfill(config);
crate::openhuman::memory_tree::jobs::ensure_reembed_backfill(config);
let snapshot = snapshot_config_json(config)?;
Ok(RpcOutcome::new(
snapshot,
Expand Down
8 changes: 4 additions & 4 deletions src/openhuman/context/segment_recap_summarizer_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::openhuman::agent::hooks::{PostTurnHook as _, TurnContext};
use crate::openhuman::context::summarizer::{Summarizer, SummaryStats};
use crate::openhuman::inference::provider::{ChatMessage, ConversationMessage};
use crate::openhuman::memory::store::{fts5, segments as seg};
use crate::openhuman::memory::tree::chat::ChatPrompt;
use crate::openhuman::memory_tree::chat::ChatPrompt;
use anyhow::Result;
use async_trait::async_trait;
use parking_lot::Mutex;
Expand All @@ -40,7 +40,7 @@ fn setup_conn() -> Arc<Mutex<Connection>> {
struct StubChatProvider;

#[async_trait]
impl crate::openhuman::memory::tree::chat::ChatProvider for StubChatProvider {
impl crate::openhuman::memory_tree::chat::ChatProvider for StubChatProvider {
fn name(&self) -> &str {
"stub:test"
}
Expand All @@ -56,7 +56,7 @@ impl crate::openhuman::memory::tree::chat::ChatProvider for StubChatProvider {
struct FailingChatProvider;

#[async_trait]
impl crate::openhuman::memory::tree::chat::ChatProvider for FailingChatProvider {
impl crate::openhuman::memory_tree::chat::ChatProvider for FailingChatProvider {
fn name(&self) -> &str {
"stub:failing"
}
Expand All @@ -72,7 +72,7 @@ impl crate::openhuman::memory::tree::chat::ChatProvider for FailingChatProvider
struct StubEmbedder;

#[async_trait]
impl crate::openhuman::memory::tree::score::embed::Embedder for StubEmbedder {
impl crate::openhuman::memory_tree::score::embed::Embedder for StubEmbedder {
fn name(&self) -> &'static str {
"stub-embedder-v1"
}
Expand Down
2 changes: 1 addition & 1 deletion src/openhuman/doctor/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ fn check_memory_tree_db(config: &Config, items: &mut Vec<DiagnosticItem>) {
}

// ── Probe connection ─────────────────────────────────────────────
match crate::openhuman::memory::tree::store::with_connection(config, |conn| {
match crate::openhuman::memory_tree::store::with_connection(config, |conn| {
let n: i64 = conn.query_row("SELECT COUNT(*) FROM mem_tree_chunks", [], |r| r.get(0))?;
Ok(n)
}) {
Expand Down
Loading
Loading