You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plan: plan-mode guard denies writes to configured plan directory (~/.opencode/plan) #50241
In Plan mode, the AI cannot write or edit files in the configured plan directory (~/.opencode/plan/) despite the plan agent's permissions explicitly allowing it. The guard incorrectly claims the target path is "outside the plan directory" when it's actually inside it.
Environment
opencode version: 2.0.10
OS: Linux 7.2.6-1-cachyos (linux x64)
Terminal: xterm-256color, truecolor
Shell: /usr/bin/bash
Install/channel: latest
Active plugins: None found in config
Reproduction
Start opencode in a workspace where ~/.opencode/plan/ exists (created automatically or manually)
Enter Plan mode (select the "Plan" agent)
Attempt to write a new file to ~/.opencode/plan/new-plan.md or edit an existing file in that directory
Observe the denial with error: "Cannot use write to modify files outside the Plan directory: /home/qasha/.opencode/plan"
Expected Behavior
The plan agent should be able to write/edit files in ~/.opencode/plan/ because:
The agent's resolved permissions include {"action": "edit", "resource": "/home/qasha/.opencode/plan/*", "effect": "allow"}
The agent's resolved permissions include {"action": "external_directory", "resource": "/home/qasha/.opencode/plan/*", "effect": "allow"}
The plan mode reminder explicitly states: "You may optionally create or update plan documents in: /home/qasha/.opencode/plan"
Actual Behavior
The plan-mode guard rejects the write/edit with: "Cannot use write to modify files outside the Plan directory: /home/qasha/.opencode/plan" — naming the exact directory the target file resides in.
Additional Context
The .opencode/plan directory exists at /home/qasha/.opencode/plan/ and contains existing plan files
The plan agent's permissions (via opencode api get /api/agent) show explicit allow rules for /home/qasha/.opencode/plan/* for both edit and external_directory actions
Fix is up in #53365 (targets v2). File tools pass paths inside the project as relative resources, so the Plan agent's absolute edit allow for the plan directory never matched and the edit * deny won. The PR also matches absolute rules against the resolved path, with tests. It supersedes the earlier #46495, which was closed by the cleanup bot without review. A maintainer may need to approve the CI workflow runs for the fork PR.
Thanks for documenting the Plan-mode denial despite explicit permissions for the plan directory. This is the same problem as #46358, where we're tracking it, and the linked fix covers both reports; please subscribe there or add any further version or reproduction details.
Activity
Shalin-Shah-2002 commentedon Oct 5, 2026
Fix is up in #53365 (targets
v2). File tools pass paths inside the project as relative resources, so the Plan agent's absoluteeditallow for the plan directory never matched and theedit *deny won. The PR also matches absolute rules against the resolved path, with tests. It supersedes the earlier #46495, which was closed by the cleanup bot without review. A maintainer may need to approve the CI workflow runs for the fork PR.neriousy commentedon Oct 20, 2026
Thanks for documenting the Plan-mode denial despite explicit permissions for the plan directory. This is the same problem as #46358, where we're tracking it, and the linked fix covers both reports; please subscribe there or add any further version or reproduction details.