Skip to content

Conversation

@dan-and
Copy link

@dan-and dan-and commented Jan 7, 2026

Feature Request: #7101

This PR adds support for a priority overrule of the opencode bundled system prompts in global, project or custom directory (via Env Setting)

Why is it helpful?
In a reddit post, someone started creating very compact system-prompts to free up capacity in the context window. This patch allows using tailored system prompts instead of the bundled prompts.
I hope this will increase creative and productive evolution on the system prompts for opencode and make it even more awesome.

How does it works:
opencode (currently) uses the following system prompt files:

Modelname -> Filename
anthropic / claude -> anthropic.txt
gpt-5 -> codex.txt
gpt-, o1, o3 -> beast.txt
gemini- -> gemini.txt
Fallback, if nothing matches -> qwen.txt

With this PR, opencode codes will load the matching system prompt file in following order (highest priority to lowest priority):

  • Environment: $OPENCODE_PROMPTS_DIR (e.g. OPENCODE_PROMPTS_DIR=/home/coder/my-custom-prompts)
  • In the project-directory (e.g. : /home/coder/source/awesome-project/.opencode/prompt/.txt )
  • Global system prompts at ~/.config/opencode/prompt/<name.txt>
  • Opencode's bundled system prompts inside opencode deployment

Q&A:
Why not use AGENTS.md?

  • AGENTS.md will append to the bundled system prompt, not replace it. So it won't help building tailored system prompts for new or low-spec coding models.

Why are the prompts under the /prompt/ directory?

  • It follows the same directory structure as opencode's code to prevent confusing standards

How to start with a custom system prompt?

dan-and and others added 3 commits January 6, 2026 18:29
priority:
- global at ~/.config/opencode/prompt/
- project level at <project root directory>/.opencode/prompt
- env variable: OPENCODE_PROMPT_DIR
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR that may be relevant to custom system prompt handling:

Related PR:

However, this is an older PR and may not be a direct duplicate. The current PR #7264 is specifically about adding a priority-based override system for custom system prompts across multiple directories (environment variable, project-level, global config, and bundled defaults).

No other duplicate PRs addressing the same feature (custom system prompts with directory hierarchy) were found in the search results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant