Ranking|Claude Code Mods

ModsCode / Claude Code Mods / Ranking / token-weather

token-weather

コンテキストの使用状況を天気で、このセッションが読んだ auto-memory を一覧で、右のペインに示す。カードを押すと内訳・残り時間・索引の項目が開く

Code you can checkTerminal + desktopPaneBoxButtonText
drives Claude, draws

What it does

  • Draws a pane
  • Watches tool calls
  • Hooks prompt.attachment, session.end, session.measure, session.start and 1 more

Good points

  • No network calls
  • Starts no processes
  • Written in TypeScript
  • Handles errors

Code to start from

A starter ModsCode writes from the drawing it read, and the mod's own lines that draw, where there are any.

Starter (register.tsx)

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

// Drawn like token-weather by haruki-cl (pane), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/haruki-cl-token-weather/
// 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 pane: open it with $.ui.open({ id: 'my-pane', title: "Token Weather" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Button, Text } = $.ui.resolve(e)
    const icon = '…'
    const label = '…'
    const percent = '…'
    const formatTokens = '…'
    const formatTokens2 = '…'
    const note = '…'
    const formatTokens3 = '…'
    const sparkline = '…'
    const padCells = '…'
    const formatTokens4 = '…'
    const percentOf = '…'
    const padCells2 = '…'
    const formatTokens5 = '…'
    const padCells3 = '…'
    const formatTokens6 = '…'
    const formatTokens7 = '…'
    const padCells4 = '…'
    const percentUsed = '…'
    const formatReset = '…'
    const formatLeft = '…'
    const kind = '…'
    const padCells5 = '…'
    const formatReset2 = '…'
    const formatLeft2 = '…'
    const kind2 = '…'
    const padCells6 = '…'
    const formatReset3 = '…'
    const formatLeft3 = '…'
    const kind3 = '…'
    const length = '…'
    const formatTokens8 = '…'
    const title = '…'
    const title2 = '…'
    const title3 = '…'
    const padCells7 = '…'
    const formatAge = '…'
    const padCells8 = '…'
    const formatAge2 = '…'
    const padCells9 = '…'
    const formatAge3 = '…'
    const hidden = '…'
    return (
      <Box flexDirection="column">
        <Box borderStyle="round" borderColor="gray" paddingX={1} flexDirection="column">
          <Box flexDirection="column">
            <Box justifyContent="space-between">
              <Button plain>
                <Text bold>
                  {icon}
                  {" "}
                  {label}
                </Text>
                {" "}
                <Text dimColor>
                  weather
                </Text>
              </Button>
              <Text bold>
                {percent}
                %
              </Text>
            </Box>
            <Text>
              ████████░░░░░░░░
            </Text>
            <Text>
              {formatTokens}
              {" / "}
              {formatTokens2}
              {" tokens"}
            </Text>
            <Text color="red">
              {note}
              {" ("}
              {formatTokens3}
              {" left)"}
            </Text>
            <Text dimColor wrap="truncate-end">
              {"Trend "}
              {sparkline}
            </Text>
          </Box>
          <Box flexDirection="column" marginTop={1}>
            <Text wrap="truncate-end">
              {padCells}
              {" "}
              {formatTokens4}
              {" "}
              {`${percentOf}%`}
            </Text>
            <Text wrap="truncate-end">
              {padCells2}
              {" "}
              {formatTokens5}
              {" "}
              {`${percentOf}%`}
            </Text>
            <Text wrap="truncate-end">
              {padCells3}
              {" "}
              {formatTokens6}
              {" "}
              {`${percentOf}%`}
            </Text>
            <Text dimColor>
              {"of "}
              {formatTokens7}
              {" (est.)"}
            </Text>
          </Box>
        </Box>
        <Box borderStyle="round" paddingX={1} flexDirection="column">
          <Button plain>
            <Text bold>
              Usage limits
            </Text>
            {" "}
            <Text dimColor>
              limits
            </Text>
          </Button>
          <Box flexDirection="column">
            <Text wrap="truncate-end">
              {padCells4}
              <Text>
                {`${percentUsed}%`}
                {" "}
                ████████░░░░░░░░
              </Text>
            </Text>
            <Text dimColor wrap="truncate-end">
              {"  "}
              {"resets "}
              {formatReset}
            </Text>
            <Text dimColor wrap="truncate-end">
              {"  "}
              {formatLeft}
              {" left ("}
              {kind}
              )
            </Text>
          </Box>
          <Box flexDirection="column">
            <Text wrap="truncate-end">
              {padCells5}
              <Text>
                {`${percentUsed}%`}
                {" "}
                ████████░░░░░░░░
              </Text>
            </Text>
            <Text dimColor wrap="truncate-end">
              {"  "}
              {"resets "}
              {formatReset2}
            </Text>
            <Text dimColor wrap="truncate-end">
              {"  "}
              {formatLeft2}
              {" left ("}
              {kind2}
              )
            </Text>
          </Box>
          <Box flexDirection="column">
            <Text wrap="truncate-end">
              {padCells6}
              <Text>
                {`${percentUsed}%`}
                {" "}
                ████████░░░░░░░░
              </Text>
            </Text>
            <Text dimColor wrap="truncate-end">
              {"  "}
              {"resets "}
              {formatReset3}
            </Text>
            <Text dimColor wrap="truncate-end">
              {"  "}
              {formatLeft3}
              {" left ("}
              {kind3}
              )
            </Text>
          </Box>
        </Box>
        <Box borderStyle="round" borderColor="magenta" paddingX={1} flexDirection="column">
          <Button plain>
            <Text bold>
              🧠 Memory
            </Text>
            {" "}
            <Text dimColor>
              memory
            </Text>
          </Button>
          <Box justifyContent="space-between">
            <Text wrap="truncate-end">
              {"Index "}
              {`${length} entries`}
            </Text>
            <Text dimColor>
              {formatTokens8}
            </Text>
          </Box>
          <Text dimColor wrap="truncate-end">
            {"  · "}
            {title}
          </Text>
          <Text dimColor wrap="truncate-end">
            {"  · "}
            {title2}
          </Text>
          <Text dimColor wrap="truncate-end">
            {"  · "}
            {title3}
          </Text>
          <Text dimColor>
            Read this session
          </Text>
          <Text wrap="truncate-end">
            {"* "}
            {padCells7}
            {" "}
            <Text dimColor>
              {formatAge}
            </Text>
          </Text>
          <Text wrap="truncate-end">
            {"* "}
            {padCells8}
            {" "}
            <Text dimColor>
              {formatAge2}
            </Text>
          </Text>
          <Text wrap="truncate-end">
            {"* "}
            {padCells9}
            {" "}
            <Text dimColor>
              {formatAge3}
            </Text>
          </Text>
          <Text dimColor>
            +
            {hidden}
            {" more"}
          </Text>
          <Text dimColor>
            * loaded by the engine
          </Text>
        </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.

token-weather/hooks/register.tsx lines 256–412 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const u = await read($, usage)
    const trend = await read($, history)
    const windows = await read($, limits)
    const compactAt = await read($, autoCompactAt)
    const mem = await read($, memory)
    const parts = await read($, breakdown)
    const opened = await read($, open)
    const now = await $.clock.now()

    // 枠線 2 と左右の余白 2 を引いた、カードの中の幅
    const inner = Math.max(12, e.props.bodyColumns - 4)
    // 枠の名前(7 列)と使用率(5 列)、空白 1 列のあとに残る幅をバーにする
    const limitBar = Math.max(inner - 13, 4)
    // 印 2 列、メモリの名前、空白 1 列、日数 4 列
    const memoryName = Math.max(inner - 7, 6)
    // 内訳の行: カテゴリ名、空白 1 列、トークン数 5 列、空白 1 列、割合 4 列
    const categoryName = Math.max(inner - 11, 6)

    // カードの見出しを押すと、そのカードの詳細を開け閉めする。描画中は書けないので押されたときに書く
    const toggle = (card: Card) => () => void update($, open, o => ({ ...o, [card]: !o[card] }))
    const mark = (card: Card) => (opened[card] ? '▾' : '▸')

    const weather = u ? weatherFor(u.percent) : undefined
    const untilCompact = u && compactAt ? Math.max(compactAt - u.tokens, 0) : undefined
    // 新しく読んだものを上に。開いていれば全部、畳んでいれば上から数件
    const recent = [...mem.reads].reverse().slice(0, opened.memory ? mem.reads.length : READS_SHOWN)
    const hidden = mem.reads.length - recent.length
    const hasAuto = recent.some(r => r.how === 'auto')

    return (
      <Box flexDirection="column">
        <Box borderStyle="round" borderColor={weather?.color ?? 'gray'} paddingX={1} flexDirection="column">
          {u && weather ? (
            <Box flexDirection="column">
              <Box justifyContent="space-between">
                <Button key="weather" plain onPress={toggle('weather')}>
                  <Text bold color={weather.color}>
                    {weather.icon} {weather.label}
                  </Text>{' '}
                  <Text dimColor>{mark('weather')}</Text>
                </Button>
                <Text bold color={weather.color}>
                  {u.percent}%
                </Text>
              </Box>
              <Text color={weather.color}>{bar(u.percent, inner)}</Text>
              <Text>
                {formatTokens(u.tokens)} / {formatTokens(u.window)} tokens
              </Text>
              {untilCompact !== undefined &&
                (weather.note ? (
                  <Text color="red">
                    {weather.note} ({formatTokens(untilCompact)} left)
                  </Text>
                ) : (
                  <Text dimColor>{formatTokens(untilCompact)} until auto-compact</Text>
                ))}
              {trend.length >= 2 && (
                <Text dimColor wrap="truncate-end">
                  Trend {sparkline(trend.slice(-(inner - 6)))}
                </Text>
              )}
            </Box>
          ) : (
            <Box flexDirection="column">
              <Button key="weather" plain onPress={toggle('weather')}>
                <Text dimColor>🌫 Not measured yet</Text> <Text dimColor>{mark('weather')}</Text>
              </Button>
              <Text dimColor>Shows after the first reply</Text>
            </Box>
          )}
          {/* 開くと /context と同じ内訳。手元の見積もりなので、上の使用率と合計は一致しないことがある */}
          {opened.weather &&
            (parts ? (
              <Box flexDirection="column" marginTop={1}>
                {parts.categories.map(c => (
                  <Text wrap="truncate-end" dimColor={c.kind !== 'used'}>
                    {padCells(c.name.slice(0, categoryName), categoryName)} {formatTokens(c.tokens).padStart(5)} {`${percentOf(c.tokens, parts.window)}%`.padStart(4)}
                  </Text>
                ))}
                <Text dimColor>of {formatTokens(parts.window)} (est.)</Text>
              </Box>
            ) : (
              <Text dimColor>No breakdown yet</Text>
            ))}
        </Box>

        {windows.length > 0 && (
          <Box borderStyle="round" borderColor={limitColor(Math.max(...windows.map(w => w.percentUsed)))} paddingX={1} flexDirection="column">
            <Button key="limits" plain onPress={toggle('limits')}>
              <Text bold>Usage limits</Text> <Text dimColor>{mark('limits')}</Text>
            </Button>
            {windows.map(w => (
              <Box flexDirection="column">
                <Text wrap="truncate-end">
                  {padCells(limitLabel(w.kind), 7)}
                  <Text color={limitColor(w.percentUsed)}>
                    {`${w.percentUsed}%`.padStart(5)} {bar(w.percentUsed, limitBar)}
                  </Text>
                </Text>
                {w.resetsAt && (
                  <Text dimColor wrap="truncate-end">
                    {'  '}
                    resets {formatReset(w.resetsAt)}
                  </Text>
                )}
                {/* 開くと、リセットまでの残り時間と枠の名前 */}
                {opened.limits && w.resetsAt && (
                  <Text dimColor wrap="truncate-end">
                    {'  '}
                    {formatLeft(Date.parse(w.resetsAt) - now)} left ({w.kind})
                  </Text>
                )}
              </Box>
            ))}
          </Box>
        )}

        <Box borderStyle="round" borderColor="magenta" paddingX={1} flexDirection="column">
          <Button key="memory" plain onPress={toggle('memory')}>
            <Text bold>🧠 Memory</Text> <Text dimColor>{mark('memory')}</Text>
          </Button>
          {mem.index ? (
            <Box justifyContent="space-between">
              <Text wrap="truncate-end">Index {mem.index.entries !== undefined ? `${mem.index.entries.length} entries` : 'loaded'}</Text>
              {mem.index.tokens !== undefined && <Text dimColor>{formatTokens(mem.index.tokens)}</Text>}
            </Box>
          ) : (
            <Text dimColor>Index not in context</Text>
          )}
          {/* 開くと、索引に並ぶ項目の名前 */}
          {opened.memory &&
            mem.index?.entries?.map(entry => (
              <Text dimColor wrap="truncate-end">
                {'  · '}
                {entry.title}
              </Text>
            ))}
          {opened.memory && recent.length > 0 && <Text dimColor>Read this session</Text>}
          {recent.length === 0 ? (
            <Text dimColor>No memory file read yet</Text>
          ) : (
            recent.map(r => (
              <Text wrap="truncate-end">
                {r.how === 'auto' ? '* ' : '  '}
                {padCells(r.name.slice(0, memoryName), memoryName)} <Text dimColor>{formatAge(r.ageDays).padStart(4)}</Text>
              </Text>
            ))
          )}
          {hidden > 0 && <Text dimColor>+{hidden} more</Text>}
          {hasAuto && <Text dimColor>* loaded by the engine</Text>}
        </Box>
      </Box>
    )
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 haruki-cl

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.

How to build this: Pane (panel), Deny a tool call

What its code calls

reads filesenv varsdrives Claudetool calls

What its code shows

Read from the source at commit 837516b5b082 on 2026-10-11. 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.token-weather/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.3 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).runs no program a Windows PC lacks
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.starts no programs
Reads and sendsWhether it both reads something of yours (files, environment variables, the transcript, settings) and reaches outside (the network, an MCP server, another session, telemetry).reads environment variables, files, but reaches nothing outside
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
Settings hooksHooks declared in hooks/hooks.json or plugin.json beside the module: a command (a shell when it has no args), an HTTP request, an MCP tool or a model prompt at an event. They run outside $.no settings hooks: its function hooks alone
Servers it shipsMCP servers (a program, or a URL; a headersHelper is a shell command; a .mcpb bundle is unpacked at run time), LSP servers, monitors (a shell command for the whole session) and bin/ (on the PATH of the Bash tool).ships no MCP or LSP server, no monitor, no bin/
Skills, commands, agentsWhat its Markdown declares beyond text: allowed-tools granted for the turn, hooks added when a skill is invoked, a command run before Claude reads the skill.no skills, commands, agents or workflows
Tools and MCPWhether every tool it calls through $.tool.call and $.mcp.call is named in the code, and none is a shell (Bash through the tool runs a shell without $.process).calls no tool, MCP server or command
Asks of the modelCompletions it runs ($.model.complete, fork, classify), subagents it spawns, prompts it submits as you, and the tools, commands and agents it adds.adds command ?
Events it hooksBy what a hook there can do: gates (refuse a tool call, a prompt, a setting, another plugin), shapes (what the model reads: the system prompt, tool descriptions, each request), reads (your input, the events of the settings hooks, every event with *), and the rest.gates: command.run, tool.call · reads: prompt.attachment · also: session.start, turn.start, session.measure, session.end (+1) · timers: clock.after
Reads, by nameThe environment variables and files it names, and whether it reads the transcript, settings.json, the prompt box or the mouse selection.env: HOME; files: a path computed at run time
Writes, by nameThe files and environment variables it names, and whether it changes settings, the prompt box, the clipboard, the conversation (a row the model reads) or another session.writes no files, environment variables, settings or conversation rows

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 its code (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

From its marketplace

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 haruki-cl/claude-code-mods
/plugin install token-weather@claude-code-mods
/reload-plugins

This installs the marketplace's latest commit, which may not be the one read here (837516b5b082). Compare them before you install. /reload-plugins loads it into a session that is already open.

Try the commit ModsCode read

No marketplace needed. In a terminal, clone the repository, check out the commit read, validate the mod, and load it for one session:

git clone https://github.com/haruki-cl/claude-code-mods
git -C claude-code-mods checkout 837516b5b082e5db880e46b28b86f070c08ec196
claude plugin validate claude-code-mods/token-weather
claude --plugin-dir claude-code-mods/token-weather

The validate line lists the events the mod hooks and what it asks Claude Code to do, without running it. The last line loads the mod for this session only and writes nothing to your settings. If the author has rewritten history, the commit may no longer exist.

Ask Claude about it

With the ModsCode connector added, Claude can read this mod's code and what it reaches, and build on them. Ask it like this:

Read the ModsCode mod "haruki-cl-token-weather" with its code and make me one like it

Search them from Claude: the MCP connector

Similar mods

More from this repository

Badge for your README

If this is your mod, paste this into your README. It links to this page.

README.md
[![ModsCode](https://modscode.com/badge/haruki-cl-token-weather.svg)](https://modscode.com/claude-mods/mods/haruki-cl-token-weather/)