loop-budget
Check token budget and run-log spend before and after a loop run. Enforces early exit when over budget or when there is no actionable work.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 1.2w
- Forks
- 1.6k
01 前言 Front Matter
- name
- loop-budget
- description
- Check token budget and run-log spend before and after a loop run. Enforces early exit when over budget or when there is no actionable work.
03 SKILL.md 正文
Loop Budget Guard
Run at the start and end of every loop iteration.
Start of run
- Read
loop-budget.mdfor daily caps and kill-switch flags. - Read recent entries in
loop-run-log.md(last 24h). - Sum
tokens_estimatefor the active pattern today. - If spend ≥ 80% of the pattern's daily cap → report-only mode (no sub-agents, no auto-fix).
- If spend ≥ 90% and High Priority items remain in
STATE.md, yield to the budget-negotiator skill (if installed). Otherwise, if spend ≥ 100% orloop-pause-allis set → exit immediately with a one-line note in STATE.md. - If watchlist/state has no actionable items → exit in <5k tokens (do not spawn sub-agents).
End of run
Append one JSON object to loop-run-log.md:
{
"run_id": "<ISO8601>",
"pattern": "<pattern-id>",
"duration_s": <number>,
"items_found": <number>,
"actions_taken": <number>,
"escalations": <number>,
"tokens_estimate": <number>,
"outcome": "no-op | report-only | fix-proposed | escalated"
}
Rules
- Never exceed
max sub-agent spawns/runfromloop-budget.md. - High-cadence patterns (CI Sweeper, PR Babysitter) must early-exit when nothing is actionable.
- On self-throttle, append a line to
loop-budget.mdunder Alerts This Period.
04 同仓库更多 Skills
goal-verifier
Verify goal completion.
pr-review-triage
Triage open pull requests for CI status, review comments, and merge readiness. Use in PR babysitter loops. Respects project review norms and required checks.
pr-review-triage
Triage open pull requests for CI status, review comments, and merge readiness. Use in PR babysitter loops. Respects project review norms and required checks.
pr-review-triage
Triage open pull requests for CI status, review comments, and merge readiness. Use in PR babysitter loops. Respects project review norms and required checks.
pr-review-triage
Watch open PRs, check CI status, review staleness, merge conflicts, and unanswered review comments. Produces a prioritized watchlist.
post-merge-scan
Scan recent merges to main for follow-up cleanup: TODOs, deprecations, broken doc links, stale flags. Use in post-merge cleanup loops.