Documentation
¶
Index ¶
- type Config
- type Experience
- type Feedback
- type LearnedSkill
- type Manager
- func (m *Manager) GetPatterns(minConfidence float64) []*Pattern
- func (m *Manager) GetRecommendations(task string) []string
- func (m *Manager) GetSkill(name string) *LearnedSkill
- func (m *Manager) GetStats() *Stats
- func (m *Manager) ImproveSkill(skillID string, feedback Feedback) error
- func (m *Manager) ListSkills() []*LearnedSkill
- func (m *Manager) Load() error
- func (m *Manager) RecordExperience(exp Experience) error
- func (m *Manager) Save() error
- type Pattern
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Enabled bool `yaml:"enabled"`
AutoLearn bool `yaml:"auto_learn"` // Automatically create skills
MinConfidence float64 `yaml:"min_confidence"` // Min confidence to suggest
MaxExperiences int `yaml:"max_experiences"` // Max experience entries
SkillThreshold int `yaml:"skill_threshold"` // Experiences before creating skill
PatternMinOccur int `yaml:"pattern_min_occur"` // Occurrences before pattern
LearnFromErrors bool `yaml:"learn_from_errors"` // Learn from failures too
}
Config holds learning configuration
type Experience ¶
type Experience struct {
ID string `json:"id"`
Timestamp int64 `json:"timestamp"`
Task string `json:"task"` // What was requested
Action string `json:"action"` // What was done
Success bool `json:"success"` // Whether it worked
ToolsUsed []string `json:"tools_used"` // Tools used
Skills []string `json:"skills"` // Skills invoked
Duration int64 `json:"duration"` // Time taken (ms)
Outcome string `json:"outcome"` // Result summary
Patterns []string `json:"patterns"` // Identified patterns
Improvements []string `json:"improvements"` // Suggested improvements
Metadata map[string]interface{} `json:"metadata"` // Additional data
}
Experience represents a learned experience
type LearnedSkill ¶
type LearnedSkill struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Content string `json:"content"`
Triggers []string `json:"triggers"` // What activates this skill
Examples []string `json:"examples"` // Usage examples
SuccessRate float64 `json:"success_rate"` // Historical success rate
UseCount int `json:"use_count"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Version int `json:"version"` // Iteration number
Tags []string `json:"tags"`
}
LearnedSkill represents an auto-generated skill
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles the learning loop
func NewManager ¶
NewManager creates a new learning manager
func (*Manager) GetPatterns ¶
GetPatterns returns patterns with confidence above threshold
func (*Manager) GetRecommendations ¶
GetRecommendations returns skill recommendations based on task
func (*Manager) GetSkill ¶
func (m *Manager) GetSkill(name string) *LearnedSkill
GetSkill returns a skill by name
func (*Manager) ImproveSkill ¶
ImproveSkill improves a skill based on usage
func (*Manager) ListSkills ¶
func (m *Manager) ListSkills() []*LearnedSkill
ListSkills returns all learned skills
func (*Manager) RecordExperience ¶
func (m *Manager) RecordExperience(exp Experience) error
RecordExperience records a new experience
type Pattern ¶
type Pattern struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Regex string `json:"regex"`
Confidence float64 `json:"confidence"` // 0.0-1.0
Occurrences int `json:"occurrences"` // Times seen
Actions []string `json:"actions"` // Recommended actions
CreatedAt int64 `json:"created_at"`
LastSeen int64 `json:"last_seen"`
}
Pattern represents a learned pattern
type Stats ¶
type Stats struct {
TotalExperiences int `json:"total_experiences"`
SuccessfulExp int `json:"successful_experiences"`
LearnedSkills int `json:"learned_skills"`
PatternsFound int `json:"patterns_found"`
TopPatterns []*Pattern `json:"top_patterns"`
TopSkills []*LearnedSkill `json:"top_skills"`
}
Stats returns learning statistics
Click to show internal directories.
Click to hide internal directories.