# opencode · Confinement

> Levels are per column and must not be summed, averaged or ranked. A level states which written criterion the runtime's source meets. It is not a measure of quality or task success. Higher is not always preferable.

Source: "Agent runtime comparison: ten open-source agent runtimes, source review", study of 2026-11-28. Mark notation: `3` is the level in the default deployment; `1→4 [opt: …]` is level 1 by default and level 4 in the named configuration; `s` source-verified, `d` documented or test only. Service dependencies are classes (E embedded, O on demand, R resident service, X external server required), not levels.

- Runtime: [opencode](https://ai-agents-review.com/runtime/opencode.md)
- Column: [Confinement](https://ai-agents-review.com/column/confinement.md) (Execution controls)
- Mark: 1 s
- Default deployment: 1
- Best supported configuration: 1
- Page: https://ai-agents-review.com/cell/opencode/confinement

## Rationale

Allow/ask/deny ruleset (allow *, *.env ask); no OS sandbox in release or dev builds

## Rubric criteria for this column

- 0: No restriction: tools run as the user with no approval or policy by default
- 1: Policy or approval layer only (allowlists, approval prompts, reviewer model). No OS boundary
- 2: An OS/container boundary exists but is opt-in, **or** is default-on only for a subset of effect paths, leaving the main shell/file tools unconfined
- 3: Default-on OS-enforced boundary for the main shell and file effects (filesystem writes restricted)
- 4: Level 3, plus network restricted by default **and** children and auxiliary processes (MCP stdio, hooks, cron) confined at least as tightly

## Review finding

No OS sandbox in release or dev builds; shell, MCP stdio and file tools run as the user. An ordered allow/ask/deny ruleset defaults to allow `*`, external directories included; `*.env` reads ask. Shell commands are parsed for paths. Remote workspaces exist only if the embedder supplies a provider. A child agent's rules are not intersected with its parent's denies. [X96][X97][X98][X99][X100]

## Evidence cited by the mark

- [X96] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/schema/src/agent.ts#L55-L60 — default permissions allow * with ask for versioned skills and *.env reads — [S]
- [X98] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/shell/permissions.ts#L26-L60 — shell commands parsed into external_directory/shell requests — [S]

## Evidence also cited by the review finding

- [X97] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/permission/policy.ts#L107-L109 — no matching rule means ask — [S]
- [X99] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/session.ts#L325-L328 — child session rules: own agent plus inherited session rules (no parent-deny intersection) — [S]
- [X100] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/sdk/src/internal/host.ts#L21-L57 — workspace providers supplied by embedder — [S]

## Grading record

- Grader A (default / best): 1 / 1
- Grader B (default / best): 1 / 1
