- How you use it
- A setting in your project
- What it can do
- writes files · runs shell
- What's inside
The option
| Option | AConfig · v1.0.0OpenCode permission merge template |
|---|---|
| How you use it | A setting in your project |
| What it can do | writes files · runs shell |
| What's inside |
What this thread does
As of November 2026, OpenCode V2 uses ordered permissions rules. V1's permission object and bash name are the older format. Permissions guide.
Do first: identify your OpenCode major version, then use its configuration format.
The problem
Most V2 actions default to allow. Narrow the shell permissions you grant.
The config (from the docs)
{
"permissions": [
{ "action": "shell", "resource": "*", "effect": "ask" },
{ "action": "shell", "resource": "git status *", "effect": "allow" },
{ "action": "shell", "resource": "rm *", "effect": "deny" },
{ "action": "shell", "resource": "git push *", "effect": "ask" },
{ "action": "external_directory", "resource": "*", "effect": "ask" }
]
}
Other things the docs cover
- Last match wins;
*and?are wildcards. A shell pattern ending in*also matches the command without arguments. - Default reads of
*.envand*.env.*ask;*.env.exampleis allowed. External-directory access defaults to allow.doom_loopandlspare not V2 Core permission actions. - Put agent rules under
agents.<id>.permissions; they append after global rules. Custom subagents have their own permissions. - Allow always saves proposed patterns for the project, rather than only the session.
Caveats
Shell commands retain the host user's authority; command scanning is not isolation. Prefer narrow allowlists.
Source: OpenCode V2 permissions.
Sources
Started from a post by @OpenCode documentation, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.