Skip to content

Surface rate-limit percentages (5h/7d) in dashboard #17

@roeimichael

Description

@roeimichael

Problem

The statusline hook captures rate_limit_five_hour_pct and rate_limit_seven_day_pct, but this data is not stored in the token_snapshots table — it's rendered once in the statusline and then lost. Users approaching their 5-hour or 7-day rate limits have no historical visibility or dashboard warning. For many users, this is more important than context-window percentage.

What to do

  1. Add a v7 migration to src/context_analyzer_tool/db/schema.py:
    • Add rate_limit_five_hour_pct REAL and rate_limit_seven_day_pct REAL columns to token_snapshots
  2. Persist the values in insert_snapshot() in src/context_analyzer_tool/db/events.py
  3. Pass them through from the route handler in routes.py
  4. Display in the TUI — add a rate-limit indicator to the sessions panel or header
  5. (Optional) Add threshold warnings similar to context-window warnings in context_warnings.py

Files to look at

  • src/context_analyzer_tool/db/schema.py — migration system
  • src/context_analyzer_tool/collector/models.pyStatuslineSnapshotRequest already has the fields
  • src/context_analyzer_tool/dashboard/tui.py — display layer

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: dashboardTUI dashboard and visualizationarea: databaseSQLite schema, queries, and migrationsdifficulty: intermediateRequires some familiarity with the codebaseenhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions