Mirror runtime status to ~/.antidrift_status

A window-manager status bar can now read a single-line status file: a
glyph plus minutes-remaining (● 24m / ⚠ DRIFT 24m / ● 24m ·? / ◔ planning
/ ✓ review), empty when idle. Rewritten on a one-minute tick, only when
the line changes, and removed on shutdown. Degrades to no file if $HOME
is unresolvable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 20:49:48 -04:00
parent 19654c2b57
commit 097678e839
3 changed files with 251 additions and 0 deletions
+10
View File
@@ -13,6 +13,7 @@ import (
"antidrift/internal/ai"
"antidrift/internal/evidence"
"antidrift/internal/session"
"antidrift/internal/statusfile"
"antidrift/internal/store"
"antidrift/internal/web"
)
@@ -45,6 +46,15 @@ func main() {
log.Printf("ai: %s backend (coach + drift judge + nudge)", backend.Name())
}
// 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 {
log.Printf("status file disabled: %v", err)
} else {
go statusfile.NewWriter(statusPath, ctrl.State).Run(context.Background())
log.Printf("status: writing %s", statusPath)
}
src := evidence.NewSource()
go src.Watch(context.Background(), ctrl.RecordWindow)