Ranking|Claude Code Mods

ModsCode / Claude Code Mods / Ranking / subagent-guard

subagent-guard

Keeps helper agents (subagents) from running up your usage: limit how many run at once, cap their model, and watch them work in a live pane.

Code you can checkTerminal + desktopPaneStatus lineBoxButtonSvgText
drives Claude, draws

What it does

  • Draws a pane, the status line
  • Adds /subagents
  • Watches tool calls and can refuse them
  • Hooks agent.spawn, prompt.submit, session.start, turn.complete
  • Keeps its own state between turns

Good points

  • No network calls
  • Starts no processes
  • Written in TypeScript
  • Handles errors

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)

register.tsx
import type { Register } from 'claude-code'

// Drawn like subagent-guard by SteveAnthonyFM (pane, status), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/steveanthonyfm-subagent-guard/
// 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: "What the helper did" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const caption = '…'
    const length = '…'
    const length2 = '…'
    const maxConcurrent = '…'
    const MAX_LIMIT = '…'
    const NAMES = '…'
    const BLURBS = '…'
    const NAMES2 = '…'
    const BLURBS2 = '…'
    const NAMES3 = '…'
    const BLURBS3 = '…'
    return (
      <Box flexDirection="column" paddingX={1} gap={1}>
        <Box flexDirection="column">
          <Text bold color="claude">
            Helper Agent Safeguard
          </Text>
          <Text dimColor>
            Keeps background helpers from running up your usage.
          </Text>
        </Box>
        <Box borderStyle="round" borderColor="subtle" paddingX={1} paddingY={1} flexDirection="column" alignItems="center">
          <Text>
            🦀🦀🦀🦀🦀🦀🦀🦀
          </Text>
          <Text dimColor>
            {caption}
          </Text>
        </Box>
        <Box borderStyle="round" borderColor="claude" paddingX={1} flexDirection="column">
          <Box flexDirection="column">
            <Text bold>
              {"Running "}
              ·
              {" "}
              {length}
            </Text>
            <Text>
              {" "}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Text bold dimColor>
              {"Finished "}
              ·
              {" "}
              {length2}
            </Text>
            <Text>
              {" "}
            </Text>
            <Box>
              <Button label="Clear finished" />
            </Box>
          </Box>
        </Box>
        <Box borderStyle="round" borderColor="success" paddingX={1} flexDirection="column">
          <Box justifyContent="space-between">
            <Text bold>
              Helper agents
            </Text>
            <Text bold color="success">
              ● Allowed
            </Text>
          </Box>
          <Text dimColor>
            Claude may hand side tasks to helpers.
          </Text>
          <Box marginTop={1}>
            <Button variant="secondary" label="Turn off" />
          </Box>
        </Box>
        <Box borderStyle="round" borderColor="subtle" paddingX={1} flexDirection="column">
          <Text bold>
            How many at a time
          </Text>
          <Text dimColor>
            Helpers working side by side. One keeps things calm and cheap.
          </Text>
          <Box marginTop={1} gap={2} alignItems="center">
            <Button label=" − " />
            <Text bold color="claude">
              {maxConcurrent}
            </Text>
            <Button label=" + " />
            <Text dimColor>
              {"of up to "}
              {MAX_LIMIT}
            </Text>
          </Box>
        </Box>
        <Box borderStyle="round" borderColor="subtle" paddingX={1} flexDirection="column">
          <Text bold>
            Strongest model a helper may use
          </Text>
          <Text dimColor>
            A helper that asks for more is stepped down to this.
          </Text>
          <Box flexDirection="column" marginTop={1} gap={1}>
            <Button>
              <Text color="claude">
                {"● "}
                {NAMES}
              </Text>
              <Text dimColor>
                {" ("}
                {BLURBS}
                )
              </Text>
            </Button>
            <Button>
              <Text color="claude">
                {"● "}
                {NAMES2}
              </Text>
              <Text dimColor>
                {" ("}
                {BLURBS2}
                )
              </Text>
            </Button>
            <Button>
              <Text color="claude">
                {"● "}
                {NAMES3}
              </Text>
              <Text dimColor>
                {" ("}
                {BLURBS3}
                )
              </Text>
            </Button>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text color="success">
            ✓ Matches your saved default
          </Text>
          <Box marginTop={1} gap={1}>
            <Button variant="secondary" label="Save as my default" />
            <Button label="Undo changes" />
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text dimColor>
            Nothing has been stopped yet this session.
          </Text>
          <Text dimColor>
            Quick look-up helpers (Explore, Plan) are never limited.
          </Text>
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const maxConcurrent = '…'
    const NAMES = '…'
    const stopped = '…'
    await $.ui.status(`Helper agents: ${maxConcurrent} at a time · up to ${NAMES}${stopped}`)
    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.

hooks/register.tsx lines 534–693 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button, ...rest } = $.ui.resolve(e)
    const Svg = 'Svg' in rest ? rest.Svg : undefined
    const s = await getSettings($)
    const d = await getSaved($)
    const n = await getBlocked($)
    const isSaved = isSame(s, d)
    const isSolo = !s.isEnabled
    const runs = await getRuns($)
    const now = await $.clock.now()
    const running = runs.filter(r => r.status === 'running')
    const frame = Math.floor(now / BEAT_MS) % 2
    const finished = runs.filter(r => r.status !== 'running')

    // The pen holds Claude and the helpers who are not out working.
    const inUse = running.map(r => r.hat)
    const penCount = isSolo ? 0 : Math.max(0, s.maxConcurrent - running.length)
    const pen: Crab[] = HATS.filter(h => !inUse.includes(h))
      .slice(0, penCount)
      .map(hat => ({ hat, isBobbing: false }))
    const scene = crabScene([{ isBobbing: false }, ...pen], frame, isSolo)
    const caption =
      running.length > 0
        ? `${plural(running.length)} out working${pen.length > 0 ? `, ${pen.length} resting here.` : '.'}`
        : isSolo
          ? 'Claude is working solo.'
          : s.maxConcurrent === 1
            ? 'Claude and 1 helper, ready when needed.'
            : `Claude and ${s.maxConcurrent} helpers, ready when needed.`

    const glyph = (r: Run) =>
      r.status === 'running'
        ? { mark: '● Working', color: 'claude' }
        : r.status === 'done'
          ? { mark: '✓ Done', color: 'success' }
          : r.status === 'stopped'
            ? { mark: '■ Stopped', color: 'warning' }
            : { mark: '✕ Problem', color: 'error' }
    const row = (r: Run) => {
      const g = glyph(r)
      const spent = clockText((r.endedAt ?? now) - r.startedAt)
      const detail = r.status === 'running' ? (r.lastTool ?? 'Getting started…') : 'Finished'
      const stepsLabel = r.tools === 1 ? '1 step taken' : `${r.tools} steps taken`
      const crab = crabScene([{ hat: r.hat, isBobbing: true }], frame, false)

      return (
        <Box key={`run-${r.id}`} flexDirection="row" gap={2} marginBottom={1}>
          {r.status === 'running' && Svg ? (
            <Svg source={crab.source} width={crab.width} height={crab.height} alt="A helper crab at work" />
          ) : null}
          <Box flexDirection="column" flexGrow={1}>
            <Box justifyContent="space-between">
              <Button
                key={`title-${r.id}`}
                plain
                label={r.label}
                onPress={() => showDetail($, r.id)}
              />
              <Text color={g.color}>{g.mark}</Text>
            </Box>
            <Text dimColor>
              {kindWords(r.type)} ({modelName(r.model)})
            </Text>
            <Text dimColor>{detail}</Text>
            <Box justifyContent="space-between">
              <Button
                key={`steps-${r.id}`}
                plain
                dimColor
                label={`${stepsLabel} ›`}
                onPress={() => showDetail($, r.id)}
              />
              <Text dimColor>
                {r.tokens === undefined ? '' : `${kTokens(r.tokens)} tokens · `}
                {spent}
              </Text>
            </Box>
            <Text color={g.color} dimColor={r.status !== 'running'}>
              {'━'.repeat(r.status === 'running' ? 12 : 30)}
            </Text>
          </Box>
        </Box>
      )
    }

    return (
      <Box flexDirection="column" paddingX={1} gap={1}>
        <Box flexDirection="column">
          <Text bold color="claude">
            Helper Agent Safeguard
          </Text>
          <Text dimColor>Keeps background helpers from running up your usage.</Text>
        </Box>

        <Box borderStyle="round" borderColor="subtle" paddingX={1} paddingY={1} flexDirection="column" alignItems="center">
          {Svg ? (
            <Svg source={scene.source} width={scene.width} height={scene.height} alt={`Claude with ${pen.length} resting helper crabs`} />
          ) : (
            <Text>{'\u{1F980}'.repeat(pen.length + 1)}</Text>
          )}
          <Text dimColor>{caption}</Text>
        </Box>

        {runs.length > 0 && (
          <Box borderStyle="round" borderColor={running.length > 0 ? 'claude' : 'subtle'} paddingX={1} flexDirection="column">
            {running.length > 0 && (
              <Box flexDirection="column">
                <Text bold>Running {'·'} {String(running.length)}</Text>
                <Text> </Text>
                {running.map(row)}
              </Box>
            )}
            {finished.length > 0 && (
              <Box flexDirection="column">
                <Text bold dimColor>
                  Finished {'·'} {String(finished.length)}
                </Text>
                <Text> </Text>
                {finished.map(row)}
                <Box>
                  <Button
                    key="clear"
                    label="Clear finished"
                    onPress={() =>
                      enqueue(async () => {
                        const all = await getRuns($)
                        await putRuns($, all.filter(r => r.status === 'running'))
                      })
                    }
                  />
                </Box>
              </Box>
            )}
          </Box>
        )}

        <Box borderStyle="round" borderColor={s.isEnabled ? 'success' : 'warning'} paddingX={1} flexDirection="column">
          <Box justifyContent="space-between">
            <Text bold>Helper agents</Text>
            <Text bold color={s.isEnabled ? 'success' : 'warning'}>
              {s.isEnabled ? '● Allowed' : '○ Turned off'}
            </Text>
          </Box>
          <Text dimColor>
            {s.isEnabled
              ? 'Claude may hand side tasks to helpers.'
              : 'Claude will do everything itself, in one place.'}
          </Text>
          <Box marginTop={1}>
            <Button
              key="toggle"
              variant={s.isEnabled ? 'secondary' : 'primary'}
              label={s.isEnabled ? 'Turn off' : 'Turn on'}
              onPress={async () => change($, { isEnabled: !(await getSettings($)).isEnabled })}
            />
          </Box>
        </Box>

        <Box borderStyle="round" borderColor="subtle" paddingX={1} flexDirection="column">
          <Text bold>How many at a time</Text>
Licence text (MIT)
MIT License

Copyright (c) 2026 SteveAnthonyFM

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: Pane (panel), Deny a tool call

What its code calls

drives Claudetool callsremembers

What its code shows

Read from the source at commit cd5d2c07270d. 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.hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.1 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.starts no programs
Reads and sendsWhether it both reads something of yours (files, environment variables, the transcript, settings) and reaches outside (the network, an MCP server, another session, telemetry).reaches nothing outside
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
Settings hooksHooks 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 shipsMCP 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, agentsWhat 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 MCPWhether 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 modelCompletions it runs ($.model.complete, fork, classify), subagents it spawns, prompts it submits as you, and the tools, commands and agents it adds.adds command subagents
Events it hooksBy 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: prompt.submit, tool.call, command.run (subagents) · also: session.start, agent.spawn, turn.complete, ui.render (Pane) · timers: clock.after
Reads, by nameThe environment variables and files it names, and whether it reads the transcript, settings.json, the prompt box or the mouse selection.reads no files, environment variables, settings or transcript
Writes, by nameThe 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 SteveAnthonyFM/subagent-guard
/plugin install subagent-guard@subagent-guard
/reload-plugins

This installs the marketplace's latest commit, which may not be the one read here (cd5d2c07270d). 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/SteveAnthonyFM/subagent-guard
git -C subagent-guard checkout cd5d2c07270d2b2408970ede188d893d09336b50
claude plugin validate subagent-guard
claude --plugin-dir subagent-guard

The 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 or ChatGPT about it

With ModsCode added as a connector, Claude or ChatGPT can read this mod's code, what it reaches and how its controls are wired, and build on them. Ask it like this:

Read the ModsCode mod "steveanthonyfm-subagent-guard" with its code and make me one like it

Add the ModsCode MCP to Claude or ChatGPT

Similar mods

Badge for your README

If this is your mod, paste this into your README. It links to this page.

README.md
[![ModsCode](https://modscode.com/badge/steveanthonyfm-subagent-guard.svg)](https://modscode.com/claude-mods/mods/steveanthonyfm-subagent-guard/)