[FEATURE]: Allow custom system prompts in global, project or custom directories #4316

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

Originally created by @dan-and on GitHub (Jan 6, 2026).

Originally assigned to: @thdxr on GitHub.

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

Based on a reddit discussion on shorter system prompts, I checked how it could be implemented in opencode, to allow custom prompts.

This would allow experimenting with the system prompt (especially on low-end models with limited context window)

Perfect would be a similar approach as for opencode.json:

Lowest to highest priority:

  • bundled system prompts inside opencode deployment
  • global system prompts at ~/.config/opencode/prompt/<name.txt>. (following bundled system prompt naming scheme)
  • project-instance prompts at /.opencode/prompt/<name.txt>. (following bundled system prompt naming scheme)
  • environment variable to overrule all other version with a path to a .../prompt/ directory, where the system prompts are provided.

Why it matters?

Foremost, I thought, I could do a similar approach as the author of the reddit post by adding smaller prompts into AGENTS.md / CONTEXT.md, but of course these are appended to the existing bundled system prompts.

First I gave the variant of replacing the prompt inside opencode sources a try, which worked pretty well, but to make faster iterations on the system prompts, it is much more convenient for me (and probably other users) to have the chance to keep system prompts on a global or project level.

Finally I hope that such a feature would accelerate the system prompt development for opencode in general.

Originally created by @dan-and on GitHub (Jan 6, 2026). Originally assigned to: @thdxr on GitHub. ### 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 Based on a [reddit discussion on shorter system prompts](https://www.reddit.com/r/opencodeCLI/comments/1p6lxd4/shortened_system_prompts_in_opencode/), I checked how it could be implemented in opencode, to allow custom prompts. This would allow experimenting with the system prompt (especially on low-end models with limited context window) Perfect would be a similar approach as for opencode.json: Lowest to highest priority: - bundled system prompts inside opencode deployment - global system prompts at ~/.config/opencode/prompt/<name.txt>. (following bundled system prompt naming scheme) - project-instance prompts at <instance-path>/.opencode/prompt/<name.txt>. (following bundled system prompt naming scheme) - environment variable to overrule all other version with a path to a .../prompt/ directory, where the system prompts are provided. Why it matters? Foremost, I thought, I could do a similar approach as the author of the reddit post by adding smaller prompts into AGENTS.md / CONTEXT.md, but of course these are appended to the existing bundled system prompts. First I gave the variant of replacing the prompt inside opencode sources a try, which worked pretty well, but to make faster iterations on the system prompts, it is much more convenient for me (and probably other users) to have the chance to keep system prompts on a global or project level. Finally I hope that such a feature would accelerate the system prompt development for opencode in general.
yindo added the discussion label 2026-02-16 17:43:24 -05:00
Author
Owner

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

This issue might be a duplicate of or closely related to existing issues. Please check:

  • #7092: Feature to allow plan mode to save plans to configurable paths (similar concept of configurable file paths for specific functionality)
  • #7003: OPENCODE_CONFIG_DIR ignored for global AGENTS.md (related to configuration directory hierarchy issues)

Feel free to ignore if your request addresses concerns beyond these related issues.

@github-actions[bot] commented on GitHub (Jan 6, 2026): This issue might be a duplicate of or closely related to existing issues. Please check: - #7092: Feature to allow plan mode to save plans to configurable paths (similar concept of configurable file paths for specific functionality) - #7003: `OPENCODE_CONFIG_DIR` ignored for global `AGENTS.md` (related to configuration directory hierarchy issues) Feel free to ignore if your request addresses concerns beyond these related issues.
Author
Owner

@dan-and commented on GitHub (Jan 6, 2026):

My feature request is not related to the 7092 and 7003.

@dan-and commented on GitHub (Jan 6, 2026): My feature request is not related to the 7092 and 7003.
Author
Owner

@dan-and commented on GitHub (Jan 6, 2026):

@thdxr , thanks for looking into it. I made this code change already on my local instance, but will wait for your comments, if a a merge request is welcome. (see: https://github.com/dan-and/opencode_custom_system_prompts/tree/dev )

@dan-and commented on GitHub (Jan 6, 2026): @thdxr , thanks for looking into it. I made this code change already on my local instance, but will wait for your comments, if a a merge request is welcome. (see: https://github.com/dan-and/opencode_custom_system_prompts/tree/dev )
Author
Owner

@dan-and commented on GitHub (Jan 13, 2026):

@thdxr , do you want any additional information, or can I help you to validate this feature request?

@dan-and commented on GitHub (Jan 13, 2026): @thdxr , do you want any additional information, or can I help you to validate this feature request?
Author
Owner

@ArtCraft commented on GitHub (Jan 14, 2026):

This killer feature is exactly what I’ve been missing in OpenCode. The default system prompts are extremely large, overly opinionated, and they fail to cover the full range of use cases where OpenCode could truly shine. Allowing users to override them would make OpenCode far more appealing — both for me and for hundreds of other users who value having full control over their workflow.

Looking forward to see it in next build !
Great job @dan-and !

P.S. I set up a local proxy to inspect what is actually being sent to the LLM provider by default. In planning mode, the payload reaches 311 KB, burning more than 18k tokens per request, and it even includes the clumsy default system prompt twice. 🤦

@ArtCraft commented on GitHub (Jan 14, 2026): This killer feature is exactly what I’ve been missing in OpenCode. The default system prompts are extremely large, overly opinionated, and they fail to cover the full range of use cases where OpenCode could truly shine. Allowing users to override them would make OpenCode far more appealing — both for me and for hundreds of other users who value having full control over their workflow. Looking forward to see it in next build ! Great job @dan-and ! P.S. I set up a local proxy to inspect what is actually being sent to the LLM provider by default. In planning mode, the payload reaches 311 KB, burning more than 18k tokens per request, and it even includes the clumsy default system prompt twice. 🤦
Author
Owner

@malhashemi commented on GitHub (Jan 16, 2026):

Hey guys just a question here, isn't that what primary agents for? You can in theory write your own custom prompt for the build agent if you would like to, however I believe we simply need a toggle in the frontmatter that decides if we want that to be replacing the system prompt or adding to it. Similar to how output styles work in Claude Code.

@malhashemi commented on GitHub (Jan 16, 2026): Hey guys just a question here, isn't that what primary agents for? You can in theory write your own custom prompt for the build agent if you would like to, however I believe we simply need a toggle in the frontmatter that decides if we want that to be replacing the system prompt or adding to it. Similar to how output styles work in Claude Code.
Author
Owner

@dan-and commented on GitHub (Jan 16, 2026):

Hi @malhashemi ,

Correct me if I am wrong, but as I understand it, the Agent is on top of the system prompt and usually optimized for a specific language model (family).

At the end: It doesn't hurt to have control over the system prompt - especially when there are new language models coming up and the users can accelerate the adoption of opencode on the new model by quickly optimizing the system prompt.

@dan-and commented on GitHub (Jan 16, 2026): Hi @malhashemi , Correct me if I am wrong, but as I understand it, the Agent is on top of the system prompt and usually optimized for a specific language model (family). At the end: It doesn't hurt to have control over the system prompt - especially when there are new language models coming up and the users can accelerate the adoption of opencode on the new model by quickly optimizing the system prompt.
Author
Owner

@malhashemi commented on GitHub (Jan 16, 2026):

Hi @malhashemi ,

Correct me if I am wrong, but as I understand it, the Agent is on top of the system prompt and usually optimized for a specific language model (family).

At the end: It doesn't hurt to have control over the system prompt - especially when there are new language models coming up and the users can accelerate the adoption of opencode on the new model by quickly optimizing the system prompt.

Correct but what I was saying from UX perspective it makes sense to me to just allow the agent to override the system prompt rather than add to it by having a flag in the frontmatter, I am almost certain that CC allows for such behaviour with output-styles which is practically CC version of OC primary agents.

@malhashemi commented on GitHub (Jan 16, 2026): > Hi [@malhashemi](https://github.com/malhashemi) , > > Correct me if I am wrong, but as I understand it, the Agent is on top of the system prompt and usually optimized for a specific language model (family). > > At the end: It doesn't hurt to have control over the system prompt - especially when there are new language models coming up and the users can accelerate the adoption of opencode on the new model by quickly optimizing the system prompt. Correct but what I was saying from UX perspective it makes sense to me to just allow the agent to override the system prompt rather than add to it by having a flag in the frontmatter, I am almost certain that CC allows for such behaviour with output-styles which is practically CC version of OC primary agents.
Author
Owner

@malhashemi commented on GitHub (Jan 16, 2026):

Found it it is called keep-coding-instructions: false we could do something similar here maybe override-system-promot: true with the default being false this way we can have control over the actual system prompt while preserving the basic functionality (like available tools, skills, model) etc. It has always been annoying to me when I create custom agents that are not meant to be used for coding to know that my custom agents prompt is just being added over a massive system prompt for no reason.

What do you think of this approach?

@rekram1-node any input here?

@malhashemi commented on GitHub (Jan 16, 2026): Found it it is called `keep-coding-instructions: false` we could do something similar here maybe `override-system-promot: true` with the default being `false` this way we can have control over the actual system prompt while preserving the basic functionality (like available tools, skills, model) etc. It has always been annoying to me when I create custom agents that are not meant to be used for coding to know that my custom agents prompt is just being added over a massive system prompt for no reason. What do you think of this approach? @rekram1-node any input here?
Author
Owner

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

I very much want this feature added into OpenCode because I find myself fighting the system prompts time and time again because they contradict my own AGENTS.md instructions.

@earthslasthope commented on GitHub (Jan 20, 2026): I very much want this feature added into OpenCode because I find myself fighting the system prompts time and time again because they contradict my own AGENTS.md instructions.
Author
Owner

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

This feature, once implemented, would be a game-changer for lightweight local models.

At present, local models such as Phi4 or gpt-oss typically fail with errors like:
the request exceeds the available context size, try increasing it.

However, after manually reducing the JSON payload by intercepting and modifying the HTTP request (using a web debugging proxy and regex-based stripping), these models work correctly with OpenCode.

Providing a supported way to minimise system prompts and tool instructions would be extremely valuable and would significantly improve the usability of lightweight local models.

Image

@Enelass commented on GitHub (Jan 20, 2026): This feature, once implemented, would be a game-changer for lightweight local models. At present, local models such as `Phi4` or `gpt-oss` typically fail with errors like: `the request exceeds the available context size, try increasing it.` However, after manually reducing the JSON payload by intercepting and modifying the HTTP request (using a web debugging proxy and regex-based stripping), these models work correctly with OpenCode. Providing a supported way to minimise system prompts and tool instructions would be extremely valuable and would significantly improve the usability of lightweight local models. ![Image](https://github.com/user-attachments/assets/8b94502d-e2ad-45a9-9105-bcd897f2bcd1)
Author
Owner

@DunaSpice commented on GitHub (Jan 28, 2026):

Will it be implemented? Is there a way to speed it up? Given it's a game changer?

@DunaSpice commented on GitHub (Jan 28, 2026): Will it be implemented? Is there a way to speed it up? Given it's a game changer?
Author
Owner

@dan-and commented on GitHub (Jan 31, 2026):

It's a bit sad that I never got any response for this issue and the corresponding pullrequest, but thdxr did build his own solution to the custom model request.

So everybody who waited for a solution: It's available today with the commit: https://github.com/anomalyco/opencode/commit/6ecd011e51f8e38bdf1287e0d054e650437f95fc

Hope you all are pleased with a solution via environmental path only.

@dan-and commented on GitHub (Jan 31, 2026): It's a bit sad that I never got any response for this issue and the corresponding pullrequest, but thdxr did build his own solution to the custom model request. So everybody who waited for a solution: It's available today with the commit: https://github.com/anomalyco/opencode/commit/6ecd011e51f8e38bdf1287e0d054e650437f95fc Hope you all are pleased with a solution via environmental path only.
Author
Owner

@earthslasthope commented on GitHub (Jan 31, 2026):

It's a bit sad that I never got any response for this issue and the corresponding pullrequest, but thdxr did build his own solution to the custom model request.

So everybody who waited for a solution: It's available today with the commit: 6ecd011

Hope you all are pleased with a solution via environmental path only.

I still appreciate you taking the time to put together your PR and doing what was asked to get this to be mergeable. You did your part! Now I can finally nuke the god damn default system prompts without having to maintain a fork of this repo :) The longer this feature took to get implemented the more I started to hate the system prompts.

@earthslasthope commented on GitHub (Jan 31, 2026): > It's a bit sad that I never got any response for this issue and the corresponding pullrequest, but thdxr did build his own solution to the custom model request. > > So everybody who waited for a solution: It's available today with the commit: [6ecd011](https://github.com/anomalyco/opencode/commit/6ecd011e51f8e38bdf1287e0d054e650437f95fc) > > Hope you all are pleased with a solution via environmental path only. I still appreciate you taking the time to put together your PR and doing what was asked to get this to be mergeable. You did your part! Now I can finally nuke the god damn default system prompts without having to maintain a fork of this repo :) The longer this feature took to get implemented the more I started to hate the system prompts.
Author
Owner

@infernix commented on GitHub (Feb 3, 2026):

I'm not sure why this was closed as completed? How does a custom models-api.json allow for specifying your own system prompts? Am I missing something? The issue @Enelass points out with small context models is still absolutely valid here.

@infernix commented on GitHub (Feb 3, 2026): I'm not sure why this was closed as completed? How does a custom models-api.json allow for specifying your own system prompts? Am I missing something? The issue @Enelass points out with small context models is still absolutely valid here.
Author
Owner

@contentnation commented on GitHub (Feb 3, 2026):

I don't get how the model path can change the system prompt (using ollama), can anyone explain this to me. What do I have to do in that other path?

@contentnation commented on GitHub (Feb 3, 2026): I don't get how the model path can change the system prompt (using ollama), can anyone explain this to me. What do I have to do in that other path?
Author
Owner

@SublimePeace commented on GitHub (Feb 16, 2026):

@dan-and would you please be open to re-opening this PR, maybe it's considered again (even if down the line)? This is one of the most reacted PRs, highly visible in google search, and it's clearly something people want, I got here from search as well.

Even if the inconvenient and needlessly unaccessible workaround was implemented by the team, it's still not mentioned anywhere in the documentation, making it near impossible for anyone to even find a solution to the - clearly highly requested - problem of not being able to change the system prompt

@SublimePeace commented on GitHub (Feb 16, 2026): @dan-and would you please be open to re-opening this PR, maybe it's considered again (even if down the line)? This is one of the most reacted PRs, highly visible in google search, and it's clearly something people want, I got here from search as well. Even if the inconvenient and needlessly unaccessible workaround was implemented by the team, it's still not mentioned anywhere in the documentation, making it near impossible for anyone to even find a solution to the - clearly highly requested - problem of not being able to change the system prompt
Author
Owner

@dan-and commented on GitHub (Feb 16, 2026):

@thdxr please close again, if the opencode team is pleased with their solution. It's fine for me, but people contact me because they would like to see this solution.

@dan-and commented on GitHub (Feb 16, 2026): @thdxr please close again, if the opencode team is pleased with their solution. It's fine for me, but people contact me because they would like to see this solution.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4316