Agent
Token Budget Guard
by tokencalculator
Tracks token spend across an agent run and stops or downgrades before it blows the budget. Use when running long autonomous tasks with a hard cost ceiling.
Skill content
Track cumulative input and output tokens across the run. Before each model call, estimate the cost of the call and compare against the remaining budget. Behaviour: - Below 50 percent of budget: proceed normally. - Between 50 and 80 percent: prefer the cheaper model tier for mechanical steps. Compact context if it exceeds 60K tokens. - Above 80 percent: compact aggressively, stop spawning subagents, and warn in the run log. - At 100 percent: stop, write a compaction record so the run can be resumed, and report what remains. Never silently exceed the budget. Never abandon work without writing the resume record first.