pub struct MemoryPolicy {
pub memory_path: String,
pub stale_warning_days: u32,
pub retrieval_top_k: usize,
pub validation_enabled: bool,
pub max_content_bytes: Option<u32>,
pub max_name_length: Option<usize>,
pub promotion_recall_threshold: Option<u64>,
}Expand description
Declarative configuration for the kernel’s long-term memory subsystem.
Installed via the set_memory_policy input event (opt-in). When no policy is installed the
kernel preserves pre-policy behavior: every write_memory is validated with the default rules
and query_memory uses the requested top_k verbatim. Installing a policy makes these knobs
authoritative:
validation_enabled = falseadmits every write without validation.retrieval_top_kis an upper bound: the emittedrequested_kismin(query.top_k, top_k).max_content_bytes/max_name_lengthoverride the validation size limits when set.
memory_path and stale_warning_days are not enforced inside the kernel (the kernel performs
no recall I/O); they are carried so the SDK consumes a single authoritative config.
Fields§
§memory_path: String§stale_warning_days: u32§retrieval_top_k: usize§validation_enabled: bool§max_content_bytes: Option<u32>§max_name_length: Option<usize>§promotion_recall_threshold: Option<u64>M4: recall count at which a record becomes a promotion candidate. When set, crossing it on a
recall emits an advisory PromotionSuggested; None disables the suggestion.
Implementations§
Source§impl MemoryPolicy
impl MemoryPolicy
Sourcepub fn validation(&self) -> MemoryValidation
pub fn validation(&self) -> MemoryValidation
Build the validation rules this policy implies, starting from the kernel defaults and applying any size / name-length overrides.
Sourcepub fn clamp_top_k(&self, requested: usize) -> usize
pub fn clamp_top_k(&self, requested: usize) -> usize
Clamp a requested retrieval count to this policy’s retrieval_top_k upper bound.
Trait Implementations§
Source§impl Clone for MemoryPolicy
impl Clone for MemoryPolicy
Source§fn clone(&self) -> MemoryPolicy
fn clone(&self) -> MemoryPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more