Wire the knowledge file adapter and a runtime path selector

main constructs the FileSource (default via ANTIDRIFT_KNOWLEDGE_FILE)
and injects it. Adds POST /knowledge/path to repoint the profile file at
runtime, and web tests asserting the planning payload carries the
knowledge object (status + path, never the text) and that path selection
reloads.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 08:06:10 -04:00
parent 8bd37ed46d
commit b1b807590c
3 changed files with 83 additions and 1 deletions
+8
View File
@@ -12,6 +12,7 @@ import (
"antidrift/internal/ai"
"antidrift/internal/evidence"
"antidrift/internal/knowledge"
"antidrift/internal/session"
"antidrift/internal/statusfile"
"antidrift/internal/store"
@@ -54,6 +55,13 @@ func main() {
ctrl.SetTasks(tasks.NewMarvin(os.Getenv("ANTIDRIFT_MARVIN_CMD")))
log.Printf("tasks: marvin adapter (am)")
// Wire the Knowledge port: a single profile file grounding the coach. The
// default path is overridable with ANTIDRIFT_KNOWLEDGE_FILE; unset falls back
// to ~/.antidrift/knowledge.md. A missing/unreadable file degrades to an
// ungrounded coach at load time — planning still works.
ctrl.SetKnowledge(knowledge.NewFileSource(os.Getenv("ANTIDRIFT_KNOWLEDGE_FILE")))
log.Printf("knowledge: file adapter")
// Mirror runtime status to ~/.antidrift_status for a window-manager bar.
// A misconfigured home dir degrades to no status file, not a failed start.
if statusPath, err := statusfile.DefaultPath(); err != nil {