GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — plan: bash writes and commits bypass plan mode (proposal: sandboxed writable paths) · Issue #65442 · anomalyco/opencode

plan: bash writes and commits bypass plan mode (proposal: sandboxed writable paths) #65442

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
plan: bash writes and commits bypass plan mode (proposal: sandboxed writable paths)#65442
Copy link
Labels
area/coreAgent loop, tools and configplatform/linuxLinuxtype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@john-okeefe
john-okeefe
opened on Nov 21, 2026
Issue body actions

Summary

Plan mode's read-only guarantee only covers the edit/write tools. Shell runs with full filesystem access by default, so in plan mode the agent can write files, rewrite source, and make git commits while the UI shows the session as read-only. I'd like shell writes in plan mode to be sandboxed to a configurable set of paths.

Environment

  • opencode version: 2.3.2
  • OS: Linux (omarchy), kernel 7.2
  • Terminal: Unavailable — agent launched from a desktop app, no TERM in its environment
  • Shell: /usr/bin/bash
  • Install/channel: latest
  • Active plugins: openchamber browser plugin, openchamber agent-tool and session-title plugins

Reproduction

  1. Toggle plan mode on.
  2. Work on something for a while and let the agent save notes and scratch scripts as it goes. Mine used cat > file <<'EOF' and python3 - <<'EOF' heredocs through the shell tool.
  3. Try the edit tool directly — it's correctly denied ("cannot modify files outside the Plan directory").
  4. Meanwhile the shell heredocs wrote files, rewrote source, and made git commits. In my case this ran across a multi-day debugging session while the UI showed plan mode the entire time.

Expected Behavior

Plan mode should make writes outside the plan directory impossible at the enforcement layer, not something that depends on the model choosing polite commands.

Actual Behavior

Only edit/write/patch are gated. The docs describe the plan agent as one that "explores and plans without editing normal project files" but note that "shell commands remain permission-controlled" — i.e. allowed unless you've configured otherwise. The shell permission matches raw command text, and you can't classify a command as read vs write from its text (git log > /etc/hosts, echo x | sudo tee file, subshells, pipes).

Proposal

Per-agent write sandboxing at the OS level with a writable-path allowlist, the way Codex CLI does workspace-write with landlock/seccomp on Linux:

{
  "agents": {
    "plan": {
      "sandbox": { "writable": ["~/.opencode/plan", "$TMPDIR"] }
    }
  }
}

The agent could still run git log, grep, tests — anything — but writes outside the allowlist fail at the syscall no matter how the command is spelled. Build mode would just add the project tree to the allowlist. A command-text deny-list (redirects, tee, rm, sed -i, git commit) would help as an interim, but text matching is bypassable and the syscall-level version is the one that actually closes this.

Additional Context

The trigger for this report: a multi-day session where I kept the agent in plan mode while reviewing its plan, and found afterward that it had edited source and committed locally the whole time. Nothing was pushed and I could revert everything, but the UI state and the enforcement disagreed the entire time, which is worse than having no plan mode at all. A permissions override on the plan agent (shell ask/deny) works today but costs all of shell, including the read-only diagnostics plan mode is genuinely useful for.

Activity

  1. opencodejr commented on Nov 21, 2026

    @opencodejr
    opencodejrBot
    on Nov 21, 2026
    Contributor
    More actions

    Thanks for the detailed write-up, @john-okeefe. I think this is a duplicate of #53955.

    The Plan agent's built-in rules in packages/core/src/plugin/plan.ts deny the edit tools outside the plan directory. I didn't find a rule there for shell commands. The docs describe Plan as an agent that "explores and plans without editing normal project files" and note that "shell commands remain permission-controlled". So heredocs, scripts and git commit run through the shell tool get past the read-only behaviour that the edit tools enforce. #53955 reports the same thing, and it has been reproduced.

    These are the possible duplicates and related issues I found, ordered by likelihood:

    • Agent is making edits when on plan mode #53955: the same problem. In plan mode the agent writes files and commits through shell commands (cat > file, scripts, git add/commit, rm, mv) without a prompt.
    • [FEATURE]: Better execution permissions and sandboxing #48411: a request for a built-in OS-level sandbox that limits filesystem, network and process access. Your proposal for per-agent writable paths at the syscall level belongs there, and that thread links several sandbox PRs.
    • agents: plan-mode session can escalate to edit access by delegating to the general subagent #55814: related. A plan-mode session gets edit access by delegating to the general subagent.
    • plan mode: worktree_create bypasses read-only restriction #64162: related. Worktree tools change the filesystem while plan mode is active.

    I'm closing this issue now as a duplicate of #53955. Please add your details there, especially the multi-day session and the git commits. Please also add the sandbox design (the writable allowlist, and Build adding the project tree) to #48411. If you think this is a different problem, reply here and the issue will reopen.

  2. opencodejr
    closed this as a duplicateof Agent is making edits when on plan mode #53955 on Nov 21, 2026
  3. opencodejr
    added
    area/coreAgent loop, tools and config
    platform/linuxLinux
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreAgent loop, tools and configplatform/linuxLinuxtype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.