modscode JA

modscode / Gallery / statusline-band

statusline-band

A panel above the prompt with rate limits and their pace, context, cost and tokens, git status and switches, actions, and a Spotify card, with Clawd and Beatbot

Code you can checkTerminal + desktopPaneBandToastBoxButtonInputText

What it does

  • Draws a pane, a band above the prompt, toasts
  • Watches tool calls and can refuse them
  • Hooks attribution.text, classic.PostToolUse, classic.PreToolUse, classic.UserPromptSubmit and 4 more
  • Keeps its own state between turns
  • Calls the network

Good points

  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors
  • Writes no files

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 statusline-band by Asyraf Hussin (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/asyrafhussin-statusline-band/
// 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: "Usage, last ‹span› days" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const count = '…'
    const message = '…'
    const query = '…'
    const fitText = '…'
    const formatClock = '…'
    const sub = '…'
    return (
      <Box flexDirection="column" paddingTop={1} paddingLeft={2} paddingRight={3}>
        <Box justifyContent="space-between">
          <Text color="#1db954" bold>
            ● Spotify
          </Text>
          <Text dimColor>
            {count}
          </Text>
        </Box>
        <Box marginTop={1} borderStyle="round" borderColor="#1db954" paddingX={1}>
          <Text dimColor>
            This surface has no text box.
          </Text>
        </Box>
        <Box marginTop={1} flexDirection="column">
          <Text dimColor>
            Type and press Enter; pick a track to play it.
          </Text>
          <Text color="#f87171">
            {message}
          </Text>
          <Text dimColor>
            {`Nothing found for “${query}”.`}
          </Text>
          <Box flexDirection="column">
            <Box justifyContent="space-between">
              <Box flexShrink={1}>
                <Text color="#1db954">
                  {"♪ "}
                </Text>
                <Button plain label={`${fitText}`} />
              </Box>
              <Text dimColor>
                {` ${formatClock}`}
              </Text>
            </Box>
            <Text dimColor wrap="truncate">
              {`  ${sub}`}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box justifyContent="space-between">
              <Box flexShrink={1}>
                <Text color="#1db954">
                  {"♪ "}
                </Text>
                <Button plain label={`${fitText}`} />
              </Box>
              <Text dimColor>
                {` ${formatClock}`}
              </Text>
            </Box>
            <Text dimColor wrap="truncate">
              {`  ${sub}`}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box justifyContent="space-between">
              <Box flexShrink={1}>
                <Text color="#1db954">
                  {"♪ "}
                </Text>
                <Button plain label={`${fitText}`} />
              </Box>
              <Text dimColor>
                {` ${formatClock}`}
              </Text>
            </Box>
            <Text dimColor wrap="truncate">
              {`  ${sub}`}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Text dimColor wrap="truncate">
            ────────────────────────
          </Text>
          <Text dimColor wrap="truncate">
            <Text color="#1db954">
              {"▶ "}
            </Text>
            ↑↓ or Tab · Enter plays · Esc closes
          </Text>
        </Box>
      </Box>
    )
  })

  // 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 arms = '…'
    const shirtText = '…'
    const arms2 = '…'
    const legs = '…'
    const text = '…'
    const text2 = '…'
    const text3 = '…'
    const historyLabel = '…'
    const text4 = '…'
    const text5 = '…'
    const text6 = '…'
    const text7 = '…'
    const text8 = '…'
    const text9 = '…'
    const text10 = '…'
    const text11 = '…'
    const text12 = '…'
    const text13 = '…'
    const text14 = '…'
    const text15 = '…'
    const text16 = '…'
    const text17 = '…'
    const text18 = '…'
    const text19 = '…'
    const text20 = '…'
    const text21 = '…'
    const text22 = '…'
    const text23 = '…'
    const text24 = '…'
    const text25 = '…'
    const text26 = '…'
    const text27 = '…'
    const text28 = '…'
    const text29 = '…'
    const text30 = '…'
    const text31 = '…'
    const text32 = '…'
    const text33 = '…'
    const text34 = '…'
    const text35 = '…'
    const text36 = '…'
    const text37 = '…'
    const text38 = '…'
    const text39 = '…'
    const text40 = '…'
    const text41 = '…'
    const text42 = '…'
    const minimizeLabel = '…'
    const text43 = '…'
    const text44 = '…'
    const text45 = '…'
    const label = '…'
    const step = '…'
    const text46 = '…'
    const text47 = '…'
    const text48 = '…'
    const text49 = '…'
    const text50 = '…'
    const text51 = '…'
    const controlGap = '…'
    const controlGap2 = '…'
    const pausePad = '…'
    const searchGap = '…'
    const time = '…'
    const volume = '…'
    const text52 = '…'
    const text53 = '…'
    const text54 = '…'
    const text55 = '…'
    const text56 = '…'
    const text57 = '…'
    const text58 = '…'
    const text59 = '…'
    const text60 = '…'
    const text61 = '…'
    const text62 = '…'
    const text63 = '…'
    const text64 = '…'
    const text65 = '…'
    const text66 = '…'
    const text67 = '…'
    const text68 = '…'
    const text69 = '…'
    const text70 = '…'
    const text71 = '…'
    const text72 = '…'
    const text73 = '…'
    const text74 = '…'
    const text75 = '…'
    const musicMinimize = '…'
    const text76 = '…'
    const text77 = '…'
    const text78 = '…'
    return (
      <Box paddingX={1} paddingY={1} flexDirection="column">
        <Box alignItems="center">
          <Box flexDirection="column" width={11} flexShrink={0}>
            <Text>
              <Text>
                {"  "}
              </Text>
              <Text color="#d97757">
                {" ▐█████▌ "}
              </Text>
            </Text>
            <Text>
              <Text>
                {"  "}
              </Text>
              <Text color="#d97757">
                {arms}
              </Text>
              <Text color="#2563eb">
                ▜
              </Text>
              <Text backgroundColor="#2563eb" color="#ffffff" bold>
                {shirtText}
              </Text>
              <Text color="#2563eb">
                ▛
              </Text>
              <Text color="#d97757">
                {arms2}
              </Text>
            </Text>
            <Text>
              <Text>
                {"  "}
              </Text>
              <Text color="#d97757">
                {legs}
              </Text>
            </Text>
          </Box>
          <Box flexDirection="column" paddingX={1}>
            <Box>
              <Text wrap="truncate">
                <Text>
                  {text}
                </Text>
                <Text>
                  {text2}
                </Text>
                <Text>
                  {text3}
                </Text>
              </Text>
              <Button plain dimColor label={`${historyLabel}`} />
              <Text wrap="truncate">
                <Text>
                  {text4}
                </Text>
                <Text>
                  {text5}
                </Text>
                <Text>
                  {text6}
                </Text>
              </Text>
            </Box>
            <Box>
              <Box flexDirection="column">
                <Text wrap="truncate">
                  <Text>
                    {text7}
                  </Text>
                  <Text>
                    {text8}
                  </Text>
                  <Text>
                    {text9}
                  </Text>
                </Text>
              </Box>
              <Box flexGrow={1} paddingX={2} justifyContent="space-between">
                <Box>
                  <Text wrap="truncate">
                    <Text>
                      {text10}
                    </Text>
                    <Text>
                      {text11}
                    </Text>
                    <Text>
                      {text12}
                    </Text>
                  </Text>
                  <Box>
                    <Text wrap="truncate">
                      <Text>
                        {text13}
                      </Text>
                      <Text>
                        {text14}
                      </Text>
                      <Text>
                        {text15}
                      </Text>
                    </Text>
                    <Box position="absolute" top={1} left={0} display="none">
                      <Text wrap="truncate">
                        <Text>
                          {text16}
                        </Text>
                        <Text>
                          {text17}
                        </Text>
                        <Text>
                          {text18}
                        </Text>
                      </Text>
                    </Box>
                  </Box>
                  <Text wrap="truncate">
                    <Text>
                      {text19}
                    </Text>
                    <Text>
                      {text20}
                    </Text>
                    <Text>
                      {text21}
                    </Text>
                  </Text>
                  <Box>
                    <Text wrap="truncate">
                      <Text>
                        {text22}
                      </Text>
                      <Text>
                        {text23}
                      </Text>
                      <Text>
                        {text24}
                      </Text>
                    </Text>
                    <Box position="absolute" top={1} left={0} display="none">
                      <Text wrap="truncate">
                        <Text>
                          {text25}
                        </Text>
                        <Text>
                          {text26}
                        </Text>
                        <Text>
                          {text27}
                        </Text>
                      </Text>
                    </Box>
                  </Box>
                  <Text wrap="truncate">
                    <Text>
                      {text28}
                    </Text>
                    <Text>
                      {text29}
                    </Text>
                    <Text>
                      {text30}
                    </Text>
                  </Text>
                  <Box>
                    <Text wrap="truncate">
                      <Text>
                        {text31}
                      </Text>
                      <Text>
                        {text32}
                      </Text>
                      <Text>
                        {text33}
                      </Text>
                    </Text>
                    <Box position="absolute" top={1} left={0} display="none">
                      <Text wrap="truncate">
                        <Text>
                          {text34}
                        </Text>
                        <Text>
                          {text35}
                        </Text>
                        <Text>
                          {text36}
                        </Text>
                      </Text>
                    </Box>
                  </Box>
                </Box>
                <Button label="compacting…" hotkey="c" variant="primary" />
              </Box>
              <Box flexDirection="column">
                <Text wrap="truncate">
                  <Text>
                    {text37}
                  </Text>
                  <Text>
                    {text38}
                  </Text>
                  <Text>
                    {text39}
                  </Text>
                </Text>
              </Box>
            </Box>
            <Box>
              <Text wrap="truncate">
                <Text>
                  {text40}
                </Text>
                <Text>
                  {text41}
                </Text>
                <Text>
                  {text42}
                </Text>
              </Text>
              <Button plain dimColor label={`${minimizeLabel}`} />
              <Text>
                <Text>
                  {text43}
                </Text>
                <Text>
                  {text44}
                </Text>
                <Text>
                  {text45}
                </Text>
              </Text>
            </Box>
          </Box>
        </Box>
        <Box marginLeft={0} justifyContent="space-between" flexWrap="wrap">
          <Box flexWrap="wrap" flexShrink={1}>
            <Box flexShrink={0}>
              <Text dimColor>
                {" · "}
              </Text>
              <Button plain dimColor label={`${label}`} />
            </Box>
            <Box flexShrink={0}>
              <Text dimColor>
                {" · "}
              </Text>
              <Button plain dimColor label={`${label}`} />
            </Box>
            <Box flexShrink={0}>
              <Text dimColor>
                {" · "}
              </Text>
              <Button plain dimColor label={`${label}`} />
            </Box>
          </Box>
          <Box flexShrink={0}>
            <Button plain dimColor label="spotify" />
            <Text color="#4ade80">
              {" on"}
            </Text>
            <Text dimColor>
              {" · "}
            </Text>
            <Button plain dimColor label="lyrics" />
            <Text color="#4ade80">
              {" on"}
            </Text>
            <Text dimColor>
              {" · "}
            </Text>
            <Button plain dimColor label={`${step}`} />
            <Text color="#4ade80">
              {" auto"}
            </Text>
            <Text dimColor>
              {" · "}
            </Text>
            <Button plain dimColor label={`${step}`} />
            <Text color="#4ade80">
              {" auto"}
            </Text>
            <Text dimColor>
              {" · "}
            </Text>
            <Button plain dimColor label={`${step}`} />
            <Text color="#4ade80">
              {" auto"}
            </Text>
          </Box>
        </Box>
        <Box marginTop={0}>
          <Box>
            <Box width={11} flexShrink={0} paddingLeft={1}>
            </Box>
            <Box flexDirection="column" paddingX={1}>
              <Text wrap="truncate">
                <Text>
                  {text46}
                </Text>
                <Text>
                  {text47}
                </Text>
                <Text>
                  {text48}
                </Text>
              </Text>
              <Box>
                <Text wrap="truncate">
                  <Text>
                    {text49}
                  </Text>
                  <Text>
                    {text50}
                  </Text>
                  <Text>
                    {text51}
                  </Text>
                </Text>
                <Box flexGrow={1} paddingX={2} justifyContent="space-between">
                  <Box flexShrink={0}>
                    <Button plain label="◀◀" />
                    <Text>
                      {controlGap}
                    </Text>
                    <Button plain label="❚❚" />
                    <Text>
                      {controlGap2}
                    </Text>
                    <Button plain label="▶▶" />
                    <Text>
                      {`${pausePad}${searchGap}`}
                    </Text>
                    <Button plain dimColor label="search" />
                    <Text>
                      {"    "}
                    </Text>
                    <Text wrap="truncate">
                      <Text color="#1db954">
                        ━━━━━━━━
                      </Text>
                      <Text dimColor>
                        ━━━━━━━━
                      </Text>
                      <Text dimColor>
                        {`  ${time}`}
                      </Text>
                    </Text>
                  </Box>
                  <Box flexShrink={0} display="flex">
                    <Button plain label="shuffle" />
                    <Text dimColor>
                      {" · "}
                    </Text>
                    <Button plain label="repeat" />
                    <Text dimColor>
                      {" · vol "}
                    </Text>
                    <Button plain dimColor label="−" />
                    <Text>
                      {` ${volume}% `}
                    </Text>
                    <Button plain dimColor label="+" />
                  </Box>
                </Box>
                <Text wrap="truncate">
                  <Text>
                    {text52}
                  </Text>
                  <Text>
                    {text53}
                  </Text>
                  <Text>
                    {text54}
                  </Text>
                </Text>
              </Box>
              <Box>
                <Text wrap="truncate">
                  <Text>
                    {text55}
                  </Text>
                  <Text>
                    {text56}
                  </Text>
                  <Text>
                    {text57}
                  </Text>
                </Text>
                <Box flexGrow={1} paddingX={2}>
                  <Text wrap="truncate">
                    {" "}
                  </Text>
                </Box>
                <Text wrap="truncate">
                  <Text>
                    {text58}
                  </Text>
                  <Text>
                    {text59}
                  </Text>
                  <Text>
                    {text60}
                  </Text>
                </Text>
              </Box>
              <Box>
                <Text wrap="truncate">
                  <Text>
                    {text61}
                  </Text>
                  <Text>
                    {text62}
                  </Text>
                  <Text>
                    {text63}
                  </Text>
                </Text>
                <Box flexGrow={1} paddingX={2}>
                  <Text wrap="truncate">
                    {" "}
                  </Text>
                </Box>
                <Text wrap="truncate">
                  <Text>
                    {text64}
                  </Text>
                  <Text>
                    {text65}
                  </Text>
                  <Text>
                    {text66}
                  </Text>
                </Text>
              </Box>
              <Box>
                <Text wrap="truncate">
                  <Text>
                    {text67}
                  </Text>
                  <Text>
                    {text68}
                  </Text>
                  <Text>
                    {text69}
                  </Text>
                </Text>
                <Box flexGrow={1} paddingX={2}>
                  <Text wrap="truncate">
                    {" "}
                  </Text>
                </Box>
                <Text wrap="truncate">
                  <Text>
                    {text70}
                  </Text>
                  <Text>
                    {text71}
                  </Text>
                  <Text>
                    {text72}
                  </Text>
                </Text>
              </Box>
              <Box>
                <Text wrap="truncate">
                  <Text>
                    {text73}
                  </Text>
                  <Text>
                    {text74}
                  </Text>
                  <Text>
                    {text75}
                  </Text>
                </Text>
                <Button plain dimColor label={`${musicMinimize}`} />
                <Text>
                  <Text>
                    {text76}
                  </Text>
                  <Text>
                    {text77}
                  </Text>
                  <Text>
                    {text78}
                  </Text>
                </Text>
              </Box>
            </Box>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const name = '…'
    const percent = '…'
    const formatReset = '…'
    await $.ui.toast(`🔥  ${name} limit at ${percent}%`)
    await $.ui.toast(`▲  ${name} limit runs out in ~${formatReset} at this pace, ${formatReset} before it resets`)
    return next(e)
  })
}

The mod's own code

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

mod/statusline-band/hooks/register.tsx lines 1038–1046 · Pane
  on('ui.render', { component: 'Pane', requestId: SEARCH_PANE }, async ($, e) => {
    const state = await read($, search)
    return drawSearchPane($.ui.resolve(e), {
      ...state,
      playingUri: (await read($, music))?.trackId ?? null,
      onSearch: query => void searchSpotify($, query),
      onPlay: track => void playFound($, track),
    })
  })
mod/statusline-band/hooks/pane.tsx lines 80–140 · Pane
export function drawSearchPane({ Box, Button, Text, Input }: Kit, view: SearchView) {
  const found = view.status === 'found' && view.tracks.length > 0
  const count = found ? `${view.tracks.length} tracks` : view.status === 'searching' ? 'searching…' : ''
  return (
    <Box flexDirection="column" paddingTop={1} paddingLeft={2} paddingRight={3}>
      <Box justifyContent="space-between">
        <Text color={SPOTIFY_GREEN} bold>{'● Spotify'}</Text>
        <Text dimColor>{count}</Text>
      </Box>
      <Box marginTop={1} borderStyle="round" borderColor={SPOTIFY_GREEN} paddingX={1}>
        {Input ? (
          <Input
            key="spotify-query"
            placeholder="a track, an artist, an album"
            value={view.query}
            submitLabel="search"
            autoFocus
            onSubmit={value => view.onSearch(value)}
          />
        ) : (
          <Text dimColor>{'This surface has no text box.'}</Text>
        )}
      </Box>
      <Box marginTop={1} flexDirection="column">
        {view.status === 'idle' ? <Text dimColor>{'Type and press Enter; pick a track to play it.'}</Text> : null}
        {view.status === 'failed' ? <Text color="#f87171">{view.message}</Text> : null}
        {view.status === 'found' && view.tracks.length === 0 ? <Text dimColor>{`Nothing found for “${view.query}”.`}</Text> : null}
        {view.tracks.map(track => {
          const isPlaying = track.uri === view.playingUri
          const sub = [track.artist, track.album].filter(Boolean).join(' · ')
          return (
            <Box key={`found-${track.uri}`} flexDirection="column">
              <Box justifyContent="space-between">
                <Box flexShrink={1}>
                  <Text color={SPOTIFY_GREEN}>{isPlaying ? '♪ ' : '  '}</Text>
                  <Button
                    key={`play-${track.uri}`}
                    plain
                    label={fitText(track.name, Math.min(TITLE_MAX, [...track.name].length))}
                    onPress={() => view.onPlay(track)}
                  />
                </Box>
                <Text dimColor>{track.durationMs ? ` ${formatClock(track.durationMs)}` : ''}</Text>
              </Box>
              <Text dimColor wrap="truncate">{`  ${sub}`}</Text>
            </Box>
          )
        })}
      </Box>
      {found ? (
        <Box flexDirection="column" marginTop={1}>
          <Text dimColor wrap="truncate">{RULE}</Text>
          <Text dimColor wrap="truncate">
            <Text color={SPOTIFY_GREEN}>{'▶ '}</Text>
            {'↑↓ or Tab · Enter plays · Esc closes'}
          </Text>
        </Box>
      ) : null}
    </Box>
  )
}
mod/statusline-band/hooks/register.tsx lines 1048–1091 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const s = await read($, snap)
    if (e.props.hasSurvey || s === null) return next(e)
    const isWorking = e.props.isWorking
    // A playing track's position counts on between Spotify's reads, so the bar, the time and the lyric move
    // with each of Beatbot's steps
    const kept = runtime.config.spotify && (await read($, musicOn)) ? await read($, music) : null
    const playing = kept && { ...kept, positionMs: livePosition(kept, await $.clock.now()) }
    const words = await read($, lyrics)
    const isLyricsOn = await read($, lyricsOn)
    const lyric = playing && isLyricsOn && words?.trackId === playing.trackId && words.lines.length > 0 ? lyricAt(words.lines, playing.positionMs) : null
    return drawBand($.ui.resolve(e), {
      s,
      config: runtime.config,
      effort: runtime.effort,
      isWorking,
      bodyColumns: e.props.bodyColumns,
      isCompacting: await read($, isCompacting),
      turn: await read($, lastTurn),
      feeling: isWorking ? 'idle' : await read($, mood),
      beat: await read($, moodTick),
      danceTick: await read($, danceTick),
      tick: isWorking ? await read($, frame) : null,
      isBlinking: await read($, isBlinking),
      music: playing,
      lyric,
      isLyricsOn: runtime.config.spotify && (await read($, musicOn)) ? isLyricsOn : null,
      onLyricsSwitch: () => void toggleLyrics($),
      isMusicCompact: await read($, musicCompact),
      isMusicOn: runtime.config.spotify ? await read($, musicOn) : null,
      onMusicSwitch: () => void toggleMusic($),
      isCardCompact: await read($, cardCompact),
      onCardCompact: () => void toggleCardCompact($),
      canDrawArt: e.surface === 'terminal',
      logoFile: e.surface === 'terminal' ? `${$.plugin.root}/assets/spotify.png` : undefined,
      actions: ACTIONS,
      onHistory: () => void openHistory($, s.day),
      onCompact: () => void compactNow($),
      onAction: action =>
        void (action.prompt === undefined ? quickCommit($) : $.prompt.submit({ text: action.prompt, asUser: true })),
      onSwitch: step => void toggleGitAuto($, step),
      onMusic: command => void controlSpotify($, command),
    })
  })
mod/statusline-band/hooks/band.tsx lines 169–328 · Band
export function drawBand({ Box, Button, Text, Raster, Image }: Kit, view: BandView) {
  const { s, config, turn, feeling, beat, tick, isWorking } = view

  // Pieces of text whose widths are known, so the frame can be drawn to fit them
  type Seg = { text: string; color?: string; bold?: boolean; dim?: boolean }
  const width = (segs: Seg[]) => segs.reduce((n, seg) => n + [...seg.text].length, 0)
  const draw = (segs: Seg[]) =>
    segs.map(seg => (
      <Text color={seg.color} bold={seg.bold} dimColor={seg.dim}>{seg.text}</Text>
    ))

  const border = isWorking ? COLORS.borderBusy : feeling === 'sweat' ? COLORS.hot : COLORS.border
  const line = (text: string): Seg => ({ text, color: border })
  const total = Math.max(40, view.bodyColumns - 2 - CLAWD_WIDTH - ENGINE_MARK_WIDTH - CARD_INSET * 2)

  // Top edge: the project as the panel's title, then the model and its effort
  const g = s.git
  const sep: Seg = { text: ' · ', dim: true }
  const diffSegs = (added: number, removed: number): Seg[] => [
    ...(added > 0 ? [{ text: ` +${added}`, color: COLORS.ok }] : []),
    ...(removed > 0 ? [{ text: ` −${removed}`, color: COLORS.hot }] : []),
  ]
  // Each git fact is its own group: uncommitted work, commits to push and pull, then the last commit
  const gitGroups: Seg[][] =
    g === null
      ? []
      : [
          ...(g.changed > 0
            ? [[{ text: `✎ ${g.changed} ${g.changed === 1 ? 'file' : 'files'}`, color: COLORS.warn }, ...diffSegs(g.added, g.removed)]]
            : []),
          ...(g.ahead > 0
            ? [
                [
                  { text: `↑ ${g.ahead} ${g.ahead === 1 ? 'commit' : 'commits'}`, color: COLORS.warn },
                  ...diffSegs(g.unpushedAdded, g.unpushedRemoved),
                ],
              ]
            : []),
          ...(g.behind > 0 ? [[{ text: `↓ ${g.behind} behind`, color: COLORS.hot }]] : []),
          ...(g.stashed > 0 ? [[{ text: `≡ ${g.stashed} stash`, color: COLORS.model }]] : []),
          ...(g.changed === 0 && g.hasUpstream && g.ahead === 0 && g.behind === 0
            ? [[{ text: '✓ synced', color: COLORS.ok }]]
            : []),
          ...(g.lastCommitAt !== null
            ? [[{ text: `committed ${s.now - g.lastCommitAt < 60_000 ? 'just now' : `${formatReset(s.now - g.lastCommitAt)} ago`}`, dim: true }]]
            : []),
          ...(!g.hasUpstream ? [[{ text: 'no upstream', color: COLORS.warn }]] : []),
        ]
  const effort = view.effort ?? s.effort
  const title: Seg[] = [
    line('╭─ '),
    { text: `◆ ${s.folder}`, color: COLORS.folder, bold: true },
    ...(s.subdir ? [{ text: s.subdir, dim: true }] : []),
    ...(g === null ? [] : [line(' ─ '), { text: g.branch, color: COLORS.branch }]),
    line(' ─ '),
    { text: `✦ ${s.model}`, color: COLORS.model },
    ...(effort ? [{ text: ` · ${effort}`, dim: true }] : []),
    ...(s.plan ? [{ text: ' · ', dim: true }, { text: s.plan, color: CLAWD_COLOR, bold: true }] : []),
    { text: ' ' },
  ]
  // Top right: what the session, today and the history window have cost, each with its tokens
  const hours = (s.now - s.startedAt) / 3_600_000
  const cost: Seg[] = []
  const costShort: Seg[] = []
  // A snapshot kept from before a reload may predate the token counts
  const counted = (s.tokens as Snapshot['tokens'] | undefined) ?? { session: 0, today: 0, rolling: 0 }
  if (s.costUsd !== null) {
    const tokens = (n: number): Seg[] => (n > 0 ? [{ text: ` ${formatTokens(n)}`, color: COLORS.model }] : [])
    cost.push(
      { text: ' ' },
      { text: formatUsd(s.costUsd), color: COLORS.ok, bold: true },
      ...tokens(counted.session),
      { text: ' session', dim: true },
    )
    costShort.push(...cost, { text: ' ' })
    if (hours > 0.05) cost.push({ text: ` ${formatUsd(s.costUsd / hours)}/h`, dim: true })
    const addTotal = (usd: number, n: number) =>
      cost.push({ text: ' · ', dim: true }, { text: formatUsd(usd), color: COLORS.ok }, ...tokens(n), { text: ' ' })
    // Today only when it adds to the session; the history window always, even while it matches today
    if (s.todayUsd !== null && s.todayUsd - s.costUsd >= 0.01) {
      addTotal(s.todayUsd, counted.today)
      cost.push({ text: 'today', dim: true })
    }
    // The window's label is a button that opens the history pane, so it is drawn apart
    if (s.rollingUsd !== null) addTotal(s.rollingUsd, counted.rolling)
  }
  const historyLabel = `${config.rollingDays}d`
  const hasHistory = s.costUsd !== null && s.rollingUsd !== null
  const costWidth = width(cost) + (hasHistory ? historyLabel.length : 0) + 1
  // When the whole line does not fit beside the title, the session cost alone still shows
  const fits = (n: number) => width(title) + n + 3 <= total
  const showFull = cost.length > 0 && fits(costWidth)
  const right = showFull ? cost : fits(width(costShort)) ? costShort : []
  const rightWidth = showFull ? costWidth : width(right)
  const topLeft = [...title, line('─'.repeat(Math.max(1, total - width(title) - rightWidth - 2))), ...right]
  const topRight = [...(showFull ? [{ text: ' ' }] : []), line('─╮')]

  // Bottom edge: running subagents and git on the left; the last reply's tokens, how long the session has
  // run and the time on the right
  const running = (s.agents as number | undefined) ?? 0
  const groups: Seg[][] = [
    ...(running > 0 ? [[{ text: `↻ ${running} ${running === 1 ? 'agent' : 'agents'}`, color: COLORS.model }]] : []),
    ...gitGroups,
  ]
  const changes: Seg[] =
    groups.length === 0 ? [] : [{ text: ' ' }, ...groups.flatMap((group, i) => (i === 0 ? group : [sep, ...group])), { text: ' ' }]
  const clock: Seg[] = [
    { text: ' ' },
    // The last turn's tokens, its responses summed: read in (cache included) and written out
    ...(turn
      ? [
          { text: 'in ', dim: true },
          { text: formatTokens(turn.input), color: COLORS.model },
          ...(turn.input > 0 && turn.cached !== undefined
            ? [{ text: ` (${Math.floor((turn.cached / turn.input) * 100)}% cache)`, dim: true }]
            : []),
          { text: ' · out ', dim: true },
          { text: formatTokens(turn.output), color: COLORS.model },
          { text: ' · ', dim: true },
        ]
      : []),
    { text: `session ${formatDuration(s.now - s.startedAt)}`, dim: true },
    { text: ' · ', dim: true },
    { text: s.time, dim: true },
    { text: ' ' },
  ]
  // On its right, after the time, the button that shrinks the card to one line
  const [mainDot = '', minimizeLabel = '', mainCorner = ''] = MAIN_BOTTOM_TAIL
  const fill = bottomFill(total, width(changes) + width(clock), MAIN_BOTTOM_TAIL)
  const bottom = [line('╰─'), ...changes, line('─'.repeat(fill)), ...clock, { text: mainDot, dim: true }]

  // Shrunk: one line from the band's left edge, in place of the card and Clawd: the repo and branch, the model, each limit and the
  // context as a percent, the first git fact, and the session cost, with the button that brings it back
  const compactSegs: Seg[] = [
    { text: `◆ ${s.folder}`, color: COLORS.folder, bold: true },
    ...(g === null ? [] : [{ text: ' ' }, { text: g.branch, color: COLORS.branch }]),
    sep,
    { text: `✦ ${s.model}`, color: COLORS.model },
    ...s.limits.flatMap((l): Seg[] => [
      sep,
      { text: `${ring(l.percent)} `, color: toneHex(l.percent) },
      { text: `${Math.round(l.percent)}%`, bold: true, color: l.percent >= 50 ? toneHex(l.percent) : undefined },
      { text: ` ${LIMIT_LABELS[l.kind] ?? l.kind}`, dim: true },
    ]),
    ...(s.context
      ? [
          sep,
          { text: 'ctx ', dim: true },
          { text: `${Math.round(s.context.percent)}%`, bold: true, color: s.context.percent >= 50 ? toneHex(s.context.percent) : undefined },
        ]
      : []),
    ...(gitGroups[0] ? [sep, ...gitGroups[0]] : []),
    ...(s.costUsd !== null ? [sep, { text: formatUsd(s.costUsd), color: COLORS.ok, bold: true }] : []),
  ]

  // Clawd
  const step = tick === null ? 0 : Math.floor(tick / 2)
  const pose =
    tick !== null
      ? CLAWD_RUN[step % CLAWD_RUN.length] ?? CLAWD_IDLE
Licence text (MIT)
MIT License

Copyright (c) 2026 Asyraf Hussin

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

networkruns programsreads filesenv varsdrives Claudetool callsremembers

The design, read from code

Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.

What its code shows

Read from the source at commit 779b070b5057 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.mod/statusline-band/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.7 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).mod/statusline-band/hooks/register.tsx:229 date (not on Windows); mod/statusline-band/hooks/register.tsx:230 date (not on Windows); mod/statusline-band/hooks/register.tsx:364 date (not on Windows); mod/statusline-band/hooks/register.tsx:920 date (not on Windows); mod/statusline-band/hooks/register.tsx:1014 date (not on Windows)
NetworkWhether every fetch names its https host in the code.mod/statusline-band/hooks/register.tsx:565 fetch(lyricsUrl(m))
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.mod/statusline-band/hooks/register.tsx:535 osascript (a shell or interpreter); mod/statusline-band/hooks/register.tsx:616 osascript (a shell or interpreter)
Reads and sendsWhether it both reads files or environment variables and reaches the network.reads environment variables and files and reaches the 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 AsyrafHussin/claude-code-statusline
/plugin install statusline-band@claude-code-statusline

This installs the marketplace's latest commit, which may not be the one read here (779b070b5057). 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 "asyrafhussin-statusline-band" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs