WARSHALL
Docs/Agents/Stop loss and ceilings

Stop loss and ceilings

A run that goes wrong can spend a whole usage window or a lot of money in minutes. Stop losses stop one turn that is running away. Ceilings stop all work on an account once it has spent the share you set aside.

The run guard

Settings > Harness > Run guard has the Harness enabled switch, on by default. While it is on, Warshall watches every run and applies the stop losses below. It only reads what the provider already reports, so watching a run adds nothing to your usage.

It also checks the account when a run starts. If one of its windows is 90% used or more, a notice says the run may not fit the window. The notice never stops or delays the run.

Stop losses

Settings > Harness > Stop losses has one box per limit and a switch for the whole section. A limit set to 0 is off.

LimitDefaultWhat it does
Output tokens per turn250000Stops a turn after this many output tokens.
Subagents per turn5Caps the subagents one turn may start, on every provider.
Minutes per turn30Stops a turn that runs longer than this.
Max 5-hour usage per run50%Stops a run that uses this share of the 5 hour window.
Max weekly usage per run20%Stops a run that uses this share of a weekly window, per model weekly windows included.
Cost alert$10Tells you after a turn that cost more than this.
Max cost per run0, offA hard cap on API key spend, handed to Claude Code itself. In Interactive mode it caps the whole live session. In headless mode it caps each turn.

The defaults are set high. A long agentic turn doing real work stays well under them. Subagents are the exception. A turn that fans out past a handful of them is spending several usage windows at once.

Subscription runs and API key runs

A run on a subscription account spends its usage window and never a dollar, so only the two window limits apply to it. A run on an API key spends money, so the cost alert and the hard budget apply instead. The token, subagent and minute limits apply to every run, whatever pays for it.

What each provider can enforce

LimitClaudeCodexMuseGeminiCustom endpoint
Output tokens per turnYesNoYesNoYes
Subagents per turnYesYesYesYesNo subagents
Minutes per turnYesYesYesYesYes
Window use per runYesYesYesNoNo windows
Cost alertYesNoNoNoNo
Max cost per runYesNoNoNoNo

Codex reports tokens and cost only when a turn ends, so there is nothing to act on mid turn. For Codex, the limits that apply during a turn are the minute limit, the subagent limit and the window limits. Its subagents are counted as each one is requested, at the approval check every tool call already passes. A model on a custom endpoint reports its tokens as it goes, so the token and minute limits hold. It has no usage windows and reports no cost.

Muse reports each model call’s tokens as it lands and each subagent as it starts, so the token and subagent limits hold. Gemini reports tokens only when a run ends, summed over its whole session, so its safety nets are the clock and the subagent count. Its quota is a daily one per model, which the window limits do not read.

When a limit trips

A STOP LOSS card appears at the bottom right with the reason and a six second countdown, and the terminal prints a line naming the limit.

  • Press Keep running and the run carries on. That one limit doubles for the rest of the turn and stays armed, so a real runaway is caught again.
  • Do nothing and the run is stopped when the countdown ends. The card turns into RUN STOPPED and the terminal prints which limit did it.

The cost alert never stops anything. A turn’s cost is only known once it has finished, so it arrives as a notice.

Ceilings

A ceiling is the share of an account’s weekly or monthly usage you do not want to go past. Set it on the account’s row in Settings > Accounts, in the Weekly Ceiling Limit box right after the address.

  • Type a whole percent and press Enter or click away. A number outside 1 to 99 is moved to the nearest end of that range.
  • A check mark beside the box shows the value is saved. It goes away while you type a new one.
  • Clear the box for no ceiling.

A ceiling lets you keep prompting without tracking usage yourself. When the account reaches the share you set, every terminal on it stops and new prompts wait, so what is left of the window goes to the work you then choose.

  • Before a run, the account’s usage is checked. Past the ceiling nothing starts. The terminal prints a line like Ceiling limit of this plan hit: 82% of Weekly · all models used, ceiling 80% with a Continue button. When several windows are past it, the worst one is named.
  • During a run, each account with a ceiling is read again every two minutes. When it crosses, every running terminal on that account prints the same line and its run stops.
  • Continue is for that terminal alone. It runs on past the window that stopped it, on that account, until that window resets. Its last prompt is sent again the way Auto continue sends one, and the button then reads Continued. Other terminals on the account keep waiting.

A plan can report more than one weekly window, such as one for all models and one for a single model. The same ceiling applies to each, and each stops the work on its own. A Continue frees only the window that stopped that terminal.

A Continue on a line from before a restart frees nothing. The next run reads the meter and prints the line again, and a Continue on that new line counts.

Autopilot never sends a pooled run to an account past its ceiling. When every account of the provider is past it, the run goes to the active account and the ceiling check stops it there.

Session windows of a few hours are never ceilinged. They come back within hours, and the provider’s own limit already stops the work there. The box only appears on a subscription that reports a window of a day or longer. API keys and custom endpoints have none.