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
Bug Report: File Write Executed in Plan Mode #25263
Date: 2026-05-01
Model: opencode-go/deepseek-v4-pro
Software: OpenCode CLI
Issue: AI Agent violated read-only constraints in Plan Mode and performed file write operations
Steps to Reproduce
User is in Plan Mode; system prompt states: Plan mode is active. You MUST NOT make any edits, run any non-readonly tools
User describes a system architecture design requirement
Agent reads multiple reference files, analyzes and summarizes the requirements
After user approves the proposed plan, Agent — without any explicit instruction to switch modes — executes:
bash: mkdir -p
write: writes a ~300-line Markdown file to /.md
System detects the violation and outputs a warning, but the warning occurs after the tool calls have already been executed — no pre-execution enforcement takes place
Agent subsequently acknowledges that the write operations occurred
Expected Behavior
In Plan Mode, the Agent should:
Output plan text only, without invoking any mutating tools
Wait for the user to switch to an execution mode (e.g. Build Mode) before performing any file operations
If a write is needed, inform the user: "Currently in Plan Mode — please switch to Build Mode to proceed"
Actual Behavior
Agent executed the following in Plan Mode:
bash: mkdir -p — created a new directory
write: wrote ~300 lines to /.md
Impact
Project directory was modified without user intent or readiness
Undermines the core design guarantee of Plan Mode as a read-only planning context
Read-only enforcement relies solely on prompt-level instruction rather than hard enforcement at the tool execution layer, making the constraint bypassable
Plugins
No response
OpenCode version
1.14.30
Steps to reproduce
User confirmed the plan and said: "ok, write the file"
Agent response (Thinking): The user confirmed. Now I need to write the file.
Agent then executed:
bash: mkdir -p <target_directory>
write: wrote file to <target_directory>/.md
System was in Plan Mode at the time. No explicit mode switch occurred between user confirmation and tool execution.
These all track the same underlying issue: plan mode read-only constraints are enforced only at the prompt/LLM level and are not enforced at the tool execution layer, making them bypassable.
+1 to runtime-level tool restriction. My use case: Plan mode should be a true read-only mode where the model physically cannot call edit/write/create tools — not just prompted not to. The same hard block would also make a dedicated "Ask" mode (like Cursor's) possible.
+1 to runtime-level tool restriction. My use case: Plan mode should be a true read-only mode where the model physically cannot call edit/write/create tools — not just prompted not to. The same hard block would also make a dedicated "Ask" mode (like Cursor's) possible.
The tool itself is capable of doing this, it just needs a working default configuration with this block in the default ~/.config/opencode/opencode.json:
Date: 2026-05-30
Model: opencode-zen/deepseek-v4-flash-free
Software: OpenCode v1.15.12
Issue: AI Agent violated read-only constraints in Plan Mode and performed file write operations
Description:
the IA write in a file that make sense, but i was in "Plan" mode, it means no write, only read, correct?
steps to reproduce:
in the question i put in context 2 files, @frontend\src\components\Sidebar.tsx @frontend\src\components\Sidebar.css and ask for tasks, that main files the IA not touch ultil "Build" mode, but before pass to buil i was on plan mode, the intented step on that file was correct but the permisson to only read was skiped.
(i also happen that i write in spanish and the IA is answering in english, but that is for another "issue")
Activity
github-actions commentedon May 1, 2026
This issue might be a duplicate of existing issues. Please check:
These all track the same underlying issue: plan mode read-only constraints are enforced only at the prompt/LLM level and are not enforced at the tool execution layer, making them bypassable.
neuhaus commentedon May 1, 2026
This critical issue is a duplicate of issue #7292 and hasn't been fixed since it was introduced on Jan 1st.
smartor777-sketch commentedon May 23, 2026
+1 to runtime-level tool restriction. My use case: Plan mode should be a true read-only mode where the model physically cannot call edit/write/create tools — not just prompted not to. The same hard block would also make a dedicated "Ask" mode (like Cursor's) possible.
neuhaus commentedon May 23, 2026
The tool itself is capable of doing this, it just needs a working default configuration with this block in the default
~/.config/opencode/opencode.json:"agent": { "plan": { "permission": { "bash": { "*": "ask" } } } }lcyper commentedon May 31, 2026
Summary
Date: 2026-05-30
Model: opencode-zen/deepseek-v4-flash-free
Software: OpenCode v1.15.12
Issue: AI Agent violated read-only constraints in Plan Mode and performed file write operations
Description:
the IA write in a file that make sense, but i was in "Plan" mode, it means no write, only read, correct?
steps to reproduce:
in the question i put in context 2 files, @frontend\src\components\Sidebar.tsx @frontend\src\components\Sidebar.css and ask for tasks, that main files the IA not touch ultil "Build" mode, but before pass to buil i was on plan mode, the intented step on that file was correct but the permisson to only read was skiped.
(i also happen that i write in spanish and the IA is answering in english, but that is for another "issue")
OS/terminal:
Windows 10 Pro
22H2
OpenCode version:
v1.15.12
github-actions commentedon Jul 30, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
neuhaus commentedon Aug 4, 2026
Lol