# Architecture: hyper-p2p-sla-budget **Category:** measurement-rate-control **Protocol:** `sla-budget/v1` (local-only) ## Purpose Token-bucket style SLA budgets per named service. ## Wire messages | type | fields | behavior | |------|--------|----------| | — | — | Local accounting only | ## Service record ``` { remaining: number, total: number } ``` ## consume decision ``` if !service or remaining < n → reject + emit reject else remaining -= n → consume + emit consume ``` ## Stats | Field | Meaning | |-------|---------| | `allocated` | `allocate` calls | | `consumed` | successful `consume` | | `rejected` | denied `consume` | ## Composition - Drive `consume` from middleware after `hyper-p2p-percentile-sketch` detects p99 regression - Reset budgets on epoch boundaries in app cron - Distinct from `hyper-p2p-bucket-rate-limit` (time-window rate) — this is cumulative budget ## Limits - No automatic refill (call `allocate` for top-ups) - No cross-peer sync