オプション

stay-within-limits

BuilderIO/skills BuilderIO/skills

長期実行されるエージェントの作業を、5時間および週間の使用制限内に収めるために、ラウンド間で使用状況を確認し、上限に近づいた場合に一時停止し、ウィンドウが空いてから再開してください。

...すべて拡張します
0
更新された時間 2026年9月6日

制限内に収める

長時間実行されるエージェントの作業を、現在の5時間および週間の使用ウィンドウ内に保持する。大規模な作業を開始する前、および並列サブエージェントの波の間で、使用状況を確認する。アクティブな5時間または週間の制限が95%以上の場合、ウィンドウが安全に継続できるまで十分な余裕ができるまで、新しい作業の開始を一時停止する。

コアループ

  1. 制限付きの作業波を実行する。ユーザーやホストが異なるスロットルを指定しない限り、並列サブエージェントは最大3つをデフォルトとする。
  2. 波が完了するまで待機する。予算を節約するために実行中のサブエージェントを中断しないでください。そうすると、通常は作業が失われる。
  3. ホストの使用状況/予算ツールを使用して、現在の5時間および週間の使用状況を確認する。
  4. いずれかのウィンドウが95%以上の場合、作業の開始を停止し、関連するウィンドウがクリアされるべき時期に、自己完結型の再開をスケジュールする。
  5. 再開時には、継続する前に実際のウィンドウまたはブロックを再確認する。経過した実時間だけを信頼しないでください。

使用状況の信号

利用可能な場合は、公式のホスト使用状況ツールを優先する。Claude Codeでは、以下を使用する:

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

JSONを使用して、アクティブなブロックの開始時刻、現在のコストまたはパーセンテージ、残り時間を特定する。ウェイク時に、アクティブなブロックの開始タイムスタンプを前のものと比較する。新しいタイムスタンプは、「十分な時間が経過した」よりも強力な証拠となる。

ツールが直接のパーセンテージではなくコストを報告する場合、現在のアカウント制限が既知の場合はそれを通じて変換する。Claude Maxスタイルの5時間ブロックの場合、一部のユーザーは約500〜550ドルの早期注意閾値を好む。これをユーザー設定のガードレールとして扱い、普遍的なルールではない。デフォルトの停止ルールは、アクティブな5時間または週間の制限の95%である。

一時停止と再開

ウェイク/再開ツールが利用可能な場合、以下の時刻にウェイクアップをスケジュールする:

min(3600, secondsUntilWindowClears)

ランタイムがウェイク遅延を60〜3600秒に制限する場合、より長い待機のためにウェイクアップをチェーンする。各ウェイクアップは使用状況を再確認し、まだ予算超過の場合は再スケジュールし、ウィンドウが閾値 safely below になった場合にのみ継続する。

ウェイクプロンプトを自己完結型にする。以下を含める:

  • 残りの計画。
  • 確認後再スケジュールルール。
  • 95%の閾値と波のスロットル。
  • 実行する正確な使用状況コマンドまたはホスト使用状況ツール。
  • 利用可能な場合の前のブロック/ウィンドウ識別子。
  • 次の検証ステップ。
  • 委譲が再開される場合、スコープ、検証コマンド、停止条件を含む次の波のハンドオフパケット。

待機メカニズムの選択

  • エージェントが将来の再開に付随する指示を必要とする場合、ウェイク/再開ツールを使用する。
  • 固定タイマーやプロセスが直接観察できるものには、バックグラウンドスリープまたはウォッチャーを使用する。
  • 定期的な新規セッションの作業には、cronまたは定期的なスケジュールのみを使用する。

バックグラウンドタスクやサブエージェントの完了など、ホストから通知される事項については、短間隔のポーリングを避ける。予算による一時停止の場合、長時間スリープ後のプロンプトキャッシュミスは許容される。制限を保持することがより重要である。

レポート

一時停止する場合、どのウィンドウが閾値を超えているか、観測された使用状況、次のチェックをスケジュールした時刻または予想時刻、および残りの作業をユーザーに伝える。次のターンが会話の勢いに依存せずに再開できるように、ウェイクプロンプトに十分な状態を含める。

GitHubで見る
---
name: stay-within-limits
description: Keep long-running agent work within 5-hour and weekly usage limits by checking usage between waves, pausing near the cap, and resuming only when the window is clear.
---

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

```sh
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:

```txt
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.

すべてのファイル

0件のファイル

stay-within-limitsをインストール

スキルファイルをダウンロードして .claude/skills/ ディレクトリに展開してください。

ZIPをダウンロード

リポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。

git clone https://github.com/BuilderIO/skills/tree/main/skills/stay-within-limits # Copy SKILL.md to your .claude/skills/ directory

コピー コピー
クイックセットアップ: スキルフォルダを .claude/skills/ にコピーしてください。Claude はそのスキルを自動的に検出し、使用します。
リポジトリ BuilderIO/skills

関連スキル

seo-programmatic
更新された時間 2026年6月29日
notion-automation
更新された時間 2026年6月29日
airtable-automation
更新された時間 2026年6月29日
fairdb-backup-manager
更新された時間 2026年6月29日
OR