You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Subscription-window usage metering across hosts and machines, for Prism #6
Agent Observer meters subscription usage per provider, model, and window (5-hour, weekly, monthly, per model and per plan) across every session it can see on every host and machine, learns the real window semantics from recorded limit events and resets, shows headroom, alerts when a window is close, and feeds Model Router's capacity ledger with advisory evidence through the router's external-evidence interface (toolboxmd/model-router#34).
Why
Model Router only sees the sessions it starts. On 2026-09-20 the OpenCode Go 5-hour limit was spent mostly by manual and body sessions the router never saw, and two long sessions went silent instead of reporting the limit. Only the observer has the full picture; the router keeps routing on its own evidence, and the observer's feed makes it smarter, never dependent.
Acceptance criteria
Sources: OpenCode's session database (cost, tokens, model per session), Codex rollouts, Claude Code transcripts, and the router's ledger; each usage record carries its source semantics (measured, provider-reported, estimated).
Rolling sums per provider, model, and window, compared with the plan's tiers; the tiers and window semantics are stored as assumptions until verified by recorded limit events and resets, then marked verified or corrected.
Headroom is visible per model and window; an alert fires at a configurable margin.
Advisory feed: when the observer knows a route is exhausted or close, it writes evidence to the router's external-evidence interface with source and until; it never routes and the router never blocks on it.
Deterministic tests with recorded fixtures from the sources above.
Finding from the prior-art research: the window evidence is already in local files. Claude Code transcripts carry quotaLimits with rateLimitType five_hour and resetsAt; Codex rollouts carry rate_limits.primary with used_percent, window_minutes, resets_at, and plan_type. Metering can start from those plus OpenCode's per-message cost, with claude-monitor's P90 discovery for learned window semantics and CodexBar JSON as a cross-check.
Context update (2026-10-12): the Objective now covers rocky, cavallo and bestia, each running its own Observer (#55). Combining evidence across machines is tracked in #56; this Issue's "every host and machine" metering can consume that instead of building its own transport.
Backlog review 2026-10-19 (Warsaw): left open for a user decision. The advisory feed to Model Router is obsolete (Model Router is archived; Chromeria's Prism absorbed it), and cross-machine combination landed in #56. What remains is subscription-window metering and headroom, which no current Issue or Prism component owns and the current Objective does not name. Decision needed: re-scope this to metering with an advisory feed to Prism (filed in Chromeria), or close it.
changed the title [-]Usage metering across hosts and machines, and an advisory capacity feed to Model Router[/-][+]Subscription-window usage metering across hosts and machines, for Prism[/+]on Oct 19, 2026
Rescoped by the user's decision (2026-10-19). Model Router is archived, so the advisory feed to its capacity ledger (model-router#34) is dropped. The metering outcome stays (per provider, model and window, with headroom and alerts); its consumer becomes Prism's capacity choices. The 'Advisory feed' criterion and the Router ledger source need rewriting against Prism's interface before implementation.
Evidence for the rescope (bestia, 2026-10-19): Codex rollouts carry account rate-limit snapshots that Observer ignores (48,868 occurrences across 1,008 source sessions; no quota events in the ledger). Parsing those as account and window evidence, without attributing them to tasks, is the first source for this Issue. Claude, Grok and OpenCode show no quota-family evidence (232, 17,402 and 70 sessions); whether their records hold any is unknown.
Activity
lukemaj commentedon Sep 20, 2026
Finding from the prior-art research: the window evidence is already in local files. Claude Code transcripts carry quotaLimits with rateLimitType five_hour and resetsAt; Codex rollouts carry rate_limits.primary with used_percent, window_minutes, resets_at, and plan_type. Metering can start from those plus OpenCode's per-message cost, with claude-monitor's P90 discovery for learned window semantics and CodexBar JSON as a cross-check.
lukemaj commentedon Oct 12, 2026
Context update (2026-10-12): the Objective now covers rocky, cavallo and bestia, each running its own Observer (#55). Combining evidence across machines is tracked in #56; this Issue's "every host and machine" metering can consume that instead of building its own transport.
lukemaj commentedon Oct 19, 2026
Backlog review 2026-10-19 (Warsaw): left open for a user decision. The advisory feed to Model Router is obsolete (Model Router is archived; Chromeria's Prism absorbed it), and cross-machine combination landed in #56. What remains is subscription-window metering and headroom, which no current Issue or Prism component owns and the current Objective does not name. Decision needed: re-scope this to metering with an advisory feed to Prism (filed in Chromeria), or close it.
[-]Usage metering across hosts and machines, and an advisory capacity feed to Model Router[/-][+]Subscription-window usage metering across hosts and machines, for Prism[/+]lukemaj commentedon Oct 19, 2026
Rescoped by the user's decision (2026-10-19). Model Router is archived, so the advisory feed to its capacity ledger (model-router#34) is dropped. The metering outcome stays (per provider, model and window, with headroom and alerts); its consumer becomes Prism's capacity choices. The 'Advisory feed' criterion and the Router ledger source need rewriting against Prism's interface before implementation.
lukemaj commentedon Oct 19, 2026
Evidence for the rescope (bestia, 2026-10-19): Codex rollouts carry account rate-limit snapshots that Observer ignores (48,868 occurrences across 1,008 source sessions; no
quotaevents in the ledger). Parsing those as account and window evidence, without attributing them to tasks, is the first source for this Issue. Claude, Grok and OpenCode show no quota-family evidence (232, 17,402 and 70 sessions); whether their records hold any is unknown.