modscode JA

modscode / Gallery / weektoken

weektoken

Rate-limit pace for Claude Code's 5-hour and weekly windows: usage against elapsed time, plain-language forecast, per-model quotas and burn-up history. A band above the prompt and a full /weektoken pane, in English or Chinese.

Code you can checkTerminal + desktopPaneBandToastBoxButtonSvgText

What it does

  • Draws a band above the prompt, a pane
  • Adds /weektoken
  • Hooks config.set, session.measure, session.start, turn.complete and 3 more
  • Keeps its own state between turns
  • Starts processes

Good points

  • No network calls
  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors

Code to start from

Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.

Starter (register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like weektoken by mj0111 (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/3dnow-weektoken/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
  // the band above the prompt; what else goes there is drawn under it
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const { Box } = $.ui.resolve(e)
    return (
      <Box flexDirection="column">

        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "WeekToken" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Button, Text, Svg } = $.ui.resolve(e)
    const full = '…'
    const L = '…'
    const burnRate = '…'
    const displayLabel = '…'
    const displayHeadline = '…'
    const second = '…'
    const trendText = '…'
    const map = '…'
    const windowNote = '…'
    const __full = '…'
    const nl = '…'
    const source = '…'
    const alt = '…'
    return (
      <Box flexDirection="column" gap={1} paddingX={1}>
        <Box flexDirection="row" alignItems="center">
          <Box flexShrink={0}>
            <Button label="❮" plain />
          </Box>
          <Box flexShrink={0} justifyContent="center">
            <Text bold wrap="truncate-end">
              {full}
            </Text>
          </Box>
          <Box flexShrink={0}>
            <Button label="❮" plain />
          </Box>
        </Box>
        <Box flexDirection="row" gap={1}>
          <Button label={`${L}`} variant="primary" />
          <Button label={`${L}`} variant="primary" />
        </Box>
        <Box flexDirection="column" gap={1}>
          <Box flexDirection="row" gap={1}>
            <Text bold>
              {`${burnRate}×`}
            </Text>
            <Text dimColor>
              {displayLabel}
            </Text>
          </Box>
          <Text bold>
            {displayHeadline}
          </Text>
          <Text dimColor wrap="wrap">
            {second}
          </Text>
          <Text dimColor>
            {trendText}
          </Text>
          <Text>
            {map}
          </Text>
          <Text dimColor>
            ?
            {windowNote}
          </Text>
          <Box flexDirection="row" gap={2}>
            <Button label={`${__full}`} hotkey="h" />
            <Button label={`${full} ›`} hotkey="l" />
          </Box>
        </Box>
        <Box flexDirection="row" alignItems="center" gap={1}>
          <Text dimColor wrap="truncate-end">
            {nl}
          </Text>
          <Box flexGrow={1} />
          <Button label={`${L}`} />
          <Button label={`${L}`} />
        </Box>
        <Box flexGrow={1} />
        <Box flexDirection="row" justifyContent="flex-end">
          <Svg source={`${source}`} alt={`${alt}`} />
        </Box>
      </Box>
    )
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

weektoken/hooks/register.tsx lines 1083–1093 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (disabled || e.props.hasSurvey) return next(e)
    if (((await read($, bandA)) ?? 'open') === 'hidden') return next(e)
    await useLang($)
    const show = (await read($, confirmHideA)) ? 'confirm' : await read($, bandShowA)
    if (!show) return next(e)
    const ours = show === 'confirm' ? drawConfirmHide($, e) : drawBand($, e, show, !!(await read($, paneOpenA)))
    const below = await next(e)
    const { Box } = $.ui.resolve(e)
    return <Box flexDirection="column">{ours}{isBlank(below) ? null : below}</Box>
  })
weektoken/hooks/register.tsx lines 1095–1106 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const samples = (await read($, samplesA)) ?? []
    const view = (await read($, viewA)) ?? DEFAULT_VIEW
    const note = await read($, noteA)
    const band = (await read($, bandA)) ?? 'open'
    await useLang($)
    const now = await $.clock.now()
    const activity = (await read($, activityA)) ?? { byModel: {} }
    const bandKey = (await read($, bandKeyA)) ?? null
    paneVersion = (await read($, versionA)) ?? ''
    return drawPane($, e, samples, activity, view, note, band, buildModel(samples, view, now, bandKey), now)
  })
weektoken/hooks/register.tsx lines 883–957 · Pane
function drawPane($: any, e: any, samples: readonly Sample[], activity: Activity, view: PaneView, note: Note, band: BandMode, m: Model, now: number) {
  const { Box, Text, Button } = $.ui.resolve(e)
  // At least as tall as the pane body (row count from the host; Box sizes are in rows on every surface); the spacer before the credit pushes it to the bottom
  const fill = e.props?.scroll?.bodyRows ? Math.max(1, e.props.scroll.bodyRows) : '100%'
  paneActions.clear()
  paneSurface = e.surface
  paneFocusedAtRender = !!e.props?.isFocused
  const term = e.surface === 'terminal'
  const sel = m.selected
  const row = sel ? m.rows[sel] : undefined
  const nl = noteLine(row, samples, activity, now)
  const busy = isBusy(note, now)
  const footer = (
    <Box flexDirection="row" alignItems="center" gap={1}>
      {nl ? <Text dimColor wrap="truncate-end">{nl}</Text> : null}
      <Box flexGrow={1} />
      <Button key="band-toggle" label={band === 'hidden' ? L('⊕ 显示横条', '⊕ Show band') : L('⊖ 隐藏横条', '⊖ Hide band')} onPress={paneAct('band-toggle', () => toggleBandHidden($))} />
      <Button key="refresh" label={busy ? L('↻ 刷新中…', '↻ Refreshing…') : L('↻ 刷新', '↻ Refresh')} {...(term ? { hotkey: 'r' } : {})} onPress={paneAct('refresh', () => refreshAll($, true))} />
    </Box>
  )
  if (!row) {
    return (
      <Box flexDirection="column" gap={term ? 1 : 2} paddingX={1} minHeight={fill}>
        {drawEmpty($, e)}
        {footer}
        <Box flexGrow={1} />
        {credit($, e)}
      </Box>
    )
  }
  // Desktop: quota-switch arrows flank the title, as on the band; the name cell is sized to the longest quota name so arrows don't move on switch.
  // (Arrows used to sit at both ends of the ring row; once readings moved into the image it grew 50% wider and squeezed the arrows against the ring)
  // The terminal pace tab has its own named buttons (h / l), so no title arrows
  const headArrows = !term && m.keys.length > 1
  const headArrow = (offset: -1 | 1) => {
    const name = offset < 0 ? 'prev' : 'next'
    return (
      <Box key={`sw-${name}`} flexShrink={0}>
        <Button
          key={name}
          label={offset < 0 ? '❮' : '❯'}
          plain
          hover={{ color: identityText(P.neighbor(row.key, m.keys, offset) as string), bold: true }}
          onPress={paneAct(name, () => stepKey($, m.keys, row.key, offset))}
        />
      </Box>
    )
  }
  const title = <Text color={identityText(row.key)} bold wrap="truncate-end">{row.full}</Text>
  const header = headArrows ? (
    <Box flexDirection="row" alignItems="center">
      {headArrow(-1)}
      <Box flexShrink={0} width={Math.max(...m.keys.map(k => cells(m.rows[k].full)))} justifyContent="center">{title}</Box>
      {headArrow(1)}
    </Box>
  ) : (
    <Box flexDirection="row" alignItems="center" gap={1}>{title}</Box>
  )
  const tabs = (
    <Box flexDirection="row" gap={1}>
      <Button key="tab-pace" label={L('配速', 'Pace')} {...(term ? { hotkey: '1' } : {})} variant={view.tab === 'pace' ? 'primary' : 'secondary'} onPress={paneAct('tab-pace', () => setView($, v => ({ ...v, tab: 'pace', explore: false })))} />
      <Button key="tab-burnup" label={L('用量轨迹', 'Burn-up')} {...(term ? { hotkey: '2' } : {})} variant={view.tab === 'burnup' ? 'primary' : 'secondary'} onPress={paneAct('tab-burnup', () => setView($, v => ({ ...v, tab: 'burnup', explore: false })))} />
    </Box>
  )
  return (
    <Box flexDirection="column" gap={term ? 1 : 2} paddingX={1} minHeight={fill}>
      {header}
      {tabs}
      {view.tab === 'burnup' ? drawBurnUpTab($, e, samples, m, row, view, now) : drawPaceTab($, e, samples, m, row)}
      {footer}
      <Box flexGrow={1} />
      {credit($, e)}
    </Box>
  )
}
weektoken/hooks/register.tsx lines 693–701 · Pane
function drawEmpty($: any, e: any) {
  const { Box, Text } = $.ui.resolve(e)
  return (
    <Box flexDirection="column" alignItems="center" paddingY={1}>
      <Text bold>{L('还没有数据', 'No data yet')}</Text>
      <Text dimColor wrap="wrap">{L('等这个会话收到第一条回复,或点「刷新」', "Waiting for this session's first reply, or press Refresh")}</Text>
    </Box>
  )
}
weektoken/hooks/register.tsx lines 873–881 · Pane
function credit($: any, e: any) {
  const { Box, Text } = $.ui.resolve(e)
  const handle = `@${AUTHOR.x}${paneVersion ? ` · v${paneVersion}` : ''}`
  return (
    <Box flexDirection="row" justifyContent="flex-end">
      {e.surface === 'terminal' ? <Text dimColor>{handle}</Text> : pic($, e, creditSvg(handle), handle)}
    </Box>
  )
}
weektoken/hooks/register.tsx lines 491–502 · Pane
function pic($: any, e: any, source: string, alt: string, opts: { isInteractive?: boolean; fluid?: boolean; fillHeight?: number } = {}) {
  const { Svg } = $.ui.resolve(e)
  if (opts.fluid) return <Svg source={source} alt={alt} />
  // Plain image with height only: the SVG declares no width (width="100%") and uses percentage geometry, so width follows the cell up to the image default 300px,
  // stretching without distortion. No interactive frame: the host reloads it, flickering, whenever the same plugin redraws elsewhere (the pane) (confirmed on device)
  if (opts.fillHeight) return <Svg source={source} alt={alt} height={opts.fillHeight} />
  const m = /^<svg[^>]*?\swidth="([\d.]+)"\s+height="([\d.]+)"/.exec(source)
  const size = m ? { width: Number(m[1]), height: Number(m[2]) } : {}
  return opts.isInteractive
    ? <Svg source={source} alt={alt} {...size} isInteractive />
    : <Svg source={source} alt={alt} {...size} />
}
Licence text (MIT)
MIT License

Copyright (c) 2026 mj0111

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

What its code calls

runs programsreads filesenv varsremembers

What its code shows

Read from the source at commit e424db927c1f on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.

Decides the listing: code you can check
Entry readEvery module hooks/hooks.json names was read.weektoken/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.6 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs
Calls in the openNetwork and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open
For you to weigh before installing
Where it drawsThe terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both
Install lineWhether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there
Programs on WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).weektoken/hooks/register.tsx:256 tail (not on Windows); weektoken/hooks/register.tsx:358 defaults (not on Windows)
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.weektoken/hooks/register.tsx:242 perl (a shell or interpreter)
Reads and sendsWhether it both reads files or environment variables and reaches the network.reaches no network
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT

This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen

Install it

Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:

/plugin marketplace add 3dnow/claude-mods
/plugin install weektoken@mj0111-mods

This installs the marketplace's latest commit, which may not be the one read here (e424db927c1f). Compare them before you install.

Ask Claude about it

With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:

Read the modscode design "3dnow-weektoken" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs