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

[Bug] /clear command fails to reset session token buffer

Open JeffeSouza opened this issue 3 months ago • 7 comments

Bug Description command /clear not clear full session the new chat start with 45k tokens in buffer and not possible clear he

Environment Info

  • Platform: win32
  • Terminal: vscode
  • Version: 2.0.13
  • Feedback ID: 5ac59957-0d13-4c92-bee3-6f254e1b3b12

/clear ⎿ (no content)

/context ⎿ Context Usage ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀ ⛁ ⛀ claude-sonnet-4-5-20250929 · 62k/200k tokens (31%) ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System prompt: 2.2k tokens (1.1%) ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System tools: 12.1k tokens (6.0%) ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Custom agents: 125 tokens (0.1%) ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Memory files: 2.5k tokens (1.2%) ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Messages: 91 tokens (0.0%) ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝ ⛶ Free space: 138k (69.0%) ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ Autocompact buffer: 45.0k tokens (22.5%) ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝

 Custom agents · /agents
 └ gemini (User): 125 tokens

 Memory files · /memory
 └ Project                                                           2.5k tokens
 (C:\Users\jd-co\OneDrive\Documentos\Projetos\NewDub\CLAUDE.md):

 SlashCommand Tool · 0 commands
 └ Total: 998 tokens

JeffeSouza avatar Oct 10 '25 11:10 JeffeSouza

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/9089
  2. https://github.com/anthropics/claude-code/issues/6835
  3. https://github.com/anthropics/claude-code/issues/8414

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Oct 10 '25 11:10 github-actions[bot]

I have this issue as well. I'm wondering if it is the cause of absolutely chewing through my tokens...

TomStephens123 avatar Oct 11 '25 09:10 TomStephens123

I have this issue as well . It has eaten up my tokens :(

danghung-dev avatar Oct 12 '25 00:10 danghung-dev

Yep, I have exact same issue

Image

dkolyada-lang avatar Oct 31 '25 11:10 dkolyada-lang

Still experiencing this on the latest version:

  • Claude Code: 2.0.31
  • Model: claude-sonnet-4-5-20250929
  • Platform: Linux/Debian

After /clear, context shows:

  • 45.0k token autocompact buffer (22.5%)
  • Only 137k free instead of ~182k expected

This is consuming about 1/4 of the token budget unnecessarily.

Osezno-byte avatar Nov 02 '25 13:11 Osezno-byte

Based on this article, this is not a bug. You can use the /status command to disable the autocompact feature and the Autocompact buffer disappears from /context:

Image

kym6464 avatar Nov 06 '25 17:11 kym6464

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 12 '25 10:12 github-actions[bot]