Skip to content

Separate instructions for the “main” agent vs. sub-agents #1668

Closed

Description

@jessevdp

Currently, you can give custom instructions to opencode via the AGENTs.md file (or by specifying other instructions paths).

If I understand correctly, these instructions are passed to every new session. And since sub-agents are really just “invisible sessions” they also receive all the same instructions as the “main” session.

Sub-agents receive additional custom instructions as configured.

There seems to be no way to give specialized instructions ONLY to the “main session”.

Does that make sense?


The reason I want something like this is because I’m attempting to implement a workflow where the “main session” becomes “the orchestrator”. I’m giving it very strict instructions about the steps it should follow to drive a change through to completion. Right now I’m putting these instructions in AGENTS.md and it’s confusing (+ polluting the context of) the sub-agents.

In this context each agent takes on a “role”. The current sub-agents have roles like “test writer”, “linter fixer”. I want the main session to also take on a specialized role: “the orchestrator”.

Does that make sense?

Activity

  1. self-assigned this
    on Aug 7, 2025
  2. jessevdp commented on Aug 8, 2025

    @jessevdp
    ContributorAuthor

    Perhaps custom slash commands (#299) would be an OK fit for this? At least as a workaround. It would give me a way to easily insert a prompt into the main session to get it to take on the role of a specialized agent.

    That does mean that this prompt isn't going into the system messages. Would that make a big difference?

    I still think that the concept of "choosing an agent" (or personality?) to chat with is pretty cool and could be useful.

    I've seen others ask about getting to "control" the sub-agents and chat with them. To use them more as separate agents that "hand off" to each other with the human still in the mix. (I'll search for and link to an issue if it exists.)

    Perhaps this concept of "choosing an agent" (/personality) for the main chat combines nicely with that?

  3. jessevdp commented on Aug 8, 2025

    @jessevdp
    ContributorAuthor

    LMAO here I am pondering about this, and you already shipped this exact fucking thing. (#1689) Way to go!

    Thx @thdxr ❤️

  4. JamesJosephFinn commented on Aug 31, 2025

    @JamesJosephFinn

    Are subagents provided with a fresh context / prompt, which is constructed dynamically, on the fly, by the primary agent which spawned them? Thank you to the team for such an amazing tool!

  5. rekram1-node commented on Aug 31, 2025

    @rekram1-node
    Collaborator

    yes thats correct

  6. bogorad commented on Jan 16, 2026

    @bogorad
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