Repository navigation
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Embedded applications sometimes want builtin file tools to work within one host-selected directory, independently of broader project discovery. Could OpenCode offer an opt-in, invocation-owned file boundary within its existing trusted-runtime model?
Proposed API, not released syntax: typed ServerOptions.fs.fileBoundary?: { root: string; workspaceID?: Workspace.ID }. No CLI flag, environment transport or authored JSON config key. Absent means existing tool behavior; malformed options fail early. Copy/freeze the owner once and propagate it unchanged through normal and lazy/private application graphs.
Initial contract:
- Admit only the exact Location directory/root and workspace identity. Start conservatively with normalized ASCII POSIX roots; unsupported placements, platforms or drivers reject rather than silently weaken the mode.
- Require proof from the actual content backend, not host realpath or lexical checks alone. Reject every encountered symlink, including root ancestors, rather than canonicalize-and-follow. Preserve exact spelling and the existing Location-relative permission identity. Implement local/memory proof and forward capabilities through the actual acquired workspace connection; missing/failed proof rejects.
- Apply proof to actual builtin read/write/edit/patch/grep/glob paths before target content I/O or search dispatch. For prospective creation, require an existing proven directory root and ordinary existing ancestors; missing tails are allowed only for creating operations. Search must use explicit backend-supported no-follow traversal.
- Keep native and organization permission rules unchanged: successful proof never grants permission or overrides DENY. Search permissions stay pattern-based, not filtered by ordinary read denies.
This is not an OS sandbox, hardlink/mount isolation or race-free authorization/open. It assumes a trusted, stable backend namespace between proof and use. Provider/plugin/instruction/configuration and independent host I/O, plus shell/MCP/execute authority, remain outside this file-tool contract.
Related: #54869 requests instance-only external_directory prompting; this proposes a separate typed, immutable no-follow tool restriction with backend proof. #56351's permission maximum is complementary, not a dependency or approval of this proposal.
A reviewed private local prototype is available through a permitted review channel; no public source link or implementation PR is offered. Recorded source-only checks: core 101 pass with eight unrelated legacy desired cases still pending, server 10 pass, SDK 1 pass, and three complete package-owner incremental typechecks. These are not CI, full-suite, native-runtime/platform or installed-version qualification, release or adoption claims.
Before any implementation PR: does ServerOptions.fs fit this ownership API? Is exact-Location/ASCII-POSIX scope with unchanged absent-option behavior acceptable initially? Should drivers explicitly advertise this proof/search capability and reject when unsupported, given the stable-namespace trust assumption, or should that assumption require a different contract?
Activity
opencode-agent commentedon Oct 17, 2026
Thanks for the detailed proposal! In short, you're asking for an opt-in, typed
ServerOptions.fs.fileBoundarythat limits the built-in file tools (read/write/edit/patch/grep/glob) to one directory chosen by the host. Paths would need proof from the backend, symlinks would be rejected, and permission rules would stay as they are. Maintainers will consider it, along with your API design questions.Related issues:
external_directoryat the instance directory instead of the git worktree. It is permission-based and has no symlink proof.external_directoryboundary check.