You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: First-class tmpDir config — auto-create and pre-allow a scratch directory #28173
When OpenCode needs to use a temporary directory outside the workspace (e.g. for
intermediate files, scratch work, or agent plans), it currently triggers an external_directory permission prompt every time — even for a well-known, safe
scratch path like /tmp/opencode.
The workaround is to manually add an external_directory rule in opencode.json,
but this is not obvious, requires knowing the exact path in advance, and the
directory must be created separately.
Proposed Solution
Add a first-class tmpDir config key in opencode.json:
{
"tmpDir": "/tmp/opencode"
}
Behavior:
OpenCode auto-creates the directory on startup if it does not exist
All tool access to this directory is implicitly allowed (no external_directory
prompt) — equivalent to setting external_directory: { "<tmpDir>/**": "allow" }
Default value: /tmp/opencode (or a platform-appropriate equivalent)
Users/teams can override it to a project-local path if preferred
Why Not Just Use external_directory?
The current external_directory config works but requires manual setup, prior
knowledge of the path, and does not auto-create the directory. A dedicated tmpDir key makes the common case ergonomic and self-documenting.
This issue might be a duplicate of existing issues. Please check:
[FEATURE]: allow /tmp or $TMPDIR folder access option #4743: [FEATURE]: allow /tmp or $TMPDIR folder access option — same underlying request to allow access to temporary directories outside the workspace without repeated permission prompts
This issue might be a duplicate of existing issues. Please check:
[FEATURE]: allow /tmp or $TMPDIR folder access option #4743: [FEATURE]: allow /tmp or $TMPDIR folder access option — same underlying request to allow access to temporary directories outside the workspace without repeated permission prompts
this is related: I'd like to set opencode's tmp to /tmp/opencode it should not interfere with other tmp files.
it happens really several times daily that opencode asks for permission to tmp and it takes some time until I noticed that it stopped working and is waiting for a permission. I could allow tmp access in general, but actually I'd like to avoid unrestricted access to the whole /tmp
Activity
github-actions commentedon May 18, 2026
This issue might be a duplicate of existing issues. Please check:
ptandler commentedon May 18, 2026
this is related: I'd like to set opencode's tmp to
/tmp/opencodeit should not interfere with other tmp files.ptandler commentedon May 20, 2026
it happens really several times daily that opencode asks for permission to tmp and it takes some time until I noticed that it stopped working and is waiting for a permission. I could allow tmp access in general, but actually I'd like to avoid unrestricted access to the whole
/tmprekram1-node commentedon May 21, 2026
What version are u on? It should already do this
ptandler commentedon May 26, 2026
currently 1.15.10
I'm sure in the morning, one session asked again for permission to
/tmp/. Do I need to configure something?rekram1-node commentedon May 26, 2026
what model are u using, the agent is instructed to create things in $TMPDIR/opencode/* if it needs tmp access and htat dir is whitelisted
ptandler commentedon May 27, 2026
I usually use Claude Sonnet 4.6 (via Copilot subscription)
in my config I now white-listed the complete
/tmpfor nowptandler commentedon Jun 15, 2026
In case there is an update here, I'd gladly remove the
/tmpwhitelisting againgithub-actions commentedon Aug 15, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
zatricky commentedon Sep 15, 2026
My workaround based on the comments here is to set an alias in my shell config:
alias opencode=TMPDIR=${XDG_RUNTIME_DIR} opencodeI'm surprised that isn't already the default since raw $TMPDIR is an obsolete place to put user-specific files.