SLOPSHOPPER

usage-meter

Mostra % usage e reset della finestra 5h e weekly a destra nel footer del prompt

newspinner
v0.1.0no licenseupdated 2026-10-15xLinkOut/claude-inline-usage-meter
A shopper browsing a rack in a slop shop
README

claude-inline-usage-meter

A Claude Code mod that shows your plan usage right in the prompt footer, bottom right, next to the session modes:

screenshot

  • 5h: current 5-hour window usage, with its reset time (local) in parentheses
  • week: weekly window usage

It refreshes after every turn and whenever a window moves by one point. It shows nothing when you're not on a subscription plan, or before the first response of the session.

Install

At the prompt of a terminal session:

/plugin install usage-meter --marketplace xLinkOut/claude-inline-usage-meter

From a shell:

claude plugin install usage-meter --marketplace xLinkOut/claude-inline-usage-meter

Answer y to add the marketplace, then pick a scope (user scope loads it in every session).

In the desktop app: click + next to the prompt box → Plugins → Add marketplace with xLinkOut/claude-inline-usage-meter → Add plugin.

Source 2 files
hooks/register.ts 41 lines
1import { atom, read, update } from 'claude-code'
2import type { Register } from 'claude-code'
3import type { Limit as SessionRateLimit } from '../types'
4
5const limits = atom({ plugin: 'usage-meter', key: 'limits' } as const, [] as SessionRateLimit[])
6
7const LABELS: Record<string, string> = { five_hour: '5h', seven_day: 'week' }
8const pad = (n: number) => String(n).padStart(2, '0')
9
10// reset time only for the 5h window: " (14:30)"
11const resetAt = (l: SessionRateLimit) => {
12  if (l.kind !== 'five_hour' || !l.resetsAt) return ''
13  const d = new Date(l.resetsAt)
14  return ` (${pad(d.getHours())}:${pad(d.getMinutes())})`
15}
16
17export const format = (ls: SessionRateLimit[]) =>
18  ls
19    .filter(l => l.kind in LABELS)
20    .map(l => `${LABELS[l.kind]} ${Math.round(l.percentUsed)}%${resetAt(l)}`)
21    .join(' · ')
22
23export const register: Register = on => {
24  on('session.start', async ($, e, next) => {
25    const r = await next(e)
26    const { rateLimits } = await $.session.usage()
27    await update($, limits, () => rateLimits)
28    return r
29  })
30
31  on('session.measure', async ($, e, next) => {
32    await update($, limits, () => e.rateLimits)
33    return next(e)
34  })
35
36  on('ui.render', { component: 'SessionMode' }, async ($, e, next) => {
37    const text = format(await read($, limits))
38    return next(text ? { ...e, props: { ...e.props, modes: [...e.props.modes, text] } } : e)
39  })
40}
41
types/index.d.ts 8 lines
1export type Limit = { kind: string; percentUsed: number; resetsAt?: string }
2
3declare module 'claude-code' {
4  interface PluginState {
5    'usage-meter': { limits: Limit[] }
6  }
7}
8