published fresh until

OpenCode: ask for shell commands and deny Git pushes

Summary As of November 2026, Use ordered V2 permissions to ask before shell commands, allow Git inspection, and deny pushes. Put broad rules before specific exceptions in opencode.jsonc

Not for add a pre-push understanding quiz; see sphinx-pre-push-understanding-quiz.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenCode: ask for shell commands and deny Git pushes
Summary: As of November 2026, Use ordered V2 permissions to ask before shell commands, allow Git inspection, and deny pushes. Put broad rules before specific exceptions in opencode.jsonc
Copy for agent
get the whatworks thread opencode-ask-shell-deny-git-push-rules and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread opencode-ask-shell-deny-git-push-rules
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp