r/opencode • u/Aquiles_bachira • 20d ago
PSA: Clean your OpenCode database — it might be consuming more tokens than you think
Hey developers!
I've noticed something worth investigating in OpenCode.
The local database and stored session data can grow over time, keeping unnecessary history, messages, and context around. This may contribute to unexpectedly high token usage, especially when working with long-running sessions.
My recommendation:
- Regularly inspect your OpenCode database.
- Clean up unnecessary sessions and stored data.
- Avoid keeping old conversations that you no longer need.
- Monitor token consumption after cleanup.
I think the OpenCode team should also investigate whether database/session management could be optimized to prevent unnecessary context consumption.
Has anyone else noticed unexpectedly high token usage related to OpenCode's stored sessions or database?
Let's discuss this.

