M5 is complete. THALIOX now governs itself with a learned, falsifiable, fully in-system control plane (RFC-0007) — "AI manages AI" as a running loop, not a slogan.
The four stages
- M5a — the closed loop (
runtime::control): observe the cluster as a fixed-width state vector → a swappablePolicy(transparent heuristic baseline) → actuate only through M1–M4's invariant-guarded mechanisms (self_heal/migrate/ budget grants). The plane invents no new way to touch an agent. - M5b — the governor is an agent (
Governor): it thinks (spends budget, INV-1 — starved ⇒ governs nothing), acts under capability (INV-2 — out-of-scope ⇒ denied), is audited (INV-4), with Shadow / Canary / Act modes gated in-system. No human floor, no master key (INV-5 self-sovereignty). - M5c — the learned policy π_θ + falsification gate E5 (
runtime::learn): trained in a deterministic cluster simulator seeded from replayed audit traces (the INV-4 ledger is the dataset); invariants are action-space masks, never reward terms; reward = budget-efficiency under a hard survival floor. π_θ may not actuate until it strictly beats the heuristic baseline on a held-out suite with zero violations — then it is promoted Shadow → Canary → Act and auto-demoted on any regression, no human on any rung. - M5d — self-optimization: the refill becomes a learned, graded adaptive-compute knob (50/100/200 tokens, priced by per-actuation overhead — the first concrete F10 step), and the self-update verdict (promote or roll back a staged candidate generation, real
update.rsmechanism underneath) is decided from observed post-update yield instead of a hand-set threshold.
The gate, passed in CI
On the held-out suite π_θ scores 0.719 vs the heuristic's 0.631 mean budget-efficiency, zero invariant violations, full survival; on the update scenario it concludes all 8 hidden-quality candidates (4 promoted, 4 rolled back) while the verdict-less baseline leaves them dangling (0.772 vs 0.612).
All four gates green: fmt · clippy -D warnings · test (127) · doc -D warnings.
Next: M6 — H2 begins, pushing the stack down.