[FEATURE]:global configuration /etc/opencode #2262

Closed
opened 2026-02-16 17:34:52 -05:00 by yindo · 10 comments
Owner

Originally created by @arlt on GitHub (Oct 24, 2025).

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

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.

Originally created by @arlt on GitHub (Oct 24, 2025). ### 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 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.
yindo added the discussion label 2026-02-16 17:34:52 -05:00
yindo closed this issue 2026-02-16 17:34:52 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 24, 2025):

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

  • #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.

@github-actions[bot] commented on GitHub (Oct 24, 2025): This issue might be a duplicate of existing issues. Please check: - #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.
Author
Owner

@rekram1-node commented on GitHub (Oct 24, 2025):

@arlt if you set OPENCODE_CONFIG to that file path it will read it in and override any other conflicting settings

You can also use OPENCODE_CONFIG_CONTENT to provide a literal json string and same thing it will override any other conflicting settings

Does that work for you?

@rekram1-node commented on GitHub (Oct 24, 2025): @arlt if you set `OPENCODE_CONFIG` to that file path it will read it in and override any other conflicting settings You can also use `OPENCODE_CONFIG_CONTENT` to provide a literal json string and same thing it will override any other conflicting settings Does that work for you?
Author
Owner

@arlt commented on GitHub (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 ...

@arlt commented on GitHub (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 ...
Author
Owner

@rekram1-node commented on GitHub (Oct 24, 2025):

That's true

@rekram1-node commented on GitHub (Oct 24, 2025): That's true
Author
Owner

@arlt commented on GitHub (Oct 24, 2025):

@rekram1-node hmm i am not sure, but it seems not to work:

$ OPENCODE_CONFIG=$HOME/xxx.json; strace -fo log /opt/npm/bin/opencode 
$ grep xxx log

nothing

btw: this would only help for opencode.json, not for build.md ...

@arlt commented on GitHub (Oct 24, 2025): @rekram1-node hmm i am not sure, but it seems not to work: ``` $ OPENCODE_CONFIG=$HOME/xxx.json; strace -fo log /opt/npm/bin/opencode $ grep xxx log ``` nothing btw: this would only help for opencode.json, not for build.md ...
Author
Owner

@rekram1-node commented on GitHub (Oct 24, 2025):

btw: this would only help for opencode.json, not for build.md ...

good point

OPENCODE_CONFIG does work, you can see it visually if you make up some provider like:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "custom": {
      "models": {
        "custoom": {
          "options": {
            "reasoningEffort": "low",
            "reasoningSummary": "auto",
            "include": ["reasoning.encrypted_content"]
          }
        }
      }
    }
  }
}

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

@rekram1-node commented on GitHub (Oct 24, 2025): > btw: this would only help for opencode.json, not for build.md ... good point OPENCODE_CONFIG does work, you can see it visually if you make up some provider like: ``` { "$schema": "https://opencode.ai/config.json", "provider": { "custom": { "models": { "custoom": { "options": { "reasoningEffort": "low", "reasoningSummary": "auto", "include": ["reasoning.encrypted_content"] } } } } } } ``` 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
Author
Owner

@arlt commented on GitHub (Oct 27, 2025):

Ah - damn. Forgot to export - sorry! You are right.
But the problem remains with all other config settings (agent, commands, ...).

@arlt commented on GitHub (Oct 27, 2025): Ah - damn. Forgot to export - sorry! You are right. But the problem remains with all other config settings (agent, commands, ...).
Author
Owner

@rekram1-node commented on GitHub (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?

@rekram1-node commented on GitHub (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?
Author
Owner

@arlt commented on GitHub (Oct 27, 2025):

yes this would help to provide a global setting (big step) - but it won't help to force some settings.

@arlt commented on GitHub (Oct 27, 2025): yes this would help to provide a global setting (big step) - but it won't help to force some settings.
Author
Owner

@rekram1-node commented on GitHub (Oct 28, 2025):

added support for loading configs from specified dir OPENCODE_CONFIG_DIR it will be in next release

@rekram1-node commented on GitHub (Oct 28, 2025): added support for loading configs from specified dir `OPENCODE_CONFIG_DIR` it will be in next release
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2262