claude-context
⚠️ Alpha software. Early and actively changing: expect breaking changes between
versions and rough edges. macOS, Linux, and Windows + Git Bash only (POSIX shells) —
native PowerShell/cmd is unsupported this release. Everything setup touches is reversible
with /claude-context:teardown.
Your agents can't manage a budget they can't see. claude-context gives Claude
Code and its subagents a live, machine-readable read of their own context window,
subscription usage, and cost — so they can follow your rules about when to stop,
checkpoint, or hand off.
On demand, any agent in your session can ask "how much have we used?" and get back
context-window occupancy, 5-hour and 7-day usage, session cost, and compaction count
— as plain numbers it can branch on. You write the rule; the agent reads the gauge.
Why this matters: the silent auto-compaction trap
When a session fills up, Claude Code auto-compacts — it summarizes the
conversation to make room. Helpful, until it quietly drops the very instructions you
were relying on. This isn't hypothetical; it's a recurring, documented failure:
An agent working blind hits that wall at full speed. An agent that can watch its
own context percentage doesn't. Give it a rule —
"Before context passes 50%, write the current plan and key decisions to
PROGRESS.md, then stop for review."
"Don't start a new subtask above 40% context."
— and it acts before the compaction it otherwise never sees coming, so your
guidance survives.
The same goes for your budget
Subscription limits are just as invisible to an agent mid-task. With claude-context
it can honor guardrails you set:
"If we're about to cross 80% of the weekly limit, summarize progress and pause."
"Don't fan out three subagents when the 5-hour window is nearly spent."
Your agents can only make those calls if they can read the numbers.
Instrument, not advisor — on purpose
claude-context gives no advice and no recommendations of its own — no baked-in
thresholds, no "you should compact," no traffic lights. That's not a missing feature;
it's the whole design. The plugin supplies the facts; your instructions supply
the policy. The 40% rule, the budget guardrail, the checkpoint trigger — those live
in your CLAUDE.md, your skills, and your subagent prompts, where you control them. A
tool that hard-coded its own thresholds would just fight the ones you wrote.
Doesn't /context already show this?
At your keyboard, largely yes — and in more detail. Claude Code's built-in /context breaks
context usage down by category (system prompt, tools, MCP, skills, messages) more thoroughly
than this plugin's single context line. If a human reading the terminal is all you need,
reach for /context.
But /context is a command you type: it runs inside Claude Code and prints to your
screen. There is no tool, script, or CLI entry point an agent can call to produce it — a
subagent mid-task can't run /context and read the result, it would have to ask you to type
it and wait. /context also can't show 5h/7d usage, cost, or compaction count at all,
because those reach only the statusline (see below), never
the transcript /context reads from.
claude-context is for the other side of that line. Its report is backed by a plain script
an agent runs and parses as JSON — the programmatic entry point /context lacks — and it
carries the usage, cost, and compaction numbers /context can't see. /context is for
you; claude-context is for your agents.
Install
Add marketplace:
/plugin marketplace add Ovid/claude-context
Install (must be a separate prompt):
/plugin install claude-context@claude-context
Set up:
/claude-context:setup
Then any agent — or you — can ask:
/claude-context:claude-context
Or:
/claude-context
Reporting requires the one-time /claude-context:setup (see below). Before that's
been run, the report itself explains how to enable it rather than guessing at
numbers it doesn't have. Once set up, it returns a short human summary and a
machine-readable JSON block, so an agent can parse its own resource state directly:
Claude Context — Opus 4.8 (1M context)
Context: 25% used · 245k / 1M tokens · 755k headroom
Session (5h): 9% used · resets in 2h 16m (at 14:30)
Weekly (7d): 2% used · resets in 6d 21h
Cost: $24.94 · Compactions: 0
Source: collector · snapshot 3s old
How your rules read the numbers