loop-budget

loop-budget is a skill for Claude Code from cobusgreyling/loop-engineering. It costs 32 tokens per session (413 once invoked), scanned A, original, MIT.

A budget check for automated work loops that reads spending limits and recent run records before and after each iteration.

In plain words
What is it for?
Use it to enforce early exits, switch to report-only mode at spending thresholds, stop when a pause flag is set, limit sub-agent use, and record each loop run’s duration, actions, escalations, and estimated token use.
Why use it?
It helps prevent an automation loop from exceeding its token budget or continuing when there is no actionable work.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents.

Part of the loop-engineering plugin — 14 skills, 2 agents shipped together

Good fit Use it to enforce early exits, switch to report-only mode at spending thresholds, stop when a pause flag is set, limit sub-agent use, and record each loop run’s duration, actions, escalations, and estimated token use.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cobusgreyling/loop-engineering/loop-budget
About the project

Loop Engineering is a collection of patterns, starter projects, and command-line tools for designing recurring workflows around AI coding agents. It is for developers who want agents to discover work, make changes, verify results, and preserve project state across tasks. The catalogue entries provide the project's reusable skills, agents, plugin, and instruction.

cobusgreyling/loop-engineering · 11,684 stars · on GitHub · cobusgreyling.github.io

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cobusgreyling/loop-engineering --skill loop-budget
Clone the repo
git clone --depth 1 https://github.com/cobusgreyling/loop-engineering

Made for: Claude Code.

Or install loop-engineering, the plugin that ships this one along with the rest of its 14 skills, 2 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for loop-budget

README.md
[![agentmods](https://agentmods.dev/badge/skills/cobusgreyling/loop-engineering/loop-budget/github.svg)](https://agentmods.dev/skills/cobusgreyling/loop-engineering/loop-budget)
Your own site
<a href="https://agentmods.dev/skills/cobusgreyling/loop-engineering/loop-budget"><img src="https://agentmods.dev/badge/skills/cobusgreyling/loop-engineering/loop-budget/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for loop-budget

Your own site · 80×15
<a href="https://agentmods.dev/skills/cobusgreyling/loop-engineering/loop-budget"><img src="https://agentmods.dev/badge/skills/cobusgreyling/loop-engineering/loop-budget.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 413 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00032 $0.00413
Opus 5.5 $0.00013 $0.00165
Sonnet 5.5 $0.00006 $0.00083
Haiku 4.5 $0.00003 $0.00041

Measured 2mo ago against content hash afc4674711e7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

loop-budget scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/loop-budget/SKILL.md · 40 lines

What it actually says

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

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 40 lines · 32 tokens per session scan A afc4674711e7

Subscribe to this mod's changes

loop-budget is a skill published in the GitHub repository cobusgreyling/loop-engineering (11,684 stars, last pushed yesterday), licensed MIT. It adds 32 tokens to every session and 413 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

github-actions

Use when authoring or fixing GitHub Actions CI/CD — workflows under .github/workflows, triggers, job matrix, caching, token permissions, OIDC cloud deploys, environment gates, reusable workflows. NOT the Dockerfile or image build strategy (that is docker), NOT the branching model (that is git-workflow), NOT release…

ericrisco/rsc-harness · 81 tokens

deployment

Use when taking an app from source to live: choosing the deploy target from requirements (Hetzner+Coolify vs Vercel vs a third), then wiring container → CI → registry → host with build secrets, healthchecks and rollback. NOT one platform's mechanics (that is coolify, vercel, railway, render), NOT the Dockerfile alone…

ericrisco/rsc-harness · 86 tokens

github-workflow-automation

Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management.

ruvnet/ruflo · 26 tokens

github-workflow-automation

Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management.

spencermarx/open-code-review · 26 tokens

aw-author

Author, validate, and improve GitHub Agentic Workflow (gh-aw) markdown files. Use when the user wants to create a new workflow, validate an existing workflow, improve a workflow, or debug workflow issues. Triggers on: "aw-author", "agentic workflow", "gh-aw workflow", "workflow markdown", "workflow frontmatter"…

zircote-plugins/github-agentic-workflows · 91 tokens

aw-daily

Fully autonomous daily pipeline for the aw-author plugin. Executes intelligence research (web search + GitHub activity queries), posts to Discussions, performs gap analysis against reference files, creates issues, implements changes on develop branch, creates PR, requests review, and auto-merges. Designed for…

zircote-plugins/github-agentic-workflows · 94 tokens