small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo

Quota #

The daemon polls supported accounts for provider-reported quota readings. These readings are separate from the token usage recorded for provider requests. quota.gleam owns discovery, scheduling, storage, and queries.

Accounts #

Provider extensions supply the accounts through QuotaPlugin sources. The daemon server passes every installed source to the poller, enabled or not, with the runtime's key environment. The poller hands that value to each source so key profiles find environment keys. enumerate collects each source's sign-in accounts first. It then asks the source of the extension each saved profile names for that profile's target. A target includes a provider, a non-secret account label, and credentials for the fetch. Discovery and individual polls run outside the poller actor. See enumerate and start_due, provider contributions, and authentication.

These extensions contribute sources today:

  • Claude, Codex, Google Antigravity, and OpenCode Go poll their sign-in accounts as anthropic, openai-codex, google-antigravity, and opencode-go.
  • An OpenCode Go key profile polls the first key it resolves to.
  • An OpenAI-compatible profile polls the feed its endpoint host names. The OpenAI extension maps the Hyper, DeepSeek, and Alibaba hosts.

Cadence #

The quota section of extensions.json defaults to enabled: true, pollSeconds: 600, and busyPollSeconds: 120. The poller reloads settings each round. It clamps the ordinary interval to 1 through 86,400 seconds and the busy interval to 1 through the ordinary interval.

A successful report uses the busy interval if a limit is at least 80 percent used or resets within the next 15 minutes. Failed polls use exponential backoff based on the ordinary interval, with the exponent capped at six and the wait capped at one hour. See load_settings, wait_seconds, and is_busy.

Readings #

record stores one row per reported limit, or an error row with an empty limit ID when a report has no limits. Every returned report then runs its source's heal. Antigravity's quota_source heal updates account limit marks, including for reports with an error or no limits. Claude's heal marks a sign-in until the latest reset of a window at 100 percent and never clears a mark; see rotation. Empty reports prune expired marks and remove integer legacy global marks. The account policy owns reconciliation; the native adapter retains matching, locking, storage layout, and unknown fields. An omitted meter keeps its live mark. The recorded reading is the provider report, not an independently measured balance. See run and record.

Reading them back #

latest returns the latest row for each account, provider, and limit. It suppresses an empty-limit error row after a newer real limit reading for that account and provider. history returns newest-first rows with an ID cursor and can filter a provider, account, and limit trail. The daemon server exposes these queries through its HTTP API.