Skip to content

feat: showCost toggle + context-window fill indicator in the status bar - #31

Merged
Carl723000 merged 3 commits into
ClaudeCodeUsage:mainfrom
ScherbakovAl:feat/status-bar-cost-toggle-context-indicator
Jun 15, 2026
Merged

Carl723000 merged 3 commits into
ClaudeCodeUsage:mainfrom
ScherbakovAl:feat/status-bar-cost-toggle-context-indicator

Conversation

@ScherbakovAl

Copy link
Copy Markdown
Contributor

Two new settings:

  • claudeCodeUsage.showCost (default true) — hide the status-bar cost item for users who only want the quota / context indicators; the dashboard still shows all cost figures.
  • claudeCodeUsage.showContext (default true) — a new status-bar item showing the current session's context-window fill as a percentage, like Claude Code's /context. Estimated from the session's latest log record (input + cache read + cache write tokens) against the model's window size (200K, or 1M for "[1m]" long-context variants). Amber at 80%, red at 95% (same thresholds as the quota item); hidden after 5h of inactivity (same recency rule as the current-session figure), with the recency check re-run on idle ticks so a stale percentage never lingers.

Also syncs package-lock.json's version field with package.json (2.0.2).

Summary

Linked issues

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (existing behaviour differs afterwards)
  • Documentation / CI / chore

How was this tested?

Checklist

  • npm run compile is clean
  • User-facing strings go through I18n with all six languages filled
  • CHANGELOG.md updated (user-visible changes)
  • README.md updated if behaviour/settings changed
  • New settings default to existing behaviour (opt-in)
  • No new runtime dependencies

ScherbakovAl and others added 3 commits June 12, 2026 23:20
Two new settings:

- claudeCodeUsage.showCost (default true) — hide the status-bar cost item
  for users who only want the quota / context indicators; the dashboard
  still shows all cost figures.
- claudeCodeUsage.showContext (default true) — a new status-bar item
  showing the current session's context-window fill as a percentage,
  like Claude Code's /context. Estimated from the session's latest log
  record (input + cache read + cache write tokens) against the model's
  window size (200K, or 1M for "[1m]" long-context variants). Amber at
  80%, red at 95% (same thresholds as the quota item); hidden after 5h
  of inactivity (same recency rule as the current-session figure), with
  the recency check re-run on idle ticks so a stale percentage never
  lingers.

Also syncs package-lock.json's version field with package.json (2.0.2).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- README (all 6 languages): document that the quota / cost / context
  status-bar items can each be hidden (usageLimitTracking / showCost /
  showContext = false).
- context tooltip: add a concise cost-awareness reminder (/compact, /clear),
  localised in all 6 languages, above the existing estimation note.
@Carl723000 Carl723000 added the feature Minor bump — new feature label Jun 15, 2026
@Carl723000
Carl723000 merged commit beed1c8 into ClaudeCodeUsage:main Jun 15, 2026
2 checks passed
Carl723000 added a commit that referenced this pull request Jun 26, 2026
Adds a relay-execution plan (for Opus 4.8 + workflow) to the V2.1 spec
after the implemented Phases 0-5, plus the on-disk log probe findings so
the next session doesn't re-derive them:

- effort/ultracode is NOT recorded in logs; the wf_ dir is the only real
  "dynamic-workflow engaged" signal
- attributionSkill / attributionPlugin are first-class fields on usage
  lines (authoritative, replaces the <command-name> heuristic)
- why native-Claude runs "look missing" from Workflows: Opus/Fable
  orchestration stays in the main session; only cheap haiku sub-agents
  (or none) write agent files

Continuation phases: 6 integrate onto current main (incl. PR #31 context
indicator) - 7 authoritative attribution + workflow-mode honesty +
main-session orchestration cost - 8 real-total calibration (daily/weekly)
- 9 advice UX + Prompt Optimizer (the headline feature) - 10 README
showcase - 11 node:test coverage.

Also gitignore docs/claude-advice-*.md (local reports, never committed).
Carl723000 added a commit that referenced this pull request Jun 26, 2026
Catches the v2.1 workflow-attribution branch up to current main (~25 commits:
v2.0.3 work, PR-attribution merges, node:test framework, CI, macOS-keychain
credentials, PR #31 status-bar context-window indicator).

Conflict resolutions:
- src/claudeApiClient.ts: keep feature's httpClient-based transport AND main's
  macOS-keychain credential read; import only execFileSync (curl/fetch now
  live in httpClient.ts, so spawn is no longer needed here).
- src/dataLoader.ts: take feature's v2.1 version wholesale, then port main's
  two new context methods (getCurrentContextInfo, contextWindowFor) + the
  ContextWindowInfo import on top.
- CHANGELOG.md: fold main's [Unreleased] items (context indicator, showCost)
  into the [2.1.0] block.

Verified: clean compile; node:test green (2/2); merged loader still yields
13 workflow runs, the attribution panel, thinking share, AND the new
context-window info. version stays 2.1.0.
Carl723000 added a commit that referenced this pull request Jun 26, 2026
Subscription backend dropped (this version): a re-test confirms Anthropic 403s
"Request not allowed" for calling /v1/messages with the Claude Code OAuth token
(it only succeeds by routing around the TLS-fingerprint gate via curl) — too
fragile/inappropriate for a public extension. Advice + Optimizer are API-only;
backend hardcoded to 'api'; advice.backend / advice.subscriptionModel settings
removed. The subscription transport stays in advisor.ts, dormant, to re-enable
if direct calls become permitted.

Context-window indicator:
- Honesty: contextWindowFor() now returns { tokens, estimated }; unrecognised /
  proxied models flag estimated=true and the % shows a "~" prefix instead of a
  confident figure. New setting contextWindowOverride (0=auto) lets users on
  custom/proxied models pin their real window — fixes the #31-class wrong %.
- Correctness: getCurrentContextInfo() now prefers main-thread records (excludes
  _agentId/_workflowId) so a running sub-agent/workflow no longer hijacks the
  "current context" with its own window.
- Startup visibility: staleness guard widened 5h→24h so opening a window in the
  morning still shows the last session's context instead of blanking it.
- Default OFF + flagged experimental in Settings (the tooltip can only show the
  input-side total, not /context's category breakdown, which are CC internals
  not on disk — so it's approximate by nature; opt in if useful).
- Tooltip decluttered: dropped the verbose estimate/compaction notes (the
  explanation moved to the setting help), added a quota-style progress bar, and
  renamed the misleading "Free space"/"剩余空间" to "Context left"/"上下文余量".

Header: removed the apple-style auto-refresh toggle (auto-refresh is managed in
the ⚙ Settings tab now); the manual ↻ refresh button still appears top-right
when auto-refresh is paused. Two shortcut buttons remain — ✨ AI advice (jumps to
the Content tab) and ⚙ Settings (jumps to the Settings tab). The gear icon now
lives on the header button; the tab label drops it (cleaner, conventional).

Compile clean; 11/11 node:test green.

Co-Authored-By: Claude <noreply@anthropic.com>
Carl723000 added a commit that referenced this pull request Jun 26, 2026
- Upstream moved to an organization: all upstream PR/issue URLs now point to
  ClaudeCodeUsage/ClaudeCodeUsage (numbers preserved on transfer) across the
  README, the translated READMEs, CONTRIBUTING and the CHANGELOG. The original
  author (@jack21) stays credited by name.
- Credits refreshed beyond the 2.0 baseline: added @ScherbakovAl (PR #31, the
  original context indicator + showCost) and @nickearnshaw's PR #24 (quota
  rollover), plus the closed issues (#25 test seed, #31 context detection).
- Reconciled the docs with the final 2.1 behaviour: AI advice/Optimizer are
  API-only (the keyless subscription backend is documented as prototyped-but-
  not-shipped), the context indicator and Optimizer are experimental/off, the
  Optimizer returns plain text, settings live in the dashboard, and the header
  was trimmed. Added CHANGELOG Changed/Fixed bullets for the header rework,
  plain-text optimizer, redesigned cards and the workspace-switch quota fix.

Docs only. Compile clean; 11/11 node:test green.

Co-Authored-By: Claude <noreply@anthropic.com>
Carl723000 added a commit that referenced this pull request Jun 26, 2026
Integrate the leftover upstream PR #38 (@wheelbarrel00) that never shipped with
the unreleased v2.0.3. It adds `showOpusWeekly` (opt-in, default off): when on,
the quota item appends `opus:NN%` after the 5h / weekly figures, so heavy Opus
users get an at-a-glance weekly Opus signal.

This branch diverged from upstream at PR #31, so #38 wasn't present; cherry-pick
would conflict with the status-bar changes made here (setVisibility signature,
cost/tokens metric, all-off entry icon). Re-applied faithfully instead, adapted
to the dashboard-managed settings:
- settings.ts: showOpusWeekly in the Status-bar group (state-stored, default off).
- statusBar.ts: 5th setVisibility param; updateQuota appends opus:NN% and keeps
  the item visible when only the Opus window is present.
- extension.ts / types.ts: thread the setting through.
- README / README-zh-CN / CHANGELOG: documented and credited @wheelbarrel00 (#38).

Compile clean; 11/11 node:test green.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: wheelbarrel00 <103789673+wheelbarrel00@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Minor bump — new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants