Describe the enhancement you want to request
Problem
Plan mode's system prompt uses absolute language that prevents ALL bash commands except read/inspect operations. This blocks legitimate planning activities like:
- Creating/updating GitHub issues via
gh issue create, gh pr create
- Creating/updating GitLab issues via
glab issue create, glab mr create
- Generating and committing planning diagrams or documentation artifacts
This forces users into build mode for these activities, which often leads to the agent executing code changes prematurely before planning is complete.
Problematic responses in plan mode
When asked to create a GitHub issue or GitLab ticket in plan mode, the agent responds with variations of:
"I'm in plan mode and cannot execute commands. I can only read and analyze. Please switch to build mode to create the issue."
"Plan mode restricts me to read-only operations. Creating a GitHub issue requires running gh issue create, which I cannot do in this mode."
This happens because the system prompt (packages/opencode/src/session/prompt/plan.txt) states:
STRICTLY FORBIDDEN: ANY file edits, modifications, or system changes.
Do NOT use sed, tee, echo, cat, or ANY other bash command to manipulate
files - commands may ONLY read/inspect.
...ZERO exceptions.
And the ## Important section reinforces:
you MUST NOT make any edits, run any non-readonly tools (including
changing configs or making commits), or otherwise make any changes
to the system.
The experimental plan prompt (prompt.ts:279) has the same restriction: "run any non-readonly tools (including changing configs or making commits)"
Root cause
The plan agent's bash tool is NOT hard-denied in the permission config (agent.ts:124-146) — it inherits "allow" from defaults. The model's refusal is caused entirely by the system prompt's absolutist language, which makes no distinction between "modifying source code" and "managing project tickets."
Recommended fix (3 files, ~35 lines changed)
-
packages/opencode/src/session/prompt/plan.txt — Reframe restrictions from "ALL commands" to "source code modifications." Add an explicit "Allowed planning activities" section listing issue/ticket management (gh, glab), PR/MR management, documentation artifacts, and project queries.
-
packages/opencode/src/session/prompt.ts (experimental plan prompt) — Same distinction: restrict source code edits, explicitly permit planning CLI tools.
-
packages/opencode/src/agent/agent.ts — Add explicit bash: { "gh *": "allow", "glab *": "allow" } permission rules to the plan agent config, making the intent unambiguous at the permission layer (not just prompt).
Benefits
- Users can stay in plan mode for the entire planning workflow (research → create tickets → write specs → create PR) without being forced into build mode
- Source code is still fully protected from modification
- The permission system and the system prompt are aligned in intent
OpenCode version: v1.14.21
OS: macOS (Darwin)
Terminal: Ghostty
Describe the enhancement you want to request
Problem
Plan mode's system prompt uses absolute language that prevents ALL bash commands except read/inspect operations. This blocks legitimate planning activities like:
gh issue create,gh pr createglab issue create,glab mr createThis forces users into build mode for these activities, which often leads to the agent executing code changes prematurely before planning is complete.
Problematic responses in plan mode
When asked to create a GitHub issue or GitLab ticket in plan mode, the agent responds with variations of:
This happens because the system prompt (
packages/opencode/src/session/prompt/plan.txt) states:And the
## Importantsection reinforces:The experimental plan prompt (
prompt.ts:279) has the same restriction: "run any non-readonly tools (including changing configs or making commits)"Root cause
The plan agent's bash tool is NOT hard-denied in the permission config (
agent.ts:124-146) — it inherits"allow"from defaults. The model's refusal is caused entirely by the system prompt's absolutist language, which makes no distinction between "modifying source code" and "managing project tickets."Recommended fix (3 files, ~35 lines changed)
packages/opencode/src/session/prompt/plan.txt— Reframe restrictions from "ALL commands" to "source code modifications." Add an explicit "Allowed planning activities" section listing issue/ticket management (gh,glab), PR/MR management, documentation artifacts, and project queries.packages/opencode/src/session/prompt.ts(experimental plan prompt) — Same distinction: restrict source code edits, explicitly permit planning CLI tools.packages/opencode/src/agent/agent.ts— Add explicitbash: { "gh *": "allow", "glab *": "allow" }permission rules to the plan agent config, making the intent unambiguous at the permission layer (not just prompt).Benefits
OpenCode version: v1.14.21
OS: macOS (Darwin)
Terminal: Ghostty