Expand description
Pattern learning infrastructure for dynamically discovering new tool patterns
This module implements a learning system that observes tool usage in Bash commands, identifies patterns, and promotes frequently-seen patterns to learned patterns.
§Architecture
PatternLearner: Main learning system with voting-based promotionCandidatePattern: Tracks observations and category votes for unknown toolsLearnedPattern: Promoted patterns with confidence scores
§Example
use terraphim_session_analyzer::patterns::knowledge_graph::{PatternLearner, LearnedPattern};
use terraphim_session_analyzer::models::ToolCategory;
let mut learner = PatternLearner::new();
// Observe tool usage
learner.observe(
"pytest".to_string(),
"pytest tests/".to_string(),
ToolCategory::Testing
);
// After multiple observations, promote to learned patterns
let learned = learner.promote_candidates();Structs§
- Candidate
Pattern - A candidate pattern being observed
- Learned
Pattern - A learned pattern that has been promoted
- Pattern
Learner - Learn new tool patterns from usage
Functions§
- infer_
category_ from_ contexts - Infer category from tool name and command contexts using heuristics