feat: add tier and session_log MCP tools

Adds two new MCP skill packages:
- internal/skills/org: exposes the tier tool, calling an injected TierFn
  for testability; returns current operating tier as structured JSON
- internal/skills/sessionlog: exposes the session_log tool, appending
  structured JSONL entries to brain/sessions/{session_id}.jsonl; requires
  session_id, wraps internal/session.Append

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mathias Bergqvist
2026-04-17 20:40:50 +02:00
parent e610e253ef
commit 9cfce8f700
6 changed files with 237 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
// internal/skills/sessionlog/skill.go
package sessionlog
import (
"encoding/json"
"github.com/mathiasbq/supervisor/internal/registry"
)
// Config holds sessionlog skill configuration.
type Config struct {
SessionsDir string // path to brain/sessions/
}
// Skill implements registry.Skill for the session_log tool.
type Skill struct {
cfg Config
}
// New constructs a sessionlog Skill.
func New(cfg Config) *Skill { return &Skill{cfg: cfg} }
// Name returns the skill name.
func (s *Skill) Name() string { return "sessionlog" }
// Tools returns the MCP tool definitions.
func (s *Skill) Tools() []registry.ToolDef {
return []registry.ToolDef{
{
Name: "session_log",
Description: "Append a structured entry to the current session log. Call after each skill invocation completes to record what happened for retrospective and training data extraction.",
InputSchema: json.RawMessage(`{
"type": "object",
"required": ["session_id"],
"properties": {
"session_id": {"type": "string"},
"skill": {"type": "string"},
"phase": {"type": "string"},
"project_root": {"type": "string"},
"final_status": {"type": "string"},
"file_path": {"type": "string"},
"model_used": {"type": "string"},
"duration_ms": {"type": "integer"},
"message": {"type": "string"}
}
}`),
},
}
}