claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] VSCode Extension: Display context usage percentage in UI

Open slinktaylor opened this issue 10 months ago • 27 comments

Feature Request

Problem

The CLI version of Claude Code supports custom status lines that can display context usage percentage, but the VSCode extension has no visibility into context consumption. Users must manually run /context to check usage.

This matters because Claude's response quality can degrade as context fills up (commonly cited around 40%). Without visibility, users don't know when to run /compact to maintain optimal performance.

Proposed Solution

Add a persistent context usage indicator to the VSCode extension UI, showing:

  • Current context usage percentage (e.g., "Context: 30%")
  • Visual warning states:
    • 🟢 Green: < 35%
    • 🟡 Yellow: 35-45% (suggest /compact)
    • 🔴 Red: > 45% (strongly recommend /compact)

Bonus Features (nice to have)

  • Configurable threshold warnings
  • Optional notification/toast when crossing thresholds
  • Auto-suggest /compact when hitting warning threshold

Context

  • The CLI statusLine feature doesn't work in VSCode extension
  • Tool Search (v2.1.7) helps reduce MCP tool overhead, but conversation context still grows
  • Power users track the "40% rule" manually - this should be built-in

Environment

  • Claude Code: 2.1.7
  • VSCode Extension
  • macOS

slinktaylor avatar Jan 16 '26 01:01 slinktaylor

we really need this

Achour avatar Mar 05 '26 22:03 Achour

I swear I thought it was always on, but turns out it's not? How hard is it to just always make it visible? It's pretty useful.

elliejayliquid avatar Mar 13 '26 02:03 elliejayliquid

Adding my use case. I run the VS Code extension via Remote-SSH on Linux (WSL2), so this isn't macOS-specific.

The extension previously showed a context percentage that updated as the conversation progressed. That indicator has disappeared in recent versions. The CLI statusLine setting works in the terminal but doesn't surface in the VS Code chat panel, so there's currently no passive way to monitor context usage from the extension.

Without it I end up either running /context manually every few messages or just guessing when to start a new conversation. A persistent indicator (status bar, inline, wherever) would remove that guesswork. Even a basic percentage without the colour thresholds would be a meaningful improvement.

maarteek avatar Mar 19 '26 12:03 maarteek

This feels like much more of an issue than an enhancement: Knowing the percentage of context is crucial to avoiding context rot, a core limitation of Claude (or any LLM for that matter). I relied heavily on knowing this information for determining my own expectations in a given session and when to start a fresh session. I hope to see this bumped.

callumhay avatar Mar 21 '26 16:03 callumhay

As far as I remember this was always visible, but now today it is gone? Why would you ever remove this extremely useful feature?

bjfar avatar Mar 25 '26 04:03 bjfar

This seems visible until context used up to 50%+ in orange/red. I never see the pie chart before 50%.

ns-lwu avatar Mar 25 '26 04:03 ns-lwu

I'm wondering whether this has something to do with the new 1M context window that was recently introduced. If the context only shows up at 50%... that would now be 500k tokens, which is A BIG context window (relative to the previous one). I actually find that going above 20-30% in the new 1M context window is not great for my kind of work... maybe there should be a reconsideration of when and how this information is presented now that the context window is so large and results in non-linear and earlier degradation in Claude's performance?

EDIT: If you find yourself here with a now broken workflow due to context rot from the 1M token window, quick solve is to update your claude settings.json with the following: "env": { "CLAUDE_CODE_DISABLE_1M_CONTEXT": "1" },

callumhay avatar Mar 25 '26 13:03 callumhay

Ever since 1M tokens became the default I have not seen the context usage indicator anymore. I tried setting CLAUDE_AUTOCOMPACT_PCT_OVERRIDE to a 5% thinking maybe it would re-appear at 50% of that amount, but this just makes it auto-compact without warning. There really should be a separate setting that controls when the indicator shows, because 50% is way too much for a 1M token context.

S-Luiten avatar Apr 02 '26 12:04 S-Luiten

I built this extension a few months back that handles this issue:

https://github.com/makingaipractical/claude-code-fuel-gauge

It puts a live percentage in your VS Code status bar from 0%, color-coded green → yellow → red.
Works with both 200k and 1M context windows and works across multiple simultaneous sessions. I actively update it when things change (and will continue until it's not needed anymore) :)

You can find it in the VS Code Marketplace as well.

I've seen a lot of people are looking for something like this, so I decided to post this here. Hope it helps.

makingaipractical avatar Apr 14 '26 00:04 makingaipractical

How is this still not fixed / addressed? @claude we need a way to see our context window in real time, please. Right now we can only see our context window stats by manually typing /context or reverting back to CLI and not using the very cool VSCode Extension.

thatchaisurface avatar May 23 '26 06:05 thatchaisurface

Just another user chiming in to say I'd love to have this feature implemented :)

randomcat7815 avatar Jun 25 '26 13:06 randomcat7815

+1 — this would significantly improve day-to-day work in the VS Code extension.

As a developer working with large domain-specific source files, I regularly run into situations where the context window fills up faster than expected. Right now the only way to check usage in the extension is to manually run /context or /usage, which interrupts the flow — and by the time you think of checking, it's often because something already went wrong (auto-compact kicked in, or responses degraded).

A few points in favor of prioritizing this:

  1. The CLI already has this via statusLine — the extension is the only surface where context usage is invisible. The data is clearly available internally (the extension knows when to trigger auto-compact), it just isn't surfaced to the user.

  2. This is one of the most frequently requested features for the extension. A quick search shows at least a dozen closed duplicates of this exact request (#66021, #57721, #58159, #52468, #44849, #20207, #52156, #33819, #44469, #16526, #38791...), plus reports like #37575 and #39503 suggesting an indicator existed in the native UI before ~v2.1.81 and was removed. The demand is clearly persistent.

  3. Context awareness changes user behavior for the better. When I can see usage approaching a threshold, I can proactively /compact, start a fresh session at a natural boundary, or trim what I attach — instead of losing work quality mid-task without warning.

Even a minimal version — a small percentage badge in the input bar area (where the indicator seems to appear only at high usage today) that is always visible — would cover the core need. A tooltip with the token breakdown on hover would be a bonus, not a requirement.

Thanks for considering this!

mcltestowy-creator avatar Jul 10 '26 08:07 mcltestowy-creator

I built an open-source VSCode extension that shows exactly this, in case it's useful while there's no native indicator — disclosure: I'm the author.

Claude Todos adds a sidebar panel with a persistent context usage indicator: a "{pct}% ctx" badge plus a thin bar with traffic-light warning states (green < 60%, yellow 60–85%, red ≥ 85%). It's computed from the transcripts Claude Code already writes to ~/.claude/projects (input + cache tokens of the latest message, with the 200k/1M window detected per model), so it updates live no matter where claude runs — integrated terminal, external terminal, another window — as long as the session's cwd matches the open workspace. The same panel also shows per-model token usage, cache efficiency, and the live TodoWrite/sub-agent task list.

It's a sidebar panel rather than the inline statusline this issue asks for, but it gives you the always-visible percentage today. Fully local (no telemetry, read-only), MIT. Repo: https://github.com/carlosdealmeida/claude-todos-vscode

carlosdealmeida avatar Jul 17 '26 16:07 carlosdealmeida

Just another message of support for this feature request, would be great to have official support rather than having to use 3rd party plugins (which I would rather not).

josh-keating avatar Jul 20 '26 03:07 josh-keating

Chiming in to voice my support for this feature request

Furkan-rgb avatar Jul 24 '26 20:07 Furkan-rgb

I can't believe this is actually open after 7 months. I can only conjecture that the devs don't even use code editors like VSCode anymore.

mortang2410 avatar Aug 11 '26 15:08 mortang2410

This omission feels intentional and disrespectful at this point... do better Anthropic.

joshhubert-dsp avatar Aug 15 '26 12:08 joshhubert-dsp

The VS Code extension now has a built-in context indicator: the prompt box shows how much of Claude's context window is in use, and Claude auto-compacts when needed (or run /compact yourself). Threshold coloring/notifications aren't there yet, but the core visibility ask is covered.

Shipped in a recent release — changelog: https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md Docs: https://code.claude.com/docs/en/vs-code

🤖 Generated with Claude Code

bcherny avatar Aug 17 '26 03:08 bcherny

With 1M context tokens the indicator only shows up when you're already at 500k tokens, that's way too late. This should be lowered to 35~45% as initially proposed, and/or allow users to configure this value.

S-Luiten avatar Aug 17 '26 08:08 S-Luiten

I think it would be helpful to be able to hover over it and see both day and week usage at any time, like how you can hover over the copilot icon at any time to see usage, it saves having to go into a submenu to see the current usage.

WilliamABradley avatar Aug 17 '26 09:08 WilliamABradley