
Control Flags vs Plan/Build for OpenCode: Intent-Driven Mode Switching
I'm new to OpenCode, and I've had to catch up on using AI, something that was complicated in proprietary products but very simple with OpenCode.
The fact that it's open source has eliminated my excuses for not having to waste time fine-tuning it.
Among other things, I've discovered that the Plan/Build mode, while widespread, is quite limited. Besides being a waste of tokens and attention on the model, it makes working with the model very rigid.
I've found a method that, at least in my case and with my models, works very well: using control flags.
This method does not treat the model as suspicious and clumsy, and takes full advantage of its potential and intelligence.
With it, we don't have to limit ourselves to just two modes, Plan and Build; we can have as many as we want simply by configuring a custom.txt file in the agent/mode.
It also frees up the space occupied by plan and build to be used in two more useful modes: Senior or Junior.
User-level control flags replace that single restrictive mode with seven distinct modes, each directing the model toward a different cognitive task:
| Mode | Flag | Direction | Prefix | What & When | OpenCode equivalent |
|---|---|---|---|---|---|
| INQUIRY | none | Default | (none) | Default mode. Handles questions, exploration, and direct requests. May execute changes. | Same as Build mode. |
| LOCK | ¿¿ |
Retrospective | [Analysis] |
Read-only analysis of existing code. Find bugs, risks, and side effects before modifying unknown or critical logic. | Closest to Plan mode, but adds active analysis vs. passive restriction. |
| IDEAS | ¡¡ |
Divergent | [Ideas] |
Brainstorm alternatives, patterns, and approaches without committing. Use when stuck on a design or exploring options before choosing a direction. | No equivalent. Entirely new capability. |
| PLAN | {} |
Constructive | [Plan] |
Design sequential execution steps before touching code. Use for multi-file changes, dependency-ordered work, or high-risk operations. | No equivalent. Entirely new capability. |
| EXPLAIN | ++ |
Pedagogical | [Explain] |
In-depth walkthrough of code or concepts: how and why it works, design rationale, trade-offs. Use when new to a codebase or debugging complex logic. | No equivalent. Entirely new capability. |
| REQUIRE | ?¿ |
Interrogative | [Require] |
Ask clarifying questions. Do not respond, do not execute. Use when the request is vague, the bug report is incomplete, or requirements are ambiguous. | Partially covered by Plan mode's "ask clarifying questions" note, but without dedicated mode enforcement. |
| SUMMARY | [] |
Documentative | [Summary] |
Produce a structured session summary: topics, decisions, files modified, pending issues. Use at end of session, before a break, or for handover. | No equivalent. Entirely new capability. |
| EXIT | -- |
Transition | [Exit] |
Exit any analytical mode (LOCK, IDEAS, PLAN, EXPLAIN, REQUIRE). Proceed to normal execution without further deliberation. | Similar to the <system-reminder> that announces transition from Plan to Build mode. |
>Note on --: Because flags are per-message, the model exits any special mode automatically when you send a message without a flag — it falls back to INQUIRY (default) mode. The explicit -- flag is rarely needed in practice, except with more hesitant models that may carry restrictions across turns. Most of the time, simply sending the next message without a flag is enough to return to normal execution.
The previous control flags to put the model in a different working mode are just one example of what can be achieved; this system can be extended much further by simply adding a line of instructions to the agent prompt of the system prompt by creating a custom.txt file.
More info:
https://github.com/criterium/opencode-lab/blob/main/research/control-flags-vs-plan-build/README.md