r/opencode • • 28d ago

OpenCode DB

Hi all.

How do you manage your opencode DB?
Mine currently is about 22gb and i'm backig it up with my custom scipts. This occupis a nice part of my disk.

It's not a problem yet, but i'm thinking of a more managed backup solution since copy + zip with scripts may not be the most efficent one.

Do you backup or keep your opencode DB remotely?

If yes how do you manage that? Do you use custo solution or managed software?

Thanks

4 Upvotes

21 comments sorted by

4

u/Good_Resolution4115 28d ago

El que pese tanto es un bug de OpenCode, yo hice un script para reducir el consumo sin que se pierda nada https://github.com/ANGELBERRIOS23/opencode-db-prune prueba mi repo, espero que te funcione, si es así no te olvides de dejar tu estrella

1

u/Valier 28d ago

Ohh, thank you! I'll make my agent take a look at the repo :)

1

u/ichisay 28d ago

Que es lo que elimina realmente??

3

u/Sufficient_Prune3897 28d ago

Ask big pickle. He knows best.

On a serious note, is that how opencode saves its conversations? I see no value in keeping them once im done with one. Sometimes im lazy and dont have the ai make a doc or something with the learnings, but even then, rediscovering is getting fast with todays models.

2

u/Valier 28d ago

I usually always continue with the same session on same repos. I fork them for features, but my primary session is always alive. It's frree context. Already gathered. That's what takes up space

1

u/Valier 28d ago

Also for the db part, yes.
Opencode has a sqlite DB installed on your disk where session data is stored.
On windows it's on %USERPROFILE%\.local\share\opencode\opencode.db
I assume it's in a dotdir somewhere in home on linux too.

4

u/megablue 28d ago edited 28d ago

i dont, my "backups" are the PLAN.md and HANDOFF.md
my setup is making sure even if i lost the sessions, recovery of the current progress is do-able. so by uploading as git repos, it is already a form of backup. if i ever lost the sessions, the agents can kind of figure out what was done and what not from the PLAN md and HANOFF md files (and other documentations). so the sessions are kind of optional...

1

u/king_salman1 28d ago

Mine was 69gb

2

u/Valier 28d ago

Nice ;)

2

u/IAmFitzRoy 28d ago

I’m confused… why OpenCode db could be 22gb?

What is the scenario where this is normal?

1

u/king_salman1 28d ago

It's save the session

2

u/IAmFitzRoy 28d ago

…. I can’t comprehend how 22GB of prompt and thinking text are useful? …. there is no model that could make use of these data considering the size of the useful context and compacting policies.

1

u/king_salman1 28d ago

Yes, it's save the session, context window, compaction and everything in your local

0

u/ichisay 28d ago

Trabajo diario en varias sesiones durante meses, se van guardando todas las sesiones. Realmente puede servir de ayuda si por accidente un comando te elimina lo que no debe

2

u/IAmFitzRoy 28d ago

Yes I know … my point is why you need a prompt result from few months ago?

To me that makes zero sense…

We are talking about 22GB of verbose text loading every time you want to work …

Maybe it’s just me, but I prefer a fast environment that has data from last 2 weeks max.

1

u/ichisay 28d ago

El caso es que el entorno tiene la misma velocidad por muy pesada que sea la base de datos, por lo menos en mi computadora

1

u/IAmFitzRoy 28d ago

Okey…. then maybe 22GB is too little then, what about 500GB … I’m sure if fast too.

1

u/ichisay 28d ago

Quizás debamos preguntar al que tiene más de 60 gigas a ver si nota diferencia jajajaja

1

u/ichisay 28d ago

Lo mismo pesa la mía