/claude-context:claude-contextfrom claude-context
Reports session resource facts: context-window occupancy, subscription usage, cost, and compaction count. Use to gate agent behavior on context or quota limits.
Ships in claude-context. 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.
This skill surfaces the current session's resource facts on demand, for both the user and agents (including subagents). It is an instrument, not an advisor: it reports measurements and where they came from, and nothing else. It makes no recommendations, attaches no evaluative or level labels, and prescribes no actions. What to do with the numbers is entirely the caller's decision.
When relaying this report, pass the measurements through as-is. Do not add
recommendations, urgency, thresholds, or "you should…" framing of your own — even
though the numbers may invite it. Report what the instrument measured and the
provenance fields (source, rate_limits_status, setup_required,
session_selection); let the caller decide what it means.
Run the report engine with Bash and read its output. Resolve the runtime the same way
setup/teardown do — prefer bun, fall back to node (the report is pure node: ESM and
runs under either) — rather than assuming node is on PATH, since setup wires bun-only hosts:
RT=$(command -v bun 2>/dev/null || command -v node 2>/dev/null)
"$RT" "${CLAUDE_PLUGIN_ROOT}/scripts/report.mjs" --session-id "${CLAUDE_SESSION_ID}"
Pass --session-id so the report reads this session's own snapshot rather than
a concurrent same-account session's. ${CLAUDE_SESSION_ID} is substituted by Claude
Code; if your build doesn't expose it, the report falls back to the
CLAUDE_CODE_SESSION_ID environment variable, then to the newest snapshot (see
session_selection below). It prints a human-readable block and a fenced json
block, and always succeeds even with no collector running.
used_tokens = input + cache-read +
cache-creation.used_percentage, resets_at (ISO), and resets_in_seconds. Present only for
Pro/Max accounts after the first API response; otherwise null.null when unavailable.collector (a fresh snapshot, or — while idle — the stale
snapshot's own context field), transcript (collector idle: context
recomputed from the transcript against the stale snapshot's real window
size), or unavailable (no snapshot has ever been written; compactions is
also null in this state, since it is unknown rather than zero).available; unavailable_plan (collector on, account
reports no subscription usage — either an API-key account or before the first
Pro/Max response); unavailable_provider (Bedrock/Vertex, which don't report
subscription usage); unavailable_stale (a snapshot exists but is past the
freshness window — collector on but idle); or unavailable_collector (no
snapshot has ever been written).true only when no collector snapshot has ever been
written (the not-set-up state): 5h/7d, cost, context, and compactions are all
null and the human block explains how to run /claude-context:setup. false
in every other state. Gate on this one field instead of inferring setup status
from source/rate_limits_status.session_id (matched this session's own id — the snapshot and its transcript are
definitively yours) or unverified-snapshot (this Claude Code build exposed no
session id, so the newest snapshot was used and may belong to another concurrent
same-account session). Omitted from the JSON in the not-set-up state, where there
are no numbers to attribute. Gate on this when it matters that the context figures
are your session's and not a neighbor's.{ id, display_name }. From the
collector, id carries the [1m] marker on a 1M-context session; from the
transcript fallback it is the base id (no marker) and display_name is empty.snapshot_age_seconds (the snapshot's age): use generated_at to tell how fresh
the report is, e.g. to ignore a cached copy.The context figures describe the session — the main agent's context window (the view Claude Code sends to the statusline). Subscription usage (5h/7d) and cost are account-wide, shared by the main agent and every subagent.
Because several Claude Code sessions can run under one account at once, the collector
keys its snapshot by session id and the report reads the one matching your session
(session_selection: "session_id"). If your Claude Code build exposes no session id,
the report falls back to the newest snapshot and flags it unverified-snapshot — in
that state the context/compaction figures may be a neighbouring session's, while the
account-wide 5h/7d/cost figures are identical across sessions and stay correct.
If you are a subagent, the context percentage is the session's, not your own private window. Use it to judge whether the parent session is filling up — for example, to checkpoint results to a file before it auto-compacts — not as a gauge of your own subagent context, which this report does not measure.
The report resolves to exactly three states, keyed on whether a collector snapshot has ever been written:
source: "collector", rate_limits_status: "available" (or
one of the unavailable_plan / unavailable_provider variants when the account
doesn't report subscription usage).source: "transcript"), or, when the transcript has
no usage to read, reported straight from the stale snapshot's own context field
(source: "collector"). Either way rate_limits_status: "unavailable_stale" and
5h/7d/cost are null — the collector is on, just not fresh, so it is never
mistaken for "collector not installed."null (including compactions, which is
unknown rather than zero), source: "unavailable",
rate_limits_status: "unavailable_collector", and setup_required: true; the
human block explains how to run /claude-context:setup.Use the source, rate_limits_status, setup_required, and session_selection
fields to judge how much to trust each number.
LICENSE (opens in a new tab)commands/setup.md (opens in a new tab)commands/teardown.md (opens in a new tab)scripts/coexist.mjs (opens in a new tab)scripts/collect.mjs (opens in a new tab)scripts/lib/atomic-write.mjs (opens in a new tab)scripts/lib/command.mjs (opens in a new tab)scripts/lib/config-dir.mjs (opens in a new tab)scripts/lib/marker.mjs (opens in a new tab)scripts/lib/redact.mjs (opens in a new tab)scripts/lib/snapshot.mjs (opens in a new tab)scripts/lib/stdin.mjs (opens in a new tab)scripts/lib/time.mjs (opens in a new tab)scripts/lib/token-math.mjs (opens in a new tab)scripts/lib/transcript.mjs (opens in a new tab)scripts/report.mjs (opens in a new tab)scripts/wiring.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ovid/claude-context --plugin claude-contextOther plugins' skills for the same job