Skip to content

v2.1 — Workflow attribution, usage tracking, AI advice + Optimizer, dashboard settings - #39

Merged
Carl723000 merged 34 commits into
ClaudeCodeUsage:mainfrom
Carl723000:feature/workflow-attribution
Jun 26, 2026
Merged

Carl723000 merged 34 commits into
ClaudeCodeUsage:mainfrom
Carl723000:feature/workflow-attribution

Conversation

@Carl723000

Copy link
Copy Markdown
Collaborator

v2.1 — Workflow attribution, usage tracking, AI advice + Optimizer, settings in the dashboard

Big feature release on top of v2.0.x. Highlights:

New

  • Workflows tab — one row per multi-agent run (dynamic workflows and ad-hoc sub-agent batches): per-run cost, agent count, models, cache hit rate (the "is my provider workflow-ready" diagnostic), and a per-agent drill-down labelled by each agent's task.
  • Usage tracking panel — the official /usage "what's contributing" view, multi-provider, with five scopes (Day / Week / Month / session / project): large-context / long-session / subagent-heavy / workflow shares + Skills / Subagents / Plugins / Models tables.
  • Settings in the dashboard — a new ⚙ Settings tab manages every option in place (fully localized in all 6 languages). VS Code's own Settings keeps only the three that benefit from syncing (language, dataDirectory, advice.apiKey); the rest move to extension-managed storage with a one-time migration from settings.json.
  • AI advice — sends your usage aggregates + a sample of your own prompts to your model (Anthropic /v1/messages by default, or any OpenAI-compatible endpoint) and writes a prioritised Markdown coaching report.
  • Usage Optimizer (experimental, opt-in) — paste a rough request, get one clean plain-text prompt plus a recommended effort / thinking / model (shown as chips; tiers incl. max / ultracode). Only the pasted text is sent; consent gate on first use.
  • Context-window indicator (experimental, opt-in) — current-session context fill in the status bar; ~ marks a guessed window, contextWindowOverride pins proxied/custom models.
  • Status-bar metric (statusBarMetric) — today's cost or today's total token count (compact k/M).
  • Weekly Opus limit (showOpusWeekly, opt-in) — appends opus:NN% to the quota item. (Original PR Surface the weekly Opus limit in the status bar (opt-in showOpusWeekly) #38 by @wheelbarrel00, re-applied on the new dashboard-settings architecture; retained as a merged ancestor.)
  • Thinking share per session + workflow quota guard banner + calibrated content analysis.

Fixed

  • "Get AI advice" hangs / terminated (timeout + retry + curl fallback; payload caps).
  • Quota indicator blanked after switching folders in the same window (curl cwd pinned; workspace-folders listener).
  • F5 launch failed on Windows (npm.ps1 execution policy) — the debug task runs tsc via node directly.

Notes

  • AI advice / Optimizer are API-only this release. A keyless "subscription" backend was prototyped but isn't shipped (Anthropic 403s the OAuth-token direct call); the transport stays dormant for if that changes.
  • node:test suite green; settings panel translations validated for all 26 settings × 5 locales.
  • Screenshots in the README are being refreshed in a follow-up.

Full details in CHANGELOG.md.

Carl723000 and others added 30 commits June 11, 2026 20:26
Local-only development/planning docs (not for the upstream PR): the optimized V2.2 feature & automation specs for self-review and Fable 5 experimentation, plus a new ARCHITECTURE.md (and Simplified-Chinese ARCHITECTURE-zh-CN.md) capturing the module map, data flow, and the exact-token-reading explanation — the seed of the future automation context pack.
… 5 scopes)

Phase 4 reworked: usage attribution panel modelled on the official /usage
'What's contributing to your limits usage?' screen — characteristics
(>150k context, long-running sessions, subagent-heavy, workflow share)
plus Skills/Subagents/Plugins/Models tables, scoped Day/Week/Month/
Session/Project. Compact strip in Today tab; full panel in Content tab;
Phase 5 advice consumes the signals. Documented agent-*.meta.json
agentType values verified on disk. Checkpoints now after Phases 2 and 4.
Phase 0 of docs/V2.1-WORKFLOW-SPEC.md — kills the intermittent
'terminated' / infinite-hang failures of Get AI Usage Advice:

- new shared src/httpClient.ts: fetch transport with AbortController
  timeout (clean 'timed out' error) + curl transport, factored out of
  claudeApiClient.ts (which now delegates; behaviour unchanged)
- advisor.ts: 120 s default timeout, one fetch retry, then curl
  fallback — same last-resort transport the quota client uses;
  verified against a black-holed host: clean failure in 3x timeout,
  no hang
- buildAdviceSummary: cap prompt sample at 40 prompts x 1500 chars,
  skip the section entirely above 80 KB
- prompt purity: collectPrompt no longer harvests from sub-agent
  logs, meta/sidechain lines, or agent-framework scaffolding text
  (kebab-case XML-ish wrappers, interrupt notices)
- dataLoader.ts: replace a literal NUL byte in a string key with its
  unicode-escape form so tooling stops treating the file as binary
Phase 1 of docs/V2.1-WORKFLOW-SPEC.md:

- records from files under subagents/ now carry _agentId and _agentType
  (from the sibling agent-*.meta.json, cached per refresh); files under
  subagents/workflows/ additionally carry _workflowId and _workflowName
  (resolved from workflows/scripts/<name>-wf_<id>.js)
- attribution is path-derived, never cwd-derived: worktree-isolated
  agents have a cwd pointing at a temporary git worktree
- new ClaudeDataLoader.getWorkflowBreakdown(): groups by workflow run,
  aggregates via calculateUsageData, per-agent drill-down, sorted by
  most recent activity
- new WorkflowUsage type

Verified against real data: 4 workflows with resolved names
(deep-literature-review etc.), agent counts 22/9/7/6, agentType split
workflow-subagent=412 / general-purpose=213 / Explore=143. Spec
acceptance updated: the 24.6M raw figure double-counts proxy
placeholder+final pairs; the deduped ~8.9M is the consistent number.
…rate

Phase 2 of docs/V2.1-WORKFLOW-SPEC.md:

- new tab after Branches: one sortable row per workflow run (start time,
  derived name, project, agent count, cost, token split, cache hit rate,
  duration), expanding to a per-agent sub-table via the existing
  project-group toggle pattern (sort-child rows travel with their parent)
- summary strip: workflows this month / their cost / share of month cost
- cache hit rate (cacheRead / input-side tokens) is the headline
  diagnostic; hint line under the table explains the native-vs-proxy
  story. Verified on real data: native Claude runs show 76%/72%,
  DeepSeek-routed runs 0.0% - exactly the signal the tab exists for
- i18n keys in all six languages; CHANGELOG [2.1.0]; version bump 2.1.0

Smoke-tested by rendering the tab against live ~/.claude data (vscode
stubbed): 4 workflows, 44 agent child rows, 11 sortable headers.
Phase 2 checkpoint follow-up:

- per-agent drill-down rows are now labelled by the task dispatched to
  the agent (first user message of its log, captured at load time as
  _agentTask, truncated 200 chars) with the hex id demoted to a second
  line + tooltip - expanding a workflow now tells you what each agent
  actually did
- new Model column on workflow and agent rows: distinct models used,
  most expensive first, shortened (claude-/date-suffix/[1m] stripped),
  full ids in the tooltip; sortable
- workflow-count question investigated: the disk only contains 4
  wf_* run dirs total (~/.claude/projects scanned recursively), so
  nothing is being missed locally - other remembered runs were cloud
  routines / other machines / generic Task-tool fan-out (49 generic
  agent logs found), which Phase 4's Subagents table will surface

Smoke-verified: 44/44 agent rows carry task labels, 12 sortable
headers, model cells render (deepseek-v4-pro etc.).
Phase 3 of docs/V2.1-WORKFLOW-SPEC.md:

- content analyzer now tracks estimated thinking vs. total assistant
  output per session and per local day (thinkingBySession/thinkingByDay
  on ContentAnalysis)
- Sessions tab: sortable "Thinking %" column; >60% gets a warning glyph
  and an /effort-high hint in the cell tooltip (no popups); hint line
  marks the figures as text-length estimates
- Today tab: one-line estimated thinking share for the day
- quota guard: dismissible warning banner in the dashboard when the
  5h window's remaining share drops below workflowQuotaWarnPercent
  (new setting, default 50, 0 disables); never warns on an
  already-reset window; dismissal lasts for the window-session;
  status bar untouched. Quota now also flows to the webview (only
  re-renders on change).

Smoke-verified on real data: 37 sessions with thinking data (top
64.6%), today line ~8%, banner shows at 20% remaining and hides on
enough quota / expired window / dismiss.
Phase 4 of docs/V2.1-WORKFLOW-SPEC.md (incl. mid-phase review feedback):

- content analyzer detects skill invocations (Skill tool_use blocks +
  <command-name> echo markers) with session/day/timestamp; trivial
  session-management commands (/model, /clear, ...) are excluded
- ClaudeDataLoader.getUsageAttribution(records, analysis, scope):
  scopes day/week/month/session/project; characteristics weighted by
  estimated cost (>150k-context share, 8h+-active-session share,
  subagent-heavy-session share, workflow share); tables for Skills,
  Subagents (by agentType), Plugins (namespace prefix), Models
- skill/plugin share methodology matched to the official screen after
  comparing real numbers: usage at/after the invocation in the same
  session counts toward the skill (overlapping independent signals),
  NOT the injected-prompt size (which measures ~0% and is kept only
  as a secondary column)
- Content tab: panel with scope selector (Session/Project reveal a
  target dropdown; recompute via webview message round-trip); top
  skill/plugin >=10% get official-style characteristic lines + hints
- Today tab: compact strip with >=5% characteristic lines only
- i18n: 22 new keys in all six languages

Smoke-verified on real data (week scope): 94% >150k context, 63%
8h+ sessions, 40% code-review, 14% plugin superpowers; today strip
shows 94% superpowers:executing-plans (this implementation session).
Phase 4 checkpoint review feedback:

- workflow-count gap root-caused: locally there were only 4 wf_* runs;
  the other remembered ultracode runs were ad-hoc Task-tool fan-outs
  (no wf_ dir - observed when the dynamic-workflow feature isn't
  engaged, e.g. proxy/DeepSeek routing) or mere text mentions of the
  word. getWorkflowBreakdown now also groups >=2 generic agents per
  session as an ad-hoc batch (badge "subagents", named by session
  title). Real data: 4 wf runs + 8 batches, incl. a 17-agent DeepSeek
  refactor run that was previously invisible
- agent drill-down: the agents' shared task boilerplate is hoisted
  into one pinned row per run; each agent row now shows only the part
  of its task that differs (hex id demoted, full text in tooltips)
- attribution panel: scope switcher is now tab buttons on the same
  line as the heading (Session/Project reveal a dropdown there);
  heading shortened to "Usage tracking" / 用量追踪; the four
  sub-tables re-rendered in the content-analysis bar style
- Today tab: insights are now a proper card (bar rows with short
  labels, sentences+hints in tooltips) instead of loose text lines;
  estimated thinking share merged into the same card
Phase 5 of docs/V2.1-WORKFLOW-SPEC.md (final phase):

- buildAdviceSummary extracted to src/adviceSummary.ts (testable
  outside VS Code) and extended with labelled sections: multi-agent
  runs (per-run cost, agent fan-out, cache hit rate, models),
  estimated thinking share (30d), and the week-scope usage
  attribution (characteristics + top skills/subagents/plugins/models)
- new setting claudeCodeUsage.advice.userContext: free-text background
  about the user/project; when set, the system prompt instructs the
  model to end with a "Personalised for this project" section.
  Language enforcement unchanged
- README (en + zh-CN): "What's new in 2.1" feature list

Smoke-verified on real data: summary carries all three signal
sections (10 runs with cache hit 65-92%, thinking 17%, attribution
94%/59% characteristics); prompt-purity invariant from Phase 0 holds
(no scaffolding in the sample block).
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 ClaudeCodeUsage#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).
The V2.1/V2.2 work-plan specs and the ARCHITECTURE dev reference are the
maintainer's private iteration docs, not shipped product. Gitignore them and
untrack them so they live on disk but never enter commits/pushes going
forward (same treatment as docs/claude-advice-*.md). Working copies are kept;
re-track later by removing the .gitignore lines if a doc should become public.

Note: docs/V2.1-WORKFLOW-SPEC.md and docs/V2.2-*-SPEC.md currently exist on
origin/main; this stages their removal there on the next merge of this branch.
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 ClaudeCodeUsage#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.
…stration cost

Phase 7 of the V2.1 continuation plan:

7a — authoritative skill/plugin attribution. Records now carry _skill/_plugin
from the log's attributionSkill/attributionPlugin fields (CC >= 2.1).
getUsageAttribution weights skills/plugins by the EXACT message.usage of those
stamped lines, falling back to the <command-name> heuristic only when no record
carries the fields. On real data: 426 _skill / 203 _plugin records;
superpowers:executing-plans now reports a precise 80x / real cost weight.

7b — clearer run badges: "workflow" (a wf_ run dir) vs "subagents (ad-hoc)"
(a plain Task-tool fan-out), plus a hint that the effort level (ultracode/xhigh)
is NOT recorded in the logs, so neither badge claims one.

7c — main-session orchestration cost. getWorkflowBreakdown now finds the
session's main-thread spend bracketing each run (same session, inside the run's
window, attributed to exactly one run; window capped at 3 h so multi-day ad-hoc
batches don't over-claim). Surfaced as a pinned drill-down row and folded into
the headline cost/models, so a native-Claude run's real Opus/Fable cost is
finally visible. Verified: the PPRFS run's $11.83 of claude-opus/sonnet
orchestration (previously invisible behind $1.25 of cheap agent files) is now
attributed when its window is focused.

types: WorkflowUsage.orchestration; ClaudeUsageRecord._skill/_plugin.
i18n: workflowModeBadge / workflowModeHint / orchestration in all six languages.
Compile clean; node:test green; webview renders badges + 6 orchestration rows.
Phase 8 of the V2.1 continuation plan — the "can it be more precise than
text-length estimates?" answer.

Totals were always exact (message.usage); only the within-request category
split is estimated. The Content tab now keeps the text-length estimate for
relative shares but scales each side to the real billed totals over the
analysis window:
- assistant categories (assistantText / assistantThinking / toolCalls) sum to
  the exact Σ output_tokens;
- input-side categories (userPrompts / toolResults) sum to the exact
  Σ (input_tokens + cache_creation_input_tokens).

dataLoader computes the anchors (ContentAnalysis.calibration) over the same
30-day window. The Sessions Thinking column tooltip gains a calibrated
"real thinking tokens" figure (share x the session's exact output tokens).
New setting analysis.calibrate (default on); calibrated figures are labelled
distinctly from raw estimates.

Verified on real data: calibrated assistant sum = 5.57M = exact output;
calibrated input sum = 61.85M = exact input-side (the raw text estimate was
only 5.31M total — cache-creation is invisible to character counts, which is
exactly the undercount this fixes). Toggling the setting off restores the raw
estimates; within-side shares unchanged. Compile clean; node:test green.
…d, workflow note

Review feedback on the current build:

- Context window is now per-model, not a flat 200K: Opus 4.6+/Sonnet 4.6+/
  Fable 5 = 1M, Haiku and older Claude = 200K, DeepSeek = 128K, [1m] suffix
  = 1M (verified against the model catalog). Fixes Opus showing >100% fill.
- Context tooltip rewritten as a /context-style breakdown — fresh input /
  cache read / cache write / free space table — instead of a single number;
  ContextWindowInfo carries the input-side split. Bottom note shortened and
  the /clear sentence wrapped to its own line (all six languages).
- Today "Usage tracking" card now shows only exact cost-weighted shares; the
  text-length thinking-share estimate was removed from it (it stays on the
  Sessions tab, clearly marked estimate).
- Workflows tab: honest note that native-Claude ultracode often keeps
  orchestration in the main session (no agent files) and so appears in
  Sessions / Usage tracking rather than as a workflow row; a community issue
  + V2.1.1 follow-up are queued to improve detection.

i18n: freeSpace + workflowNativeHint in all six languages; shortened
contextHint/contextCostHint. Compile clean.
The AI advice (and the upcoming Usage Optimizer) gain three backends behind
one entry point, with Anthropic as the default shape:

- 'subscription' (default, no API key): reuse the Claude Code OAuth session
  the quota indicator already reads — Bearer <token> + the
  `anthropic-beta: oauth-2025-04-20` header — to call /v1/messages with a
  cheap model (Haiku). Feasibility verified on disk: a live haiku call
  returned 200, and the end-to-end advisor path returns real advice with no
  key configured. Uses a little of the user's quota.
- 'api' + apiFormat 'anthropic' (default for a configured key): x-api-key
  against /v1/messages.
- 'api' + apiFormat 'openai': the prior DeepSeek chat-completions path, kept
  for compatibility (existing configs keep working).

advisor.ts: extracted a shared callModel(system, user, opts) the optimizer
will reuse; send() now also falls back to curl on the 403
"Request not allowed" TLS-fingerprint gate (not just on thrown errors) — the
same gate the quota client handles. claudeApiClient.getAccessToken() exposes
a refreshed OAuth token. extension.ts: the advice command no longer demands
an API key when backend=subscription. New settings advice.backend /
apiFormat / subscriptionModel. Compile clean; node:test green.
… 9a/9c/9d)

The Content tab now leads with two action cards before the analysis:

- AI advice card — the "Get AI advice" button moves out of the analysis
  header into a labelled card with a one-line note on what gets sent.
- Usage Optimizer (opt-in: advice.optimizer.enabled, default off) — paste a
  rough request, get back ONE tightened paste-ready prompt plus a recommended
  effort / thinking / model. Three optional lenses: flag ambiguous refs,
  condense long pasted material, suggest a style direction. Runs through the
  same backend as AI advice (callModel); ONLY the pasted text is sent — no
  files, never Claude Code's terminal — behind a one-time consent modal. The
  round-trip lives in extension.runOptimizer, parsing the model reply on
  ===PROMPT=== / ===SETTINGS=== markers; the webview exposes it via the
  onOptimize hook and fills a baked, hidden result skeleton (no labels in JS).
  Verified end-to-end on the subscription backend (live haiku, markers parsed).

- advice.promptWindowDays (default 30) — how many days of prompts/content the
  analysis samples. Threaded through loadUsageRecords (analysis + calibration
  cutoffs) and echoed in the advice summary prose so the model knows the
  horizon.

i18n: 16 new keys filled across all six locales (en, de, zh-TW, zh-CN, ja,
ko). Compile clean; pricing node:test green.

Co-Authored-By: Claude <noreply@anthropic.com>
README: refresh the AI-advice showcase for 2.1 — advice now works with no
API key (subscription backend) and a second card, the opt-in Usage Optimizer
(only-the-pasted-text, one-time consent). Rewrote the advice/optimizer
screenshot blurb, the "What's new in 2.1" bullets, the Configuration table
(advice.backend / apiFormat / subscriptionModel / userContext /
promptWindowDays / optimizer.enabled), the Privacy note (subscription vs api
endpoints) and the demo-mode troubleshooting entry.

Tests: extract the optimizer's two pure helpers into advisor.ts so they can be
covered without the vscode API —
- buildOptimizerSystemPrompt(language, lenses)
- parseOptimizerOutput(raw) -> {prompt, settings}
extension.runOptimizer now calls them instead of inlining the strings (and the
duplicated parser method is gone). New node:test files:
- optimizer.test.ts: marker split, missing/out-of-order/empty fallbacks,
  language + lens inclusion.
- adviceSummary.test.ts: windowDays prose threading (default 30, custom,
  rounding/flooring).
11/11 green; compile clean.

Co-Authored-By: Claude <noreply@anthropic.com>
…ettings

VS Code's Settings UI listed ~27 options for this extension. Move the bulk of
them into a new ⚙ Settings tab in the dashboard and keep only a syncable core
in package.json.

- src/settings.ts (new): a single catalog of every setting (type, default,
  storage, group, control hints) plus SettingsStore — one read/write layer over
  two backings. Core settings (language, dataDirectory, advice.apiKey) stay in
  VS Code config so they remain in settings.json and travel with Settings Sync;
  the other 22 move to the extension's globalState. coerce() clamps numbers,
  validates enums and casts booleans so the panel can't store garbage.
- Migration: migrateOnce() copies any explicit settings.json value for a moved
  key into globalState on first launch (via config.inspect, which still reports
  user values for now-undeclared keys), guarded by a one-shot flag — upgrades
  keep their configuration.
- extension.ts: getConfiguration() now reads through SettingsStore; the store is
  shared with the webview and an onSettingsChanged callback re-applies config
  after dashboard edits (globalState changes don't fire onDidChangeConfiguration).
- webview.ts: new ⚙ Settings tab renders the catalog grouped (General / Status
  bar / Data & refresh / AI advice & Optimizer) with the right control per type;
  updateSetting / resetSetting / resetAllSettings handlers. The four in-webview
  config reads (workflow quota %, pause refresh, optimizer.enabled, calibrate)
  and the pause write now go through the store. Header gear + the optimizer
  "enable" button point at the new tab (the latter's setting left VS Code).
- package.json: trimmed contributes.configuration to the three core keys.
- i18n: panel chrome (tab title, intro, reset, four group headers) in all six
  locales. Setting labels/help are intentionally English (technical identifiers).

Verified: tsc clean; 11/11 node:test green; a mocked-vscode smoke run confirms
defaults, number clamping, enum guard, boolean coercion, snapshot integrity
(25 settings, unique keys), the core trio, and reset.

Co-Authored-By: Claude <noreply@anthropic.com>
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 ClaudeCodeUsage#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>
Optimizer:
- The rewritten prompt is now PLAIN TEXT (the system prompt forbids Markdown —
  no bold/headings/backticks/bullets) so it pastes cleanly into a terminal.
- Clearer, task-framed copy: optimizerDesc says what it is; a new optimizerHowto
  line says how to use it (type/paste, pick lenses, Optimise). The consent text
  no longer references the removed advice.backend setting.
- Marked experimental (a pill on the card title); still default-off.

Cards: the AI advice + Usage Optimizer blocks are redesigned as one cohesive
"action card" treatment (frontend-design pass) — an accent rail + icon badge +
title/purpose/action — so they read as the two tools, distinct from the data
panels, while staying quiet and fully theme-driven (VS Code vars only). Replaces
the old left-tinted .advice-card.

i18n: optimizerDesc reworded, new optimizerHowto + experimentalBadge across all
six locales; consent text updated.

Compile clean; 11/11 node:test green.

Co-Authored-By: Claude <noreply@anthropic.com>
…r switch

Symptom: switching to another folder in the SAME VS Code window left the 5h/weekly
quota indicator blank — and it stayed blank even while Claude Code was actively
running. Opening the folder in a NEW window was fine.

Cause: the quota fetch falls back to the system curl binary (Anthropic's edge
rejects Node's TLS fingerprint). spawn() inherited the extension host's cwd, and
after a same-window folder switch that inherited cwd can point at a directory
that no longer exists — so spawn fails with ENOENT, fetchUsageLimits returns null,
and the indicator hides. A fresh window starts curl with a valid cwd, so it works
there.

Fix:
- httpClient.requestViaCurl spawns curl with cwd pinned to os.homedir() (curl
  needs no particular cwd) — immune to a stale/invalid inherited cwd.
- extension listens for onDidChangeWorkspaceFolders and forces a fresh quota
  fetch + refresh (resets the fetch throttle and the cold-start retry guard), so
  the indicator reappears even when the host persists across the change.

Compile clean.

Co-Authored-By: Claude <noreply@anthropic.com>
- 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 ClaudeCodeUsage#31, the
  original context indicator + showCost) and @nickearnshaw's PR ClaudeCodeUsage#24 (quota
  rollover), plus the closed issues (ClaudeCodeUsage#25 test seed, ClaudeCodeUsage#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>
Fixes:
- **F5 launch failed every time** ("preLaunchTask npm: compile terminated with
  exit code 1"). On Windows the npm task type runs through powershell.exe →
  npm.ps1, which the default execution policy blocks. .vscode/tasks.json now runs
  tsc directly via node (`type: process`, no shell); launch.json points at it
  (and its missing-comma JSON error is fixed).
- **Optimizer result wiped by auto-refresh** — the result lived only in the DOM,
  so any dashboard refresh erased a prompt you were still reading. The webview
  now persists the last optimizer interaction (draft + lens choices + result) and
  restores it on every re-render.
- **No way back to the dashboard when cost+quota+context are all hidden** — the
  first status-bar item now stays as an icon-only entry point ($(graph), opens
  the dashboard) when all three are off, instead of leaving zero clickable items.

Features / polish:
- **Status-bar metric** setting (`statusBarMetric`, default cost) — switch the
  first item from today's cost to today's total token count, shown compact (k/M)
  with the configured decimal places. New `I18n.formatTokensCompact`.
- **Optimizer copy de-jargoned** — dropped the "lens/透镜" wording for plain
  "optional tweaks"; each of the three options now has a tooltip explaining it
  (new *Hint keys, all six locales).
- **Settings recommendation rendered for reading, not copying** — it's no longer
  a monospace code block; clean UI-font block with a soft accent rail. The
  optimised prompt stays monospace/copyable.
- **Model recommendation grounded in reality** — the optimizer is told to pick
  only from the models you actually use (Claude reduced to family names
  haiku/sonnet/opus/fable, third-party kept as-is), so it stops naming models you
  don't have or stale versions a third-party model wouldn't know.
- **Context tooltip** widened (40-segment bar) so its right edge lines up better
  with the figures below.

Compile clean; 11/11 node:test green.

Co-Authored-By: Claude <noreply@anthropic.com>
The dashboard felt heavy in the Extension Development Host. Two safe mitigations:

- updateWebview() now skips assigning panel.webview.html when the rendered HTML
  is byte-identical to what's already shown. Assigning .html forces a full
  webview reload (re-parse + re-run the inline script + reset scroll) — the
  heaviest recurring cost on refresh ticks; skipping no-op renders avoids it.
  lastHtml is cleared on panel dispose so a reopened panel always paints.
- Removed the two highest-frequency webview console.log("[DEBUG] …") lines (one
  per message received, one per document click) that piled up in the webview
  console during long sessions.

The live full-reload during active sessions is still inherent to the current
"regenerate the whole HTML" model — `pauseDashboardRefresh` (now in the ⚙
Settings tab) remains the lever for it; an incremental-update refactor is a V2.2
candidate.

Compile clean.

Co-Authored-By: Claude <noreply@anthropic.com>
…icon

- README-zh-CN.md fully rewritten to match the current English README and the
  2.1 final state (settings-in-dashboard, API-only advice + dormant subscription
  note, experimental Optimizer with plain-text output, experimental context
  indicator with window override, status-bar cost/tokens metric, the all-off
  entry icon, the workspace-switch quota fix). Other locale READMEs stay slim by
  design — only their upstream-org URLs were updated earlier.
- README.md: added the status-bar metric (cost ↔ tokens) and the all-off entry
  icon to "What's new in 2.1".

Docs only.

Co-Authored-By: Claude <noreply@anthropic.com>
…eUsage#38)

Integrate the leftover upstream PR ClaudeCodeUsage#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 ClaudeCodeUsage#31, so ClaudeCodeUsage#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 (ClaudeCodeUsage#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>
…t tooltip

Usage Optimizer:
- The "copy prompt" control is now a compact floating icon button (⧉ + label)
  in the prompt block's top-right, themed to match the extension, with a green
  "copied" state — instead of a generic button below the text.
- "Recommended run settings" now renders each line as "Label  [value chip]  reason",
  so the choice that matters (high / on / opus) stands out as a filled chip
  instead of plain text. The optimizer is told to emit exactly three parseable
  lines (Effort/Thinking/Model) with English value tokens; a webview formatter
  (formatOptSettings) turns them into chips and re-applies after a re-render.

Context tooltip:
- Rebuilt as a single HTML table with the progress bar in the right-hand value
  column, so the bar's right edge lines up with the cache/figure numbers below
  it (the requested alignment).
- The footer hint is now two short lines: "New task → /clear" and
  "Same task → /compact" (contextHintCompact added, all six locales).

Compile clean; 11/11 node:test green; the settings parser verified on sample
model output (values isolated correctly for the chips).

Co-Authored-By: Claude <noreply@anthropic.com>
Carl723000 and others added 4 commits June 26, 2026 01:29
…r showcase

- Credits (README + README-zh-CN): lead with @Carl723000 as the maintainer who
  forked this from @jack21's original and now also helps own/maintain the
  upstream org, with the 2.x work attributed to him + Claude Code. The original
  author and the other contributors stay credited below.
- AI advice showcase: it produces a Markdown report, so describe how to use it
  (set key → Get AI advice → pick scope → opens a .md) with a short illustrative
  example instead of a screenshot (real advice text could leak personal data).
- Usage Optimizer showcase: keep a card screenshot (it's interactive UI) +
  describe the plain-text prompt, the setting chips and the three toggles. New
  image placeholder images/v2-optimizer-en.png (Carl updates screenshots next).

Docs only.

Co-Authored-By: Claude <noreply@anthropic.com>
Ran the zh-CN README through DeepSeek V4 Pro (the user's own key) with strict
"only smooth the wording — keep every heading, table, link, code span, command
and technical term verbatim" instructions, then validated the result before
applying: same 10 ## / 8 ### headings, 5 images, 26 links, tables and section
order unchanged; tables / privacy / troubleshooting / credits untouched. It
removes the most translated-sounding bits (the opening sentence, clichés like
"尽收一处" / "着力点", over-used em-dashes) so it reads less machine-generated.

Docs only (zh-CN README).

Co-Authored-By: Claude <noreply@anthropic.com>
…iers

- **Settings panel is fully localized.** The ⚙ Settings tab showed translated
  group headers/chrome but English per-setting labels and help. Added a
  SETTINGS_I18N map (de-DE / zh-TW / zh-CN / ja / ko) covering every setting's
  label + help, resolved via I18n.settingText() with the English catalog as the
  en fallback. Code/command tokens (token, /v1/messages, opus:NN%, k/M,
  git/folder/flat …) kept verbatim. (Translations drafted with DeepSeek V4 Pro
  and validated for completeness across all 26 settings × 5 locales.)
- **Context tooltip:** swapped the progress bar to the left and the percentage
  to the right, matching the tooltip's left-label / right-value convention.
- **Usage Optimizer effort tiers:** the run-settings recommendation may now
  suggest `max` and `ultracode` (in addition to low/medium/high), with a note
  that ultracode means splitting across sub-agents — same chip UI.

(A local-only roadmap note in docs/V2.2-FEATURES-SPEC.md — gitignored — records
that the Optimizer / advice suggestions do NOT read local files; that stays a
future opt-in.)

Compile clean; 11/11 node:test green; settingText verified resolving per locale.

Co-Authored-By: Claude <noreply@anthropic.com>
…mented on the new dashboard-settings architecture, original PR ClaudeCodeUsage#38 by @wheelbarrel00 retained as a merged ancestor)
@Carl723000
Carl723000 requested a review from jack21 as a code owner June 26, 2026 10:00
@Carl723000
Carl723000 merged commit 6ed01d8 into ClaudeCodeUsage:main Jun 26, 2026
1 check passed
@Carl723000
Carl723000 deleted the feature/workflow-attribution branch August 24, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant