A band above the prompt: context, 5-hour and weekly meters in one frame, with reset times and hover details.

Personal Claude Code mods for a calmer, more readable terminal.
| Mod | What it does |
|---|---|
readable-width | Draws each piece of a reply in a grey rounded card, as wide as its longest line and wrapped at 80 columns; tables and code blocks that name a language keep the full width; an unlabelled or text block wraps like prose. Your prompts are bold and accent-colored, in a rounded accent-colored bubble as wide as their longest line, with a blank line above each message. |
usage-meters | The bottom of the band above the prompt, under the other mods' buttons: ctx, 5h and 7d meters in one rounded frame. Each bar runs teal to green to yellow to red along its length, so a fuller bar reaches warmer colors; 5h and 7d also show the time left until they reset (2h 16m, 3d 4h). The pointer on a meter shows a card over the buttons: the context's tokens and the session's cost, or when a limit resets (today 18:00, Fri 16:00). |
tool-log | Folds tool calls and their results in the chat into a ◆ N tools line, one per run of calls with no text between them, and keeps them in a side log grouped by prompt. Toggle it with the framed ☰ panel button, /panel or a key bound to app:toggleDiffPreSession (ctrl+t in ~/.claude/keybindings.json, see below; this replaces the built-in todo list toggle); a click on a chat line opens it on that prompt's steps, until the next prompt or ✕ returns it to live. The chat line also sums file changes and failures (◆ 6 tools · 2 files changed +14 −3 · 1 failed). A turn longer than 30 s ends with a desktop notification. Successful Bash rows expand to show their command, and Edit/Write rows to show their diff. Inside a git repo a framed ± diff button opens the built-in /diff panel. The panel has three tabs: Log, Files (every file changed this session with its diff, new files included) and Agents (subagents with status, time, tool count and their latest step); ☰ panel reopens it on the tab last in view. The active tab is orange, a tab with something new since you last looked is bright, the rest are dim. Replaces the spinner with a minimal one that names the current step, e.g. ⠋ 12s · Reading register.tsx or ⠙ 3s · Thinking. |
turn-details | Replaces the Brewed for 34s · done 1:09 PM line with ◆ details ▸, which folds the turn's duration, finish time, tool calls and model open in place. |
ask-mode | A read-only mode for when you want an answer, not changes. Beside the panel button, a framed quick │ ask │ deep switch: a click picks a level, a click on the active one turns it off; /quick, /ask and /deep do the same, /ask off leaves any. While on, the frame and the level are yellow beside a 🔒, every prompt carries a brief to answer and report, and every call that may change something is refused, in subagents too: Edit, Write, Bash commands off a read-only list (ls, cat, rg, git log/diff/status/show, gh pr view…; redirects and command substitution included), MCP tools whose name does not read (send, create, update…). quick answers briefly on Haiku 5.5 at low effort, ask investigates on your model, deep analyzes at max effort on Opus. It stays on until you turn it off; a new session starts with it off. |
From GitHub:
claude plugin marketplace add Tvrtk0/claude-code-mods
claude plugin install readable-width@local-mods
claude plugin install usage-meters@local-mods
claude plugin install tool-log@local-mods
claude plugin install turn-details@local-mods
claude plugin install ask-mode@local-mods
From a local clone (edits apply after /reload-plugins, no reinstall):
claude plugin marketplace add ~/.claude/mods
claude plugin install readable-width@local-mods
claude plugin install usage-meters@local-mods
claude plugin install tool-log@local-mods
claude plugin install turn-details@local-mods
claude plugin install ask-mode@local-mods
Installed from a local clone, plugins are read straight from the folder.
claude plugin validate ~/.claude/mods/<mod>
claude plugin test ~/.claude/mods/<mod>
A mod cannot add a key of its own, so the ⌃T hint beside ☰ panel borrows an engine action that only the /diff panel handles. Bind any key to it:
{
"$schema": "https://www.schemastore.org/claude-code-keybindings.json",
"bindings": [
{ "context": "Global", "bindings": { "ctrl+t": "app:toggleDiffPreSession" } }
]
}
ctrl+t hands the panel the keyboard (opening it if needed) and closes it when it already has it. Inside: h/l or 1–3 switch tabs, j/k move between rows (starting from the newest), enter opens one, d/u scroll half a window, g/b jump to the first or last row, esc returns to the prompt and leaves the panel open. The panel scrolls itself, so its tabs and keys stay at the top; Bottom is b, not G: a button hotkey cannot tell shift+g from g.
hooks/register.tsx 201 lines1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register } from 'claude-code'
3
4const snapshot = atom({ plugin: 'usage-meters', key: 'snapshot' } as const, null)
5
6const BAR = 10
7
8// The meters' frame and its dividers, and the frame around the band.
9const OUTER = '#4a4a4a'
10const CARD_BORDER = '#5a5a5a'
11const CARD_LABEL = '#9a9a9a'
12// The bar's bare track, and the glyphs for one to seven eighths of a cell.
13const TRACK = '#333333'
14const PARTS = ['', '▏', '▎', '▍', '▌', '▋', '▊', '▉']
15// A meter's tooltip: a dark card that covers the buttons above it.
16const TIP_BG = '#1e1e1e'
17const TIP_BORDER = '#7a7a7a'
18
19const DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
20const pad = (n: number) => String(n).padStart(2, '0')
21
22// `46k`, `1M`: a token count at a glance.
23const tokens = (n: number) =>
24 n >= 1_000_000 ? `${+(n / 1_000_000).toFixed(1)}M` : n >= 1_000 ? `${Math.round(n / 1_000)}k` : String(n)
25
26// The bars run teal to green to yellow to orange to red along their
27// length: each cell takes the color of where it sits, so a fuller bar
28// reaches warmer colors, and the percentage takes the color at its end.
29const STOPS: [number, number, number][] = [
30 [0x4f, 0xd1, 0xc5],
31 [0x98, 0xc3, 0x79],
32 [0xe5, 0xc0, 0x7b],
33 [0xd1, 0x9a, 0x66],
34 [0xe0, 0x6c, 0x75],
35]
36
37function gradient(at: number) {
38 const x = Math.min(1, Math.max(0, at)) * (STOPS.length - 1)
39 const i = Math.min(STOPS.length - 2, Math.floor(x))
40 const from = STOPS[i] ?? STOPS[0]!
41 const to = STOPS[i + 1] ?? from
42 const mix = (k: 0 | 1 | 2) => Math.round(from[k] + (to[k] - from[k]) * (x - i))
43 const hex = (n: number) => n.toString(16).padStart(2, '0')
44
45 return `#${hex(mix(0))}${hex(mix(1))}${hex(mix(2))}`
46}
47
48async function refresh($: EngineInterface) {
49 const usage = await $.session.usage()
50 const limit = (kind: string) =>
51 usage.rateLimits.find(r => r.kind === kind)?.percentUsed
52 const resetsAt = (kind: string) => {
53 const at = usage.rateLimits.find(r => r.kind === kind)?.resetsAt
54 return at === undefined ? undefined : Date.parse(at)
55 }
56
57 await update($, snapshot, () => ({
58 context: usage.context.percent,
59 contextTokens: usage.context.tokens,
60 contextWindow: usage.context.window,
61 costUsd: usage.cost?.usd,
62 fiveHour: limit('five_hour'),
63 fiveHourResetsAt: resetsAt('five_hour'),
64 sevenDay: limit('seven_day'),
65 sevenDayResetsAt: resetsAt('seven_day'),
66 }))
67}
68
69export const register: Register = on => {
70 on('session.start', async ($, e, next) => {
71 const started = await next(e)
72 await refresh($)
73
74 return started
75 })
76
77 on('turn.complete', async ($, e, next) => {
78 const done = await next(e)
79 await refresh($)
80
81 return done
82 })
83
84 on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
85 const s = await read($, snapshot)
86
87 if (e.props.hasSurvey || s === null) {
88 return next(e)
89 }
90
91 const { Box, Text } = $.ui.resolve(e)
92 const now = await $.clock.now()
93 // Time until a window resets, as of this drawing: `2h 16m`, or `3d 4h`
94 // once it is a day or more away.
95 const resetIn = (at: number | undefined) => {
96 const left = at === undefined ? 0 : at - now
97 if (left <= 0) return ''
98 const hours = Math.floor(left / 3_600_000)
99
100 return hours >= 24
101 ? `${Math.floor(hours / 24)}d ${hours % 24}h`
102 : `${hours}h ${Math.floor((left % 3_600_000) / 60_000)}m`
103 }
104
105 // One labelled meter: the label, a bar of BAR cells and its percentage,
106 // both colored by how full it is; a divider before all but the first.
107 // When a window resets, as a clock time: `18:00`, `tomorrow 09:00` or
108 // `Fri 16:00`.
109 const resetAt = (at: number | undefined) => {
110 if (at === undefined) return ''
111 const d = new Date(at)
112 const today = new Date(now)
113 const days = Math.round(
114 (new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime() -
115 new Date(today.getFullYear(), today.getMonth(), today.getDate()).getTime()) /
116 86_400_000,
117 )
118 const time = `${pad(d.getHours())}:${pad(d.getMinutes())}`
119
120 return days <= 0 ? `today ${time}` : days === 1 ? `tomorrow ${time}` : `${DAYS[d.getDay()]} ${time}`
121 }
122
123 const meter = (label: string, percent: number | undefined, isFirst = false, note = '', tip = '') => {
124 if (percent === undefined) return null
125
126 // In eighths of a cell, so a small share still shows: full cells, one
127 // partial cell, then the bare track.
128 const eighths = Math.min(BAR * 8, Math.round((percent / 100) * BAR * 8))
129 const full = Math.floor(eighths / 8)
130 const part = eighths % 8
131
132 return (
133 <Box key={`meter-${label}`} flexShrink={0}>
134 {!isFirst && <Text color={CARD_BORDER}>{' │ '}</Text>}
135 <Text color={CARD_LABEL}>{label} </Text>
136 {Array.from({ length: BAR }, (_, i) => {
137 const glyph = i < full ? '█' : i === full && part > 0 ? (PARTS[part] ?? ' ') : ' '
138
139 return (
140 <Text key={`${label}-cell-${i}`} color={gradient((i + 0.5) / BAR)} backgroundColor={TRACK}>
141 {glyph}
142 </Text>
143 )
144 })}
145 <Text bold color={gradient(percent / 100)}> {Math.round(percent)}%</Text>
146 {note !== '' && <Text color={CARD_LABEL}> · {note}</Text>}
147 {/* Shown while the pointer is on the meter, over the buttons above:
148 the band clips anything past its own rows. */}
149 {tip !== '' && (
150 <Box
151 position="absolute"
152 top={-4}
153 left={isFirst ? -2 : 3}
154 display="none"
155 hover={{ display: 'flex' }}
156 flexShrink={0}
157 borderStyle="round"
158 borderColor={TIP_BORDER}
159 backgroundColor={TIP_BG}
160 paddingX={1}
161 >
162 <Text backgroundColor={TIP_BG}>{tip}</Text>
163 </Box>
164 )}
165 </Box>
166 )
167 }
168
169 const contextTip = [
170 s.contextTokens !== undefined && s.contextWindow !== undefined
171 ? `Context ${tokens(s.contextTokens)} / ${tokens(s.contextWindow)} tokens`
172 : 'Context',
173 s.costUsd !== undefined ? `$${s.costUsd.toFixed(2)} this session` : '',
174 ]
175 .filter(x => x !== '')
176 .join(' · ')
177 const limitTip = (name: string, at: number | undefined) =>
178 at === undefined ? name : `${name} · resets ${resetAt(at)}`
179
180 // Other mods' band content (the panel and ask buttons) is drawn above
181 // the meters, frame on frame.
182 const below = await next(e)
183
184 // One frame around the whole band, as wide as what it holds, a blank
185 // line above it, sets it off from the chat scrolling above: it stays put,
186 // the chat moves. No width
187 // of its own: the engine refuses its node under a sized Box.
188 return (
189 <Box marginTop={1} alignSelf="flex-start" flexDirection="column" borderStyle="round" borderColor={OUTER} paddingX={1}>
190 {below}
191 {/* All three in one rounded frame, as wide as they are. */}
192 <Box alignSelf="flex-start" borderStyle="round" borderColor={CARD_BORDER} paddingX={1}>
193 {meter('ctx', s.context ?? 0, true, '', contextTip)}
194 {meter('5h', s.fiveHour, false, resetIn(s.fiveHourResetsAt), limitTip('5-hour limit', s.fiveHourResetsAt))}
195 {meter('7d', s.sevenDay, false, resetIn(s.sevenDayResetsAt), limitTip('Weekly limit', s.sevenDayResetsAt))}
196 </Box>
197 </Box>
198 )
199 })
200}
201types/index.d.ts 17 lines1export type Snapshot = {
2 context?: number
3 contextTokens?: number
4 contextWindow?: number
5 costUsd?: number
6 fiveHour?: number
7 fiveHourResetsAt?: number
8 sevenDayResetsAt?: number
9 sevenDay?: number
10}
11
12declare module 'claude-code' {
13 interface PluginState {
14 'usage-meters': { snapshot: Snapshot | null }
15 }
16}
17