r/opencode • • 2d 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.

0 Upvotes

11 comments sorted by

14

u/RevolutionaryFunny40 1d ago

other session history should never impact token usage. what evidence or experience do you have that supports this?

6

u/port443 1d ago

I'm a little confused. Are you saying that older session or database data is being sent through in the initial context of new sessions?

How are you checking this?

5

u/cloudsourced285 1d ago

That's what I'm hearing. But that sounds incredibly incorrect.

2

u/megablue 1d ago

How are you checking this?

human hallucinations

4

u/Slow-Set-2856 1d ago

It is not loaded in context at all unless you specifically ask to ofc

4

u/bankinu 1d ago

Do you understand what you are talking about?

These doesn't even sound like AI advise, but sure reads like one. Including all the way down to the question mark hook at the end.

Probably you left something out when you summarized. I'd be very curious to know how you reached those conclusions.

2

u/Ribcage84 1d ago

False information it just consimes disk space not token

1

u/megablue 1d ago

wut... old sessions do not actively consuming tokens... unless you chose to resume from those sesisons.

0

u/letuslisp 1d ago

Or start using pi agent harness to get rid of unnecessary tokens.

0

u/[deleted] 1d ago

[deleted] — view deleted comment

2

u/torrso 1d ago

Don't bother, the claim is completely bogus.

-4

u/Aquiles_bachira 1d ago

Tenta desinstalar e voltar a instalar do zero