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)
The all-time board stratifies as early players pile up XP. A weekly view keeps it competitive.
Idea
claudexp board --weeklyshows 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.dbalready tracks every session with a timestamp. Sum sessions whereended_at >= now() - 7 daysper user. Only works for your own row, but is zero-backend and ships in ~20 LOC.Full (cloud): append-only
session_eventstable on Supabase with(username, xp_delta, at)rows, written byhook.jsafter 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 caninsertwhereusername = their own+ owner token matches; anyone canselect all.Open questions
--monthly? (trivial if weekly works)session_events? (e.g., delete rows older than 60 days to keep the table tiny)