// internal/skills/trainer/skill.go package trainer import ( "context" "encoding/json" "github.com/mathiasbq/supervisor/internal/registry" ) // CompleteFunc is the function used to call a local model. type CompleteFunc func(ctx context.Context, model, system, user string) (string, int64, error) // Config holds dependencies for the trainer skill. type Config struct { ReaderPrompt string WriterPrompt string DefaultModel string CompleteFunc CompleteFunc SessionsDir string BrainDir string // root of brain/ directory } // Skill implements the trainer MCP tool. type Skill struct{ cfg Config } // New creates a new trainer Skill. func New(cfg Config) *Skill { return &Skill{cfg: cfg} } // Name returns the skill identifier. func (s *Skill) Name() string { return "trainer" } // Tools returns the MCP tool definitions for this skill. func (s *Skill) Tools() []registry.ToolDef { schema := func(required []string, props map[string]any) json.RawMessage { b, _ := json.Marshal(map[string]any{"type": "object", "required": required, "properties": props}) return b } return []registry.ToolDef{ { Name: "trainer", Description: "Consult a local model to identify learning moments from a session log and suggest knowledge to preserve in the brain.", InputSchema: schema( []string{"session_id"}, map[string]any{ "session_id": map[string]any{"type": "string"}, "model": map[string]any{"type": "string"}, }, ), }, } }