Skip to content
Development
Skill

/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.

From plugin
loop-engineering
12k14 skills2 agents

Claude Code

$ npx -y skills add cobusgreyling/loop-engineering --skill loop-budget --agent claude-code

SKILL.md

loop-budget.SKILL.md
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.

Loop Budget Guard

Run at the **start** and **end** of every loop iteration.

Start of run

1. Read `loop-budget.md` for daily caps and kill-switch flags. 2. Read recent entries in `loop-run-log.md` (last 24h). 3. Sum `tokens_estimate` for the active pattern today. 4. If spend ≥ 80% of the pattern's daily cap → **report-only mode** (no sub-agents, no auto-fix). 5. If spend ≥ 90% and High Priority items remain in `STATE.md`, yield to the [budget-negotiator](../budget-negotiator/SKILL.md) skill (if installed). Otherwise, if spend ≥ 100% or `loop-pause-all` is set → **exit immediately** with a one-line note in STATE.md. 6. 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/run` from `loop-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.md` under **Alerts This Period**.
Read more
@cobusgreyling
Ships withloop-engineering

Stop prompting. Design the loop. Get a score. Start in 5 minutes · Quickstart · What do you want to do? · Refactor path · 中文 · Pattern picker --tool defaults to claude if you omit it. Swap for grok, codex, or opencode. Week one is report-only.

12k14 skills2 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
11.8k
Star history of cobusgreyling/loop-engineering on GitHub, a chart by star-history.com

Other skills on loop-engineering.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about loop-budget.

Which coding agents can use loop-budget?
loop-budget installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.