Skip to content

[FEATURE]: Each project should have a dedicated /tmp dir #49073

Open

Description

@behrangsa

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Each project should have a dedicated /tmp dir, possibly in the form of /tmp/opencode/{UUID}:

  • /tmp/opencode/b6ef6ccf.../
  • /tmp/opencode/1b433775.../
  • etc.

Maybe each session should have its own dedicated subdir too:

  • /tmp/opencode/b6ef6ccf.../92d52b4f.../
  • /tmp/opencode/1b433775.../1dfc26c2.../
  • etc.

At least it should be possible to toggle these features on/off.

Activity

  1. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your request is distinct from those, feel free to clarify the differences so maintainers can better scope this.

  2. mgrachten commented on Sep 15, 2026

    @mgrachten
    Contributor

    Beyond that, the /tmp/opencode pattern will fail when multiple users use opencode on the same system (/tmp/opencode won't by writable by user B's opencode if it was created by user A's opencode). A simple solution like /tmp/opencode-${UID} would mitigate this. This is what claude does.

  3. behrangsa commented on Sep 15, 2026

    @behrangsa
    Author

    Alternatively, instead of a UUID for the project, an idempotent/stable hash might also work.

    For example:

    • Project dir: /home/behrangsa/Projects/foo
    • Hash: echo "/home/behrangsa/Projects/foo" | sha256sum -> db823db54587807dc5599efbc293ebffdc08bf43feae923a98d54a9df5274b11
    • Temp dir: /tmp/opencode-db823db54587807dc5599efbc293ebffdc08bf43feae923a98d54a9df5274b11/
    • Session dir: /tmp/opencode-db823db54587807dc5599efbc293ebffdc08bf43feae923a98d54a9df5274b11/{session-id}/
  4. zatricky commented on Sep 26, 2026

    @zatricky

    We should anyway be using a subdir of $XDG_RUNTIME_DIR on Linux systems. Similar rules should apply to other systems. Putting it in a system-wide folder is naive.

    My workaround that I put into a comment elsewhere is an alias in my shell: alias opencode=TMPDIR=${XDG_RUNTIME_DIR} opencode

    I suppose you could change that to choose a hashed subfolder of that XDG_RUNTIME_DIR path. Either way, it's sub-optimal that this isn't there already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions