[BUG] /cost Command Resets on Session Resume [VS Code Extension]

Resolved 💬 5 comments Opened Dec 4, 2025 by mrk-han Closed Feb 5, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I found this bug by accidentally closing out of the window then resuming the session from a new window.

When using Claude Code in Cursor (VS Code extension), the /cost command resets to zero when you close out of a session and then resume that same session. The cost counter does not account for the cost incurred during the entire session lifecycle - it only shows the cost from when the session was resumed, not the cumulative cost from the beginning of the session (entire history of agent within chat window).

This makes it difficult to track the total cost of a work session, especially when you need to pause and resume work multiple times.

Cost output after command in new session:

Total cost: $0.0048 Total duration (API): 6s Total duration (wall): 2m 43s Total code changes: 0 lines added, 0 lines removed Usage by model: claude-opus-4-5: 3 input, 23 output, 4.9k cache read, 0 cache write ($0.0030) claude-haiku: 3 input, 266 output, 4.8k cache read, 0 cache write ($0.0018)

For a chat that was well over $10 dollars of token usage.

Potentially Important Note: The session had been compacted at least once before running that cost command, but before compact I had used the /cost command at least twice.

What Should Happen?

The /cost command should display the cumulative cost for the entire session, regardless of whether the session was paused and resumed, closed or compacted. When resuming a session, the cost counter should continue from where it left off, including all costs incurred before the session was closed.

Error Messages/Logs

No error messages are displayed. The `/cost` command executes successfully but shows incorrect (reset) values.

Steps to Reproduce

Precondition: I was using Opus 4.5 with claude code vs extension using cmd+shift+P -> "Claude Code: Open in new tab" on macOS.

Identifier
anthropic.claude-code
Version
2.0.58
Last Updated
2025-12-04, 02:10:40
Size
167.56MB
  1. Open Cursor and start a new Claude Code session from a tab.
  2. Perform some operations that generate API costs (e.g., ask questions, request code changes)
  3. Run /cost command and note the current cost (e.g., "$0.15")
  4. Close the session/agent window in Cursor (Close the claude code tab where the claude code agent was running)
  5. Resume the same session (claude code: open in a new tab, then /resume session)
  6. Run /cost command again
  7. Observe that the cost has reset to $0.00 or shows only costs from after resuming

Expected: The /cost command should show the cumulative cost including the $0.15 from before closing the session.

Actual: The /cost command shows $0.00 or only costs incurred after resuming

If this repro doesn't work, try compacting after running the first /cost command while running through the same Steps to Reproduce above.

Note: this probably doesn't matter but I did have another tab open for claude code with a session that wasnt active but the tab was technically open since yesterday.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.58 of Claude Code for VS Code

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗