Skip to content

Shared prompt in agent markdown definition #7369

Closed as not planned
Closed as not planned

Description

@atanasna

Question

Hi all

I have 2 agents that have the same scope of work, they basicaly have the same prompt but they defer in other parts like, model, permissions, etc. I have these two defined under .opencode/agent/lite.md and .opencode/agent/heavy.md. The only difference between the two is in the frontmater of the file.

My issue is that I want to have a single file used as prompt for both agents.
I saw that I can use the prompt:, but this seems to only be working if the agents are defined under opencode.json

I really like the freedom that I have by specifying the agents under .opencode/agent and would like to keep them there

Is there any way to do that ?

Activity

  1. changed the title [-]Shared prompt in agent yaml definition[/-] [+]Shared prompt in agent markdown definition[/+] on Jan 8, 2026
  2. github-actions commented on Jan 8, 2026

    @github-actions
    Contributor

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

    Both issues relate to the core request of reusing prompt/content across multiple agent definitions in markdown files. Feel free to ignore if none of these address your specific case.

  3. ariane-emory commented on Jan 9, 2026

    @ariane-emory
    Contributor

    What do you imagine this looking like in the Markdown file? Would it reuse the {file:somefile.md} syntax used in the JSON configuration files?

    Adding some of these details might make it easier to try to come up with a resolution.

  4. atanasna commented on Jan 9, 2026

    @atanasna
    Author

    Sorry if the description was not good enough. I imagine having 2 agent definitions, something similar to the following in <project_path>/.opencode/agent directory

    ---
    description: |
      Scope: ...
      Trigger: ...
    name: light
    color: "#ffd580"
    mode: subagent
    ---
    [include](docs/shared_prompts.md)
    ---
    description: |
      Scope: ...
      Trigger: ...
    name: heavy
    color: "#ffdee2"
    mode: subagent
    ---
    [include](docs/shared_prompts.md)

    Instead of the [include] it can be a @ notation like in claudecode, prompt in frontmatter or anything else. I don't really care about the actual syntax. The point is that I would have a 3th file shared_promped.md in my project dir that will have the prompt for both agents and that can be included in both agent's md definitions under .opencode/agent

  5. github-actions commented on Mar 25, 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

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions