Harness Notes

Permissions

Updated 2026-11-25,

On this page

How to stop an agent doing something, and what each harness gives you to control it. Permission rules decide what the agent may do; a sandbox limits what a command can reach even when it is allowed.

Block a command, for example git push

OpenCode
How

A deny rule in the permission settings

Fileopencode.jsonc
Example
{
  "$schema": "https://opencode.ai/config.json",
  "permissions": [
    {
      "action": "shell",
      "resource": "*",
      "effect": "ask"
    },
    {
      "action": "shell",
      "resource": "git push *",
      "effect": "deny"
    }
  ]
}
How it matches

shell resources ending in space-star also match the command without arguments

What wins

last configured match wins; configured deny is evaluated before saved approvals and hooks

Watch out for

Shell directory inference is best effort and shell runs with host authority.

A later configured broad allow can override an earlier configured deny; saved approvals cannot.

What you can control

OpenCode
Decisions

allow, ask, deny

Permission rules

Built in

Cover: tool, command, path, external directory, skill, subagent, MCP

Match by: whole-value wildcards over action and resource

Conflicts: last configured match wins; agent rules append after global rules; configured deny survives saved approvals and permission hooks

Docs
Sandbox

Not established

external_directory is permission policy, not proof of OS containment.

Approval prompts

Built in

Remember an approval: once, project

Allow always stores durable project-scoped proposed patterns; reject declines all pending requests in the session.

2.1 adds client.permission.saved.update({ id, action?, resource? }) / PATCH /api/permission/saved/:id for changing a saved grant’s tool action or resource pattern. action names the permission subject, not allow/ask/deny; this does not add an editable decision effect. Duplicate project/action/resource combinations return conflict.

2.2.2 schedule `if`/`until` checks run a shell command in the session's directory, with no model call, before a schedule wakes the session. At fire time the check runs unattended: only the shell commands and external directories scanned from its own text are allowed, session permission rules still apply, and it is cut off after 30 seconds. Three failed checks in a row pause the schedule.

2.2.1+ image generation asks permission under the tool's own name (`experimental_image_generate` from 2.2.2; `image_generate` in 2.2.1) with the chosen model as the resource. Saving to a requested path also needs `edit`; image URLs need `webfetch`. From 2.2.2, deny the permission to turn the tool off. In 2.4.0 the tool is generate_image. Configured permission rules using the old name migrate automatically. Saved always-allow approvals require fresh approval.

Docs
Skills granting tools

Not supported

The skill permission controls loading; skill frontmatter does not grant tool access.

Docs
Hooks that decide

Built in

permission.evaluate

Can: allow, ask, deny

The hook runs after configured-deny evaluation, so it cannot override a configured deny.

Since 2.0.30, MCP tool calls include their input in permission-evaluation metadata.input; absent input becomes {}. This does not change configured-deny precedence.

Docs
Where rules live
  • ~/.config/opencode/opencode.json(c), user
  • opencode.json(c) and .opencode/opencode.json(c), project
  • agents.<id>.permissions, agent

Sources

OpenCode