[BUG] Claude Code consistently degrades in performance over long sessions
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?
After long sessions (Claude Max with several autocompacts), Claude Code becomes slower and slower to the point that it becomes so slow that takes several minutes between requests. The current solution is to shut it down and start fresh. It looks as if something accumulates (data structure or something) and causes a terrible performance issue. I have /rewind disabled (disabled it due to the performance issue) and nothing improoves that doesn't seems to be the cause. I am using streaming MCP.
What Should Happen?
Stay at the same performance level during long sessions by using performant O(nlogn) data structures and not slow to a crawl. Or not have some memory leak (could be the cause too)
Error Messages/Logs
No error, just heavy performance degradation.
Steps to Reproduce
Run during a very long session and several auto compacts. Monitor the performance with performance counters scattered around blocks of code to locate the culprit region.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.0.31
Platform
Anthropic API
Operating System
Windows 11
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 14 comments on GitHub. Read the full discussion on GitHub ↗