Skip to content

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

Closed

Description

@arlt

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.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Oct 24, 2025
  2. github-actions commented on Oct 24, 2025

    @github-actions
    Contributor

    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.

  3. rekram1-node commented on Oct 24, 2025

    @rekram1-node
    Collaborator

    @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?

  4. arlt commented on Oct 24, 2025

    @arlt
    Author

    @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 ...

  5. rekram1-node commented on Oct 24, 2025

    @rekram1-node
    Collaborator

    That's true

  6. arlt commented on Oct 24, 2025

    @arlt
    Author

    @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 ...

  7. rekram1-node commented on Oct 24, 2025

    @rekram1-node
    Collaborator

    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

  8. arlt commented on Oct 27, 2025

    @arlt
    Author

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

  9. rekram1-node commented on Oct 27, 2025

    @rekram1-node
    Collaborator

    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?

  10. arlt commented on Oct 27, 2025

    @arlt
    Author

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

  11. rekram1-node commented on Oct 28, 2025

    @rekram1-node
    Collaborator

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionUsed for feature requests, proposals, ideas, etc. Open discussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions