Dev & Engineering

Loop Budget Guard

Check token budget and run-log spend before and after each loop run; enforce early exit when over budget or when there's no actionable work.

29/ 100
Not recommended

Current benefit does not outweigh risk or uncertainty.

See how it was scored ↓
Works as-is in
Codex · Claude Code
Stars
★ 11k
Last updated
3d ago
License
MIT
token-budgetrun-logcost-controlkill-switch
+2loop-guardbudget-monitoring

What does this skill do, and when should you use it?

This skill is designed to manage token budgets in AI coding agent loops. It runs at the start and end of every loop iteration, reading `loop-budget.md` for daily caps and kill-switch flags, and `loop-run-log.md` for recent entries. It sums token estimates for the active pattern and enforces thresholds: at 80% spend, it switches to report-only mode; at 90%, it yields to a budget-negotiation skill if high-priority items remain; at 100% or with a pause-all flag, it exits immediately. Additionally, it exits quickly when there's no actionable work. At the end of a run, it appends a JSON record with metrics like run duration, items found, actions taken, and token estimate. This skill prevents overspending and keeps loops efficient and auditable.

Reads loop-budget.md for daily caps and kill-switch flags; reads recent entries in loop-run-log.md (last 24h); sums tokens_estimate for the active pattern; decides based on spend thresholds whether to stay in normal mode, enter report-only mode, delegate to the budget-negotiator skill, or exit immediately; checks STATE.md for actionable items and exits in under 5k tokens if none; appends a JSON object to loop-run-log.md after each run with run_id, duration, items_found, actions_taken, escalations, tokens_estimate, and outcome; appends an alert to loop-budget.md when self-throttling.

Good fit
  • A developer running high-frequency loops (e.g., CI sweeper, PR babysitter) with Claude Code or Codex wants to avoid wasting tokens when there's nothing actionable and ensure fast exits.
  • A team enforcing strict daily token budgets uses this skill to trigger different responses at 80% and 90% spend, preventing overspend.
  • An engineer running multiple loop patterns wants to automatically log token consumption at each loop boundary for cost analysis.
  • A user needs an emergency stop mechanism for automated loops, using the `loop-pause-all` flag or hitting 100% spend to exit immediately.
  • A developer wants loop runs to be auditable, relying on the structured JSON log to record key metrics of each run.

How do you install this skill?

Before you use it
  • This skill may modify loop-budget.md and loop-run-log.md; ensure backups or version control before use.
  • The skill does not describe handling for missing or malformed files; users must monitor for anomalies.
  • Static review cannot verify actual behavior; test in a controlled environment before production use.
Before you start
Your agent needs
  • Shell / CLI
  • Local filesystem

The skill resides in skills/loop-budget/ within the monorepo. To use it standalone, copy the folder into your Agent Skills directory (e.g., ~/.claude/skills/), or scaffold via npx @cobusgreyling/loop-init as described in the README. The README does not provide a standalone install command; follow the quickstart for the collection installation.

Generic route: install into Claude Code manually (macOS / Linux)
tmp="$(mktemp -d)"
git clone --depth 1 https://github.com/cobusgreyling/loop-engineering.git "$tmp"
mkdir -p ~/.claude/skills
cp -R "$tmp/skills/loop-budget" ~/.claude/skills/
rm -rf "$tmp"

Generated from the source repository and skill path; it copies only this skill's folder. If the author's install steps above differ, follow those first. To scope it to one project, replace ~/.claude/skills with that project's .claude/skills.

How do you use this skill?

Try saying

Once installed, send your agent any of these to trigger it:

  • Run the loop-budget skill to check the budget before starting the loop and log the run when finished.

Instruct your AI agent to run this skill at the start and end of each loop iteration. For example, prompt in Claude Code or Codex: "Run the loop-budget skill to check the budget before starting the loop and log the run when finished." The skill will automatically read budget files, calculate spend, decide whether to enter report-only mode or exit, and append a JSON record.

What are this skill's strengths and limitations?

Pros
  • Clear budget thresholds (80%, 90%, 100%) provide phased responses, preventing abrupt stops.
  • Supports emergency stop via `loop-pause-all` flag.
  • Forces quick exit (<5k tokens) when there's no actionable work, saving resources.
  • Records structured JSON after each run for auditing and cost analysis.
  • Integrates with other skills (e.g., budget-negotiator) for smarter budget handling.
Limitations
  • Requires the project to have `loop-budget.md`, `loop-run-log.md`, and `STATE.md`; without these files, the skill cannot function.
  • Relies on token estimates which may differ from actual consumption, leading to imprecise budget control.
  • Lacks an independent test suite, so reliability is unverified.
  • The skill description is brief and does not detail the config file formats; users may need to consult repository docs.

How does this skill compare with similar options?

Side by side with related skills; every score comes from the same FSRS standard.

Skill FS score Stars Last updated License
Loop Budget Guard this page 29 · Not recommended ★ 11k 3d ago MIT
Loki Checkpoint Mode 68 · Recommended ★ 1.1k 3d ago NOASSERTION
AgentTrace 57 · Use with care ★ 141 5d ago MIT
Azure Monitor Query for Python ✓ Microsoft · Official 54 · Use with care ★ 2.7k 3mo ago MIT
Cost Mode 54 · Use with care ★ 37 4d ago MIT

It works in concert with the budget-negotiator skill from the same repository: at 90% spend with high-priority tasks, this skill defers to the negotiator. The repository does not provide other direct competitors.

How did FollowSkills review this skill?

FollowSkills review · FSRS-2.0
Not recommended
29/ 100 5-point scale 1.5 / 5
The upstream repository has new commits since this review. The score still applies to the reviewed revision shown and may not cover the latest changes.
1Trust8 / 25 · 1.6/5

Evidence: The skill itself requests no extra permissions and no malicious behavior or data exfiltration is apparent. The repo includes SECURITY.md recommending least privilege and path denylists, and is MIT-licensed. However, the skill reads and may modify loop-budget.md and loop-run-log.md without clear user confirmation or rollback mechanisms; external effects (e.g., exiting loops) may impact automation but are not explicitly limited. Deduction for lack of explicit user confirmation and recovery.

2Reliability4 / 20 · 1.0/5

Evidence: Instructions are relatively clear (read/write files at start/end), but no test suite or execution evidence is present. Repo has CI workflows and test scripts, but coverage for this skill is unknown. Static read cannot verify key paths, and handling of abnormal input (e.g., missing files or malformed data) is not described; failure feedback is unclear. Hence low reliability.

3Adaptability9 / 15 · 3.0/5

Evidence: The skill addresses a clear scenario (budget checking) and fits loop engineering. Trigger conditions (start and end) are semantically clear, audience (developers using AI coding agents) is defined. But capability boundaries and non-fit ranges are not declared, and no mention of mainland-China network reachability. Core function depends on local files, not overseas services, so environment fit is acceptable.

4Convention3 / 15 · 1.0/5

Evidence: Skill file is simple with description and steps, but lacks versioning, changelog, and maintenance responsibility. Repo has README and SECURITY, but the skill lacks examples, FAQ, and known limitations. No explicit version control or changelog. Deduction.

5Effectiveness3 / 15 · 1.0/5

Evidence: Skill describes intended task (budget check, run log), but no sample outputs or verification of direct usability. Marginal value may be limited as users might monitor budgets manually. Static read cannot verify correctness. Hence low score.

6Verifiability2 / 10 · 1.0/5

Evidence: Repo has CI workflows (audit.yml) and test scripts, but no direct test evidence for this skill. Key claims (e.g., auto-exit) are not independently verified. Static read cannot reproduce. Hence low score.

1 2 3 4 5 6

Open a dimension to read why it scored that way

Reviewed Aug 07, 2026 Reviewed revision c57170dbf93f Review evidence[1][2][3][4][5][6][7]

Evidence confidence:Low — Mostly static review, author material or a limited demo; useful for discovery, not high-risk decisions.

See the full review method →

FAQ

What happens if I don't have `loop-budget.md`?
The skill cannot read the budget, so it cannot function correctly. You need to create these files first, perhaps with `loop-init`.
How does the skill estimate tokens?
It reads the `tokens_estimate` field from entries in `loop-run-log.md` from the last 24 hours and sums them. These estimates are provided by previous runs and may not be accurate.
Will the skill actually exit when there's no work?
Yes, if `STATE.md` or the watchlist has no actionable items, it exits in under 5k tokens without spawning sub-agents.

More skills from this repository

All from cobusgreyling/loop-engineering

Related skills