Generated banner for Stay Within Limits
Generated logo for Stay Within Limits

Stay Within Limits

Builder.ioOfficialPublished by Builder.io

  • Skill
  • Meta (authoring, orchestration, planning, memory)
  • Agent tooling
  • MIT
  • Low risk

From the author

Use when long-running or parallel agent work must respect 5-hour and weekly usage limits by checking usage between waves, pausing near the cap, and resuming only when the window is clear.
— the description by Builder.io

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach for agents to manage long-running or parallel tasks while respecting 5-hour and weekly usage limits. It defines a core loop that involves checking usage before and after work waves, pausing operations when usage reaches a 95% threshold, and scheduling self-contained resumes to ensure work continues only when the usage window is clear.

What it does

  • Monitors 5-hour and weekly usage limits during task execution.
  • Throttles parallel subagent work to prevent exceeding budget thresholds.
  • Implements a check-pause-resume cycle for long-running operations.
  • Uses host-specific tools to verify current usage and window status.
  • Schedules future wakeups to resume tasks once usage windows clear.
  • Maintains state in wake prompts to allow for seamless task resumption.

When to use it

  • When executing long-running agent tasks that risk hitting usage caps.
  • When managing parallel subagents that could collectively exceed budget limits.
  • When you need to pause work automatically and resume later without manual intervention.
  • When working in environments where usage windows are strictly enforced.

Advantages

  • Prevents unexpected task termination due to budget exhaustion.
  • Provides a systematic way to handle resource-constrained environments.
  • Ensures continuity of work by preserving state across pause-resume cycles.
  • Reduces the risk of exceeding usage limits during high-intensity agent operations.

Usage examples

“Run the data migration task while staying within my 5-hour usage limit.”
The agent will execute the migration in throttled waves, checking usage between each wave and pausing if the 95% threshold is reached.
“Process these 50 documents in parallel but pause if we hit our weekly limit.”
The agent will manage the parallel processing, monitor the weekly budget, and schedule a resume if the limit is approached.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/builderio/stay-within-limits/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip stay-within-limits.zip -d .agents/skills

Documentation by Builder.io

Stay Within Limits

Keep long-running agent work inside the current 5-hour and weekly usage windows. Check usage before launching substantial work and between waves of parallel subagents. If an active 5-hour or weekly limit is at or above 95%, pause new work until the window is clear enough to continue safely.

Core Loop

  1. Run a bounded wave of work. Default to at most 3 parallel subagents unless the user or host gives a different throttle.

  2. Wait for the wave to finish. Do not interrupt in-flight subagents just to save budget; that usually loses work.

  3. Check current 5-hour and weekly usage with the host's usage/budget tool.

  4. If either window is at or above 95%, stop launching work and schedule a self-contained resume when the relevant window should clear.

  5. On resume, re-check the real window or block before continuing. Do not trust elapsed wall-clock time alone.

Usage Signals

Prefer a first-party host usage tool when available. In Claude Code, use:

npx -y ccusage@latest blocks --active --json

Use the JSON to identify the active block start, current cost or percentage, and time remaining. On wake, compare the active block start timestamp with the previous one; a new timestamp is stronger evidence than "enough time passed."

If the tool reports cost instead of a direct percentage, convert through the current account limit when known. For Claude Max-style 5-hour blocks, some users prefer an earlier caution threshold around $500-550; treat that as a user-configured guardrail, not a universal rule. The default stop rule is still 95% of the active 5-hour or weekly limit.

Pausing And Resuming

When a wake/resume tool is available, schedule a wakeup for:

min(3600, secondsUntilWindowClears)

If the runtime clamps wake delays to 60-3600 seconds, chain wakeups for longer waits. Each wakeup should re-check usage, reschedule if still over budget, and continue only when the window is safely below the threshold.

Make wake prompts self-contained. Include:

  • The remaining plan.

  • The check-then-reschedule rule.

  • The 95% threshold and wave throttle.

  • The exact usage command or host usage tool to run.

  • The previous block/window identifier when available.

  • The next verification steps.

  • The next wave's handoff packets, including scope, verification commands, and stop conditions, if delegation will resume.

Choosing The Wait Mechanism

  • Use a wake/resume tool when the agent needs instructions attached to the future resume.

  • Use a background sleep or watcher for fixed timers and things a process can observe directly.

  • Use cron or recurring schedules only for recurring fresh-session work.

Avoid short-interval polling for things the host will notify you about, such as background task or subagent completion. For budget pauses, a prompt-cache miss after a long sleep is acceptable; preserving the limit matters more.

Reporting

If you pause, tell the user which window is over threshold, the observed usage, when you scheduled or expect the next check, and what work remains. Keep enough state in the wake prompt that the next turn can resume without relying on conversation momentum.

Files

README.md

/stay-within-limits

Keep long-running agent work inside model and account usage windows.

/stay-within-limits gives coding agents a lightweight budget loop for broad, parallel, or multi-hour work. The agent checks current 5-hour and weekly usage, runs work in bounded waves, and pauses before it crosses the limit instead of burning through the last usable budget mid-task.

What It Does

  • Checks 5-hour and weekly usage before substantial work and between waves.

  • Uses waves of at most 3 parallel subagents by default.

  • Pauses new work when either window reaches 95% of its limit.

  • Resumes only after re-checking that the actual window or block is clear.

  • Makes wake prompts self-contained so work can continue after a long pause.

  • Carries the remaining plan, verification steps, and delegation stop conditions into the resume prompt.

  • Documents the Claude Code-compatible ccusage command while allowing host usage tools to take priority.

When To Use It

Use this for long-running coding sessions, PR babysitting, broad reviews, multi-wave refactors, large research tasks, or any task where parallel agents could exhaust the current 5-hour or weekly budget.

Skip it for small one-shot edits where checking budget would add more ceremony than value.

Claude Code Usage Check

When Claude Code does not expose a better first-party usage signal, use:

npx -y ccusage@latest blocks --active --json

The agent should read the active block start, current usage or cost, and time remaining. On wake, it should compare the block start timestamp with the previous check rather than trusting elapsed time alone.

Resume Pattern

For hosts with a wake/resume tool, the wake prompt should restate the remaining plan, the 95% pause threshold, the wave throttle, the exact usage check, and the rule to reschedule if the limit is still too high. If more delegated work remains, include the next wave's scope, verification commands, and stop conditions so the resumed agent does not depend on old chat momentum.

For waits longer than an hour, chain wakeups. For budget pauses, preserving the usage window matters more than keeping the prompt cache warm.

Install

npx @agent-native/skills@latest add --skill stay-within-limits --update-instructions

Use --update-instructions when you want the 5-hour and weekly limit convention added to AGENTS.md or CLAUDE.md automatically.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

What our scanner noticed· Low risk

  • Instructions that use the network

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Builder.io
Publisher
Builder.io (Official)
Source
BuilderIO/skills · skills/stay-within-limits · commit f4f10b8
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Builder.io.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download stay-within-limits.zip