loop-budget

loop-budget is a skill for Claude Code, Codex from tzz123-hub/DevWhale. It costs 33 tokens per session (398 once invoked), scanned A, original, MIT.

A skill that checks token usage and run logs before and after each automated work cycle. Tokens are the units used to measure an AI model’s input and output.

In plain words
What is it for?
Use it to enforce budgets, record each cycle’s cost and outcome, and exit early when further automated work is unnecessary.
Why use it?
It stops or limits work when spending approaches a daily budget, when a pause switch is set, or when there is nothing actionable to do.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it to enforce budgets, record each cycle’s cost and outcome, and exit early when further automated work is unnecessary.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tzz123-hub/devwhale/loop-budget
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 tzz123-hub/DevWhale --skill loop-budget
Clone the repo
git clone --depth 1 https://github.com/tzz123-hub/DevWhale

Made for: Claude Code, Codex.

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/tzz123-hub/devwhale/loop-budget/github.svg)](https://agentmods.dev/skills/tzz123-hub/devwhale/loop-budget)
Your own site
<a href="https://agentmods.dev/skills/tzz123-hub/devwhale/loop-budget"><img src="https://agentmods.dev/badge/skills/tzz123-hub/devwhale/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/tzz123-hub/devwhale/loop-budget"><img src="https://agentmods.dev/badge/skills/tzz123-hub/devwhale/loop-budget.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 398 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.
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.00033 $0.00398
Opus 5.5 $0.00013 $0.00159
Sonnet 5.5 $0.00007 $0.00080
Haiku 4.5 $0.00003 $0.00040

Measured 1mo ago against content hash 9afa1314c99f, 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 1mo 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.

.codewhale/skills/loop-budget/SKILL.md · 41 lines

What it actually says

Loop Budget Guard(循环预算守卫)

在每次循环迭代的开始和结束时运行。

运行开始

  1. 读取 loop-budget.md 获取每日上限和 kill-switch 标志。
  2. 读取 loop-run-log.md 最近 24 小时的条目。
  3. 汇总当日该模式的 tokens_estimate。
  4. 如果花费 ≥ 模式每日上限的 80% → 仅报告模式(禁止子代理、禁止自动修复)。
  5. 如果花费 ≥ 100% 或 loop-pause-all 已设置 → 立即退出,在 STATE.md 中写一行说明。
  6. 如果观察列表/状态中无可操作项 → 在 <5k token 内退出(不创建子代理)。

运行结束

向 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"
}

规则

  • 绝不超出 loop-budget.md 中 max sub-agent spawns/run 的限制。
  • 高频模式(CI Sweeper、PR Babysitter)必须在无待办时提前退出。
  • 自我节流时,在 loop-budget.md 的 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. 1mo ago First seen · 41 lines · 33 tokens per session scan A 9afa1314c99f

Subscribe to this mod's changes

loop-budget is a skill published in the GitHub repository tzz123-hub/DevWhale (10 stars, last pushed 4mo ago), licensed MIT. It adds 33 tokens to every session and 398 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-31.

Related

Other skills, from other repositories

eac-desktop-tips

A quick reference for using and troubleshooting features in the Deepseek Harness EAC desktop client. It covers window behavior, conversation rollback, plugins, desktop pets, Skills, MCP services, updates, and logs.

zouyuxuan122/DSH-Desktop-EAC · 80 tokens

electron-expert

Expert in Electron framework, desktop app development, IPC, and cross-platform packaging. Use when the user mentions desktop, Node.js, cross platform, Windows, macOS, or Linux, or when the task involves Electron Architecture, Process Types, IPC Communication, or App Lifecycle.

personamanagmentlayer/pcl · 59 tokens

architecture-diagram

How to draw and maintain the architecture diagram Ensemblr keeps for a workspace — ensemblrgetarchitecturediagram to fetch the stored one (it answers with null when nobody has drawn this workspace yet), the IR shape, how to derive it from the codebase, and ensemblrupdatearchitecturediagram to store it. Read this when…

ensemblr-hq/ensemblr · 94 tokens

ensemblr

How Ensemblr works from inside it — the workspace/git-worktree model, the ensemblr control tools and what their answers mean, the committed .ensemblr/settings.toml (setup and run scripts, [git], [prompts], [infisical], environment variables), /.config/ensemblr/config.json, the Changes panel and diff comments, the…

ensemblr-hq/ensemblr · 130 tokens

lino-veusz-sci-plot

An automation guide for Veusz, a free scientific charting program similar to Origin, using Python scripts.

LINoone516/lino-agent-skills · 71 tokens

lino-local-vision

A local vision tool that uses a model running in LM Studio to inspect images and read text from them. It works through a local OpenAI-compatible service and is intended to run without sending images to an external API.

LINoone516/lino-agent-skills · 57 tokens