pub struct MemoryBankEntry {Show 26 fields
pub timestamp: DateTime<Utc>,
pub memory_kind: MemoryKind,
pub memory_type: MemoryType,
pub scope: MemoryScope,
pub session_id: String,
pub category: Option<String>,
pub task_id: Option<String>,
pub reflection_id: Option<String>,
pub strategy_key: Option<String>,
pub reflection_state: Option<ReflectionMemoryState>,
pub success_count: u16,
pub failure_count: u16,
pub directive_id: Option<String>,
pub agent_id: Option<String>,
pub governance_state: MemoryGovernanceState,
pub governance_note: Option<String>,
pub governance_suggestions: Vec<MemoryGovernanceSuggestion>,
pub tags: Vec<String>,
pub promoted_from_session_id: Option<String>,
pub promotion_reason: Option<String>,
pub outcome_summary: Option<String>,
pub outcome_labels: Vec<String>,
pub confidence: f32,
pub summary: String,
pub content: String,
pub file_path: Option<PathBuf>,
}Expand description
A single entry in the memory bank representing a saved conversation context
Each entry contains metadata (timestamp, session ID, summary) and the full
conversation content. Entries are stored as markdown files in .gestura/memory/
and can be searched and retrieved across sessions.
§Examples
use gestura_core::memory_bank::MemoryBankEntry;
let entry = MemoryBankEntry::new(
"session-123".to_string(),
"Implemented user authentication".to_string(),
"User: How do I add auth?\nAssistant: Here's how...".to_string(),
);
let markdown = entry.to_markdown();
let filename = entry.generate_filename(); // e.g., "memory_20260121_143022_session-1.md"Fields§
§timestamp: DateTime<Utc>Timestamp when this entry was created (UTC)
memory_kind: MemoryKindRetention domain for the memory.
memory_type: MemoryTypeTyped classification of the memory entry.
scope: MemoryScopeRetrieval scope for the memory entry.
session_id: StringSession ID that created this entry (used for grouping related conversations)
category: Option<String>Optional category for grouping/filtering entries (e.g., “project”, “personal”, “research”)
task_id: Option<String>Optional task identifier associated with the memory.
reflection_id: Option<String>Optional stable reflection identifier linked to the memory.
strategy_key: Option<String>Optional normalized strategy key for reflection-derived memories.
reflection_state: Option<ReflectionMemoryState>Reflection retrieval state derived from downstream outcomes.
success_count: u16Count of positive downstream outcomes associated with the reflection.
failure_count: u16Count of negative downstream outcomes associated with the reflection.
directive_id: Option<String>Optional higher-level directive identifier associated with the memory.
agent_id: Option<String>Optional agent identifier that produced or owns the memory.
governance_state: MemoryGovernanceStateGeneral governance state for the durable memory entry.
governance_note: Option<String>Optional operator note describing curation intent.
governance_suggestions: Vec<MemoryGovernanceSuggestion>Persisted governance suggestions produced by automated analysis.
Tags used for targeted retrieval.
promoted_from_session_id: Option<String>Optional originating short-term session when this record was promoted.
promotion_reason: Option<String>Optional explanation of why the record was promoted.
outcome_summary: Option<String>Optional human-readable outcome summary linked to this memory’s provenance.
outcome_labels: Vec<String>Stable outcome labels linked to this memory’s provenance.
confidence: f32Confidence score for retrieval/ranking.
summary: StringBrief summary of the conversation (used for search and display)
content: StringFull conversation context in markdown format
file_path: Option<PathBuf>File path where this entry is stored (not serialized, populated on load)
Implementations§
Source§impl MemoryBankEntry
impl MemoryBankEntry
Sourcepub fn new(
session_id: String,
summary: String,
content: String,
) -> MemoryBankEntry
pub fn new( session_id: String, summary: String, content: String, ) -> MemoryBankEntry
Create a new memory bank entry with the current timestamp
§Arguments
session_id- Unique identifier for the session that created this entrysummary- Brief description of the conversation (used for search)content- Full conversation context in markdown format
§Examples
use gestura_core::memory_bank::MemoryBankEntry;
let entry = MemoryBankEntry::new(
"session-abc123".to_string(),
"Fixed authentication bug".to_string(),
"User: Auth is broken\nAssistant: Here's the fix...".to_string(),
);Sourcepub fn with_memory_type(self, memory_type: MemoryType) -> MemoryBankEntry
pub fn with_memory_type(self, memory_type: MemoryType) -> MemoryBankEntry
Override the memory type for this entry.
Sourcepub fn with_scope(self, scope: MemoryScope) -> MemoryBankEntry
pub fn with_scope(self, scope: MemoryScope) -> MemoryBankEntry
Override the memory scope for this entry.
Sourcepub fn with_category(self, category: impl Into<String>) -> MemoryBankEntry
pub fn with_category(self, category: impl Into<String>) -> MemoryBankEntry
Attach a category to the entry.
Sourcepub fn with_provenance(
self,
task_id: Option<String>,
directive_id: Option<String>,
agent_id: Option<String>,
) -> MemoryBankEntry
pub fn with_provenance( self, task_id: Option<String>, directive_id: Option<String>, agent_id: Option<String>, ) -> MemoryBankEntry
Attach provenance identifiers to the entry.
Sourcepub fn with_reflection_id(
self,
reflection_id: impl Into<String>,
) -> MemoryBankEntry
pub fn with_reflection_id( self, reflection_id: impl Into<String>, ) -> MemoryBankEntry
Attach a stable reflection identifier to the entry.
Sourcepub fn with_reflection_learning(
self,
strategy_key: impl Into<String>,
reflection_state: ReflectionMemoryState,
success_count: u16,
failure_count: u16,
) -> MemoryBankEntry
pub fn with_reflection_learning( self, strategy_key: impl Into<String>, reflection_state: ReflectionMemoryState, success_count: u16, failure_count: u16, ) -> MemoryBankEntry
Attach reflection-learning metadata used for ranking and governance.
Attach retrieval tags to the entry.
Sourcepub fn with_governance_state(
self,
state: MemoryGovernanceState,
) -> MemoryBankEntry
pub fn with_governance_state( self, state: MemoryGovernanceState, ) -> MemoryBankEntry
Set the general governance state.
Sourcepub fn with_governance_note(self, note: impl Into<String>) -> MemoryBankEntry
pub fn with_governance_note(self, note: impl Into<String>) -> MemoryBankEntry
Attach an operator note describing memory curation context.
Sourcepub fn with_governance_suggestions(
self,
suggestions: Vec<MemoryGovernanceSuggestion>,
) -> MemoryBankEntry
pub fn with_governance_suggestions( self, suggestions: Vec<MemoryGovernanceSuggestion>, ) -> MemoryBankEntry
Replace automated governance suggestions.
Sourcepub fn with_promotion(
self,
promoted_from_session_id: impl Into<String>,
promotion_reason: impl Into<String>,
) -> MemoryBankEntry
pub fn with_promotion( self, promoted_from_session_id: impl Into<String>, promotion_reason: impl Into<String>, ) -> MemoryBankEntry
Mark the entry as promoted from short-term memory.
Sourcepub fn with_outcome_provenance(
self,
outcome_summary: Option<String>,
outcome_labels: Vec<String>,
) -> MemoryBankEntry
pub fn with_outcome_provenance( self, outcome_summary: Option<String>, outcome_labels: Vec<String>, ) -> MemoryBankEntry
Attach durable outcome provenance to the entry.
Sourcepub fn with_confidence(self, confidence: f32) -> MemoryBankEntry
pub fn with_confidence(self, confidence: f32) -> MemoryBankEntry
Override the retrieval confidence for this entry.
Sourcepub fn is_archived(&self) -> bool
pub fn is_archived(&self) -> bool
Returns true when the memory has been archived from retrieval.
Sourcepub fn is_prompt_eligible_reflection(&self) -> bool
pub fn is_prompt_eligible_reflection(&self) -> bool
Returns true when the reflection can safely be injected into prompts.
Sourcepub fn to_markdown(&self) -> String
pub fn to_markdown(&self) -> String
Convert entry to markdown format for file storage
The markdown format includes metadata headers and the full context:
# Memory Bank Entry
**Timestamp**: 2026-01-21 14:30:22 UTC
**Session ID**: session-abc123
**Category**: engineering # optional
**Summary**: Fixed authentication bug
## Context
[conversation content here]Sourcepub fn from_markdown(
markdown: &str,
file_path: Option<PathBuf>,
) -> Result<MemoryBankEntry, MemoryBankError>
pub fn from_markdown( markdown: &str, file_path: Option<PathBuf>, ) -> Result<MemoryBankEntry, MemoryBankError>
Sourcepub fn generate_filename(&self) -> String
pub fn generate_filename(&self) -> String
Generate a unique filename for this entry
Format: memory_YYYYMMDD_HHMMSS_<session-prefix>.md
§Examples
use gestura_core::memory_bank::MemoryBankEntry;
let entry = MemoryBankEntry::new(
"session-abc123".to_string(),
"Summary".to_string(),
"Content".to_string(),
);
let filename = entry.generate_filename();
// e.g., "memory_20260121_143022_session-a.md"
assert!(filename.starts_with("memory_"));
assert!(filename.ends_with(".md"));Sourcepub fn matches_query(&self, query: &MemoryBankQuery) -> bool
pub fn matches_query(&self, query: &MemoryBankQuery) -> bool
Return true when the entry satisfies the supplied filter.
Sourcepub fn score_against_query(&self, query: &MemoryBankQuery) -> MemorySearchResult
pub fn score_against_query(&self, query: &MemoryBankQuery) -> MemorySearchResult
Rank the entry against a targeted query.
Sourcepub fn to_prompt_section(&self, preview_chars: usize) -> String
pub fn to_prompt_section(&self, preview_chars: usize) -> String
Render a compact section suitable for prompt context.
Trait Implementations§
Source§impl Clone for MemoryBankEntry
impl Clone for MemoryBankEntry
Source§fn clone(&self) -> MemoryBankEntry
fn clone(&self) -> MemoryBankEntry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MemoryBankEntry
impl Debug for MemoryBankEntry
Source§impl<'de> Deserialize<'de> for MemoryBankEntry
impl<'de> Deserialize<'de> for MemoryBankEntry
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MemoryBankEntry, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MemoryBankEntry, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for MemoryBankEntry
impl PartialEq for MemoryBankEntry
Source§impl Serialize for MemoryBankEntry
impl Serialize for MemoryBankEntry
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for MemoryBankEntry
Auto Trait Implementations§
impl Freeze for MemoryBankEntry
impl RefUnwindSafe for MemoryBankEntry
impl Send for MemoryBankEntry
impl Sync for MemoryBankEntry
impl Unpin for MemoryBankEntry
impl UnwindSafe for MemoryBankEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].