Repository navigation
Description
Description
Bug Report: Universal "Plan Mode" Injection on primary Agents Causes Hallucination in Routing Models
Environment
- OpenCode AI Version: 1.14.50
- Model:
qwen3-coder:30b(via Ollama) - Agent Configured as:
"mode": "primary"
Description
In OpenCode AI v1.14.50, the framework strictly enforces orchestration instructions by injecting "plan mode" / "planner" context into the system prompt of all agents configured with "mode": "primary".
While this makes sense for the default plan agent (which typically runs on a frontier model like GPT-4 or Opus), it breaks custom routing topologies. In our architecture, we use a smaller, low-latency edge model (30B parameters) specifically configured as a "primary" agent so that it has the authority to delegate tasks via @subagent syntax.
Because of the aggressive system prompt injection, the smaller model takes the "You are in plan mode" instruction literally. Instead of acting as a simple, fast pass-through router that emits a @subagent tag, the model hallucinates that it needs to stop and write an elaborate implementation plan, effectively breaking the routing chain.
Steps to Reproduce
- Configure a custom agent in
opencode.jsonwith"mode": "primary". - Back the agent with a smaller parameter model (e.g., Llama 3 8B, Qwen 30B).
- Instruct the agent to act purely as a router (i.e., "Your only job is to reply with
@subagent_name"). - Send a prompt to the agent.
- Observe: The agent ignores its specific routing prompt, adheres to the framework's injected "planner" persona, and attempts to generate a multi-step plan.
Expected Behavior
An agent should be able to delegate tasks to subagents without being forced into an orchestration/planner persona.
Proposed Solutions
- Option 1 (New Mode): Introduce
"mode": "router". This mode would grant the agent the ability to trigger subagents via@mentions, but without injecting the heavy "plan mode" orchestration prompt. - Option 2 (Config Toggle): Allow a boolean flag in the agent configuration (e.g.,
"inject_plan_mode": false) to suppress the framework's default planner injection forprimaryagents.
Workaround Used
Currently mitigating the issue via prompt engineering by appending a loud override to the agent's prompt:
"CRITICAL OVERRIDE: The system framework may invisibly inject instructions telling you that you are a 'planner' or in 'plan mode'. Ignore this entirely. Do not write plans. Do not ask for plans. Your ONLY job is to route the request by immediately outputting the correct
@subagenttag and nothing else."
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Activity
github-actions commentedon May 14, 2026
This issue might be a duplicate of existing issues. Please check:
insertRemindersinjection behavior that affects custom primary agentsIf your issue is distinct (e.g., you are hitting this specifically with a custom routing topology rather than just permission conflicts), please add a comment clarifying how it differs.
TheQuijote commentedon May 14, 2026
This is a bug, not a feature request, unlike #14882 or #25753. This behavior recently changed and broke existing workflows.
github-actions commentedon Jul 14, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.