Skip to content

fix: replace plan mode prompt instead of stripping it#341

Merged
backnotprop merged 1 commit into
mainfrom
fix/oc-permissions-part2
Mar 19, 2026
Merged

fix: replace plan mode prompt instead of stripping it#341
backnotprop merged 1 commit into
mainfrom
fix/oc-permissions-part2

Conversation

@backnotprop
Copy link
Copy Markdown
Owner

Summary

  • Before: messages.transform hook nuked OpenCode's entire plan mode STRICTLY FORBIDDEN message, leaving the model with no prompt-level guardrails. Models went rogue — writing Python scripts via Bash to edit code (reported by @ilmpc in submit_plan not appear after plan is finished #328).
  • After: Replaces the message with a tailored version that keeps the read-only constraint but allows markdown file writing (.md) for plans, specs, docs, etc.

The replacement message:

  • Retains STRICTLY FORBIDDEN language for non-markdown edits and destructive bash commands
  • Allows .md file writing explicitly
  • Keeps the Responsibility section (explore, ask questions, surface tradeoffs)
  • Keeps the Important section (no execution, no source code edits)

Test plan

  • OpenCode plan mode: agent should use submit_plan and write plan .md files without going rogue
  • Agent should NOT attempt to edit source code, run destructive bash, or write Python workarounds
  • Non-plan primary agents (Build) should still see submit_plan and work normally
  • Weaker models (GPT-5-mini) should respect the STRICTLY FORBIDDEN constraint

Fixes #328

Instead of nuking OpenCode's STRICTLY FORBIDDEN plan mode message entirely
(which left the model with no prompt-level guardrails, causing it to go
rogue and edit code via bash+python), replace it with a tailored version
that allows markdown file writing while keeping all other restrictions.

Fixes #328

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@backnotprop
Copy link
Copy Markdown
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@backnotprop backnotprop merged commit 5dd60c1 into main Mar 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

submit_plan not appear after plan is finished

1 participant