Skip to content

Plan Mode Injection #27449

Closed as not planned
Closed as not planned

Description

@TheQuijote

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

  1. Configure a custom agent in opencode.json with "mode": "primary".
  2. Back the agent with a smaller parameter model (e.g., Llama 3 8B, Qwen 30B).
  3. Instruct the agent to act purely as a router (i.e., "Your only job is to reply with @subagent_name").
  4. Send a prompt to the agent.
  5. 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

  1. 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.
  2. 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 for primary agents.

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 @subagent tag 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

  1. github-actions commented on May 14, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If 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.

  2. TheQuijote commented on May 14, 2026

    @TheQuijote
    Author

    This is a bug, not a feature request, unlike #14882 or #25753. This behavior recently changed and broke existing workflows.

  3. github-actions commented on Jul 14, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions