Skip to content

[FEATURE]: Permissions separation #48806

Closed

Description

@AzazelHD

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

Hello everyone :)
Wondering if it was possible to allow opencode read on every file from a path, write only on cwd, and ask everywhere else? from a global config.
I've been searching on docs and i think not, because the closest thing will be adding edit to ask, but that will make opencode ask before writting on cwd too.

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr

    Thanks for the request, @AzazelHD!

    I think you can already do this with config, without a new feature. Here is how OpenCode v2 treats paths:

    • Paths inside the working directory (or the project's git worktree) count as internal. edit rules match them as relative paths.
    • Any other path triggers the external_directory permission (default ask), and rules match it as an absolute path.
    • Rules use last-match-wins, and * also matches /.

    So a global config (~/.config/opencode/opencode.json) like this should do what you want:

    {
      "$schema": "https://opencode.ai/config.json",
      "permission": {
        "read": "allow",
        "external_directory": {
          "*": "ask",
          "~/path/you/trust/**": "allow"
        },
        "edit": {
          "*": "allow",
          "/*": "ask"
        }
      }
    }
    • Inside the working directory, reads and edits are allowed without asking.
    • Under ~/path/you/trust/**, reads are allowed without asking. Edits still ask, because the absolute path matches "/*": "ask".
    • Anywhere else, you are asked first (external_directory).

    A few caveats:

    • "Internal" covers the project worktree as well as the exact cwd.
    • On Windows, absolute paths look like C:/..., so add a rule such as "?:*": "ask" to edit.
    • bash commands can still write files, so add bash rules if you need that to be strict too.

    More details are in the permissions docs. If this doesn't cover your case, please reply with what's missing and maintainers will consider it.

  2. Tarquinen commented on Nov 2, 2026

    @Tarquinen
    Member

    Thanks for the request! This can already be done with permission rules in your config, as described in the comment above. Closing this issue.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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