Skip to main content
Back to Blog
· Futurist Systems

How do we keep Claude Code costs and quota predictable for a team?

Pin the model per task instead of per person, cap every unattended run, stop loops that produce nothing, and read usage from the tool's own logs every week. The quota rules we run across our repositories and how to install them.

Claude Code cost control quota team setup

Spend becomes predictable when three things are written down in the repo: which model runs which kind of task, how long and how many turns an unattended run may take, and what stops an automated loop that is not producing anything. Interactive use by a few developers is rarely the problem; the surprise bills and exhausted quotas come from scheduled jobs, retry loops and the most expensive model being used by default. Fix those three in settings.json, in the wrapper scripts and in CLAUDE.md, then read the usage numbers weekly.

Know what you are limited by

Teams on a subscription are limited by usage windows: a rolling allowance that refills over a few hours plus a weekly ceiling, both shared by everything that runs under that account, interactive or scheduled. Teams on API billing are limited by money, through workspace spend limits, and by the organisation’s rate limits. The rules below are the same in both cases, but the signal you watch differs: the plan’s usage page for the first, the console’s workspace spend and usage pages for the second. Decide which one you are on before you write any rule, because “we hit the limit” means different things.

Rule 1: the model is chosen by the task, not by the person

The expensive model should be a deliberate choice, named in a file, not the default a session inherits. Three places set it:

  • model in .claude/settings.json sets the default for every session in the repo.
  • model: in a subagent’s frontmatter (.claude/agents/<name>.md) pins that agent regardless of what the parent session runs.
  • --model on claude -p pins every headless or scheduled call. A wrapper that omits it inherits the account default, which is how a cheap nightly job quietly runs on the top tier.

Our written policy: the cheaper models by default for every routine task, including code; the top model only on an explicit signal, such as a security or money path, an architecture decision, or a genuinely hard multi-step call. “It is code” is not a signal. A short audit prompt in the repo checks every wrapper’s --model flag and every agent’s model: line against that policy, so drift is caught before the bill is.

Rule 2: every unattended call is capped

A scheduled job that can run forever will, eventually. Our wrapper contract for every headless claude -p call:

claude -p "$PROMPT" \
  --model <cheap-tier> \
  --max-turns 20 \
  --max-budget-usd 2 \
  --tools "Read,Grep,Glob,Bash" \
  --allowedTools "Read,Grep,Glob,Bash(git log *)" \
  --strict-mcp-config
  • --max-turns ends the run after a fixed number of agent turns.
  • --max-budget-usd is a hard spend cap for print mode: the run stops when it is reached. Pair it with --max-turns; one caps money, the other caps time.
  • --tools limits which tools the job can use at all. --allowedTools pre-approves the listed tools so they run without a permission prompt that would otherwise hang an unattended job; it does not take tools away. Use --tools or --disallowedTools to restrict, --allowedTools to pre-approve.
  • --strict-mcp-config stops the job from loading every MCP server configured on the machine, so a nightly job runs with only the servers its own config names. Tool definitions are deferred by default, so the saving is smaller than it used to be, but a job should still not reach servers it has no business using.
  • The scheduler itself wraps the call in a hard wall-clock timeout. Ours is twenty minutes for every scheduled job, without exception.

Rule 3: loops stop on silence

Self-pacing automation (a tick that triages pull requests, advances a backlog, re-runs reviews) is where quota disappears, because a stuck loop looks like activity. Our rule is simple enough to put in one line of the loop’s prompt: an empty tick is one with no commit, no merged pull request, no closed item and no new finding; after the second consecutive empty tick, the loop stops itself and writes a one-line reason. A stop is final until a person restarts it.

A per-day guard sits above that: a limit on how many runs, reviews and automated loops may fire in a day across the repo. When it trips, the job exits before calling the model. The number is yours to pick; the point is that it exists and is in a file people can read.

Rule 4: context is a cost too

Everything that sits in the context window is paid for on every turn: the root CLAUDE.md and its ancestors, which load at launch; the subdirectory CLAUDE.md files, which load on demand when Claude reads or edits a file in that directory; and the session history. MCP tool definitions are deferred by default, so only the server names and their instructions load up front, but every enabled server is still a surface the job can reach. Three habits keep it in check:

  1. Keep the root CLAUDE.md short and push detail into subdirectory files, which load only when Claude works there.
  2. Enable MCP servers per project rather than globally, and disable the ones a repo does not use with /mcp, so a website repo does not carry a database server’s tools.
  3. Treat half of the context window as the point to stop taking on new work in a session: finish the step in hand, write the notes the next session needs, and start fresh. /context shows what is in the window; /compact summarises it, but a summary loses the detail a hand-written note keeps.

Rule 5: read the numbers weekly

  • Inside a session, /usage shows the session’s cost, the plan’s limits and a usage breakdown; /cost is an alias for it.
  • Claude Code writes its session logs locally. Third-party, unofficial tools such as ccusage read those logs and total usage per day, per session and per model, which is enough to see which job or which repo is eating the budget. Treat the totals as an estimate: local logs are not a bill.
  • On a subscription, the account usage page shows how close the team is to the window and weekly limits. On the API, the console shows workspace spend and usage; where your setup allows it, a separate workspace or a named job per scheduled task makes the line item name the culprit.
  • Put the weekly read into the same ceremony as the retro. Our audit skill reports usage next to the week’s shipped items, so a high number next to an empty week is a question, not a surprise.

Checklist

  1. Decide whether you are limited by usage windows or by spend, and which page shows it.
  2. Set model in the repo settings and model: in every subagent; write the escalation rule into CLAUDE.md.
  3. Give every claude -p wrapper --model, --max-turns, --max-budget-usd, --tools where read-mostly, --allowedTools for the tools it may run unprompted, and --strict-mcp-config; wrap it in a wall-clock timeout.
  4. Add the two-empty-ticks stop to every loop, and a per-day run limit above it.
  5. Trim the root CLAUDE.md; scope MCP servers per project and disable unused ones with /mcp.
  6. One named job per scheduled task, so usage has a name.
  7. Read /usage, the log totals and the account page once a week, in the retro.

Quota guard and model-tier policy are two of the components we install in a team’s repositories; the full list is on the Claude Code fleet setup page.

Ready to automate your business?

Get a free workflow analysis to discover your highest-ROI automation opportunities.