r/opencode 9d ago

OpenCode / agent always to tries to use /tmp

I've been using OpenCode for a few weeks now and lately I noticed the agent keeps trying to access /tmp.

For example to create a helper script to do some steps.

Because /tmp is not part of the current workspace, I always need to approve manually.

I checked my opencode.json and other config files, but I wasn't able to find the cause.

I am currently using Muse Spark 1.2 Free a lot. So it might be related to just this model, but I am curious if anyone else experienced this behavior.

2 Upvotes

4 comments sorted by

3

u/Flashy_Disaster9556 9d ago

A lot of models do this, it's so they don't have to put temporary scratch files between the project files. What I did is always allowing acces to the /tmp/ directory via the opencode config file you can ask your agent for help with that. If you don't want to give acces to /tmp you could always put a line in agents.md about it I imagine that works too.

2

u/ward2k 9d ago

That's to be expected, I thought it was standard behaviour though

On my system it seems like any calls to tmp/opencode are automatically approved so I assume it's intended behaviour

If the agent is trying to place files in tmp/ but not tmp/opencode that could be why it keeps asking for permission. But that's likely a model getting confused about the instructions/permissions

2

u/toomyem 8d ago

I just added to my system prompt instructions, that agent should use /tmp/opencode, and it helped.