SLOPSHOPPER

cost-band

A band above the prompt showing the last turn's and the session's list-price cost estimate.

band
v0.1.0MITupdated 2026-10-14mategog/mateai-mods/plugins/cost-band
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · cost-band
› fix the failing auth test and add an audit log call ⏺ Read(src/auth.ts) ⎿ Read 6 lines ⏺ Update(src/auth.ts) ⎿ Added 2 lines, removed 1 line ⏺ Bash(bun test) ⎿ 3 pass, 1 fail ● Done. refresh now rejects expired claims and logs an audit event. ✻ Worked for 42s · done 4:20 PM Last turn $0.420 · Session $0.420 · list-price estimate, not a bill ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Band
Last turn $0.420 · Session $0.420 · list-price estimate, not a bill
README

mateai-mods

Small Claude Code mods and skills from the [MateAI]

Plugins

PluginWhat it doesInstall
cost-bandBand above the prompt showing the last turn's and the session's list-price cost estimate.claude plugin install cost-band@mateai-mods
delegatePlan a coding task on Opus, hand the implementation to Sonnet subagents, then review and verify their work.claude plugin install delegate@mateai-mods

Add the marketplace once, then install whichever plugins you want. Each one installs independently:

claude plugin marketplace add mategog/mateai-mods

cost-band

A band above the prompt that shows what the last turn and the whole session would cost at API list prices:

Last turn $0.042 · Session $0.318 · list-price estimate, not a bill

The mod reads the session cost Claude Code already computes (the same number as "Total cost" in /usage). It contains no price table, so there are no hard-coded rates to go stale.

Requirements

  • Claude Code 2.1.287 or later, or the Desktop app 2.1.286 or later (mods do not exist in older versions).
  • Not available in Desktop WSL sessions.

Check your version with claude --version (terminal) or /status (Desktop, local session).

Install

From a terminal:

claude plugin marketplace add mategog/mateai-mods
claude plugin install cost-band@mateai-mods

Or inside a Claude Code session:

/plugin marketplace add mategog/mateai-mods
/plugin install cost-band@mateai-mods

Then restart the session. The band appears above the prompt after the first completed turn.

Update and remove

claude plugin marketplace update mateai-mods
claude plugin disable cost-band@mateai-mods
claude plugin marketplace remove mateai-mods

Read it before you install it

Mods are not sandboxed. A mod runs inside Claude Code with your permissions, so it could read your files and environment variables, start programs and use the network. Only install mods from people you trust, and read the code first. This one is short:

FileWhat it does
plugins/cost-band/hooks/register.tsxOn turn.complete it reads session.usage(); on ui.render it draws the band.
plugins/cost-band/hooks/cost.tsPure functions: last-turn math and $ formatting.
plugins/cost-band/hooks/hooks.jsonRegisters the module.

It makes no network calls and starts no processes. You can also check what any mod registers without running it:

claude plugin validate plugins/cost-band

What the number is, and is not

  • It is a list-price estimate computed locally from token counts. It is not your bill. The Claude Code docs say it is not relevant for billing on Pro and Max plans.
  • It shows how much work you asked the model to do. It says nothing about what any company earns or spends.
  • If the session reports no cost, the band says Cost estimate unavailable in this session.
  • After /clear the session total starts over, and so does the last-turn figure.

Layout

.claude-plugin/marketplace.json      marketplace "mateai-mods"
plugins/cost-band/                   the plugin
  .claude-plugin/plugin.json
  hooks/{hooks.json,register.tsx,cost.ts}
  hooks/*.test.ts                    unit tests for the cost math and registration
  types/index.d.ts

delegate

A skill, not a mod: it runs no code of its own. You run it in an Opus session. Opus researches and plans the task, then hands the implementation to Sonnet subagents and reviews what they wrote. Experimental (v0.3.0).

The goal is lower cost by moving implementation to cheaper models. In our benchmark it never beat plain Opus: when it delegated, it cost 1.7–2.5× as much and saved no time; when it chose not to delegate, it matched plain Opus. See Benchmark.

/delegate:delegate add pagination to the orders API and cover it with tests

It is only ever run by you typing the command; Claude will not start it on its own.

What it does

  • Decides whether to delegate at all. It delegates only when the work is large (roughly 500+ changed lines or 10+ files) and splits into independent chunks that are each substantial. Otherwise Opus does the work itself and says why.
  • Plans before spawning. Each task gets an exact file list and a verification command. Shared interfaces are written first so parallel agents don't guess each other's signatures. At most 5 subagents.
  • Picks the model per task. Sonnet by default, Opus for subtle or high-risk tasks, Haiku only for trivial mechanical edits.
  • Keeps subagents on a short leash. They run as a lean implementer agent with only Read, Write, Edit, Bash and Skill, which makes each one cheaper to start. They can't commit, push or deploy, they only run narrow checks on their own files, and they report "blocked" instead of redesigning.
  • Reviews the result. Opus reads every diff, checks that each subagent stayed inside its files, runs the full verification once, and uses code-review for risky changes. Max 2 correction rounds per task, then Opus takes over.

Benchmark

Five tasks on a small Node project (bench/delegate/fixture, about 150 lines), each started from the same commit with the same prompt. Correctness is graded by hidden tests the agent never sees. Run on 2026-10-14 with Claude Code 2.1.238 (opus = claude-opus-5, sonnet = claude-sonnet-5), one run per cell unless noted. Cost is Claude Code's list-price estimate (total_cost_usd), not a bill.

Two versions of the delegation rule are compared:

  • v0.2.0 delegates for "2+ independent tasks, or one bulk mechanical change".
  • v0.3.0 delegates only for large work (roughly 500+ changed lines or 10+ files) that splits into substantial independent chunks; otherwise Opus does it itself.

Round 1: small and medium tasks (plain Opus vs v0.2.0)

TaskRunDelegated?Hidden testsCostWall timeOutput tokensTotal tokens
T1 small: fix quoted fields in one CSV functionOpus–5/5$0.9286 s6.7k424k
v0.2.0no5/5$0.9780 s5.9k506k
T2 medium: validation in 3 modules + shared error classOpus–3/3$0.8497 s6.6k598k
v0.2.0yes, 3 Sonnet subagents3/3$2.07 (Opus $1.17 + Sonnet $0.89)166 s18.5k2,039k
T3 mechanical: rename qty → quantity across 7 filesOpus–4/4$0.96159 s7.9k719k
v0.2.0no4/4$0.9295 s7.7k589k

Round 2: larger tasks (plain Opus vs v0.2.0 vs v0.3.0)

TaskRunDelegated?Hidden testsCostWall timeOutput tokensTotal tokens
T4 six new feature modules with tests (12 new files, ~400 lines)Opus–6/6$1.16164 s17.2k478k
v0.2.0yes, 3 Sonnet subagents6/6$2.23 (Opus $1.32 + Sonnet $0.92)162 s24.1k1,911k
v0.3.0no, below the size bar6/6$1.11155 s15.0k460k
T5 migrate every amount to a Money type (coupled, 8 files)Opus–2/2$0.94106 s9.4k570k
v0.2.0no, too coupled2/2$0.99113 s9.7k605k
v0.3.0no2/2$0.96120 s10.0k488k

Round 3: self-contained briefs (experimental variants that keep v0.2.0's rule, so they still delegate; patches against v0.2.0 in bench/delegate/variants/)

  • v0.4a: each brief carries its spec section, helper signatures, the small files it edits and a test-style example verbatim; subagents are told not to explore and to finish in about 5 tool calls.
  • v0.4b: v0.4a plus a lean implementer subagent that only has Read, Write, Edit, Bash and Skill.
TaskRunDelegated?Hidden testsCostWall timeSubagent tool callsTotal tokens
T4 six new feature modulesOpus, 2nd run–6/6$1.02130 s–463k
v0.2.0, 2nd runyes, 3 Sonnet subagents6/6$2.43 (Opus $1.50 + Sonnet $0.93)212 s332,028k
v0.4ayes, 3 Sonnet subagents6/6$2.14 (Opus $1.28 + Sonnet $0.86)155 s201,741k
v0.4byes, 3 lean subagents6/6$1.88 (Opus $1.35 + Sonnet $0.53)151 s191,315k
T2 validation in 3 modulesv0.4ano3/3$0.8489 s–476k
v0.4bno3/3$0.8190 s–412k

Total tokens include cache reads and writes, which are most of the volume.

What it shows

  • Same quality. All 18 runs passed every hidden test.
  • Delegating never paid off. Every run that delegated cost 1.7–2.5× as much as plain Opus and saved no time. Even on T4, twelve independent files split across three parallel subagents finished no faster than Opus alone: planning, briefing and review took as long as the parallel typing saved.
  • Why: the cost is context, not typing. Plain Opus wrote all of T4 with 17k output tokens; most of its 478k tokens were cache reads of context it already had. Every subagent starts cold and builds its own context, so T4 with delegation processed 1.9M tokens. Sonnet's lower price doesn't make up for four times the volume.
  • v0.3.0's tighter rule avoided both losing cases. It declined everything here and stayed within about 5% of plain Opus on cost. Time differences of about a minute are noise: T3 shows a 64 s gap between two runs that did the same thing.
  • Self-contained briefs cut subagent tool calls by 40% (33 → 20) but Sonnet cost by only 7%. Each call still re-reads the subagent's full system prompt and tool definitions.
  • The lean subagent is what cut subagent cost: −43% ($0.93 → $0.53, cache reads 980k → 332k).
  • It still lost, because of the lead. The Opus lead alone ($1.28–1.50) cost more than plain Opus doing the whole task ($1.02–1.16): loading the skill, planning, writing about 14,000 characters of briefs and reviewing three diffs all re-read a growing context. No brief format fixes that part.
  • On T2 both variants chose not to delegate, reasoning that a fully self-contained brief for ~50 lines would contain essentially the final code.

Limits: mostly one run per cell, a small project, and tasks of at most ~450 changed lines. Delegation might pay off on much larger work (thousands of lines of mostly new code); that is not tested.

To reproduce (each run is capped at $12 list price):

bench/delegate/run.sh t4 baseline
bench/delegate/run.sh t4 delegate

To test another version of the plugin, point DELEGATE_PLUGIN at its plugins/delegate folder and give the run a label, e.g. DELEGATE_PLUGIN=/path/to/plugins/delegate bench/delegate/run.sh t4 v020. For the Round 3 variants, apply a patch from bench/delegate/variants/ (with git apply) to a copy of the v0.2.0 plugin and point DELEGATE_PLUGIN at that copy. Results land in bench/delegate/results/. The tasks are in bench/delegate/tasks/ and the grading tests in bench/delegate/hidden/.

Requirements

  • Claude Code with the Agent tool (subagents). It does not work in plain chat.
  • A session running an Opus-class model. On anything else it warns you and asks before continuing.
  • Nothing else to install: the karpathy-guidelines skill it relies on is bundled in this plugin. It also uses the code-review skill for risky changes when you have it; without it, Opus reviews the diff itself.

Install

It installs independently of cost-band:

claude plugin marketplace add mategog/mateai-mods
claude plugin install delegate@mateai-mods

Or inside a Claude Code session:

/plugin marketplace add mategog/mateai-mods
/plugin install delegate@mateai-mods

Update and remove

claude plugin marketplace update mateai-mods
claude plugin disable delegate@mateai-mods

Read it before you install it

The plugin is three plain-text files: the delegate skill, the bundled karpathy-guidelines skill (a short, independent write-up of four coding rules, not affiliated with Andrej Karpathy), and the implementer subagent definition. They are plain instructions for Claude, but it makes Claude spawn subagents that edit files and run commands with your permissions. Read it, and try it first on a branch or a throwaway repo.

Layout

plugins/delegate/                    the plugin
  .claude-plugin/plugin.json
  agents/implementer.md
  skills/delegate/SKILL.md
  skills/karpathy-guidelines/SKILL.md
bench/delegate/                      benchmark: fixture, tasks, hidden tests, runner, results

License

MIT. See LICENSE.

Source 3 files
hooks/register.tsx 36 lines
1import { atom, read, update } from 'claude-code'
2import type { Register } from 'claude-code'
3
4import { formatUsd, nextCost, START } from './cost'
5
6const cost = atom({ plugin: 'cost-band', key: 'cost' } as const, START)
7
8export const register: Register = on => {
9  on('turn.complete', async ($, e, next) => {
10    const usage = await $.session.usage()
11    await update($, cost, prev => nextCost(prev, usage.cost?.usd))
12
13    return next(e)
14  })
15
16  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
17    const { turns, total, last } = await read($, cost)
18
19    if (e.props.hasSurvey || turns === 0) {
20      return next(e)
21    }
22
23    const { Box, Text } = $.ui.resolve(e)
24
25    return (
26      <Box>
27        <Text dimColor>
28          {total === null || last === null
29            ? 'Cost estimate unavailable in this session'
30            : `Last turn ${formatUsd(last)} · Session ${formatUsd(total)} · list-price estimate, not a bill`}
31        </Text>
32      </Box>
33    )
34  })
35}
36
hooks/cost.ts 17 lines
1import type { Cost } from '../types'
2
3export const START: Cost = { turns: 0, total: null, last: null }
4
5// `usd` is the session's running total; a total below the previous one means /clear started over.
6export function nextCost(prev: Cost, usd: number | undefined): Cost {
7  if (usd === undefined) return { turns: prev.turns + 1, total: null, last: null }
8
9  const before = prev.total === null || usd < prev.total ? 0 : prev.total
10
11  return { turns: prev.turns + 1, total: usd, last: usd - before }
12}
13
14export function formatUsd(n: number): string {
15  return '$' + n.toFixed(n < 1 ? 3 : 2)
16}
17
types/index.d.ts 8 lines
1export type Cost = { turns: number; total: number | null; last: number | null }
2
3declare module 'claude-code' {
4  interface PluginState {
5    'cost-band': { cost: Cost }
6  }
7}
8