anomalyco / anomalyco/opencode

tui: plan mode silently not enforced after re-engaging mid-session — agent executes mutations without restriction

Open
#43,830 3 comments 0 reactions 1 assignee View on GitHub

@neriousy is already working on this.

Since Aug 21, 2026.

2.0
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 plugin entry),
    plugins/switchboard.ts, plugins/worktrunk.ts

Reproduction

  1. Launch opencode2, work through several agent/mode switches where plan
    mode engages and disengages normally (reminder injected each time)
  2. Later, re-engage plan mode via agent switch
  3. UI shows plan mode active; no plan-mode reminder reaches the model
  4. Instruct the agent to mutate a file — it executes (rm of 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.