Runs a task autonomously until a usage window (5-hour or 7-day) is nearly spent, checking consumption at each checkpoint and stopping at a configurable threshold to avoid rate limits.
Ships in caliper. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Run a task as a continuous autonomous work session, self-checking how much of the current usage window (5-hour by default) 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>] [--window 5h|7d] <task>
--queue — at the threshold, don't just stop: queue the remaining work to
auto-resume once the window resets (see "At the threshold" below).--at <pct> — override the threshold (e.g. --at 95). Default 99.--window 5h|7d — the window to guard (default 5h; 7d is the weekly cap).
Call it W and pass --window W to every check-usage and compute-fire call
this run; a 7d run that queued off the 5h reset would resume still capped../skills/usage-guard/scripts/check-usage.sh --window W <threshold>
(invoke directly — executable, no bash prefix) reads this session's
state.d/<session_id>.json under $CLAUDE_CONFIG_DIR/queue (else
~/.claude/queue), so another account's session can't skew it, kept fresh by
the queue skill's statusline wrapper. It prints WINDOW=, USED_PCT=,
VERDICT= (UNDER/OVER), SOURCE=, STATE_FILE=, CAPTURED_AGE_SEC=, STALE=
(yes/no), RESETS_AT_HUMAN=, RESETS_IN_MIN= and exits 0 = under,
10 = at/over, 1/2 = data unavailable.
resets_at (a stale render), and right after a window
reset (a fresh reset reads null until the first post-reset render lands — if it
then clears to a low number, treat that ~0% as the new window's start).SOURCE=own is the authoritative per-session read; fallback/legacy mean no
own file was found (run from a subagent, or a fresh session's first ~10s) and
the number could be another account's — treat non-own as soft near the ceiling.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.resets_at, or a fresh-reset null); relay and stop only if it repeats.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 --window W
(reset mode — fires ~90s after window W 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 (carry this run's --window/--at flags into the re-invocation):
Your queued usage-guarded work is due — the usage window has reset. First
cdto the working directory named below. Then resume by invoking/usage-guard --queue --window <W> [--at <pct>]on 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, this
run's --window/--at flags, and 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 a breadcrumb
whose path ./skills/usage-guard/scripts/guard-marker.sh pending prints. At
the start of any /usage-guard run, check for that file; if present, fold its
task/flags/env into this run and delete it so it isn't picked up twice. If
set warns about a stale hook copy, relay it. 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.What SKILL.md sets; muted values are Claude Code's defaults
19 skills in this plugin
/caliper-settingsUse when the user wants to view, change, or reset their persistent preferences, or when triggered by "/caliper-settings", "my settings", "change defaults"./codebase-reviewUse when asked to audit a codebase, find DRY/YAGNI/complexity issues repo-wide, or perform periodic code quality review/conversateUse when the user invokes /conversate, or asks to talk a change through with you — your recommendations, their decisions, open questions — before anything gets built./caliper:usage-guardfrom caliper
npx claudepluginhub nikhilsitaram/claude-caliper --plugin caliperOther plugins' skills for the same job