feat(skills): inject brain context into review, debug, spec, tdd before spawning workers

This commit is contained in:
Mathias Bergqvist
2026-04-22 15:37:56 +02:00
parent 3625e1268d
commit f2bc39b500
9 changed files with 66 additions and 34 deletions

View File

@@ -7,6 +7,7 @@ import (
"fmt"
"time"
"github.com/mathiasbq/supervisor/internal/brain"
iexec "github.com/mathiasbq/supervisor/internal/exec"
"github.com/mathiasbq/supervisor/internal/session"
)
@@ -40,11 +41,16 @@ func (s *Skill) Handle(ctx context.Context, tool string, args json.RawMessage) (
model = s.cfg.DefaultModel
}
brainCtx, _ := brain.Query(ctx, s.cfg.IngestBaseURL, a.Error+" "+a.Context, 3)
task := fmt.Sprintf(
"phase: debug\nproject_root: %s\nerror: %s\ncontext: %s\nmodel: %s",
a.ProjectRoot, a.Error, a.Context, model,
)
task = session.PrependHistory(s.cfg.SessionsDir, a.SessionID, "debug", task)
if brainCtx != "" {
task = brainCtx + "\n---\n\n" + task
}
if s.cfg.ExecutorFn == nil {
return nil, fmt.Errorf("no executor configured")

View File

@@ -14,10 +14,11 @@ type ExecutorFn func(ctx context.Context, req iexec.Request) (iexec.Result, erro
// Config holds dependencies for the debug skill.
type Config struct {
SkillPrompt string
DefaultModel string
ExecutorFn ExecutorFn
SessionsDir string
SkillPrompt string
DefaultModel string
ExecutorFn ExecutorFn
SessionsDir string
IngestBaseURL string // optional: base URL of ingestion server for brain context
}
// Skill implements the debug MCP tool.