pub struct MemoryQuery {
pub text: Option<String>,
pub category: Option<String>,
pub tags: Vec<String>,
pub agent: Option<String>,
pub agent_prefix: Option<String>,
pub limit: usize,
pub memory_type: Option<MemoryType>,
pub min_strength: Option<f64>,
pub query_embedding: Option<Vec<f32>>,
pub max_confidentiality: Option<Confidentiality>,
pub reinforce: bool,
pub exact_words: bool,
}Expand description
Query parameters for recalling memories.
limit controls the maximum number of results returned. A value of 0
means no limit (return all matching entries). This is the default.
Fields§
§text: Option<String>§category: Option<String>§agent: Option<String>§agent_prefix: Option<String>Filter entries whose agent field starts with this prefix.
Useful for cross-agent recall within a user namespace (e.g. "tg:123"
matches "tg:123:assistant", "tg:123:researcher", etc.).
Mutually exclusive with agent — if both are set, agent takes precedence.
limit: usizeMaximum number of results. 0 means unlimited.
memory_type: Option<MemoryType>Filter by memory type.
min_strength: Option<f64>Minimum strength threshold. Entries below this are excluded.
query_embedding: Option<Vec<f32>>Optional query embedding for hybrid (BM25 + vector) retrieval.
When present and entries have stored embeddings, cosine similarity
is computed and fused with BM25 via Reciprocal Rank Fusion.
Populated automatically by EmbeddingMemory::recall().
max_confidentiality: Option<Confidentiality>When set, recall excludes entries with confidentiality above this level.
None means no restriction (all levels returned).
reinforce: boolWhether to reinforce the strength of returned entries on this read
(Ebbinghaus reinforcement, +0.2 per access, capped at 1.0).
Defaults to true to preserve historical recall semantics. Set to
false for a pure read — useful when surfacing strength to a UI,
driving deterministic decay tests, or letting prune_weak_entries
observe a freshly-stored low-strength entry without first promoting
it above the prune threshold. last_accessed and access_count
are still updated regardless.
exact_words: boolOpt in to exact-word text matching instead of the default
substring (word.contains(token)) semantics.
When true, InMemoryStore::recall short-circuits to entries
whose lowercased content / keyword tokens exactly equal at
least one query token, looked up via the in-memory inverted
index built at store time. Estimated gain at N=10k entries:
12.69 ms → 1–3 ms text-query recall (Phase 8 in
tasks/perf-audit-v2-2026-05-07.md).
Trade-off: queries whose tokens are prefixes / substrings
of indexed words (“perf” matching “performance”) will no
longer match. Default is false — substring semantics
preserved; opt-in when callers know their queries are full
words. The Postgres path ignores this flag (it doesn’t
implement substring matching the same way).
Trait Implementations§
Source§impl Clone for MemoryQuery
impl Clone for MemoryQuery
Source§fn clone(&self) -> MemoryQuery
fn clone(&self) -> MemoryQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more