Budget
aide enforces a token budget per task. When the budget runs out, the task stops — no surprise bills.
Configuration
[budget]
tokens = "100k"
max_retries = 3
- tokens — maximum tokens for the entire task (all retries combined)
- max_retries — how many times
claude -pcan be invoked for a single task
How it works
- aide calls
claude -pwith--output-format json - Claude Code returns token usage in its JSON output
- aide tracks accumulated tokens across invocations
- If
accumulated >= limitorinvocations > max_retries, the task stops
Saturating arithmetic
The budget tracker uses saturating arithmetic — token counts can never overflow u64::MAX. This is formally verified with kani.
Token shorthand
| Input | Value |
|---|---|
"50k" | 50,000 |
"100k" | 100,000 |
"1m" | 1,000,000 |
"200000" | 200,000 |
Default: "200k" if not specified.