From a779568622d1ce461bbea443919f9b6b270c2430 Mon Sep 17 00:00:00 2001 From: Mikhail Date: Sat, 29 Aug 2026 11:28:05 +0300 Subject: [PATCH] GEN2-018: add bounded perspectives over Work Graph --- contracts/work/perspective.go | 26 +++++++++++++++++++++++++ dev/ACTIVE_TASK.json | 2 +- modules/work/domain/perspective.go | 17 ++++++++++++++++ modules/work/domain/perspective_test.go | 17 ++++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 contracts/work/perspective.go create mode 100644 modules/work/domain/perspective.go create mode 100644 modules/work/domain/perspective_test.go diff --git a/contracts/work/perspective.go b/contracts/work/perspective.go new file mode 100644 index 0000000..bc4de0f --- /dev/null +++ b/contracts/work/perspective.go @@ -0,0 +1,26 @@ +package work + +type PerspectiveID string +type PerspectiveSpec struct { + ID PerspectiveID + ObjectiveLens string + RetrievalProfileRef string + EvaluationCriteria []string + CapabilityRequirements []string + ExpectedOutputShape string + Critic bool +} +type SpecialistAssignment struct { + Perspective PerspectiveSpec + SubtaskRef string + EvidenceRefs []EvidenceRef +} +type TeamDecision struct { + UseTeam bool + Reason string + Assignments []SpecialistAssignment +} + +func (p PerspectiveSpec) Valid() bool { + return p.ID != "" && p.ObjectiveLens != "" && len(p.EvaluationCriteria) > 0 && p.ExpectedOutputShape != "" +} diff --git a/dev/ACTIVE_TASK.json b/dev/ACTIVE_TASK.json index 688a1fc..3935773 100644 --- a/dev/ACTIVE_TASK.json +++ b/dev/ACTIVE_TASK.json @@ -1 +1 @@ -{"task_file":"dev/tasks/GEN2-017-extend-work-into-durable-longrunningwork-investigation.json","task_id":"GEN2-017","task_revision":1} +{"task_file":"dev/tasks/GEN2-018-add-perspective-and-dynamic-specialist-team-semantics-on-existing-work-g.json","task_id":"GEN2-018","task_revision":1} \ No newline at end of file diff --git a/modules/work/domain/perspective.go b/modules/work/domain/perspective.go new file mode 100644 index 0000000..e6f1486 --- /dev/null +++ b/modules/work/domain/perspective.go @@ -0,0 +1,17 @@ +package domain + +import "git.cin.su/m/Assistant/contracts/work" + +func AssembleSpecialists(p work.PerspectiveSpec, subtasks []string) work.TeamDecision { + if !p.Valid() { + return work.TeamDecision{Reason: "invalid perspective"} + } + if len(subtasks) < 2 { + return work.TeamDecision{Reason: "single reasoning path is sufficient"} + } + assignments := make([]work.SpecialistAssignment, 0, len(subtasks)) + for _, s := range subtasks { + assignments = append(assignments, work.SpecialistAssignment{Perspective: p, SubtaskRef: s}) + } + return work.TeamDecision{UseTeam: true, Reason: "independent subtasks justify bounded perspectives", Assignments: assignments} +} diff --git a/modules/work/domain/perspective_test.go b/modules/work/domain/perspective_test.go new file mode 100644 index 0000000..05c5061 --- /dev/null +++ b/modules/work/domain/perspective_test.go @@ -0,0 +1,17 @@ +package domain_test + +import ( + "git.cin.su/m/Assistant/contracts/work" + "git.cin.su/m/Assistant/modules/work/domain" + "testing" +) + +func TestPerspectiveTeamIsBoundedByIndependentSubtasks(t *testing.T) { + p := work.PerspectiveSpec{ID: "architect", ObjectiveLens: "architecture", EvaluationCriteria: []string{"correctness"}, ExpectedOutputShape: "finding"} + if d := domain.AssembleSpecialists(p, []string{"a"}); d.UseTeam { + t.Fatal("team for one subtask") + } + if d := domain.AssembleSpecialists(p, []string{"a", "b"}); !d.UseTeam || len(d.Assignments) != 2 { + t.Fatalf("%#v", d) + } +}