Skip to content

Conversation

@moyueheng
Copy link

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

…ites

The plan mode prompt previously stated "ZERO exceptions" which prevented
the agent from writing plan files to .opencode/plan/*.md, even though
the permission system explicitly allows these writes.

This fix aligns the prompt with the actual permission configuration:
- Edit permission: "*.md" = "deny", ".opencode/plan/*.md" = "allow"
- Prompt now clearly states the ONE exception for plan files

Resolves the mismatch between agent prompt and permission system that
prevented plan agents from creating/editing plan files.
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@moyueheng
Copy link
Author

image

Explanation of the screenshot

The screenshot shows an inconsistency in Plan mode behavior:

In Plan mode, writing to .opencode/plan/*.md is expected to be allowed, but the system/model treats Plan mode as fully read-only and rejects the write, insisting that Plan must be exited before any file write.

This indicates that the allowlist for .opencode/plan/*.md is not being honored (or is being overridden) in the current Plan-mode write gate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant