Skip to main content
ClaudeWave
Skill323 estrellas del repoactualizado yesterday

loop-budget

The loop-budget skill monitors token consumption and run activity across loop iterations by checking budget caps and run logs before execution and logging outcomes after completion. Use this to enforce cost controls, prevent runaway spending by exiting when budgets are exceeded or work is non-actionable, and maintain detailed spending records for high-frequency automation patterns like CI sweepers and PR monitors.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/cobusgreyling/loop-engineering /tmp/loop-budget && cp -r /tmp/loop-budget/skills/loop-budget ~/.claude/skills/loop-budget
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# 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 ≥ 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`:

```json
{
  "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**.