You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
I want to provide global agent configuration, global commands - e.g. /etc/opencode/agent/xx.md and /etc/opencode/commands/xx.md - all which can be configured in ~/.config/opencode/ as a predefined value (for all team members).
So opencode should search all configuration data in /etc/opencode and ~/.config/opencode/.
In my opinion, the global must have the highest priority without it being able to be overwritten.
But maybe it would be even better if it can be forced that the global or user/project has priority and can not be overwritten or if it should get merged (json) in which direction.
This issue might be a duplicate of existing issues. Please check:
opencode.json/config.json search path #3407: [opencode.json/config.json search path] - This issue discusses the exact same concern about using /etc/opencode for system-wide configuration instead of /opencode.json. The author specifically suggests using /etc/opencode.json or /etc/opencode/opencode.json for central configuration, which aligns perfectly with your request for global configuration in /etc/opencode.
Feel free to ignore if none of these address your specific case.
@rekram1-node Really helpful - thank you! But I can't enforce these settings - so if somebody forgets to set the variable, he can select providers or agents which are not allowed here and he doesn't use the same settings for agents ...
and then throw that in a rnadom json file then use env var to point at it, if u run opencode, open models drop down and type "custom" you will see the model
Note that configs aren't live reloaded you need to restart opencode after config changes
Activity
github-actions commentedon Oct 24, 2025
This issue might be a duplicate of existing issues. Please check:
/etc/opencodefor system-wide configuration instead of/opencode.json. The author specifically suggests using/etc/opencode.jsonor/etc/opencode/opencode.jsonfor central configuration, which aligns perfectly with your request for global configuration in/etc/opencode.Feel free to ignore if none of these address your specific case.
rekram1-node commentedon Oct 24, 2025
@arlt if you set
OPENCODE_CONFIGto that file path it will read it in and override any other conflicting settingsYou can also use
OPENCODE_CONFIG_CONTENTto provide a literal json string and same thing it will override any other conflicting settingsDoes that work for you?
arlt commentedon Oct 24, 2025
@rekram1-node Really helpful - thank you! But I can't enforce these settings - so if somebody forgets to set the variable, he can select providers or agents which are not allowed here and he doesn't use the same settings for agents ...
rekram1-node commentedon Oct 24, 2025
That's true
arlt commentedon Oct 24, 2025
@rekram1-node hmm i am not sure, but it seems not to work:
nothing
btw: this would only help for opencode.json, not for build.md ...
rekram1-node commentedon Oct 24, 2025
good point
OPENCODE_CONFIG does work, you can see it visually if you make up some provider like:
and then throw that in a rnadom json file then use env var to point at it, if u run opencode, open models drop down and type "custom" you will see the model
Note that configs aren't live reloaded you need to restart opencode after config changes
arlt commentedon Oct 27, 2025
Ah - damn. Forgot to export - sorry! You are right.
But the problem remains with all other config settings (agent, commands, ...).
rekram1-node commentedon Oct 27, 2025
yeah perhaps an OPENCODE_CONFIG_DIR?
someone else wanted to define their agents in a cystom folder I think if we made a config dir var that would solve your case right?
arlt commentedon Oct 27, 2025
yes this would help to provide a global setting (big step) - but it won't help to force some settings.
rekram1-node commentedon Oct 28, 2025
added support for loading configs from specified dir
OPENCODE_CONFIG_DIRit will be in next release