Skip to content

[FEATURE]: Add "soft deny" permission action for self-correcting AI behavior #9651

Closed

Description

@awikman

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

Currently, the permission system has three actions: allow, ask, and deny. When a command is denied, execution halts with an error. This is problematic when the AI could simply try an alternative approach.

Example config:

{
  "permission": {
    "bash": {
      "find *": "soft deny",
      "python tests/*": "soft deny"
    }
  }
}

Generic use case: Configure find * with "soft deny" so that when the AI tries bash command find, it receives a message like "That bash command is not allowed. Try using another tool, instead of bash" and hopefully will naturally self-correct.

My use case: The AI tries constantly to run tests using bash commands python tests/..., which fails because it does not have permission to run python. I'd like opencode to tell the AI to use my custom mcp server that can run tests, if it tries to run bash python test*. Some models just wont listen to instructions on this...

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 20, 2026
  2. github-actions commented on Jan 20, 2026

    @github-actions
    Contributor

    This issue has several related feature requests that share similar goals of improving the permission system and tool guidance:

    While not exact duplicates, these issues complement your feature request. In particular, #9552, #9548, and #9461 would help make 'soft deny' more effective by making alternative MCP tools discoverable to the AI when bash is denied.

  3. rekram1-node commented on Jan 20, 2026

    @rekram1-node
    Contributor

    You can use continue_loop_on_deny in the experimental section of ur cfg btw

  4. awikman commented on Jan 20, 2026

    @awikman
    Author

    Hmm... When I was testing this before, the model just stopped, without output. So I assumed opencode stopped it. But on further digging, it seems like it only stopped because of the deny message caused it to to stop:

    packages/opencode/src/permission/next.ts

    `The user has specified a rule which prevents you from using this specific tool call. Here are some of the relevant rules ${JSON.stringify(ruleset)}`,
    

    Some models just give up because of that response from using the tool.
    So what I really need is it to be more soft with the response, and suggesting to the AI to do something else. Having a custom message for specific permission would be optimal.
    Something like:

        "permission": {                                                                                                                                                                                                                                           
            "bash": {                                                                                                                                                                                                                                             
                "python test/*": {"deny": "This tool call is not allowed. use test_tool_run_test instead"}                                                                                                                                                                                                                                       
    

    For now, I think I'll try to convince the model not to give up on that response in AGENTS.md

  5. awikman commented on Jan 30, 2026

    @awikman
    Author

    Going to close this, because better instruction in AGENTS.md was good enough.

  6. disbolog commented on Feb 13, 2026

    @disbolog

    I'd like to see this reopened, because AGENTS.md in such a case is a snake oil non-solution.

  7. mathe00 commented on Feb 13, 2026

    @mathe00

    I'd like to see this reopened, because AGENTS.md in such a case is a snake oil non-solution.

    up. I agree.

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

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions