modscode JA

modscode / Gallery / workbench

workbench

Workbench for Claude Code: a live narration band above the prompt and a side pane with this turn's steps, working tree changes and turn history.

Code you can checkTerminal + desktopPaneBandStatus lineToastBoxButtonSvgText

What it does

  • Draws a band above the prompt, a pane, the status line, toasts
  • Adds /workbench
  • Watches tool calls and can refuse them
  • Hooks prompt.submit, session.start, turn.complete, turn.step
  • Keeps its own state between turns

Good points

  • No network calls
  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors

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 workbench by fanbuz (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/fanbuz-workbench/
// 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 text = '…'
    const bandSteps = '…'
    const elapsed = '…'
    const bandFailures = '…'
    const bandChanges = '…'
    const current = '…'
    const input = '…'
    const fmtTokens = '…'
    const output = '…'
    const fmtTokens2 = '…'
    const cacheRead = '…'
    const fmtTokens3 = '…'
    const cacheWrite = '…'
    const fmtTokens4 = '…'
    const narrator = '…'
    const fmtTokens5 = '…'
    const hit = '…'
    const hitRate = '…'
    const cost = '…'
    const costUsd = '…'
    const ctx = '…'
    const GLYPHS = '…'
    const legend = '…'
    const GLYPHS2 = '…'
    const legend2 = '…'
    const GLYPHS3 = '…'
    const legend3 = '…'
    return (
      <Box flexDirection="column" paddingX={1}>
        <Box flexDirection="row" gap={1}>
          <Box flexGrow={1} flexShrink={1} minWidth={0}>
            <Text wrap="wrap">
              {text}
            </Text>
          </Box>
          <Box flexShrink={0}>
            <Button plain dimColor label="Collapse" />
          </Box>
          <Box width={6} flexShrink={0} justifyContent="flex-end">
            <Text color="#D97757">
              ● ● ●
            </Text>
          </Box>
        </Box>
        <Text color="#B0AEA5" dimColor wrap="truncate-end">
          ────────
        </Text>
        <Box flexDirection="row" alignItems="center" gap={2}>
          <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row" flexWrap="wrap" columnGap={2}>
            <Text>
              {`${bandSteps}`}
            </Text>
            <Text>
              <Text dimColor>
                {"Time "}
              </Text>
              <Text bold>
                {elapsed}
              </Text>
            </Text>
            <Box>
              <Button plain label={`${bandFailures}`} />
            </Box>
            <Box>
              <Button plain label={`${bandChanges}`} />
            </Box>
            <Text dimColor wrap="truncate-end">
              {"▸ "}
              {current}
            </Text>
          </Box>
          <Box flexShrink={0} flexDirection="row" alignItems="center" gap={1}>
            <Button label="▤ Workbench" />
            <Button label="⚙ Settings" />
          </Box>
        </Box>
        <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
          <Box flexDirection="row" alignItems="center" gap={1}>
            {`${input}`}
            <Text bold color="#D97757">
              {fmtTokens}
            </Text>
          </Box>
          <Box flexDirection="row" alignItems="center" gap={1}>
            {`${output}`}
            <Text bold color="#6A9BCC">
              {fmtTokens2}
            </Text>
          </Box>
          <Box flexDirection="row" alignItems="center" gap={1}>
            {`${cacheRead}`}
            <Text bold color="#788C5D">
              {fmtTokens3}
            </Text>
          </Box>
          <Box flexDirection="row" alignItems="center" gap={1}>
            {`${cacheWrite}`}
            <Text bold color="#D4A27F">
              {fmtTokens4}
            </Text>
          </Box>
          <Box flexDirection="row" alignItems="center" gap={1}>
            {`${narrator}`}
            <Text bold color="#8F8A80">
              {fmtTokens5}
            </Text>
          </Box>
          <Text dimColor>
            │
          </Text>
          <Box flexDirection="row" alignItems="center" gap={1}>
            {`${hit}`}
            <Text bold color="#B5836B">
              {`${hitRate}%`}
            </Text>
          </Box>
          <Box flexDirection="row" alignItems="center" gap={1}>
            {`${cost}`}
            <Text bold color="#788C5D">
              {costUsd}
            </Text>
          </Box>
          <Box flexDirection="row" alignItems="center" gap={1}>
            <Text>
              ▤
            </Text>
            <Text>
              <Text>
                ▰▰▰▰▰▰▰▰
              </Text>
              <Text color="#8F8A80">
                ▱▱▱▱▱▱▱▱
              </Text>
              <Text bold>
                {" "}
                {ctx}
                %
              </Text>
            </Text>
          </Box>
          <Box>
            <Button plain label="ⓘ Hide" />
          </Box>
        </Box>
        <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
          <Box flexDirection="row" alignItems="center" gap={1}>
            <Text>
              {GLYPHS}
            </Text>
            <Text dimColor>
              {legend}
            </Text>
          </Box>
          <Box flexDirection="row" alignItems="center" gap={1}>
            <Text>
              {GLYPHS2}
            </Text>
            <Text dimColor>
              {legend2}
            </Text>
          </Box>
          <Box flexDirection="row" alignItems="center" gap={1}>
            <Text>
              {GLYPHS3}
            </Text>
            <Text dimColor>
              {legend3}
            </Text>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Workbench settings" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const title = '…'
    const desc = '…'
    const choice = '…'
    const title2 = '…'
    const desc2 = '…'
    const title3 = '…'
    const desc3 = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Text bold>
          Workbench settings
        </Text>
        <Box flexDirection="column">
          <Text>
            <Text bold>
              {title}
            </Text>
            <Text dimColor>
              {"  Saving…"}
            </Text>
          </Text>
          <Text dimColor wrap="wrap">
            {desc}
          </Text>
          <Box flexDirection="row" gap={1} flexWrap="wrap">
            <Button label={`${choice}`} variant="primary" />
            <Button label={`${choice}`} variant="primary" />
            <Button label={`${choice}`} variant="primary" />
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text>
            <Text bold>
              {title2}
            </Text>
            <Text dimColor>
              {"  Saving…"}
            </Text>
          </Text>
          <Text dimColor wrap="wrap">
            {desc2}
          </Text>
          <Box flexDirection="row" gap={1} flexWrap="wrap">
            <Button label={`${choice}`} variant="primary" />
            <Button label={`${choice}`} variant="primary" />
            <Button label={`${choice}`} variant="primary" />
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text>
            <Text bold>
              {title3}
            </Text>
            <Text dimColor>
              {"  Saving…"}
            </Text>
          </Text>
          <Text dimColor wrap="wrap">
            {desc3}
          </Text>
          <Box flexDirection="row" gap={1} flexWrap="wrap">
            <Button label={`${choice}`} variant="primary" />
            <Button label={`${choice}`} variant="primary" />
            <Button label={`${choice}`} variant="primary" />
          </Box>
        </Box>
        <Text dimColor wrap="wrap">
          Saved to your Claude Code settings (pluginConfigs); the workbench reloads to apply.
        </Text>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const statusLine = '…'
    const compactSkipped = '…'
    await $.ui.status(`${statusLine}`)
    await $.ui.toast(`${compactSkipped}`)
    await $.ui.toast(`Copied`)
    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.

plugins/workbench/hooks/register.tsx lines 603–762 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const line = await read($, lineAtom)
    if (config.bandMode !== 'band' || e.props.hasSurvey || !line) return next(e)
    await read($, tickAtom) // 订阅慢速时钟,让用时走起来
    const isLegendOpen = await read($, legendAtom)
    const isExpanded = await read($, narrationExpandedAtom)
    const gitState = await read($, gitAtom)

    const resolved = $.ui.resolve(e)
    const { Box, Text, Button } = resolved
    // 终端的组件表里也有 Svg,但只会显示替代文字,所以按表面判断:终端走 Unicode 符号和纯文本
    const Svg = e.surface !== 'terminal' && 'Svg' in resolved ? resolved.Svg : null
    const now = Date.now()
    const isWorkingNow = line.phase === 'working'
    const elapsed = duration((line.endedAt ?? now) - line.startedAt)
    const color = isWorkingNow ? CLAY : line.phase === 'done' ? CLAY_MUTED : STONE

    const t = line.tokens
    const hasTokens = t.input + t.output + t.cacheRead + t.cacheWrite > 0
    const prompt = t.input + t.cacheRead + t.cacheWrite
    const hitRate = prompt > 0 ? Math.round((t.cacheRead / prompt) * 100) : null
    const ctx = line.contextPercent
    const ctxColor = ctx === null ? CLOUD : ctx >= 85 ? ALERT : ctx >= 60 ? AMBER : CLAY_MUTED
    const ctxFilled = ctx === null ? 0 : Math.max(0, Math.min(10, Math.round(ctx / 10)))
    const rule = '─'.repeat(Math.max(10, Math.min(240, e.props.bodyColumns - 2)))
    const isFresh = (at: number) => isWorkingNow && now - at < FLASH_MS

    // 第一行旁白:按 narrationOverflow 决定放不下时怎么办
    const overflow = config.overflow === 'scroll' && !Svg ? 'wrap' : config.overflow
    const marqueeW = Math.max(200, Math.min(1400, (e.props.bodyColumns - 10) * 8))
    const narration =
      overflow === 'scroll' && Svg ? (
        <Box flexGrow={1} flexShrink={1} minWidth={0} overflow="hidden">
          <Svg source={marqueeSvg(line.text, color, isWorkingNow, marqueeW)} alt={line.text} width={marqueeW} height={MARQUEE_H} />
        </Box>
      ) : overflow === 'wrap' || isExpanded ? (
        <Box flexGrow={1} flexShrink={1} minWidth={0}>
          <Text bold={isWorkingNow} color={color} wrap="wrap">
            {line.text}
          </Text>
        </Box>
      ) : (
        // 省略:单行截断;放不下时旁边有「全文」按钮,点了才展开
        <Box flexGrow={1} flexShrink={1} minWidth={0}>
          <Text bold={isWorkingNow} color={color} wrap="truncate-end">
            {line.text}
          </Text>
        </Box>
      )
    // 估算放不下:按格数比较,右侧还有状态格和按钮。Desktop 用的是比例字体,格数和实际宽度对不准,
    // 门槛放宽到六成:宁可在刚好放得下时多显示一个「全文」,也不要截断了却没有入口
    const isLong = cellWidth(line.text) > (e.props.bodyColumns - 16) * 0.6
    const expandToggle =
      overflow === 'truncate' && (isLong || isExpanded) ? (
        <Box key="narration-toggle" flexShrink={0}>
          <Button
            key="narration-expand"
            plain
            dimColor
            label={isExpanded ? tr().collapseNarration : tr().expandNarration}
            hover={{ underline: true, dimColor: false }}
            onPress={() => void update($, narrationExpandedAtom, v => !v)}
          />
        </Box>
      ) : null

    // 图标的含义:悬停弹出太容易误触(引擎的悬停没有延迟),改成点 ⓘ 才在下方展开图例
    const icon = (kind: IconKind, c: string) =>
      Svg ? (
        <Svg source={ICONS[kind](c)} alt={tr().alt[kind]} width={iconWidth(kind)} height={ICON_H} />
      ) : (
        <Text color={c}>{GLYPHS[kind]}</Text>
      )
    const legend = (
      <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
        {(['input', 'output', 'cacheRead', 'cacheWrite', 'narrator', 'hit', 'cost', 'context'] as const).map(kind => (
          <Box flexDirection="row" alignItems="center" gap={1}>
            {icon(kind, kind === 'input' ? CLAY : kind === 'output' ? SKY : kind === 'cacheRead' ? OLIVE : kind === 'cacheWrite' ? AMBER : kind === 'hit' || kind === 'context' ? CLAY_MUTED : kind === 'cost' ? OLIVE : IDLE)}
            <Text dimColor>{tr().legend[kind]}</Text>
          </Box>
        ))}
      </Box>
    )

    // 一个指标:图标 + 加粗数值;图标颜色表示类别,刚增长时换成高亮色、数值同色
    const stat = (kind: IconKind, value: string, tint: string, isLit = false) => {
      const c = isLit ? tint : kind === 'input' || kind === 'output' ? IDLE : tint
      return (
        <Box flexDirection="row" alignItems="center" gap={1}>
          {icon(kind, c)}
          <Text bold color={isLit ? tint : undefined}>
            {value}
          </Text>
        </Box>
      )
    }

    return (
      <Box flexDirection="column" paddingX={1}>
        {/* 旁白占满左侧,状态钉在右侧固定宽度的格子里:文字长短变化不会挪动它 */}
        <Box flexDirection="row" gap={1}>
          {narration}
          {expandToggle}
          <Box width={6} flexShrink={0} justifyContent="flex-end">
            {isWorkingNow ? (
              Svg ? (
                <Svg source={dotsSvg(CLAY, CLOUD)} alt={tr().working} width={DOTS_W} height={DOTS_H} />
              ) : (
                <Text color={CLAY}>● ● ●</Text>
              )
            ) : (
              <Text bold color={color}>
                {line.phase === 'done' ? '✓' : '✕'}
              </Text>
            )}
          </Box>
        </Box>

        <Text color={CLOUD} dimColor wrap="truncate-end">
          {rule}
        </Text>

        {/* 进度行:左边是信息,右边钉着两个入口按钮(工作台、设置),左边再长也挤不走它们 */}
        <Box flexDirection="row" alignItems="center" gap={2}>
          <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row" flexWrap="wrap" columnGap={2}>
            <Text>{tr().bandSteps(isWorkingNow, line.steps)}</Text>
            <Text>
              <Text dimColor>{tr().bandTime}</Text>
              <Text bold>{elapsed}</Text>
            </Text>
            {line.errors > 0 && (
              <Box key="open-errors">
                <Button
                  key="errors"
                  plain
                  label={tr().bandFailures(line.errors)}
                  hover={{ underline: true }}
                  onPress={() => void openPane($, 'turn')}
                />
              </Box>
            )}
            {gitState.files.length > 0 && (
              <Box key="open-changes">
                <Button
                  key="changes"
                  plain
                  label={tr().bandChanges(gitState.files.length)}
                  hover={{ underline: true, color: CLAY }}
                  onPress={() => void openPane($, 'changes')}
                />
              </Box>
            )}
            {line.current && (
              <Text dimColor wrap="truncate-end">
                ▸ {line.current}
              </Text>
            )}
          </Box>
          <Box flexShrink={0} flexDirection="row" alignItems="center" gap={1}>
            <Button key="open-workbench" label={tr().openWorkbench} onPress={() => void openLastTab($)} />
plugins/workbench/hooks/register.tsx lines 1200–1251 · Pane
  on('ui.render', { component: 'Pane', requestId: SETTINGS_PANE }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const m = tr()
    const current: Record<SettingField, string> = {
      language: config.language,
      bandMode: config.bandMode,
      narrationOverflow: config.overflow,
      narratorMode: config.mode,
      narratorIntervalSeconds: String(config.minGapMs / 1000),
      narratorMaterialChars: String(config.materialStep),
    }
    const resolved = m.langName[m.lang]
    const pending = await read($, pendingSettingAtom)

    return (
      <Box flexDirection="column" gap={1}>
        <Text bold>{m.settingsTitle}</Text>
        {SETTING_FIELDS.map(({ field, choices }) => {
          const meta = m.fields[field]!
          const isSaving = pending?.field === field
          const selected = isSaving ? pending.value : current[field]
          return (
            <Box key={`setting-${field}`} flexDirection="column">
              <Text>
                <Text bold>{meta.title}</Text>
                {isSaving && <Text dimColor>{`  ${m.settingSaving}`}</Text>}
              </Text>
              <Text dimColor wrap="wrap">
                {meta.desc}
              </Text>
              <Box flexDirection="row" gap={1} flexWrap="wrap">
                {choices.map(choice => {
                  const value = String(choice)
                  return (
                    <Button
                      key={`set-${field}-${value}`}
                      label={meta.choice(value, resolved)}
                      variant={selected === value ? 'primary' : 'secondary'}
                      onPress={() => (selected === value ? undefined : void saveSetting($, field, choice))}
                    />
                  )
                })}
              </Box>
            </Box>
          )
        })}
        <Text dimColor wrap="wrap">
          {m.settingsNote}
        </Text>
      </Box>
    )
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 fanbuz

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 programsenv 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 d432eb3e5f9b 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.plugins/workbench/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.3 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.its repository's .claude-plugin/marketplace.json does not list it: no install line to give
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.git (reaches the network)
Reads and sendsWhether it both reads files or environment variables and reaches the network.reads environment variables 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's .claude-plugin/marketplace.json does not list it, so there is no install line to give. Read it as code, or follow its author's README.

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 "fanbuz-workbench" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs