anomalyco / anomalyco/opencode
tui: plan mode silently not enforced after re-engaging mid-session — agent executes mutations without restriction
@neriousy is already working on this.
Since Aug 21, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
In the v2 beta TUI, re-engaging plan mode mid-session (after previously
exiting it) sometimes fails to inject the plan-mode system reminder into the
conversation. The UI indicates plan mode is active, but the agent executes
file mutations without restriction. Observed in a session where an earlier
plan-mode engagement DID inject the reminder correctly.
Environment
- opencode version: 0.0.0-beta-17759
- OS: macOS 26 (Darwin 25.5.0, arm64)
- Terminal: tmux (xterm-256color, truecolor)
- Shell: /bin/zsh
- Install/channel: beta (mise npm: opencode-ai@beta)
- Active plugins: opencode-buddy (v1-syntax
pluginentry),
plugins/switchboard.ts, plugins/worktrunk.ts
Reproduction
- Launch
opencode2, work through several agent/mode switches where plan
mode engages and disengages normally (reminder injected each time) - Later, re-engage plan mode via agent switch
- UI shows plan mode active; no plan-mode reminder reaches the model
- Instruct the agent to mutate a file — it executes (
rmof a plugin file
observed) with no restriction message
Expected Behavior
Every plan-mode engagement injects the plan-mode system reminder and enforces
read-only behavior, regardless of how many prior mode transitions occurred in
the session.
Actual Behavior
Re-engagement after prior switches silently skipped reminder injection.
Agent remained fully mutable. No error or indication of the missed injection;
only user-side observation of unauthorized mutations revealed it.
Additional Context
- Earlier plan-mode engagements in the same long session injected the
reminder correctly, so the failure is intermittent/state-dependent - Session included custom primary agents (~/.config/opencode/agent/*.md)
alongside built-in plan/build - Possibly related to plugin event handling (v1-syntax buddy entry +
switchboard.ts were loaded)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.