# budget-leash

Hard budget enforcement for Ulpi sessions.

- Type: Plugin
- Version: 0.1.2
- Updated: 22 Nov 2026
- Publisher: jusst
- Category: Automation

[Contact us](https://www.ulpi.io/en/support#contact)

## 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

- [bulk](https://www.ulpi.io/en/marketplace/plugins/bulk): Apply one instruction to hundreds of independent files, CSV rows or JSON records from a /bulk slash command, with job state in SQLite, background processing.
- [bundlebees](https://www.ulpi.io/en/marketplace/plugins/bundlebees): bundlebees: dispatch sandboxed coding workers (bees) from Ulpi, watch their attempts, and keep the apply, test and push step in your own hands.
- [Butler](https://www.ulpi.io/en/marketplace/plugins/butler): Turns Ulpi into a proactive personal assistant.

[All listings →](https://www.ulpi.io/en/marketplace) · [Publisher's guide →](https://www.ulpi.io/en/docs) · [Report a problem →](https://www.ulpi.io/en/security#report)
