Skip to content

claude-context-badge Explained: Track and Hand Off claude.ai Context Accurately

AINewss Editorial

A Claude context badge is a small indicator that shows how much of a conversation's context window is already consumed. This guide explains what the badge measures, why exact tokenizer counts beat estimates, how the 80% handoff threshold works, what paid-plan context windows allow, and which accuracy caveats still apply.

View 1 reference
0 views 0 likes

Allow the functional cookie to save your likes. Privacy details

A browser window showing claude.ai with a compact context-meter badge in the header and an expanded token breakdown panel.

A claude-context-badge is a compact readout that sits inside claude.ai and tells you how full the conversation's context window is. The open-source Claude Context Meter places it at the top-center of the app header by default and expands into a breakdown panel on click. This article uses that project as the concrete reference, because its README documents the counting method and its known limits in detail. Source

What Is a Claude Context Badge (claude-context-badge)?

A Claude context badge is a small overlay on claude.ai that shows how full the current conversation's context window is. The Claude Context Meter renders model, effort, and token usage in one compact line, expands into a per-layer breakdown on click, and applies its styling only inside its own shadow DOM. Source

The badge is a Manifest V3 browser extension modeled on Claude Code's /context readout. It is not a change to claude.ai itself. Its value is timing: it makes context pressure visible before the model starts losing earlier turns, instead of after a compaction event has already happened.

How Does a Claude Context Badge Count Tokens?

Modern versions count tokens with a JavaScript port of Claude's own tokenizer, verified document-for-document against Anthropic's count_tokens values on 5,278 reference documents with exact matches. Earlier releases used OpenAI's o200k_base tokenizer scaled by a guessed multiplier and under-counted by roughly 10–33%, which made the badge read several times too full on some models. Source

When the streaming response exposes usage.input_tokens, the total is labeled measured; otherwise it is an estimated tokenization of the conversation payload. Keeping those two labels distinct matters: an estimated badge is a hint, while a measured one reflects the API's own accounting.

What Do Claude.ai Context Windows Actually Allow?

Context limits depend on the model and on where you talk to it. The project's table lists chat windows on paid plans; the same model can have a different limit in Claude Code or Cowork. Fable 5 and Mythos 5 are documented for Code and Cowork but not for chat, so the badge shows "window unconfirmed" rather than guessing. Source

Model family Claude.ai chat window
Opus 5, Sonnet 5 1,000,000 tokens
Opus 4.8, 4.7, 4.6, Sonnet 4.6 500,000 tokens
Everything else, including Haiku 4.5 200,000 tokens

Why Does the 80% Handoff Threshold Matter?

claude.ai silently auto-compacts the earliest turns at roughly 85% of the window, so a useful handoff must be written while the model can still see the uncompacted conversation. The badge offers to generate one at 80%, leaving about 25,000 tokens of headroom at a 500,000-token window for the request and reply. Source

The default is confirm-first: you click Generate handoff, then copy the model's reply into a fresh conversation. Automatic sending is an opt-in toggle because it drives the composer through the DOM and can misfire if claude.ai changes its interface. Files cannot travel between conversations, so the generated prompt lists tracked attachment and artifact names to remind you what to re-attach.

What Does the Drill-Down Panel Show?

Clicking the badge opens a breakdown by layer: system prompt, available tools, messages, attachments, files and artifacts, and free space. The project's own example shows 28.0k for the system prompt, 10.7k for tools, 103.0k for messages, 2.1k for attachments, 5.8k for files and artifacts, and 357.8k free. Source

A refresh control re-runs the tree fetch and re-tokenizes the full conversation on demand. Project Knowledge is displayed as a separate unmeasured line because it is retrieved through RAG: only retrieved chunks enter context and they are not visible in the payload.

What Accuracy Caveats Apply to a Context Badge?

A trustworthy badge should label partial counts rather than present them as authoritative. This one shows ~142k for partial tallies, keeps a per-conversation cache tagged "cached" while a fresh fetch runs, and counts the full message tree from the conversation payload instead of the rendered DOM. Source

That payload approach captures turns that are scrolled out, virtualized, collapsed, or inside closed artifact panels—content the DOM scan in older versions missed. Attachments are counted from extracted content rather than a bytes-divided-by-four guess, and artifact bodies come from the message tree so closed panels no longer read as zero. Each item is counted once to avoid double counting.

Claude Context Badge FAQ

Does the badge modify claude.ai?

No. It injects a badge into the header and applies its own theme only within its shadow DOM, so the host interface keeps its normal styling. It remains a browser extension, not a change to the site's behavior.

Is the same badge available for Claude Code?

Not from this project. Claude Code exposes its own /context readout, and separate third-party tools add terminal HUDs or token counters. The Claude Context Meter described here is specifically for the claude.ai web app.

Why did my older badge read roughly three times too full?

Version 0.7 had no multiplier entry for Opus 5 and fell through to a default of 1.0, while also metering a 1M window as 200k. The combination overstated usage; version 0.8 replaced the approximation with exact tokenization and corrected the window table.

Can a handoff carry my files into the new chat?

No. Files and artifacts cannot be transferred across conversations. The handoff prompt lists their names so you know what to re-attach manually before continuing the work.

Limitations and Bottom Line

A Claude context badge is most useful on long-running conversations where compaction would otherwise be a surprise. It is still an estimate when the API does not expose ground-truth usage, and Project Knowledge remains unmeasured by design. Treat the number as an early-warning gauge and verify important work against the source material before a handoff.

References

  1. Claude Context Meter - Live context-window meter for claude.aigithub.com