Skip to content

esummervill/worker-budget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

worker-budget

A Claude Code skill that budgets, tiers, and contracts subagent workers before you spawn them.

Inspired by the superpowers pattern of encoding process discipline as skills — this one encodes delegation economics: no big model on mundane work, no small model planning, and the orchestrator woken only at mediation points.

What it does

When your orchestrating Claude session is about to spawn subagent workers for substantial work (feature builds, audits, releases), the skill makes it:

  1. Run a deterministic budgeter (plain Node, no model, no network) that forecasts tokens per worker class from an EWMA of your observed history, prices it per model tier, and recommends a tier.
  2. Refresh pricing via a Haiku scout when the snapshot is stale — never from a large model's memory.
  3. Classify novel tasks via a Haiku scout into the nearest worker class with a multiplier — the scout estimates, it never decides.
  4. Emit a worker contract — success metrics, a hard token ceiling (estimate × 1.5), and the five (and only five) escalation triggers that justify waking the orchestrator mid-run.
  5. Record actuals after each worker completes, so the forecast self-corrects.

The design principle: arithmetic is a script, judgment is tiered. The only model calls in the whole system are two small, bounded Haiku errands.

Install

Copy (or symlink) the skill into your Claude Code skills directory:

git clone https://github.com/esummervill/worker-budget.git
cp -R worker-budget/skills/worker-budget ~/.claude/skills/

Or install as a plugin (repo doubles as a Claude Code plugin via .claude-plugin/plugin.json).

Claude Code picks it up automatically; the skill's description triggers it before Agent workers are spawned.

Usage

# forecast + contract for 3 heavy build workers
node ~/.claude/skills/worker-budget/scripts/budget.mjs build-heavy 3

# novel task? nearest class + scouted multiplier
node ~/.claude/skills/worker-budget/scripts/budget.mjs cartography 1 --multiplier=1.4

# after the worker finishes, feed the forecast
node ~/.claude/skills/worker-budget/scripts/record.mjs build-heavy 241503 ok

Sample output:

worker-class: build-heavy — Multi-slice TDD feature build with migrations + suites (phase workers)
count: 3 · multiplier: 1 · est tokens/worker: 220,000 · ceiling: 330,000
pricing as_of 2026-07-25 (0d old)

tier      $/worker   $/total    note
opus      $  8.58   $  25.74   ◀ recommended
sonnet    $  1.72   $   5.15
haiku     $  0.57   $   1.72

── WORKER CONTRACT (paste into worker prompt) ──
CONTRACT:
- Success metrics (self-report each in your final report): ...
- Budget ceiling: ~330,000 tokens. If you project exceeding it, STOP ...
- Escalate (stop + report) ONLY for: ...

Worker classes

Class What Default tier
build-heavy Multi-slice TDD feature build, migrations + suites opus
build-standard Bounded build to a fixed spec opus (sonnet candidate)
cartography System mapping / spec writing / audit synthesis opus
research Adversarial / landscape research with web search opus
release Merge + deploy + verify against checklists opus (sonnet candidate)
verify Independent re-verification of a worker's result sonnet
grind Mechanical greps, listings, file moves haiku

Classes and seeds live in scripts/history.json — edit freely; your recorded runs (EWMA, α=0.3, last 20 kept) will dominate the seeds quickly.

The contract's escalation doctrine

A worker stops and wakes the orchestrator only for:

  1. contract ambiguity (spec contradicts code reality)
  2. a decision crossing repo/system boundaries
  3. anything security/tenancy-adjacent not explicitly in the spec
  4. projected budget overrun >50%
  5. the same gate failing twice for one root cause

Everything else the worker decides and documents. This is the whole point: escalations are expensive (they wake your biggest model), so the contract enumerates them exhaustively.

Files

skills/worker-budget/
  SKILL.md               # the skill — flow, contract doctrine, division of labor
  scripts/budget.mjs     # deterministic forecaster + contract printer
  scripts/record.mjs     # EWMA updater
  scripts/pricing.json   # pricing snapshot with staleness gate
  scripts/history.json   # per-class observed usage (yours, over time)

License

MIT

About

Claude Code skill: deterministic subagent budgeting — token forecasts per worker class, model-tier recommendation, worker contracts with escalation triggers

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages