Claude Code mod token-weather
- Observability
- Publisher
- Anthropic (opens in a new tab)
- License
- Apache-2.0
Anthropic's sample mod that draws a live forecast of the context window in the band above the prompt, with a chart of the last turns.
Notice
Anthropic shares this sample mod as it is, without support. Its README says it is not an official Anthropic product and that no support or maintenance is implied. It needs Claude Code 2.1.287 or later, where mods load by default.
What it does
After each turn, the band above the prompt shows a weather icon and word for how full the window is, the percentage used, the tokens used out of the window, a chart of the last 12 turns drawn with block characters, and how much the last turn added.
The forecast follows the share of the window used: under 25% is Clear, 25 to 49% is Cloudy, 50 to 74% is Showers, 75 to 89% is Storm, and 90% and up is Compact soon.
The figures come from $.session.usage(). tokens is the input tokens the last response was answered over (uncached, cache-written and cache-read together), window is the context window of the session's model, and percent is tokens over window. The README says these are the same figures the status line shows, and that the call is free because the mod asks for no breakdown.
How it works
The hooks module is hooks/token-weather.mjs, and hooks/hooks.json points to it. It registers three hooks.
session.start: takes a first reading, so the band shows before the first turn.
turn.complete: takes a reading after each main-loop turn. Subagent turns are skipped. It keeps the last 12 readings and asks Claude Code to draw again.
ui.render on the AbovePrompt component: draws the band as one line. In a terminal narrower than 60 columns it leaves out the chart and the trend.
Set up
The README asks for Claude Code 2.1.287 or later, where mods load by default. Check yours with claude --version. It needs no environment variables or configuration.
Run these from the claude-code/mods folder of a clone (see Download the source). The first command checks the plugin and lists its hooks. The second loads it for one session only.
To keep it, add the folder as a local marketplace and install it from claude-code-playground-mods, as the last two commands do. The official mods overview notes that this marketplace points at your clone, so the mod stops loading if you move or delete the clone.
If you install it from your shell while a session is open, run /reload-plugins in that session to load it. To confirm it loaded, run /plugin: a dim line under the tabs names the mods the session loaded.
It needs a terminal: the README says AbovePrompt is drawn on the terminal surface only. Then work as normal. The band updates after each turn.
claude plugin validate ./token-weatherclaude --plugin-dir ./token-weatherclaude plugin marketplace add ./claude plugin install token-weather@claude-code-playground-mods --scope userDownload the source
The source lives in the claude-code/mods/token-weather folder of the anthropics/claude-code-playground repository, beside the two other sample mods. The README's steps clone the whole repository and go to the mods folder, which is the folder the set up commands run from.
The repository's LICENSE is the Apache License 2.0, and the hooks module carries the header SPDX-License-Identifier: Apache-2.0. The repository README says the DevRel team maintains it, that entries are provided as is with no support and no guarantee they still work, and that it is not accepting outside contributions yet.
git clone https://github.com/anthropics/claude-code-playground.gitcd claude-code-playground/claude-code/modsLimitations
The percentage is of the full window. Claude Code's own context used notice counts against the auto-compact point, which is lower, so the two can differ. In the README's testing, the band read 81% when the notice read 90%.
The band updates once per turn, not during a turn. The chart's bars are relative to the fullest turn shown, and the percentage is the absolute figure. The history resets when the session starts or the plugin reloads, and before the first response the band reads 0%.
Only one band shows per session: another plugin that draws AbovePrompt competes for it.
Hooks it registers
What the badge means
Source verified means the source URL for this entry responded with HTTP 200 on . That is the whole claim. Nobody has read, scanned or run this code on your behalf, and the badge does not mean Anthropic or anyone else endorses it.
Sources change after the check date. Read the code and the publisher page before you install. How to check an extension