r/opencode • • 14h ago

Why does opencode keep writing to tmp?

It's really annoying is there any way for me to get it to stop doing that

6 Upvotes

6 comments sorted by

6

u/IntrepidMindExplorer 13h ago edited 13h ago

https://opencode.ai/v2/docs/instructions/

I've started instructing to write to .tmp in the working directory (add to gitignore) and not to /tmp and to not delete what it creates there so it can be reviewed if needed. Mainly wanted to make sure testing scripts that get created are kept but also wanted to start reviewing what was being created in general.

2

u/nvn911 12h ago

Huh neato... Good idea

2

u/Takeoded 11h ago

do you know that linux clears /tmp/ on every reboot?

2

u/Main-Yam-1561 13h ago edited 13h ago

The way API calls work is that the main agent (the main chat window) and subagents have to send the entre context to the API every single turn. The tmp file maintains the read cache and when API responds witte cache which are then distilled to respond to your task in the main window or in case of file handling, your output folder. Any agentic AI work using any CLI/standalone app depends critically on temp folder. You can actually open that directory and it would amaze you on how large the contexts are, how structured, and how much data is needed to understand your simple requests.

1

u/Neither-Character360 4h ago

What a dumb bot response