M2: wire planning coach backend into the daemon with graceful fallback

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 14:21:37 -04:00
parent c61c9d46b1
commit b51ad45c10
+12
View File
@@ -5,10 +5,12 @@ package main
import (
"context"
"log"
"os"
"os/exec"
"runtime"
"time"
"antidrift/internal/ai"
"antidrift/internal/evidence"
"antidrift/internal/session"
"antidrift/internal/store"
@@ -30,6 +32,16 @@ func main() {
srv := web.NewServer(ctrl)
srv.Init() // re-arm or expire a restored Active session
// Wire the AI planning coach. Backend selectable via ANTIDRIFT_AI_BACKEND
// (claude default, or codex). Misconfiguration degrades to no coach rather
// than failing startup — manual planning still works.
if backend, err := ai.NewBackend(os.Getenv("ANTIDRIFT_AI_BACKEND")); err != nil {
log.Printf("ai coach disabled: %v", err)
} else {
ctrl.SetCoach(ai.NewService(backend))
log.Printf("ai coach: %s backend", backend.Name())
}
src := evidence.NewSource()
go src.Watch(context.Background(), ctrl.RecordWindow)