Urgent.News

What's breaking now, across thousands of outlets.

AI

My Subagents Were Eating 48% of My Tokens. So I Gave Them Hard Budget Caps — Enforced by Hooks, Not Dashboards

My subagents were eating 48% of my tokens. So I gave them hard budget caps — enforced by hooks, not dashboards A few weeks ago a measurement made the rounds: developer aidiveyt logged a month of Claude Code usage — 455 sessions, 2,631 subagent runs — and found subagents had consumed 48.1% of all tokens . The median subagent's first request alone was 47,117 tokens. Nobody approved that spend. It…

A recent report surfaced that developer aidiveyt had tracked Claude Code usage for a month and found that subagents had consumed 48.1% of all tokens. One subagent's initial request alone totaled 47,117 tokens, and this was happening quietly in the background, one Task call at a time. Many in the community echoed the sentiment that hard budget caps were needed.

Simon Willison, after experiencing the same problem, built a tool called subagent-budget. This tool enforces per-agent-type token and dollar budgets through Claude Code hooks, preventing over-budget subagents from launching. To set up budget caps, users install subagent-budget, initialize budgets with default token and USD limits, and then set specific budgets using patterns.

The enforcement is done by adding a block in the Claude settings file, which runs a budget check before every subagent launch. If the budget is exceeded, Claude returns an error indicating the type of budget that was exceeded. Unlike subagent-ledger, subagent-budget not only tracks token usage but also estimates costs in dollars, using built-in model price tables that can be overridden in the config.

It also maintains a cross-session ledger that survives session ends. The budget rules are matched using globs against the agent's description and subagent type, with the first match taking precedence. This tool works well with resume-budget-guard, and its budget rules can be easily imported. The enforcement is per-machine, and it is idempotent, meaning that re-running the tool will not change the outcome.

While the transcript backfill is estimated, users can provide exact figures using the record command with the --tokens flag.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

Your Skill's Frontmatter Has a Typo. Nothing Will Ever Tell You

Your skill's frontmatter has a typo. Nothing will ever tell you. A few days ago I shipped a Claude Code command with this frontmatter: --- name : deploy-helper description : " Helps with deployments"…

  • Frontmatter-guard is a semantic linter for skill and plugin frontmatter.
  • It detects unknown keys, unknown hook events, missing fields, and incorrect types.
  • The tool provides file:line information, rule names, and concrete fix suggestions.

TrailMate AI: An Open-Source AI Companion That Gets You Outside

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass What I Built I built TrailMate AI , a small outdoor companion designed to turn a little curiosity into time…

  • TrailMate AI is an open-source AI companion for outdoor activities
  • Users can select activities like nature walks or birdwatching
  • Project promotes open innovation and self-hosted AI models

Outdoor portrait generator: a quality and speed test

Outdoor portrait generator: a quality and speed test To test an outdoor portrait generator, measure sharpness on a crop of the face and time the order from upload to the "photos ready" email.

  • PFPMaker claims delivery within 10 minutes for outdoor portraits.
  • Calibration script reveals flaw in conventional scoring method.
  • Laplacian variance metric better identifies blurry outdoor portrait regions.

More from Sunday 11 October →