ModsCode / Claude Code Mods / Ranking / context-bar
context-bar
Your context window as a stacked bar above the prompt, a color per category, with token counts and the compaction point. Click the ▾ to open every row's share and what sits under the rows. /context-bar shows or hides it.
What it does
- Draws a band above the prompt
- Adds /context-bar
- Hooks prompt.compose, session.compact, session.start, turn.complete
- Keeps its own state between turns
Good points
- No network calls
- Starts no processes
- Written in TypeScript
- Writes no files
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)
import type { Register } from 'claude-code'
// Drawn like context-bar by Hamza Zafar (band), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/see-stack-context-bar/
// 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, Text, Button } = $.ui.resolve(e)
const head = '…'
const badge = '…'
const text = '…'
const text2 = '…'
const text3 = '…'
const SWATCH = '…'
const name = '…'
const tokens = '…'
const share = '…'
const tokens2 = '…'
const tokens3 = '…'
const tokens4 = '…'
const tokens5 = '…'
const tokens6 = '…'
const tokens7 = '…'
const tokens8 = '…'
const tokens9 = '…'
const GLYPH = '…'
const lpad = '…'
const lpad2 = '…'
const name2 = '…'
const GLYPH2 = '…'
const lpad3 = '…'
const lpad4 = '…'
const name3 = '…'
const GLYPH3 = '…'
const lpad5 = '…'
const lpad6 = '…'
return (
<Box flexDirection="column">
<Box flexDirection="column" borderStyle="round" borderColor="inactive" paddingX={1}>
<Box flexDirection="row" justifyContent="space-between">
<Text wrap="truncate-end">
<Text color="#d97757">
{"◆ "}
</Text>
<Text bold>
context
</Text>
</Text>
<Box flexDirection="row">
<Text wrap="truncate-start">
<Text dimColor>
{`${head} `}
</Text>
<Text bold color="black">
{badge}
</Text>
<Text>
{" "}
</Text>
</Text>
<Button plain label="▴" />
</Box>
</Box>
<Text>
<Text>
{text}
</Text>
<Text>
{text2}
</Text>
<Text>
{text3}
</Text>
</Text>
<Text wrap="truncate-end">
<Text>
<Text>
{" "}
</Text>
<Text>
{`${SWATCH} `}
</Text>
<Text>
{`${name} `}
</Text>
<Text>
{tokens}
</Text>
<Text dimColor>
{` ${share}`}
</Text>
</Text>
<Text>
<Text>
{" "}
</Text>
<Text>
{`${SWATCH} `}
</Text>
<Text>
{`${name} `}
</Text>
<Text>
{tokens2}
</Text>
<Text dimColor>
{` ${share}`}
</Text>
</Text>
<Text>
<Text>
{" "}
</Text>
<Text>
{`${SWATCH} `}
</Text>
<Text>
{`${name} `}
</Text>
<Text>
{tokens3}
</Text>
<Text dimColor>
{` ${share}`}
</Text>
</Text>
</Text>
<Text wrap="truncate-end">
<Text>
<Text>
{" "}
</Text>
<Text>
{`${SWATCH} `}
</Text>
<Text>
{`${name} `}
</Text>
<Text>
{tokens4}
</Text>
<Text dimColor>
{` ${share}`}
</Text>
</Text>
<Text>
<Text>
{" "}
</Text>
<Text>
{`${SWATCH} `}
</Text>
<Text>
{`${name} `}
</Text>
<Text>
{tokens5}
</Text>
<Text dimColor>
{` ${share}`}
</Text>
</Text>
<Text>
<Text>
{" "}
</Text>
<Text>
{`${SWATCH} `}
</Text>
<Text>
{`${name} `}
</Text>
<Text>
{tokens6}
</Text>
<Text dimColor>
{` ${share}`}
</Text>
</Text>
</Text>
<Text wrap="truncate-end">
<Text>
<Text>
{" "}
</Text>
<Text>
{`${SWATCH} `}
</Text>
<Text>
{`${name} `}
</Text>
<Text>
{tokens7}
</Text>
<Text dimColor>
{` ${share}`}
</Text>
</Text>
<Text>
<Text>
{" "}
</Text>
<Text>
{`${SWATCH} `}
</Text>
<Text>
{`${name} `}
</Text>
<Text>
{tokens8}
</Text>
<Text dimColor>
{` ${share}`}
</Text>
</Text>
<Text>
<Text>
{" "}
</Text>
<Text>
{`${SWATCH} `}
</Text>
<Text>
{`${name} `}
</Text>
<Text>
{tokens9}
</Text>
<Text dimColor>
{` ${share}`}
</Text>
</Text>
</Text>
<Box flexDirection="column" alignItems="center">
<Box flexDirection="column">
<Box flexDirection="row">
<Text>
{" "}
</Text>
<Text>
{" "}
</Text>
<Text wrap="truncate-end">
<Text>
{`${SWATCH} `}
</Text>
<Text>
{name}
</Text>
<Text>
{" "}
</Text>
<Text>
<Text>
{GLYPH}
</Text>
<Text dimColor>
········
</Text>
</Text>
<Text>
{" "}
</Text>
<Text>
{lpad}
</Text>
<Text>
{" "}
</Text>
<Text dimColor>
{lpad2}
</Text>
</Text>
</Box>
<Box flexDirection="row">
<Text>
{" "}
</Text>
<Text>
{" "}
</Text>
<Text wrap="truncate-end">
<Text>
{`${SWATCH} `}
</Text>
<Text>
{name2}
</Text>
<Text>
{" "}
</Text>
<Text>
<Text>
{GLYPH2}
</Text>
<Text dimColor>
········
</Text>
</Text>
<Text>
{" "}
</Text>
<Text>
{lpad3}
</Text>
<Text>
{" "}
</Text>
<Text dimColor>
{lpad4}
</Text>
</Text>
</Box>
<Box flexDirection="row">
<Text>
{" "}
</Text>
<Text>
{" "}
</Text>
<Text wrap="truncate-end">
<Text>
{`${SWATCH} `}
</Text>
<Text>
{name3}
</Text>
<Text>
{" "}
</Text>
<Text>
<Text>
{GLYPH3}
</Text>
<Text dimColor>
········
</Text>
</Text>
<Text>
{" "}
</Text>
<Text>
{lpad5}
</Text>
<Text>
{" "}
</Text>
<Text dimColor>
{lpad6}
</Text>
</Text>
</Box>
<Text>
{" "}
</Text>
<Button label="Minimize" hotkey="q" />
</Box>
</Box>
</Box>
{await next(e)}
</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.
mods/context-bar/hooks/register.tsx lines 90–236 · Band
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const rest = await next(e) // what other mods and Claude Code draw here stays
const r = await read($, reading)
if (e.props.hasSurvey || (await read($, isHidden)) || !r) return rest
const { Box, Text, Button } = $.ui.resolve(e)
const inner = e.props.bodyColumns - 4 // the border and padding take 4 cells
if (inner < MIN_WIDTH) return rest
const opened = await read($, isOpen)
const show = await read($, openRow)
const prompt = await read($, promptSections)
const tools = await read($, toolList)
const messages = await read($, messageList)
// A list opens under its own row, and one at a time: opening another shuts the first.
const toggle = (id: string) => update($, openRow, (now: string | null) => (now === id ? null : id))
const head = `${tokens(r.total)} of ${tokens(r.window)}${r.compactsAt ? ` · compacts at ${tokens(r.compactsAt)}` : ''}`
const badge = ` ${r.percent}% `
// The detail is laid out in a block narrower than a wide box, and centered in it.
const m = metrics(frameWidth(inner))
return (
<Box flexDirection="column">
<Box flexDirection="column" borderStyle="round" borderColor="inactive" paddingX={1}>
<Box flexDirection="row" justifyContent="space-between">
<Text wrap="truncate-end">
<Text color="#d97757">{'◆ '}</Text>
<Text bold>context</Text>
</Text>
<Box flexDirection="row">
<Text wrap="truncate-start">
<Text dimColor>{`${head} `}</Text>
<Text bold color="black" backgroundColor={levelColor(r)}>{badge}</Text>
<Text> </Text>
</Text>
<Button key="toggle" plain label={opened ? '▴' : '▾'} onPress={() => update($, isOpen, v => !v)} />
</Box>
</Box>
<Text>
{cells(r, inner).map(c => (
<Text color={c.color}>{c.text}</Text>
))}
</Text>
{!opened &&
legend(r, inner).map(line => (
<Text wrap="truncate-end">
{line.map((s, i) => (
<Text>
{i > 0 && <Text>{SPLIT}</Text>}
<Text color={s.color}>{`${SWATCH[s.kind]} `}</Text>
<Text dimColor={s.kind !== 'used'}>{`${s.name} `}</Text>
<Text bold={s.kind === 'used'}>{tokens(s.tokens)}</Text>
{s.kind === 'used' && <Text dimColor>{` ${share(s.tokens, r.window)}`}</Text>}
</Text>
))}
</Text>
))}
{opened && (
<Box flexDirection="column" alignItems="center">
<Box flexDirection="column" width={m.total}>
{blocks(r, show, prompt, tools, messages).map(b => {
if (b.kind === 'gap') return <Text> </Text>
if (b.kind === 'entry') {
const list = b.list
return (
<Box flexDirection="row">
<Button key={list.id} plain label={b.open ? '▼' : '▶'} onPress={() => toggle(list.id)} />
<Text wrap="truncate-end">
<Text>{' '}</Text>
<Text bold>{list.head}</Text>
{list.note !== undefined && <Text dimColor>{` ${list.note}`}</Text>}
</Text>
</Box>
)
}
if (b.kind === 'figure')
return (
<Text wrap="truncate-end">
<Text>{' '}</Text>
<Text bold>{b.text}</Text>
<Text dimColor>{` ${b.note}`}</Text>
</Text>
)
if (b.kind === 'head')
return (
<Text wrap="truncate-end">
<Text bold>{b.text}</Text>
{b.note !== undefined && <Text dimColor>{` ${b.note}`}</Text>}
</Text>
)
if (b.kind === 'note')
return (
<Text dimColor wrap="truncate-end">
{`${' '.repeat(2 + m.num)}${b.text}`}
</Text>
)
if (b.kind === 'item')
return (
<Text wrap="truncate-end">
<Text>{' '.repeat(INDENT)}</Text>
{/* A `~` wherever the figure is this mod's estimate. A tool has no figure at all:
the engine counts its row whole, so the cells are left bare rather than guessed. */}
<Text bold>
{b.item.tokens === undefined ? ' '.repeat(m.num) : lpad(`${b.item.estimated ? '~' : ''}${tokens(b.item.tokens)}`, m.num)}
</Text>
<Text>{' '}</Text>
<Text>{cut(b.item.name, itemRoom(m.total, m.num, b.item))}</Text>
{b.item.note !== undefined && <Text dimColor>{` ${b.item.note}`}</Text>}
</Text>
)
const filled = barFill(b.slice.tokens, b.max, m.bar)
const list = b.list
return (
<Box flexDirection="row">
{/* The row that has detail under it leads with a mark; a bare row keeps the cells. */}
{list ? (
<Button key={list.id} plain label={b.open ? '▼' : '▶'} onPress={() => toggle(list.id)} />
) : (
<Text>{' '}</Text>
)}
<Text>{' '}</Text>
<Text wrap="truncate-end">
<Text color={b.slice.color}>{`${SWATCH[b.slice.kind]} `}</Text>
<Text dimColor={b.slice.kind !== 'used'}>{pad(b.slice.name, m.name)}</Text>
{m.bar > 0 && <Text>{' '}</Text>}
{m.bar > 0 && (
<Text>
<Text color={b.slice.color}>{GLYPH[b.slice.kind].repeat(filled)}</Text>
{m.bar - filled > 0 && <Text dimColor>{REST.repeat(m.bar - filled)}</Text>}
</Text>
)}
<Text>{' '}</Text>
<Text bold={b.slice.kind === 'used'}>{lpad(tokens(b.slice.tokens), m.num)}</Text>
<Text>{' '}</Text>
<Text dimColor>{lpad(share(b.slice.tokens, r.window), m.pct)}</Text>
</Text>
</Box>
)
})}
<Text> </Text>
<Button key="minimize" label="Minimize" hotkey="q" onPress={() => update($, isOpen, () => false)} />
</Box>
</Box>
)}
</Box>
{rest}
</Box>
)
})Licence text (MIT)
MIT License Copyright (c) 2026 See Stack (https://github.com/seestack-dev) 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: Band above the prompt, Add a slash command
What its code calls
remembers
What its code shows
Read from the source at commit 105aa932221f 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 read | Every module hooks/hooks.json names was read.mods/context-bar/hooks/register.tsx |
| Parses | Every file parses as TypeScript or JavaScript.1 files parsed |
| All its code is in the mod | Every import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod |
| Readable | No 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 open | Network 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 draws | The 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 line | Whether 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 Windows | Whether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks |
| Network | Whether every fetch names its https host in the code.no network |
| Programs | Whether 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 sends | Whether it both reads something of yours (files, environment variables, the transcript, settings) and reaches outside (the network, an MCP server, another session, telemetry).reads the transcript, but reaches nothing outside |
| Keys in the source | Whether the source holds what looks like an API key or a private key.no keys in the source |
| Licence | An 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 hooks | Hooks 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 ships | MCP 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, agents | What 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 MCP | Whether 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 model | Completions it runs ($.model.complete, fork, classify), subagents it spawns, prompts it submits as you, and the tools, commands and agents it adds.adds command context-bar |
| Events it hooks | By 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 (context-bar) · shapes: prompt.compose · also: session.start, turn.complete, session.compact, ui.render (AbovePrompt) |
| Reads, by name | The environment variables and files it names, and whether it reads the transcript, settings.json, the prompt box or the mouse selection.the transcript |
| Writes, by name | The 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 see-stack/claude-code-mods/plugin install context-bar@seestack-mods/reload-pluginsThis installs the marketplace's latest commit, which may not be the one read here (105aa932221f). 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/see-stack/claude-code-modsgit -C claude-code-mods checkout 105aa932221f1bd3207bbe85ac738991cd54d060claude plugin validate claude-code-mods/mods/context-barclaude --plugin-dir claude-code-mods/mods/context-barThe 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 "see-stack-context-bar" with its code and make me one like itSearch them from Claude: the MCP connector
Similar mods
- blast-radiusdeepseek-ai★ 247,289
- replay-theaterdeepseek-ai★ 247,289
- code-modernizationAnthropic★ 37,653
- seo-cockpitAgrici Daniel★ 18,364
- next-stepsThariq Shihipar★ 4,505
- token-optimizerAlex Greenshpun★ 2,534
More from this repository
More by Hamza Zafar
- agent-radarHamza Zafar★ 184
- blast-radiusHamza Zafar★ 184
- browser-lanesHamza Zafar★ 184
- cache-clockHamza Zafar★ 184
- context-barHamza Zafar★ 184
- glanceHamza Zafar★ 184
See all 25 mods by Hamza Zafar
Badge for your README
If this is your mod, paste this into your README. It links to this page.
[](https://modscode.com/claude-mods/mods/see-stack-context-bar/)