Plan Agent does modifications to files. #1777

Open
opened 2026-02-16 17:32:35 -05:00 by yindo · 12 comments
Owner

Originally created by @juri-diener on GitHub (Sep 20, 2025).

Originally assigned to: @rekram1-node on GitHub.

Hello I encountering that when I'm in the plan mode. It sometimes does modification to my codebase.

This should never be happen. And sometimes in plan mode i get an error that it could not create me code examples in the chat so that i could just look up what the agent would be doing.

This all worked in version v0.3.133 now in version v0.911 it's broken.

This is really unpleasant, it stops the workflow. I hope you guys can fix this in later releases.

Thanks for a such good tool.

Originally created by @juri-diener on GitHub (Sep 20, 2025). Originally assigned to: @rekram1-node on GitHub. Hello I encountering that when I'm in the plan mode. It sometimes does modification to my codebase. This should never be happen. And sometimes in plan mode i get an error that it could not create me code examples in the chat so that i could just look up what the agent would be doing. This all worked in version v0.3.133 now in version v0.911 it's broken. This is really unpleasant, it stops the workflow. I hope you guys can fix this in later releases. Thanks for a such good tool.
Author
Owner

@rekram1-node commented on GitHub (Sep 20, 2025):

@juri-diener mind updating to latest?

The plan agent can't made modifications to files, it does have bash commands but they require approvals so maybe the llm tried to run a bash command that had some side effects to edit a file?

We should probably do better prompting but maybe you can share the session and/or your config?

@rekram1-node commented on GitHub (Sep 20, 2025): @juri-diener mind updating to latest? The plan agent can't made modifications to files, it does have bash commands but they require approvals so maybe the llm tried to run a bash command that had some side effects to edit a file? We should probably do better prompting but maybe you can share the session and/or your config?
Author
Owner

@NaikSoftware commented on GitHub (Sep 20, 2025):

I created a similar ticket https://github.com/sst/opencode/issues/2631
There are two problems:

  1. Any action MUST be approved with default settings, no matter how the internal team uses it (with or without approvals)
  2. Plan agent and subagents should not have access to bash (expect whitelisted commands for search) and file edit/delete
@NaikSoftware commented on GitHub (Sep 20, 2025): I created a similar ticket https://github.com/sst/opencode/issues/2631 There are two problems: 1. Any action MUST be approved with default settings, no matter how the internal team uses it (with or without approvals) 2. Plan agent and subagents should not have access to bash (expect whitelisted commands for search) and file edit/delete
Author
Owner

@dimaportenko commented on GitHub (Sep 21, 2025):

hi @rekram1-node, here is link to promt in plan mode https://opencode.ai/s/HX172WVg#msg_96d9ad80b001HTIN6cib3E5V17-0, it's ended up in code changes.

@dimaportenko commented on GitHub (Sep 21, 2025): hi @rekram1-node, here is link to promt in plan mode https://opencode.ai/s/HX172WVg#msg_96d9ad80b001HTIN6cib3E5V17-0, it's ended up in code changes.
Author
Owner

@juri-diener commented on GitHub (Sep 23, 2025):

@juri-diener mind updating to latest?

The plan agent can't made modifications to files, it does have bash commands but they require approvals so maybe the llm tried to run a bash command that had some side effects to edit a file?

We should probably do better prompting but maybe you can share the session and/or your config?

I encountered it again:

this is what is executed on the Plan Mode:
Shell Add setLocalLiked before calling likeRespItem

$ cd /Users/juridiener/Projects/react-native/expo-apps/app-connects &&
sed -i '' 's/ likeRespItem(respId, !liked);/
setLocalLiked(!localLiked);\n likeRespItem(respId, !localLiked);/'
src/components/RespItem/index.tsx

Config:
{
"$schema": "https://opencode.ai/config.json",
"theme": "system",
"autoupdate": true,
"permission": {
"bash": {
"install": "deny",
"uninstall": "deny",
"rm": "deny",
"rmdir": "deny",
"del": "deny",
"amplify*": "deny",
"git*": "ask",
"grep": "allow",
"glob": "allow",
"*": "allow"
}
}
}

@juri-diener commented on GitHub (Sep 23, 2025): > [@juri-diener](https://github.com/juri-diener) mind updating to latest? > > The plan agent can't made modifications to files, it does have bash commands but they require approvals so maybe the llm tried to run a bash command that had some side effects to edit a file? > > We should probably do better prompting but maybe you can share the session and/or your config? I encountered it again: this is what is executed on the Plan Mode: Shell Add setLocalLiked before calling likeRespItem $ cd /Users/juridiener/Projects/react-native/expo-apps/app-connects && sed -i '' 's/ likeRespItem(respId, !liked);/ setLocalLiked(!localLiked);\n likeRespItem(respId, !localLiked);/' src/components/RespItem/index.tsx Config: { "$schema": "https://opencode.ai/config.json", "theme": "system", "autoupdate": true, "permission": { "bash": { "*install*": "deny", "*uninstall*": "deny", "*rm*": "deny", "*rmdir*": "deny", "*del*": "deny", "amplify*": "deny", "git*": "ask", "grep": "allow", "glob": "allow", "*": "allow" } } }
Author
Owner

@rekram1-node commented on GitHub (Sep 24, 2025):

@juri-diener you should remove that "*": "allow" and you will should stop having this issue

right now you are overriding the plan agent permissions and giving it the ability to make edits without approval

@rekram1-node commented on GitHub (Sep 24, 2025): @juri-diener you should remove that "*": "allow" and you will should stop having this issue right now you are overriding the plan agent permissions and giving it the ability to make edits without approval
Author
Owner

@stefanstifter commented on GitHub (Oct 2, 2025):

can confirm it happened to me too the other day.
i was in a longer interaction with opencode, switching back and forth between "plan" and "build" mode. at some point in "plan" mode opencode edited existing files and created new files.
not exactly sure what was going on or how to reproduce.
i don’t have any custom config, just running defaults.
opencode version: 0.13.7
might be related to having a second opencode process running in another tmux window (possibly in build mode at the same time)?
i’ll try to debug further and report back if i can reproduce.
thanks anyways for the hard work and great tool! ✌️

@stefanstifter commented on GitHub (Oct 2, 2025): can confirm it happened to me too the other day. i was in a longer interaction with opencode, switching back and forth between "plan" and "build" mode. at some point in "plan" mode opencode edited existing files and created new files. not exactly sure what was going on or how to reproduce. i don’t have any custom config, just running defaults. opencode version: 0.13.7 might be related to having a second opencode process running in another tmux window (possibly in build mode at the same time)? i’ll try to debug further and report back if i can reproduce. thanks anyways for the hard work and great tool! ✌️
Author
Owner

@rekram1-node commented on GitHub (Oct 2, 2025):

thx for sharing will take a look

@rekram1-node commented on GitHub (Oct 2, 2025): thx for sharing will take a look
Author
Owner

@berenar commented on GitHub (Oct 24, 2025):

Hi @juri-diener, please upgrade to the latest version v0.15.16, this should be fixed

@berenar commented on GitHub (Oct 24, 2025): Hi @juri-diener, please upgrade to the latest version [v0.15.16](https://github.com/sst/opencode/releases/tag/v0.15.16), this should be fixed
Author
Owner

@juri-diener commented on GitHub (Oct 29, 2025):

Hi @juri-diener, please upgrade to the latest version v0.15.16, this should be fixed

Okay thanks i will try it. Do I need to change my config? Because of the "*" or is it now handled correctly that everything is allowed except that where i have ask or deny permission set.

"bash": {
"install": "deny",
"uninstall": "deny",
"rm": "deny",
"rmdir": "deny",
"del": "deny",
"amplify*": "deny",
"git*": "ask",
"grep": "allow",
"glob": "allow",
"*": "allow"
}

@juri-diener commented on GitHub (Oct 29, 2025): > Hi [@juri-diener](https://github.com/juri-diener), please upgrade to the latest version [v0.15.16](https://github.com/sst/opencode/releases/tag/v0.15.16), this should be fixed Okay thanks i will try it. Do I need to change my config? Because of the "*" or is it now handled correctly that everything is allowed except that where i have ask or deny permission set. "bash": { "install": "deny", "uninstall": "deny", "rm": "deny", "rmdir": "deny", "del": "deny", "amplify*": "deny", "git*": "ask", "grep": "allow", "glob": "allow", "*": "allow" }
Author
Owner

@rekram1-node commented on GitHub (Oct 29, 2025):

@juri-diener u need to wildcard them I recommend doing it:

"install*": "deny"

etc

@rekram1-node commented on GitHub (Oct 29, 2025): @juri-diener u need to wildcard them I recommend doing it: "install*": "deny" etc
Author
Owner

@stefanstifter commented on GitHub (Dec 9, 2025):

can confirm it happened to me too the other day. i was in a longer interaction with opencode, switching back and forth between "plan" and "build" mode. at some point in "plan" mode opencode edited existing files and created new files. not exactly sure what was going on or how to reproduce. i don’t have any custom config, just running defaults. opencode version: 0.13.7 might be related to having a second opencode process running in another tmux window (possibly in build mode at the same time)? i’ll try to debug further and report back if i can reproduce. thanks anyways for the hard work and great tool! ✌️

quick follow up from my side: after some updates, especially since versions above 1.0.0, this behavior never showed up again. i could not reproduce it anymore. seems to be fixed on my setup. thanks again for the great work ✌️

@stefanstifter commented on GitHub (Dec 9, 2025): > can confirm it happened to me too the other day. i was in a longer interaction with opencode, switching back and forth between "plan" and "build" mode. at some point in "plan" mode opencode edited existing files and created new files. not exactly sure what was going on or how to reproduce. i don’t have any custom config, just running defaults. opencode version: 0.13.7 might be related to having a second opencode process running in another tmux window (possibly in build mode at the same time)? i’ll try to debug further and report back if i can reproduce. thanks anyways for the hard work and great tool! ✌️ quick follow up from my side: after some updates, especially since versions above 1.0.0, this behavior never showed up again. i could not reproduce it anymore. seems to be fixed on my setup. thanks again for the great work ✌️
Author
Owner

@Straffern commented on GitHub (Dec 11, 2025):

I had this config:

  "agent": {
    // Build agent - full capability with slight creativity
    "build": {
      "temperature": 0.3
    },
    // Plan agent - read-only analysis, no file writes
    "plan": {
      "temperature": 0.1,
      "tools": {
        "write": false,
        "edit": false,
        "patch": false
      },
      "permission": {
        "bash": {
          "jj status": "allow",
          "jj st": "allow",
          "jj diff*": "allow",
          "jj log*": "allow",
          "jj show*": "allow",
          "bd *": "allow",
          "rg *": "allow",
          "tree *": "allow",
          "wc *": "allow",
          "head *": "allow",
          "tail *": "allow",
          "mix format*": "allow",
          "mix compile*": "allow",
          "mix test*": "allow",
          "pnpm exec tsc*": "allow",
          "pnpm run lint*": "allow",
          "pnpm test*": "allow",
          "*": "deny"
        }
      }
    },
  },

The plan agent then spawned General agent, that then had permission to edit files and proceeded to implement.
Is there a way to deny access to agents that have edit/write capabilities?
eg. research-agent: allow
general: deny

@Straffern commented on GitHub (Dec 11, 2025): I had this config: ``` "agent": { // Build agent - full capability with slight creativity "build": { "temperature": 0.3 }, // Plan agent - read-only analysis, no file writes "plan": { "temperature": 0.1, "tools": { "write": false, "edit": false, "patch": false }, "permission": { "bash": { "jj status": "allow", "jj st": "allow", "jj diff*": "allow", "jj log*": "allow", "jj show*": "allow", "bd *": "allow", "rg *": "allow", "tree *": "allow", "wc *": "allow", "head *": "allow", "tail *": "allow", "mix format*": "allow", "mix compile*": "allow", "mix test*": "allow", "pnpm exec tsc*": "allow", "pnpm run lint*": "allow", "pnpm test*": "allow", "*": "deny" } } }, }, ``` The plan agent then spawned General agent, that then had permission to edit files and proceeded to implement. Is there a way to deny access to agents that have edit/write capabilities? eg. research-agent: allow general: deny
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1777