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:
49
internal/skills/sessionlog/skill.go
Normal file
49
internal/skills/sessionlog/skill.go
Normal 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"}
|
||||
}
|
||||
}`),
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user