Hey, thanks for the detailed report with metrics and SQL. This is helpful.
It helps to split this into two parts.
The growth of state.vscdb is a real issue. Right now there’s no automatic retention policy or eviction for old agent and chat sessions, so with active use the database keeps growing. This is a known issue and it’s being tracked, but I can’t share an ETA for a fix yet. The same topic is discussed in a few threads, for example Cursor state.vscdb growing at 1 GB in a day and Cursor freezes; state.vscdb grows to 10 GB.
What you can do right now to clean it up:
- Command Palette
Cmd+Shift+P→Delete Old Chats- Deletes old chats based on a day threshold.
- Command Palette →
GC Agent KV Blobs- Cleans up orphaned blob records and runs VACUUM.
On the “exponential token consumption” part, there’s a small misunderstanding. All local history from state.vscdb is not sent to the model in full on every message. On the server side, old turns in long sessions are summarized and trimmed before sending to the LLM. That means the context that actually goes to the model is capped, and token usage does not grow linearly with the size of the local database. state.vscdb growth is about disk usage and UI performance, not about burning tokens.
There are already feature requests for a UI indicator for context usage and for a built-in cleanup tool. You can add a vote and details here:
- Context Window Inspector & Agent Usage Profiler
- Request for official tool for Cursor to cleanup itself for its really hard burden and slow speed nowadays
Let me know if the database doesn’t shrink after Delete Old Chats, then we can dig deeper.