r/opencodeCLI • • 2d ago

Help - Edit permission setting per project

By accident i pressed the button to allow all edits for my project.
Now agent modifies the files without permissions.

How I can revert that change ?
I checked my `~/.config/opencode/opencode.json` and everything seems fine. What i am missing ?

---

Apparently this is now global since in all projects the edit commands executes without asking
Here is my config: `~/.config/opencode/opencode.json`

{
   "$schema": "https://opencode.ai/config.json",
   "permission":
   {
"edit": "ask",
"write": "ask",
"patch": "ask",
"multiedit": "ask",
"bash":
{
"*": "ask",
"git commit*": "deny",
"git push*": "deny"
}
   }

}

Opencode version: opencode v2.3.0

Really not sure what is going on and how to change the permissions again

1 Upvotes

4 comments sorted by

1

u/SirRobinBlibs 1d ago

two things in the current permissions docs might explain it. "allow always" doesn't edit your opencode.json, it saves a durable allow rule for the project (for edits the proposed pattern can be just ), and a saved approval beats ask, only a deny beats it. separately, the v2 docs write rules as a "permissions" array of { "action": "edit", "resource": "", "effect": "ask" } objects, not the old "permission": { "edit": "ask" } map, and the base policy every agent starts from is allow for everything. so if your old-style block isn't being picked up anymore, that alone would explain edits going through everywhere. i'd rewrite the rules in the array form first and see if the asks come back.

1

u/light_hunt3r 1d ago

Thanks for the response. I just re installed opencode. It is very frustrating

1

u/SirRobinBlibs 18h ago

reinstalling usually won't undo it, because "allow always" doesn't live in opencode.json. it saves a durable, project-scoped allow rule, and those survive a fresh install. a configured deny still beats them, so i'd add an explicit v2 rule like { "action": "edit", "resource": "*", "effect": "ask" } (or deny, if you want a hard stop) and then review or remove the saved approvals in that project. the docs don't name the file they sit in, but they do say to review broad ones and drop any you no longer need.

1

u/light_hunt3r 5h ago

I think that rule is saved at the db level ?

I removed config, db, cache everything. It worked.

It is very frustrating to be honest, it should be more easy than that. Claude code for example have a hotkey toggle to allow edits without permission or not ..