# How Do You Control AI Coding Agent Spend?

**Short answer.** Controlling AI coding agent spend means setting a hard
ceiling on tokens, dollars, or tool calls for a given change and having the
tool itself refuse to continue once that ceiling is crossed — not just a
dashboard that reports spend after the fact. A number you can look up
after the run is observability. A number that blocks the run is control.

## Reporting versus enforcing

Every AI coding tool can show you how much a session cost after it
finished. Far fewer will actually stop a run before it doubles that cost.
The difference is whether spend is checked *during* the loop, against a
ceiling that was configured *before* it started.

## How Maistik Forge does it

The [spend budget](/harness/budget) is one of [Forge's enforced
controls](/harness/overview) and bounds cost the way the [verify
circuit-breaker](/harness/circuit-breaker) bounds iterations. Each change
keeps its own ledger (`.forge/changes/<c>/budget.yaml`):

```sh
forge budget record --change <c>   # add reported spend, enforce ceiling
forge budget check  --change <c>   # read-only verdict
forge budget reset  --change <c>   # clear the ledger
```

`record` returns a non-zero exit with `BUDGET EXCEEDED` the moment a
configured ceiling — `--max-tokens`, `--max-usd`, or `--max-tool-calls` —
is strictly crossed. With no ceiling set, the ledger accumulates spend and
never blocks; enforcement only turns on once you give it a number to
enforce.

## Questions people actually ask

### Does Forge meter tokens itself, or does it trust the agent to report them?

Forge is not inside the model's inference loop, so it does not meter tokens
on its own. Whoever holds the real numbers — a host hook or the agent —
reports spend into the ledger, and Forge enforces the ceiling against what
was reported. Tool-call count is the most reliably reportable figure, since
a `PostToolUse` hook can increment it once per call. See [the honest
limit](/harness/budget#the-honest-limit) for the full explanation of what
this does and does not guarantee.

### What happens exactly at the limit — does the last request still go through?

Reaching exactly the configured ceiling is within budget; only strictly
exceeding it blocks. `1000/1000` passes, `1001/1000` blocks.
