[Bug] Excessive token consumption in new sessions - context not clearing properly between conversations
Bug Description
Using Claude Code with claude-opus-4-6[1m]. After only 2 short messages in a new session, the usage meter showed 26% of my 5-hour session limit consumed. Running /context revealed 185.4k tokens attributed to "Messages" — which is impossible with just 2 short user messages. Total context was 201k/1000k (20%).
This suggests Claude Code may be injecting previous conversation history or accumulated context into new sessions without clearing it properly. The autocompact buffer also showed 33k tokens (3.3%) which adds to the suspicion.
Expected behavior: 2 short messages should consume a small fraction of the session limit.
Actual behavior: 26% consumed, with 185k tokens under "Messages" category.
Screenshot of /context output available. This makes Claude Code effectively unusable within normal Pro plan session limits.
Additional incident (same day):
In a previous session, I asked Claude Code to make a simple git commit in a relatively short conversation. This completely exhausted my session limit and left me locked out for approximately 1.5 hours.
A git commit task should be one of the lightest operations possible. Burning an entire session limit on it strongly suggests the token consumption is not proportional to actual work done — either context is not being cleared between sessions, the autocompact mechanism is malfunctioning, or tokens are being charged incorrectly.
This is happening consistently across multiple sessions, not as a one-off event.
Environment Info
- Platform: win32
- Terminal: null
- Version: 2.1.84
- Feedback ID: 634a61f4-b759-4079-bbd2-fb65ad43079b
Errors
[{"error":"Error: rg --files exited 2\n at ChildProcess.<anonymous> (file:///C:/Users/carlos/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:604:53)\n at ChildProcess.emit (node:events:518:28)\n at maybeClose (node:internal/child_process:1101:16)\n at Socket.<anonymous> (node:internal/child_process:456:11)\n at Socket.emit (node:events:518:28)\n at Pipe.<anonymous> (node:net:346:12)","timestamp":"2026-03-27T12:25:35.630Z"},{"error":"CS8: Failed to install new version of claude: npm error code EBUSY\nnpm error syscall copyfile\nnpm error path C:\\Users\\carlos\\AppData\\Roaming\\npm\\node_modules\\@anthropic-ai\\claude-code\\node_modules\\@img\\sharp-win32-x64\\lib\\libvips-cpp-8.17.3.dll\nnpm error dest C:\\Users\\carlos\\AppData\\Roaming\\npm\\node_modules\\@anthropic-ai\\.claude-code-wXpZeiZf\\node_modules\\@img\\sharp-win32-x64\\lib\\libvips-cpp-8.17.3.dll\nnpm error errno -4082\nnpm error EBUSY: resource busy or locked, copyfile 'C:\\Users\\carlos\\AppData\\Roaming\\npm\\node_modules\\@anthropic-ai\\claude-code\\node_modules\\@img\\sharp-win32-x64\\lib\\libvips-cpp-8.17.3.dll' -> 'C:\\Users\\carlos\\AppData\\Roaming\\npm\\node_modules\\@anthropic-ai\\.claude-code-wXpZeiZf\\node_modules\\@img\\sharp-win32-x64\\lib\\libvips-cpp-8.17.3.dll'\nnpm error A complete log of this run can be found in: C:\\Users\\carlos\\AppData\\Local\\npm-cache\\_logs\\2026-03-27T12_25_36_711Z-debug-0.log\n at Rs6 (file:///C:/Users/carlos/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2858:834)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async file:///C:/Users/carlos/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:7814:4156","timestamp":"2026-03-27T12:25:37.784Z"},{"error":"Error: ENOENT: no such file or directory, unlink 'C:\\Users\\carlos\\AppData\\Local\\Temp\\claude\\C--local-Trading\\c03d0731-9c19-41fe-8065-120dfdda6e71\\tasks\\ae2e4c7ec8fe3e816.output'\n at async unlink (node:internal/fs/promises:1065:10)\n at async cz6 (file:///C:/Users/carlos/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:855:303)","timestamp":"2026-03-27T12:27:03.236Z"},{"error":"Error: ENOENT: no such file or directory, unlink 'C:\\Users\\carlos\\AppData\\Local\\Temp\\claude\\C--local-Trading\\c03d0731-9c19-41fe-8065-120dfdda6e71\\tasks\\a5b5d6d07adc61b30.output'\n at async unlink (node:internal/fs/promises:1065:10)\n at async cz6 (file:///C:/Users/carlos/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:855:303)","timestamp":"2026-03-27T12:27:06.734Z"},{"error":"Error: EISDIR: illegal operation on a directory, read 'C:\\local\\Trading\\trading_core\\market_structure\\profile'\n at UY6 (file:///C:/Users/carlos/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1055:8428)\n at async YM4 (file:///C:/Users/carlos/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:4608:2614)\n at async Object.call (file:///C:/Users/carlos/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:4613:5725)\n at async Mo_ (file:///C:/Users/carlos/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:4315:6683)","timestamp":"2026-03-27T12:27:06.773Z"},{"error":"Error: ENOENT: no such file or dire…
Note: Content was truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗