Skip to content

Feature request: calendar month-to-date option for the cost reporting period #2087

Description

@kcharlan

Problem

Cost reporting (menus, inline dashboards, cost submenus/charts, widgets, and codexbar cost) is always a rolling
last-N-days window. Many of us budget against calendar months — provider billing cycles, employer expense periods,
and personal budgets all reset on the 1st — so "spend in the last 30 days" and "spend this month" can differ
substantially mid-month. There's currently no way to see month-to-date cost without exporting and computing it
externally.

Related precedent: #689 established calendar-month pacing for Copilot premium usage. This proposal generalizes the
same idea to the shared cost reporting period.

Proposed behavior

Add a user-selectable cost reporting period with two modes:

  • Rolling last N days (current behavior, remains the default — no change for existing users)
  • Month to date (current local calendar month, resolved against a per-operation "now" rather than a cached
    startup clock)

The saved selection applies consistently everywhere a cost period is shown or computed: shared cost menus, inline
dashboards, cost submenus and charts, widgets, CLI default output, project breakdowns, labels, and totals.

CLI precedence: an explicit codexbar cost --days N always selects a rolling N-day window and overrides the saved
month-to-date setting, so scripts keep deterministic behavior.

Design considerations (from a working prototype implementation)

I have this implemented and validated in a prototype. The sharp edges this surfaced:

  1. Cache identity must include the semantic window. Fetch and /cost serve-cache keys need the resolved period
    (e.g. calendar-month:2026-07) so a mode switch never relabels data fetched for a different window, and failed
    refreshes must not strand the new period with a stale snapshot from the old one.
  2. Provider aggregation must be window-aligned. Totals, tokens, requests, charts, and top-model facts should all
    derive from entries in the same resolved window. Providers that return pre-aggregated values (e.g. Mistral) need
    to recompute aggregates from daily buckets when a sub-window is selected.
  3. JSON/API compatibility. Existing last30Days... JSON field names can remain as compatibility aliases while
    new period-neutral names are introduced, so downstream consumers (Waybar/GNOME/KDE integrations, showy-quota)
    don't break.
  4. Widget/app localization parity. The period labels ("Month to date", etc.) need matching entries in both the
    app and widget-extension locale catalogs across all 23 locales.

I suggest focused test coverage for the period resolver, CLI precedence, serve-cache identity, and widget
snapshot/localization behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions