Skip to main content

Module caps

Module caps 

Source
Expand description

Spending caps for job runs (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §5.3): the defaults Settings → Jobs holds, the figures a job’s policy.caps may lower, and the rules that decide, from the spend the ledger found, whether a run may start. Pure: reservation.rs reads the ledger and acts on the answer.

A day is the operator’s local calendar day (§10, decision 7).

Structs§

Effective
The figures that apply to one job: its own, else the defaults.
Limits
The caps Settings → Jobs holds: what a job without figures of its own gets, and the most an agent can ask for.
Spend
The spend a start is weighed against: what was spent today plus what the runs in flight may still spend (each at its whole per-run cap).

Enums§

Refusal
What a start may not do, in the order checked.

Constants§

DEFAULT_ACCOUNT_DAY_USD
DEFAULT_JOB_DAY_USD
DEFAULT_MESSAGES_PER_DAY
DEFAULT_RUN_USD
The defaults when Settings leaves a cap unset (§5.3, operator decision 2).

Functions§

check
The reservation (§5.3): the run starts only if the job’s spend today plus the run’s whole per-run cap fits the job’s daily cap, and the same for its account. Every run that starts this way spends at most its cap, so the day’s total can’t pass the daily cap even if each one spends all of it.
clamp_to_defaults
An agent’s caps, held to the defaults: a higher figure becomes the default (only the operator raises a cap, §7). A figure the job already had (before, on an edit) is kept as it is, so an agent changing a job’s brief doesn’t lower a cap the operator raised. Returns the caps to store and, for each figure changed, a sentence for the reply.
day_start_ms
Local midnight at or before now_ms in tz, ms epoch. A zone whose midnight doesn’t exist that day (a daylight-saving gap at 00:00) starts its day at the first hour that does.
effective
local_day_start_ms
The operator’s local midnight (the machine’s time zone).
reached
Whether a run that has spent cost_usd has reached cap_usd: it is stopped. A run that spent nothing hasn’t, whatever the cap.
reports_cost
Whether a run on provider reports what it cost. Only Claude’s result frame carries a cost today (PassStats::from_result_frame); any other provider’s runs have cost_known = false, count $0 toward the dollar caps and are bounded by their timeout (§5.3). A provider not known yet is assumed to report one.
sends_to_another
Whether job is a message job aimed at an agent other than its owner (§5.3). A job with no owner, the operator’s own, isn’t: the limit is for an agent’s job that could flood another agent’s conversation.