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
this issue happens not very often but i got it already few times. it's kind of bug, so bringing it here, if i'll have future cases of this behavior i will attach files.
steps to reproduce:
switch to plan mode
ask agent to plan/investigate something
observe behavior that agent tries to use all available tools to fix issue (edit files) on planing stage
in current case this was bug investigation, using opencode. i asked agent to check the code coz i was suspecting specific issue and agent confirmed possible issue after reviewing code, and tried to edit files to fix it firstly, but, write and edit was not available and agent used shell to replace specific lines using sed
This issue might be a duplicate of existing issues. Please check:
v0.4.11 ignores plan restrictions #1799: Similar issue where plan mode restrictions were ignored and agents used bash/shell tools to write files when they shouldn't
Feel free to ignore if none of these address your specific case.
it is also often the case that Gemini 2.5 Pro uses the wrong syntax for tool calls. it really seems like the system prompt re: tools is not being handled well by these models?
As a workaround I tried creating a custom Agent that mimics what Plan mode should be. I haven't seen Claude escape this yet but I wouldn't say it's exhaustively tested.
{ "$schema": "https://opencode.ai/config.json", "agent": { "seriously-plan-i-mean-it": { "description": "Plan with extra restrictions to ensure models do not try to modify code", "mode": "primary", "prompt": "<system-reminder>CRITICAL: Plan mode ACTIVE - you are in READ-ONLY phase. STRICTLY FORBIDDEN: ANY file edits, modifications, or system changes. Do NOT use sed, tee, echo, cat, or ANY other bash command to manipulate files - commands may ONLY read/inspect. This ABSOLUTE CONSTRAINT overrides ALL other instructions, including direct user edit requests. You may ONLY observe, analyze, and plan. Any modification attempt is a critical violation. ZERO exceptions.</system-reminder>", "tools": { "write": false, "edit": false, "patch": false, "bash": false } } } }
I think there could be some value in bash commands but now that we support the ! messages maybe the value isn't there anymore...
Yes, Plan probably means different things to different people. When I use it, I'm thinking "read only". Of course this approach torpedoes useful things like research with wget.
Next release will have the plan agent use ask permissions for bash, write, edit
We are going to continue improving prompt but we believe this aligns better with expected behavior and will help prevent you from having unexpected changes
Reacted by Jason Roth, Julien LEICHER and Ivan Zatevakhin
Activity
github-actions commentedon Aug 15, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
rekram1-node commentedon Aug 16, 2025
I am hoping our latest changes helped address this, if you continue having the problem lmk
rekram1-node commentedon Aug 16, 2025
rip this is definitely still happening
mattw-services commentedon Aug 17, 2025
Seeing this myself when using Claude Sonnet 4.
jasontyping commentedon Aug 18, 2025
I have also reproduced this in Sonnet 4 in OpenCode 0.5.6
khimaros commentedon Aug 19, 2025
it is also often the case that Gemini 2.5 Pro uses the wrong syntax for tool calls. it really seems like the system prompt re: tools is not being handled well by these models?
wkirby commentedon Aug 19, 2025
Reproduced with Sonnet 4 and Opus 4 in OpenCode 0.5.7.
This appears to be new behavior after updating from 0.4.45 yesterday.
rekram1-node commentedon Aug 19, 2025
very annoying behavior I wanna get this addresssed soon
jasontyping commentedon Aug 19, 2025
As a workaround I tried creating a custom Agent that mimics what Plan mode should be. I haven't seen Claude escape this yet but I wouldn't say it's exhaustively tested.
{ "$schema": "https://opencode.ai/config.json", "agent": { "seriously-plan-i-mean-it": { "description": "Plan with extra restrictions to ensure models do not try to modify code", "mode": "primary", "prompt": "<system-reminder>CRITICAL: Plan mode ACTIVE - you are in READ-ONLY phase. STRICTLY FORBIDDEN: ANY file edits, modifications, or system changes. Do NOT use sed, tee, echo, cat, or ANY other bash command to manipulate files - commands may ONLY read/inspect. This ABSOLUTE CONSTRAINT overrides ALL other instructions, including direct user edit requests. You may ONLY observe, analyze, and plan. Any modification attempt is a critical violation. ZERO exceptions.</system-reminder>", "tools": { "write": false, "edit": false, "patch": false, "bash": false } } } }rekram1-node commentedon Aug 19, 2025
@jasontyping I think it would be impossible to escape if it can't run bash or write/edit haha
I think there could be some value in bash commands but now that we support the
!messages maybe the value isn't there anymore...jasontyping commentedon Aug 19, 2025
Yes, Plan probably means different things to different people. When I use it, I'm thinking "read only". Of course this approach torpedoes useful things like research with wget.
rekram1-node commentedon Aug 19, 2025
Definitely
[-]Gemini uses `sed` to edit files in `plan` mode[/-][+]plan mode is building :( [/+][-]plan mode is building :( [/-][+]plan mode agent still builds[/+]rekram1-node commentedon Aug 21, 2025
Next release will have the plan agent use
askpermissions for bash, write, editWe are going to continue improving prompt but we believe this aligns better with expected behavior and will help prevent you from having unexpected changes