ashlr-budget

ashlr-budget is a command for Claude Code from ashlrai/ashlr-plugin. It costs 24 tokens per session (904 once invoked), scanned A, original, MIT.

A session budget control that sets, displays, or removes a limit on tool spending in dollars or tokens. Tokens are the small text units used to measure model input and output.

In plain words
What is it for?
Use it to set a dollar or token cap, check current usage against that cap, or turn the cap off.
Why use it?
It stops tool calls after a chosen limit, helping prevent unexpectedly expensive or runaway sessions.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: positional $N argument.

Part of the ashlr plugin — 11 skills, 36 commands, 5 agents, 7 hooks, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/ashlrai/ashlr-plugin/ashlr-budget
Clone the repo
git clone --depth 1 https://github.com/ashlrai/ashlr-plugin

Made for: Claude Code.

Or install ashlr, the plugin that ships this one along with the rest of its 11 skills, 36 commands, 5 agents, 7 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ashlr-budget

README.md
[![agentmods](https://agentmods.dev/badge/commands/ashlrai/ashlr-plugin/ashlr-budget.svg)](https://agentmods.dev/commands/ashlrai/ashlr-plugin/ashlr-budget)
Your own site
<a href="https://agentmods.dev/commands/ashlrai/ashlr-plugin/ashlr-budget"><img src="https://agentmods.dev/badge/commands/ashlrai/ashlr-plugin/ashlr-budget.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 904 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00024 $0.00904
Opus 5 $0.00012 $0.00452
Sonnet 5 $0.00005 $0.00181
Haiku 4.5 $0.00002 $0.00090

Measured 6d ago against content hash a45cdf3518ed, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

ashlr-budget scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/ashlr-budget.md · 77 lines

How it starts

The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Manage a session budget cap that blocks tool calls when the limit is reached.

Usage

/ashlr-budget $X            # set USD cap (e.g. /ashlr-budget $2.00 or /ashlr-budget $0.50)
/ashlr-budget tokens=200000 # set token cap (e.g. /ashlr-budget tokens=200000)
/ashlr-budget status        # show current usage vs budget
/ashlr-budget off           # clear the budget cap

$X and tokens=N are mutually exclusive — setting one clears the other.

Environment variables

The budget guard hook (hooks/pretooluse-budget-guard.ts) reads these env vars:

Variable Description
ASHLR_SESSION_BUDGET_USD USD cap as a decimal string (e.g. "2.00")
ASHLR_SESSION_BUDGET_TOKENS Token cap as an integer string (e.g. "200000")

The status line shows $X / $Y · Z% when ASHLR_SESSION_BUDGET_USD is set, or Nt / Nmax · Z% when ASHLR_SESSION_BUDGET_TOKENS is set.

Steps

$X — set USD cap

  1. Parse the dollar amount (strip $, parse as float). Reject if non-positive or non-numeric.
  2. Set environment variable: ASHLR_SESSION_BUDGET_USD=<amount> via Bash:
    export ASHLR_SESSION_BUDGET_USD=<amount>
    unset ASHLR_SESSION_BUDGET_TOKENS
    
  3. Confirm: "Budget set to $<amount>. The pretooluse-budget-guard hook will warn at 80%, warn loudly at 95%, and block at 100%."

tokens=N — set token cap

  1. Parse N as integer. Reject if non-positive.
  2. Set: ASHLR_SESSION_BUDGET_TOKENS=<N> via Bash, unset USD cap.
  3. Confirm: "Budget set to <N> tokens."

status — print current usage

  1. Read ASHLR_SESSION_BUDGET_USD and ASHLR_SESSION_BUDGET_TOKENS from environment.
  2. Read session-log (~/.ashlr/session-log.jsonl) to compute cumulative input_size + output_size bytes for the current session.
  3. Estimate token usage: tokens ≈ (input_bytes + output_bytes) / 4.
  4. Estimate USD: usd ≈ tokens / 1_000_000 * 12 (blended $4/Mtok input + $20/Mtok output at typical 60/40 mix).
  5. Print:
    Session budget status
    ─────────────────────
    USD cap:    $<cap>  (or "not set")
    Token cap:  <N>     (or "not set")
    Est. tokens used:   ~<N>
    Est. USD used:      ~$<X>
    Usage:              <Z>%
    
    If no budget is set: "No budget set. Use /ashlr-budget $X or /ashlr-budget tokens=N to set one."

Read the full file on GitHub · 77 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 77 lines · 24 tokens per session scan A a45cdf3518ed

Subscribe to this mod's changes

ashlr-budget is a command published in the GitHub repository ashlrai/ashlr-plugin (3 stars, last pushed 6d ago), licensed MIT. It adds 24 tokens to every session and 904 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.