Is it possible to start in plan mode by default? #2934

Open
opened 2026-02-16 17:37:52 -05:00 by yindo · 17 comments
Owner

Originally created by @quantonganh on GitHub (Nov 18, 2025).

Originally assigned to: @rekram1-node on GitHub.

Question

I'm using Helix editor.
My workflow is highlight a piece of code, and send it to the right pane using opencode -p, along with a prompt to ask some questions. The problem is that if I forget to press Tab to switch to plan mode, it changes my code, which is not what I want.

Is it possible to have opencode always start in plan mode by default?

Originally created by @quantonganh on GitHub (Nov 18, 2025). Originally assigned to: @rekram1-node on GitHub. ### Question I'm using [Helix editor](https://github.com/helix-editor/helix). My workflow is highlight a piece of code, and send it to the right pane using `opencode -p`, along with a prompt to ask some questions. The problem is that if I forget to press Tab to switch to plan mode, it changes my code, which is not what I want. Is it possible to have opencode always start in plan mode by default?
Author
Owner

@rekram1-node commented on GitHub (Nov 18, 2025):

no but we can add that

@rekram1-node commented on GitHub (Nov 18, 2025): no but we can add that
Author
Owner

@rekram1-node commented on GitHub (Nov 18, 2025):

I mean you can use the --agent flag actually, but most people want a config option

@rekram1-node commented on GitHub (Nov 18, 2025): I mean you can use the --agent flag actually, but most people want a config option
Author
Owner

@rekram1-node commented on GitHub (Nov 18, 2025):

/oc add a "default_agent" field to config.ts, be sure to update all the places that we default to "build" agent, etc to check hey did the user set a default_agent and if not use build one if build one exists ig

@rekram1-node commented on GitHub (Nov 18, 2025): /oc add a "default_agent" field to config.ts, be sure to update all the places that we default to "build" agent, etc to check hey did the user set a default_agent and if not use build one if build one exists ig
Author
Owner

@opencode-agent[bot] commented on GitHub (Nov 18, 2025):

Created PR #4447

New%20session%20-%202025-11-18T07%3A19%3A57.263Z
opencode session  |  github run

@opencode-agent[bot] commented on GitHub (Nov 18, 2025): Created PR #4447 <a href="https://opencode.ai/s/Liz5LQ7R"><img width="200" alt="New%20session%20-%202025-11-18T07%3A19%3A57.263Z" src="https://social-cards.sst.dev/opencode-share/TmV3IHNlc3Npb24gLSAyMDI1LTExLTE4VDA3OjE5OjU3LjI2M1o=.png?model=opencode/glm-4.6&version=1.0.72&id=Liz5LQ7R" /></a> [opencode session](https://opencode.ai/s/Liz5LQ7R)&nbsp;&nbsp;|&nbsp;&nbsp;[github run](/sst/opencode/actions/runs/19457584275)
Author
Owner

@quantonganh commented on GitHub (Nov 18, 2025):

I think we can add list/ls command into opencode agent to list agents:

opencode agent

manage agents

Commands:
  opencode agent create  create a new agent

and the help page can be improved to something like this:

Options:
      --agent       agent to use                                        
                            [string] [built-in: "build", "plan"]
@quantonganh commented on GitHub (Nov 18, 2025): I think we can add `list/ls` command into `opencode agent` to list agents: ``` opencode agent manage agents Commands: opencode agent create create a new agent ``` and the help page can be improved to something like this: ``` Options: --agent agent to use [string] [built-in: "build", "plan"] ```
Author
Owner

@rekram1-node commented on GitHub (Nov 18, 2025):

Yeah that's good

@rekram1-node commented on GitHub (Nov 18, 2025): Yeah that's good
Author
Owner

@rekram1-node commented on GitHub (Nov 18, 2025):

/oc add a new subcommand to the opencode agent command called list, read cmd/agent.ts

It should be pretty straight forward to get all the available agents and list then by name and maybe if they are a subagent or not

@rekram1-node commented on GitHub (Nov 18, 2025): /oc add a new subcommand to the `opencode agent` command called `list`, read cmd/agent.ts It should be pretty straight forward to get all the available agents and list then by name and maybe if they are a subagent or not
Author
Owner

@opencode-agent[bot] commented on GitHub (Nov 18, 2025):

Created PR #4446

New%20session%20-%202025-11-18T08%3A02%3A43.286Z
opencode session  |  github run

@opencode-agent[bot] commented on GitHub (Nov 18, 2025): Created PR #4446 <a href="https://opencode.ai/s/uH3pl9gr"><img width="200" alt="New%20session%20-%202025-11-18T08%3A02%3A43.286Z" src="https://social-cards.sst.dev/opencode-share/TmV3IHNlc3Npb24gLSAyMDI1LTExLTE4VDA4OjAyOjQzLjI4Nlo=.png?model=opencode/glm-4.6&version=1.0.72&id=uH3pl9gr" /></a> [opencode session](https://opencode.ai/s/uH3pl9gr)&nbsp;&nbsp;|&nbsp;&nbsp;[github run](/sst/opencode/actions/runs/19458568041)
Author
Owner

@dehidehidehi commented on GitHub (Nov 20, 2025):

This is a great PR; is it possible to include a parameter which would also output each agent's description field ?
My use case is to help Orchestrator agents delegate to subagents by having a quick way of having the list of subagents

@dehidehidehi commented on GitHub (Nov 20, 2025): This is a great PR; is it possible to include a parameter which would also output each agent's description field ? My use case is to help Orchestrator agents delegate to subagents by having a quick way of having the list of subagents
Author
Owner

@rekram1-node commented on GitHub (Nov 20, 2025):

@dehidehidehi any agent that has access to the task tool has every agent and their description in context automatically because they are options for it:


export const TaskTool = Tool.define("task", async () => {
  const agents = await Agent.list().then((x) => x.filter((a) => a.mode !== "primary"))
  const description = DESCRIPTION.replace(
    "{agents}",
    agents
      .map((a) => `- ${a.name}: ${a.description ?? "This subagent should only be called manually by the user."}`)
      .join("\n"),
  )
  return {
    description,
    parameters: z.object({
      description: z.string().describe("A short (3-5 words) description of the task"),
      prompt: z.string().describe("The task for the agent to perform"),
      subagent_type: z.string().describe("The type of specialized agent to use for this task"),
      session_id: z.string().describe("Existing Task session to continue").optional(),
    }),
    async execute(params, ctx)
@rekram1-node commented on GitHub (Nov 20, 2025): @dehidehidehi any agent that has access to the `task` tool has every agent and their description in context automatically because they are options for it: ``` export const TaskTool = Tool.define("task", async () => { const agents = await Agent.list().then((x) => x.filter((a) => a.mode !== "primary")) const description = DESCRIPTION.replace( "{agents}", agents .map((a) => `- ${a.name}: ${a.description ?? "This subagent should only be called manually by the user."}`) .join("\n"), ) return { description, parameters: z.object({ description: z.string().describe("A short (3-5 words) description of the task"), prompt: z.string().describe("The task for the agent to perform"), subagent_type: z.string().describe("The type of specialized agent to use for this task"), session_id: z.string().describe("Existing Task session to continue").optional(), }), async execute(params, ctx) ```
Author
Owner

@tgrushka commented on GitHub (Jan 10, 2026):

Yes, why does it always start in Build mode? That's annoying and dangerous. It should by default start in Plan mode unless specifically set by the user to start in Build mode.

Actually, why not at minimum keep the same setting the user had last time instead of resetting it? It doesn't make sense that it doesn't store the preference. It's like setting a preference, then exiting an app, then having to reset it.

So a preference for a specific agent, or the last agent the user had selected ("automatic")?

@tgrushka commented on GitHub (Jan 10, 2026): Yes, why does it always start in Build mode? That's annoying and dangerous. It should by default start in Plan mode unless specifically set by the user to start in Build mode. Actually, why not at minimum keep the same setting the user had last time instead of resetting it? It doesn't make sense that it doesn't store the preference. It's like setting a preference, then exiting an app, then having to reset it. So a preference for a specific agent, or the last agent the user had selected ("automatic")?
Author
Owner

@jdanbrown commented on GitHub (Feb 6, 2026):

I saw in my github email feed that someone left this comment earlier today and now it's gone (deleted I guess?), but I think it's worth addressing because it's probably a common question:

Why not simply add an alias to the shell configuration file?
alias opencode="opencode --agent plan"

This is what I originally tried too, but I ran into trouble because always having an --agent=... option messes up opencode subcommands, e.g. it breaks opencode session list:

$ opencode session list -n5
Session ID                      Title                      Updated
──────────────────────────────────────────────────────────────────
ses_4372144b0ffe57Tqg4XQsHOTNC  Greeting                   3:13 PM · 1/16/2026
ses_43721e396ffeCYLkR3Kp1rkc3r  Greeting                   3:12 PM · 1/16/2026
ses_437220afaffeLpqFRU6qCi40NE  Greeting                   3:12 PM · 1/16/2026
ses_437222cdfffe75JvohDScGOEoH  Greeting                   3:12 PM · 1/16/2026
ses_4372267bcffe6j0FOgt24yy2Qy  Greeting                   3:12 PM · 1/16/2026

$ opencode --agent=plan session list -n5
opencode session list

list sessions

Options:
  -h, --help        show help                                                              [boolean]
  -v, --version     show version number                                                    [boolean]
      --print-logs  print logs to stderr                                                   [boolean]
      --log-level   log level                   [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"]
  -n, --max-count   limit to N most recent sessions                                         [number]
      --format      output format             [string] [choices: "table", "json"] [default: "table"]

So I'd argue that having a proper config setting for the default agent is worthwhile, to avoid weird sharp edges like this.

@jdanbrown commented on GitHub (Feb 6, 2026): I saw in my github email feed that someone left this comment earlier today and now it's gone (deleted I guess?), but I think it's worth addressing because it's probably a common question: > Why not simply add an alias to the shell configuration file? > `alias opencode="opencode --agent plan"` This is what I originally tried too, but I ran into trouble because always having an `--agent=...` option messes up `opencode` subcommands, e.g. it breaks `opencode session list`: ```sh $ opencode session list -n5 Session ID Title Updated ────────────────────────────────────────────────────────────────── ses_4372144b0ffe57Tqg4XQsHOTNC Greeting 3:13 PM · 1/16/2026 ses_43721e396ffeCYLkR3Kp1rkc3r Greeting 3:12 PM · 1/16/2026 ses_437220afaffeLpqFRU6qCi40NE Greeting 3:12 PM · 1/16/2026 ses_437222cdfffe75JvohDScGOEoH Greeting 3:12 PM · 1/16/2026 ses_4372267bcffe6j0FOgt24yy2Qy Greeting 3:12 PM · 1/16/2026 $ opencode --agent=plan session list -n5 opencode session list list sessions Options: -h, --help show help [boolean] -v, --version show version number [boolean] --print-logs print logs to stderr [boolean] --log-level log level [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"] -n, --max-count limit to N most recent sessions [number] --format output format [string] [choices: "table", "json"] [default: "table"] ``` So I'd argue that having a proper config setting for the default agent is worthwhile, to avoid weird sharp edges like this.
Author
Owner

@rapcal commented on GitHub (Feb 6, 2026):

Thanks, @jdanbrown !

I had posted it but thought there should be more to it. So I'm glad you pointed out theses issues.

In the meantime I found out that the "default_agent" option already works in opencode.json - setting it to "plan" solves this issue.

@rapcal commented on GitHub (Feb 6, 2026): Thanks, @jdanbrown ! I had posted it but thought there should be more to it. So I'm glad you pointed out theses issues. In the meantime I found out that the "default_agent" option already works in opencode.json - setting it to "plan" solves this issue.
Author
Owner

@seantiz commented on GitHub (Feb 6, 2026):

Thanks, @jdanbrown !

I had posted it but thought there should be more to it. So I'm glad you pointed out theses issues.

In the meantime I found out that the "default_agent" option already works in opencode.json - setting it to "plan" solves this issue.

Where is this opencode.json?

I saw Claude recommended the same approach to me, but it's not obvious to me where this lives.

I looked through the help docs of the cli, and looked in the usual places (for non-Windows machines) .local and .config. I couldn't see anywhere that jumps out on where to put this.

@seantiz commented on GitHub (Feb 6, 2026): > Thanks, [@jdanbrown](https://github.com/jdanbrown) ! > > I had posted it but thought there should be more to it. So I'm glad you pointed out theses issues. > > In the meantime I found out that the "default_agent" option already works in opencode.json - setting it to "plan" solves this issue. Where is this `opencode.json`? I saw Claude recommended the same approach to me, but it's not obvious to me where this lives. I looked through the help docs of the cli, and looked in the usual places (for non-Windows machines) `.local` and `.config`. I couldn't see anywhere that jumps out on where to put this.
Author
Owner

@rapcal commented on GitHub (Feb 6, 2026):

You can find it in the schema

https://opencode.ai/config.json

Thanks, @jdanbrown !

I had posted it but thought there should be more to it. So I'm glad you pointed out theses issues.

In the meantime I found out that the "default_agent" option already works in opencode.json - setting it to "plan" solves this issue.

Where is this opencode.json?

I saw Claude recommended the same approach to me, but it's not obvious to me where this lives.

I looked through the help docs of the cli, and looked in the usual places (for non-Windows machines) .local and .config. I couldn't see anywhere that jumps out on where to put this.

@rapcal commented on GitHub (Feb 6, 2026): You can find it in the schema https://opencode.ai/config.json > > Thanks, [@jdanbrown](https://github.com/jdanbrown) ! > > > > I had posted it but thought there should be more to it. So I'm glad you pointed out theses issues. > > > > In the meantime I found out that the "default_agent" option already works in opencode.json - setting it to "plan" solves this issue. > > Where is this `opencode.json`? > > I saw Claude recommended the same approach to me, but it's not obvious to me where this lives. > > I looked through the help docs of the cli, and looked in the usual places (for non-Windows machines) `.local` and `.config`. I couldn't see anywhere that jumps out on where to put this.
Author
Owner

@hernancerm commented on GitHub (Feb 6, 2026):

I've noticed that when using "default_agent" set to plan, the colors are inverted in the TUI.

What I mean is that by default opencode starts with the Build agent and the TUI highlights the prompt area with purple. When pressing tab the agent becomes Plan and the highlight color is orange.

With the default agent as plan (through the new "default_agent" config opt), the colors are reversed: Build is highlighted with orange and Plan is highlighted with purple. Is this intentional?

@hernancerm commented on GitHub (Feb 6, 2026): I've noticed that when using "default_agent" set to plan, the colors are inverted in the TUI. What I mean is that by default opencode starts with the Build agent and the TUI highlights the prompt area with purple. When pressing <kbd>tab</kbd> the agent becomes Plan and the highlight color is orange. With the default agent as plan (through the new "default_agent" config opt), the colors are reversed: Build is highlighted with orange and Plan is highlighted with purple. Is this intentional?
Author
Owner

@rapcal commented on GitHub (Feb 6, 2026):

I guess the color is attached to the default agent, not build or plan. Any agent you set to default will have a color set on your theme

I've noticed that when using "default_agent" set to plan, the colors are inverted in the TUI.

What I mean is that by default opencode starts with the Build agent and the TUI highlights the prompt area with purple. When pressing tab the agent becomes Plan and the highlight color is orange.

With the default agent as plan (through the new "default_agent" config opt), the colors are reversed: Build is highlighted with orange and Plan is highlighted with purple. Is this intentional?

@rapcal commented on GitHub (Feb 6, 2026): I guess the color is attached to the default agent, not build or plan. Any agent you set to default will have a color set on your theme > I've noticed that when using "default_agent" set to plan, the colors are inverted in the TUI. > > What I mean is that by default opencode starts with the Build agent and the TUI highlights the prompt area with purple. When pressing <kbd>tab</kbd> the agent becomes Plan and the highlight color is orange. > > With the default agent as plan (through the new "default_agent" config opt), the colors are reversed: Build is highlighted with orange and Plan is highlighted with purple. Is this intentional?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2934