pub struct ThoughtGraphState {
pub nodes: Vec<ThoughtNode>,
pub edges: HashMap<(u64, u64), ThoughtEdge>,
pub patterns: Vec<ThoughtPattern>,
pub current_session_id: u32,
/* private fields */
}Fields§
§nodes: Vec<ThoughtNode>§edges: HashMap<(u64, u64), ThoughtEdge>§patterns: Vec<ThoughtPattern>§current_session_id: u32Implementations§
Source§impl ThoughtGraphState
impl ThoughtGraphState
pub fn load_or_init(output_dir: &Path) -> Self
Sourcepub fn record_recall(
&mut self,
query_hash: u64,
results: &[(u32, f32)],
dominant_layer: u8,
) -> u32
pub fn record_recall( &mut self, query_hash: u64, results: &[(u32, f32)], dominant_layer: u8, ) -> u32
Record a recall event. Returns session_id.
Sourcepub fn detect_patterns(&mut self)
pub fn detect_patterns(&mut self)
Detect and crystallize patterns from recent session history. Uses sliding-window n-gram (lengths 2..=5) on the current session’s recalls.
Sourcepub fn pattern_boost(&self, current_query_hash: u64) -> Vec<(u32, f32)>
pub fn pattern_boost(&self, current_query_hash: u64) -> Vec<(u32, f32)>
Compute pattern boost for a new query. Checks if recent session recalls + this query form a known pattern prefix/match. Returns block indices with boost scores.
Sourcepub fn update_pattern_blocks(&mut self, query_hash: u64, result_blocks: &[u32])
pub fn update_pattern_blocks(&mut self, query_hash: u64, result_blocks: &[u32])
Update pattern result blocks with the actual results from a recall. Called after record_recall when a pattern was matched.
Sourcepub fn top_patterns(&self, n: usize) -> Vec<&ThoughtPattern>
pub fn top_patterns(&self, n: usize) -> Vec<&ThoughtPattern>
Top patterns by strength * frequency.
Sourcepub fn crystallized_count(&self) -> usize
pub fn crystallized_count(&self) -> usize
Crystallized patterns (frequency >= PATTERN_MIN_FREQ).
Sourcepub fn current_path(&self) -> Vec<&ThoughtNode>
pub fn current_path(&self) -> Vec<&ThoughtNode>
Get current session’s recall path.
Sourcepub fn recent_sessions(&self, n: usize) -> Vec<Vec<&ThoughtNode>>
pub fn recent_sessions(&self, n: usize) -> Vec<Vec<&ThoughtNode>>
Get recent sessions (unique session IDs, most recent first).
Sourcepub fn export_patterns(&self) -> Vec<&ThoughtPattern>
pub fn export_patterns(&self) -> Vec<&ThoughtPattern>
Export crystallized patterns for cross-instance exchange.
Sourcepub fn import_patterns(&mut self, patterns: &[ThoughtPattern], trust: f32)
pub fn import_patterns(&mut self, patterns: &[ThoughtPattern], trust: f32)
Import patterns from a remote instance with trust weighting.
Sourcepub fn stats(&self) -> ThoughtGraphStats
pub fn stats(&self) -> ThoughtGraphStats
Stats summary.
Auto Trait Implementations§
impl Freeze for ThoughtGraphState
impl RefUnwindSafe for ThoughtGraphState
impl Send for ThoughtGraphState
impl Sync for ThoughtGraphState
impl Unpin for ThoughtGraphState
impl UnsafeUnpin for ThoughtGraphState
impl UnwindSafe for ThoughtGraphState
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> 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