Skip to content

[FEATURE]: Add more granular command approval options for project and global persistence #59623

Open

Description

@sanathusk

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

The command approval prompt currently only offers two choices:

  • Allow once
  • Always allow
  • Reject.

This is useful, but it does not support the common expectation that a user may want to approve a command permanently for either the current project or across all projects.

I’d like to add more explicit permission options when the agent asks to run a command:

  • Allow once
  • Allow in session
  • Always allow in project
  • Always allow globally
  • Reject

This would make the approval model more flexible and reduce repeated prompts for commands the user trusts.

Expected behavior:

  • Allow once: permit this command only for the current invocation.
  • Allow in session: permit this command for the remainder of the current session.
  • Always allow in project: persist the decision in the project-level config (for example in the project’s opencode.json file).
  • Always allow globally: persist the decision in the user’s global config so it applies across projects.
  • Reject - the current behaviour

Benefits:

  • Fewer repeated approval prompts for trusted commands.
  • Clear separation between temporary and persistent approvals.
  • Better UX for commands that are safe and commonly used in a project or across many projects.
  • Easier user trust management without forcing them to re-authorize the same command repeatedly.

This would make the permission flow more explicit and align with the expectation of session-scoped, project-scoped, and global-scoped approval decisions.

Activity

  1. opencode-agent commented on Oct 27, 2026

    @opencode-agent
    Contributor

    Thanks for the suggestion, @sanathusk! You'd like the command approval prompt to let you choose how long an approval lasts: once, for this session, always for this project (saved in the project's opencode.json), or always for every project (saved in your global config).

    In OpenCode v2 the prompt currently offers Allow once, Always allow and Reject. Always allow already saves the approval for the current project and keeps it across sessions and restarts. It's stored in OpenCode's local database rather than in opencode.json, and there's no session-only or global option yet. If your prompt shows "Allow in session", could you tell us your opencode --version? Only critical bugs get fixed in v1 (0.x/1.x), so please check on v2.

    Maintainers will consider this. A plugin can't add it today because plugins can't add options to the approval prompt.

    Related issues:

  2. jo7ueb commented on Nov 24, 2026

    @jo7ueb

    Request

    Strong +1. Please prioritize an explicit Always allow globally option alongside project-scoped approval.

    The approval should:

    • Be recorded automatically when selected in the TUI.
    • Persist across sessions and application restarts.
    • Apply across existing and future projects.
    • Preserve permission prompts for unapproved operations.
    • Respect explicit deny rules.
    • Be inspectable and revocable by the user.

    I would appreciate an early implementation of global persistent approvals, even if the other proposed approval scopes need to follow later.

    Motivation

    While working across repositories, I am repeatedly interrupted to approve operations I have already explicitly trusted elsewhere.

    A manually maintained global allowlist is not an adequate substitute. As tasks evolve, users would have to continually edit configuration files to record decisions they have already made through the permission UI.

    Disabling permissions altogether is obviously not an acceptable workaround either.

    For multi-project, semi-autonomous agent workflows, this is a serious execution bottleneck. Repeated approval prompts encourage approval fatigue, which ultimately undermines the effectiveness of the permission system itself.

    Experimental findings

    I investigated the repeated permission prompts on my own installation (OpenCode v2.4.0).

    • Both the CLI and the running server reported v2.4.0.
    • A read-only SQLite query returned 235 saved approval records across 7 project IDs.
    • The pattern ls * was stored separately for all 7 projects, and git status * for 4 projects.
    • GET /api/permission/saved initially returned an empty list, but explicitly supplying the project ID returned the corresponding saved approvals. The approvals were therefore being persisted.
    • I tested git status, git log -1, and git remote -v as separate shell calls in the same project. The first two ran without prompting; the third, which was already approved in another project but not in this one, prompted again.
    • After approving the remaining command, repeating a compound command using && worked without another prompt.

    I therefore could not reproduce a persistence or compound-command evaluation bug in this controlled test.

    However, hundreds of saved approvals illustrate how poorly project-only persistence scales. Compound-command prompts can also make it difficult to distinguish newly requested permissions from previously approved ones.

    Thank you for working on OpenCode.

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

Metadata

Metadata

Assignees

No one assigned

    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