plan mode agent still builds
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
planmode - 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:
- #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.
I am hoping our latest changes helped address this, if you continue having the problem lmk
rip this is definitely still happening
Seeing this myself when using Claude Sonnet 4.
I have also reproduced this in Sonnet 4 in OpenCode 0.5.6
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?
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.
very annoying behavior I wanna get this addresssed soon
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 } } } }
@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...
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.
Definitely
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