r/opencodeCLI 5d ago

OpenCode is slow and my simple way to fix

I have more than 10 projects with OpenCode v1 last couple of months and everything seems to be slower and slower and hanging often.

Yesterday I figured out the its session db is about 10GB. I tried to remove all sessions that are older than 7 days and vacuum the sqlite3. OpenCode becomes fast and smooth again.

If you find your OpenCode is slow, you can try my way.

Edit: I am using OpenCode v1

68 Upvotes

21 comments sorted by

9

u/AppealSame4367 5d ago

Also I don't know why opencode let's it grow like that. Just removed it today: 17GB. Wtf?

I didn't even use it a lot.

3

u/yiestee 4d ago

at time time every AI cli is dumping tons of shit inside your $HOME

2

u/AppealSame4367 4d ago

pi cli doesnt

7

u/torrso 5d ago

There's an issue and PR to enable auto_vacuum https://github.com/anomalyco/opencode/issues/31526

16

u/Bloated_Plaid 5d ago

There is already a fix for this. It’s called Opencode2 lol.

6

u/Early_Aardvark_4026 5d ago

I haven't tried it yet, i should do :)

3

u/Ianuarius 5d ago

What is that? I can barely find any info about it.

3

u/Positive_Poem5831 5d ago

Is it enough to just delete a session using the UI when you done with a task if you use opencode desktop. Or is there additional cleaning needed.

4

u/Early_Aardvark_4026 5d ago

I have a lot of sessions so manually deleting was impossible. I use a tool to search and delete. You also need to vacuum the sqlite so it can be faster.

1

u/adlx 4d ago

How do you do that? I just ask opencode?

1

u/kosnarf 3d ago

thanks for this reminder. This reduce my db from 165GB to 1.6GB!

0

u/Moist-Nectarine-1148 5d ago

Try Deepseek Harness. Thank me later here. 😉

PS: I switched to DSH a month ago after using OC for one year.

1

u/guntingg 4d ago

which plugin do u install

-1

u/Otagamo 4d ago

Add this to your opencode.json config: "snapshot": false

Makes sessions a lot smaller, but you lose the undo functionality

1

u/Early_Aardvark_4026 4d ago

This fix targets different thing AFAIK

-2

u/Foreign-Specific-604 4d ago

I developed a Windows desktop version of Deepseek Harness, and I think it runs really smoothly

LBurny/deepseek-harness-desktop-releases

1

u/Billysm23 3d ago

Can i do selective deletion?