NEW Workflows: agents follow the steps, you sign off. Read more →
Ulpi

budget-leash

PLUGIN

Hard budget enforcement for Ulpi sessions.

by jusst · v0.1.2

What it does

Hard budget enforcement for Ulpi sessions. Tracks estimated model spend (token usage x per-model prices, cache read/write tokens included) and tool-call counts against a per-session cap and a persistent per-day cap; blocks tool calls via pre_tool_call once a cap is exhausted and cuts off the model calls themselves via the llm_execution middleware, answering with a synthetic budget-exhausted reply so the provider is never invoked (fail-closed), so unattended agents cannot run up unbounded cost; warns at 80% of a cap via context injection, keeps a flock-guarded day-ledger on disk that survives restarts and is shared safely across processes, and writes a per-session JSONL spend report.

Disclosure — local code only; meters estimated model spend from token-usage metadata and tool-call counts, and with the defaults ($2 per session, $10 per day, 200 tool calls per session, 1000 per day) refuses tool calls and answers model calls with a synthetic budget-exhausted reply once a cap is reached; spend figures are estimates from a user-editable price table (default $1/$3 per million input/output tokens), not provider bills; reads its settings from budget-leash.json in the Ulpi home and writes ledger.json, its lock file and reports.jsonl under plugin-data/budget-leash/ there; no network calls, no subprocesses.

Review notes

What an owner reads and accepts before the install is approved.

  • Ulpi has not reviewed this version: it is listed in the public plugin catalog, and the install still fetches it at its pinned commit, checks its shape and scans it before you approve

More in Automation

All listings →