Skip to content

BUG: Overriding built-in agents, doesn't allow overriding permissions #3575

Closed

Description

@oribarilan

Description

I am overriding the built-in agents (e.g., using agent/plan.md) which although not documented, it successfully catches my new prompt. However, I want this agent to be able to write markdown files, but even though i am properly setting permissions, agent qoutes:

"CRITICAL: Plan mode ACTIVE - you are in READ-ONLY phase. STRICTLY
FORBIDDEN: ANY file edits, modifications, or system changes...

Expected behavior in my opinion is that if another definition of a plan agent exists, it should bypass the original plan agent entirely.

OpenCode version

0.15.29 (latest)

Steps to reproduce

  1. define plan.md agent
  2. give it write permissions (e.g., to a .md files, example below)
  3. give it a custom prompt
  4. ask it to generate a file and see your prompt is used but permissions are ignored

permission example:

permissions:
  write:
    ".plan/*": allow
    "*": deny
  edit:
    ".plan/*": allow
    "*": deny

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

    Ahh this is something I stupidly didn't think about lol

    The prompt reminder we give it says it can't edit files, we should probably adjust it to tell the agent it's own permissions and encourage it to obey them.

    Then we can use some basic templating to fix this

  2. self-assigned this
    on Oct 30, 2025
  3. oribarilan commented on Oct 30, 2025

    @oribarilan
    ContributorAuthor

    why not allowing to override built-in agent entirely? Instead of messing with carry-over from built-in spec to a custom agent with the same name, we can just allow a complete override.
    So, if the user defines a "plan" agent, the built-in one become obsolete, and the PLAN agent that appears points to the custom agent entirely.
    Sounds simpler and more pragmatic

  4. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

    Well you can override everything for the agent, but we also inject <system-reminders> that are not part of the system prompt

    That is why you see this behavior

    So perhaps we can expose that in some way instead

  5. oribarilan commented on Oct 30, 2025

    @oribarilan
    ContributorAuthor

    oh interesting. i wonder why these are not implemented simply as permissions (that can be overriden). sounds like a non-trivial decision so I'll just rename my agent to something other than plan for now :)

    is there anyway to disable a built-in agent?

  6. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

    is there anyway to disable a built-in agent?

    Not rn no

    i wonder why these are not implemented simply as permissions

    They are implemented as permissions but there are system reminders too (essentially just hidden user messages), because we don't want the agent to try to abuse the tools it does have to get around the idea of being in "plan" mode

    I don't think it is non-trivial to add some way to customize around this, just probably not the highest priority atm

  7. ferrao commented on Oct 30, 2025

    @ferrao
    Contributor

    ... so I'll just rename my agent to something other than plan for now :)

    Exactly what I did, so I now have a plan and a planner agent ;)
    It's not the worse thing in the world, but of course simply being able to disable the built in agents would make it cleaner.

  8. oribarilan commented on Oct 30, 2025

    @oribarilan
    ContributorAuthor

    @rekram1-node if you want to spec a solution i can try to tackle it
    (disable built-in agent, avoid plan system reminders if user has plan agent, etc.)

  9. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

    the system reminder may need to be thought out a little bit just to see what makes sense but disabled would be fine, maybe add a disabled field to an agent definition similar to how lsp and formatters have it defined

  10. oribarilan commented on Oct 31, 2025

    @oribarilan
    ContributorAuthor

    sounds good. I will take a shot at it, after my currently open PR is resolved :) (#3580)

  11. gw0 commented on Nov 13, 2025

    @gw0

    is there anyway to disable a built-in agent?

    Not rn no

    In OpenCode 1.0.61 one can disable an built-in agent (https://opencode.ai/docs/agents/#disable), but it is still not possible to reuse its name or override it with the agent markdown definition.

    I have a feeling everything would be simpler if built-in agents would also be defined with the agent markdown definition instead of with code, then overrides could be supported at the file-loading level.

  12. mintchaos commented on Jan 6, 2026

    @mintchaos

    I ran into some unexpected behavior around this. I added the atlassian mcp server and wanted to use the built in plan agent to plan out some new tickets with some back and forth. But the plan agent just went ahead and made the ticket right away.

    Which now that I know more makes sense because nothing in the default perms denys it from using mcp calls.

    I think I could fix it by adding something like this but that doesn't help if I can't override permissions easily.

    "tools": {
        "atlassian*": false,
        "atlassian_getJira*": true
      }

    Furthermore when I asked it to update the ticket after some further planning it had an issue with the mcp calls and then just went ahead and made the changes to the codebase while still in the plan agent. Which was unexpected. This was however on v1.0.220 as I didn't realize that homebrew didn't have the latest. I've since updated.

    I do wonder if it'd be best to make some jira specific subagents and give them structured perms and prompts.

  13. estenp commented on Feb 8, 2026

    @estenp

    Yeah it's annoying the solution here is to just disable the built in because a) you can't unreserve it's name and b) it doesn't track with the docs which imply over and over you can override the built in's via json or markdown by naming the agent config the same as the built in.

    https://opencode.ai/docs/agents/#configure

    If disabling and renaming built ins is the solution for the foreseeable future the docs should probably be updated because it's all quite misleading.

    Fwiw in my testing:

    1. using opencode.json, and overriding "build" to disable writes did not stop it from writing.
    2. using opencode.json, and overriding "plan" to enable writes did not allow it to write.
    3. using .opencode/agents/build.md with write disabled does disable writes.
    4. using .opencode/agents/plan.md with write enabled still does not allow writes.
  14. github-actions commented on Apr 10, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 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

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions