opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix(session): update plan mode prompt to allow .opencode/plan/*.md writes

Open moyueheng opened this issue 1 day ago • 3 comments

Issue

Plan mode agent refuses to write plan files to .opencode/plan/*.md, even though the permission system explicitly allows these writes (see agent.ts:69).

Root Cause

The plan mode prompt (packages/opencode/src/session/prompt/plan.txt) states "ZERO exceptions", which misleads the agent into believing it cannot write any files, including plan files.

This creates a mismatch between:

  • Permission layer: .opencode/plan/*.md = "allow" ✅
  • Prompt layer: "ZERO exceptions" ❌

Fix

Updated the plan mode prompt to clearly state the ONE exception:

  • Plan files at .opencode/plan/*.md are explicitly allowed
  • All other files remain prohibited

The prompt now aligns with the actual permission configuration.

Testing

  • Manual testing: Use plan mode, agent can now create/edit .opencode/plan/*.md files
  • The permission system (agent.ts:67-70) remains unchanged

moyueheng avatar Jan 14 '26 10:01 moyueheng