Feature Request: Add "ask before editing files" mode #677

Closed
opened 2026-02-16 17:27:51 -05:00 by yindo · 23 comments
Owner

Originally created by @andreimaxim on GitHub (Jul 12, 2025).

Originally assigned to: @adamdotdevin on GitHub.

I know this might be controversial, since most people seem to give AI agents a set of task and let them figure it out, but here it goes...

The codebases I work in tend to have a lot of legacy code (I frequently edit code that was written 7+ years) and I need to be very strategic about the changes I make. AI agents, especially Claude, tend to edit a lot of code and often their style does not match the one in the codebase, so just looking at the final version of the code means I will have a lot of code to edit. So I tend to use Claude Code a lot in its normal mode because Claude will show me a diff before editing a file, which I can reject and explain what to do better, and the AI agent starts to pick up on what I want so the next files tend to be closed to what I want.

A couple of days ago, opencode added custom modes, which allow you to customize what model you're using and what they're allowed to do. Unfortunately, the settings are boolean, meaning they are either enabled or disabled.

What I'd like to suggest is to switch to "allow", "deny", and "ask" instead of boolean values (so basically add a third mode). A sample configuration would look like this:

{
  "mode": {
    "readonly": {
      "tools": {
        "write": "ask",
        "edit": "ask",
        "bash": "allow",
        "read": "allow",
        "grep": "allow",
        "glob": "allow"
      }
    }
  }
}

When the value is "ask" and opencode would add or edit a file, it should show the diff and ask before applying the changes.

As I said above, I understand this might be controversial and could be rejected, but I thought it's worth asking for it and maybe it could appear down the line.

Thank you for the awesome project!

Originally created by @andreimaxim on GitHub (Jul 12, 2025). Originally assigned to: @adamdotdevin on GitHub. I know this might be controversial, since most people seem to give AI agents a set of task and let them figure it out, but here it goes... The codebases I work in tend to have a lot of legacy code (I frequently edit code that was written 7+ years) and I need to be very strategic about the changes I make. AI agents, especially Claude, tend to edit a lot of code and often their style does not match the one in the codebase, so just looking at the final version of the code means I will have a lot of code to edit. So I tend to use Claude Code a lot in its normal mode because Claude will show me a diff before editing a file, which I can reject and explain what to do better, and the AI agent starts to pick up on what I want so the next files tend to be closed to what I want. A couple of days ago, opencode added custom modes, which allow you to customize what model you're using and what they're allowed to do. Unfortunately, the settings are boolean, meaning they are either enabled or disabled. What I'd like to suggest is to switch to "allow", "deny", and "ask" instead of boolean values (so basically add a third mode). A sample configuration would look like this: ```json { "mode": { "readonly": { "tools": { "write": "ask", "edit": "ask", "bash": "allow", "read": "allow", "grep": "allow", "glob": "allow" } } } } ``` When the value is "ask" and opencode would add or edit a file, it should show the diff and ask before applying the changes. As I said above, I understand this might be controversial and could be rejected, but I thought it's worth asking for it and maybe it could appear down the line. Thank you for the awesome project!
yindo closed this issue 2026-02-16 17:27:51 -05:00
Author
Owner

@ilkerhk commented on GitHub (Jul 13, 2025):

I agree this would be very valuable. I think we can't be able to let agents work totally independently.

For example, during a multistep but relatively simple task, opencode with sonnet-4, decided to divide a file into two, and then create a new pip environment install packages in it etc.

I had no option to interrupt and guide it. Just watched it. An option similar to Claude-Code would be nice for the "ask" config above: either approve or alternatively do it in another way (using a guidance from the user)

Thanks for the nice work !

@ilkerhk commented on GitHub (Jul 13, 2025): I agree this would be very valuable. I think we can't be able to let agents work totally independently. For example, during a multistep but relatively simple task, opencode with sonnet-4, decided to divide a file into two, and then create a new pip environment install packages in it etc. I had no option to interrupt and guide it. Just watched it. An option similar to Claude-Code would be nice for the "ask" config above: either approve or alternatively do it in another way (using a guidance from the user) Thanks for the nice work !
Author
Owner

@nandilugio commented on GitHub (Jul 15, 2025):

Yep, definitely agree. This is something that also would make much sense when generating bash commands. There's normally no undo there so I'd like to be prompted to review the commands before running them.

Of course you can ask the model to do so but that's not reliable enough for certain kind of task.

And again, thanks for the great work!

@nandilugio commented on GitHub (Jul 15, 2025): Yep, definitely agree. This is something that also would make much sense when generating bash commands. There's normally no undo there so I'd like to be prompted to review the commands before running them. Of course you can ask the model to do so but that's not reliable enough for certain kind of task. And again, thanks for the great work!
Author
Owner

@rogercost commented on GitHub (Jul 16, 2025):

Agreed - I am not comfortable letting an agent write code unsupervised. Cline and Claude Code, my two other favorites, ask for my approval for each diff they make, and I reject about 20% of them, providing feedback to get the AI back on track. Without the ability to do this I will have a hard time trusting Opencode to make significant changes.

@rogercost commented on GitHub (Jul 16, 2025): Agreed - I am not comfortable letting an agent write code unsupervised. Cline and Claude Code, my two other favorites, ask for my approval for each diff they make, and I reject about 20% of them, providing feedback to get the AI back on track. Without the ability to do this I will have a hard time trusting Opencode to make significant changes.
Author
Owner

@k3d3 commented on GitHub (Jul 17, 2025):

I fully agree with rogercost - I'm constantly rejecting and rewriting prompts to get Claude Code to better write its output.

One thing I will add here, is I quite like how Claude Code handles permissions. They give you the ability to specify in decent detail what things are and aren't allowed, in a json file in .claude:

{
  "permissions": {
    "allow": [
      "Bash(cargo check:*)",
      "Bash(mkdir:*)",
      "WebFetch(domain:github.com)",
      "WebFetch(domain:book.leptos.dev)",
      "WebFetch(domain:lib.rs)",
      "WebFetch(domain:docs.rs)"
    ],
    "deny": []
  }
}

Those are added automatically when I specify to not ask again for the session, but I do like that I can also go into the json and modify or add entries myself.

@k3d3 commented on GitHub (Jul 17, 2025): I fully agree with rogercost - I'm constantly rejecting and rewriting prompts to get Claude Code to better write its output. One thing I will add here, is I quite like how Claude Code handles permissions. They give you the ability to specify in decent detail what things are and aren't allowed, in a json file in `.claude`: ``` { "permissions": { "allow": [ "Bash(cargo check:*)", "Bash(mkdir:*)", "WebFetch(domain:github.com)", "WebFetch(domain:book.leptos.dev)", "WebFetch(domain:lib.rs)", "WebFetch(domain:docs.rs)" ], "deny": [] } } ``` Those are added automatically when I specify to not ask again for the session, but I do like that I can also go into the json and modify or add entries myself.
Author
Owner

@k3d3 commented on GitHub (Jul 25, 2025):

I apologize as I really don't want to spam this issue, but this issue is literally the one and only thing stopping me from using opencode. Everything else about this project looks fantastic.

I also don't want to sound demanding - I understand I'm not paying for it (though I would be interested in offering a bounty for this issue, if possible), I haven't contributed code to it, and that this project is not sponsored.

With that said, I'm curious @thdxr and @adamdotdevin if there's a status on this issue: whether it's in the works, on a roadmap, or not (yet/currently) planned.

Thank you!

@k3d3 commented on GitHub (Jul 25, 2025): I apologize as I really don't want to spam this issue, but this issue is literally the one and only thing stopping me from using opencode. Everything else about this project looks fantastic. I also don't want to sound demanding - I understand I'm not paying for it (though I would be interested in offering a bounty for this issue, if possible), I haven't contributed code to it, and that this project is not sponsored. With that said, I'm curious @thdxr and @adamdotdevin if there's a status on this issue: whether it's in the works, on a roadmap, or not (yet/currently) planned. Thank you!
Author
Owner

@jayair commented on GitHub (Jul 25, 2025):

@k3d3 you might've said this elsewhere but does the Plan mode not help you with this?

@jayair commented on GitHub (Jul 25, 2025): @k3d3 you might've said this elsewhere but does the Plan mode not help you with this?
Author
Owner

@andrewneilson commented on GitHub (Jul 25, 2025):

of course it does help in comparison to just "build" mode, but other tools do have this middle ground where you have a chance to catch unintended behaviour. I think the other messages in this issue explain it well.

@andrewneilson commented on GitHub (Jul 25, 2025): of course it does help in comparison to just "build" mode, but other tools do have this middle ground where you have a chance to catch unintended behaviour. I think the other messages in this issue explain it well.
Author
Owner

@Askath commented on GitHub (Jul 26, 2025):

The amount of times opencode completely messed up something because I couldn't check/approve what it is doing is insane. Even with plan mode. AI is not perfect, even with a plan. Being able to dismiss an execution saves A LOT of debugging time later on.

@Askath commented on GitHub (Jul 26, 2025): The amount of times opencode completely messed up something because I couldn't check/approve what it is doing is insane. Even with plan mode. AI is not perfect, even with a plan. Being able to dismiss an execution saves A LOT of debugging time later on.
Author
Owner

@nandilugio commented on GitHub (Jul 26, 2025):

Also executing shell commands. I was trying to get it read some TODOs from a git commit. For some reason it couldn't access git directly so "we"'ve decided to try using git from the shell. It required a lot of trial and error and all those errors I could have saved actually executing if I was promted to approve. Git is ok but other shell commands can have non reversible consequences. I'd definitely feel more comfortable if I could set "bash" to "ask" too.

@nandilugio commented on GitHub (Jul 26, 2025): Also executing shell commands. I was trying to get it read some TODOs from a git commit. For some reason it couldn't access git directly so "we"'ve decided to try using git from the shell. It required a lot of trial and error and all those errors I could have saved actually executing if I was promted to approve. Git is ok but other shell commands can have non reversible consequences. I'd definitely feel more comfortable if I could set "bash" to "ask" too.
Author
Owner

@nithin-raj-9100 commented on GitHub (Jul 26, 2025):

Today I told it to run du -sh . command directly (not even asked it how to see disk space instead directly told to use du -sh .)
opencode executed command and thought that lets delete this directory because its a large directory of 1.3 GB it deleted it instantly (had permissions feature were there this wouldn't have happened) and told me I deleted your directory sad I couldn't share the session because I was already frustrated

@nithin-raj-9100 commented on GitHub (Jul 26, 2025): Today I told it to run `du -sh .` command directly (not even asked it how to see disk space instead directly told to use du -sh .) opencode executed command and thought that lets delete this directory because its a large directory of 1.3 GB it deleted it instantly (had permissions feature were there this wouldn't have happened) and told me I deleted your directory sad I couldn't share the session because I was already frustrated
Author
Owner

@jd-santos commented on GitHub (Jul 26, 2025):

Glad to see this conversation, if only for the sanity check that I wasn't missing something in the docs. I'm coming from Cline and thought I had mistakenly enabled some kind of yolo mode when files started getting created and edited without any approval step.

The conversation around vibe coding makes a lot more sense now, I didn't realize y'all lived like this by default 😳

@jd-santos commented on GitHub (Jul 26, 2025): Glad to see this conversation, if only for the sanity check that I wasn't missing something in the docs. I'm coming from Cline and thought I had mistakenly enabled some kind of yolo mode when files started getting created and edited without any approval step. The conversation around vibe coding makes a lot more sense now, I didn't realize y'all lived like this by default 😳
Author
Owner

@jeremiahsmithdev commented on GitHub (Jul 27, 2025):

+1 for this. It's really important for me to be able to follow the changes that the agent makes to my codebase at my own pace. This becomes even more crucial as technical debt builds and the debugging sessions become longer. The user needs to become more involved and aware of how the code works at this stage. This feature in Claude Code allows you to both read the code changes at your own pace and guide them by prompting the agent to take different approaches. Absolutely essential in my eyes. I have a similar annoyance with Aider where it just goes ahead and commits all its changes without asking the user. This is a high level task that the user should handle in most cases. Although you can turn this off in Aider thankfully.

I'm currently extending a Neovim plugin for Claude Code which among other things, brings up the diff view in a Neovim buffer for you to accept/reject and then leaves the changed files open so you can browse and review the changes while the agent continues. Like the Claude Code VS Code extension. I was already thinking to extend it for opencode when I realized it does not ask before making code changes.

@jeremiahsmithdev commented on GitHub (Jul 27, 2025): +1 for this. It's really important for me to be able to follow the changes that the agent makes to my codebase at my own pace. This becomes even more crucial as technical debt builds and the debugging sessions become longer. The user needs to become more involved and aware of how the code works at this stage. This feature in Claude Code allows you to both read the code changes at your own pace and guide them by prompting the agent to take different approaches. Absolutely essential in my eyes. I have a similar annoyance with Aider where it just goes ahead and commits all its changes without asking the user. This is a high level task that the user should handle in most cases. Although you can turn this off in Aider thankfully. I'm currently extending a Neovim plugin for Claude Code which among other things, brings up the diff view in a Neovim buffer for you to accept/reject and then leaves the changed files open so you can browse and review the changes while the agent continues. Like the Claude Code VS Code extension. I was already thinking to extend it for opencode when I realized it does not ask before making code changes.
Author
Owner

@nikhilmaddirala commented on GitHub (Jul 27, 2025):

+100 This is the main thing stopping me from using opencode. Is there a reason for not providing this as an option?

@nikhilmaddirala commented on GitHub (Jul 27, 2025): +100 This is the main thing stopping me from using opencode. Is there a reason for not providing this as an option?
Author
Owner

@alexispurslane commented on GitHub (Jul 27, 2025):

I refuse to use opencode until this is a thing as well.

@alexispurslane commented on GitHub (Jul 27, 2025): I refuse to use opencode until this is a thing as well.
Author
Owner

@marcosktsz commented on GitHub (Jul 28, 2025):

+1

@marcosktsz commented on GitHub (Jul 28, 2025): +1
Author
Owner

@nandilugio commented on GitHub (Jul 28, 2025):

Guys remember this is not a product but an opensource project. There's no
obligation from the maintainers to develop anything. Let's just continue
to be grateful for what's already there and contribute here with ideas on
how to improve ❤️

On Mon, 28 Jul 2025, 15:28 Marco Caceffo, @.***> wrote:

marcosktsz left a comment (sst/opencode#935)
https://github.com/sst/opencode/issues/935#issuecomment-3127245186

+1


Reply to this email directly, view it on GitHub
https://github.com/sst/opencode/issues/935#issuecomment-3127245186, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AANF5KJ2UUGTILEXTIDDQU33KYQOFAVCNFSM6AAAAACBMDTLDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCMRXGI2DKMJYGY
.
You are receiving this because you commented.Message ID:
@.***>

@nandilugio commented on GitHub (Jul 28, 2025): Guys remember this is not a product but an opensource project. There's no obligation from the maintainers to develop anything. Let's just continue to be grateful for what's already there and contribute here with ideas on how to improve ❤️ On Mon, 28 Jul 2025, 15:28 Marco Caceffo, ***@***.***> wrote: > *marcosktsz* left a comment (sst/opencode#935) > <https://github.com/sst/opencode/issues/935#issuecomment-3127245186> > > +1 > > — > Reply to this email directly, view it on GitHub > <https://github.com/sst/opencode/issues/935#issuecomment-3127245186>, or > unsubscribe > <https://github.com/notifications/unsubscribe-auth/AANF5KJ2UUGTILEXTIDDQU33KYQOFAVCNFSM6AAAAACBMDTLDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCMRXGI2DKMJYGY> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

@jeremiahsmithdev commented on GitHub (Jul 28, 2025):

@nandilugio "Ideas on how to improve" - that's exactly what this is. I'd say if people are asking for a feature it means they like the project and would like to use it or contribute but may have a pain point.

So far the project is a wonderfully polished option for us terminal lovers and I wish it all the success. It would be great to have a more standardized open source CLI agent to Claude which people can build for with MCPs and editor integrations etc.

@jeremiahsmithdev commented on GitHub (Jul 28, 2025): @nandilugio "Ideas on how to improve" - that's exactly what this is. I'd say if people are asking for a feature it means they like the project and would like to use it or contribute but may have a pain point. So far the project is a wonderfully polished option for us terminal lovers and I wish it all the success. It would be great to have a more standardized open source CLI agent to Claude which people can build for with MCPs and editor integrations etc.
Author
Owner

@alexispurslane commented on GitHub (Jul 28, 2025):

Guys remember this is not a product but an opensource project. There's no
obligation from the maintainers to develop anything. Let's just continue
to be grateful for what's already there and contribute here with ideas on
how to improve ❤️

Agreed! In retrospect, I came across more harshly than I intended, I'd just had a wild experience trying opencode out and was coming right off the heat of that. But I joined in not to accuse, but to help make it clear this is wanted.

@alexispurslane commented on GitHub (Jul 28, 2025): > Guys remember this is not a product but an opensource project. There's no > obligation from the maintainers to develop anything. Let's just continue > to be grateful for what's already there and contribute here with ideas on > how to improve ❤️ > […](#) Agreed! In retrospect, I came across more harshly than I intended, I'd just had a wild experience trying opencode out and was coming right off the heat of that. But I joined in not to accuse, but to help make it clear this is wanted.
Author
Owner

@nikhilmaddirala commented on GitHub (Jul 28, 2025):

The maintainers should simply clarify between one of the following:

  1. Yes we want to address this issue, here is the progress so far and here is where we need contributions from the community.

  2. No we don't want to address this issue due to XYZ reasons.

@nikhilmaddirala commented on GitHub (Jul 28, 2025): The maintainers should simply clarify between one of the following: 1) Yes we want to address this issue, here is the progress so far and here is where we need contributions from the community. 2) No we don't want to address this issue due to XYZ reasons.
Author
Owner

@nithin-raj-9100 commented on GitHub (Jul 29, 2025):

The maintainers should simply clarify between one of the following:

  1. Yes we want to address this issue, here is the progress so far and here is where we need contributions from the community.
  2. No we don't want to address this issue due to XYZ reasons.

This is what I am expecting from them I lost my codebase with valuable changes for which I didn't push

@nithin-raj-9100 commented on GitHub (Jul 29, 2025): > The maintainers should simply clarify between one of the following: > > 1. Yes we want to address this issue, here is the progress so far and here is where we need contributions from the community. > 2. No we don't want to address this issue due to XYZ reasons. This is what I am expecting from them I lost my codebase with valuable changes for which I didn't push
Author
Owner

@thdxr commented on GitHub (Jul 29, 2025):

sorry few issues on this and didn't see this one

we're implementing this week - we've actually had support for permissions since day 1 on the backend, just need to expose it

@thdxr commented on GitHub (Jul 29, 2025): sorry few issues on this and didn't see this one we're implementing this week - we've actually had support for permissions since day 1 on the backend, just need to expose it
Author
Owner

@k3d3 commented on GitHub (Jul 29, 2025):

No worries at all - thanks for the update!

@k3d3 commented on GitHub (Jul 29, 2025): No worries at all - thanks for the update!
Author
Owner

@adamdotdevin commented on GitHub (Jul 31, 2025):

moving the conversation to #239

@adamdotdevin commented on GitHub (Jul 31, 2025): moving the conversation to #239
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#677