feat: add retrospective MCP tool

Adds internal/skills/retrospective/ — an MCP skill that reads a session
log and dispatches a worker subprocess (via ExecutorFn) to identify
learnings and write them to the brain. Follows the same executor pattern
as the TDD skill.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mathias Bergqvist
2026-04-17 20:45:22 +02:00
parent a2889645fc
commit 13ee0d7114
3 changed files with 169 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
// internal/skills/retrospective/skill.go
package retrospective
import (
"context"
"encoding/json"
iexec "github.com/mathiasbq/supervisor/internal/exec"
"github.com/mathiasbq/supervisor/internal/registry"
)
// ExecutorFn allows injecting a test double for the subprocess executor.
type ExecutorFn func(ctx context.Context, req iexec.Request) (iexec.Result, error)
// Config holds retrospective skill configuration.
type Config struct {
SkillPrompt string // content of retrospective.md
DefaultModel string // model to use when not specified in args
SessionsDir string // path to brain/sessions/
ExecutorFn ExecutorFn // injected executor
}
// Skill implements registry.Skill for the retrospective tool.
type Skill struct {
cfg Config
}
// New constructs a retrospective Skill.
func New(cfg Config) *Skill { return &Skill{cfg: cfg} }
// Name returns the skill name.
func (s *Skill) Name() string { return "retrospective" }
// Tools returns the MCP tool definitions.
func (s *Skill) Tools() []registry.ToolDef {
return []registry.ToolDef{
{
Name: "retrospective",
Description: "Run a retrospective on a completed session. Reads the session log, identifies novel learnings, and writes structured entries to the brain for ingestion. Call at the end of each coding session.",
InputSchema: json.RawMessage(`{
"type": "object",
"required": ["session_id"],
"properties": {
"session_id": {"type": "string"},
"model": {"type": "string"}
}
}`),
},
}
}