[FEATURE]: EDIT PLAN mode or allow editing of only certain (.md) files in PLAN mode #2555

Open
opened 2026-02-16 17:36:12 -05:00 by yindo · 18 comments
Owner

Originally created by @tgrushka on GitHub (Nov 3, 2025).

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Just signed up for Zen. Hoping to support this open-source project and have a better experience than I did with GitHub Copilot.

The AI agents are getting worse and more reckless. (Deliberate money grabbing by forcing users to use more tokens to accomplish something?) I ask it explicitly to create a plan file in PLAN mode. It complains that it cannot edit. So I turn on EDIT mode. And it goes haywire and starts editing the code and wrecking things. Happened to be GPT-5 but I've seen it happen with other agents too. All the agents seem to be getting more and more reckless and careless and not following user instructions. I think the word "caution" has been removed from their vocabulary.

Is there any way to have another mode, PLAN EDIT or EDIT PLAN that allows it to only CREATE or EDIT certain files (configurable, or *.md files by default or something)? (Or allow limited create/edit in the PLAN mode as configured by the user)?

The reason for this request is I am visually impaired and have the terminal enlarged, and copying is very, very difficult. It messes up the formatting, e.g. adds line breaks, and I can only copy a few lines at a time, and the agent just goes on and on. I can scroll the TUI, but it's tedious to copy, when it says, "I’m in plan-only (read-only) mode and cannot modify files. Here’s the updated ui/PLAN.md content for you to paste:". Right. It has no concept of, "if I put you in EDIT mode, you will take a bulldozer to my project and go haywire, and that will frustrate me."

Another feature that would be helpful would be a /copy command that would copy the previous response to the clipboard. Maybe been requested before, not sure. But I added to this issue because the two are kind of related.

Would really appreciate either of these features in whatever order is easiest. I think a lot of users would appreciate these. Thank you!

Originally created by @tgrushka on GitHub (Nov 3, 2025). ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request Just signed up for Zen. Hoping to support this open-source project and have a better experience than I did with GitHub Copilot. The AI agents are getting worse and more reckless. (Deliberate money grabbing by forcing users to use more tokens to accomplish something?) I ask it explicitly to create a plan file in PLAN mode. It complains that it cannot edit. So I turn on EDIT mode. And it goes haywire and starts editing the code and wrecking things. Happened to be GPT-5 but I've seen it happen with other agents too. All the agents seem to be getting more and more reckless and careless and not following user instructions. I think the word "caution" has been removed from their vocabulary. Is there any way to have another mode, PLAN EDIT or EDIT PLAN that allows it to only CREATE or EDIT certain files (configurable, or *.md files by default or something)? (Or allow limited create/edit in the PLAN mode as configured by the user)? The reason for this request is I am visually impaired and have the terminal enlarged, and copying is very, very difficult. It messes up the formatting, e.g. adds line breaks, and I can only copy a few lines at a time, and the agent just goes on and on. I can scroll the TUI, but it's tedious to copy, when it says, "I’m in plan-only (read-only) mode and cannot modify files. Here’s the updated ui/PLAN.md content for you to paste:". Right. It has no concept of, "if I put you in EDIT mode, you will take a bulldozer to my project and go haywire, and that will frustrate me." Another feature that would be helpful would be a `/copy` command that would copy the previous response to the clipboard. Maybe been requested before, not sure. But I added to this issue because the two are kind of related. Would really appreciate either of these features in whatever order is easiest. I think a lot of users would appreciate these. Thank you!
yindo added the discussion label 2026-02-16 17:36:12 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 3, 2025):

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

  • #2118: Add a /copy command to copy latest message (or allow scrolling while selecting text) - This issue specifically requests a /copy command to copy the entire last message to clipboard, which is exactly one of the features requested in this issue.

  • #2755: feat: Copy Mode for OpenCode - This comprehensive feature request discusses adding proper copy mode functionality and mentions that only entire message copying is currently available, which relates to the copy functionality requested here.

  • #3241: Opencode stuck in Plan mode - This issue discusses problems with Plan/Edit mode restrictions and the agent being unable to switch back from Plan mode, which relates to the request for better Plan/Edit mode control in this issue.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 3, 2025): This issue might be a duplicate of existing issues. Please check: - #2118: Add a /copy command to copy latest message (or allow scrolling while selecting text) - This issue specifically requests a `/copy` command to copy the entire last message to clipboard, which is exactly one of the features requested in this issue. - #2755: feat: Copy Mode for OpenCode - This comprehensive feature request discusses adding proper copy mode functionality and mentions that only entire message copying is currently available, which relates to the copy functionality requested here. - #3241: Opencode stuck in Plan mode - This issue discusses problems with Plan/Edit mode restrictions and the agent being unable to switch back from Plan mode, which relates to the request for better Plan/Edit mode control in this issue. Feel free to ignore if none of these address your specific case.
Author
Owner

@tgrushka commented on GitHub (Nov 3, 2025):

I am trying to create a tool to restrict editing to .md files, but not having much luck because:

  • The opencode npm package isn't available to be installed;
  • The API interface for creating tools is completely different than the one opencode uses internally (why?)
  • There seems no supported way to "wrap" or re-use existing tools.
// import { Tool } from "./tool"
// import { EditTool } from "./edit"
import { Tool } from "./opencode/packages/opencode/src/tool/tool"
import { MultiEditTool } from "./opencode/packages/opencode/src/tool/multiedit"
import z from "zod"

export const MdEditTool = Tool.define("multiedit", {
    description: "Edit .md files",
    parameters: z.object({
        filePath: z.string().describe("The absolute path to the file to modify"),
        edits: z
            .array(
                z.object({
                    filePath: z.string().describe("The absolute path to the file to modify"),
                    oldString: z.string().describe("The text to replace"),
                    newString: z.string().describe("The text to replace it with (must be different from oldString)"),
                    replaceAll: z.boolean().optional().describe("Replace all occurrences of oldString (default false)"),
                }),
            )
            .describe("Array of edit operations to perform sequentially on the file"),
    }),
    async execute(params, ctx) {
        if (!params.filePath.endsWith(".md")) {
            throw new Error("File is not an .md file. You cannot edit anything but .md files with this tool.")
        }
        const tool = await MultiEditTool.init()
        return await tool.execute(params, ctx)
    },
})

@tgrushka commented on GitHub (Nov 3, 2025): I am trying to create a tool to restrict editing to .md files, but not having much luck because: - The `opencode` npm package isn't available to be installed; - The API interface for creating tools is completely different than the one opencode uses internally (why?) - There seems no supported way to "wrap" or re-use existing tools. ```ts // import { Tool } from "./tool" // import { EditTool } from "./edit" import { Tool } from "./opencode/packages/opencode/src/tool/tool" import { MultiEditTool } from "./opencode/packages/opencode/src/tool/multiedit" import z from "zod" export const MdEditTool = Tool.define("multiedit", { description: "Edit .md files", parameters: z.object({ filePath: z.string().describe("The absolute path to the file to modify"), edits: z .array( z.object({ filePath: z.string().describe("The absolute path to the file to modify"), oldString: z.string().describe("The text to replace"), newString: z.string().describe("The text to replace it with (must be different from oldString)"), replaceAll: z.boolean().optional().describe("Replace all occurrences of oldString (default false)"), }), ) .describe("Array of edit operations to perform sequentially on the file"), }), async execute(params, ctx) { if (!params.filePath.endsWith(".md")) { throw new Error("File is not an .md file. You cannot edit anything but .md files with this tool.") } const tool = await MultiEditTool.init() return await tool.execute(params, ctx) }, }) ```
Author
Owner

@arsham commented on GitHub (Nov 3, 2025):

Very unrelated to this (I apologise for this!), but I think it would be beneficial to discuss it. I too have created a multiedit tool and it works ok so far. What I've noticed that we need to have a "permission" control over this, otherwise the agents would use it without asking permission. At the moment only internal tools can be set but not user tools.

@arsham commented on GitHub (Nov 3, 2025): Very unrelated to this (I apologise for this!), but I think it would be beneficial to discuss it. I too have created a `multiedit` tool and it works ok so far. What I've noticed that we need to have a "permission" control over this, otherwise the agents would use it without asking permission. At the moment only internal tools can be set but not user tools.
Author
Owner

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

yeah we are gonna rework permissions so that for all tools u can do very granular definitions

I may be misunderstanding, not sure what some of these mean:

  • The opencode npm package isn't available to be installed?
  • The API interface for creating tools is completely different than the one opencode uses internally (why?)

There seems no supported way to "wrap" or re-use existing tools.

You can override pre-existing tools but yeah I guess we don't expose a great way to do this

@rekram1-node commented on GitHub (Nov 3, 2025): yeah we are gonna rework permissions so that for all tools u can do very granular definitions I may be misunderstanding, not sure what some of these mean: - The opencode npm package isn't available to be installed? - The API interface for creating tools is completely different than the one opencode uses internally (why?) > There seems no supported way to "wrap" or re-use existing tools. You can override pre-existing tools but yeah I guess we don't expose a great way to do this
Author
Owner

@taqtiqa-mark commented on GitHub (Nov 4, 2025):

@tgrushka; I think the general statement for what you want is "User configurable (editable) system prompts".
This and related issues have been discussed elsewhere, in case it helps:
#3195
#1894
#356

@taqtiqa-mark commented on GitHub (Nov 4, 2025): @tgrushka; I think the general statement for what you want is "User configurable (editable) system prompts". This and related issues have been discussed elsewhere, in case it helps: #3195 #1894 #356
Author
Owner

@mirbasit01 commented on GitHub (Nov 4, 2025):

This is an interesting idea. Restricting edits to specific file types like .md could make Plan mode much safer and more predictable. It would be great to see limited edit permissions added in future versions.

@mirbasit01 commented on GitHub (Nov 4, 2025): This is an interesting idea. Restricting edits to specific file types like `.md` could make Plan mode much safer and more predictable. It would be great to see limited edit permissions added in future versions.
Author
Owner

@ravshansbox commented on GitHub (Nov 4, 2025):

Can we configure current plan mode with editing *.md files capability? Adding one more mode will overcomplicate switching.

@ravshansbox commented on GitHub (Nov 4, 2025): Can we configure current plan mode with editing *.md files capability? Adding one more mode will overcomplicate switching.
Author
Owner

@dchasman commented on GitHub (Nov 4, 2025):

+1

@dchasman commented on GitHub (Nov 4, 2025): +1
Author
Owner

@taqtiqa-mark commented on GitHub (Nov 5, 2025):

@tgrushka another workaround is to run OpenCode in a container (access project files via a mount).
The critical part here is to ensure this folder is mounted to a location on your host where you can regain control of the prompts.

Not sure if OC will permit such full control via config settings, but even if not, this imperfect workaround should help?

@taqtiqa-mark commented on GitHub (Nov 5, 2025): @tgrushka another workaround is to run OpenCode in a container (access project files via a mount). The critical part here is to ensure [this folder](https://github.com/sst/opencode/tree/dev/packages/opencode/src/session/prompt) is mounted to a location on your host where you can regain control of the prompts. Not sure if OC will permit such full control via config settings, but even if not, this imperfect workaround should help?
Author
Owner

@Mishkun commented on GitHub (Nov 6, 2025):

@tgrushka Try to explicitly instruct it to create a plan.md file with plan on implementing this feature.

This works for me 100% of time even though I don't use plan mode at all and use build mode for planning

@Mishkun commented on GitHub (Nov 6, 2025): @tgrushka Try to explicitly instruct it to create a plan.md file with plan on implementing this feature. This works for me 100% of time even though I don't use plan mode at all and use build mode for planning
Author
Owner

@iamhenry commented on GitHub (Dec 11, 2025):

@rekram1-node is there an update on this?

Granular editing permissions by agent would be extremely helpful

@iamhenry commented on GitHub (Dec 11, 2025): @rekram1-node is there an update on this? Granular editing permissions by agent would be extremely helpful
Author
Owner

@airtonix commented on GitHub (Dec 12, 2025):

@tgrushka you can do this already with plugins, the env example shows you how.

https://opencode.ai/docs/plugins/#env-protection

@airtonix commented on GitHub (Dec 12, 2025): @tgrushka you can do this already with plugins, the env example shows you how. https://opencode.ai/docs/plugins/#env-protection
Author
Owner

@osnoser1 commented on GitHub (Jan 12, 2026):

I would also love this feature

EDIT: I specified in the plan mode to create a md file: Create the complete implementation plan with the migration file and all frontend changes in a PLAN.md file and it was able to do it

Image
@osnoser1 commented on GitHub (Jan 12, 2026): I would also love this feature EDIT: I specified in the plan mode to create a md file: `Create the complete implementation plan with the migration file and all frontend changes in a PLAN.md file` and it was able to do it <img width="1254" height="706" alt="Image" src="https://github.com/user-attachments/assets/2520bcaa-c808-4ffb-829e-bfa86bc17977" />
Author
Owner

@art-shen commented on GitHub (Jan 14, 2026):

I also would love to see automatic plan file handling, like it's currently done in Claude Code, when the plan mod explicitly attaches a separate unique file as a plan that’s available through all the compactions and reminded to the model.

@art-shen commented on GitHub (Jan 14, 2026): I also would love to see automatic plan file handling, like it's currently done in Claude Code, when the plan mod explicitly attaches a separate unique file as a plan that’s available through all the compactions and reminded to the model.
Author
Owner

@JaredEzz commented on GitHub (Jan 19, 2026):

+1 for this. Coming from Claude Code, it's a simple thing there and not simple to set up in OpenCode

@JaredEzz commented on GitHub (Jan 19, 2026): +1 for this. Coming from Claude Code, it's a simple thing there and not simple to set up in OpenCode
Author
Owner

@art-shen commented on GitHub (Jan 20, 2026):

Another useful feature is the option to clean the context after the planning phase, leaving only the plan itself (+ plan file reference). This helps a lot with efficient context management in complex situations.

@art-shen commented on GitHub (Jan 20, 2026): Another useful feature is the option to clean the context after the planning phase, leaving only the plan itself (+ plan file reference). This helps a lot with efficient context management in complex situations.
Author
Owner

@ZombieHarvester commented on GitHub (Jan 20, 2026):

I also would love to see automatic plan file handling, like it's currently done in Claude Code, when the plan mod explicitly attaches a separate unique file as a plan that’s available through all the compactions and reminded to the model.

Unlike Claude Code, it would be great if OpenCode could:

  • give plan files sensible names
  • prefix them with a date, for example 2026-01-30_implement_feature_1.md
@ZombieHarvester commented on GitHub (Jan 20, 2026): > I also would love to see automatic plan file handling, like it's currently done in Claude Code, when the plan mod explicitly attaches a separate unique file as a plan that’s available through all the compactions and reminded to the model. Unlike Claude Code, it would be great if OpenCode could: - give plan files sensible names - prefix them with a date, for example `2026-01-30_implement_feature_1.md`
Author
Owner

@ravshansbox commented on GitHub (Jan 20, 2026):

Unlike Claude Code, it would be great if OpenCode could:

  • give plan files sensible names
  • prefix them with a date, for example 2026-01-30_implement_feature_1.md

And configurable folder to store in with sensible default

@ravshansbox commented on GitHub (Jan 20, 2026): > Unlike Claude Code, it would be great if OpenCode could: > > * give plan files sensible names > * prefix them with a date, for example `2026-01-30_implement_feature_1.md` And configurable folder to store in with sensible default
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2555