Repository navigation
Description
- I have verified this feature I'm about to request hasn't been suggested before.
(Adjacent open issues, none covering a scope picker: [FEATURE]:permissions: external_directory approval prompt lacks explicit scope choice (folder only vs including subfolders) #56807 — show the
scope explicitly in the external_directory prompt (transparency only,
and in the "deeper" direction); [FEATURE]: Add a way to choose "exact command" vs. "pattern" when granting always-allow #49165 — exact vs. pattern choice for
shell commands (same feature family, "narrower" direction); [FEATURE]: Add more granular command approval options for project and global persistence #59623 —
persistence scope (session/project/global); permissions: add time-limited approvals (30m/1h/3h/5h/1d/1w) between once and always #61465 — time-limited
approvals; permissions: allow-always is durable and project-scoped with no opt-out or TUI reset #50600 — reviewing/removing saved approvals in the TUI.
Background: V2 TUI terminology and copy decisions #36707 §12, webfetch: always-allow scoped to domain instead of all URLs #37183.)
Current behavior
When a permission prompt resolves to ask, the tool decides which pattern an
Allow always reply will save — the user only picks whether to save, not
what gets saved. (Since #47369 the prompt previews the proposed pattern,
which confirms the behavior but offers no choice.) For external_directory,
the proposed pattern is the exact canonical directory boundary the access
touched.
Problem
The proposed pattern is frequently the wrong trust scope. Concrete pain:
Prompt: external_directory C:/projects/acme/components/libs/src/net/core/*
[ Allow once ] [ Always allow ] [ Reject ]
Clicking Always allow saves C:/projects/acme/components/libs/src/net/core/*
— that one leaf. The intent was "trust the whole components tree under
C:/projects/acme/components". Every later access to a sibling
(.../src/net/protocols/, .../widgets/, a directory added to the tree later)
prompts again, because each new leaf is a new "first touch". There is no way
in the UI to say "allow everything a few levels up"; the only workarounds are
hand-editing opencode.jsonc or rewriting the stored rule in the SQLite DB
directly (#50600).
The mirror-image problem (the tool proposes a pattern that is too broad,
e.g. webfetch always saving *) is the same feature family from the other
direction and would be covered by the same design: the saved pattern should be
a choice the user makes, with the tool's proposal as default.
Requested change
When an approval prompt is shown, let the user pick the scope of the pattern
that "Always allow" will persist, with the tool-proposed pattern as the default
selection:
external_directory: offer the ancestor chain of the proposed boundary
as selectable options (top-down by breadth):(depth capped to a reasonable bound, and/or free-text pattern entryAlways allow for: ▸ C:/projects/acme/components/libs/src/net/core/* (proposed) ▸ C:/projects/acme/components/libs/src/net/* ▸ C:/projects/acme/components/libs/* ▸ C:/projects/acme/components/* ▸ C:/projects/acme/*
validated against the whole-value wildcard grammar)webfetch: the same mechanism with host/path derivation (the
mirror-image case, e.g.https://example.com/docs/*instead of*;
requested separately in the companion path-scoping issue).shell/ others: keep the current single proposal where sensible
(command prefixes), but route through the same UX so users can widen or
narrow before saving (see also [FEATURE]: Add a way to choose "exact command" vs. "pattern" when granting always-allow #49165 for the shell-specific exact-match
variant).
Why it matters
- Trust decisions are made at the tree level in practice (a repo, a component
set, a vendor dir), not at the first-touched leaf; today the UI only encodes
the leaf, forcing prompt churn or manual DB/config surgery. - Turns "Allow always" from an all-or-nothing gamble into a deliberate,
visible grant — the saved pattern is exactly what the user saw and picked. - Directly reduces the need for broad
*grants that users later have to
audit away.
Open questions
- Where does the picker live? Inside the permission prompt itself, or a
secondary step after "Always allow" (keep the prompt single-choice and add a
"choose scope…" option)? - Free-text entry: should users be able to type an arbitrary pattern (with
syntax validation), or only pick from the derived ancestors? (Prior art:
[FEATURE]: Allow editing the "always" permission pattern before confirming #24795/[FEATURE]: Editable allow all #25089 requested exactly this for shell and were closed as not
planned — flagging in case the concern was scope, not direction.) - Discoverability of saved rules: V2 TUI terminology and copy decisions #36707 §12 and permissions: allow-always is durable and project-scoped with no opt-out or TUI reset #50600 note there is
currently no first-class UI to inspect or remove stored approvals — should
this feature also include a list/edit surface for previously saved patterns,
or is that a separate issue? - Ancestor cap: how many levels up should be offered? (Unlimited makes the
list unwieldy for e.g.C:/*; trust boundaries between unrelated repos
argue for a cap.) - Should the same scope-picker apply to
question/skill/subagentIDs, or
stay limited to path/URL-shaped resources?
Environment
- opencode version: 2.3.0
- OS: Windows 11 (Windows 10.0.26300, win32 x64)
- Terminal: Unavailable (terminal environment variables not set)
- Shell: C:\WINDOWS\system32\cmd.exe (PowerShell used for tooling)
- Install/channel: release (latest)
- Active plugins: none found in config
Activity
opencodejr commentedon Nov 17, 2026
Thanks for the thorough write-up. You're asking for a way to choose which pattern Always allow saves, with the tool's proposal selected by default. For
external_directorythat would be a list of parent folders; webfetch and shell would use the same picker to widen or narrow the pattern.Some context from the current code: the docs describe Always allow as saving "the tool's proposed patterns for the project". For
external_directory, the saved pattern is the external folder's project root plus/*if it has one, otherwise the folder itself plus/*. The prompt doesn't offer any other choice, so this is a new feature rather than a bug. Maintainers will consider it.Related issues:
external_directoryprompt state its scope / offer folder-only vs including subfoldersAs far as I could tell, a plugin can't add choices to the approval prompt or change the saved pattern, so this would need a change in OpenCode itself.
neriousy commentedon Nov 23, 2026
Closing as a duplicate of #48011: choosing the scope saved by "Always allow". Please follow that issue for updates and add any extra details there.