Skip to content

Feature request: Predictive usage alerts #20

Description

@symonbaikov

Summary

Add predictive alerts that warn users when they are on track to hit a provider usage limit before the next reset. This builds on the existing pace indicator and usage-history data to turn raw numbers into actionable warnings.

Why

Right now users can see current usage and a pace indicator, but they have to do the math themselves to understand whether they will run out of quota before it resets. A simple projection removes the guesswork and prevents unexpected cutoffs in the middle of work.

How it should work

  1. Projection source

    • Use the existing per-metric used/limit values from the latest probe.
    • Use the existing pace data (or derive velocity from usage-history.json snapshots).
    • Use resetsAt / periodDurationMs from the progress line to know the time window.
  2. Prediction calculation

    • Compute average consumption per hour over the last N snapshots (e.g. last 24h or since reset, whichever is shorter).
    • Extrapolate to resetsAt.
    • If projected used >= limit, calculate the estimated depletion time.
  3. Alert thresholds

    • Predict depletion within 24 hours → warning notification.
    • Predict depletion within 4 hours → critical notification.
    • Optional per-provider setting to disable or change thresholds.
  4. Notification content examples

    • "Claude session: at current pace you will hit the limit around 18:00 today."
    • "Cursor credits: projected to run out in ~3 hours."
    • "Codex weekly: on track to exceed the limit by tomorrow morning."
  5. Where to surface

    • OS notification (will require adding the Tauri notification plugin).
    • Inline warning badge on the provider card in the panel.
    • Optional "Predictions" section in provider detail.
  6. Dampening / noise control

    • Send at most one alert per provider per metric per day.
    • Re-check only after each successful probe or when pace changes significantly.
    • Do not alert if usage is flat or data is insufficient (<3 snapshots).

UI / settings

  • Add a global toggle: "Predictive alerts" in Settings.
  • Add per-provider toggles in provider settings or context menu.
  • Allow choosing thresholds: 24h / 12h / 4h / 1h before depletion.

Acceptance criteria

  • Depletion time is estimated from existing history/pace data.
  • OS notification is shown when a provider is predicted to hit its limit within the configured threshold.
  • Alerts respect a daily cooldown per provider/metric.
  • Users can enable/disable alerts globally and per provider.
  • No alert is shown when there is not enough data to make a reliable projection.

Related code / files

  • Pace indicator: src/components/provider-card.tsx
  • Usage history storage: src-tauri/src/local_http_api/usage_history.rs
  • Plugin runtime output (progress lines): src-tauri/src/plugin_engine/runtime.rs
  • Settings persistence: src/lib/settings.ts
  • Notifications would need Tauri notification plugin.

Mock alert message

Claude session limit expected today
At your current pace the session quota will be used around 18:00, before the daily reset at 21:00.
[Open OpenUsage] [Dismiss]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions