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

@@ -6,6 +6,7 @@ import (
"fmt"
"time"
"github.com/mathiasbq/supervisor/internal/brain"
iexec "github.com/mathiasbq/supervisor/internal/exec"
"github.com/mathiasbq/supervisor/internal/session"
)
@@ -41,10 +42,15 @@ func (s *Skill) handleRed(ctx context.Context, raw json.RawMessage) (json.RawMes
if args.Spec == "" {
return nil, fmt.Errorf("spec is required")
}
brainCtx, _ := brain.Query(ctx, s.cfg.IngestBaseURL, args.Spec, 3)
task := fmt.Sprintf(
"phase: red\nproject_root: %s\nspec: %s\nmodel: %s\ntest_cmd: %s",
args.ProjectRoot, args.Spec, s.resolveModel(args.Model), args.TestCmd,
)
if brainCtx != "" {
task = brainCtx + "\n---\n\n" + task
}
return s.execute(ctx, task)
}

View File

@@ -12,11 +12,12 @@ import (
type ExecutorFn func(ctx context.Context, req iexec.Request) (iexec.Result, error)
type Config struct {
SystemPrompt string
SkillPrompt string
ExecutorFn ExecutorFn // nil = no executor (tests that don't reach execute())
DefaultModel string
SessionsDir string // optional: path to brain/sessions/ for history injection
SystemPrompt string
SkillPrompt string
ExecutorFn ExecutorFn // nil = no executor (tests that don't reach execute())
DefaultModel string
SessionsDir string // optional: path to brain/sessions/ for history injection
IngestBaseURL string // optional: base URL of ingestion server for brain context
}
type Skill struct {