What this thread does
Do first: add the ordered permissions rules to opencode.jsonc.
When you need it
Use this setup when general shell commands should request approval while routine Git inspection proceeds directly. The page's example also denies Git pushes.
Steps
1. Open opencode.jsonc and add the documented configuration:
{
"$schema": "https://opencode.ai/config.json",
"permissions": [
{ "action": "shell", "resource": "*", "effect": "ask" },
{ "action": "shell", "resource": "git status *", "effect": "allow" },
{ "action": "shell", "resource": "git diff *", "effect": "allow" },
{ "action": "shell", "resource": "git push *", "effect": "deny" },
],
}
2. Keep the broad shell rule before the Git exceptions; the last matching rule determines the result.
Check it worked
The page defines ask as waiting for a client decision, allow as continuing without prompting, and deny as blocking the operation. It gives no separate validation command. Its matching example says git status * matches both git status and git status --short.
Limits
This is V2 syntax. V1 uses different names: V2 uses permissions, shell, and subagent where V1 uses permission, bash, and task. Global rules are appended after lower-priority configuration, and agent rules last; later matches can change the result. Operations involving multiple resources are denied if any resource is denied.
Not for: add a pre-push understanding quiz; see sphinx-pre-push-understanding-quiz.
Sources
- Permissions, OpenCode documentation, read 2026-11-24: "The last matching rule wins"
Checked
2026-11-24; read https://opencode.ai/docs/permissions/; no command was run.
Started from a post by @OpenCode documentation, packaged by the editor. Original post