modscode JA

modscode / Gallery / bullswarm

bullswarm

Bullswarm as a Claude Mod: live subscription meters for every installed coding-agent CLI above the prompt, quota-aware routing of Claude's own subagents to whichever pool has surplus, a verdict note on every bullswarm command the model run…

Code you can checkTerminal + desktopPaneBandStatus lineToastBoxButtonText

What it does

  • Draws a band above the prompt, toasts
  • Watches Agent, Bash calls
  • Hooks engine.create, prompt.context, session.start, ui.close and 1 more
  • Keeps its own state between turns
  • Starts processes

Good points

  • No network calls
  • Written in TypeScript
  • 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 bullswarm by cowcow02 (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/bulls-work-bullswarm/
// 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 summary = '…'
    const lastError = '…'
    const name = '…'
    const used = '…'
    const elapsed = '…'
    const running = '…'
    const name2 = '…'
    const used2 = '…'
    const elapsed2 = '…'
    const running2 = '…'
    const name3 = '…'
    const used3 = '…'
    const elapsed3 = '…'
    const running3 = '…'
    const i = '…'
    const shortId = '…'
    const done = '…'
    const runStatusText = '…'
    const goal = '…'
    const done2 = '…'
    const runStatusText2 = '…'
    const goal2 = '…'
    const done3 = '…'
    const runStatusText3 = '…'
    const goal3 = '…'
    const lane = '…'
    const nameOf = '…'
    const timingOf = '…'
    const source = '…'
    const lane2 = '…'
    const nameOf2 = '…'
    const lane3 = '…'
    const nameOf3 = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" flexWrap="nowrap" gap={1} marginRight={4}>
          <Box flexShrink={1} overflow="hidden">
            <Text wrap="truncate-end">
              <Text bold color="magenta">
                bullswarm
              </Text>
              <Text dimColor>
                {" "}
                {summary}
                {" · used/elapsed · pace"}
              </Text>
            </Text>
          </Box>
          <Box flexShrink={0} flexDirection="row" gap={1}>
            <Button hotkey="w" label="[w] close" />
          </Box>
        </Box>
        <Text color="red" wrap="truncate-end">
          {lastError}
        </Text>
        <Box flexDirection="row">
          <Text wrap="truncate-end">
            <Text>
              {name}
            </Text>
            <Text backgroundColor="#3a3a3a">
              ········
            </Text>
            <Text>
              {" "}
              {used}
            </Text>
            <Text dimColor>
              {elapsed}
            </Text>
            <Text bold>
              {"  "}
              quarantined
            </Text>
            <Text color="cyan">
              {running}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text wrap="truncate-end">
            <Text>
              {name2}
            </Text>
            <Text backgroundColor="#3a3a3a">
              ········
            </Text>
            <Text>
              {" "}
              {used2}
            </Text>
            <Text dimColor>
              {elapsed2}
            </Text>
            <Text bold>
              {"  "}
              quarantined
            </Text>
            <Text color="cyan">
              {running2}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text wrap="truncate-end">
            <Text>
              {name3}
            </Text>
            <Text backgroundColor="#3a3a3a">
              ········
            </Text>
            <Text>
              {" "}
              {used3}
            </Text>
            <Text dimColor>
              {elapsed3}
            </Text>
            <Text bold>
              {"  "}
              quarantined
            </Text>
            <Text color="cyan">
              {running3}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row">
          <Button plain hotkey={`${i}`} label={`⧖ ${shortId}`} />
          <Text wrap="truncate-end">
            <Text color="magenta">
              {" ●"}
            </Text>
            <Text color="green">
              {"  "}
              {done}
            </Text>
            <Text color="yellow">
              {" "}
              {runStatusText}
            </Text>
            <Text color="cyan">
              {`  ${running}`}
            </Text>
            <Text dimColor>
              {" "}
              {goal}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row">
          <Button plain hotkey={`${i}`} label={`⧖ ${shortId}`} />
          <Text wrap="truncate-end">
            <Text color="magenta">
              {" ●"}
            </Text>
            <Text color="green">
              {"  "}
              {done2}
            </Text>
            <Text color="yellow">
              {" "}
              {runStatusText2}
            </Text>
            <Text color="cyan">
              {`  ${running}`}
            </Text>
            <Text dimColor>
              {" "}
              {goal2}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row">
          <Button plain hotkey={`${i}`} label={`⧖ ${shortId}`} />
          <Text wrap="truncate-end">
            <Text color="magenta">
              {" ●"}
            </Text>
            <Text color="green">
              {"  "}
              {done3}
            </Text>
            <Text color="yellow">
              {" "}
              {runStatusText3}
            </Text>
            <Text color="cyan">
              {`  ${running}`}
            </Text>
            <Text dimColor>
              {" "}
              {goal3}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text wrap="truncate-end">
            <Text color="cyan" bold>
              ▶ run
            </Text>
            <Text>
              {"  "}
              {lane}
              @
              {nameOf}
            </Text>
            <Text dimColor>
              {`  ${timingOf}`}
              {`  ${source}`}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text wrap="truncate-end">
            <Text color="cyan" bold>
              ▶ run
            </Text>
            <Text>
              {"  "}
              {lane2}
              @
              {nameOf2}
            </Text>
            <Text dimColor>
              {`  ${timingOf}`}
              {`  ${source}`}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text wrap="truncate-end">
            <Text color="cyan" bold>
              ▶ run
            </Text>
            <Text>
              {"  "}
              {lane3}
              @
              {nameOf3}
            </Text>
            <Text dimColor>
              {`  ${timingOf}`}
              {`  ${source}`}
            </Text>
          </Text>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const description = '…'
    const pool = '…'
    await $.ui.toast(`bullswarm routed "${description}" to ${pool}`)
    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.

mods/bullswarm/hooks/register.ts lines 841–873 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (stripLevel === 'off' || e.surface === 'mobile' || e.props.hasSurvey || pools.length === 0)
      return next(e)

    const { Box, Text, Button } = await $.ui.resolve(e)
    const h = host

    return strip(
      { ui: { Box, Text, Button }, columns: e.props.bodyColumns, maxRows: e.props.maxRows },
      {
        pools,
        runs,
        assignments,
        autoRoute,
        routedCount: routed.length,
        lastError,
        paneOpen,
        selectedShortId,
        names,
        level: stripLevel,
      },
      {
        pane: () => {
          if (!h) return
          void (paneOpen ? closePane(h) : openPane(h, null))
        },
        open: shortId => {
          if (!h) return
          void (paneOpen && selectedShortId === shortId ? closePane(h) : openPane(h, shortId))
        },
      },
    )
  })
mods/bullswarm/hooks/strip.tsx lines 43–148 · Band
export function strip(
  kit: { ui: StripUi; columns: number; maxRows: number },
  model: StripModel,
  actions: StripActions,
): RenderElement {
  const { Box, Text, Button } = kit.ui
  const budget = Math.max(1, kit.maxRows - 1)
  const pools = model.level === 'full' ? model.pools.filter(p => p.enabled).slice(0, budget) : []
  const loose = looseOf(model.runs, model.assignments)
  const runRows = Math.max(0, budget - pools.length)
  const runs = model.runs.slice(0, runRows)
  const looseShown = loose.slice(0, Math.max(0, runRows - runs.length))
  const nameOf = (pool: string) => model.names.get(pool) ?? pool

  const summary = [
    model.runs.length ? `${model.runs.length} run${model.runs.length === 1 ? '' : 's'}` : 'no runs',
    model.assignments.length ? `${model.assignments.length} in flight` : '',
    model.routedCount ? `${model.routedCount} routed` : '',
    model.autoRoute ? '' : 'route off',
  ]
    .filter(Boolean)
    .join(' · ')

  return (
    <Box flexDirection="column">
      <Box flexDirection="row" flexWrap="nowrap" gap={1} marginRight={4}>
        <Box flexShrink={1} overflow="hidden">
          <Text wrap="truncate-end">
            <Text bold color="magenta">
              bullswarm
            </Text>
            <Text dimColor> {summary}{model.level === 'full' ? ' · used/elapsed · pace' : ''}</Text>
          </Text>
        </Box>
        <Box flexShrink={0} flexDirection="row" gap={1}>
          <Button
            key="pane"
            hotkey="w"
            label={model.paneOpen ? '[w] close' : '[w] runs'}
            onPress={actions.pane}
          />
        </Box>
      </Box>
      {model.lastError ? (
        <Text color="red" wrap="truncate-end">
          {model.lastError}
        </Text>
      ) : null}
      {poolRows({ Box, Text }, pools, model.assignments, model.names)}
      {runs.map((run, i) => {
        const steps = stepsOf(run, model.assignments)
        const done = `${run.actionsSucceeded}/${run.actionsTotal}`
        // One step in flight is named; the rest are counted, so the goal
        // that says which run this is always stays on the row.
        const named = steps
          .slice(0, 1)
          .map(a => `${a.actionId ?? '?'}@${nameOf(a.pool)}${timingOf(a) ? ` ${timingOf(a)}` : ''}`)
          .join(', ')
        const running = steps.length > 1 ? `${named}, and ${String(steps.length - 1)} more` : named
        const finished = run.status !== 'running'
        // A parked v3 run waits for the caller at a gate or loop.
        const waiting = (run.waitingFor ?? []).length > 0
        const selected = model.selectedShortId === run.shortId && model.paneOpen

        return (
          <Box key={run.runId} flexDirection="row">
            <Button
              key={`open-${run.shortId}`}
              plain
              hotkey={i < 9 ? String(i + 1) : undefined}
              label={`${waiting ? '⧖' : finished ? '◼' : '▶'} ${run.shortId}`}
              onPress={() => actions.open(run.shortId)}
            />
            <Text wrap="truncate-end">
              <Text color="magenta">{selected ? ' ●' : ''}</Text>
              <Text color="green">
                {'  '}
                {done}
              </Text>
              {finished ? <Text color="yellow">  {runStatusText(run)}</Text> : null}
              <Text color="cyan">{running ? `  ${running}` : ''}</Text>
              <Text dimColor>  {run.goal}</Text>
            </Text>
          </Box>
        )
      })}
      {looseShown.map((a, i) => (
        <Box key={`loose-${String(i)}`} flexDirection="row">
          <Text wrap="truncate-end">
            <Text color="cyan" bold>
              ▶ run
            </Text>
            <Text>
              {'  '}
              {a.lane}@{nameOf(a.pool)}
            </Text>
            <Text dimColor>
              {timingOf(a) ? `  ${timingOf(a)}` : ''}
              {a.source ? `  ${a.source}` : ''}
            </Text>
          </Text>
        </Box>
      ))}
    </Box>
  )
}
mods/bullswarm/hooks/pool-rows.tsx lines 84–116 · Band
export function poolRows(
  ui: RowsUi,
  pools: readonly BullswarmPool[],
  assignments: readonly BullswarmAssignment[],
  names: ReadonlyMap<string, string>,
): RenderElement[] {
  const { Box, Text } = ui
  return pools
    .filter(p => p.enabled)
    .map(p => {
      const state = stateOf(p)
      const name = (names.get(p.name) ?? p.name).padEnd(NAME_WIDTH).slice(0, NAME_WIDTH)
      const used = p.usedPct === null ? '  —' : `${String(Math.round(p.usedPct)).padStart(3)}%`
      const elapsed = p.elapsedPct === null ? '' : `/${String(Math.round(p.elapsedPct)).padStart(2)}%`
      const busy = assignments.filter(a => a.pool === p.name)
      const running = busy.length ? `  ${busy.map(a => a.actionId ?? a.lane).join(', ')}` : ''
      return (
        <Box key={p.name} flexDirection="row">
          <Text wrap="truncate-end">
            <Text>{name}</Text>
            {meterBar(Text, p.usedPct, p.elapsedPct, BAR_WIDTH)}
            <Text> {used}</Text>
            <Text dimColor>{elapsed}</Text>
            <Text color={state.color} bold>
              {'  '}
              {p.quarantine ? 'quarantined' : paceText(p)}
            </Text>
            {running ? <Text color="cyan">{running}</Text> : null}
          </Text>
        </Box>
      )
    })
}
mods/bullswarm/hooks/pool-rows.tsx lines 30–72 · Band
export function meterBar(
  Text: RowsUi['Text'],
  usedPct: number | null,
  elapsedPct: number | null,
  width: number,
  key?: string,
): RenderElement {
  if (usedPct === null) return <Text key={key} backgroundColor={TRACK}>{'·'.repeat(width)}</Text>
  const fill = severityColor(usedPct)
  const filled = Math.max(0, Math.min(width, Math.floor((usedPct / 100) * width)))
  let mark = -1
  let glyph = '▏'
  if (elapsedPct !== null) {
    mark = Math.floor((elapsedPct / 100) * width)
    if (mark >= width) {
      mark = width - 1
      glyph = '▕'
    }
  }
  const cells: RenderElement[] = []
  let i = 0
  while (i < width) {
    const bg = i < filled ? fill : TRACK
    if (i === mark) {
      cells.push(
        <Text key={`m${String(i)}`} color="white" backgroundColor={bg}>
          {glyph}
        </Text>,
      )
      i += 1
      continue
    }
    let j = i
    while (j < width && j !== mark && (j < filled) === (i < filled)) j += 1
    cells.push(
      <Text key={`c${String(i)}`} backgroundColor={bg}>
        {' '.repeat(j - i)}
      </Text>,
    )
    i = j
  }
  return <Text key={key}>{cells}</Text>
}
Licence text (MIT)
MIT License

Copyright (c) 2026 bullswarm contributors

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

runs programsreads filesenv varstool 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 5b4d51c63b68 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.mods/bullswarm/hooks/register.ts
ParsesEvery file parses as TypeScript or JavaScript.12 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.mods/bullswarm/hooks/register.ts:475 a program named at run time; mods/bullswarm/hooks/register.ts:516 a program named at run time
Reads and sendsWhether it both reads files or environment variables and reaches the network.reaches no 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 Bulls-Work/bullswarm
/plugin install bullswarm@bullswarm

This installs the marketplace's latest commit, which may not be the one read here (5b4d51c63b68). 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 "bulls-work-bullswarm" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs