Skip to content

[feature] Weekly leaderboard view #5

Description

@EvanPaules

The all-time board stratifies as early players pile up XP. A weekly view keeps it competitive.

Idea

claudexp board --weekly shows the top XP gained in the last 7 days, resetting on Monday.

Implementation paths

Two options, pick one in the PR:

MVP (local only): the local ~/.claudexp/data.db already tracks every session with a timestamp. Sum sessions where ended_at >= now() - 7 days per user. Only works for your own row, but is zero-backend and ships in ~20 LOC.

Full (cloud): append-only session_events table on Supabase with (username, xp_delta, at) rows, written by hook.js after the scored total is known. The weekly board is a single query: select username, sum(xp_delta) from session_events where at >= now() - interval '7 days' group by username order by sum desc. Requires RLS: anyone can insert where username = their own + owner token matches; anyone can select all.

Open questions

  • Week boundary: UTC Mon-Sun vs local time?
  • Also add --monthly? (trivial if weekly works)
  • If we go full-cloud, what's the retention policy on session_events? (e.g., delete rows older than 60 days to keep the table tiny)

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

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions