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
10k22 skills2 agents
Install
$ npx -y skills add cobusgreyling/loop-engineering --skill loop-budget --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/loop-budget

Context preview

The summary Claude sees to decide when to auto-load this skill.

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.

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
Ships withloop-engineering

Stop prompting. Design the loop. Get a score. loop init (or loop-init) scaffolds skills, state, and budget files, then prints your Loop Ready score and first loop command. loop doctor combines audit + sync + file checks into top-3 next actions.

Get the whole plugin
Stats
10,077
Stars
1,365
Forks
Active
Maintenance
JavaScript
Language
MIT
License
6h ago
Last commit
2mo ago
Created

Repo: cobusgreyling/loop-engineering