Session 4 step 16 — post-hoc enforcement via PostToolUse hook with PAUSED flag, budget-report.sh aggregates spend against window limit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
758 B
Markdown
26 lines
758 B
Markdown
# Budget Policy: {{PROJECT_NAME}}
|
||
|
||
## Company Budget
|
||
- window: {{BUDGET_WINDOW}}
|
||
- limit: {{BUDGET_LIMIT_CENTS}} cents
|
||
- warn_percent: 80
|
||
- hard_stop: true
|
||
|
||
## Agent Budgets
|
||
- {{AGENT_NAME}}: {{AGENT_BUDGET_CENTS}} cents/{{BUDGET_WINDOW}}
|
||
|
||
## Notification
|
||
- on_warn: log
|
||
- on_hard_stop: pause
|
||
|
||
## Notes
|
||
|
||
Budget enforcement is POST-HOC (checked after each run, not before).
|
||
This matches Paperclip's proven approach: check SUM(cost) after run,
|
||
pause if exceeded. No pre-run reservation needed.
|
||
|
||
Cost estimation uses token counts × published pricing. For accurate
|
||
cost data, organizations can use the Admin API:
|
||
`/v1/organizations/cost_report` (requires Admin API key: sk-ant-admin...).
|
||
|
||
For headless runs, use `claude -p --max-budget-usd N` as a per-run cap.
|