Shared prompt in agent markdown definition #4451

Open
opened 2026-02-16 17:43:49 -05:00 by yindo · 3 comments
Owner

Originally created by @atanasna on GitHub (Jan 8, 2026).

Originally assigned to: @thdxr on GitHub.

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 ?

Originally created by @atanasna on GitHub (Jan 8, 2026). Originally assigned to: @thdxr on GitHub. ### 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 ?
Author
Owner

@github-actions[bot] commented on GitHub (Jan 8, 2026):

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

  • #2965: How to reference other mds in the md of Subagents by using @? - This discusses using @references in agent markdown files to include other markdown content
  • #3195: Dynamic system prompts for custom agents - This addresses the challenge of sharing prompt content across multiple agent configurations

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.

@github-actions[bot] commented on GitHub (Jan 8, 2026): This issue might be a duplicate of existing issues. Please check: - #2965: How to reference other mds in the md of Subagents by using @? - This discusses using @references in agent markdown files to include other markdown content - #3195: Dynamic system prompts for custom agents - This addresses the challenge of sharing prompt content across multiple agent configurations 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.
Author
Owner

@ariane-emory commented on GitHub (Jan 8, 2026):

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.

@ariane-emory commented on GitHub (Jan 8, 2026): 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.
Author
Owner

@atanasna commented on GitHub (Jan 9, 2026):

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

@atanasna commented on GitHub (Jan 9, 2026): 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 ```markdown --- description: | Scope: ... Trigger: ... name: light color: "#ffd580" mode: subagent --- [include](docs/shared_prompts.md) ``` ```markdown --- 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
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4451