SLOPSHOPPER

usage-pace

Weekly usage in the status line, and whether it lasts until the reset

statustimer
★ 2v0.2.0no licenseupdated 2026-10-19cpeaustriajc/cj-stack/mods/usage-pace
A shopper browsing a rack in a slop shop
README

usage-pace

A mod (a plugin that adds hooks to Claude Code) that shows your weekly usage in the status row. It also tells you if the weekly allowance lasts until the reset.

Why

A weekly usage limit is easy to burn through by mid-week. A percentage alone does not say if you are early or late. usage-pace compares the percentage with the time left until the reset.

Install

/plugin marketplace add cpeaustriajc/cj-stack
/plugin install usage-pace@cj-stack

To see that it is on, run claude plugin list and look for usage-pace. The mod is optional: cj-stack does not install it.

Example

You are four days into a seven-day week and you used 40%. The status row shows this:

Week 40% · lasts to Tue 4:00 PM · 20%/day left

Later, you have used 81% at the same point. The status row shows this:

Week 81% · out ~Sun 2:31 PM · 6%/day left

What it does

Status rowMeaning
Week 40% · lasts to Tue 4:00 PM · 20%/day leftAt the current rate, the allowance lasts until the reset.
Week 81% · out ~Sun 2:31 PM · 6%/day leftAt the current rate, the allowance ends at the time shown, before the reset.
Week 0% · resets Tue 4:00 PMNo projection. This also shows at 100% or more, and in the first 12 hours of the week.
NothingThe reset time is missing or in the past, or no weekly reading exists.

The %/day left figure is the unused percentage divided by the days until the reset. The week starts seven days before the reset. The times use the clock of your computer.

The mod reads the usage again every 60 seconds, when a turn changes the rate limits, and when a surface attaches or detaches. The status row shows only when a desktop or phone surface is attached. A terminal-only session shows nothing and reads no usage.

Settings

No settings. To turn the mod off, run claude plugin disable usage-pace@cj-stack.

Limits

  • It shows the seven-day limit only. It ignores the five-hour limit.
  • A non-interactive session reads nothing and shows nothing.
  • If the read fails, the mod clears the status row. A hook call also throws "usage-pace: could not read weekly usage".
  • The projection assumes the rate of the whole week so far continues. It does not use your recent pace.

More

Source 2 files
hooks/register.ts 59 lines
1import type { Hook, Register } from 'claude-code'
2import { weeklyStatus } from './pace'
3
4type Api = Parameters<Hook<'session.start'>>[0]
5
6async function show($: Api): Promise<void> {
7  const surfaces = await $.session.surfaces()
8  if (!surfaces.some(s => s !== 'terminal')) {
9    $.ui.status(undefined)
10    return
11  }
12  const { rateLimits } = await $.session.usage()
13  const week = rateLimits.find(r => r.kind === 'seven_day')
14  const text = week && weeklyStatus(week.percentUsed, week.resetsAt, await $.clock.now())
15  $.ui.status(text)
16}
17
18async function showOrClear($: Api): Promise<void> {
19  try {
20    await show($)
21  } catch (cause) {
22    $.ui.status(undefined)
23    throw new Error('usage-pace: could not read weekly usage', { cause })
24  }
25}
26
27export const register: Register = on => {
28  let timer: { cancel: () => void } | undefined
29
30  on('session.start', async ($, e, next) => {
31    const result = await next(e)
32    if (e.isInteractive === false) return result
33    timer?.cancel()
34    timer = $.clock.every(60_000, () => {
35      show($).catch(() => $.ui.status(undefined))
36    })
37    await showOrClear($)
38    return result
39  })
40
41  on('session.measure', async ($, e, next) => {
42    const result = await next(e)
43    if (e.changed.includes('rateLimits')) await showOrClear($)
44    return result
45  })
46
47  on('session.attach', async ($, e, next) => {
48    const result = await next(e)
49    await showOrClear($)
50    return result
51  })
52
53  on('session.detach', async ($, e, next) => {
54    const result = await next(e)
55    await showOrClear($)
56    return result
57  })
58}
59
hooks/pace.ts 28 lines
1const DAY = 86_400_000
2const MIN_ELAPSED = 12 * 3_600_000
3const WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
4
5export function formatTime(ms: number): string {
6  const d = new Date(ms)
7  const h = d.getHours()
8  const mm = String(d.getMinutes()).padStart(2, '0')
9  return `${WEEKDAYS[d.getDay()]} ${h % 12 || 12}:${mm} ${h < 12 ? 'AM' : 'PM'}`
10}
11
12export function weeklyStatus(used: number, resetsAt: string | undefined, now: number): string | undefined {
13  const resetMs = resetsAt === undefined ? Number.NaN : Date.parse(resetsAt)
14  if (Number.isNaN(resetMs) || resetMs <= now) return undefined
15
16  const head = `Week ${Math.round(used)}%`
17  const resets = `${head} · resets ${formatTime(resetMs)}`
18  const start = resetMs - 7 * DAY
19  const elapsed = now - start
20  if (used >= 100 || used === 0 || elapsed < MIN_ELAPSED) return resets
21
22  const perDay = Math.round((100 - used) / ((resetMs - now) / DAY))
23  const outAt = start + (elapsed * 100) / used
24  return outAt >= resetMs
25    ? `${head} · lasts to ${formatTime(resetMs)} · ${perDay}%/day left`
26    : `${head} · out ~${formatTime(outAt)} · ${perDay}%/day left`
27}
28