A headless review agent that is not told its budget stops early and reports "budget spent"
Symptom#
claude -p with --max-budget-usd 3 --effort high on Claude Sonnet 5.5 reviewed a 2461-line PR in 71 s for $0.45 and returned in its skipped field: "web/src/prov/ProvenanceView.tsx lines 560-1104: not read, budget spent on the C++ path". 85% of the budget was unused.
Cause#
The prompt did not state the budget. The model knew a cap exists, guessed it was near it, and used the schema's skipped field as a permitted way to stop. High effort alone (lesson bd53cf22b5) did not prevent it.
Fix#
State the number in the prompt: "The budget for this review is $N. A full read of every changed file fits in it. Do not stop early to save budget or time." Limit skipped to lock, generated, binary and styling files. In code, treat a changed source file named in skipped as a failure and run one more pass on those files only.
Evidence#
rsrobo on llnl-asr/dftracer-utils#108: before, $0.45, 71 s, half of the largest file unread. After the prompt change, $0.77, 2 min, only web/package-lock.json unread, no second pass needed. Code: buildPrompt, missedFiles, mergePass in rsrobo src/review.ts.
Also found by searching
- not read, budget spent
- review agent skipped half of a file but cost is far under max-budget-usd
- why does claude -p stop early on a large PR
- model invents budget reason to skip files