Budget requests and spend control
Fund output metrics rather than outcomes, hold worst-case spend before every model call, honour the pause file, and halt spend when a goal turns red.
Requesting budget is one of a holon's five permitted actions. Constitution, article 3 Because holons never approve spend themselves, every budget request goes to a person while every runtime model call sits behind a hard, disk-backed spend meter. Constitution 1.7 Reference: meter.mjs
Best practices
- Attach budgets strictly to output metrics, never to outcome metrics. Fund controllable work volume (tasks run, packs prepared, messages classified) rather than lagging outcomes such as revenue. Ruling 18 Vocabulary term 25
- Hold the worst-case call cost on disk before invoking a model. Settle the actual cost transactionally after the call so concurrent requests or crashes cannot overspend the day's budget. Reference: meter.mjs
- Check the
PAUSEfile before every model call, including mid-flow. Dropping aPAUSEfile in the data directory must halt spend immediately without restarting the server. Reference: server.mjs Reference: meter.mjs - Refuse startup if an existing spend ledger is missing or empty. A deleted or wiped ledger must never silently reset a deployment's daily budget. Reference: server.mjs Reference: meter.mjs
- Halt automated spend-bearing retries when a goal turns red. Do not keep burning budget on a failing red goal; stop spend so a person can review and reallocate. Vocabulary term 28 Doctrine §6 Wireframe review C5
Budgets fund outputs, never outcomes
In Decidr's goal model, an output metric measures controllable units produced by task types (such as requests classified or compilation packs prepared), whereas an outcome metric measures a lagging result earned from those outputs (such as net margin or client retention). Vocabulary term 25
Budgets apply exclusively to output metrics. Ruling 18 When a holon sees that funded output capacity is insufficient to keep a goal inside its result range, it emits a request budget action naming the output metric, the wholesale task type, and the concrete Product · Variant · $X.XX / unit price. Constitution, article 3 Ruling 52 Structure and app installs are free; only executed task-type runs and retail artefacts are priced. Ruling 52
The spend meter and the pause file
Every live holon wraps its decisions client and reply client in a transactional micro-USD meter stored in the local store. Reference: meter.mjs Reference: server.mjs
Before sending any call, the meter computes a strict upper bound from UTF-8 byte lengths (because a byte-level token is at least one byte), adds fixed framing (FRAMING_TOKENS * 4, where FRAMING_TOKENS = 1024), and adds the maximum output cap for reply calls (decisions output is free). Reference: meter.mjs
hold(amount) {
if (broken) return null;
const a = Math.max(1, Math.ceil(amount));
const d = dayOf(now());
const t = today();
const held = heldToday.get(d).held;
if (t.calls >= callCap || t.spent + held + a > budgetMicro) return null;
const h = { id: randomUUID(), day: d, amount: a };
try { putHold.run(h.id, h.day, h.amount, new Date(now()).toISOString()); }
catch { broken = true; return null; }
return h;
}Four safeguards prevent silent budget drift:
| Safeguard | How the meter enforces it |
|---|---|
| Persist before call | hold() saves a row in console_holds before the network request leaves. Reference: meter.mjs |
| Commit before release | settle() adds the actual charge to console_spend inside a transaction before deleting the hold; unknown costs keep the full hold. If recording fails, broken locks all future holds. Reference: meter.mjs |
| Crash recovery | On boot, any leftover rows in console_holds are charged in full to console_spend. Reference: meter.mjs |
| Ledger integrity and pause | checkLedger() verifies a .init marker and requireExisting verifies console_spend exists before boot. Both server.mjs and meter.mjs check the PAUSE file before every call, returning the resting line when paused. Reference: server.mjs Reference: meter.mjs |
On the public surface, display only the billed Product · Variant price; keep raw micro-USD model cost strictly off public ports and visible only on internal operator views. Holon rules §1.3 Wireframe review C6
Red result ranges halt spend
Result ranges act as a three-state control switch for goals: Green runs deterministically at zero model cost, Orange slows down to evaluate, and Red stops spend immediately so the organisation can learn and reallocate. Vocabulary term 28 Doctrine §9 Wireframe review C5
For example, when EFS Delivery's goal for approved invoices not marked as sent enters the red band, automated spend-bearing retries halt and the exception surfaces for a person to act. Wireframe review C5
Request budget against a controllable output metric with its product-variant price.
<div class="hx-card hx-stack">
<div class="hx-spread">
<div class="hx-row">
<img class="hx-glyph" src="assets/glyphs/function.svg" alt="Function holon">
<span class="hx-title">Budget request · EFS Delivery</span>
</div>
<span class="hx-chip">Request budget</span>
</div>
<div class="hx-small">Output metric: Comp pack intake emails classified (500 requests for Week 48, 2026).</div>
<div class="hx-spread">
<span class="hx-price">Classify delivery request · Standard · $0.02 / request</span>
<span class="hx-small hx-muted">Assigned to [Practice lead]</span>
</div>
</div>Do not fund an outcome metric directly or auto-spend through a red goal.
<div class="hx-card hx-stack">
<div class="hx-spread">
<span class="hx-title">Outcome budget auto-approved</span>
<span class="hx-row"><span class="hx-dot hx-red"></span><span class="hx-small">Red</span></span>
</div>
<div class="hx-small hx-muted">Added $500 to revenue goal and queued 20 automatic retries.</div>
</div>