feat(templates): add budget tracking templates (Paperclip pattern)
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>
This commit is contained in:
parent
506f532f88
commit
ec6f7c150e
4 changed files with 246 additions and 0 deletions
26
scripts/templates/budget/BUDGET.md
Normal file
26
scripts/templates/budget/BUDGET.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# 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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue