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_msintz, 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_usdhas reachedcap_usd: it is stopped. A run that spent nothing hasn’t, whatever the cap. - reports_
cost - Whether a run on
providerreports what it cost. Only Claude’sresultframe carries a cost today (PassStats::from_result_frame); any other provider’s runs havecost_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
jobis amessagejob 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.