pub struct GanaRegistry { /* private fields */ }Expand description
Tracks co-usage patterns between Ganas and allows taxonomy drift.
When two Ganas are frequently used together (e.g., memory.create + memory.search), the registry records the co-usage. Over time, if a Gana pair exceeds a threshold, the registry can suggest merging or reorganizing the taxonomy.
This implements the “mutable structures” principle: the taxonomy itself becomes a learnable structure rather than a fixed design decision.
Implementations§
Source§impl GanaRegistry
impl GanaRegistry
Sourcepub fn with_threshold(drift_threshold: u64) -> Self
pub fn with_threshold(drift_threshold: u64) -> Self
Create a registry with a custom drift threshold.
Sourcepub fn record_usage(&mut self, gana: Gana, success: bool)
pub fn record_usage(&mut self, gana: Gana, success: bool)
Record a tool dispatch within a Gana.
Sourcepub fn record_co_usage(&mut self, gana_a: Gana, gana_b: Gana)
pub fn record_co_usage(&mut self, gana_a: Gana, gana_b: Gana)
Record co-usage of two Ganas in the same session/context.
Sourcepub fn success_rate(&self, gana: Gana) -> f32
pub fn success_rate(&self, gana: Gana) -> f32
Get the success rate for a Gana.
Sourcepub fn usage_count(&self, gana: Gana) -> u64
pub fn usage_count(&self, gana: Gana) -> u64
Get the usage count for a Gana.
Sourcepub const fn usage_counts(&self) -> &HashMap<u8, u64>
pub const fn usage_counts(&self) -> &HashMap<u8, u64>
Get all usage counts (Gana index → count).
Sourcepub const fn co_usage(&self) -> &HashMap<String, u64>
pub const fn co_usage(&self) -> &HashMap<String, u64>
Get all co-usage counts (string key “a:b” → count).
Sourcepub fn co_usage_count(&self, gana_a: Gana, gana_b: Gana) -> u64
pub fn co_usage_count(&self, gana_a: Gana, gana_b: Gana) -> u64
Get the co-usage count between two Ganas.
Sourcepub fn suggested_merges(&self) -> &[GanaMerge]
pub fn suggested_merges(&self) -> &[GanaMerge]
Get all suggested merges from drift analysis.
Sourcepub fn analyze_drift(&self, top_n: usize) -> Vec<GanaMerge>
pub fn analyze_drift(&self, top_n: usize) -> Vec<GanaMerge>
Analyze drift and return the top N suggested reorganizations.
Sourcepub fn rebuild_pairs(&mut self)
pub fn rebuild_pairs(&mut self)
Rebuild the co_usage_pairs lookup from co_usage data.
Call this after deserializing a GanaRegistry, since co_usage_pairs
is skipped during serialization.
Trait Implementations§
Source§impl Clone for GanaRegistry
impl Clone for GanaRegistry
Source§fn clone(&self) -> GanaRegistry
fn clone(&self) -> GanaRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more