Runs tasks autonomously until the 5-hour usage window is nearly spent, stopping at a configurable threshold to avoid rate limits. Supports weekly cap with --window 7d and optional queueing for next block.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-caliper-tooling:usage-guardThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Run a task as a continuous autonomous work session, self-checking how much of
Run a task as a continuous autonomous work session, self-checking how much of the current 5-hour usage window has been consumed, and stop cleanly at a threshold (default 99%) — leaving 1% headroom so the stop/report (or queue) actions don't trip a real rate limit mid-action.
/usage-guard [--queue] [--at <pct>] <task>
--queue — at the threshold, don't just stop: queue the remaining work to
auto-resume in the next 5-hour block (see "At the threshold" below).--at <pct> — override the threshold (e.g. --at 95). Default 99../skills/usage-guard/scripts/check-usage.sh [--window 5h|7d] [threshold]
(invoke directly — executable, no bash prefix) reads ~/.claude/queue/state.json,
kept fresh by the queue skill's statusline wrapper. It prints WINDOW=, USED_PCT=,
VERDICT= (UNDER/OVER), CAPTURED_AGE_SEC=, STALE= (yes/no), RESETS_AT_HUMAN=,
RESETS_IN_MIN= and exits 0 = under, 10 = at/over, 1/2 = data unavailable.
--window selects the rolling window (default 5h). Pass --window 7d to guard
the weekly cap instead — e.g. "stop when I'm near my 7-day limit". The work
loop is otherwise identical; just thread the same --window value through every
check this run so cadence and the threshold branch track one window.resets_at stderr is a transient cross-session
glitch (a stale blob from another session, overwritten within ~10s). Re-run once
after ~5s before stopping; only stop if it repeats.STALE=yes (the same >90s cutoff compute-fire.sh uses) means the statusline
hasn't rendered recently — terminal idle/unfocused — so USED_PCT lags reality.
Note it; the number may be behind.--queue mode, also write the rate-limit backstop marker once now (see
"Rate-limit backstop"), and — at the very start of any run — check for a
leftover breadcrumb from a previously interrupted run.USED_PCT, check
after every step.STALE=yes near the ceiling, the reading lags reality — treat
USED_PCT as a floor and stop early rather than trusting a sub-threshold
number.Work continuously without pausing to ask between chunks — that's the point of the guard. Only stop for the threshold, task completion, a hard error, or a genuine decision that's the user's to make.
First, make the ledger accurate (mark what's done; the open items are what remains). Then:
Default (no --queue): stop now and report:
USED_PCT reached and that the window resets at RESETS_AT_HUMAN,With --queue: queue the remainder to resume in the next block.
./skills/queue/scripts/compute-fire.sh
(reset mode — fires ~90s after the window resets). Relay stderr and stop if
it errors; if it prints STALE=yes, refresh the statusline first.CronCreate with: cron = its CRON value, recurring: false,
durable: true (a multi-block chain almost always outlives this terminal,
so persist it — unlike a plain /queue, which defaults session-only), and
prompt:
Your queued usage-guarded work is due — the 5-hour window has reset. First
cdto the working directory named below. Then resume by invoking/usage-guard --queueon the following remaining work, so it keeps guarding usage and re-queues anything still open at the next threshold:
./skills/usage-guard/scripts/guard-marker.sh clearFIRE_HUMAN (job ID), and
the caveats below. Because the continuation re-invokes /usage-guard --queue,
a task bigger than one block chains block-to-block until the open list is
empty (the termination guard above is what ends it).(Default-mode stop also clears the marker — there's no queued continuation to protect.)
--queue, opt-in hook)usage-guard's job is to stop before the limit; this is just a light safety net
for the overshoot case (one oversized action trips a real rate limit before the
next check). An opt-in StopFailure hook (matcher rate_limit) records — it does
NOT auto-resume — so an interrupted --queue run isn't silently lost.
--queue run start, write the marker once with the original task + the
environment needed to resume (working dir, branch/worktree, key paths/IDs):
printf '%s' "<task + env>" | ./skills/usage-guard/scripts/guard-marker.sh setguard-marker.sh clear.If a rate limit hits while the marker is live, the hook copies it to
~/.claude/queue/pending-resume.json (a breadcrumb). At the start of any
/usage-guard run, check for that file; if present, fold its task/env into this
run and delete it so it isn't picked up twice. The hook is opt-in (a plugin
can't edit settings.json) — wiring + caveats in the README.
--queue chains are durable: true — they persist to disk and survive a
restart (a 5h+ chain won't keep one terminal open). But a durable job still
only fires while some Claude session is running and idle — if nothing is
running at reset time it fires late, when you next open Claude. It is not a
headless/background runner. CronList / CronDelete <id> to inspect or cancel.npx claudepluginhub nikhilsitaram/claude-caliper --plugin claude-caliper-workflowManages 5-hour and weekly usage limits during long-running or parallel agent work by checking usage between waves, pausing near the cap, and resuming when clear.
Governs API budget caps, reset rules, and commit-identity gate for Claude Code. Activates when starting autonomous work, spawning subagents, near a limit, or before a commit.
Schedules commands to run later in the same Claude session — by default after the 5-hour usage window resets, or at a specified time/duration. Useful for deferring work onto fresh quota or specific deadlines.