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]: Plan-to-build transition does not tell AI to re-read files before editing -- stale plan-mode knowledge used #30784
When the AI transitions from plan mode to build mode, the build-switch.txt message (packages/opencode/src/session/prompt/build-switch.txt) tells the AI:
You are no longer in read-only mode.
You are permitted to make file changes, run shell commands, and utilize your arsenal of tools as needed.
It does not tell the AI to re-read files before editing them.
The problem
During plan mode, the AI may have read files many turns ago. File content could have changed. The AI's knowledge of file contents may be stale. But the build switch message gives no instruction to re-verify.
Compare with the plan mode prompt (plan-reminder-anthropic.txt:48) which DOES tell the AI:
"Each agent will return an implementation plan along with a list of critical files that should be read. You should keep these in mind and read them before you start implementing the plan."
This instruction is present in plan mode but is not repeated at the transition to build mode.
Experimental mode also affected
The experimental plan mode prompt (plan-mode.txt) also doesn't include a re-read instruction at transition. reminders.ts lines 51-68 add only the plan file location.
Related:#30766 (prompts missing read-before-edit instruction), #30767 (no session tracking — plan-mode reads could be timestamped)
Plugins
N/A (source code analysis)
OpenCode version
main
Steps to reproduce
Start plan mode, AI reads src/main.ts (turn 5)
AI spends 30 turns planning
User approves plan, AI transitions to build mode
AI edits src/main.ts based on content recalled from turn 5
If src/main.ts changed during this time, the edit may corrupt the file
Activity