Expand description
The token governor (RFC 0026 §7, plan §3.17): windowed, durable token/
request budgets that pace how fast an instance burns intelligence, with the
tactics wait | slow | degrade | refuse | fail when a window is exhausted.
- Windows —
intelligence.budget.windows[]:{per: second|minute|hour| day|week, tokens?, requests?, reset?}. Every window is a fixed window aligned to its unit (a rollingsecond|minute|hourwindow is the current unit-aligned bucket; a calendarday|weekwindow resets atresetHH:MMZ, default00:00Z, weeks on Monday). Counters{index, tokens, requests}are durable in the manifest (RFC 0025 §3.3): a restart never re-opens a spent daily budget. - Scopes — the instance governor plus optional sub-budgets per run /
conversation / principal (
Governor::admittakes the applicable scoped budgets); the tightest applicable window wins. - Reservation —
admitreserves an estimate against every window; the reported usagesettles it (replacing the estimate). - Lifetime —
lifetime_tokensis the hard ceiling (alwaysfail).
Pure and clock-injected (now_ms) — the runtime feeds it, the manifest
stores it, agent://budget reads it.
Structs§
- Governor
- The governor: the instance scope + named sub-scopes.
- Window
State - One window’s durable counters.
Enums§
- Admission
- The verdict of an admission request.
Functions§
- parse_
reset - Parse
HH:MMZ(orHH:MM) into ms after midnight.