1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Hybrid retrieval primitives, ported from OpenHuman's `memory_search` and
//! `memory_tree::retrieval`.
//!
//! Each primitive is **deterministic and scope-specific**; orchestration (which
//! primitive to call, how to combine results) is left to the caller — there is
//! no classifier, gate, or composer here. Every primitive emits the same
//! unified [`RetrievalHit`] / [`QueryResponse`] shape so a caller sees one
//! schema regardless of which ran.
//!
//! ## Primitives
//!
//! - [`query_source`] — per-source-tree summary retrieval (optional semantic
//! rerank).
//! - [`query_global`] — cross-source digest over an explicit time window,
//! reconstructed from source-tree summaries.
//! - [`query_topic`] — entity/topic-scoped retrieval reconstructed from the
//! entity index plus hydrated source-tree nodes.
//! - [`search_entities`] — fuzzy `LIKE` lookup over the entity index.
//! - [`drill_down`] — descend a summary's `child_ids` (BFS, optional rerank).
//! - [`cover_window`] — minimum-node cover of a `[since, until]` window.
//! - [`fetch_leaves`] — batch-hydrate raw chunk leaves by id, capped.
//!
//! ## Hybrid scoring
//!
//! [`scoring`] supplies the deterministic signal functions (keyword overlap,
//! freshness decay) and folds graph / vector / keyword / freshness into a
//! [`crate::memory::types::RetrievalScoreBreakdown`] under the active
//! [`crate::memory::config::WeightProfile`] (read from config — never
//! hardcoded). [`mmr`] provides Maximal Marginal Relevance diversification.
//!
//! ## Reuse
//!
//! These primitives delegate storage to the already-ported modules:
//! - [`crate::memory::tree`] for tree/summary reads,
//! - [`crate::memory::chunks`] for leaf hydration + the shared SQLite handle,
//! - [`crate::memory::score`] for embeddings ([`Embedder`]) and the entity
//! index,
//! - [`crate::memory::graph`] for co-occurrence relevance (via
//! [`graph_adapter::ConfigEntityIndex`]).
//!
//! [`Embedder`]: crate::memory::score::embed::Embedder
pub
// ── Public re-exports ───────────────────────────────────────────────────────
pub use cover_window;
pub use drill_down;
pub use ;
pub use ;
pub use ConfigEntityIndex;
pub use ;
pub use ;
pub use search_entities;
pub use query_source;
pub use ;